/* ═══════════════════════════════════════════════════════════════════
   运营工作台 v4 — "Bitcoin DeFi" Aesthetic
   Night: True Void (#030304) + Bitcoin Fire (orange/gold) — full experience
   Day:   Light paper variant that keeps the Bitcoin orange brand accent
   ═══════════════════════════════════════════════════════════════════ */


/* ── 基础 Token (Night / 默认) ────────────────────────────────────── */
:root {
  color-scheme: dark;
  --bg: #030304;                                /* True Void */
  --surface-0: rgba(15, 17, 21, 0.6);           /* Dark Matter, translucent */
  --surface-1: #0F1115;                          /* Dark Matter */
  --surface-2: #14171d;                          /* elevated */
  --glass: rgba(15, 17, 21, 0.5);
  --glass-border: rgba(255, 255, 255, 0.1);
  --text: #FFFFFF;                               /* Pure Light */
  --text-secondary: #94A3B8;                     /* Stardust */
  --text-tertiary: #5b6779;
  --border: rgba(255, 255, 255, 0.1);
  --border-active: rgba(247, 147, 26, 0.5);      /* Bitcoin Orange 50% */
  --accent: #F7931A;                             /* Bitcoin Orange */
  --accent-soft: rgba(247, 147, 26, 0.12);
  --accent-2: #EA580C;                           /* Burnt Orange */
  --accent-2-soft: rgba(234, 88, 12, 0.12);
  --accent-3: #FFD600;                           /* Digital Gold */
  --accent-3-soft: rgba(255, 214, 0, 0.12);
  --warning: #FFD600;                            /* Gold doubles as warning */
  --warning-soft: rgba(255, 214, 0, 0.12);
  --danger: #f43f5e;                             /* Rose for true alerts */
  --danger-soft: rgba(244, 63, 94, 0.12);
  --grad-fire: linear-gradient(135deg, #EA580C, #F7931A);
  --grad-gold: linear-gradient(135deg, #F7931A, #FFD600);
  --glow-sm: 0 0 20px -5px rgba(234, 88, 12, 0.5);
  --glow-md: 0 0 30px -5px rgba(247, 147, 26, 0.6);
  --glow-card: 0 0 40px -12px rgba(247, 147, 26, 0.22);
  --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 40px -20px rgba(247, 147, 26, 0.25);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.6), 0 0 60px -24px rgba(247, 147, 26, 0.3);
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  --sidebar-width: 72px;
  --sidebar-expanded: 248px;
  --topbar-height: 64px;
  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --font-heading: "Space Grotesk", "Microsoft YaHei", "PingFang SC", sans-serif;
  --font-body: "Inter", "Microsoft YaHei", "PingFang SC", sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Code", "Consolas", monospace;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-feature-settings: "tnum" 1, "cv02" 1;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* 标题统一使用 Space Grotesk，数据/标签使用等宽 */
h1, h2, h3, h4, h5, h6,
.brand h1, .topbar h2, .today-board h3, .dialog-head h3,
.smart-entry h3, .dash-welcome-text h3, .dash-card h3 {
  font-family: var(--font-heading);
  letter-spacing: -0.02em;
}
.eyebrow, .nav-label, .chip, .status-select, th,
.metric span, .dash-metric-label, .storage-panel,
.aws-sync-stage, .module-tabs span, .upcoming-item span {
  font-family: var(--font-mono);
}

/* 能量场：True Void 上的橙/金径向辉光 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 70% 55% at 12% 0%, rgba(247, 147, 26, 0.10), transparent 70%),
    radial-gradient(ellipse 55% 45% at 88% 8%, rgba(234, 88, 12, 0.08), transparent 70%),
    radial-gradient(ellipse 60% 50% at 50% 105%, rgba(255, 214, 0, 0.05), transparent 70%);
}

/* 区块链网格：向边缘渐隐 */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 50px 50px;
  mask-image: radial-gradient(circle at 50% 30%, black 35%, transparent 95%);
  -webkit-mask-image: radial-gradient(circle at 50% 30%, black 35%, transparent 95%);
}

.app-shell, .login-gate { position: relative; z-index: 1; }

button, input, select, textarea { font: inherit; }

/* 统一下拉箭头：去掉浏览器默认（常出现歪斜/双箭头），换成居中的自绘箭头 */
.panel-head select,
.field-filter select,
select.aws-config-inline,
.admin-table-wrap select {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2.5 4.5L6 8l3.5-3.5' fill='none' stroke='%239aa0aa' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px 12px;
}
.panel-head select::-ms-expand,
.field-filter select::-ms-expand,
select.aws-config-inline::-ms-expand { display: none; }
button { cursor: pointer; border: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ── 登录页 ───────────────────────────────────────────────────────── */
.login-gate { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.login-gate[hidden] { display: none; }

.login-panel {
  display: grid; gap: 20px; width: min(400px, 100%); padding: 36px;
  border: 1px solid var(--glass-border); border-radius: var(--radius-lg);
  background: var(--glass); backdrop-filter: blur(24px) saturate(1.2);
  box-shadow: var(--shadow-lg);
}
.login-panel h1 { margin: 4px 0 0; font-size: 24px; font-weight: 700; letter-spacing: -0.03em; }
.login-title { white-space: nowrap; }
@media (max-width: 420px) {
  .login-title { font-size: 20px; }
}
.login-panel form { display: grid; gap: 14px; }
.login-panel form[hidden] { display: none; }
.auth-steps { display: flex; gap: 6px; margin: 0; padding: 1px; list-style: none; }
.auth-steps li {
  flex: 1 1 0; min-width: 0; text-align: center; padding: 6px 4px; border-radius: var(--radius-xs);
  font-size: 11px; font-weight: 800; color: var(--text-tertiary); background: var(--surface-0);
  border: 1px solid var(--border);
}
.auth-steps li.active { color: var(--accent); border-color: var(--border-active); background: var(--accent-soft); }
.auth-step-panel { display: grid; gap: 14px; }
.auth-step-panel[hidden] { display: none; }
.login-panel label { display: grid; gap: 6px; color: var(--text-secondary); font-size: 13px; }
.login-panel input {
  width: 100%; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); background: var(--surface-0);
  transition: border-color var(--transition);
}
.login-panel input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.auth-mode-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.auth-mode-tabs button {
  min-height: 34px; border: 1px solid var(--border); border-radius: var(--radius-xs);
  color: var(--text-secondary); background: var(--surface-0);
  font-size: 12px; font-weight: 800; white-space: nowrap;
}
.auth-mode-tabs button.active { color: var(--accent); border-color: var(--border-active); background: var(--accent-soft); }
.link-button {
  justify-self: center; padding: 4px 6px; background: transparent; border: 0;
  color: var(--text-secondary); font-size: 12px; text-decoration: underline; text-underline-offset: 3px;
}
.link-button:hover { color: var(--accent); }
.login-message { min-height: 18px; margin: 0; color: var(--danger); font-size: 13px; }

/* ── 应用布局 ─────────────────────────────────────────────────────── */
.app-shell {
  position: relative;
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
  /* 当前生效的侧栏宽度：默认展开，收紧时切换为窄轨。 */
  --rail: var(--sidebar-expanded);
}
.app-shell.is-collapsed { --rail: var(--sidebar-width); }

/* ── 侧栏（默认展开 / 一键收紧，R15）────────────────────────────────── */
.sidebar {
  position: fixed;
  left: 0; top: 0;
  display: flex; flex-direction: column;
  gap: 4px; height: 100vh; width: var(--rail);
  padding: 16px 12px;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(12, 16, 32, 0.98), rgba(8, 12, 24, 0.99));
  overflow: visible; z-index: 50;
  transition: width 240ms cubic-bezier(0.4, 0, 0.2, 1), box-shadow 240ms ease;
}

/* 收紧/展开切换按钮：放在侧栏与主内容交界处的圆形轻量按钮。 */
.sidebar-collapse-btn {
  position: absolute; top: 26px; right: -13px; z-index: 60;
  display: grid; place-items: center;
  width: 26px; height: 26px; padding: 0;
  border: 1px solid var(--border); border-radius: 50%;
  color: var(--text-secondary); background: var(--surface-1);
  box-shadow: var(--shadow-sm, 0 2px 8px rgba(0,0,0,0.18));
  cursor: pointer;
  transition: color var(--transition), background var(--transition), transform var(--transition), border-color var(--transition);
}
.sidebar-collapse-btn:hover { color: var(--accent); border-color: var(--border-active); background: var(--accent-soft); }
.sidebar-collapse-btn svg { width: 14px; height: 14px; transition: transform 240ms ease; }
/* 展开态箭头指向左（收起），收紧态指向右（展开）。 */
.app-shell.is-collapsed .sidebar-collapse-btn svg { transform: rotate(180deg); }

.sidebar::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(247, 147, 26, 0.04), transparent 40%);
}

.brand, .nav, .sidebar-footer, .storage-panel, .model-status-panel { position: relative; z-index: 1; }

.brand {
  display: flex; align-items: center; gap: 12px;
  height: 44px; padding: 0 4px; margin-bottom: 12px;
  overflow: hidden;
}
.brand-mark {
  display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0;
  border-radius: var(--radius-sm); color: #050810;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  font-weight: 800; font-size: 16px;
  box-shadow: 0 4px 16px rgba(247, 147, 26, 0.3);
}
.brand h1, .brand p, .topbar h2, .topbar p, .dialog-head h3, .dialog-head p { margin: 0; }
.brand h1 {
  font-size: 15px; font-weight: 700; white-space: nowrap;
  opacity: 1; transition: opacity 200ms ease;
}
.brand p { display: none; }
.app-shell.is-collapsed .brand h1 { opacity: 0; }

.sidebar-section {
  margin: 8px 0 4px; padding: 0 12px;
  color: var(--text-tertiary); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  white-space: nowrap; opacity: 0.8;
  transition: opacity 200ms ease;
}
.app-shell.is-collapsed .sidebar-section { opacity: 0; }

.nav {
  display: flex; flex-direction: column;
  gap: 4px; width: 100%;
  min-height: 0; overflow-y: auto; overflow-x: hidden; flex: 1;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }

.nav button {
  display: flex; align-items: center; gap: 14px;
  width: 100%; height: 44px; padding: 0 10px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  color: var(--text-secondary); background: transparent;
  font-size: 14px; font-weight: 500; white-space: nowrap;
  transition: all var(--transition);
}
.app-shell.is-collapsed .nav button { justify-content: center; gap: 0; }
.nav button .nav-icon {
  display: grid; place-items: center;
  width: 26px; height: 26px; flex-shrink: 0;
  border-radius: var(--radius-xs);
}
.nav button .nav-icon svg { width: 20px; height: 20px; }
.nav button .nav-icon.nav-icon-text { font-size: 14px; font-weight: 700; }
.nav button .nav-label {
  opacity: 1; transition: opacity 180ms ease;
}
.app-shell.is-collapsed .nav button .nav-label {
  opacity: 0; width: 0; overflow: hidden;
}

.nav button:hover { color: var(--text); background: var(--accent-soft); }
.nav button.active {
  color: var(--accent); background: var(--accent-soft);
  border-color: var(--border-active);
}
.nav button.active .nav-icon { background: var(--accent); color: var(--bg); }

