/* ═══════════════════════════════════════════
   加电运营后台 — 逸电能源 v1.1.0
   优化版样式表
   ═══════════════════════════════════════════ */

:root {
  color-scheme: light;
  /* 品牌色系 — 能源/充电行业 */
  --brand: #0d9488;        /* 主品牌色 teal-600 */
  --brand-deep: #0f766e;   /* 深色 teal-700 */
  --brand-soft: #ccfbf1;   /* 浅色 teal-100 */
  --brand-surface: #f0fdfa;/* 极浅 teal-50 */
  --accent: #f59e0b;       /* 强调色 amber-500 */
  --accent-deep: #d97706;  /* 深琥珀 amber-600 */
  --accent-soft: #fef3c7;  /* 浅琥珀 amber-100 */

  /* 功能色 */
  --good: #059669;          /* emerald-600 */
  --good-soft: #d1fae5;    /* emerald-100 */
  --warn: #ea580c;          /* orange-600 */
  --warn-soft: #ffedd5;    /* orange-100 */
  --danger: #dc2626;        /* red-600 */
  --danger-soft: #fee2e2;  /* red-100 */

  /* 中性色 */
  --bg: #f3f4f6;           /* gray-100 */
  --surface: #ffffff;
  --surface-raised: #f9fafb;
  --line: #e5e7eb;          /* gray-200 */
  --line-strong: #d1d5db;   /* gray-300 */
  --text: #111827;          /* gray-900 */
  --text-secondary: #4b5563;/* gray-600 */
  --muted: #9ca3af;         /* gray-400 */

  /* 侧边栏 */
  --sidebar-bg: #0f172a;    /* slate-900 */
  --sidebar-hover: #1e293b; /* slate-800 */
  --sidebar-text: #cbd5e1;  /* slate-300 */
  --sidebar-muted: #64748b; /* slate-500 */

  /* 阴影 */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);

  /* 圆角 */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* 过渡 */
  --transition: 0.15s ease;
  --transition-slow: 0.25s ease;

  /* 尺寸 */
  --sidebar-width: 260px;
  --sidebar-collapsed: 64px;
  --topbar-height: 64px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  min-width: 320px;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background: var(--bg);
  font-family: "Microsoft YaHei", "PingFang SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── 基础元素 ── */
button, input, select, textarea {
  font: inherit;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

button {
  border: 0;
  cursor: pointer;
  user-select: none;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(13,148,136,0.12);
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: 20px; font-weight: 700; line-height: 1.35; }
h2 { font-size: 15px; font-weight: 600; line-height: 1.4; }
h3 { font-size: 14px; font-weight: 600; }
p { color: var(--text-secondary); line-height: 1.6; font-size: 13px; }

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-deep); text-decoration: underline; }

/* ── 按钮 ── */
.primary, .secondary, .ghost, .danger, .icon-button, .row-action {
  min-height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  font-weight: 500;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
}

.primary {
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.primary:hover { background: var(--brand-deep); box-shadow: var(--shadow); }
.primary:active { transform: scale(0.98); }

.secondary, .ghost, .icon-button {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
}
.secondary:hover, .ghost:hover, .icon-button:hover {
  background: var(--surface-raised);
  border-color: var(--muted);
}

.danger {
  border: 1px solid #fca5a5;
  background: var(--danger-soft);
  color: var(--danger);
}
.danger:hover { background: #fecaca; }

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  pointer-events: none;
}

.icon-button {
  display: none;
  width: 36px;
  min-height: 36px;
  padding: 0;
  font-size: 20px;
  font-weight: 700;
  border-radius: var(--radius-sm);
}
.icon-button.visible {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ── 登录 ── */
.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 18px;
  background: linear-gradient(135deg, var(--sidebar-bg) 0 38%, var(--bg) 38% 100%);
}

.login-panel {
  width: min(440px, 100%);
  padding: 36px 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: fadeInUp 0.4s ease;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-brand, .brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.login-brand {
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(13,148,136,0.3);
}

.login-brand strong, .login-brand span,
.brand strong, .brand span { display: block; }
.login-brand strong { font-size: 17px; }
.login-brand span, .brand span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.login-heading { margin: 28px 0 22px; }
.login-heading p { margin-top: 4px; }

.login-form, .form-grid { display: grid; gap: 16px; }

.login-form label:not(.check-row),
.form-grid label {
  display: grid;
  gap: 6px;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 13px;
}

.form-grid small {
  color: var(--muted);
  font-weight: 400;
  font-size: 12px;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
}

input, select { min-height: 40px; padding: 0 12px; }
textarea { min-height: 100px; padding: 10px 12px; resize: vertical; line-height: 1.6; }

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-weight: 400;
  font-size: 13px;
}
.check-row input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--brand);
}

