/* ==========================================================================
   WorkBuddy 主题覆盖层（字体 / 字号 / 图标）
   --------------------------------------------------------------------------
   1) 字体：与 WorkBuddy 应用完全一致的系统字体栈
        -apple-system, BlinkMacSystemFont, "PingFang SC", Helvetica, Arial,
        "Microsoft YaHei", "微软雅黑", sans-serif
      移除 Google Fonts 的 Inter 外链依赖（离线环境下外链会挂起页面加载）。
   2) 字号：按 WorkBuddy 的 token 阶梯映射到 Metronic 的 fs-* 工具类
        --wb-font-size-3 12px  → fs-9 / fs-10
        --wb-font-size-4 13px  → fs-8
        --wb-font-size-5 14px  → fs-7 / fs-6（正文）
        --wb-font-size-6 16px  → fs-5 / fs-4（标题）
        --wb-font-size-7 18px  → fs-3
        --wb-font-size-8 20px  → fs-2
        --wb-font-size-9 24px  → fs-1
   3) 图标：新增 wb-icon-* 蓝底方块图标（替代线性 ki-pencil / ki-trash）
   ========================================================================== */

/* ---------- 1. 字体族 ---------- */
:root {
    --wb-font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", Helvetica, Arial,
        "Microsoft YaHei", "微软雅黑", "黑体", Heiti, sans-serif;
    --bs-font-sans-serif: var(--wb-font-family);
    --bs-body-font-family: var(--wb-font-family);
    /* WorkBuddy 正文 14px / 行高 1.7 */
    --bs-body-font-size: 14px;
    --bs-body-line-height: 1.7;
}

html,
body,
.app-default {
    font-family: var(--wb-font-family);
}

/* 覆盖 Metronic 在 body,html 上写死的 Inter */
body,
html {
    font-family: var(--wb-font-family);
}

/* Metronic 用 `body,html{font-size:13px!important}` 硬写了字号，
   必须用同等 !important 覆盖。
   注意：html 根字号保持 13px 不变 —— Metronic 全站 5400+ 处间距用 rem，
   放大根字号会把所有内边距/外边距/尺寸一起撑大 7.7%，破坏既有布局；
   这里只把 body 正文提到 WorkBuddy 的 14px，字号阶梯由下面的 fs-* 精确指定。 */
html {
    font-size: 13px !important;
}

body {
    font-size: 14px !important;
    line-height: 1.7;
}

/* ki 图标字体必须保留自身字体族，否则图标会变成方块 */
.ki-outline,
.ki-solid,
.ki-duotone {
    font-family: keenicons-outline !important;
}

/* ---------- 2. 字号阶梯 ---------- */
.fs-1  { font-size: 24px !important; }
.fs-2  { font-size: 20px !important; }
.fs-3  { font-size: 18px !important; }
.fs-4  { font-size: 16px !important; }
.fs-5  { font-size: 16px !important; }
.fs-6  { font-size: 14px !important; }
.fs-7  { font-size: 13px !important; }
.fs-8  { font-size: 12px !important; }
.fs-9  { font-size: 12px !important; }
.fs-10 { font-size: 10px !important; }
.fs-base { font-size: 14px !important; }
.fs-sm   { font-size: 13px !important; }

/* 页面标题 / 卡片标题 */
.page-heading,
.card-title,
.card-header .card-title,
.card .card-header .card-title {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0;
}

/* 标题元素统一到 WorkBuddy 字号阶梯（h1~h6） */
h1 {
    font-size: 18px;
    font-weight: 600;
}

h2 {
    font-size: 16px;
    font-weight: 600;
}

h3 {
    font-size: 16px;
    font-weight: 600;
}

h4,
h5,
h6 {
    font-size: 14px;
    font-weight: 600;
}

/* 登录页左侧品牌大标题保持醒目 */
.wb-brand-title {
    font-size: 24px;
    font-weight: 700;
}

/* 面包屑、辅助说明文字 */
.breadcrumb,
.form-text,
.text-muted.fs-7 {
    font-size: 12px;
}

/* 表格与表单控件沿用正文 14px */
.table {
    font-size: 14px;
}

.form-control,
.form-select,
.form-label,
.btn {
    font-size: 14px;
}

/* ---------- 3. 行内图标按钮（统一规格：见下方 .wb-act） ---------- */

/* 操作列按钮组：不换行，且文字按钮保持单行显示 */
.wb-actions {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
}