.sidebar-footer {
  display: grid; gap: 6px; width: 100%; margin-top: auto; overflow: hidden;
  transition: opacity 180ms ease, visibility 180ms ease;
}
.app-shell.is-collapsed .sidebar-footer {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.admin-console-entry {
  display: flex; align-items: center; justify-content: flex-start;
  min-height: 38px; padding: 0 10px; border: 1px solid var(--border-active);
  border-radius: var(--radius-xs); color: var(--accent); background: var(--accent-soft);
  font-size: 12px; font-weight: 800; white-space: nowrap;
  transition: opacity 180ms ease, visibility 180ms ease;
}
.app-shell.is-collapsed .admin-console-entry {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.storage-panel {
  display: flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 10px; border-radius: var(--radius-xs);
  border: 1px solid transparent;
  color: var(--text-tertiary); background: var(--surface-0);
  font-size: 12px; white-space: nowrap; text-align: left;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
}
.storage-panel:hover { border-color: var(--border-active); background: var(--accent-soft); color: var(--text-secondary); }
.storage-panel[data-status-level="error"] { border-color: rgba(244, 63, 94, 0.32); background: var(--danger-soft); }
.storage-panel[data-status-level="success"] { border-color: rgba(16, 185, 129, 0.28); }
.storage-panel[data-status-level="running"] { border-color: var(--border-active); }
.storage-panel span { opacity: 1; transition: opacity 180ms ease; }
.app-shell.is-collapsed .storage-panel span { opacity: 0; }
.storage-panel strong { color: var(--accent-3); font-size: 12px; margin-left: auto; }
.storage-panel[data-status-level="error"] strong { color: var(--danger); }

.storage-status-dialog {
  width: min(680px, calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 32px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  background: var(--surface-1);
  box-shadow: var(--shadow-lg);
}
.storage-status-dialog::backdrop { background: rgba(0, 0, 0, 0.46); backdrop-filter: blur(5px); }
.storage-status-body {
  display: grid;
  gap: 12px;
  max-height: min(560px, calc(100vh - 150px));
  overflow: auto;
  padding: 16px;
}
.storage-status-current {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface-0);
}
.storage-status-current strong { color: var(--accent-3); font-size: 14px; }
.storage-status-current span, .storage-status-event time { color: var(--text-tertiary); font-size: 12px; }
.storage-status-events {
  display: grid;
  gap: 8px;
}
.storage-status-event {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface-0);
}
.storage-status-event[data-level="error"] { border-color: rgba(244, 63, 94, 0.32); background: var(--danger-soft); }
.storage-status-event[data-level="success"] { border-color: rgba(16, 185, 129, 0.28); }
.storage-status-event b { color: var(--text); font-size: 13px; }
.storage-status-event pre {
  max-height: 180px;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-secondary);
  font: 11px/1.5 var(--font-mono);
}

.model-status-panel {
  display: flex; align-items: center; gap: 8px;
  min-height: 38px; padding: 8px 10px; border-radius: var(--radius-xs);
  color: var(--text-tertiary); background: var(--surface-0);
  font-size: 12px; overflow: hidden;
}
.model-status-panel div { display: grid; gap: 2px; min-width: 0; opacity: 1; transition: opacity 180ms ease; }
.app-shell.is-collapsed .model-status-panel div { opacity: 0; }
.model-status-panel strong { overflow: hidden; color: var(--accent-2); text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.model-status-panel em { color: var(--text-tertiary); font-size: 11px; font-style: normal; }
.model-status-panel em.connected { color: var(--accent-3); }

.model-status-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; flex-shrink: 0; }
.model-status-test {
  min-height: 28px; padding: 0 8px;
  border: 1px solid var(--border-active); border-radius: var(--radius-xs);
  color: var(--accent); background: var(--accent-soft);
  font-weight: 700; font-size: 11px; white-space: nowrap;
}
.model-status-test:disabled { opacity: 0.5; cursor: wait; }
.model-status-config {
  display: grid; place-items: center; width: 28px; height: 28px; flex-shrink: 0;
  border: 1px solid var(--border); border-radius: var(--radius-xs);
  color: var(--text); background: var(--surface-0); font-size: 12px;
}

.admin-panel { display: grid; gap: 18px; max-width: 1220px; }
.admin-panel[hidden] { display: none; }
.admin-panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.admin-panel-head h3 { margin: 4px 0 0; font-size: 20px; }
.admin-section-head { margin-top: 18px; }
.admin-console-tabs {
  display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 0;
  border-bottom: 1px solid var(--border);
}
.admin-console-tabs button {
  min-height: 36px; padding: 0 14px; border: 1px solid var(--border);
  border-bottom: 0; border-radius: var(--radius-xs) var(--radius-xs) 0 0;
  color: var(--text-tertiary); background: transparent; font-size: 13px;
  white-space: nowrap; cursor: pointer;
}
.admin-console-tabs button.active {
  color: var(--text); background: var(--surface-0); border-color: var(--border-active);
  font-weight: 700;
}
.admin-console-page { display: grid; gap: 18px; min-width: 0; }
.admin-dashboard-grid {
  display: grid; grid-template-columns: 1fr;
  gap: 16px; align-items: start;
}
.admin-message {
  margin: 0; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-xs); color: var(--text-secondary); background: var(--surface-1);
}
.admin-card { box-shadow: var(--shadow-sm); }
.admin-users-card,
.admin-alert-card,
.admin-reserved-panel {
  min-width: 0; padding: 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface-0);
}
.admin-reserved-list {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px; margin-top: 12px;
}
.admin-reserved-item {
  display: grid; gap: 6px; min-height: 112px; padding: 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-1); opacity: .68;
}
.admin-reserved-item span {
  justify-self: start; min-height: 22px; padding: 2px 8px; border-radius: 999px;
  color: var(--text-tertiary); background: var(--surface-2); font-size: 11px; font-weight: 700;
}
.admin-reserved-item strong { color: var(--text-secondary); font-size: 13px; }
.admin-reserved-item p { margin: 0; color: var(--text-tertiary); font-size: 12px; line-height: 1.5; }
.admin-table-wrap {
  overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-0);
}
.admin-table-wrap table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.admin-table-wrap th, .admin-table-wrap td {
  padding: 14px 16px; border-bottom: 1px solid var(--border); text-align: left;
}
.admin-table-wrap th:nth-child(1), .admin-table-wrap td:nth-child(1) { width: 54%; }
.admin-table-wrap th:nth-child(2), .admin-table-wrap td:nth-child(2),
.admin-table-wrap th:nth-child(3), .admin-table-wrap td:nth-child(3) { width: 23%; }
.admin-table-wrap tbody tr:last-child td { border-bottom: 0; }
.admin-user-cell { display: grid; gap: 4px; min-width: 0; }
.admin-user-cell strong, .admin-user-cell span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-table-wrap td span { color: var(--text-tertiary); font-size: 12px; }
.admin-control-select {
  width: 100%; max-width: 150px; min-height: 36px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius-xs);
  color: var(--text); background: var(--surface-0); font-weight: 600;
}

/* ── 下拉选项配置 ─────────────────────────────────────────────────── */
.admin-hint { margin: 0; color: var(--text-tertiary); font-size: 12px; line-height: 1.5; }
.admin-message-inline { margin-left: 8px; color: var(--accent); font-weight: 600; }
.email-center-panel {
  display: grid; gap: 14px; padding: 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface-0);
}
.email-center-actions, .email-history-actions {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.email-switch-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px;
}
.email-switch-group {
  display: grid; gap: 8px; padding: 10px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface-1);
}
.email-switch-group h4, .email-history-head h4 { margin: 0; font-size: 13px; }
.email-switch-list { display: grid; gap: 8px; }
.email-switch-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; align-items: start;
  font-size: 12px; color: var(--text-secondary);
}
.email-switch-row strong { display: block; color: var(--text); font-size: 12px; }
.email-switch-row strong em {
  margin-left: 6px; color: var(--text-tertiary); font-style: normal; font-size: 11px;
}
.email-switch-row small { display: block; margin-top: 2px; color: var(--text-tertiary); }
.email-switch-row.offline { opacity: .58; }
.email-switch-row.offline input { cursor: not-allowed; }
.email-test-panel {
  display: grid; gap: 12px; padding: 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface-1);
}
.admin-alert-card .email-test-panel {
  margin-top: 2px; padding: 14px 0 0; border-width: 1px 0 0;
  border-radius: 0; background: transparent;
}
.email-test-panel h4 { margin: 2px 0 4px; font-size: 14px; }
.email-test-grid {
  display: grid; grid-template-columns: 1fr;
  gap: 10px; align-items: stretch;
}
.email-test-grid label { display: grid; gap: 5px; min-width: 0; color: var(--text-secondary); font-size: 12px; font-weight: 700; }
.email-test-grid select,
.email-test-grid input {
  width: 100%; min-height: 36px; padding: 6px 10px; border: 1px solid var(--border);
  border-radius: var(--radius-xs); background: var(--surface-0); color: var(--text);
}
.email-test-grid .primary-button { justify-self: start; }
.email-history-head {
  display: flex; justify-content: space-between; align-items: end; gap: 12px;
}
.email-history-head select {
  min-height: 34px; padding: 4px 8px; border: 1px solid var(--border);
  border-radius: var(--radius-xs); background: var(--surface-0); color: var(--text);
}
.email-center-panel .admin-table-wrap table { table-layout: auto; }
.email-center-panel .admin-table-wrap th,
.email-center-panel .admin-table-wrap td { width: auto; }
.email-status {
  display: inline-flex; align-items: center; min-height: 22px; padding: 0 8px;
  border-radius: 999px; border: 1px solid var(--border); color: var(--text-secondary);
  background: var(--surface-1); font-size: 11px; font-weight: 700;
}
.email-status.sent { color: var(--success); border-color: rgba(16, 185, 129, .28); background: rgba(16, 185, 129, .08); }
.email-status.failed { color: var(--danger); border-color: rgba(239, 68, 68, .28); background: rgba(239, 68, 68, .08); }
.email-status.skipped { color: var(--warning); border-color: rgba(245, 158, 11, .28); background: rgba(245, 158, 11, .08); }
.email-history-viewer {
  display: grid; gap: 10px; padding-top: 10px; border-top: 1px solid var(--border);
}
.email-history-frame {
  width: 100%; min-height: 420px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: #ffffff;
}
.email-history-text {
  max-height: 420px; overflow: auto; margin: 0; padding: 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface-1); color: var(--text-secondary);
}
@media (max-width: 960px) {
  .email-switch-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .email-test-grid { grid-template-columns: 1fr; }
  .email-test-recipients { grid-column: auto; }
}
@media (max-width: 620px) {
  .email-switch-grid { grid-template-columns: 1fr; }
  .email-test-grid { grid-template-columns: 1fr; }
  .email-test-recipients { grid-column: auto; }
  .email-history-head { align-items: stretch; flex-direction: column; }
}
.option-config-list { display: grid; gap: 10px; }
.option-config-row {
  display: grid; grid-template-columns: minmax(200px, 1fr) minmax(240px, 2fr) auto;
  align-items: center; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-1);
}
.option-config-row label { display: flex; align-items: center; gap: 8px; min-width: 0; }
.option-config-row label strong { font-size: 13px; font-weight: 600; }
.option-config-tag { font-size: 11px; font-weight: 700; color: var(--accent); }
.option-config-tag.muted { color: var(--text-tertiary); }
.option-config-row input {
  width: 100%; min-height: 36px; padding: 6px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-xs);
  color: var(--text); background: var(--surface-0); font-size: 13px;
}
.option-config-row input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.option-config-row .ghost-button { min-height: 36px; padding: 0 12px; font-size: 12px; white-space: nowrap; }
@media (max-width: 720px) {
  .option-config-row { grid-template-columns: 1fr; }
}

/* ── 工作区 ───────────────────────────────────────────────────────── */
.workspace {
  position: relative; min-width: 0; height: 100vh;
  margin-left: var(--rail);
  overflow-y: auto; padding: 24px 32px;
  scrollbar-width: thin; scrollbar-color: rgba(247, 147, 26, 0.3) transparent;
  transition: margin-left 240ms cubic-bezier(0.4, 0, 0.2, 1);
}

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 28px; }
.topbar h2 { margin-top: 2px; font-size: 28px; font-weight: 700; letter-spacing: -0.03em; }

.eyebrow {
  color: var(--accent); font-size: 11px; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase;
}