.form-error {
  min-height: 20px;
  color: var(--danger);
  font-size: 13px;
  line-height: 1.4;
}

.login-button {
  width: 100%;
  min-height: 44px;
  font-size: 15px;
}

/* ── 主布局 ── */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 16px 12px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  z-index: 40;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--sidebar-muted); border-radius: 2px; }

.brand {
  padding: 4px 8px 18px;
}
.brand strong { color: #f1f5f9; }
.brand span { color: var(--sidebar-muted); }

.menu { display: grid; gap: 3px; }
.menu button {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: transparent;
  color: var(--sidebar-text);
  text-align: left;
  font-size: 14px;
  transition: all var(--transition);
}
.menu button:hover { background: var(--sidebar-hover); color: #e2e8f0; }
.menu button.active {
  background: rgba(13,148,136,0.2);
  color: #5eead4;
  font-weight: 600;
}

.menu .token {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.08);
  font-size: 12px;
  font-weight: 800;
  transition: background var(--transition);
}
.menu button.active .token { background: rgba(13,148,136,0.4); }

.sidebar-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding: 14px 10px 2px;
  color: var(--sidebar-muted);
  font-size: 12px;
}
.sidebar-status i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d399;
  flex-shrink: 0;
}
.sidebar-status i.offline { background: #f87171; }

/* ── 工作区 ── */
.workspace {
  min-width: 0;
  padding: 16px 20px;
  animation: fadeInUp 0.3s ease;
}

.topbar, .status-strip, .panel, .module-toolbar {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

/* ── 顶栏 ── */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: var(--topbar-height);
  padding: 12px 16px;
}

.page-heading { min-width: 180px; }
.page-heading p { margin-top: 2px; }

.top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.search-box {
  width: min(240px, 22vw);
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  color: var(--muted);
}
.search-box input {
  min-height: 32px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 13px;
}
.search-box input:focus { box-shadow: none; }
.search-icon { font-size: 18px; line-height: 1; flex-shrink: 0; }

.account-block {
  min-width: 80px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
}
.account-block strong, .account-block span { display: block; }
.account-block span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

/* ── 状态条 ── */
.status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 12px 0;
  overflow: hidden;
}
.status-strip div {
  min-width: 0;
  padding: 10px 16px;
  border-right: 1px solid var(--line);
}
.status-strip div:last-child { border-right: 0; }
.status-strip span, .status-strip strong { display: block; }
.status-strip span {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.status-strip strong {
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

/* ── 视图 ── */
.view { display: none; }
.view.active { display: grid; gap: 14px; }

/* ── 指标卡片 ── */
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric-card {
  min-height: 108px;
  padding: 18px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
  position: relative;
  overflow: hidden;
}
.metric-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--brand);
  border-radius: var(--radius) var(--radius) 0 0;
}
.metric-card.warn::before { background: var(--accent); }
.metric-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.metric-card span { color: var(--text-secondary); font-size: 13px; }
.metric-card strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 28px;
  line-height: 1.2;
  font-weight: 800;
  color: var(--text);
}
.metric-card em {
  color: var(--good);
  font-size: 12px;
  font-style: normal;
}
.metric-card.warn em { color: var(--warn); }

/* ── 双列布局 ── */
.grid.two {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(340px, 0.8fr);
  gap: 14px;
}

.grid.three {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

/* ── 面板 ── */
.panel {
  padding: 16px;
}
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.panel-head p { margin-top: 2px; }

/* ── 监控面板 ── */
.monitor-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
}

.gauge {
  min-height: 112px;
  padding: 14px 16px;
  background: var(--surface-raised);
}
.gauge strong {
  display: block;
  margin: 6px 0;
  font-size: 24px;
  font-weight: 700;
}
.gauge p {
  margin-top: 6px;
  font-size: 12px;
}

