/* ============================================================
   ACE 国际企业级智能管理平台 - UI 规范实现
   设计令牌：深海军蓝 + 科技靛蓝 + 语义色
   ============================================================ */
/* 默认主题：中国红·喜庆风（点击顶部 🎨 可切换） */
:root, body[data-theme="red"] {
  --bg: #fdf3ee;
  --surface: #ffffff;
  --surface-2: #f7eae3;
  --sidebar-bg: #7f1d1d;
  --sidebar-active: #c0392b;
  --sidebar-text: #f4d6c9;
  --primary: #c0392b;
  --primary-dark: #a93226;
  --accent: #e67e22;
  --success: #27ae60;
  --warning: #e67e22;
  --danger: #e74c3c;
  --info: #16a085;
  --text: #2c3e50;
  --text-light: #7f8c8d;
  --border: #eccfc3;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(127,29,29,.06), 0 4px 14px rgba(127,29,29,.05);
  --font: "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
}
/* 天蓝·明亮浅色风 */
body[data-theme="blue"] {
  --bg: #f0f6ff;
  --surface: #ffffff;
  --surface-2: #e8f0fb;
  --sidebar-bg: #1e3a5f;
  --sidebar-active: #2563eb;
  --sidebar-text: #c3d5ef;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --accent: #0ea5e9;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #0891b2;
  --text: #1e293b;
  --text-light: #64748b;
  --border: #d8e4f3;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(30,58,95,.06), 0 4px 14px rgba(30,58,95,.05);
  --font: "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
}
/* 青绿·江南清雅风 */
body[data-theme="green"] {
  --bg: #f0faf7;
  --surface: #ffffff;
  --surface-2: #e4f3ee;
  --sidebar-bg: #134e4a;
  --sidebar-active: #0f766e;
  --sidebar-text: #c6e5de;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --accent: #14b8a6;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #0891b2;
  --text: #1f2937;
  --text-light: #64748b;
  --border: #cfe9e2;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(19,78,74,.06), 0 4px 14px rgba(19,78,74,.05);
  --font: "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
}
/* 金色·庄重风 */
body[data-theme="gold"] {
  --bg: #fbf7ee;
  --surface: #ffffff;
  --surface-2: #f3ead7;
  --sidebar-bg: #5b3a1e;
  --sidebar-active: #b45309;
  --sidebar-text: #ecd9b8;
  --primary: #b45309;
  --primary-dark: #92400e;
  --accent: #d97706;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #0891b2;
  --text: #38302a;
  --text-light: #7c6f5f;
  --border: #e7d9bd;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(91,58,30,.07), 0 4px 14px rgba(91,58,30,.05);
  --font: "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 236px; background: var(--sidebar-bg); color: var(--sidebar-text);
  display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0;
  transition: transform .25s ease; z-index: 50;
}
.main { flex: 1; margin-left: 236px; display: flex; flex-direction: column; min-width: 0; transition: margin .25s ease; }

/* 折叠 */
body.sidebar-collapsed .sidebar { transform: translateX(-100%); }
body.sidebar-collapsed .main { margin-left: 0; }