.toolbar { display: flex; align-items: center; gap: 8px; }
.user-pill {
  max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-xs);
  color: var(--text-secondary); background: var(--surface-1); font-size: 12px; font-weight: 700;
}

/* ── 按钮系统 (Crypto Pills) ──────────────────────────────────────── */
.primary-button, .ghost-button, .icon-button, .text-button {
  min-height: 40px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-1);
  color: var(--text); font-size: 13px; font-weight: 600;
  transition: all var(--transition);
}
.primary-button {
  padding: 0 22px; border: none;
  color: #FFFFFF; background: var(--grad-fire);
  font-weight: 700; letter-spacing: 0.03em;
  box-shadow: var(--glow-sm);
}
.primary-button:hover { box-shadow: var(--glow-md); transform: scale(1.04); }
.primary-button:active { transform: scale(1); }

.ghost-button { padding: 0 16px; background: var(--surface-0); }
.ghost-button:hover { border-color: var(--border-active); background: var(--accent-soft); color: var(--accent); }

.icon-button { display: inline-grid; place-items: center; width: 40px; height: 40px; font-size: 18px; background: var(--surface-0); }
.icon-button:hover { border-color: var(--border-active); color: var(--accent); box-shadow: var(--glow-sm); }

.text-button { min-height: auto; padding: 0; border: 0; border-radius: 0; background: transparent; text-align: left; }
.import-label input { display: none; }

.theme-toggle {
  position: relative; overflow: hidden;
  border-color: var(--border-active); color: var(--accent);
  background: var(--accent-soft); font-size: 13px; font-weight: 700;
}

/* ── 首页看板 ─────────────────────────────────────────────────────── */
.dashboard { display: grid; gap: 20px; margin-bottom: 24px; }

.today-overview {
  display: grid;
  grid-template-columns: minmax(180px, .48fr) minmax(560px, 1.9fr);
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, .88);
  box-shadow: var(--shadow-sm);
}
.today-overview h3 { margin: 4px 0 0; font-size: 20px; font-weight: 800; }
.cost-module-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 10px;
}
.cost-module-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-0);
}
.cost-module-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.cost-module-head strong { font-size: 15px; font-weight: 900; color: var(--text); }
.cost-module-head span { color: var(--text-tertiary); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.cost-module-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.cost-module-metric {
  display: grid;
  gap: 4px;
  min-height: 52px;
  padding: 8px;
  border-radius: 8px;
  background: var(--surface-1);
  min-width: 0;
}
.cost-module-metric b {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 18px;
  line-height: 1.05;
  overflow-wrap: anywhere;
}
.cost-module-metric small {
  color: var(--text-tertiary);
  font-size: 10px;
  font-weight: 800;
}
.cost-module-metric.accent b { color: var(--accent); }
.cost-module-metric.success b { color: var(--success); }
.cost-module-compare {
  margin: 0;
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 700;
}
.cost-module-compare strong { color: var(--accent); font-weight: 900; }
.today-overview-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, 1fr));
  gap: 8px;
}
.today-overview-chip {
  display: grid;
  gap: 3px;
  min-height: 54px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-0);
}
.today-overview-chip strong { font-size: 21px; line-height: 1; font-weight: 900; color: var(--text); }
.today-overview-chip span { font-size: 11px; color: var(--text-tertiary); font-weight: 700; }
.today-overview-chip.accent strong { color: var(--accent); }
.today-overview-chip.danger strong { color: var(--danger); }
.today-overview-chip.success strong { color: var(--success); }
.today-overview-compare {
  grid-column: 1 / -1;
  margin: 2px 0 0;
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 700;
}
.today-overview-compare strong { color: var(--accent); font-weight: 900; }

.executive-summary {
  display: grid; grid-template-columns: minmax(220px, 0.9fr) minmax(420px, 1.8fr) minmax(180px, 0.7fr);
  gap: 16px; align-items: stretch;
  padding: 22px; border: 1px solid var(--glass-border); border-radius: var(--radius-lg);
  background: var(--glass); backdrop-filter: blur(14px) saturate(1.08);
  box-shadow: var(--shadow-md);
}
.executive-copy { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.executive-copy h3 { margin: 4px 0 6px; font-size: 22px; font-weight: 800; color: var(--text); }
.executive-copy p:not(.eyebrow) { margin: 0; color: var(--text-secondary); font-size: 13px; line-height: 1.5; }
.executive-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; min-width: 0; }
.executive-metric {
  display: grid; align-content: center; gap: 6px; min-height: 94px; min-width: 0;
  padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-0);
}
.executive-metric span { color: var(--text-tertiary); font-size: 11px; font-weight: 700; }
.executive-metric strong {
  color: var(--text); font-family: var(--font-mono); font-size: 20px; line-height: 1.15;
  overflow-wrap: anywhere;
}
.executive-metric.metric-tag strong { color: var(--accent); }
.executive-bars {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: 10px;
  padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-0);
}
.executive-bar { display: grid; justify-items: center; align-items: end; gap: 7px; min-width: 0; }
.executive-bar i {
  display: block; width: 100%; max-width: 28px; min-height: 8px; border-radius: 999px 999px 3px 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent-3));
}
.executive-bar span { color: var(--text-tertiary); font-size: 10px; font-weight: 700; }

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

.dash-card {
  border: 1px solid var(--glass-border); border-radius: var(--radius-md);
  background: var(--glass); backdrop-filter: blur(12px);
  padding: 20px; box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.dash-card:hover {
  border-color: var(--border-active);
  transform: translateY(-2px);
  box-shadow: var(--glow-card);
}

.dash-card-welcome {
  grid-column: 1 / 3; grid-row: 1;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  background:
    linear-gradient(135deg, rgba(247, 147, 26, 0.08), transparent 60%),
    var(--surface-1);
  position: relative; overflow: hidden;
}
.dash-card-welcome::after {
  content: ""; position: absolute; right: -60px; top: -60px;
  width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, rgba(247, 147, 26, 0.18), transparent 70%);
  filter: blur(40px); pointer-events: none;
}
.dash-welcome-text { position: relative; z-index: 1; }
.dash-welcome-text h3 {
  margin: 6px 0; font-size: 24px; font-weight: 700; letter-spacing: -0.03em;
  background: var(--grad-gold); -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.dash-welcome-sub { margin: 0; color: var(--text-secondary); font-size: 14px; }
.dash-welcome-sub strong { color: var(--accent); font-family: var(--font-mono); }
.dash-welcome-actions { display: flex; gap: 10px; flex-shrink: 0; position: relative; z-index: 1; }

.dash-card-ring {
  grid-column: 3; grid-row: 1;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.dash-ring-wrap { display: flex; align-items: center; gap: 16px; }
.donut-chart { flex-shrink: 0; }
.dash-ring-legend {
  display: grid; grid-template-columns: auto 1fr; gap: 4px 8px; font-size: 11px; color: var(--text-secondary);
}
.legend-dot {
  width: 8px; height: 8px; border-radius: 2px; background: var(--dot-color); align-self: center;
}

.dash-card-billing {
  grid-column: 4; grid-row: 1 / 3;
  display: flex; flex-direction: column;
}
.dash-card-head { margin-bottom: 12px; }

.dash-bar-chart {
  display: flex; align-items: flex-end; justify-content: space-around; gap: 8px; flex: 1; min-height: 100px;
}
.dash-bar-col { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 1; }
.dash-bar-col span { font-size: 10px; color: var(--text-tertiary); font-family: var(--font-mono); }
.dash-bar-stack { display: flex; flex-direction: column; justify-content: flex-end; width: 100%; max-width: 28px; border-radius: 6px; overflow: hidden; }
.dash-bar.paid { background: linear-gradient(180deg, #FFD600, #F7931A); min-height: 2px; box-shadow: 0 0 12px -2px rgba(247, 147, 26, 0.5); }
.dash-bar.unpaid { background: rgba(255, 255, 255, 0.1); min-height: 0; }

.dash-card-metric {
  display: flex; flex-direction: column; justify-content: center;
}
.dash-metric-label { color: var(--text-secondary); font-size: 11px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; }
.dash-metric-value { font-family: var(--font-mono); font-size: 34px; font-weight: 500; letter-spacing: -0.02em; margin: 6px 0; color: var(--accent); }
.metric-danger .dash-metric-value { color: var(--danger); }
.metric-success .dash-metric-value { color: var(--accent-3); }
.metric-warning .dash-metric-value { color: var(--warning); }
.metric-neutral .dash-metric-value { color: var(--text); }
.dash-metric-desc { margin: 0; color: var(--text-tertiary); font-size: 11px; line-height: 1.4; }

.bucket-overview {
  padding: 22px; border: 1px solid var(--glass-border); border-radius: var(--radius-lg);
  background: var(--glass); backdrop-filter: blur(14px) saturate(1.08);
  box-shadow: var(--shadow-md);
}
.bucket-overview-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: 16px;
}
.bucket-overview-head h3 { margin: 4px 0 0; font-size: 20px; font-weight: 700; }
.dashboard-sync-time {
  margin: 6px 0 0;
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 700;
}
.dashboard-sync-time strong { color: var(--text-secondary); font-weight: 800; }
.bucket-card-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px;
}
.bucket-card {
  display: grid; gap: 14px; align-content: start; min-height: 224px;
  padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-0); text-align: left;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.bucket-card:hover { border-color: var(--border-active); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.bucket-card-top, .bucket-card-foot, .bucket-card-facts { display: flex; align-items: center; gap: 8px; }
.bucket-card-top { justify-content: space-between; }
.bucket-card-top strong { color: var(--accent); font-family: var(--font-mono); font-size: 14px; }
.bucket-risk {
  display: inline-flex; align-items: center; justify-content: center; min-height: 22px; padding: 0 9px;
  border: 1px solid var(--border); border-radius: 999px; color: var(--text-tertiary);
  font-size: 11px; font-weight: 700;
}
.bucket-risk.danger { border-color: rgba(244, 63, 94, 0.28); color: var(--danger); background: var(--danger-soft); }
.bucket-card-metric { display: grid; gap: 4px; }
.bucket-card-metric span, .bucket-card-foot, .bucket-card-facts { color: var(--text-tertiary); font-size: 11px; }
.bucket-card-metric b { color: var(--text); font-family: var(--font-mono); font-size: 24px; font-weight: 700; }
.bucket-card-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.bucket-card-kpis span {
  display: grid; gap: 3px; min-width: 0; padding: 9px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-xs); background: var(--surface-1);
}
.bucket-card-kpis small { color: var(--text-tertiary); font-size: 10px; font-weight: 700; }
.bucket-card-kpis strong {
  color: var(--text); font-family: var(--font-mono); font-size: 13px; font-weight: 800;
  overflow-wrap: anywhere;
}
.bucket-card-facts { flex-wrap: wrap; }
.bucket-card-facts span {
  padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-secondary);
  font-size: 11px;
}
.bucket-card-foot { justify-content: space-between; border-top: 1px solid var(--border); padding-top: 10px; }

.today-board {
  padding: 24px; border: 1px solid var(--glass-border); border-radius: var(--radius-lg);
  background: var(--glass); backdrop-filter: blur(16px) saturate(1.1);
  box-shadow: var(--shadow-md);
}
.today-board-head, .today-layout, .task-card, .task-card-side, .upcoming-item { display: flex; }
.today-board-head { align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.today-board-actions { display: flex; align-items: center; gap: 8px; }
.today-board h3 { margin: 4px 0 0; font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }

.priority-task-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }

.task-column {
  display: grid; align-content: start; gap: 10px; min-width: 0;
  padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--surface-0);
}
.overdue-column { border-color: var(--danger-soft); background: rgba(244, 63, 94, 0.04); }
.task-column-title { color: var(--text-secondary); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.overdue-column .task-column-title { color: var(--danger); }
.task-column-list { display: grid; gap: 8px; }

.task-card {
  justify-content: space-between; gap: 12px; min-height: 80px;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-1); transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.task-card:hover { border-color: var(--border-active); transform: translateY(-1px); box-shadow: var(--glow-card); }
.task-card.overdue { border-color: rgba(244, 63, 94, 0.25); background: linear-gradient(135deg, rgba(244, 63, 94, 0.06), var(--surface-1)); box-shadow: inset 3px 0 0 var(--danger); }

.task-card-main { min-width: 0; }
.task-card-main .record-title { display: block; margin-top: 8px; color: var(--text); font-size: 14px; font-weight: 600; line-height: 1.4; }
.task-card-main p { margin: 6px 0 0; color: var(--text-secondary); font-size: 12px; line-height: 1.5; }

.task-card-side { align-items: flex-end; flex-direction: column; justify-content: space-between; gap: 8px; min-width: 110px; color: var(--text-secondary); font-size: 12px; }
.overdue-days { color: var(--danger); font-weight: 700; }

.upcoming-list {
  width: 100%; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--surface-0);
}
.upcoming-title { margin-bottom: 10px; color: var(--text-secondary); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.upcoming-item {
  display: flex; align-items: flex-start; width: 100%; gap: 12px;
  padding: 10px 0; border: 0; border-top: 1px solid var(--border);
  color: var(--text); background: transparent; text-align: left;
  transition: color var(--transition);
}
.upcoming-item:hover { color: var(--accent); }
.upcoming-item span { min-width: 80px; color: var(--accent); font-size: 12px; font-weight: 500; }
.upcoming-item strong { font-size: 13px; font-weight: 500; line-height: 1.4; }

.task-empty {
  display: grid; min-height: 80px; place-items: center; padding: 16px;
  border: 1px dashed var(--border); border-radius: var(--radius-sm);
  color: var(--text-tertiary); font-size: 13px;
}
.task-empty.compact { min-height: 56px; font-size: 12px; }

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

.metric {
  position: relative; overflow: hidden; min-height: 110px; padding: 20px;
  border: 1px solid var(--glass-border); border-radius: var(--radius-md);
  background: var(--glass); backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), transform var(--transition);
}
.metric:hover { border-color: var(--border-active); transform: translateY(-2px); }
.metric::after { content: none; }
.metric span { color: var(--text-secondary); font-size: 12px; font-weight: 500; }
.metric strong { display: block; margin-top: 10px; font-size: 32px; font-weight: 800; letter-spacing: -0.03em; color: var(--accent); }
.metric p { margin: 8px 0 0; color: var(--text-tertiary); font-size: 12px; line-height: 1.4; }

