/* 固定侧边栏布局（sidebar-fixed）设计系统
   Token 映射：bg-zinc-50 / border-zinc-200 / text-zinc-900·600·400 / blue-500 系
   圆角：控件 rounded-lg=8px，卡片 rounded-xl=12px；阴影：shadow-sm / hover shadow-md
   交互：nav duration-150 颜色反馈 + 图标轻移；卡片 hover 微抬 + 轻阴影 */
  :root {
    --primary: #2563eb; --primary-d: #1d4ed8; --primary-soft: #eff6ff;
    --success: #16a34a; --warning: #d97706; --danger: #dc2626; --info: #0891b2;
    --bg: #fafafa; --card: #fff; --line: #e4e4e7; --fill: #f4f4f5;
    --text: #18181b; --sub: #52525b; --faint: #71717a;
    --r-ctl: 8px; --r-card: 12px;
    --sider-w: 256px; --sider-w-min: 64px;
    --ring: 0 0 0 3px rgba(59, 130, 246, .3);
    --lift: 0 4px 12px rgba(0, 0, 0, .08);
  }
  * { margin: 0; padding: 0; box-sizing: border-box; }
  body { font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; font-variant-numeric: tabular-nums; }
  a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid rgba(37, 99, 235, .55); outline-offset: 2px; }

  /* ===== 布局：固定侧边栏 + 主区左边距 ===== */
  .layout { min-height: 100vh; }
  .sider {
    position: fixed; left: 0; top: 0; bottom: 0; width: var(--sider-w); z-index: 50;
    background: var(--bg); border-right: 1px solid var(--line); color: var(--sub);
    display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain;
    transition: width .15s ease, transform .15s ease;
  }
  .sider::-webkit-scrollbar { width: 6px; }
  .sider::-webkit-scrollbar-thumb { background: #d4d4d8; border-radius: 3px; }
  .brand { display: flex; align-items: center; gap: 10px; padding: 16px 14px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
  .brand-logo { width: 30px; height: 30px; flex-shrink: 0; background: var(--primary); color: #fff; border-radius: var(--r-ctl); display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; }
  .brand-text { min-width: 0; }
  .brand-text b { color: var(--text); font-size: 16px; font-weight: 600; letter-spacing: 1px; display: block; white-space: nowrap; }
  .brand-text span { font-size: 10px; color: var(--faint); letter-spacing: 2px; white-space: nowrap; }
  .side-toggle { margin-left: auto; flex-shrink: 0; width: 26px; height: 26px; border: 1px solid var(--line); background: var(--card); color: var(--faint); border-radius: var(--r-ctl); cursor: pointer; font-size: 12px; line-height: 1; transition: color .15s ease, background-color .15s ease, border-color .15s ease; }
  .side-toggle:hover { color: var(--primary); background: var(--primary-soft); border-color: #bfdbfe; }
  .sider nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 3px; }
  .sider nav a {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-ctl);
    color: var(--sub); font-size: 14px; cursor: pointer; text-decoration: none; position: relative;
    transition: color .15s ease, background-color .15s ease;
  }
  .sider nav a .ic { flex-shrink: 0; width: 18px; text-align: center; transition: transform .15s ease; }
  .sider nav a:hover { color: var(--text); background: var(--fill); }
  .sider nav a:hover .ic { transform: translateX(2px); }
  .sider nav a.on { background: var(--primary-soft); color: var(--primary-d); font-weight: 600; }
  .sider nav a.on::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: var(--primary); }
  .nav-group { font-size: 11px; color: var(--faint); letter-spacing: 2px; padding: 14px 12px 4px; }
  .sider-foot { margin-top: auto; padding: 14px 16px; border-top: 1px solid var(--line); font-size: 13px; flex-shrink: 0; }
  .sider-foot .u { color: var(--text); font-weight: 600; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .sider-foot .u i { font-style: normal; font-size: 11px; font-weight: 400; background: var(--primary-soft); color: var(--primary-d); padding: 2px 8px; border-radius: var(--r-ctl); white-space: nowrap; }
  .sider-foot a { color: var(--faint); text-decoration: none; font-size: 13px; display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 6px 12px; border-radius: var(--r-ctl); transition: color .15s ease, background-color .15s ease; }
  .sider-foot a:hover { color: var(--primary); background: var(--primary-soft); }

  /* 收起态（仅桌面 ≥1024px 生效，见文件末尾媒体查询） */
  .layout.collapsed .sider { width: var(--sider-w-min); }
  .layout.collapsed .brand { flex-direction: column; gap: 8px; padding: 14px 8px; }
  .layout.collapsed .brand-text, .layout.collapsed .nav-group, .layout.collapsed .sider-foot .u, .layout.collapsed .nav-label { display: none; }
  .layout.collapsed .side-toggle { margin-left: 0; }
  .layout.collapsed .sider nav a { justify-content: center; padding: 10px 0; gap: 0; }
  .layout.collapsed .sider-foot a { justify-content: center; padding: 6px 0; }
  .layout.collapsed .main { margin-left: var(--sider-w-min); }

  /* 移动端遮罩 */
  .nav-overlay { display: none; }

  .main { margin-left: var(--sider-w); min-width: 0; display: flex; flex-direction: column; transition: margin-left .15s ease; }
  .mhead { background: var(--card); border-bottom: 1px solid var(--line); padding: 14px 28px; display: flex; align-items: center; gap: 14px; position: sticky; top: 0; z-index: 40; }
  .mhead h2 { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
  .mhead .meta { font-size: 12px; color: var(--faint); margin-top: 3px; }
  .mhead .spacer { flex: 1; }
  .hamburger { display: none; width: 36px; height: 36px; flex-shrink: 0; align-items: center; justify-content: center; border: 1px solid var(--line); background: var(--card); color: var(--sub); border-radius: var(--r-ctl); cursor: pointer; font-size: 16px; transition: color .15s ease, background-color .15s ease; }
  .hamburger:hover { background: var(--fill); color: var(--text); }
  .date-chip { font-size: 12px; color: var(--sub); background: var(--fill); border: 1px solid var(--line); padding: 7px 14px; border-radius: var(--r-ctl); white-space: nowrap; }
  .pt-switch { display: flex; background: var(--fill); border: 1px solid var(--line); border-radius: var(--r-ctl); overflow: hidden; }
  .pt-switch button { border: 0; background: transparent; color: var(--sub); padding: 7px 18px; cursor: pointer; font-size: 13px; font-weight: 500; transition: color .15s ease, background-color .15s ease; }
  .pt-switch button:hover { color: var(--text); }
  .pt-switch button.on { background: var(--primary); color: #fff; font-weight: 600; }

  /* ===== 首页 ===== */
  .home-hero { position: relative; margin: -20px -28px 0; min-height: 430px; display: flex; align-items: center; background: #0b1120 url('../assets/home-bg.jpg') center/cover no-repeat; }
  .home-hero::before { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(8,13,26,.88) 0%, rgba(8,13,26,.55) 45%, rgba(8,13,26,.15) 100%); }
  .hero-inner { position: relative; padding: 56px 56px; max-width: 640px; }
  .hero-tag { display: inline-block; font-size: 12px; letter-spacing: 4px; color: #f59e0b; border: 1px solid rgba(245,158,11,.45); padding: 5px 14px; border-radius: 4px; margin-bottom: 22px; }
  .hero-inner h1 { color: #fff; font-size: 30px; font-weight: 600; line-height: 1.4; letter-spacing: 1px; }
  .hero-inner p { color: #cbd5e1; font-size: 15px; margin-top: 16px; letter-spacing: 1px; max-width: 46ch; line-height: 1.8; }
  .hero-inner p b { color: #f8fafc; font-weight: 600; }
  .hero-btn { margin-top: 30px; background: var(--primary); color: #fff; border: 0; padding: 12px 32px; border-radius: var(--r-ctl); font-size: 14px; font-weight: 500; cursor: pointer; letter-spacing: 1px; transition: background-color .15s ease, transform .15s ease; }
  .hero-btn:hover { background: var(--primary-d); transform: translateY(-1px); }
  .home-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 24px; }
  .hstat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); padding: 18px 20px; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.05); transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
  .hstat:hover { border-color: #bfdbfe; box-shadow: var(--lift); transform: translateY(-1px); }
  .hstat .l { font-size: 12px; color: var(--faint); }
  .hstat .v { font-size: 24px; font-weight: 700; margin-top: 8px; }
  .hstat .v small { font-size: 13px; font-weight: 400; color: var(--sub); margin-left: 4px; }
  .hstat .f { font-size: 12px; color: var(--sub); margin-top: 6px; }
  .home-sec-title { font-size: 15px; font-weight: 600; color: var(--text); margin: 30px 0 14px; letter-spacing: 1px; display: flex; align-items: center; gap: 8px; }
  .home-sec-title::before { content: ''; width: 4px; height: 14px; background: var(--primary); border-radius: 2px; }
  .home-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .hcard { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); padding: 26px 24px; overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,.05); transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
  .hcard:hover { transform: translateY(-1px); box-shadow: var(--lift); border-color: #bfdbfe; }
  .hcard .ic { font-size: 26px; }
  .hcard h3 { font-size: 16px; font-weight: 600; margin-top: 12px; color: var(--text); }
  .hcard p { font-size: 13px; color: var(--sub); margin-top: 8px; line-height: 1.7; }
  .sync-btn { border: 1px solid var(--line); background: var(--card); color: var(--sub); padding: 7px 14px; border-radius: var(--r-ctl); cursor: pointer; font-size: 14px; font-weight: 500; white-space: nowrap; transition: color .15s ease, border-color .15s ease, background-color .15s ease; }
  .sync-btn:hover:not(:disabled) { color: var(--primary); border-color: #bfdbfe; background: var(--primary-soft); }
  .sync-btn:disabled { opacity: .6; cursor: default; }
  .sync-msg { font-size: 12px; color: var(--faint); white-space: nowrap; }

  .page { padding: 20px 28px 48px; max-width: 1500px; width: 100%; margin: 0 auto; }
  .err-banner { background: #fef2f2; color: #b91c1c; padding: 10px 28px; font-size: 13px; border-bottom: 1px solid #fecaca; }
  .loading { text-align: center; color: var(--faint); padding: 60px 0; font-size: 13px; }

  /* ===== 通用卡片 ===== */
  .card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: 0 1px 2px rgba(0,0,0,.05); }
  .card-h { padding: 14px 20px 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
  .card-h h3 { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
  .card-h h3::before { content: ""; display: inline-block; width: 3px; height: 14px; background: var(--primary); border-radius: 2px; margin-right: 8px; vertical-align: -2px; }
  .card-h .hint { font-size: 12px; color: var(--faint); font-weight: 400; }
  .card-b { padding: 12px 20px 18px; }

  /* ===== KPI 指标卡 ===== */
  .kpi-row { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; }
  @media (max-width: 1100px) { .kpi-row { grid-template-columns: repeat(2,1fr); } }
  .kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); padding: 16px 20px; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.05); position: relative; overflow: hidden; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
  .kpi:hover { border-color: #bfdbfe; box-shadow: var(--lift); transform: translateY(-1px); }
  .kpi .label { font-size: 13px; color: var(--sub); }
  .kpi .value { font-size: 26px; font-weight: 700; margin-top: 6px; color: var(--kc, var(--primary)); letter-spacing: -0.01em; }
  .kpi .value small { font-size: 14px; font-weight: 600; margin-left: 3px; }
  .kpi .value.dash { color: #d4d4d8; }
  .kpi .foot { font-size: 12px; color: var(--faint); margin-top: 8px; border-top: 1px dashed var(--line); padding-top: 8px; }

  /* ===== 主体面板 ===== */
  .subj-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
  @media (max-width: 1000px) { .subj-row { grid-template-columns: 1fr; } }
  .tile-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; padding: 12px 14px 8px; }
  .tile { padding: 10px 12px; cursor: pointer; border-radius: var(--r-ctl); transition: background-color .15s ease; }
  .tile:hover { background: var(--fill); }
  .tile .label { font-size: 12px; color: var(--sub); }
  .tile .value { font-size: 20px; font-weight: 700; margin-top: 3px; }
  .tile .value small { font-size: 12px; font-weight: 500; color: var(--faint); margin-left: 4px; }
  .tile .value.dash { color: #d4d4d8; }
  .tile .value.blue { color: var(--primary); } .tile .value.green { color: var(--success); }
  .subj-meta { padding: 0 16px 14px; font-size: 12px; color: var(--faint); line-height: 1.7; }
  .subj-meta b { color: var(--sub); font-weight: 600; }
  .subj-title { padding: 14px 16px 0; display: flex; align-items: center; gap: 8px; }
  .subj-title .dot { width: 8px; height: 8px; border-radius: 50%; }
  .subj-title h3 { font-size: 16px; font-weight: 600; }
  .subj-title .chip { margin-left: auto; font-size: 12px; color: var(--sub); background: var(--fill); padding: 3px 10px; border-radius: var(--r-ctl); white-space: nowrap; }

  /* ===== 图表区 ===== */
  .chart-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
  @media (max-width: 1100px) { .chart-2col { grid-template-columns: 1fr; } }
  .chart { width: 100%; height: 300px; }
  .rawctrl { display: flex; flex-wrap: wrap; gap: 10px 26px; padding: 12px 20px 0; align-items: flex-start; }
  .rawctrl-group { display: flex; align-items: center; gap: 8px; }
  .rawctrl-group.rawctrl-grow { flex: 1 1 340px; }
  .rawctrl-label { font-size: 12px; color: var(--faint); white-space: nowrap; }
  .seg { display: flex; gap: 6px; flex-wrap: wrap; }
  .seg button { border: 1px solid var(--line); background: var(--card); color: var(--sub); font-size: 12px; padding: 4px 13px; border-radius: var(--r-ctl); cursor: pointer; transition: color .15s ease, background-color .15s ease, border-color .15s ease; }
  .seg button:hover { color: var(--primary); border-color: #bfdbfe; }
  .seg button.on { background: var(--primary); border-color: var(--primary); color: #fff; }
  .seg button.type-btn.on { background: var(--success); border-color: var(--success); color: #fff; font-weight: 600; }
  .chart-note { padding: 8px 14px; margin: 4px 0 10px; font-size: 12px; color: #b45309; background: #fffbeb; border: 1px solid #fde68a; border-radius: var(--r-ctl); }

  /* ===== 早会简报 ===== */
  .brief-card { margin-bottom: 16px; }
  .brief-card .card-h { padding: 14px 20px; border-bottom: 1px solid var(--line); }
  .brief-body { padding: 16px 22px 20px; font-size: 14px; line-height: 2.0; color: var(--text); white-space: pre-wrap; max-width: 75ch; }
  .brief-line { display: flex; align-items: baseline; gap: 8px; }
  .brief-line .dot { flex: none; width: 7px; height: 7px; border-radius: 50%; position: relative; top: -1px; }
  .dot.info { background: #3b82f6; }
  .dot.warn { background: #d97706; }
  .dot.risk { background: #dc2626; }
  .dot.good { background: #16a34a; }
  .chart-empty { padding: 30px 20px; text-align: center; color: var(--faint); font-size: 13px; line-height: 1.9; background: var(--bg); border-radius: var(--r-ctl); margin: 6px 0 12px; }
  .chart-empty b { color: var(--sub); }

  /* ===== 明细：筛选 + 表格 ===== */
  .filter-bar { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; padding: 16px 20px; }
  .f-item { display: flex; flex-direction: column; gap: 5px; }
  .f-item label { font-size: 12px; color: var(--sub); }
  .f-item select, .f-item input { border: 1px solid transparent; background: var(--fill); border-radius: var(--r-ctl); padding: 7px 10px; font-size: 14px; color: var(--text); outline: none; transition: background-color .15s ease, box-shadow .15s ease; }
  .f-item select:focus, .f-item input:focus { background: var(--card); box-shadow: var(--ring); }
  .f-item input[type=number] { width: 96px; }
  .f-item input[type=date] { width: 140px; }
  .f-btns { display: flex; gap: 8px; margin-left: auto; }
  .f-btns button { border: 0; border-radius: var(--r-ctl); padding: 8px 22px; font-size: 14px; font-weight: 500; cursor: pointer; transition: background-color .15s ease, color .15s ease; }
  .f-btns .q { background: var(--primary); color: #fff; }
  .f-btns .q:hover { background: var(--primary-d); }
  .f-btns .r { background: var(--fill); color: var(--sub); border: 1px solid var(--line); }
  .f-btns .r:hover { color: var(--text); }
  .table-summary { padding: 12px 20px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--sub); display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
  .table-summary b { color: var(--text); }
  .table-summary .rate { color: var(--success); font-weight: 700; }
  .table-summary .tip { margin-left: auto; color: var(--faint); font-size: 12px; }
  .table-wrap { overflow-x: auto; }
  table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
  table.grid th, table.grid td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
  table.grid th { color: var(--sub); font-weight: 600; background: var(--fill); font-size: 12px; }
  table.grid tbody tr:nth-child(even) td { background: #fcfcfd; }
  table.grid tbody tr:hover td { background: var(--primary-soft); }
  td.num, th.num { text-align: right; }
  .tag { display: inline-block; padding: 2px 10px; border-radius: 4px; font-size: 12px; }
  .tag.优品 { background: #dcfce7; color: #15803d; }
  .tag.良品 { background: #dbeafe; color: #1d4ed8; }
  .tag.非标 { background: #fee2e2; color: #b91c1c; }
  .tag.none { background: var(--fill); color: var(--faint); }
  a.fno { color: var(--primary); cursor: pointer; text-decoration: none; font-weight: 600; }
  a.fno:hover { text-decoration: underline; }
  .photo-btn { border: 1px solid var(--line); background: var(--card); border-radius: 6px; cursor: pointer; font-size: 12px; padding: 3px 8px; color: var(--sub); transition: color .15s ease, background-color .15s ease, border-color .15s ease; }
  .photo-btn:hover { background: var(--primary-soft); border-color: #93c5fd; color: var(--primary-d); }
  .pager { display: flex; align-items: center; gap: 10px; padding: 12px 20px; font-size: 13px; color: var(--sub); }
  .pager button { border: 1px solid var(--line); background: var(--card); border-radius: var(--r-ctl); padding: 5px 14px; cursor: pointer; font-size: 13px; color: var(--sub); transition: color .15s ease, border-color .15s ease; }
  .pager button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
  .pager button:disabled { opacity: .4; cursor: default; }

  /* ===== 弹窗 ===== */
  .modal-mask { position: fixed; inset: 0; background: rgba(24, 24, 27, .5); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 30px; }
  .modal { background: #fff; border-radius: var(--r-card); width: 100%; max-width: 1080px; max-height: 86vh; display: flex; flex-direction: column; box-shadow: 0 8px 24px rgba(0, 0, 0, .12); }
  .modal-head { padding: 16px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
  .modal-head h3 { font-size: 16px; font-weight: 600; }
  .modal-head .count { color: var(--sub); font-size: 13px; font-weight: normal; }
  .modal-head .x { margin-left: auto; border: 1px solid var(--line); background: var(--fill); width: 30px; height: 30px; border-radius: var(--r-ctl); cursor: pointer; font-size: 14px; color: var(--sub); transition: color .15s ease, background-color .15s ease; }
  .modal-head .x:hover { background: #e4e4e7; color: var(--text); }
  .modal-body { overflow: auto; padding: 14px 22px 22px; }
  /* 系统配置面板 */
  .cfg-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
  .cfg-tabs button { border: 1px solid var(--line); background: var(--fill); color: var(--sub); padding: 8px 16px; border-radius: var(--r-ctl); cursor: pointer; font-size: 13px; font-weight: 500; transition: color .15s ease, background-color .15s ease, border-color .15s ease; }
  .cfg-tabs button:hover { color: var(--text); }
  .cfg-tabs button.on { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
  .cfg-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
  .cfg-row label { font-size: 13px; color: var(--sub); }
  .cfg-row select { padding: 7px 10px; border: 1px solid transparent; background: var(--fill); border-radius: var(--r-ctl); font-size: 13px; min-width: 240px; color: var(--text); outline: none; transition: background-color .15s ease, box-shadow .15s ease; }
  .cfg-row select:focus { background: var(--card); box-shadow: var(--ring); }
  .cfg-hint { font-size: 12px; color: var(--faint); }
  .cfg-order-list { border: 1px solid var(--line); border-radius: var(--r-card); max-height: 46vh; overflow: auto; }
  .cfg-order-item { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-bottom: 1px solid #f4f4f5; font-size: 13px; }
  .cfg-order-item:last-child { border-bottom: 0; }
  .cfg-order-item.off .cfg-order-name { color: var(--faint); text-decoration: line-through; }
  .cfg-order-item input { accent-color: var(--primary); }
  .cfg-order-idx { width: 28px; color: var(--faint); font-size: 12px; text-align: right; }
  .cfg-order-name { flex: 1; }
  .cfg-move { border: 1px solid var(--line); background: var(--card); width: 28px; height: 28px; border-radius: 6px; cursor: pointer; color: var(--sub); transition: color .15s ease, background-color .15s ease; }
  .cfg-move:hover:not(:disabled) { background: var(--primary-soft); color: var(--primary); }
  .cfg-move:disabled { opacity: .3; cursor: default; }
  .cfg-empty { padding: 30px; text-align: center; color: var(--faint); font-size: 13px; }
  .cfg-actions { display: flex; gap: 10px; margin-top: 14px; }
  .cfg-save { background: var(--primary); color: #fff; border: 0; padding: 9px 22px; border-radius: var(--r-ctl); cursor: pointer; font-size: 14px; font-weight: 500; transition: background-color .15s ease; }
  .cfg-save:hover:not(:disabled) { background: var(--primary-d); }
  .cfg-save:disabled { opacity: .5; cursor: default; }
  .cfg-acl { width: 100%; border-collapse: collapse; font-size: 13px; }
  .cfg-acl th, .cfg-acl td { border: 1px solid var(--line); padding: 9px 12px; text-align: center; }
  .cfg-acl th { background: var(--fill); color: var(--sub); font-weight: 600; }
  .cfg-acl td:first-child { text-align: left; font-weight: 600; }
  .cfg-msg { margin-top: 12px; font-size: 13px; color: var(--primary); }
  .photo-phase { border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; margin-top: 14px; }
  .photo-phase > h4 { font-size: 13px; padding: 10px 14px; display: flex; align-items: center; gap: 8px; }
  .photo-phase.before > h4 { background: #fff7ed; color: #9a3412; }
  .photo-phase.after > h4 { background: #f0fdf4; color: #166534; }
  .photo-phase .badge { font-size: 11px; font-weight: 400; background: rgba(255,255,255,.7); border: 1px solid currentColor; opacity: .75; padding: 1px 8px; border-radius: var(--r-ctl); }
  .photo-phase .slots { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 14px; }
  @media (max-width: 700px) { .photo-phase .slots { grid-template-columns: 1fr; } }
  .photo-slot .t { font-size: 12px; color: var(--sub); margin-bottom: 6px; }
  .photo-slot img { width: 100%; border-radius: var(--r-ctl); border: 1px solid var(--line); display: block; margin-bottom: 8px; background: var(--fill); min-height: 100px; }
  .insp-toggle { border: 1px solid var(--line); background: var(--card); border-radius: 6px; cursor: pointer; font-size: 12px; padding: 2px 8px; color: var(--sub); transition: color .15s ease, background-color .15s ease; }
  .insp-toggle:hover { background: var(--primary-soft); border-color: #93c5fd; color: var(--primary-d); }
  .insp-toggle.on { background: var(--primary-soft); border-color: #93c5fd; color: var(--primary); }
  .insp-row td { background: var(--fill) !important; padding: 12px 16px !important; white-space: normal !important; }
  .insp-grid { display: flex; flex-wrap: wrap; gap: 8px; }
  .insp-item { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 5px 12px; font-size: 12px; color: var(--sub); }
  .insp-item b { color: var(--text); font-weight: 700; margin-right: 6px; }
  .insp-none { font-size: 12px; color: var(--faint); padding: 4px 0; }

  /* ===== 登录页 ===== */
  .login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
  .login-card { background: #fff; border: 1px solid var(--line); border-radius: var(--r-card); padding: 48px 56px; text-align: center; box-shadow: 0 8px 24px rgba(0, 0, 0, .10); }
  .login-card h1 { font-size: 22px; font-weight: 600; margin-bottom: 8px; letter-spacing: 2px; }
  .login-card p { color: var(--sub); font-size: 14px; margin-bottom: 28px; }
  .login-card a.btn { display: inline-block; background: var(--primary); color: #fff; text-decoration: none; padding: 12px 44px; border-radius: var(--r-ctl); font-size: 15px; font-weight: 500; transition: background-color .15s ease; }
  .login-card a.btn:hover { background: var(--primary-d); }

  /* ===== 全流程台账 ===== */
  .ldg-tabs { display: flex; flex-wrap: nowrap; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
  .ldg-tab { flex-shrink: 0; border: 1px solid var(--line); background: var(--card); border-radius: var(--r-ctl); padding: 7px 14px; font-size: 13px; color: var(--sub); cursor: pointer; transition: color .15s ease, background-color .15s ease, border-color .15s ease; white-space: nowrap; }
  .ldg-tab i { font-style: normal; font-size: 11px; color: var(--faint); margin-left: 6px; }
  .ldg-tab:hover { border-color: var(--primary); color: var(--primary); }
  .ldg-tab.on { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
  .ldg-tab.on i { color: rgba(255,255,255,.75); }
  .ldg-wrap { max-height: 560px; overflow: auto; }
  .ldg-wrap table.grid th { position: sticky; z-index: 2; cursor: pointer; user-select: none; }
  .ldg-wrap thead tr:first-child th { top: 0; }
  .ldg-wrap thead tr:nth-child(2) th { top: 27px; }
  .ldg-wrap table.grid th.sort { color: var(--primary); }
  .ldg-arrow { font-size: 10px; margin-left: 3px; }
  .ldg-wrap table.grid td { max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
  .ldg-wrap tbody tr { cursor: pointer; }
  /* 分组表头：组带 + 分组底色 */
  .ldg-gh th, .ldg-gh2 th { font-weight: 600; }
  th.ldg-gband { padding: 5px 12px; font-size: 11px; letter-spacing: 1px; text-align: center; cursor: default; }
  th.ldg-gband i { font-style: normal; font-weight: 400; opacity: .65; margin-left: 4px; }
  .ldg-gh2 th { font-weight: 400; }
  .ldg-g-编号 { background: #eef2ff !important; color: #4338ca; }
  .ldg-g-编号.ldg-gband, th.ldg-g-编号 { border-bottom-color: #c7d2fe; }
  .ldg-g-时间 { background: #ecfeff !important; color: #0e7490; }
  .ldg-g-人员 { background: #f0fdf4 !important; color: #15803d; }
  .ldg-g-状态 { background: #fefce8 !important; color: #a16207; }
  .ldg-g-数量 { background: #fdf4ff !important; color: #a21caf; }
  .ldg-g-其他 { background: #f8fafc !important; color: #64748b; }
  /* 合并表「炉前 · 混料」的来源分组 */
  .ldg-g-炉前 { background: #eff6ff !important; color: #1d4ed8; }
  .ldg-g-班数据 { background: #f0fdf4 !important; color: #15803d; }
  .ldg-g-D料 { background: #ecfeff !important; color: #0e7490; }
  .ldg-g-H料 { background: #fefce8 !important; color: #a16207; }
  .ldg-g-混料 { background: #fdf4ff !important; color: #a21caf; }
  td.ldg-gstart, th.ldg-gstart { box-shadow: inset 2px 0 0 rgba(100,116,139,.35); }
  /* 列设置 */
  .ldg-colbtn { border: 1px solid var(--line); background: var(--card); border-radius: 6px; padding: 5px 12px; font-size: 12px; color: var(--sub); cursor: pointer; margin-left: 10px; white-space: nowrap; transition: color .15s ease, border-color .15s ease; }
  .ldg-colbtn.on, .ldg-colbtn:hover { border-color: var(--primary); color: var(--primary); }
  .ldg-colpanel { position: absolute; right: 12px; top: calc(100% - 6px); width: 300px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: 0 8px 24px rgba(0,0,0,.10); z-index: 60; padding: 12px; }
  .ldg-colsearch { width: 100%; border: 1px solid transparent; background: var(--fill); border-radius: var(--r-ctl); padding: 6px 10px; font-size: 13px; box-sizing: border-box; outline: none; transition: background-color .15s ease, box-shadow .15s ease; }
  .ldg-colsearch:focus { background: var(--card); box-shadow: var(--ring); }
  .ldg-colactions { display: flex; gap: 12px; padding: 8px 2px; font-size: 12px; }
  .ldg-colactions a { color: var(--primary); cursor: pointer; }
  .ldg-colactions a:hover { text-decoration: underline; }
  .ldg-collist { max-height: 320px; overflow-y: auto; border-top: 1px solid var(--line); padding-top: 6px; }
  .ldg-colgroup-h { font-size: 11px; color: var(--faint); letter-spacing: 1px; padding: 8px 2px 2px; }
  .ldg-colitem { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text); padding: 4px 2px; cursor: pointer; border-radius: 4px; }
  .ldg-colitem:hover { background: var(--fill); }
  .ldg-colitem input { accent-color: var(--primary); }
  .ldg-colitem.off { color: var(--faint); cursor: not-allowed; }
  .ldg-adminmark { font-size: 11px; color: var(--faint); background: var(--fill); border-radius: 4px; padding: 0 5px; }
  /* 记录详情抽屉 */
  .ldg-drawer { width: 480px; max-width: 92vw; height: 100%; background: #fff; display: flex; flex-direction: column; box-shadow: -6px 0 18px rgba(0, 0, 0, .08); }
  .ldg-drawer-body { flex: 1; overflow-y: auto; padding: 16px 20px; }
  .ldg-dgroup { margin-bottom: 18px; }
  .ldg-dgroup-h { font-size: 12px; font-weight: 600; letter-spacing: 1px; color: var(--primary); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
  .ldg-dgroup-h::before { content: ''; width: 3px; height: 12px; background: var(--primary); border-radius: 2px; }
  .ldg-drow { display: flex; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
  .ldg-dk { flex-shrink: 0; width: 150px; color: var(--sub); }
  .ldg-dv { flex: 1; min-width: 0; color: var(--text); word-break: break-all; font-variant-numeric: tabular-nums; }

  /* ===== 台账大改：视图切换 / 聚焦视图 / 表格增强 ===== */
  .ldg-viewsw { margin-left: auto; display: flex; background: var(--fill); border: 1px solid var(--line); border-radius: var(--r-ctl); overflow: hidden; flex-shrink: 0; }
  .ldg-viewsw button { border: 0; background: transparent; color: var(--sub); font-size: 13px; font-weight: 500; padding: 6px 14px; cursor: pointer; transition: color .15s ease, background-color .15s ease; }
  .ldg-viewsw button:hover { color: var(--text); }
  .ldg-viewsw button.on { background: var(--primary); color: #fff; font-weight: 600; }
  .ldg-searchwrap { margin-left: auto; }
  .ldg-searchwrap .ldg-colsearch { width: 260px; }
  .ldg-gfilter { display: flex; align-items: center; gap: 10px; padding: 12px 20px 2px; flex-wrap: wrap; }
  /* 聚焦视图：左侧记录列表 + 右侧字段详情 */
  .ldg-focus { display: grid; grid-template-columns: 300px minmax(0, 1fr); border-top: 1px solid var(--line); min-height: 440px; }
  .ldg-list { border-right: 1px solid var(--line); background: #fcfcfd; max-height: 620px; overflow-y: auto; }
  .ldg-rec { padding: 11px 14px; border-bottom: 1px solid var(--line); cursor: pointer; position: relative; transition: background-color .15s ease; }
  .ldg-rec:hover { background: var(--fill); }
  .ldg-rec.on { background: var(--primary-soft); }
  .ldg-rec.on::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--primary); }
  .ldg-rec .t { font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ldg-rec .m { display: flex; gap: 8px; align-items: center; margin-top: 4px; font-size: 12px; color: var(--faint); min-width: 0; }
  .ldg-rec .m span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ldg-rec .badge { flex-shrink: 0; font-size: 11px; padding: 1px 8px; border-radius: 4px; background: var(--card); color: var(--sub); border: 1px solid var(--line); }
  .ldg-rec .s { margin-top: 4px; font-size: 12px; color: var(--sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ldg-detail { max-height: 620px; overflow-y: auto; padding: 16px 22px 20px; }
  .ldg-dcount { font-style: normal; font-weight: 400; font-size: 11px; color: var(--faint); background: var(--fill); border-radius: 4px; padding: 0 6px; margin-left: 6px; }
  .ldg-kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0 20px; }
  .ldg-kv .kv { display: flex; gap: 8px; align-items: baseline; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 13px; min-width: 0; }
  .ldg-kv .k { color: var(--sub); flex-shrink: 0; max-width: 48%; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ldg-kv .v { color: var(--text); font-weight: 600; min-width: 0; word-break: break-all; font-variant-numeric: tabular-nums; }
  .ldg-empty { padding: 40px 16px; text-align: center; color: var(--faint); font-size: 13px; line-height: 1.8; }
  /* 合并表：混料物料明细（默认摘要 + 展开表格） */
  .chem-sum { display: flex; align-items: center; gap: 12px; padding: 6px 0 2px; font-size: 13px; color: var(--sub); flex-wrap: wrap; }
  .chem-sum-t b { color: var(--text); font-size: 15px; font-weight: 700; margin: 0 2px; }
  .chem-toggle { margin-left: auto; border: 1px solid var(--line); background: var(--card); color: var(--primary); font-size: 12px; font-weight: 500; padding: 4px 12px; border-radius: 6px; cursor: pointer; transition: background-color .15s ease, border-color .15s ease; white-space: nowrap; }
  .chem-toggle:hover { background: var(--primary-soft); border-color: #93c5fd; }
  .chem-hint { font-size: 12px; color: var(--faint); padding: 4px 0 6px; }
  .chem-scroll { overflow: auto; max-height: 320px; border: 1px solid var(--line); border-radius: var(--r-ctl); margin-top: 8px; }
  .chem-grid { font-size: 12px; min-width: 100%; }
  .chem-grid th { position: sticky; top: 0; z-index: 2; padding: 7px 10px; }
  .chem-grid td { padding: 6px 10px; }
  /* 表格视图：首列冻结（含表头两层）+ 数字右对齐 + 行焦点 */
  .ldg-wrap thead tr:first-child th { z-index: 4; }
  .ldg-wrap thead tr:nth-child(2) th { z-index: 3; }
  .ldg-wrap thead th:first-child { z-index: 6; }
  .ldg-wrap td:first-child { position: sticky; left: 0; z-index: 2; background: var(--card); font-weight: 600; color: var(--text); box-shadow: 1px 0 0 var(--line); }
  .ldg-wrap tbody tr:nth-child(even) td:first-child { background: #fcfcfd; }
  .ldg-wrap tbody tr:hover td:first-child { background: var(--primary-soft); }

  /* ===== 响应式：桌面 ≥1024 完整侧栏；移动端抽屉 ===== */
  @media (min-width: 1024px) {
    .hamburger { display: none !important; }
    .nav-overlay { display: none !important; }
  }
  @media (max-width: 1023px) {
    .sider { width: 256px; transform: translateX(-100%); box-shadow: none; }
    .layout.navopen .sider { transform: translateX(0); box-shadow: 4px 0 16px rgba(0,0,0,.10); }
    .layout.collapsed .sider { width: 256px; }
    .layout.collapsed .brand { flex-direction: row; padding: 16px 14px; }
    .layout.collapsed .brand-text, .layout.collapsed .nav-group, .layout.collapsed .sider-foot .u, .layout.collapsed .nav-label { display: block; }
    .layout.collapsed .brand-text { display: block; }
    .layout.collapsed .side-toggle { margin-left: auto; }
    .layout.collapsed .sider nav a { justify-content: flex-start; padding: 10px 12px; gap: 10px; }
    .layout.collapsed .sider-foot a { justify-content: flex-start; padding: 6px 12px; }
    .main, .layout.collapsed .main { margin-left: 0; }
    .hamburger { display: inline-flex; }
    .side-toggle { display: none; }
    .nav-overlay { display: block; position: fixed; inset: 0; background: rgba(24, 24, 27, .5); z-index: 45; }
    .mhead { padding: 12px 16px; flex-wrap: wrap; gap: 10px; }
    .page { padding: 16px 16px 40px; }
    .home-hero { margin: -16px -16px 0; min-height: 360px; }
    .hero-inner { padding: 40px 24px; }
    .hero-inner h1 { font-size: 26px; }
    .home-stats { grid-template-columns: repeat(2, 1fr); }
    .home-cards { grid-template-columns: 1fr; }
    .kpi-row { grid-template-columns: 1fr; }
    .brief-body { max-width: none; }
    /* 聚焦视图：手机上列表在上、详情在下 */
    .ldg-focus { grid-template-columns: 1fr; min-height: 0; }
    .ldg-list { border-right: 0; border-bottom: 1px solid var(--line); max-height: 280px; }
    .ldg-detail { max-height: none; }
    .ldg-searchwrap { width: 100%; margin-left: 0; }
    .ldg-searchwrap .ldg-colsearch { width: 100%; }
    .ldg-gfilter { padding: 10px 14px 0; }
  }

  /* 减少动效偏好 */
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
  }


/* 图表自动占满卡片剩余高度（所有含图表的卡片生效） */
.card:has(.chart) { display: flex; flex-direction: column; }
.card-b:has(.chart) { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.card-b > .chart { flex: 1; height: auto; min-height: 320px; }
