/* ==========================================================================
   闪电系统 · 主题化设计令牌 tokens.css  v2.0
   --------------------------------------------------------------------------
   架构：data-theme（色彩方向）× data-mode（明暗）全覆盖
     data-theme: electric-sky | deep-ink | solar-amber | dusk-sky | graphite
     data-mode : light | dark
     默认组合  : electric-sky + light（:root 兜底）
     deep-ink 主题默认 mode=dark（暗色原生），其余默认 light
   附加属性：
     data-density : comfortable | compact | dense  （表格/工作台密度）
     data-role    : admin | dispatcher | installer | public（角色变体）
   --------------------------------------------------------------------------
   用法：<html data-theme="electric-sky" data-mode="light" data-density="comfortable" data-role="admin">
   所有颜色为 RGB 三元组，组件类通过 rgb(var(--x) / alpha) 派生透明度，切换零运行时构建。
   ========================================================================== */

/* ============================================================
   1. 共享基准（字体 / 圆角 / 间距 / 阴影 / 层级 / 尺寸默认）
   ============================================================ */
:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", "Roboto Mono", "Consolas", monospace;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 999px;

  --space-1: 4px;  --space-2: 8px;  --space-3: 12px;
  --space-4: 16px; --space-6: 24px; --space-8: 32px; --space-12: 48px;

  --shadow-1: 0 1px 2px rgb(15 23 42 / .05);
  --shadow-2: 0 4px 12px rgb(15 23 42 / .07);
  --shadow-3: 0 12px 32px rgb(15 23 42 / .14);

  --z-dropdown: 100; --z-sticky: 200; --z-modal: 300; --z-toast: 400;

  --topbar-h: 56px;
  --sidebar-w: 256px;
  --table-row-h: 44px;
  --table-cell-py: 12px;
  --table-font: 13px;
  --touch-min: 40px;
}

/* ============================================================
   2. 主题 × 模式色板（RGB 三元组）
   变量：bg / surface / surface-2 / primary(+hover/active/ink/on) /
         accent / text-1/2/3 / border / border-strong /
         success / warning / danger / info / echarts-palette
   ============================================================ */

/* ---------- 默认兜底 = 电驭青蓝 · 浅色 ---------- */
:root,
[data-theme="electric-sky"][data-mode="light"] {
  --color-bg: 248 250 252;          /* slate-50 */
  --color-surface: 255 255 255;     /* white */
  --color-surface-2: 241 245 249;   /* slate-100 */
  --color-primary: 2 132 199;       /* sky-600 */
  --color-primary-hover: 3 105 161; /* sky-700 */
  --color-primary-active: 7 89 133; /* sky-800 */
  --color-primary-ink: 3 105 161;   /* sky-700 文字（白底≥4.5:1） */
  --color-on-primary: 255 255 255;
  --color-accent: 251 191 36;       /* amber-400 电火花/施工安全 */
  --color-text-1: 15 23 42;         /* slate-900 */
  --color-text-2: 71 85 105;        /* slate-600 */
  --color-text-3: 100 116 139;      /* slate-500（AA ≥4.5:1） */
  --color-border: 226 232 240;      /* slate-200 */
  --color-border-strong: 203 213 225; /* slate-300 */
  --color-success: 5 150 105;       /* emerald-600 */
  --color-warning: 180 83 9;        /* amber-700（白底文字 AA） */
  --color-danger: 220 38 38;        /* red-600 */
  --color-info: 37 99 235;          /* blue-600 */
  --echarts-palette: #0284c7, #fbbf24, #10b981, #ef4444, #2563eb, #94a3b8, #8b5cf6, #14b8a6;
}

/* ---------- 电驭青蓝 · 深色（调度监控暗室） ---------- */
[data-theme="electric-sky"][data-mode="dark"] {
  --color-bg: 2 6 23;               /* slate-950 */
  --color-surface: 15 23 42;        /* slate-900 */
  --color-surface-2: 30 41 59;      /* slate-800 */
  --color-primary: 56 189 248;      /* sky-400 */
  --color-primary-hover: 14 165 233;/* sky-500 */
  --color-primary-active: 125 211 252; /* sky-300 */
  --color-primary-ink: 125 211 252; /* sky-300 文字 */
  --color-on-primary: 8 47 73;      /* sky-950 */
  --color-accent: 252 211 77;       /* amber-300 */
  --color-text-1: 241 245 249;      /* slate-100 */
  --color-text-2: 148 163 184;      /* slate-400 */
  --color-text-3: 100 116 139;      /* slate-500 */
  --color-border: 51 65 85;         /* slate-700 */
  --color-border-strong: 71 85 105; /* slate-600 */
  --color-success: 52 211 153;      /* emerald-400 */
  --color-warning: 251 191 36;      /* amber-400 */
  --color-danger: 248 113 113;      /* red-400 */
  --color-info: 96 165 250;         /* blue-400 */
  --echarts-palette: #38bdf8, #fcd34d, #34d399, #f87171, #60a5fa, #94a3b8, #a78bfa, #2dd4bf;
}