.metric-accent strong { color: var(--accent); }
.metric-danger strong { color: var(--danger); }
.metric-success strong { color: var(--accent-3); }
.metric-warning strong { color: var(--warning); }
.metric-neutral strong { color: var(--text-secondary); }

/* ── 智能录入 ─────────────────────────────────────────────────────── */
.smart-entry {
  display: grid; gap: 14px; margin-bottom: 24px; padding: 20px;
  border: 1px solid var(--glass-border); border-radius: var(--radius-lg);
  background: var(--glass); backdrop-filter: blur(12px);
  box-shadow: var(--shadow-md);
}
.smart-entry[hidden] { display: none; }
.smart-entry-head, .smart-entry-actions, .smart-entry-buttons, .smart-entry-row { display: flex; }
.smart-entry-head, .smart-entry-actions { align-items: center; justify-content: space-between; gap: 12px; }
.smart-entry h3 { margin: 4px 0 0; font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.smart-entry textarea {
  width: 100%; min-height: 88px; resize: vertical; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); outline: 0;
  color: var(--text); background: var(--surface-0); line-height: 1.6; font-size: 14px;
}
.smart-entry textarea::placeholder { color: var(--text-tertiary); }
.smart-entry textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.smart-entry-actions span { color: var(--text-tertiary); font-size: 12px; }
.smart-entry-buttons { justify-content: flex-end; gap: 8px; flex: 0 0 auto; }

.smart-entry-preview { display: grid; gap: 10px; }
.smart-entry-preview:empty { display: none; }
.smart-entry-group { display: grid; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.smart-entry-group > strong { color: var(--text-secondary); font-size: 12px; }
.smart-entry-list { display: grid; gap: 8px; }
.smart-entry-row {
  align-items: center; justify-content: space-between; gap: 12px;
  min-height: 52px; padding: 10px 14px;
  border: 1px solid rgba(255, 214, 0, 0.18); border-radius: var(--radius-sm);
  background: var(--surface-0);
}
.smart-entry-row.update { border-color: var(--border-active); }
.smart-entry-row.note { border-color: rgba(255, 214, 0, 0.2); }
.smart-entry-row div { display: grid; gap: 3px; min-width: 0; }
.smart-entry-row span, .smart-entry-row em { color: var(--text-tertiary); font-size: 11px; font-style: normal; }
.smart-entry-row b { overflow-wrap: anywhere; color: var(--text); font-size: 13px; }
.smart-entry-row em { flex: 0 0 auto; }
.smart-entry-confirmed { color: var(--accent-3); }

/* ── AWS Sync ─────────────────────────────────────────────────────── */
.aws-sync-panel {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: minmax(160px, 1fr) minmax(260px, 1.6fr) auto;
  align-items: center; gap: 14px; margin: 0 auto 18px; padding: 12px 16px;
  max-width: 920px;
  border: 1px solid var(--glass-border); border-radius: var(--radius-md);
  background: var(--glass); backdrop-filter: blur(12px);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
.aws-sync-panel::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 4px;
  background: var(--text-tertiary); opacity: 0.7;
}
.aws-sync-panel[data-status="running"] {
  border-color: var(--border-active);
  background: linear-gradient(135deg, rgba(247, 147, 26, 0.16), rgba(15, 17, 21, 0.78));
  box-shadow: 0 0 0 1px rgba(247, 147, 26, 0.16), var(--glow-card);
  animation: syncPulse 1.6s ease-in-out infinite;
}
.aws-sync-panel[data-status="running"]::before { background: var(--accent); opacity: 1; }
.aws-sync-panel[data-status="success"]::before { background: var(--accent-3); }
.aws-sync-panel[data-status="error"]::before { background: var(--danger); }
.aws-sync-panel[hidden] { display: none; }
.aws-sync-copy { min-width: 0; }
.aws-sync-copy h3 { margin: 2px 0 3px; font-size: 14px; font-weight: 700; }
.aws-sync-copy p:not(.eyebrow) { margin: 0; color: var(--text-tertiary); font-size: 11px; }
.aws-sync-progress {
  height: 5px; margin-top: 9px; overflow: hidden;
  border-radius: 999px; background: rgba(255, 255, 255, 0.08);
}
.aws-sync-progress[hidden] { display: none; }
.aws-sync-progress span {
  display: block; width: var(--sync-progress, 0%); height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-3));
  box-shadow: 0 0 18px rgba(247, 147, 26, 0.42);
  transition: width 420ms ease;
}
.aws-sync-stage-list { display: grid; grid-template-columns: repeat(5, minmax(64px, 1fr)); gap: 5px; }
.aws-sync-stage {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  min-height: 28px; padding: 0 6px;
  border: 1px solid var(--border); border-radius: var(--radius-xs);
  color: var(--text-tertiary); font-size: 10px; font-weight: 700; white-space: nowrap;
}
.aws-sync-stage b {
  display: inline-grid; place-items: center; width: 15px; height: 15px;
  border-radius: 999px; color: var(--bg); background: var(--text-tertiary); font-size: 9px;
}
.aws-sync-stage.done { color: var(--accent-3); border-color: rgba(255, 214, 0, 0.25); }
.aws-sync-stage.done b { background: var(--accent-3); }
.aws-sync-stage.active { color: var(--accent); border-color: var(--border-active); }
.aws-sync-stage.active b { background: var(--accent); }
.aws-sync-stage.active {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(247, 147, 26, 0.12), 0 0 18px -10px var(--accent);
}
.aws-sync-stage.error { color: var(--danger); border-color: rgba(244, 63, 94, 0.3); }
.aws-sync-stage.error b { background: var(--danger); }
.aws-sync-stage.no-data { color: var(--warning); border-color: rgba(255, 214, 0, 0.3); }
.aws-sync-stage.no-data b { background: var(--warning); }
.aws-sync-run { min-width: 104px; padding: 0 14px; font-size: 13px; }

@keyframes syncPulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(247, 147, 26, 0.14), var(--glow-card); }
  50% { box-shadow: 0 0 0 1px rgba(247, 147, 26, 0.34), 0 0 34px -14px rgba(247, 147, 26, 0.7); }
}

/* ── 内容面板 / 表格 ──────────────────────────────────────────────── */
.content-panel {
  border: 1px solid var(--glass-border); border-radius: var(--radius-lg);
  overflow: hidden; background: var(--glass); backdrop-filter: blur(12px);
  box-shadow: var(--shadow-md);
}

.module-tabs {
  display: flex; gap: 6px; overflow-x: auto; padding: 14px 16px 0;
  background: var(--surface-0);
}
.module-tabs[hidden] { display: none; }
.module-tabs button {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: var(--radius-xs) var(--radius-xs) 0 0;
  color: var(--text-tertiary); background: transparent; font-size: 13px; white-space: nowrap;
  transition: all var(--transition);
}
.module-tabs button.active { color: var(--text); border-color: var(--border-active); background: var(--surface-1); font-weight: 600; border-bottom-color: transparent; }
.module-tabs span { color: var(--accent); font-size: 11px; font-weight: 600; }

.panel-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px;
  border-bottom: 1px solid var(--border); background: var(--surface-0); flex-wrap: wrap;
}
.panel-head select { width: 100%; min-height: 36px; max-width: 200px; padding: 0 32px 0 10px; color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); background-color: var(--surface-1); font-size: 13px; }
.field-filter { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; min-width: 0; }
.field-filter[hidden] { display: none; }
.field-filter select { width: auto; min-width: 120px; min-height: 36px; max-width: 180px; padding: 0 32px 0 10px; color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); background-color: var(--surface-1); font-size: 13px; }
.field-filter-clear { min-height: 36px; padding: 0 14px; font-size: 12px; white-space: nowrap; flex-shrink: 0; }