.wb-actions .btn {
    white-space: nowrap;
    flex: 0 0 auto;
}

/* ---------- 4. 图标操作按钮（列表操作列统一规格） ----------
   规格：28×28 圆角方块 / 圆角 8px / 图标 16px / 间距 6px
   浅色：功能按钮（预算、合同、日报、巡检、验收）
   主色：编辑  危险：删除                                            */
.wb-act {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: #f2f4f8;
    color: #5e6278;
    cursor: pointer;
    flex: 0 0 auto;
    transition: background-color .15s ease, color .15s ease;
}

.wb-act > i {
    display: block;
    font-size: 16px;
    line-height: 1;
    /* keenicons 自带 color 声明，必须显式继承按钮文字色 */
    color: inherit;
}

.wb-act:hover {
    background: #e6f2ff;
    color: #3e97ff;
}

/* 编辑：默认蓝 10% 透明底 + 实色图标，悬停实底白图标 */
.wb-act-primary {
    background: rgba(62, 151, 255, 0.1);
    color: #1d7fe8;
}

.wb-act-primary:hover {
    background: #3e97ff;
    color: #ffffff;
}

/* 信息（浅青）：查看/头像类辅助操作 */
.wb-act-info {
    background: rgba(0, 178, 160, 0.1);
    color: #00877a;
}

.wb-act-info:hover {
    background: #00b2a0;
    color: #ffffff;
}

/* 警告（橙）：停用/启用等状态类操作 */
.wb-act-warning {
    background: rgba(246, 161, 35, 0.1);
    color: #c77c08;
}

.wb-act-warning:hover {
    background: #f6a123;
    color: #ffffff;
}