/* ---------- 深空墨绿 · 深色（默认，暗色原生） ---------- */
[data-theme="deep-ink"][data-mode="dark"] {
  --color-bg: 2 6 23;               /* slate-950 */
  --color-surface: 15 23 42;        /* slate-900 */
  --color-surface-2: 30 41 59;      /* slate-800 */
  --color-primary: 16 185 129;      /* emerald-500 */
  --color-primary-hover: 52 211 153;/* emerald-400 */
  --color-primary-active: 5 150 105;/* emerald-600 */
  --color-primary-ink: 52 211 153;  /* emerald-400 文字 */
  --color-on-primary: 2 44 34;      /* emerald-950 */
  --color-accent: 103 232 249;      /* cyan-300 能量电弧 */
  --color-text-1: 241 245 249;      /* slate-100 */
  --color-text-2: 148 163 184;      /* slate-400 */
  --color-text-3: 100 116 139;      /* slate-500 */
  --color-border: 51 65 85;         /* slate-700 */
  --color-border-strong: 71 85 105; /* slate-600 */
  --color-success: 52 211 153;      /* emerald-400 */
  --color-warning: 251 191 36;      /* amber-400 */
  --color-danger: 248 113 113;      /* red-400 */
  --color-info: 96 165 250;         /* blue-400 */
  --echarts-palette: #10b981, #67e8f9, #38bdf8, #fbbf24, #a78bfa, #94a3b8, #059669, #fb7185;
}

/* ---------- 深空墨绿 · 浅色（辅助） ---------- */
[data-theme="deep-ink"][data-mode="light"] {
  --color-bg: 248 250 252;          /* slate-50 */
  --color-surface: 255 255 255;
  --color-surface-2: 241 245 249;   /* slate-100 */
  --color-primary: 5 150 105;       /* emerald-600 */
  --color-primary-hover: 4 120 87;  /* emerald-700 */
  --color-primary-active: 6 95 70;  /* emerald-800 */
  --color-primary-ink: 4 120 87;    /* emerald-700 文字 */
  --color-on-primary: 255 255 255;
  --color-accent: 8 145 178;        /* cyan-600 */
  --color-text-1: 15 23 42;         /* slate-900 */
  --color-text-2: 71 85 105;        /* slate-600 */
  --color-text-3: 100 116 139;      /* slate-500（AA ≥4.5:1） */
  --color-border: 226 232 240;      /* slate-200 */
  --color-border-strong: 203 213 225; /* slate-300 */
  --color-success: 5 150 105;       /* emerald-600 */
  --color-warning: 180 83 9;        /* amber-700 */
  --color-danger: 220 38 38;        /* red-600 */
  --color-info: 37 99 235;          /* blue-600 */
  --echarts-palette: #059669, #0891b2, #0284c7, #d97706, #7c3aed, #64748b, #047857, #e11d48;
}

/* ---------- 曜金工程橙 · 浅色（默认） ---------- */
[data-theme="solar-amber"][data-mode="light"] {
  --color-bg: 248 250 252;          /* slate-50 中性非米白 */
  --color-surface: 255 255 255;
  --color-surface-2: 241 245 249;   /* slate-100 */
  --color-primary: 234 88 12;       /* orange-600 */
  --color-primary-hover: 194 65 12; /* orange-700 */
  --color-primary-active: 154 52 18;/* orange-800 */
  --color-primary-ink: 194 65 12;   /* orange-700 文字 */
  --color-on-primary: 255 255 255;
  --color-accent: 20 184 166;       /* teal-500 能源反差 */
  --color-text-1: 15 23 42;         /* slate-900 */
  --color-text-2: 71 85 105;        /* slate-600 */
  --color-text-3: 100 116 139;      /* slate-500（AA ≥4.5:1） */
  --color-border: 226 232 240;      /* slate-200 */
  --color-border-strong: 203 213 225; /* slate-300 */
  --color-success: 5 150 105;       /* emerald-600 */
  --color-warning: 180 83 9;        /* amber-700（与主橙区分：偏黄深） */
  --color-danger: 220 38 38;        /* red-600 */
  --color-info: 37 99 235;          /* blue-600 */
  --echarts-palette: #ea580c, #14b8a6, #f59e0b, #ef4444, #2563eb, #64748b, #8b5cf6, #059669;
}