.table-wrap {
  overflow-x: auto; overflow-y: auto; max-width: 100%;
  scrollbar-width: thin; scrollbar-color: rgba(247, 147, 26, 0.3) transparent;
}
/* 桌面端宽列尽量按真实内容铺，min-width 在窄屏 / 平板会被媒体查询放开。 */
table { width: 100%; border-collapse: collapse; min-width: 1360px; table-layout: auto; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; font-size: 13px; white-space: nowrap; }
th { position: sticky; top: 0; z-index: 1; color: var(--text-secondary); background: var(--surface-0); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
td { color: var(--text); }
th.cell-money, td.cell-money { text-align: right; font-variant-numeric: tabular-nums; }
th.cell-percent, td.cell-percent, th.cell-center, td.cell-center { text-align: center; }
.table-wrap[data-module="accounts"] th:nth-child(-n+3),
.table-wrap[data-module="accounts"] td:nth-child(-n+3) {
  position: sticky; background: var(--surface-0); z-index: 2;
  box-shadow: 1px 0 0 var(--border);
}
.table-wrap[data-module="accounts"] th:nth-child(-n+3) { z-index: 4; }
.table-wrap[data-module="accounts"] th:nth-child(1),
.table-wrap[data-module="accounts"] td:nth-child(1) { left: 0; min-width: 130px; }
.table-wrap[data-module="accounts"] th:nth-child(2),
.table-wrap[data-module="accounts"] td:nth-child(2) { left: 130px; min-width: 210px; }
.table-wrap[data-module="accounts"] th:nth-child(3),
.table-wrap[data-module="accounts"] td:nth-child(3) { left: 340px; min-width: 150px; }
.table-wrap[data-module="awsCostDaily"] th:nth-child(-n+2),
.table-wrap[data-module="awsCostDaily"] td:nth-child(-n+2) {
  position: sticky; background: var(--surface-0); z-index: 2;
  box-shadow: 1px 0 0 var(--border);
}
.table-wrap[data-module="awsCostDaily"] th:nth-child(-n+2) { z-index: 4; }
.table-wrap[data-module="awsCostDaily"] th:nth-child(1),
.table-wrap[data-module="awsCostDaily"] td:nth-child(1) { left: 0; min-width: 140px; }
.table-wrap[data-module="awsCostDaily"] th:nth-child(2),
.table-wrap[data-module="awsCostDaily"] td:nth-child(2) { left: 140px; min-width: 220px; }
.table-wrap[data-module="awsMapTagDaily"] th:nth-child(-n+2),
.table-wrap[data-module="awsMapTagDaily"] td:nth-child(-n+2) {
  position: sticky; background: var(--surface-0); z-index: 2;
  box-shadow: 1px 0 0 var(--border);
}
.table-wrap[data-module="awsMapTagDaily"] th:nth-child(-n+2) { z-index: 4; }
.table-wrap[data-module="awsMapTagDaily"] th:nth-child(1),
.table-wrap[data-module="awsMapTagDaily"] td:nth-child(1) { left: 0; min-width: 140px; }
.table-wrap[data-module="awsMapTagDaily"] th:nth-child(2),
.table-wrap[data-module="awsMapTagDaily"] td:nth-child(2) { left: 140px; min-width: 220px; }
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--accent-soft); }
tbody tr.is-today { background: linear-gradient(90deg, var(--accent-3-soft), transparent); box-shadow: inset 3px 0 0 var(--accent-3); }
tbody tr.is-overdue { background: linear-gradient(90deg, var(--danger-soft), transparent); box-shadow: inset 3px 0 0 var(--danger); }
tbody tr.is-aws-alert { background: linear-gradient(90deg, rgba(244, 63, 94, 0.08), transparent); box-shadow: inset 3px 0 0 var(--danger), 0 0 18px -12px rgba(255, 95, 143, 0.8); }
tbody tr.is-archived { opacity: 0.45; }
tbody tr.is-archived .record-title { color: var(--text-tertiary); }
.record-title { color: var(--accent); font-weight: 700; }

/* ── Chip / Badge ─────────────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; min-height: 22px; padding: 2px 10px;
  border: 1px solid var(--border-active); border-radius: 999px;
  color: var(--accent); background: var(--accent-soft);
  font-size: 11px; font-weight: 700; white-space: nowrap;
}
.chip.warning { color: var(--warning); border-color: rgba(255, 214, 0, 0.3); background: var(--warning-soft); }
.chip.danger { color: var(--danger); border-color: rgba(244, 63, 94, 0.3); background: var(--danger-soft); }
.chip.archive { color: var(--text-tertiary); border-color: var(--border); background: var(--surface-0); }

.status-select {
  min-height: 28px; min-width: 100px; padding: 2px 24px 2px 10px;
  border: 1px solid var(--border-active); border-radius: 999px; outline: 0;
  color: var(--accent); background: var(--surface-0); font-size: 11px; font-weight: 700;
}
.status-select.warning { color: var(--warning); border-color: rgba(255, 214, 0, 0.3); }
.status-select.danger { color: var(--danger); border-color: rgba(244, 63, 94, 0.3); }
.status-select.archive { color: var(--text-tertiary); border-color: var(--border); }
.status-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ── Sparkline ────────────────────────────────────────────────────── */
.sparkline {
  display: inline-flex; align-items: center; width: 88px; height: 28px;
  padding: 2px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-0);
}
.sparkline svg { width: 84px; height: 24px; }
.sparkline polyline { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sparkline.down polyline { stroke: var(--danger); }

/* ── AWS Config Tree ──────────────────────────────────────────────── */
.aws-config-tree { display: grid; gap: 12px; min-width: 1160px; }
/* 平板/小屏会被 @media 放开 min-width，避免列宽固定逼出横向滚动条。 */
.aws-config-bucket { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-0); overflow: hidden; }
/* Payer 桶汇总行：桶别名 · Payer Account ID · Owner · 付款方式(固定) · More */
.aws-config-bucket summary {
  display: grid;
  grid-template-columns: minmax(170px, 1.4fr) minmax(140px, 1fr) minmax(120px, 1fr) minmax(120px, 1fr) 110px;
  align-items: center; gap: 16px; padding: 14px 18px; cursor: pointer;
  border-bottom: 1px solid var(--border);
  list-style: none;
}
.aws-config-bucket summary::-webkit-details-marker { display: none; }
.aws-config-title { color: var(--accent); font-weight: 700; font-family: var(--font-mono); }
/* 客户账号行：账号 · Account ID · Owner · 付款方式 · 充值/押金 · 预付款余额 · Status · More */
.aws-config-account-head, .aws-config-account-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.35fr) minmax(120px, 1fr) minmax(90px, 0.8fr) minmax(92px, 0.78fr) minmax(96px, 0.82fr) minmax(96px, 0.82fr) minmax(92px, 0.74fr) minmax(108px, 0.86fr) minmax(80px, 0.68fr) 90px;
  align-items: center; gap: 12px; padding: 12px 18px;
}
.aws-config-account-head { color: var(--text-tertiary); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; background: var(--surface-2); }
.aws-config-account-row { border-top: 1px solid var(--border); }
.aws-config-account-row:hover { background: var(--accent-soft); }

/* 单元格：默认左对齐；加 aws-config-center 居中 */
.aws-config-cell { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 2px; min-width: 0; line-height: 1.4; }
.aws-config-center { align-items: center; text-align: center; }
.aws-config-center .aws-config-sub { padding-left: 0; }
/* 固定付款方式（Payer 对 AWS 月结后付，不可编辑） */
.aws-config-fixed { color: var(--text-secondary); font-size: 12px; font-weight: 600; white-space: nowrap; }
.aws-config-cell .record-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aws-config-cell .chip { align-self: flex-start; max-width: 100%; }
.aws-config-center .chip { align-self: center; justify-content: center; }
/* sub-label 与上方输入框文字左对齐（输入框文字内缩 10px） */
.aws-config-sub { color: var(--text-tertiary); font-size: 11px; font-family: var(--font-mono); padding-left: 10px; }

/* 行内可编辑输入：默认低调，聚焦/悬停时显边框，看得出可改。宽度收敛，文字与列头对齐 */
.aws-config-inline {
  width: 100%; max-width: 200px; min-height: 32px; padding: 4px 10px;
  border: 1px solid transparent; border-radius: var(--radius-xs);
  background-color: transparent; color: var(--text); font-size: 13px;
  transition: border-color var(--transition), background var(--transition);
}
.aws-config-inline:hover { border-color: var(--border); background-color: var(--surface-1); }
.aws-config-inline:focus { outline: none; border-color: var(--accent); background-color: var(--surface-0); box-shadow: 0 0 0 3px var(--accent-soft); }
select.aws-config-inline { cursor: pointer; padding-right: 28px; }
.aws-config-amount { font-variant-numeric: tabular-nums; }
/* 短输入：Owner / 付款方式 / 充值押金等收敛宽度并居中，避免一长条铺满列 */
.aws-config-inline-sm { max-width: 124px; padding: 4px 8px; text-align: center; }
.aws-config-inline-xs { max-width: 92px; padding: 4px 8px; text-align: center; }
select.aws-config-inline-sm { padding-right: 26px; text-align: left; text-align-last: center; }
.aws-config-center .aws-config-inline { margin: 0 auto; }
.aws-config-no-config {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 26px; padding: 2px 9px; border: 1px solid var(--border);
  border-radius: var(--radius-xs); color: var(--text-tertiary);
  background: var(--surface-1); font-size: 12px; font-weight: 700;
  white-space: nowrap;
}
.aws-config-account-row.is-no-customer-config { background: rgba(148, 163, 184, 0.04); }

/* Action 列：整体居中，按钮文字居中、内边距均匀 */
.aws-config-action { align-items: center; justify-content: center; }
.aws-config-account-head .aws-config-action { text-align: center; }
.aws-config-action .ghost-button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 100%; max-width: 110px; min-height: 34px; padding: 0 12px; text-align: center;
  font-family: var(--font-mono); font-size: 12px; white-space: nowrap;
}