progress {
  display: block;
  width: 100%;
  height: 6px;
  overflow: hidden;
  border: 0;
  border-radius: 3px;
  background: #e5e7eb;
  appearance: none;
}
progress::-webkit-progress-bar { background: #e5e7eb; border-radius: 3px; }
progress::-webkit-progress-value { background: var(--brand); border-radius: 3px; }
progress::-moz-progress-bar { background: var(--brand); border-radius: 3px; }

/* ── 待处理列表 ── */
.list { display: grid; gap: 4px; }
.list-item {
  width: 100%;
  min-height: 52px;
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  text-align: left;
  transition: background var(--transition);
}
.list-item:hover { background: var(--surface-raised); }
.list-item span strong, .list-item span small { display: block; }
.list-item span small, .list-item time {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--good);
  flex-shrink: 0;
}
.dot.warning, .dot.disabled { background: var(--danger); }
.dot.pending { background: var(--accent); }

/* ── 快捷工作台 ── */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.quick-card {
  min-height: 84px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  transition: all var(--transition);
}
.quick-card:hover {
  background: var(--brand-soft);
  border-left-color: var(--brand-deep);
  box-shadow: var(--shadow-sm);
}
.quick-card strong, .quick-card span { display: block; }
.quick-card span {
  margin-top: 5px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
}

/* ── 模块工具栏 ── */
.module-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  flex-wrap: wrap;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.tabs button {
  min-height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  transition: all var(--transition);
}
.tabs button:hover { background: var(--surface-raised); color: var(--text); }
.tabs button.active {
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-weight: 600;
}
.tabs .tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  margin-left: 4px;
}

.filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.filters select { width: 130px; }

/* ── 表格面板 ── */
.table-panel { min-height: 460px; }

.record-count {
  color: var(--muted);
  font-size: 12px;
  flex-shrink: 0;
}

.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  min-width: 700px;
  border-collapse: collapse;
}
th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  line-height: 1.5;
}
th {
  background: var(--surface-raised);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  position: sticky;
  top: 0;
}
td:nth-child(1) { width: 18%; }
td:nth-child(2) { width: 35%; }
td:nth-child(3) { width: 27%; }
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--brand-surface); }

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}
.badge.normal { background: var(--good-soft); color: var(--good); }
.badge.pending { background: var(--warn-soft); color: var(--warn); }
.badge.warning, .badge.disabled { background: var(--danger-soft); color: var(--danger); }

.row-action {
  min-height: 30px;
  padding: 0 10px;
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-size: 12px;
}
.row-action:hover { background: #b2f0e3; }

/* ── 分页 ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 12px;
}
.pagination button {
  width: 32px;
  min-height: 32px;
  padding: 0;
  font-size: 18px;
  border-radius: var(--radius-sm);
}
.pagination span {
  color: var(--text-secondary);
  font-size: 12px;
}

.empty-state, .table-loading {
  padding: 56px 18px;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}
.empty-state svg, .table-loading svg {
  display: block;
  margin: 0 auto 12px;
  opacity: 0.4;
}
.error-state { color: var(--danger); }

.page-error {
  min-height: 360px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.metrics > .page-error { grid-column: 1 / -1; }
.page-error span { color: var(--text-secondary); }

/* ── 权限编辑器 ── */
.permission-editor { display: grid; gap: 20px; }
.permission-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(180px, 1fr) auto;
  align-items: end;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-raised);
}
.permission-toolbar label, .permission-toolbar > div { display: grid; gap: 6px; }
.permission-toolbar span { color: var(--muted); font-size: 12px; }
.permission-toolbar strong {
  min-height: 40px;
  display: flex;
  align-items: center;
  font-size: 14px;
}

.permission-fieldset {
  min-width: 0;
  margin: 0;
  padding: 14px 0 4px;
  border: 0;
  border-top: 1px solid var(--line);
}
.permission-fieldset legend {
  padding: 0 10px 0 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.permission-check {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 13px;
}
.permission-check:hover { border-color: var(--brand); }
.permission-check:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-weight: 600;
}
.permission-check input { width: 16px; min-height: 16px; margin: 0; accent-color: var(--brand); }
.permission-check:has(input:disabled) { cursor: not-allowed; opacity: 0.65; }