/* ---------- 曜金工程橙 · 深色（暖黑） ---------- */
[data-theme="solar-amber"][data-mode="dark"] {
  --color-bg: 12 10 9;              /* stone-950 */
  --color-surface: 28 25 23;        /* stone-900 */
  --color-surface-2: 41 37 36;      /* stone-800 */
  --color-primary: 251 146 60;      /* orange-400 */
  --color-primary-hover: 253 186 116;/* orange-300 */
  --color-primary-active: 249 115 22;/* orange-500 */
  --color-primary-ink: 253 186 116; /* orange-300 文字 */
  --color-on-primary: 67 20 7;      /* orange-950 */
  --color-accent: 45 212 191;       /* teal-400 */
  --color-text-1: 250 250 249;      /* stone-50 */
  --color-text-2: 168 162 158;      /* stone-400 */
  --color-text-3: 120 113 108;      /* stone-500 */
  --color-border: 68 64 60;         /* stone-700 */
  --color-border-strong: 87 83 78;  /* stone-600 */
  --color-success: 52 211 153;      /* emerald-400 */
  --color-warning: 251 191 36;      /* amber-400 */
  --color-danger: 248 113 113;      /* red-400 */
  --color-info: 96 165 250;         /* blue-400 */
  --echarts-palette: #fb923c, #2dd4bf, #fbbf24, #f87171, #60a5fa, #a8a29e, #a78bfa, #34d399;
}

/* ============================================================
   3. 组合彩蛋（额外 data-theme）
   ============================================================ */

/* ---------- 晨昏青蓝 dusk-sky：调度台日/夜混合 ----------
   浅色 = 电驭青蓝白昼；深色 = 深空墨绿暗夜 + 电光蓝主色 */
[data-theme="dusk-sky"][data-mode="light"] {
  --color-bg: 248 250 252;          /* slate-50 */
  --color-surface: 255 255 255;
  --color-surface-2: 241 245 249;   /* slate-100 */
  --color-primary: 2 132 199;       /* sky-600 */
  --color-primary-hover: 3 105 161; /* sky-700 */
  --color-primary-active: 7 89 133; /* sky-800 */
  --color-primary-ink: 3 105 161;
  --color-on-primary: 255 255 255;
  --color-accent: 251 191 36;       /* amber-400 */
  --color-text-1: 15 23 42; --color-text-2: 71 85 105; --color-text-3: 100 116 139;
  --color-border: 226 232 240; --color-border-strong: 203 213 225;
  --color-success: 5 150 105; --color-warning: 180 83 9; --color-danger: 220 38 38; --color-info: 37 99 235;
  --echarts-palette: #0284c7, #fbbf24, #10b981, #ef4444, #2563eb, #94a3b8, #8b5cf6, #14b8a6;
}
[data-theme="dusk-sky"][data-mode="dark"] {
  --color-bg: 2 6 23;               /* slate-950 深空墨绿暗夜 */
  --color-surface: 15 23 42;        /* slate-900 */
  --color-surface-2: 30 41 59;      /* slate-800 */
  --color-primary: 56 189 248;      /* sky-400 电光蓝主色 */
  --color-primary-hover: 14 165 233;/* sky-500 */
  --color-primary-active: 125 211 252; /* sky-300 */
  --color-primary-ink: 125 211 252;
  --color-on-primary: 8 47 73;      /* sky-950 */
  --color-accent: 103 232 249;      /* cyan-300 能量电弧 */
  --color-text-1: 241 245 249; --color-text-2: 148 163 184; --color-text-3: 100 116 139;
  --color-border: 51 65 85; --color-border-strong: 71 85 105;
  --color-success: 52 211 153; --color-warning: 251 191 36; --color-danger: 248 113 113; --color-info: 96 165 250;
  --echarts-palette: #38bdf8, #67e8f9, #34d399, #f87171, #60a5fa, #94a3b8, #a78bfa, #2dd4bf;
}