/* ── AWS 主页预警条 ───────────────────────────────────────────────── */
.aws-alert-banner { display: grid; gap: 10px; margin-bottom: 20px; }
.aws-alert-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 2px;
}
.aws-alert-head-title {
  font-family: var(--font-heading); font-size: 13px; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-secondary);
}
.aws-alert-head-count {
  font-family: var(--font-mono); font-size: 12px; font-weight: 600;
  padding: 2px 10px; border-radius: 999px;
}
.aws-alert-head-count.danger { color: var(--danger); background: var(--danger-soft); }
.aws-alert-head-count.warning { color: var(--accent); background: var(--accent-soft); }
.aws-alert {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 14px 18px; border-radius: var(--radius-md); text-align: left;
  border: 1px solid var(--border); background: var(--surface-1);
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.aws-alert:hover { transform: translateY(-1px); }
.aws-alert-icon {
  display: grid; place-items: center; width: 38px; height: 38px; flex-shrink: 0;
  border-radius: var(--radius-sm); font-size: 18px;
}
.aws-alert-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.aws-alert-body strong { font-family: var(--font-heading); font-size: 14px; }
.aws-alert-body small { color: var(--text-secondary); font-size: 12px; font-family: var(--font-mono); }
.aws-alert-danger { border-color: rgba(244, 63, 94, 0.4); box-shadow: inset 3px 0 0 var(--danger); }
.aws-alert-danger:hover { box-shadow: inset 3px 0 0 var(--danger), 0 0 24px -8px rgba(244, 63, 94, 0.4); }
.aws-alert-danger .aws-alert-icon { color: var(--danger); background: var(--danger-soft); }
.aws-alert-warning { border-color: var(--border-active); box-shadow: inset 3px 0 0 var(--accent); }
.aws-alert-warning:hover { box-shadow: inset 3px 0 0 var(--accent), var(--glow-card); }
.aws-alert-warning .aws-alert-icon { color: var(--accent); background: var(--accent-soft); }
.aws-alert-optimization { border-color: rgba(16, 185, 129, 0.28); box-shadow: inset 3px 0 0 var(--accent-3); }
.aws-alert-optimization:hover { box-shadow: inset 3px 0 0 var(--accent-3), 0 0 20px -10px rgba(16, 185, 129, 0.35); }
.aws-alert-optimization .aws-alert-icon { color: var(--accent-3); background: rgba(16, 185, 129, 0.12); }

/* 表单字段提示 */
.field-hint { color: var(--text-tertiary); font-size: 11px; font-family: var(--font-mono); margin-top: 2px; }
.field input[readonly], .field textarea[readonly], .field select[disabled] {
  opacity: 0.6; cursor: not-allowed; background: var(--surface-2);
}

/* ── 空状态 ───────────────────────────────────────────────────────── */
.empty-state { display: none; padding: 56px 18px; text-align: center; }
.empty-state h3 { margin: 0 0 8px; }
.empty-state p { margin: 0; color: var(--text-secondary); }

/* ── 弹窗 ─────────────────────────────────────────────────────────── */
dialog {
  width: min(880px, calc(100vw - 32px));
  border: 1px solid var(--glass-border); border-radius: var(--radius-xl); padding: 0;
  color: var(--text); background: rgba(12, 16, 32, 0.98);
  box-shadow: var(--shadow-lg);
}
dialog::backdrop { background: rgba(5, 8, 16, 0.6); backdrop-filter: blur(6px); }
#recordForm { padding: 20px; }
#payerForm { padding: 20px; }
.payer-hint { margin: -4px 0 14px; color: var(--text-tertiary); font-size: 12px; line-height: 1.5; }
.payer-foot-hint { margin: 14px 0 0; padding: 10px 12px; border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius-xs); color: var(--text-secondary); font-size: 12px; line-height: 1.55; background: var(--surface-1); }
.payer-message { min-height: 18px; margin: 12px 0 0; color: var(--accent); font-size: 13px; }
.dialog-head, .dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog-head { margin-bottom: 18px; }
.dialog-head h3 { font-size: 20px; font-weight: 700; }
.dialog-actions { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.dialog-actions > div { display: flex; gap: 8px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; max-height: min(64vh, 680px); overflow: auto; padding-right: 4px; }
.field { display: grid; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { color: var(--text-secondary); font-size: 12px; font-weight: 500; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 38px; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); outline: 0;
  color: var(--text); background: var(--surface-0); font-size: 13px;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field textarea { min-height: 88px; resize: vertical; }
#deleteBtn { color: var(--danger); }

/* ── AI 助手 ──────────────────────────────────────────────────────── */

.ai-assistant-shell { position: fixed; right: 20px; bottom: 20px; z-index: 20; width: min(380px, calc(100vw - 32px)); max-width: calc(100vw - 24px); max-height: calc(100vh - 24px); }
.ai-assistant-toggle {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 44px; margin-left: auto; padding: 10px 14px;
  border: 1px solid var(--glass-border); border-radius: var(--radius-sm);
  color: var(--text); background: var(--glass); backdrop-filter: blur(16px);
  box-shadow: var(--shadow-md);
}
.ai-assistant-toggle span { display: grid; place-items: center; width: 26px; height: 26px; border-radius: var(--radius-xs); color: #FFFFFF; background: var(--grad-fire); font-weight: 800; font-size: 12px; }
.ai-assistant-toggle.has-pending { border-color: var(--border-active); box-shadow: var(--glow-sm); }
.ai-assistant-panel {
  position: relative; display: flex; flex-direction: column;
  width: 100%; height: 100%; min-width: 320px; min-height: 360px; overflow: hidden;
  border: 1px solid var(--glass-border); border-radius: var(--radius-md);
  background: rgba(12, 16, 32, 0.98); box-shadow: var(--shadow-lg);
}
.ai-assistant-head, .ai-compose-row, .ai-preview-title, .ai-preview-actions, .ai-memory-search, .ai-head-actions { display: flex; align-items: center; }
.ai-assistant-head { justify-content: space-between; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); cursor: grab; user-select: none; }
.ai-assistant-head:active { cursor: grabbing; }
.ai-assistant-head div:first-child, .ai-memory-search { display: grid; gap: 3px; }
.ai-assistant-head span, .ai-preview-title span, .ai-used-memory p, .ai-memory-item span, .ai-config-hint { color: var(--text-tertiary); font-size: 11px; }
.ai-head-actions { gap: 6px; flex: 0 0 auto; }
.ai-assistant-body { display: grid; flex: 1 1 auto; gap: 10px; min-height: 120px; overflow: auto; padding: 12px; align-content: start; }
.ai-message { max-width: 88%; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); background: var(--surface-1); font-size: 13px; line-height: 1.5; }
.ai-message.user { justify-self: end; border-color: var(--border-active); background: var(--accent-soft); }
.ai-used-memory, .ai-preview, .ai-memory-panel { display: grid; gap: 9px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-0); }
.ai-used-memory p { margin: 0; }
.ai-preview-title { justify-content: space-between; gap: 12px; }
.ai-preview-title strong { color: var(--accent-2); }
.ai-preview-list, .ai-memory-list { display: grid; gap: 8px; }
.ai-preview-row, .ai-memory-item { display: grid; gap: 4px; padding: 9px 10px; border: 1px solid var(--border); border-radius: var(--radius-xs); background: var(--surface-1); }
.ai-preview-row span { color: var(--text-tertiary); font-size: 11px; }
.ai-preview-row strong, .ai-memory-item strong { overflow-wrap: anywhere; font-size: 13px; }
.ai-preview-notes { display: grid; gap: 5px; margin: 0; padding-left: 18px; color: var(--text-tertiary); font-size: 11px; }
.ai-preview-actions { justify-content: flex-end; gap: 8px; }
.ai-memory-search { grid-template-columns: 1fr; }
.ai-memory-search input { min-height: 32px; border: 1px solid var(--border); border-radius: var(--radius-xs); padding: 6px 10px; color: var(--text); background: var(--surface-0); }
.ai-assistant-compose { display: grid; gap: 8px; padding: 10px; border-top: 1px solid var(--border); }
.ai-attachment-list { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-attachment-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 8px; border: 1px solid var(--border); border-radius: var(--radius-xs); color: var(--text); background: var(--accent-soft); font-size: 11px; }
.ai-attachment-chip button { border: 0; color: var(--text-tertiary); background: transparent; }
.ai-compose-row { gap: 8px; }
.ai-resize-handle { position: absolute; right: 4px; bottom: 4px; width: 16px; height: 16px; cursor: nwse-resize; }
.ai-resize-handle::after { content: ""; position: absolute; right: 3px; bottom: 3px; width: 8px; height: 8px; border-right: 2px solid rgba(56, 217, 255, 0.4); border-bottom: 2px solid rgba(56, 217, 255, 0.4); }
.ai-upload-button { flex: 0 0 auto; }
.ai-upload-button input { display: none; }
.ai-compose-row textarea { min-width: 0; flex: 1; min-height: 40px; max-height: 96px; resize: vertical; border: 1px solid var(--border); border-radius: var(--radius-xs); padding: 8px 10px; color: var(--text); background: var(--surface-0); line-height: 1.4; }
.ai-config-dialog { width: min(560px, calc(100vw - 24px)); max-width: 560px; border-radius: var(--radius-lg); }
#aiConfigForm { padding: 16px; }
.ai-config-dialog .dialog-head { margin-bottom: 14px; }
.ai-config-dialog .dialog-head h3 { margin-top: 2px; font-size: 20px; }
.ai-config-dialog .form-grid { grid-template-columns: 1fr; max-height: min(58vh, 520px); gap: 10px; }
.ai-config-dialog .field input { min-height: 36px; }
.ai-config-dialog .dialog-actions { margin-top: 14px; padding-top: 12px; }

/* ── File Bridge ──────────────────────────────────────────────────── */
.file-bridge-panel {
  position: fixed; left: 50%; top: 16px; z-index: 30;
  display: grid; grid-template-columns: auto auto auto; align-items: center; gap: 10px;
  max-width: min(700px, calc(100vw - 32px)); padding: 10px 14px;
  border: 1px solid rgba(52, 211, 153, 0.3); border-radius: var(--radius-sm);
  color: var(--text); background: rgba(12, 16, 32, 0.97); box-shadow: var(--shadow-md);
  transform: translateX(-50%);
}
.file-bridge-panel span, .file-bridge-panel em { color: var(--text-secondary); font-size: 12px; font-style: normal; }

/* ═══════════════════════════════════════════════════════════════════
   白天模式
   ═══════════════════════════════════════════════════════════════════ */