/* ---------- 移动端（手机/平板，≤900px） ---------- */
@media (max-width: 900px) {
  .sidebar { box-shadow: 6px 0 24px rgba(0,0,0,.35); }
  .main { margin-left: 0; }
  .topbar { padding: 0 10px; gap: 8px; }
  .page-title { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar-right { gap: 4px; }
  .topbar-right .chip { display: none; }
  .user-btn span:not(.avatar) { display: none; }
  .content { padding: 12px 10px 66px; }  /* 底部导航留白（V5.0 规范）2026-08-26 */
  .card-head { flex-wrap: wrap; gap: 8px; }
}

/* ---------- 移动端底部导航（V5.0 规范，≤900px 显示）2026-08-26 ---------- */
.mob-nav { display: none; }
@media (max-width: 900px) {
  .mob-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: 58px;
    background: var(--surface,#fff); border-top: 1px solid var(--border,#e2e8f0);
    z-index: 60; box-shadow: 0 -4px 16px rgba(15,23,42,.06);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .mob-nav-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; color: var(--text-light,#64748b); text-decoration: none; font-size: 10.5px;
  }
  .mob-nav-item .mob-ico { font-size: 20px; line-height: 1; }
  .mob-nav-item.active { color: var(--primary,#1d4ed8); font-weight: 600; }
  .mob-nav-item.active .mob-ico { transform: translateY(-1px); }
}

/* ---------- 更多选项折叠组件（移动端少字段模式 V5.0 规范，2026-08-26）----------
   通用：详情折叠，桌面端恒展开、移动端收起可展开；用于现场登记页把可选高级字段收进「更多选项」 */
.wf-more { border: 1px dashed var(--border,#cbd5e1); border-radius: 10px; background: #f8fafc; padding: 6px 12px 8px; }
.wf-more summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--primary,#1d4ed8); padding: 6px 0; user-select: none; list-style: none; display: flex; align-items: center; gap: 4px; }
.wf-more summary::-webkit-details-marker { display: none; }
.wf-more summary::after { content: '▾'; margin-left: 4px; transition: transform .15s; }
.wf-more[open] summary::after { transform: rotate(180deg); }
@media (min-width: 901px) {
  .wf-more { border: none; border-radius: 0; background: transparent; padding: 0; }
  .wf-more summary { display: none; }
}

/* ---------- 侧边栏 ---------- */
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-logo { width: 38px; height: 38px; }
.brand-name { color: #fff; font-weight: 700; font-size: 14px; letter-spacing: .5px; }
.brand-sub { font-size: 11px; color: var(--sidebar-text); opacity: .8; }
.nav { flex: 1; overflow-y: auto; padding: 10px 10px 20px; }
.nav::-webkit-scrollbar { width: 5px; }
.nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 3px; }
.nav-group { font-size: 11px; color: #8a9bb8; text-transform: uppercase; letter-spacing: 1px; padding: 18px 12px 8px; font-weight: 600; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px; margin: 3px 0;
  border-radius: 8px; color: var(--sidebar-text); text-decoration: none; font-size: 13.5px;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; box-shadow: 0 4px 12px rgba(37,99,235,.35); }
.nav-ico { width: 20px; text-align: center; font-size: 15px; }
.nav-collapse { margin: 2px 0; }
.nav-collapse summary {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; margin: 2px 0;
  border-radius: 8px; color: var(--sidebar-text); text-decoration: none; font-size: 13px;
  cursor: pointer; opacity: .75; list-style: none; transition: background .15s, color .15s;
}
.nav-collapse summary::-webkit-details-marker { display: none; }
.nav-collapse summary:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-collapse .nav-item { padding-left: 26px; font-size: 13px; opacity: .85; }
.site-block {
  display: flex; flex-direction: column; gap: 2px; padding: 10px 16px; min-width: 130px;
  border-radius: 12px; border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; text-align: left; transition: all .15s;
}
.site-block:hover { border-color: var(--primary); transform: translateY(-1px); box-shadow: 0 3px 10px rgba(37,99,235,.12); }
.site-block.active { border-color: var(--primary); background: linear-gradient(135deg, #eff6ff, #e0f2fe); box-shadow: 0 3px 12px rgba(37,99,235,.18); }
.site-block .sb-name { font-weight: 700; font-size: 14px; color: #0f172a; }
.site-block.active .sb-name { color: var(--primary); }
.site-block .sb-meta { font-size: 12px; color: var(--text-light); }

/* ---------- 顶栏 ---------- */
.topbar {
  height: 58px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px; padding: 0 22px; position: sticky; top: 0; z-index: 40;
}
.icon-btn { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-light); padding: 4px 8px; border-radius: 6px; }
.icon-btn:hover { background: var(--bg); color: var(--primary); }
.page-title { font-size: 16px; font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.chip { background: var(--bg); border: 1px solid var(--border); color: var(--text-light); padding: 3px 10px; border-radius: 20px; font-size: 12px; }
.chip-role { background: rgba(37,99,235,.08); color: var(--primary); border-color: rgba(37,99,235,.2); }

/* 用户菜单 */
.user-menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 8px; background: none; border: none; cursor: pointer; font-size: 13.5px; color: var(--text); padding: 4px 8px; border-radius: 8px; }
.user-btn:hover { background: var(--bg); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; }
.caret { font-size: 10px; color: var(--text-light); }
.dropdown {
  display: none; position: absolute; right: 0; top: 42px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  min-width: 150px; padding: 6px; z-index: 60;
}
.dropdown a { display: block; padding: 8px 12px; text-decoration: none; color: var(--text); border-radius: 6px; font-size: 13px; }
.dropdown a:hover { background: var(--bg); color: var(--primary); }
.user-menu.open .dropdown { display: block; }

/* ---------- 顶栏一键切换公司 ---------- */
.ws-switch-btn { font-weight: 600; }
.ws-switch-name { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-dropdown { min-width: 260px; padding: 8px; }
.ws-dd-head { font-size: 12px; color: var(--text-light); font-weight: 600; padding: 4px 8px 8px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.ws-dd-list { max-height: 300px; overflow-y: auto; }
.ws-dd-empty { font-size: 12.5px; color: var(--text-light); padding: 14px 8px; text-align: center; }
.ws-dd-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; }
.ws-dd-item:hover { background: var(--bg); }
.ws-dd-item .ws-dd-t { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.ws-dd-item .ws-dd-sub { font-size: 11.5px; color: var(--text-light); }
.ws-dd-item .ws-dd-t, .ws-dd-item .ws-dd-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-dd-item > div { min-width: 0; flex: 1; }
.ws-dd-item.cur { background: #f0fdf4; border: 1px solid #bbf7d0; }
.ws-dd-item.cur .ws-dd-t { color: #15803d; }
.ws-dd-cur { background: #16a34a; color: #fff; border-radius: 999px; padding: 0 7px; font-size: 10.5px; font-weight: 700; }
.ws-dd-btn { flex-shrink: 0; }
.ws-dd-foot { display: block !important; margin-top: 6px; padding-top: 8px !important; border-top: 1px solid var(--border); text-align: center; font-size: 12px !important; color: var(--primary) !important; }

/* ---------- 内容区 ---------- */
.content { padding: 22px; flex: 1; }
.flash-area { padding: 0 22px; }
.flash { padding: 10px 14px; border-radius: 8px; margin-top: 12px; font-size: 13.5px; position: relative; animation: slideIn .25s ease; }
.flash-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.flash-danger { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.flash-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.flash-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.flash-close { position: absolute; right: 8px; top: 6px; border: none; background: none; font-size: 16px; cursor: pointer; color: inherit; opacity: .6; }
@keyframes slideIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; } }

/* ---------- 卡片 ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; }
.card-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.card-title { font-size: 15px; font-weight: 600; }
.card-body { padding: 18px; }
.card-body.pad-sm { padding: 12px 18px; }

/* ---------- 统计卡 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 14px; }
.stat-ico { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; color: #fff; flex-shrink: 0; }
.stat-ico.blue { background: linear-gradient(135deg, #2563eb, #0ea5e9); }
.stat-ico.green { background: linear-gradient(135deg, #16a34a, #4ade80); }
.stat-ico.orange { background: linear-gradient(135deg, #d97706, #fbbf24); }
.stat-ico.red { background: linear-gradient(135deg, #dc2626, #f87171); }
.stat-ico.purple { background: linear-gradient(135deg, #7c3aed, #a78bfa); }
.stat-ico.teal { background: linear-gradient(135deg, #0d9488, #2dd4bf); }
.stat-num { font-size: 22px; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: 12.5px; color: var(--text-light); }
.stat-sub { font-size: 12px; color: var(--text-light); margin-top: 2px; }

/* ==================== 仪表盘深化 · 企业总驾驶舱 ==================== */
.mt-2 { margin-top: 18px; }

/* ---------- Hero 总览横幅 ---------- */
.dash-hero { position: relative; overflow: hidden; display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; background: linear-gradient(120deg, #0b1e3f 0%, #123a6b 52%, #0e7490 130%); border-radius: 18px; padding: 26px 30px; margin-bottom: 16px; box-shadow: 0 14px 34px rgba(11,30,63,.28); color: #fff; }
.dash-hero-grid { position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px); background-size: 42px 42px; }
.dash-hero-glow { position: absolute; right: -90px; top: -110px; width: 320px; height: 320px; border-radius: 50%; background: radial-gradient(circle, rgba(14,165,233,.4), transparent 65%); }
.dash-hero-left, .dash-hero-right { position: relative; z-index: 1; }
.dash-greet { font-size: 26px; font-weight: 800; letter-spacing: .5px; }
.dash-date { font-size: 13px; color: rgba(255,255,255,.78); margin-top: 4px; }
.dash-org { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.dash-org-chip { display: inline-flex; align-items: center; gap: 5px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18); border-radius: 999px; padding: 3px 12px; font-size: 12px; }
.dash-quick { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.dash-qbtn { display: inline-flex; align-items: center; gap: 5px; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.2); color: #fff; border-radius: 10px; padding: 7px 14px; font-size: 12.5px; text-decoration: none; transition: .18s; }
.dash-qbtn:hover { background: rgba(255,255,255,.26); transform: translateY(-1px); }
.health-box { display: flex; align-items: center; gap: 14px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16); border-radius: 16px; padding: 14px 22px; backdrop-filter: blur(6px); }
.health-svg { width: 108px; height: 108px; }
.health-title { font-size: 15px; font-weight: 700; }
.health-sub { font-size: 12px; color: rgba(255,255,255,.75); margin-top: 4px; max-width: 130px; line-height: 1.5; }

/* ---------- 今日待办横幅 ---------- */
.todo-banner { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; border-radius: 14px; padding: 12px 18px; margin-bottom: 16px; font-size: 13px; }
.todo-danger { background: linear-gradient(90deg, #fef2f2, #fff); border: 1px solid #fecaca; }
.todo-good { background: linear-gradient(90deg, #f0fdf4, #fff); border: 1px solid #bbf7d0; }
.todo-emoji { font-size: 22px; }
.todo-text { flex: 1; line-height: 1.9; }
.todo-count { color: #b91c1c; }
.todo-good .todo-count { color: #15803d; }
.todo-btn { flex-shrink: 0; }
.chip-badge { display: inline-block; padding: 1px 10px; margin: 2px 4px; border-radius: 999px; font-size: 12px; }
.chip-red { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.chip-orange { background: #ffedd5; color: #c2410c; border: 1px solid #fed7aa; }
.chip-amber { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

/* ---------- 🤖 AI 员工今日值班卡片 ---------- */
.ai-duty-card { border-radius: 14px; padding: 14px 18px; margin-bottom: 16px; background: linear-gradient(120deg, #0b1e3f, #123a6b 55%, #14532d 160%); color: #fff; box-shadow: 0 10px 26px rgba(11,30,63,.22); }
.ai-duty-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ai-duty-title { font-weight: 800; font-size: 15px; }
.ai-duty-sub { font-size: 12px; color: #bfdbfe; }
.ai-duty-body { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.ai-duty-item { flex: 1; min-width: 150px; background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.16); border-radius: 12px; padding: 10px 14px; display: flex; align-items: center; gap: 8px; }
.ai-duty-item b { font-size: 22px; font-weight: 800; color: #34d399; }
.ai-duty-item.warn b { color: #fcd34d; }
.ai-duty-item span { font-size: 12px; color: #e2e8f0; line-height: 1.5; }
.ai-duty-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.ai-duty-actions .btn-outline { border-color: rgba(255,255,255,.4); color: #fff; background: transparent; }
.ai-duty-actions .btn-outline:hover { background: rgba(255,255,255,.14); }

/* ---------- KPI 卡 ---------- */
.dash-kpis { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.kpi-body { flex: 1; min-width: 0; }
.stat-mini { background: linear-gradient(180deg, #f8fafc, var(--surface)); }
.stat-mini .stat-ico { width: 40px; height: 40px; font-size: 18px; }
.mini-link { color: var(--primary); font-weight: 600; text-decoration: none; }
.mini-link:hover { text-decoration: underline; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.dot-green { background: #16a34a; }
.dot-red { background: #dc2626; }
.dot-amber { background: #f59e0b; }
.trend-up { color: #dc2626; font-weight: 700; }
.trend-down { color: #16a34a; font-weight: 700; }

/* ---------- 成本趋势柱状图（升级） ---------- */
.dash-bar { height: 190px; }
.bar-peak .bar { background: linear-gradient(180deg, #f59e0b, #d97706); box-shadow: 0 0 14px rgba(245,158,11,.4); }
.bar-peak .bar-val { color: #d97706; }

/* ---------- 设备状态环形图 ---------- */
.donut-svg { width: 168px; height: 168px; flex-shrink: 0; }
.donut-legend { display: flex; flex-direction: column; gap: 8px; font-size: 13px; flex: 1; min-width: 120px; }
.lg-item { display: flex; align-items: center; gap: 8px; color: var(--text-light); }
.lg-item b { color: var(--text); margin-left: auto; }
.lg-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------- 横向条形图 ---------- */
.hbar-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.hbar-label { flex: 0 0 78px; font-size: 12.5px; color: var(--text); }
.hbar-track { flex: 1; height: 12px; background: #f1f5f9; border-radius: 6px; overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 6px; min-width: 2px; transition: width .5s; }
.hbar-val { flex: 0 0 88px; text-align: right; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- AI 洞察（强化） ---------- */
.ai-insight { padding: 11px 2px; }
.ins-ico { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0; }
.ins-danger { background: #fef2f2; }
.ins-warn { background: #fffbeb; }
.ins-info { background: #eff6ff; }

/* ---------- TOP 排行 ---------- */
.rank-badge { width: 22px; height: 22px; border-radius: 7px; background: #eef2ff; color: #4338ca; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th { background: #f8fafc; color: var(--text-light); font-weight: 600; text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody td { padding: 7px 12px; border-bottom: 1px solid #eef2f7; word-break: break-word; overflow-wrap: anywhere; vertical-align: middle; }
tbody tr:hover { background: #f8fafc; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.td-strong { font-weight: 600; }
tr.total-row td { background: #eff6ff; font-weight: 700; border-top: 2px solid var(--primary); }

/* ---------- 徽章 ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.badge-normal, .badge-good, .badge-done { background: #ecfdf5; color: #065f46; }
.badge-fault, .badge-overdue, .badge-danger, .badge-high { background: #fef2f2; color: #991b1b; }
.badge-repair, .badge-warning, .badge-pending, .badge-medium { background: #fffbeb; color: #92400e; }
.badge-scrapped, .badge-cancelled, .badge-low { background: #f1f5f9; color: #475569; }
.badge-excellent { background: #ecfdf5; color: #065f46; }
.badge-info { background: #eff6ff; color: #1e40af; }

/* ---------- 按钮 ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 8px; border: 1px solid transparent; font-size: 13px; cursor: pointer; text-decoration: none; transition: all .15s; font-family: var(--font); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: #fef2f2; color: var(--danger); border-color: #fecaca; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-success { background: #ecfdf5; color: var(--success); border-color: #a7f3d0; }
.btn-success:hover { background: var(--success); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 表单 ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
/* —— 现场加油登记表单：分组布局（间距舒展、分组标题） —— */
.iss-form { display: block; }
.iss-sec { font-size: 13px; font-weight: 700; color: #1e3a5f; margin: 16px 0 10px; padding-left: 10px; border-left: 3px solid #2563eb; }
.iss-sec:first-child { margin-top: 0; }
.iss-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 4px; }
.iss-grid .form-group { min-width: 0; }
.iss-form .form-actions { margin-top: 16px; text-align: center; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 12.5px; color: var(--text-light); font-weight: 500; }
.form-group label .req { color: var(--danger); }
input, select, textarea {
  padding: 8px 11px; border: 1px solid var(--border); border-radius: 8px; font-size: 13.5px;
  font-family: var(--font); background: var(--surface); color: var(--text); width: 100%; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
textarea { resize: vertical; min-height: 70px; }
.form-actions { display: flex; gap: 10px; margin-top: 18px; }
.field-hint { font-size: 12px; color: var(--text-light); }

/* ---------- 搜索栏 ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar .form-group { flex-direction: row; align-items: center; gap: 8px; }
.toolbar input, .toolbar select { width: auto; min-width: 150px; }

/* ---------- 进度条 / 健康分 ---------- */
.progress { height: 8px; background: #eef2f7; border-radius: 6px; overflow: hidden; }
.progress > div { height: 100%; border-radius: 6px; }
.score-ring { display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; border-radius: 50%; font-weight: 700; color: #fff; font-size: 15px; }

/* ---------- 双栏布局 ---------- */
.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; }
.grid-2-1 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 1100px) { .grid-2, .grid-2-1 { grid-template-columns: 1fr; } }

/* ---------- 仪表盘图表（纯CSS柱状图） ---------- */
.bar-chart { display: flex; align-items: flex-end; gap: 14px; height: 160px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar { width: 60%; max-width: 46px; background: linear-gradient(180deg, var(--accent), var(--primary)); border-radius: 6px 6px 0 0; min-height: 3px; transition: height .4s; }
.bar-col:hover .bar { filter: brightness(1.1); }
.bar-label { font-size: 11px; color: var(--text-light); }
.bar-val { font-size: 11px; color: var(--text); font-weight: 600; }

/* ---------- 列表 ---------- */
.list-group { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #eef2f7; }
.list-item:last-child { border-bottom: none; }
.list-item .grow { flex: 1; }
.list-item .title { font-weight: 500; font-size: 13.5px; }
.list-item .sub { font-size: 12px; color: var(--text-light); margin-top: 2px; }

/* ---------- AI 聊天 ---------- */
.chat-box { display: flex; flex-direction: column; height: 520px; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: #f8fafc; border-radius: 8px; }
.msg { max-width: 82%; padding: 10px 14px; border-radius: 12px; font-size: 13.5px; line-height: 1.65; white-space: pre-wrap; }
.msg.user { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.msg.ai { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-input { display: flex; gap: 10px; padding-top: 12px; }
.chat-input input { flex: 1; }
.chat-hint { font-size: 12px; color: var(--text-light); padding: 8px 2px 0; }

/* ---------- 登录页 ---------- */
/* ==================== 登录页 · 国际化品牌设计 ==================== */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #071a3d 0%, #0f2447 40%, #1e3a8a 75%, #0ea5e9 140%); position: relative; overflow: hidden; padding: 24px; }
.login-page::before { content: ''; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px); background-size: 46px 46px; }
.login-page::after { content: '🌍'; position: absolute; right: -70px; top: -70px; font-size: 320px; opacity: .07; transform: rotate(-12deg); }
.login-wrap { display: flex; width: min(1000px, 96vw); min-height: 540px; background: rgba(255,255,255,.045); border: 1px solid rgba(255,255,255,.13); border-radius: 22px; backdrop-filter: blur(14px); box-shadow: 0 30px 90px rgba(0,0,0,.5); overflow: hidden; position: relative; z-index: 1; }
.login-left { flex: 1; padding: 46px 42px; color: #fff; display: flex; flex-direction: column; justify-content: center; background: radial-gradient(circle at 18% 8%, rgba(37,99,235,.4), transparent 62%), linear-gradient(165deg, rgba(11,31,69,.25), rgba(30,79,160,.3)); }
.login-left .brand { display: flex; align-items: center; gap: 14px; margin-bottom: 30px; }
.login-left .brand img { width: 54px; filter: drop-shadow(0 4px 16px rgba(0,0,0,.45)); }
.login-left .brand-name { font-size: 26px; font-weight: 800; letter-spacing: .5px; line-height: 1.2; }
.login-left .brand-en { font-size: 11px; opacity: .82; letter-spacing: 2.5px; text-transform: uppercase; margin-top: 3px; }
.login-left .hero { font-size: 15px; line-height: 1.75; opacity: .94; margin-bottom: 32px; max-width: 430px; }
.login-feats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 440px; }
.login-feat { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15); border-radius: 13px; padding: 13px 15px; transition: .2s; }
.login-feat:hover { background: rgba(255,255,255,.14); transform: translateY(-2px); }
.login-feat .ic { font-size: 21px; }
.login-feat .ti { font-size: 13px; font-weight: 600; margin-top: 5px; }
.login-feat .ds { font-size: 11px; opacity: .72; margin-top: 2px; }
.login-card { width: 400px; background: rgba(255,255,255,.98); border-radius: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.38); padding: 38px 34px; align-self: center; margin: 26px; }
.login-logo { text-align: center; margin-bottom: 14px; }
.login-logo img { width: 52px; }
.login-title { font-size: 18px; font-weight: 700; text-align: center; color: var(--sidebar-bg); }
.login-sub { text-align: center; color: var(--text-light); font-size: 12px; margin: 6px 0 20px; }
.login-card .form-group { margin-bottom: 14px; }
.login-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.login-actions label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-light); }
.login-btn { width: 100%; margin-top: 16px; padding: 11px; font-size: 15px; }
.login-tip { text-align: center; font-size: 12px; color: var(--text-light); margin-top: 16px; line-height: 1.8; }
.login-foot { text-align: center; margin-top: 20px; color: rgba(255,255,255,.55); font-size: 12px; letter-spacing: .5px; }
@media (max-width: 880px) { .login-left { display: none; } .login-wrap { justify-content: center; width: 96vw; } .login-card { margin: 24px 10px; width: 380px; } }

/* ---------- 错误页 ---------- */
.error-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: var(--bg); }
.error-code { font-size: 72px; font-weight: 800; color: var(--primary); }

/* ============ 主题适配（覆盖模板内联浅色，打印文档保持白纸） ============ */
input, select, textarea { color-scheme: light; }
input[type="date"], input[type="month"], input[type="time"] { color-scheme: light; }
::placeholder { color: #94a3b8; }

/* 各页卡片 / 工具条 / 搜索框 */
.photo-ai-bar, .td-grp, .sr-card, .nt-card, .wb-card, .wb-quick a,
.pl-toolbar, .pl-card, .map-card, .wf-day-title, .wf-item,
.stat-card, .dropdown, .pd-info, .de-info { background: var(--surface); border-color: var(--border); }
.wb-quick a, .nt-card { color: var(--text); }
.wf-btn, .pl-btn.outline, .wb-chip { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.wf-btn:hover { border-color: var(--primary); color: var(--primary); }
.wf-banner.off { background: var(--surface-2); border-color: var(--border); color: var(--text-light); }
.wf-date { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.wf-who { background: var(--surface-2); color: var(--text); }
.wf-content { color: var(--text); }
.wf-time { color: var(--text-light); }
.wf-day-title { color: var(--text); }

/* 表格 */
thead th { background: var(--surface-2); color: var(--text-light); border-color: var(--border); }
tbody tr:nth-child(even) { background: rgba(15,23,42,.03); }
tr.total-row td { background: rgba(37,99,235,.12); }
.pm td.grp { background: var(--surface-2); color: var(--primary); }
.engine-card code { background: var(--surface-2); }
.filter-hint.warn { background: #fff7ed; border-color: #fcd34d; color: #b45309; }
.dev-table tbody tr:nth-child(even), .tbl tbody tr:nth-child(even) { background: rgba(15,23,42,.03); }

/* 顶部搜索框（base.html 内联浅色） */
input[name="q"] { background: var(--surface-2) !important; color: var(--text) !important; border-color: var(--border) !important; }

/* 警示 / 成功提示条 */
.flash-warning, .ins-warn { background: #fff7ed; color: #b45309; border-color: #fcd34d; }
.badge-repair, .badge-warning, .badge-pending, .badge-medium { background: #fff7ed; color: #b45309; }

/* 登录卡片内保持浅色（登录页本身深色背景） */
.login-card input, .login-card select, .login-card textarea { background: #fff; color: #1e293b; border-color: #cbd5e1; }
.login-card input:focus, .login-card select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.2); }

/* 打印文档 / 签字画板保持白纸 */
.doc, .sign-box canvas, .sign-box img.sign-img { background: #fff; }
@media print { body { background: #fff; } .doc { box-shadow: none; } }

/* ============================================================
   打印通用规则：单据文字完整不裁切、A4 页面边距统一
   ============================================================ */
@page { size: A4; margin: 12mm 10mm; }
@media print {
  html, body { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body { font-size: 12px; }
  /* 单据内容不裁切：表格/行禁止在行内断开 */
  table.doc-table, .doc-tri, table.tri-table,
  .doc-table tr, .tri-table tr, .doc-tri .tri-col { page-break-inside: avoid; break-inside: avoid; }
  .doc-tri { page-break-after: always; }
  .doc-tri:last-child { page-break-after: auto; }
  /* 长文本自动换行，防止打印时被截断 */
  .doc-table td, .doc-table th, .tri-table td, .tri-table th,
  .doc-meta .v, .doc-line .v, .tri-line .v { word-break: break-word; overflow-wrap: anywhere; white-space: normal; }
  /* 隐藏非打印元素 */
  .no-print, .doc-actions, .site-blocks, .flash-area, .sidebar, .topbar { display: none !important; }
  .main { margin: 0 !important; padding: 0 !important; }
  .content { padding: 0 !important; max-width: 100% !important; }
  .doc { padding: 6mm 5mm !important; max-width: 100% !important; }
  .doc-wrap { max-width: 100% !important; }
}
.error-msg { color: var(--text-light); font-size: 16px; }

/* 授权人列：已填=绿色高亮 / 未填=红色提醒 */
input.dev-auth { transition: border-color .2s, background .2s, box-shadow .2s, color .2s; }
input.dev-auth.filled { background: rgba(22,163,74,.12); border-color: #16a34a !important; color: #14532d; font-weight: 600; }
input.dev-auth.empty { background: rgba(220,38,38,.07); border-color: #dc2626 !important; border-style: dashed; color: #dc2626; }
input.dev-auth.empty::placeholder { color: #dc2626; font-weight: 600; }
input.dev-auth:focus { border-color: var(--primary) !important; border-style: solid; box-shadow: 0 0 0 3px rgba(37,99,235,.18); background: var(--surface); color: var(--text); }
input.dev-auth.saved-flash { animation: authSaved .6s ease; }
@keyframes authSaved { 0% { box-shadow: 0 0 0 4px rgba(22,163,74,.35); } 100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); } }
input.dev-auth.save-fail { box-shadow: 0 0 0 4px rgba(220,38,38,.35); }

/* ============================================================
   🎨 全系统界面升级（2026-08-21）—— 玻璃拟态 · 大圆角 · 动效
   统一所有页面：卡片 / 统计卡 / 按钮 / 模块 Hero 质感
   ============================================================ */
.card {
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #fcfdfe 100%);
  border: 1px solid #eef2f7;
  box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 8px 22px rgba(15,23,42,.06);
  transition: box-shadow .18s ease, transform .18s ease;
  position: relative;
  overflow: hidden;
}
.card::before { content:""; position:absolute; top:0; left:16px; right:16px; height:1.5px;
  background: linear-gradient(90deg, transparent, rgba(37,99,235,.35), transparent); pointer-events:none; }
.card:hover { box-shadow: 0 4px 10px rgba(15,23,42,.05), 0 14px 32px rgba(37,99,235,.10); }
.card-head { padding: 15px 20px; border-bottom: 1px solid #eef2f7; }
.card-title { font-size: 15.5px; font-weight: 700; letter-spacing:.2px; color: #0f172a; }
.card-body { padding: 18px 20px; }

/* 统计卡：玻璃拟态 + 渐变高光 + 悬浮动效 + 大数字 */
.stat-card { position: relative; overflow: hidden; border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid #eef2f7;
  box-shadow: 0 1px 2px rgba(15,23,42,.05), 0 10px 24px rgba(15,23,42,.06);
  transition: transform .18s ease, box-shadow .18s ease;
  padding: 20px; }
.stat-card::before { content:""; position:absolute; top:0; left:18px; right:18px; height:1.5px;
  background: linear-gradient(90deg, transparent, rgba(37,99,235,.45), transparent); }
.stat-card:hover { transform: translateY(-3px);
  box-shadow: 0 4px 10px rgba(15,23,42,.06), 0 18px 38px rgba(37,99,235,.16); }
.stat-ico { width: 54px; height: 54px; border-radius: 15px; font-size: 25px;
  box-shadow: 0 10px 22px rgba(37,99,235,.28); }
.stat-num { font-size: 28px; font-weight: 800; letter-spacing: .3px; line-height: 1.1;
  font-variant-numeric: tabular-nums; }
.stat-label { font-size: 13px; font-weight: 600; color: #475569; margin-top: 4px; }
.stat-sub { font-size: 11.5px; margin-top: 2px; }

/* 模块 Hero：在原有深蓝渐变上叠加炫光（不动各页主题色） */
.mod-hero { position: relative; overflow: hidden; }
.mod-hero::before { content:""; position:absolute; inset:0; pointer-events:none; z-index:0;
  background:
    radial-gradient(800px 260px at 85% -40px, rgba(56,189,248,.30), transparent 60%),
    radial-gradient(600px 220px at -5% 120%, rgba(129,140,248,.22), transparent 55%); }
.mod-hero > * { position: relative; z-index: 1; }
.mod-hero-title { font-size: 20px; font-weight: 800; letter-spacing: .4px; }
.mod-hero-sub { opacity: .9; }

/* 按钮：主按钮渐变 + 投影 + 悬浮 */
.btn { border-radius: 9px; font-weight: 600; transition: all .15s ease; }
.btn-primary { background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  box-shadow: 0 6px 14px rgba(37,99,235,.25); }
.btn-primary:hover { transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(37,99,235,.32); }
.btn-outline:hover { transform: translateY(-1px); }

/* 表格：表头更深 + 行 hover */
table { border-collapse: separate; border-spacing: 0; }
thead th { font-size: 12px; letter-spacing: .3px; }
tbody tr { transition: background .12s ease; }
tbody tr:hover td { background: #f8fafc; }

/* 顶栏/侧边栏品牌更精致 */
.topbar { box-shadow: 0 1px 0 rgba(15,23,42,.04); }
.brand-logo { border-radius: 10px; box-shadow: 0 4px 12px rgba(0,0,0,.25); }

/* ---------- 其他 ---------- */
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }
.text-muted { color: var(--text-light); }
.text-sm { font-size: 12px; }
.text-right { text-align: right; }
.flex { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; }
.empty { text-align: center; color: var(--text-light); padding: 40px 10px; }
.empty .emoji { font-size: 40px; display: block; margin-bottom: 8px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.kv { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--text-light); }
.kv .v { font-weight: 500; }

/* ---------- 弹窗（dialog） ---------- */
dialog.modal { border: none; border-radius: 14px; padding: 0; width: min(680px, 92vw); box-shadow: 0 24px 70px rgba(0,0,0,.35); }
dialog.modal::backdrop { background: rgba(15,23,42,.55); backdrop-filter: blur(2px); }
.modal-body { padding: 24px 28px; }
.modal-body h3 { margin: 0 0 18px; font-size: 16px; color: var(--sidebar-bg); }
.modal-actions { display: flex; align-items: center; gap: 10px; margin-top: 20px; }

/* ---------- 页签 ---------- */
.tabs { display: flex; gap: 4px; background: var(--bg); border-radius: 10px; padding: 4px; }
.tab { padding: 7px 18px; border-radius: 8px; font-size: 13px; color: var(--text-light); cursor: pointer; text-decoration: none; }
.tab.active { background: var(--surface); color: var(--primary); font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.tab:hover { color: var(--primary); }

/* ---------- 分页 ---------- */
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 14px 18px; }

/* ---------- 维修配件行 ---------- */
.repair-parts { display: flex; gap: 8px; flex-wrap: wrap; }
.repair-parts input { flex: 1; min-width: 120px; }

/* ============================================================
   📱 2026-08-29 移动端深化：文档单据 / 表格 / 手机浏览优化
   解决：手机看调运单/维修执行单无网格线、格式乱、字体拥挤；
        设备台账手机查看；通用表格小屏体验
   ============================================================ */
@media (max-width: 760px) {
  /* —— A4 文档单据（调运单/维修执行单/保养执行单/租赁单等）手机适配 —— */
  .doc-wrap { max-width: 100% !important; margin: 0 !important; }
  .doc { padding: 12px 10px !important; border-width: 1px !important; }
  .doc-title { font-size: 17px !important; letter-spacing: 1px !important; }
  .doc-sub { font-size: 10px !important; margin-bottom: 10px !important; }
  .doc-meta { grid-template-columns: 1fr !important; gap: 2px 10px !important; font-size: 12px !important; line-height: 1.9 !important; }
  .doc-head { flex-direction: column !important; gap: 4px !important; font-size: 12px !important; line-height: 1.8 !important; }
  .doc-arrow { font-size: 18px !important; margin: 2px 0 !important; }
  .doc-wrap table, .doc-wrap table.doc-table { font-size: 11.5px !important; }
  .doc-wrap th, .doc-wrap td, table.doc-table th, table.doc-table td { padding: 5px 4px !important; border: 1px solid #64748b !important; }
  .doc-wrap .lbl { width: 76px !important; }
  .doc-signs { grid-template-columns: 1fr !important; gap: 12px !important; margin-top: 14px !important; }
  .doc-foot { flex-direction: column !important; gap: 4px !important; font-size: 11px !important; }
  .sign-box { padding: 6px 8px !important; }
  .sign-box canvas, .sign-box img.sign-img { height: 80px !important; }
  .doc-line .k { white-space: normal !important; }
  /* —— 通用卡片/表格手机优化 —— */
  .card-body { padding: 10px !important; }
  .content { padding: 8px !important; }
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .card-head { padding: 12px 14px !important; }
  .form-grid { grid-template-columns: 1fr !important; }
  .modal-body { padding: 16px !important; }
  /* 通用表格小屏：列多时允许横向滑动，但表头保持可见 */
  .table-wrap table { min-width: 640px; }
  .card .table-wrap table { min-width: 0; }
}