/* ---------- 石墨单色 graphite：工程蓝图灰（去彩色） ---------- */
[data-theme="graphite"][data-mode="light"] {
  --color-bg: 250 250 250;          /* gray-50 */
  --color-surface: 255 255 255;
  --color-surface-2: 243 244 246;   /* gray-100 */
  --color-primary: 51 65 85;        /* slate-700 石墨 */
  --color-primary-hover: 30 41 59;  /* slate-800 */
  --color-primary-active: 15 23 42; /* slate-900 */
  --color-primary-ink: 51 65 85;
  --color-on-primary: 255 255 255;
  --color-accent: 100 116 139;      /* slate-500 */
  --color-text-1: 17 24 39;         /* gray-900 */
  --color-text-2: 75 85 99;         /* gray-600 */
  --color-text-3: 107 114 128;      /* gray-500（AA ≥4.5:1） */
  --color-border: 229 231 235;      /* gray-200 */
  --color-border-strong: 209 213 219; /* gray-300 */
  --color-success: 5 150 105; --color-warning: 180 83 9; --color-danger: 220 38 38; --color-info: 37 99 235;
  --echarts-palette: #475569, #94a3b8, #64748b, #cbd5e1, #94a3b8, #64748b, #475569, #cbd5e1;
}
[data-theme="graphite"][data-mode="dark"] {
  --color-bg: 3 7 18;               /* 近黑 */
  --color-surface: 15 23 42;        /* slate-900 */
  --color-surface-2: 30 41 59;      /* slate-800 */
  --color-primary: 148 163 184;     /* slate-400 */
  --color-primary-hover: 203 213 225;/* slate-300 */
  --color-primary-active: 100 116 139; /* slate-500 */
  --color-primary-ink: 203 213 225;
  --color-on-primary: 15 23 42;     /* slate-900 */
  --color-accent: 100 116 139;      /* slate-500 */
  --color-text-1: 241 245 249; --color-text-2: 148 163 184; --color-text-3: 100 116 139;
  --color-border: 51 65 85; --color-border-strong: 71 85 105;
  --color-success: 52 211 153; --color-warning: 251 191 36; --color-danger: 248 113 113; --color-info: 96 165 250;
  --echarts-palette: #94a3b8, #64748b, #cbd5e1, #64748b, #94a3b8, #475569, #cbd5e1, #64748b;
}

/* ============================================================
   4. 密度 3 档（A 管理员默认 comfortable / B 信息员默认 compact）
   ============================================================ */
[data-density="compact"] {
  --table-row-h: 36px; --table-cell-py: 8px; --table-font: 12px; --topbar-h: 52px; --sidebar-w: 220px;
}
[data-density="dense"] {
  --table-row-h: 32px; --table-cell-py: 6px; --table-font: 12px; --topbar-h: 48px; --sidebar-w: 200px;
}

/* ============================================================
   5. 基础重置
   ============================================================ */
html { font-size: 15px; }
body {
  margin: 0; padding: 0;
  font-family: var(--font-sans);
  background: rgb(var(--color-bg));
  color: rgb(var(--color-text-1));
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color .2s ease, color .2s ease;
}
*, *::before, *::after { box-sizing: border-box; }
a { color: rgb(var(--color-primary)); text-decoration: none; }
a:hover { color: rgb(var(--color-primary-hover)); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgb(var(--color-border-strong) / .5); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgb(var(--color-border-strong)); }
.hide-scrollbar::-webkit-scrollbar { display: none; }
.hide-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* 数字等宽 / 工单号 mono */
.num, .stat-value, .data-table td[data-type="num"], .kpi-value {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  letter-spacing: -0.01em;
}
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ============================================================
   6. 三大工艺工具类：玻璃 / 渐变描边 / 辉光
   ============================================================ */
.glass {
  background: rgb(var(--color-surface) / .72);
  backdrop-filter: blur(12px) saturate(1.15);
  -webkit-backdrop-filter: blur(12px) saturate(1.15);
  border: 1px solid rgb(var(--color-border) / .6);
}
[data-mode="dark"] .glass {
  background: rgb(var(--color-surface) / .62);
  border-color: rgb(var(--color-border-strong) / .35);
}

/* 渐变描边：仅 Logo / 侧边栏激活项 / 关键统计卡 / 顶栏下沿，每屏 ≤2 处 */
.gradient-border {
  border: 1px solid transparent;
  background:
    linear-gradient(rgb(var(--color-surface)), rgb(var(--color-surface))) padding-box,
    linear-gradient(180deg, rgb(var(--color-border-strong)), transparent 45%) border-box;
}
[data-mode="dark"] .gradient-border {
  background:
    linear-gradient(rgb(var(--color-surface)), rgb(var(--color-surface))) padding-box,
    linear-gradient(180deg, rgb(var(--color-primary) / .55), transparent 45%) border-box;
}
/* 品牌 Logo 专用：主色渐变描边 + 主色到点缀色渐变内芯 */
.logo-mark {
  border: 1px solid transparent;
  background:
    linear-gradient(rgb(var(--color-primary) / .12), rgb(var(--color-primary) / .06)) padding-box,
    linear-gradient(135deg, rgb(var(--color-primary)), rgb(var(--color-accent))) border-box;
  border-radius: var(--radius-md);
}