/* ── 对话框 ── */
dialog {
  width: min(680px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: fadeInUp 0.2s ease;
}
dialog::backdrop { background: rgba(15,23,42,0.55); }
#passwordDialog, #confirmDialog { width: min(460px, calc(100vw - 24px)); }

.dialog-card {
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  padding: 20px;
}

.dialog-head {
  position: sticky;
  top: -20px;
  z-index: 2;
  padding-top: 20px;
  background: var(--surface);
  margin-bottom: 4px;
}

.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.form-grid .half { /* default */ }

.form-grid input:disabled,
.form-grid select:disabled,
.form-grid textarea:disabled {
  opacity: 1;
  border-color: var(--line);
  background: var(--surface-raised);
  color: var(--text);
}

menu {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
}
.menu-spacer { flex: 1; }

/* ── Loading ── */
.loading-bar {
  position: fixed;
  z-index: 200;
  top: 0;
  left: 0;
  width: 0;
  height: 3px;
  opacity: 0;
  background: linear-gradient(90deg, var(--brand), #5eead4);
  transition: width 0.3s ease;
}
.loading-bar.active {
  width: 75%;
  opacity: 1;
  transition: width 9s ease-out;
}

/* ── Toast ── */
.toast {
  position: fixed;
  z-index: 210;
  right: 20px;
  bottom: 20px;
  max-width: min(380px, calc(100vw - 40px));
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--sidebar-bg);
  color: #e2e8f0;
  font-size: 13px;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: 0.2s ease;
  box-shadow: var(--shadow-lg);
}
.toast::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  border-radius: var(--radius) 0 0 var(--radius);
  background: var(--good);
}
.toast.error::before { background: var(--danger); }
.toast.warn::before { background: var(--accent); }
.toast.show { opacity: 1; transform: translateY(0); }

/* ── 报表视图 (dashboard sub-tab) ── */
.report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.report-card {
  padding: 20px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.report-card h3 { margin-bottom: 14px; }
.report-card .chart-placeholder {
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 13px;
  background: var(--surface-raised);
}

.report-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.report-stat {
  padding: 10px;
  text-align: center;
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
}
.report-stat strong { display: block; font-size: 20px; margin-bottom: 2px; }
.report-stat span { color: var(--muted); font-size: 11px; }

/* ── 告警中心 ── */
.alert-filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.alert-filter-bar button {
  min-height: 30px;
  padding: 0 14px;
  border-radius: 20px;
  font-size: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-secondary);
}
.alert-filter-bar button.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

/* ── 响应式 ── */
@media (max-width: 1280px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.two { grid-template-columns: 1fr; }
  .report-grid { grid-template-columns: 1fr; }
  .permission-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .topbar { flex-wrap: wrap; align-items: flex-start; }
  .top-actions { width: 100%; margin-left: 0; }
  .search-box { width: auto; flex: 1; }
  .module-toolbar { flex-direction: column; align-items: stretch; }
}

@media (max-width: 900px) {
  .login-view { background: var(--bg); }
  .login-panel { padding: 26px 22px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    z-index: 50;
    width: var(--sidebar-width);
    transform: translateX(-100%);
    transition: transform var(--transition-slow);
  }
  body.menu-open .sidebar { transform: translateX(0); }
  .workspace { padding: 10px; }
  .icon-button:not(.visible) { display: inline-flex; }
  .page-heading { min-width: 0; flex: 1; }
  .top-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; }
  .search-box { grid-column: 1 / -1; width: 100%; }
  .account-block { padding-left: 0; border-left: 0; }
  .status-strip, .metrics, .monitor-board, .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .status-strip div:nth-child(2) { border-right: 0; }
  .status-strip div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .filters { flex-wrap: wrap; }
  .permission-toolbar { grid-template-columns: 1fr 1fr; }
  .permission-toolbar button { grid-column: 1 / -1; }
  .permission-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 540px) {
  .top-actions { grid-template-columns: 1fr 1fr; }
  .account-block { grid-column: 1 / -1; }
  .status-strip, .metrics, .monitor-board, .quick-grid, .form-grid { grid-template-columns: 1fr; }
  .status-strip div { border-right: 0; border-bottom: 1px solid var(--line); }
  .status-strip div:last-child { border-bottom: 0; }
  .form-grid .full { grid-column: auto; }
  .filters select { width: 100%; }
  .filters button { flex: 1; }
  .permission-toolbar, .permission-grid { grid-template-columns: 1fr; }
  .permission-toolbar button { grid-column: auto; }
  .report-stats { grid-template-columns: 1fr; }
}