html[data-theme="day"] {
  color-scheme: light;
  --bg: #f4f1ec;                                /* warm light paper */
  --surface-0: #ffffff;
  --surface-1: #ffffff;
  --surface-2: #faf7f2;
  --glass: #ffffff;
  --glass-border: #e8e2d8;
  --text: #1a1407;
  --text-secondary: #6b6052;
  --text-tertiary: #9a8d79;
  --border: #ebe5db;
  --border-active: rgba(234, 88, 12, 0.5);
  --accent: #d9740a;                             /* darker Bitcoin orange for AA contrast on light */
  --accent-soft: rgba(247, 147, 26, 0.12);
  --accent-2: #c2410c;                           /* burnt orange */
  --accent-2-soft: rgba(234, 88, 12, 0.12);
  --accent-3: #b45309;                           /* deep gold/amber for text contrast */
  --accent-3-soft: rgba(255, 214, 0, 0.16);
  --warning: #b45309;
  --warning-soft: rgba(255, 214, 0, 0.18);
  --danger: #d4304f;
  --danger-soft: rgba(212, 48, 79, 0.1);
  --grad-fire: linear-gradient(135deg, #EA580C, #F7931A);
  --grad-gold: linear-gradient(135deg, #EA580C, #d9740a);
  --glow-sm: 0 4px 16px rgba(234, 88, 12, 0.2);
  --glow-md: 0 6px 24px rgba(247, 147, 26, 0.28);
  --glow-card: 0 8px 28px -8px rgba(247, 147, 26, 0.25);
  --shadow-sm: 0 1px 3px rgba(60, 40, 10, 0.06);
  --shadow-md: 0 6px 20px rgba(60, 40, 10, 0.08);
  --shadow-lg: 0 18px 50px rgba(60, 40, 10, 0.14);
}

html[data-theme="night"] {
  color-scheme: dark;
  --bg: #030304;                                /* True Void */
  --surface-0: rgba(15, 17, 21, 0.6);
  --surface-1: #0F1115;                          /* Dark Matter */
  --surface-2: #14171d;
  --glass: rgba(15, 17, 21, 0.5);
  --glass-border: rgba(255, 255, 255, 0.1);
  --text: #FFFFFF;
  --text-secondary: #94A3B8;
  --text-tertiary: #5b6779;
  --border: rgba(255, 255, 255, 0.1);
  --border-active: rgba(247, 147, 26, 0.5);
  --accent: #F7931A;                             /* Bitcoin Orange */
  --accent-soft: rgba(247, 147, 26, 0.12);
  --accent-2: #EA580C;                           /* Burnt Orange */
  --accent-2-soft: rgba(234, 88, 12, 0.12);
  --accent-3: #FFD600;                           /* Digital Gold */
  --accent-3-soft: rgba(255, 214, 0, 0.12);
  --warning: #FFD600;
  --warning-soft: rgba(255, 214, 0, 0.12);
  --danger: #f43f5e;
  --danger-soft: rgba(244, 63, 94, 0.12);
  --grad-fire: linear-gradient(135deg, #EA580C, #F7931A);
  --grad-gold: linear-gradient(135deg, #F7931A, #FFD600);
  --glow-sm: 0 0 20px -5px rgba(234, 88, 12, 0.5);
  --glow-md: 0 0 30px -5px rgba(247, 147, 26, 0.6);
  --glow-card: 0 0 40px -12px rgba(247, 147, 26, 0.22);
  --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 40px -20px rgba(247, 147, 26, 0.25);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.6), 0 0 60px -24px rgba(247, 147, 26, 0.3);
}

html[data-theme="day"] body { background: var(--bg); }
html[data-theme="day"] body::before { background: radial-gradient(ellipse at 18% 0%, rgba(247, 147, 26, 0.08), transparent 55%), radial-gradient(ellipse at 85% 100%, rgba(234, 88, 12, 0.05), transparent 55%); }
html[data-theme="day"] body::after { background-image: linear-gradient(to right, rgba(120, 90, 40, 0.05) 1px, transparent 1px), linear-gradient(to bottom, rgba(120, 90, 40, 0.05) 1px, transparent 1px); mask-image: radial-gradient(circle at 50% 30%, black 30%, transparent 90%); -webkit-mask-image: radial-gradient(circle at 50% 30%, black 30%, transparent 90%); }
html[data-theme="night"] body::before { background: radial-gradient(ellipse 70% 55% at 12% 0%, rgba(247, 147, 26, 0.10), transparent 70%), radial-gradient(ellipse 55% 45% at 88% 8%, rgba(234, 88, 12, 0.08), transparent 70%), radial-gradient(ellipse 60% 50% at 50% 105%, rgba(255, 214, 0, 0.05), transparent 70%); }

/* 白天模式：去掉毛玻璃模糊，用纯色卡片提升可读性 */
html[data-theme="day"] .dash-card,
html[data-theme="day"] .metric,
html[data-theme="day"] .today-board,
html[data-theme="day"] .bucket-overview,
html[data-theme="day"] .smart-entry,
html[data-theme="day"] .aws-sync-panel,
html[data-theme="day"] .content-panel,
html[data-theme="day"] .ai-assistant-toggle,
html[data-theme="day"] .ai-assistant-panel {
  backdrop-filter: none;
  background: var(--surface-1);
  border-color: var(--glass-border);
}
html[data-theme="day"] .dash-card-welcome { background: linear-gradient(135deg, #ffffff, #fdf2e3); }

html[data-theme="day"] .sidebar {
  background: #ffffff;
  border-right: 1px solid var(--glass-border);
}
html[data-theme="day"] .sidebar::after { background: none; }
html[data-theme="day"] .brand-mark { background: var(--grad-fire); box-shadow: 0 4px 12px rgba(234, 88, 12, 0.22); }
html[data-theme="day"] .nav button { color: var(--text-secondary); }
html[data-theme="day"] .nav button .nav-icon { background: var(--surface-2); color: var(--text-secondary); }
html[data-theme="day"] .nav button:hover { color: var(--accent); background: var(--accent-soft); }
html[data-theme="day"] .nav button.active { color: var(--accent); background: var(--accent-soft); border-color: var(--border-active); }
html[data-theme="day"] .nav button.active .nav-icon { background: var(--accent); color: #ffffff; }
html[data-theme="day"] .storage-panel,
html[data-theme="day"] .model-status-panel { background: var(--surface-2); }
html[data-theme="day"] .storage-status-dialog,
html[data-theme="day"] .storage-status-current,
html[data-theme="day"] .storage-status-event { background: #ffffff; }
html[data-theme="day"] .storage-status-current,
html[data-theme="day"] .storage-status-event { border-color: var(--glass-border); }

html[data-theme="day"] .primary-button { color: #ffffff; background: var(--grad-fire); box-shadow: 0 4px 16px rgba(234, 88, 12, 0.2); }
html[data-theme="day"] .ghost-button,
html[data-theme="day"] .icon-button { background: var(--surface-1); border-color: var(--glass-border); }
html[data-theme="day"] .ghost-button:hover,
html[data-theme="day"] .icon-button:hover { background: var(--accent-soft); border-color: var(--border-active); }

html[data-theme="day"] th { background: var(--surface-2); color: var(--text-secondary); }
html[data-theme="day"] .panel-head,
html[data-theme="day"] .module-tabs { background: var(--surface-2); }
html[data-theme="day"] .panel-head select { background-color: var(--surface-1); }
html[data-theme="day"] .task-column,
html[data-theme="day"] .upcoming-list { background: var(--surface-2); }
html[data-theme="day"] .task-card { background: var(--surface-1); }
html[data-theme="day"] .module-tabs button.active { background: var(--surface-1); }
html[data-theme="day"] .field input,
html[data-theme="day"] .field select,
html[data-theme="day"] .field textarea,
html[data-theme="day"] .smart-entry textarea,
html[data-theme="day"] .status-select { background-color: var(--surface-1); }
html[data-theme="day"] tbody tr:hover { background: var(--accent-soft); }
html[data-theme="day"] dialog { background: #ffffff; }
html[data-theme="day"] dialog::backdrop { background: rgba(40, 26, 8, 0.28); backdrop-filter: blur(3px); }
html[data-theme="day"] .ai-message { background: var(--surface-2); }
html[data-theme="day"] .ai-message.user { background: var(--accent-3-soft); }

/* ── 汇率面板 ─────────────────────────────────────────────────────── */
.rate-panel { padding: 0 16px; }
.rate-details { margin-bottom: 14px; }
.rate-details summary { cursor: pointer; font-size: 12px; color: var(--text-secondary); padding: 8px 0; }
.rate-details summary:hover { color: var(--text); }
.rate-grid { display: flex; flex-wrap: wrap; gap: 12px; padding: 12px 0; align-items: center; }
.rate-input-label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); }
.rate-input { width: 72px; padding: 4px 8px; border: 1px solid var(--border); border-radius: var(--radius-xs); background: var(--surface-0); color: var(--text); font-size: 12px; }
.mini-table { border-collapse: collapse; width: 100%; }
.mini-table th, .mini-table td { border: 1px solid var(--border); padding: 3px 6px; text-align: center; font-size: 11px; }
.mini-table th { background: var(--surface-0); font-weight: 600; }

.customer-sync-panel {
  margin: 0 16px 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 12px;
}
.customer-sync-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.customer-sync-head h3 { margin: 2px 0 0; font-size: 16px; }
.customer-sync-head span { color: var(--text-secondary); font-size: 12px; white-space: nowrap; }
.customer-sync-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.customer-sync-stats div {
  padding: 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--surface-muted);
}
.customer-sync-stats b {
  display: block;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 22px;
}
.customer-sync-stats span { color: var(--text-tertiary); font-size: 11px; }
.customer-sync-list { display: grid; gap: 6px; }
.customer-sync-item {
  display: grid;
  grid-template-columns: 72px minmax(140px, 1fr) minmax(180px, 1.6fr);
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--surface-soft);
}
.customer-sync-item span { color: var(--warning); font-size: 12px; font-weight: 700; }
.customer-sync-item strong { color: var(--text); font-size: 13px; }
.customer-sync-item em { color: var(--text-tertiary); font-size: 12px; font-style: normal; }
.customer-sync-ok { margin: 0; color: var(--text-tertiary); font-size: 13px; }

/* ═══════════════════════════════════════════════════════════════════
   流程文档 / 知识库（文章式视图）
   ═══════════════════════════════════════════════════════════════════ */
.docs-panel {
  height: calc(100vh - 160px); min-height: 480px; overflow: hidden;
}
.docs-panel[hidden] { display: none; }

.docs-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 18px;
  height: 100%;
  min-height: 0;
}

/* 左侧目录 */
.docs-sidebar {
  display: flex; flex-direction: column; gap: 14px;
  min-height: 0;
  padding: 18px;
  border: 1px solid var(--glass-border); border-radius: var(--radius-lg);
  background: var(--glass); backdrop-filter: blur(12px);
}
html[data-theme="day"] .docs-sidebar { backdrop-filter: none; background: var(--surface-1); }
.docs-sidebar-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.docs-sidebar-head h3 { margin: 2px 0 0; font-size: 18px; }
.docs-new-btn { min-height: 36px; padding: 0 14px; font-size: 13px; white-space: nowrap; }

.docs-search {
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px; min-height: 40px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-0); color: var(--text-secondary);
}
.docs-search span { font-size: 15px; }
.docs-search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); outline: none; }

.docs-list { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; padding-right: 4px; min-height: 0; scrollbar-width: thin; scrollbar-color: rgba(247, 147, 26, 0.3) transparent; }
.docs-list-empty { margin: 8px 0; color: var(--text-secondary); font-size: 13px; }
.docs-list-item {
  display: grid; gap: 6px; width: 100%; text-align: left;
  padding: 12px 14px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: var(--surface-0); color: var(--text);
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
}
.docs-list-item:hover { border-color: var(--border-active); background: var(--accent-soft); transform: translateX(2px); }
.docs-list-item.active { border-color: var(--border-active); background: var(--accent-soft); box-shadow: var(--glow-card); }
.docs-list-title { font-weight: 600; font-size: 14px; line-height: 1.35; }
.docs-list-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.docs-list-type { font-size: 11px; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-family: var(--font-mono); }
.docs-list-version { font-size: 11px; color: var(--text-tertiary); font-family: var(--font-mono); }
.docs-list-date { font-size: 11px; color: var(--text-tertiary); font-family: var(--font-mono); }

/* 右侧阅读区 */
.docs-reader {
  min-height: 0; overflow-y: auto;
  border: 1px solid var(--glass-border); border-radius: var(--radius-lg);
  background: var(--glass); backdrop-filter: blur(12px);
  scrollbar-width: thin; scrollbar-color: rgba(247, 147, 26, 0.3) transparent;
}
html[data-theme="day"] .docs-reader { backdrop-filter: none; background: var(--surface-1); }

.docs-flash {
  margin: 16px 16px 0; padding: 10px 14px;
  border: 1px solid var(--border-active); border-radius: var(--radius-sm);
  background: var(--accent-soft); color: var(--accent); font-size: 13px;
}

.docs-blank { padding: 80px 32px; text-align: center; color: var(--text-secondary); }
.docs-blank h3 { margin: 0 0 8px; color: var(--text); }

/* 文章排版 */
.doc-article { max-width: 820px; margin: 0 auto; padding: 40px 48px 56px; }
.doc-article-head { padding-bottom: 22px; margin-bottom: 28px; border-bottom: 1px solid var(--border); }
.doc-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.doc-tag { display: inline-flex; align-items: center; min-height: 22px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-0); color: var(--text-secondary); font-size: 12px; font-family: var(--font-mono); }
.doc-article-title { margin: 0 0 16px; font-size: 32px; line-height: 1.2; }
.doc-article-meta { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; color: var(--text-secondary); font-size: 13px; font-family: var(--font-mono); }
.doc-version-pill { display: inline-flex; align-items: center; padding: 2px 12px; border-radius: 999px; background: var(--grad-fire); color: #fff; font-weight: 600; font-family: var(--font-mono); letter-spacing: 0.02em; }
.doc-version-pill.small { padding: 1px 9px; font-size: 11px; }
.doc-article-actions { display: flex; gap: 10px; margin-top: 18px; }
.doc-article-actions .ghost-button { min-height: 36px; }
.ghost-button.danger { color: var(--danger); }
.ghost-button.danger:hover { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }

.doc-section { margin-bottom: 30px; }
.doc-section-title { position: relative; margin: 0 0 14px; padding-left: 14px; font-size: 19px; }
.doc-section-title::before { content: ""; position: absolute; left: 0; top: 4px; bottom: 4px; width: 4px; border-radius: 4px; background: var(--grad-fire); }
.doc-section-risk .doc-section-title::before { background: var(--danger); }
.doc-section-faq .doc-section-title::before { background: var(--warning); }
.doc-section-body { color: var(--text); font-size: 15px; line-height: 1.75; }
.doc-empty-body { color: var(--text-secondary); font-style: italic; }

.doc-paragraph { margin: 0 0 14px; }
.doc-subhead { margin: 22px 0 10px; font-size: 16px; color: var(--accent); font-family: var(--font-heading); }
.doc-ol, .doc-ul { margin: 0 0 14px; padding-left: 24px; display: grid; gap: 6px; }
.doc-ol li, .doc-ul li { line-height: 1.7; }
.doc-code {
  margin: 0 0 16px; padding: 16px 18px; overflow-x: auto;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text);
  font-family: var(--font-mono); font-size: 13px; line-height: 1.6;
  white-space: pre; tab-size: 2;
}
html[data-theme="day"] .doc-code { background: #2b2417; color: #f6ede0; border-color: #46402f; }

/* 修改记录 */
.doc-changelog { margin-top: 36px; padding-top: 22px; border-top: 1px solid var(--border); }
.doc-changelog-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
  padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-0); color: var(--text); font-size: 14px; font-weight: 600;
}
.doc-changelog-toggle:hover { border-color: var(--border-active); }
.doc-changelog-caret { font-size: 12px; font-weight: 500; color: var(--text-secondary); font-family: var(--font-mono); }
.doc-changelog-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 14px; }
.doc-changelog-item { padding: 14px 16px; border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius-sm); background: var(--surface-0); }
.doc-changelog-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.doc-changelog-time { font-size: 12px; color: var(--text-secondary); font-family: var(--font-mono); }
.doc-changelog-author { font-size: 12px; color: var(--text); font-weight: 600; }
.doc-changelog-note { margin: 0; font-size: 13px; color: var(--text); }
.doc-changelog-fields { margin: 6px 0 0; font-size: 12px; color: var(--text-tertiary); font-family: var(--font-mono); }