/* 辉光：只给主操作 */
.btn-primary { box-shadow: 0 2px 12px rgb(var(--color-primary) / .35); }
[data-mode="dark"] .btn-primary { box-shadow: 0 2px 12px rgb(var(--color-primary) / .22); }

/* ============================================================
   7. 组件类
   ============================================================ */

/* ---------- 按钮体系 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: inherit; font-size: 13px; font-weight: 600;
  border-radius: var(--radius-md);
  min-height: var(--touch-min);
  padding: 0 16px; cursor: pointer; border: 1px solid transparent;
  transition: all .15s ease; white-space: nowrap; text-decoration: none;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: rgb(var(--color-primary-hover));
  color: rgb(var(--color-on-primary));
}
.btn-primary:hover:not(:disabled) { background: rgb(var(--color-primary-active)); }
.btn-primary:active:not(:disabled) { background: rgb(var(--color-primary-active)); filter: brightness(.94); }
.btn-secondary {
  background: rgb(var(--color-surface));
  color: rgb(var(--color-text-2));
  border-color: rgb(var(--color-border));
}
.btn-secondary:hover:not(:disabled) { border-color: rgb(var(--color-primary) / .5); color: rgb(var(--color-text-1)); background: rgb(var(--color-surface-2)); }
.btn-danger {
  background: rgb(var(--color-danger));
  color: rgb(var(--color-on-primary));
}
.btn-danger:hover:not(:disabled) { filter: brightness(.92); }
.btn-ghost {
  background: transparent; color: rgb(var(--color-text-2));
}
.btn-ghost:hover:not(:disabled) { background: rgb(var(--color-surface-2)); color: rgb(var(--color-text-1)); }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-lg { min-height: 48px; padding: 0 24px; font-size: 15px; }
/* 移动端大按钮（C 施工员） */
[data-role="installer"] .btn { min-height: 48px; font-size: 15px; border-radius: var(--radius-lg); }

/* ---------- 卡片 ---------- */
.card {
  background: rgb(var(--color-surface));
  border: 1px solid rgb(var(--color-border));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  padding: var(--space-4) var(--space-4);
}
.card-hover:hover { box-shadow: var(--shadow-2); border-color: rgb(var(--color-primary) / .35); }

/* ---------- KPI 统计卡 ---------- */
.stat-card {
  background: rgb(var(--color-surface));
  border: 1px solid rgb(var(--color-border));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  padding: 16px 18px;
  min-height: 96px;
  display: flex; flex-direction: column; justify-content: space-between;
}
.stat-card.is-key { /* 关键统计卡，允许渐变描边 */
  background:
    linear-gradient(rgb(var(--color-surface)), rgb(var(--color-surface))) padding-box,
    linear-gradient(180deg, rgb(var(--color-primary)), transparent 45%) border-box;
  border: 1px solid transparent;
}
.stat-label { font-size: 13px; font-weight: 500; color: rgb(var(--color-text-2)); }
.stat-value { font-size: 30px; line-height: 1.1; font-weight: 700; color: rgb(var(--color-text-1)); margin-top: 8px; }
.stat-meta { margin-top: 8px; font-size: 12px; color: rgb(var(--color-text-3)); }
.stat-value.trend-up { color: rgb(var(--color-success)); }
.stat-value.trend-down { color: rgb(var(--color-danger)); }
.stat-value.trend-flat { color: rgb(var(--color-text-1)); }

/* ---------- 数据表格 ---------- */
.data-table-wrap {
  background: rgb(var(--color-surface));
  border: 1px solid rgb(var(--color-border));
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--table-font); }
.data-table thead th {
  background: rgb(var(--color-surface-2));
  color: rgb(var(--color-text-2));
  font-weight: 600; font-size: 12px;
  padding: var(--table-cell-py) 14px;
  text-align: left; white-space: nowrap;
  letter-spacing: .03em;
  border-bottom: 1px solid rgb(var(--color-border));
  position: sticky; top: 0; z-index: 1;
}
.data-table tbody td {
  padding: var(--table-cell-py) 14px;
  border-bottom: 1px solid rgb(var(--color-border) / .6);
  color: rgb(var(--color-text-1));
  vertical-align: middle;
  height: var(--table-row-h);
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: rgb(var(--color-primary) / .05); }
.data-table tbody tr:nth-child(even) td { background: rgb(var(--color-surface-2) / .45); }
.data-table tbody tr:nth-child(even):hover td { background: rgb(var(--color-primary) / .05); }
/* 表格操作列 */
.table-actions { display: flex; gap: 6px; justify-content: flex-end; }
.table-actions .btn { min-height: 28px; padding: 0 10px; font-size: 12px; }

