  :root {
    color-scheme: light;
    /* 品牌（天立独流老醋：枣红 + 赭金 + 米白） */
    --brand: #A32F1B;
    --brand-deep: #8A2311;
    --brand-gold: #C49A4F;
    --brand-ink: #ffffff;
    --sidebar: #2A130E;
    --sidebar-ink: #E3CDB7;
    --page: #FAF5EC;
    --surface: #ffffff;
    --surface-2: #F5EDE1;
    --border: rgba(70,35,18,0.13);
    --hairline: #EADCCB;
    --ink: #241611;
    --ink-2: #5B463A;
    --muted: #8C7A6B;
    --font-serif: "Source Han Serif SC", "Noto Serif SC", "Songti SC", STSong, SimSun, serif;

    /* 数据色（dataviz 规范） */
    --s1: #A32F1B; --s2: #E08A3C; --s3: #1b8f6a; --s4: #C49A4F;
    --s5: #e87ba4; --s6: #008300; --s7: #4a3aa7; --s8: #e34948;
    --seq: #A8532A; --seq-100: #F1DDCB; --seq-400: #C0703F; --seq-600: #7A2A14;

    /* 状态色（固定） */
    --good: #0ca30c; --warn: #fab219; --serious: #ec835a; --crit: #d03b3b;

    --r: 10px; --r-sm: 6px;
    --shadow: 0 1px 2px rgba(11,11,11,0.05), 0 4px 16px rgba(11,11,11,0.05);
  }

  * { box-sizing: border-box; margin: 0; padding: 0; }
  html, body { height: 100%; }
  body {
    font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
    background: var(--page); color: var(--ink); font-size: 14px; line-height: 1.5;
  }
  button { font-family: inherit; cursor: pointer; }

  /* ===== 登录页 ===== */
  #login {
    position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
    background:
      radial-gradient(900px 520px at 12% 6%, rgba(196,154,79,0.18), transparent 60%),
      radial-gradient(760px 620px at 92% 96%, rgba(163,47,27,0.35), transparent 62%),
      linear-gradient(135deg, #24100B 0%, #4A1B10 52%, #7C2110 100%);
    padding: 20px;
  }
  .login-shell {
    display: flex; width: 880px; max-width: 100%; background: #fff; border-radius: 20px; overflow: hidden;
    box-shadow: 0 30px 80px rgba(0,0,0,0.45);
  }
  .login-brand {
    flex: 0 0 380px; padding: 44px 38px; color: #F7E6C2; display: flex; flex-direction: column;
    background:
      radial-gradient(420px 300px at 100% 0%, rgba(231,199,126,0.22), transparent 62%),
      linear-gradient(150deg, #7F2412 0%, #5A1A0F 100%);
  }
  .login-brand .lb-logo { width: 268px; max-width: 100%; display: block; margin-bottom: 26px; }
  .login-brand .lb-title {
    font-family: var(--font-serif); font-size: 30px; font-weight: 700; letter-spacing: 4px; color: #FBEFD8;
  }
  .login-brand .lb-sub { margin-top: 12px; font-size: 13.5px; line-height: 2; color: #E4CBA6; letter-spacing: .5px; }
  .login-brand .lb-rule { height: 1px; background: rgba(231,199,126,0.4); margin: 24px 0; }
  .login-brand .lb-foot { margin-top: auto; font-size: 12.5px; color: #E3C79A; letter-spacing: .5px; }
  .login-card {
    flex: 1; background: #fff; padding: 44px 40px; min-width: 0;
  }
  .login-card .login-hd { margin-bottom: 26px; }
  .login-card .login-hd .t { font-family: var(--font-serif); font-size: 22px; font-weight: 700; color: var(--brand-deep); letter-spacing: 2px; }
  .login-card .login-hd .s { color: #5B463A; font-size: 12.5px; margin-top: 6px; }
  .field { margin-bottom: 16px; }
  .field label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
  .field input {
    width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-sm);
    font-size: 14px; outline: none;
  }
  .field input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(42,120,214,0.15); }
  .btn-login {
    width: 100%; padding: 11px; background: var(--brand); color: #fff; border: none; border-radius: var(--r-sm);
    font-size: 15px; font-weight: 600; margin-top: 4px;
  }
  .btn-login:hover { background: #256abf; }
  .login-tip { text-align: center; color: #5B463A; font-size: 12px; line-height: 1.65; margin-top: 16px; white-space: normal; word-break: break-word; }

  /* ===== 布局 ===== */
  #app { display: none; height: 100vh; }
  #app.on { display: flex; }

  .sidebar {
    width: 220px; flex: 0 0 220px; background: var(--sidebar); color: var(--sidebar-ink);
    display: flex; flex-direction: column; padding: 20px 12px;
  }
  .sidebar .brand { padding: 2px 10px 18px; border-bottom: 1px solid rgba(231,199,126,0.18); margin-bottom: 12px; }
  .sidebar .brand-logo { width: 168px; max-width: 100%; display: block; }
  .sidebar .brand small { display: block; font-size: 11px; color: var(--sidebar-ink); font-weight: 400; margin-top: 8px; letter-spacing: 1px; }
  .nav { flex: 1; overflow-y: auto; }
  .nav-item {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px;
    color: var(--sidebar-ink); text-decoration: none; cursor: pointer; margin-bottom: 2px; font-size: 14px;
  }
  .nav-item:hover { background: rgba(255,255,255,0.08); }
  .nav-item.active { background: rgba(163,47,27,0.92); color: #fff; box-shadow: inset 3px 0 0 var(--brand-gold); }
  .nav-item .ic { width: 18px; text-align: center; opacity: 0.9; }
  .sidebar .user {
    display: flex; align-items: center; gap: 10px; padding: 12px; border-top: 1px solid rgba(255,255,255,0.1);
  }
  .avatar {
    width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff;
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
  }
  .sidebar .user .name { color: #fff; font-size: 13px; }
  .sidebar .user .role { color: var(--sidebar-ink); font-size: 11px; }

  .main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
  .topbar {
    height: 60px; flex: 0 0 60px; background: var(--surface); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 16px; padding: 0 24px;
  }
  .topbar .title { font-size: 17px; font-weight: 700; font-family: var(--font-serif); letter-spacing: 1px; }
  .topbar .search {
    margin-left: auto; width: 260px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 20px; outline: none;
  }
  .content { flex: 1; overflow-y: auto; padding: 24px; }

  .page { display: none; }
  .page.on { display: block; }

  /* ===== 组件 ===== */
  .grid { display: grid; gap: 16px; }
  .cols-4 { grid-template-columns: repeat(4, 1fr); }
  .cols-2 { grid-template-columns: repeat(2, 1fr); }
  .cols-3 { grid-template-columns: repeat(3, 1fr); }

  .card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow); }
  .card .card-h { padding: 14px 18px; border-bottom: 1px solid var(--hairline); font-weight: 700; font-size: 14px; display: flex; align-items: center; justify-content: space-between; }
  .card .card-b { padding: 18px; }

  .tile { padding: 18px; }
  .tile .label { color: var(--ink-2); font-size: 13px; }
  .tile .value { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; margin: 6px 0 2px; }
  .tile .delta { font-size: 12px; }
  .delta.up { color: #006300; }
  .delta.down { color: var(--crit); }
  .delta.flat { color: var(--muted); }

  table { width: 100%; border-collapse: collapse; font-size: 13px; }
  th { text-align: left; color: var(--muted); font-weight: 500; padding: 10px 12px; border-bottom: 1px solid var(--hairline); font-size: 12px; }
  td { padding: 11px 12px; border-bottom: 1px solid var(--hairline); }
  tbody tr:hover { background: var(--surface-2); }
  .num { font-variant-numeric: tabular-nums; }
  .link { color: var(--brand); cursor: pointer; }
  .link:hover { text-decoration: underline; }

  .tag { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 20px; font-size: 12px; background: var(--surface-2); color: var(--ink-2); }
  .dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
  .tag.good { background: #e6f6e6; color: #006300; } .dot.good { background: var(--good); }
  .tag.warn { background: #fdf3d8; color: #7a5600; } .dot.warn { background: var(--warn); }
  .tag.serious { background: #fdeae1; color: #9c4a1e; } .dot.serious { background: var(--serious); }
  .tag.crit { background: #fbe5e5; color: #a32626; } .dot.crit { background: var(--crit); }
  .tag.blue { background: #e6effb; color: #1c5cab; }

  .btn { padding: 8px 14px; border-radius: var(--r-sm); border: 1px solid var(--border); background: #fff; font-size: 13px; }
  .btn:hover { background: var(--surface-2); }
  .btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
  .btn.primary:hover { background: #256abf; }
  .btn.ghost { border: 1px dashed var(--brand); color: var(--brand); background: transparent; }

  .tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--hairline); margin-bottom: 16px; }
  .tab { padding: 9px 16px; cursor: pointer; color: var(--ink-2); border-bottom: 2px solid transparent; font-size: 13px; }
  .tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
  .tabpane { display: none; }
  .tabpane.on { display: block; }

  .toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
  .toolbar input, .toolbar select { padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--r-sm); font-size: 13px; outline: none; }
  .toolbar .spacer { flex: 1; }

  .kpi-note { font-size: 12px; color: var(--muted); }

  /* 图表 */
  .legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; }
  .legend .li { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-2); }
  .legend .sw { width: 10px; height: 10px; border-radius: 3px; }

  .hstack { display: flex; height: 24px; border-radius: 4px; overflow: hidden; gap: 2px; }
  .hstack .seg { height: 100%; }
  .hstack .seg:first-child { border-radius: 4px 0 0 4px; }
  .hstack .seg:last-child { border-radius: 0 4px 4px 0; }

  .bar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
  .bar-row .nm { width: 90px; text-align: right; color: var(--ink-2); font-size: 13px; }
  .bar-row .track { flex: 1; height: 22px; background: var(--surface-2); border-radius: 4px; }
  .bar-row .bar { height: 22px; background: var(--seq); border-radius: 4px 4px 4px 4px; color: #fff; font-size: 12px; padding: 2px 8px; text-align: right; font-variant-numeric: tabular-nums; }
  .bar-row .bar.light { color: var(--ink-2); background: var(--seq-100); }

  .filter-pills { display: flex; gap: 8px; }
  .pill { padding: 5px 12px; border-radius: 20px; font-size: 12px; border: 1px solid var(--border); cursor: pointer; color: var(--ink-2); }
  .pill.active { background: var(--brand); color: #fff; border-color: var(--brand); }

  /* 手机打卡模拟 */
  .phone {
    width: 260px; margin: 0 auto; border: 8px solid #14263b; border-radius: 26px; overflow: hidden; background: #fff;
  }
  .phone .ph-bar { background: #14263b; color: #fff; padding: 10px; text-align: center; font-size: 13px; }
  .phone .ph-body { padding: 20px; }
  .loc-pin { text-align: center; font-size: 40px; margin: 6px 0; }
  .loc-status { text-align: center; color: var(--muted); font-size: 12px; margin-bottom: 14px; }

  .modal-bg { position: fixed; inset: 0; background: rgba(11,11,11,0.4); display: none; align-items: center; justify-content: center; z-index: 90; }
  .modal-bg.on { display: flex; }
  .modal { position: relative; width: 560px; max-height: 84vh; overflow-y: auto; background: #fff; border-radius: 12px; padding: 22px; }
  .modal h3 { margin-bottom: 16px; }
  .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .form-grid .full { grid-column: 1 / -1; }
  .form-grid label { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 5px; }
  .form-grid input, .form-grid select { width: 100%; padding: 9px 10px; border: 1px solid var(--border); border-radius: var(--r-sm); }
  .modal .foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

  .toast { position: fixed; top: 76px; right: 24px; background: #14263b; color: #fff; padding: 12px 18px; border-radius: 8px; font-size: 13px; display: none; z-index: 200; }
  .toast.on { display: block; }

  .muted { color: var(--muted); }
  .mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mb16 { margin-bottom: 16px; }
  .flex { display: flex; align-items: center; gap: 10px; }
  .section-title { font-size: 15px; font-weight: 700; margin: 20px 0 10px; }

  /* ===== 通用组件补充 ===== */
  .btn-block { display: block; width: 100%; text-align: center; }
  .modal-close { display: none; }
  .tabbar { display: none; }

  /* ===== 订单明细卡片（桌面 + 手机通用） ===== */
  .order-items { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
  .item-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px; background: var(--surface); box-shadow: var(--shadow); }
  .ic-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
  .ic-idx { font-weight: 700; color: var(--brand); font-size: 14px; }
  .ic-del { font-size: 13px; }
  .ic-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
  .ic-row > label { font-size: 12px; color: var(--muted); }
  .ic-row input, .ic-row select { width: 100%; padding: 11px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 15px; background: #fff; }
  .ic-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .stepper { display: flex; align-items: center; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
  .stepper button { width: 44px; height: 44px; border: none; background: var(--surface-2); font-size: 20px; line-height: 1; color: var(--ink); flex: none; }
  .stepper button:active { background: #e6e6e0; }
  .stepper input { flex: 1; min-width: 0; border: none; text-align: center; font-size: 16px; height: 44px; padding: 0; -moz-appearance: textfield; }
  .stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
  .ic-total { display: flex; justify-content: space-between; align-items: center; border-top: 1px dashed var(--hairline); padding-top: 10px; font-weight: 700; font-size: 16px; }
  .ic-total .o_amount { color: var(--brand); font-variant-numeric: tabular-nums; }
  .order-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
  .order-btns { display: flex; gap: 10px; }
  .order-summary { font-size: 14px; color: var(--ink-2); }
  .order-summary b { color: var(--brand); font-size: 17px; font-variant-numeric: tabular-nums; }

  /* ===== 汉堡按钮与移动侧栏遮罩 ===== */
  .hamburger { display: none; background: none; border: none; font-size: 22px; color: var(--ink); line-height: 1; padding: 4px 8px; }
  .sidebar-bg { display: none; position: fixed; inset: 0; background: rgba(11,11,11,0.4); z-index: 60; }

  /* ===== 移动端（手机优先，≤768px） ===== */
  @media (max-width: 768px) {
    body { font-size: 15px; }
    .hamburger { display: none; }               /* 手机改用底部 tabbar */
    .sidebar {
      position: fixed; left: 0; top: 0; bottom: 0; z-index: 70;
      width: 264px; flex: 0 0 264px;
      transform: translateX(-100%); transition: transform 0.25s ease;
    }
    #app.nav-open .sidebar { transform: translateX(0); }
    #app.nav-open .sidebar-bg { display: block; }

    .main { width: 100%; }
    .topbar { height: 52px; flex: 0 0 52px; padding: 0 16px; }
    .topbar .title { font-size: 16px; }
    .content { padding: 14px 14px 24px; }

    .login-card { width: calc(100vw - 32px); }

    /* 指标卡片两列 */
    .cols-4, .cols-3, .cols-2 { grid-template-columns: 1fr 1fr; gap: 10px; }
    .tile { padding: 14px; }
    .tile .value { font-size: 22px; }
    .form-grid { grid-template-columns: 1fr; }

    /* 列表表格 → 卡片 */
    table.as-cards { display: block; width: 100%; }
    table.as-cards thead { display: none; }
    table.as-cards tbody { display: block; }
    table.as-cards tr { display: block; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; padding: 4px 14px; background: var(--surface); box-shadow: var(--shadow); }
    table.as-cards tbody tr:hover { background: var(--surface); }
    table.as-cards td { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--hairline); text-align: right; }
    table.as-cards td:last-child { border-bottom: none; }
    table.as-cards td::before { content: attr(data-label); color: var(--muted); font-size: 12px; flex: 0 0 82px; text-align: left; font-weight: 500; }
    table.as-cards td.row-actions, table.as-cards td[data-label=""] { display: block; text-align: right; border-top: 1px dashed var(--hairline); padding-top: 10px; }
    table.as-cards td.row-actions::before, table.as-cards td[data-label=""]::before { display: none; }
    table.as-cards td.row-actions .link, table.as-cards td[data-label=""] .link { display: inline-block; padding: 7px 12px; margin-left: 6px; font-size: 14px; }

    /* 弹窗 → 底部全屏面板 */
    .modal-bg { align-items: flex-end; }
    .modal { width: 100% !important; max-width: 100% !important; max-height: 96vh; border-radius: 16px 16px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); }
    .modal h3 { font-size: 17px; padding-right: 32px; }
    .modal-close { display: block; position: absolute; top: 16px; right: 14px; width: 32px; height: 32px; border: none; background: var(--surface-2); border-radius: 50%; font-size: 15px; color: var(--ink-2); }
    .modal .foot { flex-wrap: wrap; }
    .modal .foot .btn { flex: 1; min-width: 96px; padding: 12px 16px; font-size: 15px; }

    /* 表单与按钮加大触控 */
    .form-grid input, .form-grid select, .toolbar input, .toolbar select { min-height: 44px; font-size: 15px; }
    .btn { min-height: 40px; padding: 9px 16px; font-size: 14px; }
    .toolbar { gap: 8px; }
    .toolbar input { width: 100% !important; }
    .toolbar .btn { flex: 1; }
    .toolbar .spacer { display: none; }

    /* 底部 tabbar */
    .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: 58px; background: var(--surface); border-top: 1px solid var(--border); z-index: 50; padding-bottom: env(safe-area-inset-bottom); }
    .tb-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); cursor: pointer; }
    .tb-item .tb-ic { font-size: 20px; line-height: 1; }
    .tb-item .tb-label { font-size: 11px; }
    .tb-item.active { color: var(--brand); font-weight: 600; }

    .toast { left: 14px; right: 14px; top: auto; bottom: 76px; text-align: center; }
  }


  /* =========================================================
     v3 品牌：横幅 / 品牌卡 / 登录页响应式
     ========================================================= */
  .brand-banner {
    position: relative; overflow: hidden; border-radius: 14px; margin-bottom: 18px;
    background:
      radial-gradient(620px 320px at 88% 8%, rgba(231,199,126,0.22), transparent 62%),
      radial-gradient(520px 380px at 4% 100%, rgba(255,255,255,0.07), transparent 60%),
      linear-gradient(120deg, #7F2412 0%, #A32F1B 58%, #6E1D0D 100%);
    color: #FBEFD8; min-height: 132px; display: flex; align-items: center;
  }
  .brand-banner .bb-inner { padding: 26px 150px 26px 30px; position: relative; z-index: 1; }
  .brand-banner .bb-kicker { font-size: 12px; letter-spacing: 2px; color: #E4CBA6; }
  .brand-banner .bb-title {
    font-family: var(--font-serif); font-size: 25px; font-weight: 700; letter-spacing: 3px; margin: 8px 0 6px;
  }
  .brand-banner .bb-sub { font-size: 13px; color: #E9D3AE; letter-spacing: .5px; }
  .brand-banner .bb-seal {
    position: absolute; right: 26px; top: 50%; transform: translateY(-50%);
    width: 74px; height: 74px; border-radius: 12px; background: rgba(231,199,126,0.16);
    border: 1px solid rgba(231,199,126,0.45); display: flex; align-items: center; justify-content: center;
    font-family: var(--font-serif); font-size: 30px; color: #F7E6C2;
  }
  .brand-banner.has-img { background: #7F2412; }
  .brand-banner .bb-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
  .brand-banner.has-img .bb-inner, .brand-banner.has-img .bb-seal { display: none; }

  /* 页头品牌小字 */
  .page-kicker { font-size: 12px; color: var(--muted); letter-spacing: 1px; margin-bottom: 2px; }

  @media (max-width: 768px) {
    .login-shell { flex-direction: column; width: 100%; max-width: 420px; border-radius: 16px; box-sizing: border-box; }
    #login { padding: 14px; overflow-x: hidden; }
    .login-card, .login-brand { box-sizing: border-box; }
    .login-brand { flex: none; padding: 26px 22px 22px; }
    .login-brand .lb-logo { width: 210px; margin-bottom: 16px; }
    .login-brand .lb-title { font-size: 22px; letter-spacing: 2px; }
    .login-brand .lb-sub { font-size: 12.5px; line-height: 1.9; margin-top: 8px; }
    .login-brand .lb-rule { margin: 16px 0; }
    .login-card { padding: 26px 22px 30px; }
    .login-card .login-hd { margin-bottom: 18px; }
    .login-card .login-hd .t { font-size: 19px; }
    .brand-banner { min-height: 116px; border-radius: 12px; }
    .brand-banner .bb-inner { padding: 18px 18px; }
    .brand-banner .bb-title { font-size: 20px; letter-spacing: 2px; }
    .brand-banner .bb-sub { font-size: 12px; }
    .brand-banner .bb-seal { display: none; }
  }