/* ---------- 5. 全局确认弹窗（替代浏览器原生 confirm） ---------- */
.wb-confirm-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.wb-confirm-icon.danger  { background: rgba(241, 65, 108, 0.08); color: #f1416c; }
.wb-confirm-icon.warning { background: rgba(246, 161, 35, 0.12); color: #c77c08; }
.wb-confirm-icon.info    { background: rgba(62, 151, 255, 0.08); color: #3e97ff; }

/* 删除：默认红 10% 透明底 + 实色图标，悬停实底白图标 */
.wb-act-danger {
    background: rgba(241, 65, 108, 0.1);
    color: #d9214e;
}

.wb-act-danger:hover {
    background: #f1416c;
    color: #ffffff;
}

/* 功能按钮配色：默认背景为对应色 10% 透明 + 实色图标，悬停变为实底白图标 */
.wb-act-purple { background: rgba(114, 57, 234, 0.1); color: #5f21d8; }
.wb-act-purple:hover { background: #7239ea; color: #ffffff; }

.wb-act-indigo { background: rgba(67, 97, 238, 0.1); color: #2f4dd6; }
.wb-act-indigo:hover { background: #4361ee; color: #ffffff; }

.wb-act-teal { background: rgba(0, 178, 160, 0.1); color: #00877a; }
.wb-act-teal:hover { background: #00b2a0; color: #ffffff; }

.wb-act-green { background: rgba(80, 205, 137, 0.1); color: #2f9e63; }
.wb-act-green:hover { background: #50cd89; color: #ffffff; }

.wb-act-orange { background: rgba(246, 161, 35, 0.1); color: #c77c08; }
.wb-act-orange:hover { background: #f6a123; color: #ffffff; }

/* ---------- 5. 列表表格：文本左对齐、仅姓名加粗 ---------- */
.wb-table th,
.wb-table td {
    text-align: left;
}

.wb-table thead th {
    font-weight: 500;
}

.wb-table tbody td {
    font-weight: 400;
}

/* 姓名是唯一需要强调的字段 */
.wb-table tbody td .wb-strong {
    font-weight: 600;
    color: #181c32;
}

/* 标签类不加粗，避免整行显得过重 */
.wb-table .badge {
    font-weight: 500;
}

/* 表格内不换行：保证列宽稳定，长内容由容器横向滚动承接 */
.wb-nowrap th,
.wb-nowrap td {
    white-space: nowrap;
}
.wb-nowrap td.wb-wrap,
.wb-nowrap th.wb-wrap {
    white-space: normal;
}

/* 表单辅助说明：不换行，保持单行紧凑 */
.wb-help {
    font-size: 12px;
    white-space: nowrap;
    margin-top: 6px;
}

/* ---------- 6. 弹窗内嵌页（iframe）最大化 ----------
   外层只保留遮罩的灰，内嵌页白底通栏、零内边距，与弹窗完全齐平 */
html:has(body.wb-embed),
body.wb-embed {
    background: #ffffff !important;
}

/* Metronic 容器写死了 50px 左右内边距，内嵌时强制清零 */
body.wb-embed .app-container {
    padding: 0 !important;
    max-width: none !important;
    margin: 0 !important;
}

body.wb-embed .card {
    box-shadow: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
    border: 0 !important;
}

/* 卡片头保留底部分隔线即可，去掉首行大间距 */
body.wb-embed .card-header {
    padding-top: 1.25rem;
}

/* 弹窗右上角悬浮关闭按钮（无 header 白条，内容区直接顶到弹窗边） */
.wb-modal-close {
    position: absolute;
    top: 10px;
    right: 12px;
    z-index: 1057;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 6px;
}

/* ---------- 7. 表单紧凑化（全局） ----------
   Metronic 默认输入框字号 1.1rem、内边距 .775rem 1rem，过高过大 */
.form-control,
.form-select {
    padding: 0.3rem 0.65rem;
    font-size: 13px;
    line-height: 1.45;
}

textarea.form-control {
    min-height: auto;
}

.input-group-text {
    padding: 0.3rem 0.65rem;
    font-size: 13px;
}

.form-label {
    margin-bottom: 0.3rem;
    font-size: 13px;
}

.form-text {
    margin-top: 0.2rem;
    font-size: 12px;
}

/* Select2 跟随紧凑尺寸 */
.select2-container--bootstrap5 .select2-selection {
    min-height: 32px;
    padding: 0.3rem 0.65rem;
    font-size: 13px;
}

.select2-container--bootstrap5 .select2-selection--single .select2-selection__rendered {
    padding-top: 0;
    line-height: 24px;
    font-size: 13px;
}

.select2-container--bootstrap5 .select2-selection--single .select2-selection__arrow {
    height: 24px;
}

/* Select2 下拉列表紧凑化（含弹窗内） */
.select2-container--bootstrap5 .select2-dropdown {
    font-size: 13px;
    z-index: 1056;
}

.select2-container--bootstrap5 .select2-search {
    padding: 6px 10px 2px;
}

.select2-container--bootstrap5 .select2-search input {
    padding: 0.3rem 0.65rem;
    font-size: 13px;
    min-height: 32px;
}

.select2-container--bootstrap5 .select2-results__option {
    padding: 0.4rem 0.75rem;
    font-size: 13px;
    color: #3f4254;
}

.select2-container--bootstrap5 .select2-results__option.select2-results__option--highlighted {
    background: #f1faff;
    color: #009ef7;
}

.select2-container--bootstrap5 .select2-results__option[aria-selected="true"] {
    background: #f9f9f9;
    color: #3f4254;
}

/* 弹窗内的下拉列表跟随弹窗定位，不超出边界 */
.modal .select2-container--bootstrap5 {
    width: 100% !important;
}


/* 页面标题/面包屑与下方内容的间距加大 */
#kt_app_toolbar { padding-bottom: 4px; margin-bottom: 14px; }

/* 预算明细表：每行浅灰色分隔线 */
.wb-row-line tbody tr td { border-bottom: 1px solid var(--bs-gray-300, #e8e9eb) !important; }

/* ---------- 8. 表单控件可见化 ----------
   默认的「transparent / solid」变体把输入框做成无边框、近乎透明的文字样式，
   导致筛选栏、配置表单等全站表单辨识度极低（看起来像纯文本）。
   这里统一补上可见边框 + 浅灰底，并加深占位符，使控件一眼可辨。 */
.form-control-transparent,
.form-select-transparent,
.form-control-solid,
.form-select-solid {
    background-color: #f7f8fa !important;
    border: 1px solid #d7dae0 !important;
    color: #3f4254 !important;
}

.form-control-transparent:focus,
.form-select-transparent:focus,
.form-control-solid:focus,
.form-select-solid:focus {
    background-color: #ffffff !important;
    border-color: #3e97ff !important;
    box-shadow: 0 0 0 0.15rem rgba(62, 151, 255, 0.18) !important;
    color: #181c32 !important;
}

.form-control-transparent::placeholder,
.form-control-solid::placeholder {
    color: #8b8fa3 !important;
    opacity: 1 !important;
}

/* 防止 inline py-0 / lh-1 把透明控件压得过扁：统一给一个舒适的最小高度与内边距 */
.form-control-transparent,
.form-control-solid {
    min-height: 34px;
    padding-top: 0.4rem !important;
    padding-bottom: 0.4rem !important;
}

/* Select2 选择框（筛选栏 / 弹窗下拉等同款）也补可见边框，避免只剩箭头看不出范围 */
.select2-container--bootstrap5 .select2-selection {
    border: 1px solid #d7dae0 !important;
    background-color: #f7f8fa !important;
}

.select2-container--bootstrap5.select2-container--open .select2-selection,
.select2-container--bootstrap5 .select2-selection:focus,
.select2-container--bootstrap5 .select2-selection--single:focus {
    border-color: #3e97ff !important;
    background-color: #ffffff !important;
}

/* ============================================================
   轻量富文本编辑器（施工日志/巡检/验收）
   ============================================================ */
.wb-editor {
    border: 1px solid #d7dae0;
    border-radius: 6px;
    background: #ffffff;
    overflow: hidden;
}
.wb-editor-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 6px 8px;
    border-bottom: 1px solid #eef0f4;
    background: #f7f8fa;
    flex-wrap: wrap;
}
.wb-editor-toolbar button {
    border: 1px solid transparent;
    background: transparent;
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 12px;
    color: #4b5675;
    cursor: pointer;
    line-height: 1.4;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.wb-editor-toolbar button:hover {
    background: #e9ebf1;
    color: #181c32;
}
.wb-editor-sep {
    width: 1px;
    height: 16px;
    background: #d7dae0;
    margin: 0 4px;
}
.wb-editor-body {
    min-height: 140px;
    max-height: 320px;
    overflow-y: auto;
    padding: 10px 12px;
    font-size: 14px;
    line-height: 1.7;
    color: #30364b;
    outline: none;
}
.wb-editor-body:empty::before {
    content: attr(data-placeholder);
    color: #a1a5b7;
    pointer-events: none;
}
.wb-editor-body:focus {
    box-shadow: inset 0 0 0 2px rgba(62, 151, 255, 0.08);
}
.wb-editor-status {
    margin-left: auto;
}

/* 网盘在线预览（Word / Excel 解析渲染） */
.of-preview {
    background: #fff;
    border: 1px solid #e4e6ee;
    border-radius: 10px;
    padding: 22px 26px;
    max-height: 74vh;
    overflow: auto;
}
.of-preview-xl { padding: 16px; }
.of-p {
    margin: 0 0 10px;
    line-height: 1.9;
    color: #3f4a63;
}
.of-h {
    margin: 18px 0 10px;
    font-weight: 700;
    color: #1f2b4d;
}
.of-h1 { font-size: 21px; }
.of-h2 { font-size: 18px; }
.of-h3 { font-size: 16px; }
.of-h4 { font-size: 15px; }
.of-img {
    max-width: 100%;
    border-radius: 6px;
    margin: 6px 0;
}
.of-img-full {
    display: block;
    max-width: 100%;
    margin: 0 auto;
    border-radius: 8px;
}
.of-pdf {
    width: 100%;
    height: 72vh;
    border: 0;
    border-radius: 6px;
}
.of-tbl {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0 16px;
}
.of-tbl td {
    border: 1px solid #dfe3ee;
    padding: 6px 9px;
    vertical-align: top;
    font-size: 13px;
}
.of-td-p { margin: 0 0 4px; line-height: 1.7; }
.of-xl {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.of-xl td {
    border: 1px solid #dfe3ee;
    padding: 5px 8px;
    vertical-align: top;
    white-space: pre-wrap;
    word-break: break-word;
}
.of-xl tr:nth-child(even) td { background: #fafbfe; }
.of-txt {
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 13px;
    line-height: 1.8;
    color: #3f4a63;
    margin: 0;
}
.of-sheet-tabs { border-bottom: 1px solid #e4e6ee; }

/* 电子相册（协同办公）：卡片 / 内容管理 / 翻页画册 */
.album-card {
    border: 1px solid #e4e6ee;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    height: 100%;
    transition: box-shadow .15s ease, transform .15s ease;
}
.album-card:hover {
    box-shadow: 0 10px 26px rgba(20, 25, 40, .10);
    transform: translateY(-2px);
}
.album-cover {
    position: relative;
    background: #f7f8fa;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}
.album-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.album-cover-empty {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #b5bccd;
}
.album-cover-badges {
    position: absolute;
    top: 10px; left: 10px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.album-cover-act {
    position: absolute;
    left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    background: rgba(20, 25, 40, .62);
    color: #fff;
    padding: 7px 14px;
    border-radius: 20px;
    font-size: 12px;
    opacity: 0;
    transition: opacity .15s ease;
    white-space: nowrap;
}
.album-cover:hover .album-cover-act { opacity: 1; }
.album-share {
    display: flex;
    align-items: center;
    background: #f4f7fb;
    border: 1px dashed #c9d3e6;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 12px;
    color: #5a6785;
}
.album-share-url { flex: 1; min-width: 0; }

/* 内容管理缩略图 */
.album-thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    gap: 10px;
    max-height: 320px;
    overflow-y: auto;
    padding: 4px;
}
.album-thumb {
    position: relative;
    border: 1px solid #e4e6ee;
    border-radius: 8px;
    overflow: hidden;
    background: #f7f8fa;
}
.album-thumb-img { display: block; }
.album-thumb-img img {
    width: 100%;
    height: 82px;
    object-fit: cover;
    display: block;
}
.album-thumb-pdf {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 82px;
    color: #6b7794;
    gap: 2px;
}
.album-thumb-no {
    position: absolute;
    top: 3px; left: 5px;
    background: rgba(20, 25, 40, .55);
    color: #fff;
    font-size: 11px;
    border-radius: 4px;
    padding: 0 5px;
}
.album-thumb-cover {
    position: absolute;
    bottom: 3px; left: 4px;
    background: #f5b942;
    color: #fff;
    font-size: 10px;
    border-radius: 4px;
    padding: 1px 5px;
}
.album-thumb-ops {
    position: absolute;
    top: 3px; right: 3px;
    display: none;
    gap: 2px;
    background: rgba(20, 25, 40, .55);
    border-radius: 5px;
    padding: 1px;
}
.album-thumb-ops a {
    color: #fff;
    padding: 2px 3px;
    line-height: 1;
}
.album-thumb-ops a:hover { color: #7cd1ff; }
.album-thumb-del {
    position: absolute;
    bottom: 3px; right: 4px;
    color: #fff;
    opacity: 0;
    transition: opacity .15s ease;
}
.album-thumb:hover .album-thumb-ops,
.album-thumb:hover .album-thumb-del { opacity: 1; display: flex; }
.album-thumb-del:hover { color: #ff8a8a; }
.album-manage {
    border: 1px dashed #c9d3e6;
    border-radius: 8px;
    padding: 6px;
    min-height: 90px;
}

/* 翻页画册 */
.album-viewer {
    background: #f7f8fa;
    border: 1px solid #e4e6ee;
    border-radius: 12px;
    padding: 16px;
}
.album-viewer-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.album-stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: #1c2233;
    border-radius: 10px;
    padding: 14px;
    min-height: 420px;
}
.album-page {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 390px;
}
.album-page img {
    max-width: min(1100px, 92%);
    max-height: 78vh;
    border-radius: 6px;
    background: #fff;
}
.album-pdf {
    width: min(1100px, 96%);
    height: 78vh;
    border: 0;
    border-radius: 6px;
    background: #fff;
}
.album-nav {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    border: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.album-nav:hover { background: rgba(255, 255, 255, .26); }
.album-counter {
    position: absolute;
    right: 12px; bottom: 8px;
    color: rgba(255, 255, 255, .72);
    font-size: 12px;
}
.album-strip {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    margin-top: 12px;
    padding-bottom: 4px;
}
.album-strip-item {
    flex: 0 0 auto;
    width: 78px;
    height: 56px;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid transparent;
    background: #fff;
    padding: 0;
}
.album-strip-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.album-strip-item.active { border-color: #3b82f6; }
.album-strip-pdf {
    display: flex; align-items: center; justify-content: center;
    height: 100%; font-size: 12px; color: #6b7794;
}

/* 内容展示区：图片缩略图 70×70，点击看原图 */
.wb-rich img.wb-thumb,
.wb-rich img,
.wb-editor-body img.wb-thumb,
.wb-editor-body img {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e4e6ee;
    cursor: zoom-in;
    margin: 3px 6px 3px 0;
    vertical-align: middle;
}

/* 灯箱：点缩略图查看原图（限宽 960） */
.wb-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: rgba(20, 25, 40, 0.72);
    backdrop-filter: blur(2px);
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}
.wb-lightbox.show {
    display: flex;
}
.wb-lightbox img {
    max-width: min(960px, 92vw);
    max-height: 88vh;
    border-radius: 8px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
    background: #fff;
}