/* ---------- 筛选栏 ---------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px 0; }
.filter-bar > * { min-height: 36px; }

/* ---------- 表单 ---------- */
.input, .form-input,
input[type="text"], input[type="number"], input[type="email"], input[type="password"],
input[type="search"], input[type="date"], input[type="datetime-local"], select, textarea {
  background: rgb(var(--color-surface));
  border: 1px solid rgb(var(--color-border));
  color: rgb(var(--color-text-1));
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-size: 13px; font-family: inherit;
  width: 100%; min-height: 38px;
  outline: none; transition: all .15s ease;
}
.input:focus, .form-input:focus, input:focus, select:focus, textarea:focus {
  border-color: rgb(var(--color-primary));
  box-shadow: 0 0 0 3px rgb(var(--color-primary) / .12);
}
.input::placeholder, input::placeholder, textarea::placeholder { color: rgb(var(--color-text-3)); }
select { appearance: auto; }
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: rgb(var(--color-text-2)); margin-bottom: 6px; }
.form-error { font-size: 12px; color: rgb(var(--color-danger)); margin-top: 4px; }

/* ---------- 徽章 / 状态标签 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: var(--radius-full);
  font-size: 11px; font-weight: 600; line-height: 1.6; white-space: nowrap;
}
.badge-success { background: rgb(var(--color-success) / .12); color: rgb(var(--color-success)); }
.badge-warning { background: rgb(var(--color-warning) / .14); color: rgb(var(--color-warning)); }
.badge-danger  { background: rgb(var(--color-danger) / .12); color: rgb(var(--color-danger)); }
.badge-info    { background: rgb(var(--color-info) / .12); color: rgb(var(--color-info)); }
.badge-neutral { background: rgb(var(--color-surface-2)); color: rgb(var(--color-text-2)); }
.badge-primary { background: rgb(var(--color-primary) / .12); color: rgb(var(--color-primary-ink)); }
/* 状态圆点（实时脉冲只给"在线/充电中"主语义） */
.badge .dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.badge .dot.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* ---------- 弹窗 / 抽屉 ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: var(--z-modal);
  background: rgb(0 0 0 / .4);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal-content {
  background: rgb(var(--color-surface));
  border: 1px solid rgb(var(--color-border));
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-3);
  padding: 24px; max-width: 640px; width: 92%;
  max-height: 90vh; overflow-y: auto;
  animation: modalIn .2s ease;
}
@keyframes modalIn { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 360px; max-width: 92vw;
  background: rgb(var(--color-surface));
  border-left: 1px solid rgb(var(--color-border));
  box-shadow: -4px 0 24px rgb(0 0 0 / .12);
  z-index: var(--z-modal);
  transform: translateX(100%); transition: transform .25s ease;
  overflow-y: auto;
}
.drawer.active { transform: translateX(0); }
.drawer-overlay { position: fixed; inset: 0; z-index: calc(var(--z-modal) - 1); background: rgb(0 0 0 / .35); backdrop-filter: blur(3px); display: none; }
.drawer-overlay.active { display: block; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(120%);
  visibility: hidden; pointer-events: none;
  z-index: var(--z-toast);
  background: rgb(var(--color-text-1));
  color: rgb(var(--color-bg));
  border-radius: var(--radius-md);
  padding: 10px 18px; font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-3);
  display: flex; align-items: center; gap: 8px;
  transition: transform .25s ease; max-width: 90vw;
}
.toast.active { transform: translateX(-50%) translateY(0); visibility: visible; pointer-events: auto; }
.toast-success { background: rgb(var(--color-success)); color: #fff; }
.toast-danger  { background: rgb(var(--color-danger)); color: #fff; }

/* ---------- 空状态 ---------- */
.empty-state { text-align: center; padding: 48px 16px; color: rgb(var(--color-text-3)); }
.empty-state svg, .empty-state i { width: 40px; height: 40px; margin: 0 auto 12px; opacity: .4; }
.empty-state .empty-title { font-size: 15px; font-weight: 600; color: rgb(var(--color-text-2)); margin-bottom: 4px; }
.empty-state .empty-desc { font-size: 13px; }

/* ---------- 侧边栏 + 导航项 ---------- */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: rgb(var(--color-surface));
  border-right: 1px solid rgb(var(--color-border));
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.sidebar-group-label {
  font-size: 11px; font-weight: 600; letter-spacing: .06em;
  color: rgb(var(--color-text-3)); text-transform: uppercase;
  padding: 16px 16px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; margin: 1px 8px;
  border-radius: var(--radius-md);
  color: rgb(var(--color-text-2)); font-size: 13px; font-weight: 500;
  cursor: pointer; border: none; background: transparent; width: calc(100% - 16px); text-align: left;
  position: relative; transition: all .15s ease;
}
.nav-item:hover { background: rgb(var(--color-surface-2)); color: rgb(var(--color-text-1)); }
.nav-item.active {
  background: rgb(var(--color-primary) / .1);
  color: rgb(var(--color-primary-ink)); font-weight: 600;
}
.nav-item.active::before {
  content: ""; position: absolute; left: -8px; top: 20%; bottom: 20%;
  width: 3px; border-radius: 3px; background: rgb(var(--color-primary));
}
.nav-item svg, .nav-item i { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item .nav-badge { margin-left: auto; }

/* ---------- 顶栏 ---------- */
.topbar {
  height: var(--topbar-h); flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; gap: 16px;
  border-bottom: 1px solid rgb(var(--color-border));
  background: rgb(var(--color-surface) / .72);
  backdrop-filter: blur(12px) saturate(1.15);
  -webkit-backdrop-filter: blur(12px) saturate(1.15);
  z-index: var(--z-sticky);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-logo {
  width: 36px; height: 36px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgb(var(--color-primary)), rgb(var(--color-accent)));
  color: rgb(var(--color-on-primary)); box-shadow: 0 2px 8px rgb(var(--color-primary) / .3);
}
.topbar-logo i, .topbar-logo svg { width: 20px; height: 20px; }

/* ---------- 应用布局 ---------- */
.app-shell { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.app-body { display: flex; flex: 1; overflow: hidden; }
.app-main { flex: 1; overflow-y: auto; padding: 20px; }
.page-header { margin-bottom: 16px; }
.page-title { font-size: 20px; font-weight: 700; color: rgb(var(--color-text-1)); margin: 0 0 4px; }
.page-desc { font-size: 13px; color: rgb(var(--color-text-2)); margin: 0; }

/* ---------- 订单卡片（A/B/C 三端变体） ---------- */
.order-card {
  background: rgb(var(--color-surface));
  border: 1px solid rgb(var(--color-border));
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  transition: all .15s ease;
}
.order-card:hover { border-color: rgb(var(--color-primary) / .4); box-shadow: var(--shadow-2); }
.order-card.is-priority { border-left: 3px solid rgb(var(--color-warning)); }
.order-card-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.order-card-id { font-family: var(--font-mono); font-size: 13px; font-weight: 600; color: rgb(var(--color-primary-ink)); }
.order-card-body { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: rgb(var(--color-text-2)); }
.order-card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; gap: 8px; }
/* A 端：桌面列表风 */
[data-role="admin"] .order-card { border-radius: var(--radius-md); padding: 12px 14px; }
/* B 端：紧凑调度风（看板列内） */
[data-role="dispatcher"] .order-card { padding: 10px 12px; border-radius: var(--radius-md); }
[data-role="dispatcher"] .order-card-body { font-size: 12px; }
/* C 端：移动大卡片风 */
[data-role="installer"] .order-card { border-radius: var(--radius-xl); padding: 18px; margin-bottom: 12px; }
[data-role="installer"] .order-card-body { font-size: 15px; gap: 8px; }

/* ---------- 步骤条（施工填报） ---------- */
.step-bar { display: flex; align-items: center; gap: 4px; margin-bottom: 16px; }
.step-item { display: flex; align-items: center; gap: 8px; flex: 1; }
.step-dot {
  width: 26px; height: 26px; border-radius: 999px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  background: rgb(var(--color-surface-2)); color: rgb(var(--color-text-3));
  border: 1px solid rgb(var(--color-border));
}
.step-item.active .step-dot { background: rgb(var(--color-primary)); color: rgb(var(--color-on-primary)); border-color: transparent; }
.step-item.done .step-dot { background: rgb(var(--color-success)); color: #fff; border-color: transparent; }
.step-label { font-size: 12px; color: rgb(var(--color-text-3)); }
.step-item.active .step-label { color: rgb(var(--color-text-1)); font-weight: 600; }
.step-line { flex: 1; height: 2px; background: rgb(var(--color-border)); border-radius: 2px; }
.step-item.done + .step-line { background: rgb(var(--color-success)); }
.step-item.active + .step-line { background: rgb(var(--color-primary) / .5); }

/* ---------- 移动端底部导航 + 大按钮 ---------- */
.mobile-tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; height: 64px;
  background: rgb(var(--color-surface) / .85);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgb(var(--color-border));
  display: flex; z-index: var(--z-sticky);
  padding-bottom: env(safe-area-inset-bottom);
}
.mobile-tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; color: rgb(var(--color-text-3)); background: none; border: none; cursor: pointer; }
.mobile-tab i, .mobile-tab svg { width: 22px; height: 22px; }
.mobile-tab.active { color: rgb(var(--color-primary-ink)); font-weight: 600; }
.mobile-cta-fixed { position: fixed; bottom: 76px; left: 16px; right: 16px; z-index: var(--z-sticky); }
/* C 端触控放大 */
[data-role="installer"] body, [data-role="installer"] .app-main { touch-action: manipulation; }
[data-role="installer"] .btn, [data-role="installer"] .mobile-tab { min-height: 48px; }

/* ---------- 登录卡（D 端） ---------- */
.login-card {
  width: 420px; max-width: 92vw;
  padding: 32px; border-radius: var(--radius-xl);
  background: rgb(var(--color-surface));
  border: 1px solid rgb(var(--color-border));
  box-shadow: var(--shadow-3);
}
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-logo { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 24px; }
.login-title { font-size: 24px; font-weight: 700; color: rgb(var(--color-text-1)); text-align: center; margin-bottom: 4px; }
.login-sub { font-size: 13px; color: rgb(var(--color-text-2)); text-align: center; margin-bottom: 24px; }

/* ---------- 看板（B 信息员） ---------- */
.kanban { display: flex; gap: 14px; overflow-x: auto; align-items: flex-start; }
.kanban-col {
  width: 300px; flex-shrink: 0;
  background: rgb(var(--color-surface-2) / .6);
  border: 1px solid rgb(var(--color-border) / .7);
  border-radius: var(--radius-lg);
  padding: 10px; max-height: calc(100vh - 160px); overflow-y: auto;
}
.kanban-col-title { display: flex; align-items: center; gap: 8px; padding: 6px 8px 10px; font-size: 13px; font-weight: 600; color: rgb(var(--color-text-1)); }
.kanban-col-count { font-size: 11px; font-weight: 600; background: rgb(var(--color-surface-2)); color: rgb(var(--color-text-2)); border-radius: 999px; padding: 1px 8px; }

/* ============================================================
   8. 响应式（移动端特化）
   ============================================================ */
@media (max-width: 1024px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: var(--z-dropdown); transform: translateX(-100%); transition: transform .25s ease; }
  .sidebar.active { transform: translateX(0); }
  .app-main { padding: 14px; }
}
@media (max-width: 640px) {
  html { font-size: 14px; }
  .app-main { padding: 12px; }
  .filter-bar { flex-direction: column; }
  .filter-bar > * { width: 100%; }
  .stat-card { min-height: 84px; }
  .data-table thead { display: none; } /* 移动端建议卡片化表格或横向滚动，勿硬隐藏——此处仅兜底 */
}

/* ============================================================
   9. 加载占位 / 骨架屏（数据就绪前避免显示默认值）
   ------------------------------------------------------------
   用法：数据驱动区域在接口返回前，先用 .skeleton 占位块渲染，
   接口返回后再整体替换为真实内容，杜绝「先显默认值→再被真实值替换」的闪烁。
   ============================================================ */
.skeleton {
  position: relative; overflow: hidden;
  background: rgb(var(--color-surface-2));
  border-radius: var(--radius-sm, 6px);
}
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgb(var(--color-surface) / .7), transparent);
  animation: skeleton-shimmer 1.15s ease-in-out infinite;
}
@keyframes skeleton-shimmer { 100% { transform: translateX(100%); } }
.sk-line { height: 12px; border-radius: 6px; }
.sk-line + .sk-line { margin-top: 8px; }
.sk-block { border-radius: var(--radius-md, 8px); }
.sk-circle { border-radius: 999px; }
@media (prefers-reduced-motion: reduce) { .skeleton::after { animation: none; } }

/* 表格内的加载占位行 */
.tr-skeleton td { padding: 14px 8px; }
.tr-skeleton .sk-line { margin: 0; height: 14px; }
.tr-skeleton .sk-line + .sk-line { margin-top: 10px; }

/* 空状态提示（接口返回空列表时） */
.empty-hint {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 32px 16px; color: rgb(var(--color-text-3)); font-size: 13px; text-align: center;
}
.empty-hint svg { width: 24px; height: 24px; opacity: .55; }