/* ── 地图选点 ── */
.billing-rules-section {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-raised);
}

.billing-rules-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.billing-rules-head strong {
  font-size: 14px;
}

.billing-rules-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.billing-rule-columns,
.billing-rule-row {
  display: grid;
  grid-template-columns: 110px 78px 78px 100px 100px 36px;
  gap: 8px;
  align-items: center;
  justify-content: start;
}

.billing-rule-columns {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
}

.billing-rule-rows {
  display: grid;
  gap: 8px;
}

.billing-rule-row input {
  min-width: 0;
  padding-right: 8px;
  padding-left: 8px;
  font-size: 13px;
}

.billing-rule-row .billing-remove {
  color: var(--danger);
}

.special-billing-card {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line-strong);
}

.special-billing-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.special-billing-toggle p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.switch-label {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

.switch-label input {
  width: 18px;
  height: 18px;
}

.special-billing-fields {
  display: grid;
  grid-template-columns: 1.3fr repeat(2, 0.75fr) repeat(2, 0.9fr) repeat(2, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.special-billing-fields label {
  display: grid;
  gap: 5px;
}

.special-billing-fields label > span {
  color: var(--muted);
  font-size: 11px;
}

.special-billing-fields input {
  min-width: 0;
}

.special-billing-preview {
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.special-billing-preview > strong {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
}

.special-preview-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.special-preview-list span {
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--surface-raised);
  color: var(--muted);
  font-size: 11px;
}

.special-preview-list .is-special {
  background: rgba(235, 166, 37, 0.16);
  color: #a86100;
  font-weight: 700;
}

.preview-hint {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 680px) {
  .billing-rule-columns {
    display: none;
  }

  .billing-rule-row {
    grid-template-columns: 1fr 1fr 36px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
  }

  .billing-rule-row .billing-remove {
    grid-column: 3;
    grid-row: 1;
  }

  .billing-rule-row .billing-name {
    grid-column: 1 / 3;
  }

  .special-billing-toggle {
    align-items: flex-start;
  }

  .special-billing-fields {
    grid-template-columns: 1fr 1fr;
  }

  .special-billing-fields label:first-child {
    grid-column: 1 / 3;
  }
}

.map-section {
  margin-top: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-raised);
  position: sticky;
  top: 0;
  z-index: 5;
}

.map-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.map-section-head > span:first-child {
  font-weight: 600;
  font-size: 13px;
}

.coord-display {
  color: var(--muted);
  font-size: 11px;
  font-family: monospace;
}

.map-search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.map-search-bar input {
  flex: 1;
  min-height: 36px;
}

.map-search-bar button {
  flex-shrink: 0;
}

.map-container {
  width: 100%;
  height: 260px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #e8edee;
}

.map-container .amap-logo,
.map-container .amap-copyright {
  display: none !important;
}

.map-latlng {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.map-latlng label {
  display: grid;
  gap: 4px;
}

.map-latlng span {
  color: var(--muted);
  font-size: 12px;
}

.map-latlng input {
  min-height: 36px;
  font-family: monospace;
  font-size: 13px;
  background: var(--surface-raised);
}

.map-placeholder {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  gap: 8px;
}

.map-placeholder .icon {
  font-size: 40px;
  opacity: 0.5;
}

.map-placeholder p {
  font-size: 13px;
}

.map-placeholder button {
  margin-top: 4px;
}

/* ── 打印优化 ── */
@media print {
  .sidebar, .top-actions, .module-toolbar, #loadingBar, #toast { display: none !important; }
  .shell { grid-template-columns: 1fr; }
  .workspace { padding: 0; }
  .panel { border: 1px solid #ccc; break-inside: avoid; }
}