/* 编辑表单 */
.doc-editor { max-width: 820px; margin: 0 auto; padding: 32px 48px 48px; }
.doc-editor-head { margin-bottom: 22px; }
.doc-editor-head h2 { margin: 0 0 6px; font-size: 24px; }
.doc-editor-hint { margin: 0; color: var(--text-secondary); font-size: 13px; }
.doc-editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.doc-editor-field { display: grid; gap: 6px; }
.doc-editor-field.full { grid-column: 1 / -1; }
.doc-editor-field label { font-size: 12px; color: var(--text-secondary); font-weight: 600; }
.doc-editor-field input,
.doc-editor-field select,
.doc-editor-field textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-0); color: var(--text); font-size: 14px;
  transition: border-color var(--transition);
}
.doc-editor-field textarea { resize: vertical; line-height: 1.6; font-family: var(--font-body); }
.doc-editor-field input:focus,
.doc-editor-field select:focus,
.doc-editor-field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.doc-editor-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }
.doc-editor-actions .primary-button,
.doc-editor-actions .ghost-button { min-height: 42px; }

/* ── 响应式 ───────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  /* 移动端：侧栏展开时以浮层覆盖主内容，避免挤压工作区。 */
  .sidebar { box-shadow: var(--shadow-lg); }
  .workspace { margin-left: var(--sidebar-width); padding: 16px; }
  .app-shell:not(.is-collapsed) .workspace { margin-left: var(--sidebar-width); }
  .metric-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .today-overview { grid-template-columns: 1fr; align-items: stretch; }
  .cost-module-grid { grid-template-columns: 1fr; }
  .today-overview-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .executive-summary { padding: 16px; }
  .executive-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .priority-task-grid { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
  .dash-card-welcome { grid-column: 1 / -1; }
  .dash-card-ring { grid-column: 1; }
  .dash-card-billing { grid-column: 2; grid-row: auto; }
  .docs-layout { grid-template-columns: 1fr; height: auto; }
  .docs-panel { height: auto; overflow: visible; }
  .docs-sidebar { max-height: 320px; }
  .doc-article, .doc-editor { padding: 24px 20px 36px; }
  .doc-article-title { font-size: 26px; }
  .doc-editor-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .topbar, .panel-head, .smart-entry-head, .smart-entry-actions, .dialog-actions { flex-direction: column; align-items: stretch; }
  .toolbar, .dialog-actions > div { width: 100%; }
  .primary-button, .ghost-button { flex: 1; }
  .metric-strip, .form-grid { grid-template-columns: 1fr; }
  .cost-module-metrics { grid-template-columns: 1fr; }
  .today-overview-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .executive-metrics { grid-template-columns: 1fr; }
  .customer-sync-head { display: grid; }
  .customer-sync-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .customer-sync-item { grid-template-columns: 1fr; gap: 4px; }
  .executive-bars { grid-template-columns: repeat(3, minmax(56px, 1fr)); }
  .bucket-card-grid { grid-template-columns: 1fr; }
  .bucket-card-kpis { grid-template-columns: 1fr 1fr; }
  .aws-sync-panel, .aws-sync-stage-list { grid-template-columns: 1fr; }
  .task-card { flex-direction: column; }
  .task-card-side { flex-direction: row; align-items: center; min-width: 0; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .dash-card-welcome, .dash-card-ring, .dash-card-billing { grid-column: auto; grid-row: auto; }
  .dash-card-welcome { flex-direction: column; align-items: flex-start; }
}

.admin-alert-card { display: grid; gap: 12px; }
.admin-alert-head h3 { font-size: 18px; }
.alert-source-pill {
  padding: 5px 9px; border: 1px solid var(--border); border-radius: 999px;
  color: var(--text-tertiary); background: var(--surface-1); font-size: 11px; font-weight: 700;
  white-space: nowrap;
}
.alert-settings-grid {
  display: grid; grid-template-columns: minmax(150px, 1fr) minmax(100px, 0.65fr) minmax(150px, 1fr);
  gap: 10px;
}
.alert-settings-grid label,
.alert-recipient-field {
  display: grid; gap: 6px; min-width: 0; color: var(--text-secondary); font-size: 12px; font-weight: 700;
}
.alert-settings-grid input[type="time"],
.alert-settings-grid input[type="text"],
.alert-recipient-input {
  width: 100%; border: 1px solid var(--border); border-radius: var(--radius-xs);
  color: var(--text); background: var(--surface-1); font-size: 13px;
}
.alert-settings-grid input[type="time"],
.alert-settings-grid input[type="text"] { min-height: 38px; padding: 0 10px; }
.alert-recipient-input { min-height: 38px; padding: 0 10px; }
.alert-settings-grid input:focus,
.alert-recipient-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.alert-recipient-module {
  display: grid; gap: 10px; padding: 10px;
  border: 1px solid var(--border); border-radius: var(--radius-xs); background: var(--surface-1);
}
.alert-recipient-list {
  display: flex; flex-wrap: wrap; gap: 8px; min-height: 30px; align-items: center;
}
.alert-recipient-chip {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%;
  min-height: 30px; padding: 3px 5px 3px 10px;
  border: 1px solid var(--border-active); border-radius: 999px;
  color: var(--text); background: var(--accent-soft); font-size: 12px; font-weight: 700;
}
.alert-recipient-chip span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alert-recipient-chip button {
  display: grid; place-items: center; width: 22px; height: 22px; flex: 0 0 auto;
  border: 1px solid transparent; border-radius: 50%;
  color: var(--accent); background: var(--surface-0); font-size: 16px; line-height: 1;
}
.alert-recipient-chip button:hover { border-color: var(--border-active); background: var(--surface-1); }
.alert-recipient-empty { color: var(--text-tertiary); font-size: 12px; font-weight: 600; }
.alert-recipient-add {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center;
}
.alert-recipient-add .ghost-button { min-height: 38px; white-space: nowrap; }
.alert-toggle-row {
  grid-template-columns: auto 1fr; align-items: center; align-content: center;
  min-height: 38px; padding: 0 10px; border: 1px solid var(--border);
  border-radius: var(--radius-xs); background: var(--surface-1);
}
.alert-toggle-row input { width: 16px; height: 16px; accent-color: var(--accent); }
.alert-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.alert-actions .primary-button,
.alert-actions .ghost-button { min-height: 38px; }
.alert-message { display: block; margin: 0; }
@media (max-width: 1380px) {
  .admin-dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 1180px) {
  .admin-dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .alert-settings-grid { grid-template-columns: 1fr; }
  .alert-recipient-add { grid-template-columns: 1fr; }
}

/* ── 响应式补充 (R16)：13"~15" 笔电 / 平板 / 小屏的中间档位 ──────── */
/* 1280px 以下：宽表与 AWS Config Tree 不再硬撑出横向滚动条。 */
@media (max-width: 1280px) {
  table { min-width: 100%; }
  .aws-config-tree { min-width: 0; }
  .aws-config-bucket summary {
    grid-template-columns: minmax(140px, 1.4fr) minmax(120px, 1fr) minmax(100px, 1fr) minmax(100px, 1fr) 90px;
    gap: 12px; padding: 12px 14px;
  }
  .aws-config-account-head, .aws-config-account-row {
    grid-template-columns: minmax(130px, 1.3fr) minmax(110px, 1fr) minmax(80px, 0.76fr) minmax(82px, 0.72fr) minmax(86px, 0.78fr) minmax(86px, 0.78fr) minmax(82px, 0.72fr) minmax(96px, 0.86fr) minmax(72px, 0.66fr) 84px;
    gap: 10px; padding: 10px 14px;
  }
}

/* ~1180px：管理员看板与首页指标条进入两列布局，告警面板收紧。 */
@media (max-width: 1180px) {
  .executive-summary { grid-template-columns: 1fr; }
  .executive-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash-card-welcome { grid-column: 1 / -1; grid-row: auto; }
  .dash-card-ring { grid-column: 1; grid-row: auto; }
  .dash-card-billing { grid-column: 2 / 4; grid-row: auto; }
  .metric-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ~960px：进入两列布局，AWS Sync 面板按上下堆叠。 */
@media (max-width: 960px) {
  .workspace { padding: 20px 22px; }
  .executive-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-card-billing { grid-column: 1 / -1; }
  .metric-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .priority-task-grid { grid-template-columns: 1fr; }
  .aws-sync-panel {
    grid-template-columns: 1fr; max-width: 100%; padding: 12px;
  }
  .aws-sync-stage-list { grid-template-columns: repeat(5, minmax(56px, 1fr)); }
  .aws-config-bucket summary {
    grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px;
  }
  .aws-config-account-head { display: none; }
  .aws-config-account-row {
    grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px;
  }
  .aws-config-account-row .aws-config-cell { min-width: 0; }
}


/* ── R28：删除二次确认弹窗 ──────────────────────────────────────── */
.confirm-dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0;
  background: var(--surface-1);
  color: var(--text);
  max-width: 480px;
  box-shadow: var(--shadow-lg);
}
.confirm-dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
}
.confirm-form { padding: 22px 24px; display: grid; gap: 12px; }
.confirm-form h3 { margin: 0; font-size: 17px; }
.confirm-form .confirm-message { margin: 0; color: var(--text); font-size: 14px; line-height: 1.6; }
.confirm-form .confirm-impact { margin: 0; color: var(--text-secondary); font-size: 13px; line-height: 1.6; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); }
.confirm-form .confirm-soft-hint { margin: 0; color: var(--text-tertiary); font-size: 12px; }
.confirm-form .confirm-field { display: grid; gap: 6px; font-size: 13px; color: var(--text-secondary); }
.confirm-form .confirm-field input {
  min-height: 36px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-0); color: var(--text); padding: 0 10px;
}
.confirm-form .confirm-error { margin: 0; color: var(--danger); font-size: 12px; }
.confirm-form .confirm-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }
.danger-button {
  min-height: 36px; padding: 0 16px; border-radius: var(--radius-sm);
  background: var(--danger); color: #ffffff; font-weight: 600;
  border: 1px solid var(--danger);
  cursor: pointer;
}
.danger-button:hover { filter: brightness(0.92); }
.danger-button:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── R26：role-map 编辑器 ─────────────────────────────────────── */
.role-map-table th, .role-map-table td { width: auto !important; }
.role-map-table input[type="text"], .role-map-table select {
  width: 100%; min-height: 30px; padding: 4px 8px;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface-0); color: var(--text);
}
.role-map-table .rm-positions {
  display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 12px;
}
.role-map-table .rm-positions label { display: inline-flex; gap: 4px; align-items: center; }
.rm-invite-toggle {
  display: inline-flex; gap: 6px; align-items: center;
  margin-right: 12px; font-size: 13px; color: var(--text-secondary);
}
.role-map-source {
  display: inline-flex; align-items: center; min-height: 22px; padding: 2px 8px;
  border: 1px solid var(--border); border-radius: 999px; color: var(--text-tertiary);
  background: var(--surface-1); font-size: 11px; font-weight: 700;
}
.role-map-source.generated { color: var(--accent); border-color: var(--border-active); background: var(--accent-soft); }
.admin-card-foot { padding: 8px 0; }
.customer-merge-group {
  display: grid; gap: 12px; margin-top: 12px; padding: 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-1);
}
.merge-keep-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  color: var(--text-secondary); font-size: 13px;
}
.merge-keep-row select,
.customer-merge-group select {
  min-height: 32px; padding: 4px 8px; border: 1px solid var(--border);
  border-radius: var(--radius-xs); background: var(--surface-0); color: var(--text);
}

/* ── R21：AWS Account ID 反查行 ─────────────────────────────────── */
.aws-id-row { display: flex; gap: 6px; align-items: center; }
.aws-id-row input { flex: 1; }
.field-hint.hint-ok { color: #10b981; }
.field-hint.hint-warning { color: var(--warning); }
