/* ==========================================================================
   AgentRouter 签到控制台 — 样式
   分区：变量 / 基础 / 布局 / 登录页 / 导航 / 卡片 / 按钮 / 表单 / 徽章标签 /
         统计卡 / 签到区 / 日志面板 / 表格 / 邮件页 / 趋势图 / 历史列表 /
         模态框 / Toast / 加载与空状态 / 响应式
   ========================================================================== */

/* ---------- 一、变量 ---------- */
:root {
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --success: #16a34a;
  --danger: #ef4444;
  --warning: #f59e0b;
  --border: #e2e8f0;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 4px 14px rgba(15, 23, 42, 0.05);
}

/* ---------- 二、基础 ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
a { color: var(--primary); }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 5px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 三、布局 ---------- */
.app-view { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  flex: none;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  color: #e2e8f0;
  position: sticky;
  top: 0;
  height: 100vh;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 28px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar h1 { margin: 0; font-size: 18px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 14px; }

.conn-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #94a3b8;
  transition: background 0.2s, box-shadow 0.2s;
}
.conn-dot.live { background: var(--success); box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.16); }
.conn-dot.error { background: var(--danger); box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.16); }

.page { padding: 24px 28px; max-width: 1280px; width: 100%; margin: 0 auto; }

/* ---------- 四、登录页 ---------- */
.boot-view {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--muted);
  background: linear-gradient(135deg, #0f172a, #1e293b 55%, #0f172a);
}
.boot-view p { margin: 0; font-size: 13px; }

.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #0f172a, #1e293b 55%, #0f172a);
}
.login-card {
  width: min(380px, 94vw);
  background: var(--card);
  border-radius: 18px;
  padding: 34px 30px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
  text-align: center;
  animation: fadeUp 0.3s ease;
}
.login-logo {
  width: 58px;
  height: 58px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #60a5fa, #2563eb 60%, #1d4ed8);
  position: relative;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.4);
}
.login-logo::after {
  content: "";
  position: absolute;
  inset: 11px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-left-color: transparent;
}
.login-card h1 { margin: 0 0 4px; font-size: 20px; }
.login-sub { color: var(--muted); font-size: 13px; margin: 0 0 22px; }
.login-card form { text-align: left; }
.login-error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
  margin-bottom: 12px;
}
.login-hint { color: var(--muted); font-size: 12px; margin: 16px 0 0; }

/* ---------- 五、导航（侧边栏） ---------- */
.logo-area { display: flex; align-items: center; gap: 11px; padding: 22px 18px 18px; }
.logo-badge {
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #60a5fa, #2563eb 55%, #1d4ed8);
  position: relative;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.45);
}
.logo-badge::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-left-color: transparent;
}
.logo-title { font-size: 16px; font-weight: 700; color: #fff; letter-spacing: 0.2px; }
.logo-sub { font-size: 11px; color: #94a3b8; margin-top: 1px; }

.nav { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 13px;
  border-radius: 10px;
  color: #cbd5e1;
  text-decoration: none;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  user-select: none;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.nav-item.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}
/* 精简面板外链：视觉对齐 nav-item，但不带 data-page，不会被页面切换逻辑拦截 */
.nav-ext {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 13px;
  border-radius: 10px;
  color: #cbd5e1;
  text-decoration: none;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}
.nav-ext:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.nav-ext-arrow { margin-left: auto; font-size: 12px; opacity: 0.7; }

/* ---------- 六、卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}
.card[hidden] { display: none; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.card-head h2 { margin: 0; font-size: 16px; font-weight: 700; }

/* ---------- 七、按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 15px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, transform 0.06s;
}
.btn:hover { background: #f8fafc; border-color: #cbd5e1; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }

.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: #f1f5f9; }

.btn-danger-ghost { background: transparent; border-color: transparent; color: var(--danger); }
.btn-danger-ghost:hover { background: #fef2f2; border-color: #fecaca; }

.btn-sm { padding: 5px 11px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 11px 24px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }

.btn-loading { cursor: progress; opacity: 0.8; }
.btn-loading::before {
  content: "";
  width: 13px;
  height: 13px;
  flex: none;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ---------- 八、表单 ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #334155; }
.field input[type="text"],
.field input[type="password"],
.field input[type="number"],
.field input[type="time"],
.field input:not([type]),
.field select,
.field textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.field textarea { resize: vertical; }
.field-hint { font-size: 12px; color: var(--muted); margin: 5px 0 0; }
.form-grid { display: grid; grid-template-columns: 1fr 130px; gap: 14px; }
.form-actions { display: flex; gap: 10px; margin-top: 6px; }
.form-stack { display: flex; flex-direction: column; }

/* ---------- 开关与设置页 ---------- */
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }

/* 开关：文字在左、拨杆在右，桌面端比手机更符合直觉。
   带上 .field > 前缀是为了盖过 .field label 的 display:block。 */
.switch-label,
.field > .switch-label {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 40px;
  margin-bottom: 0;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}
.switch-input { position: absolute; right: 0; width: 44px; height: 40px; margin: 0; opacity: 0; cursor: pointer; }
.switch-track { flex: none; width: 38px; height: 22px; padding: 3px; border-radius: 20px; background: #94a3b8; pointer-events: none; transition: background 0.15s; }
.switch-track::after { content: ""; display: block; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 15%); transition: transform 0.15s; }
.switch-input:checked + .switch-track { background: var(--primary); }
.switch-input:checked + .switch-track::after { transform: translateX(16px); }
.switch-input:focus-visible + .switch-track { outline: 3px solid var(--primary); outline-offset: 3px; }
.switch-input:disabled + .switch-track { opacity: 0.5; }
.form-stack > .field:last-child { margin-bottom: 0; }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  margin-bottom: 10px;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}
.switch {
  appearance: none;
  -webkit-appearance: none;
  width: 40px;
  height: 22px;
  flex: none;
  border-radius: 999px;
  background: #cbd5e1;
  position: relative;
  cursor: pointer;
  transition: background 0.18s;
  margin: 0;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: left 0.18s;
}
.switch:checked { background: var(--success); }
.switch:checked::after { left: 20px; }

.adv { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; }
.adv summary { cursor: pointer; font-size: 13px; color: var(--muted); user-select: none; }
.adv .field { margin: 10px 0 0; }

/* ---------- 九、徽章与标签 ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}
.badge-success { background: #dcfce7; color: #15803d; }
.badge-danger { background: #fee2e2; color: #b91c1c; }
.badge-info { background: #dbeafe; color: #1d4ed8; }
.badge-muted { background: #f1f5f9; color: #475569; }

.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 6px;
  font-size: 12px;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid var(--border);
  white-space: nowrap;
}
.tag-success { background: #dcfce7; color: #15803d; border-color: #bbf7d0; }
.tag-warn { background: #fef3c7; color: #b45309; border-color: #fde68a; }
.tag-info { background: #dbeafe; color: #1d4ed8; border-color: #bfdbfe; }
.tag-danger { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }
.tag-muted { background: #f1f5f9; color: #64748b; }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot-ok { background: var(--success); }

/* ---------- 十、统计卡 ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.stat-icon {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.stat-value { font-size: 22px; font-weight: 700; line-height: 1.25; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: 13px; }

/* ---------- 十一、签到区 ---------- */
.checkin-row { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  user-select: none;
  font-size: 14px;
}
.checkbox-inline input { accent-color: var(--primary); width: 16px; height: 16px; }
.account-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }
.picker-label { color: var(--muted); font-size: 13px; }
.check-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  background: #fff;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  user-select: none;
}
.check-chip input { accent-color: var(--primary); }
.check-chip:has(input:checked) {
  border-color: var(--primary);
  background: #eff6ff;
  color: #1d4ed8;
}

.run-progress { display: flex; align-items: center; gap: 16px; padding: 8px 2px; }
.run-progress-text { font-size: 15px; font-weight: 600; }
.run-progress-sub { margin-top: 2px; }

/* ---------- 十二、日志面板 ---------- */
.log-panel {
  background: #0f172a;
  border-radius: 12px;
  padding: 12px 14px;
  height: 300px;
  overflow-y: auto;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace;
  font-size: 12.5px;
  line-height: 1.75;
}
.log-panel::-webkit-scrollbar-thumb { background: #334155; }
.log-line {
  color: #cbd5e1;
  white-space: pre-wrap;
  word-break: break-all;
}
.log-time { color: #64748b; margin-right: 9px; user-select: none; }
.log-level { color: #94a3b8; margin-right: 10px; font-weight: 600; user-select: none; }
.log-line.log-warn { color: #f59e0b; }
.log-line.log-error { color: #ef4444; }
.log-line.log-warn .log-time, .log-line.log-error .log-time { opacity: 0.7; }
.log-placeholder { color: #475569; }
.log-tools { display: flex; align-items: center; gap: 10px; }

/* ---------- 十三、表格 ---------- */
.page-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-desc { margin: 0; }

.table-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow-x: auto;
  background: var(--card);
}
.table-head, .table-row {
  display: grid;
  gap: 10px;
  padding: 11px 16px;
  align-items: center;
}
.table-head {
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}
.table-row:not(:last-child) { border-bottom: 1px solid #f1f5f9; }
.table-row:hover { background: #f8fafc; }
.td { min-width: 0; overflow-wrap: break-word; }
.td-name { font-weight: 600; }
.td-num { font-variant-numeric: tabular-nums; font-size: 13px; }
.td-msg { color: var(--muted); font-size: 13px; }
.td-ops { display: flex; gap: 6px; flex-wrap: wrap; }
.td-session { display: flex; align-items: center; gap: 7px; }

/* 账号启停列：拨杆比默认尺寸小一号，避免撑开表格行高 */
.td-status { display: flex; align-items: center; }
.switch-compact { min-height: 32px; }
.switch-compact .switch-track { width: 34px; height: 20px; }
.switch-compact .switch-track::after { width: 14px; height: 14px; }
.switch-compact .switch-input:checked + .switch-track::after { transform: translateX(14px); }
.table-row.row-disabled { opacity: 0.55; }

.table-accounts .table-head, .table-accounts .table-row {
  grid-template-columns: minmax(90px, 1fr) minmax(130px, 1.8fr) minmax(120px, 1.4fr) minmax(110px, 1fr) minmax(64px, 0.6fr) minmax(150px, 1.4fr);
  min-width: 700px;
}
.table-results .table-head, .table-results .table-row {
  grid-template-columns: minmax(80px, 1fr) minmax(110px, 1.2fr) minmax(120px, 1.5fr) minmax(110px, 1.3fr) minmax(70px, 0.9fr) minmax(130px, 2fr);
  min-width: 660px;
}
.table-compact .table-head, .table-compact .table-row { padding: 9px 14px; }

.proxy-cell { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.proxy-url { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; display: inline-block; vertical-align: middle; }

/* ---------- 十四、邮件页 ---------- */
.mail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.pills { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.pill-label { font-size: 12.5px; color: var(--muted); }
.pill {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 5px 13px;
  font-size: 12.5px;
  cursor: pointer;
  color: var(--text);
  transition: all 0.15s;
  font-family: inherit;
}
.pill:hover { border-color: var(--primary); color: var(--primary); background: #eff6ff; }
.preview-frame {
  width: 100%;
  height: 600px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

/* ---------- 十五、趋势图 ---------- */
.trend-chart { position: relative; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-grid { stroke: var(--border); stroke-width: 1; }
.chart-axis { fill: #64748b; font-size: 10.5px; }
.chart-ref { stroke-dasharray: 4 4; stroke-width: 1.5; }
.chart-dot { stroke: #fff; stroke-width: 2; }
.chart-vline { stroke: #94a3b8; stroke-width: 1; stroke-dasharray: 3 3; }
.chart-ring { stroke: #fff; stroke-width: 2; }
.chart-hit { cursor: crosshair; }

.chart-tip {
  position: absolute;
  pointer-events: none;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.65;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.35);
  z-index: 5;
  white-space: nowrap;
  min-width: 140px;
}
.chart-tip-name { font-weight: 700; color: #fff; }
.chart-tip-time { color: #94a3b8; font-size: 11px; }
.chart-tip-usd { color: #fbbf24; font-weight: 700; font-size: 13px; }
.chart-tip-quota { color: #94a3b8; font-size: 11px; }

.legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  font-size: 12.5px;
  font-family: inherit;
  color: var(--text);
  transition: opacity 0.15s, border-color 0.15s;
}
.legend-chip:hover { border-color: #cbd5e1; }
.legend-chip.off { opacity: 0.4; }
.legend-chip.off .legend-name { text-decoration: line-through; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }

/* ---------- 十六、历史列表 ---------- */
.run-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 10px;
  overflow: hidden;
  background: var(--card);
  transition: box-shadow 0.15s;
}
.run-card:hover { box-shadow: var(--shadow); }
.run-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
  flex-wrap: wrap;
  transition: background 0.15s;
}
.run-head:hover { background: #f8fafc; }
.chevron {
  color: var(--muted);
  font-size: 12px;
  display: inline-block;
  transition: transform 0.2s;
  width: 10px;
  text-align: center;
}
.run-card.open .chevron { transform: rotate(90deg); }
.run-time { font-weight: 600; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.run-finish { margin-left: auto; }
.run-body { display: none; border-top: 1px solid var(--border); padding: 12px 14px; background: #fbfcfe; }
.run-card.open .run-body { display: block; }

/* ---------- 十七、模态框 ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.18s ease;
  padding: 20px;
}
.modal-overlay.show { opacity: 1; }
.modal-box {
  background: #fff;
  border-radius: 16px;
  width: min(540px, 94vw);
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.3);
  transform: translateY(10px) scale(0.98);
  transition: transform 0.18s ease;
}
.modal-overlay.show .modal-box { transform: none; }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  transition: background 0.15s;
}
.modal-close:hover { background: #f1f5f9; color: var(--text); }
.modal-body { padding: 20px; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  position: sticky;
  bottom: 0;
  background: #fff;
}
.confirm-msg { margin: 0; font-size: 14px; line-height: 1.7; color: #334155; }

/* ---------- 十八、Toast ---------- */
#toast-root {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(380px, 92vw);
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
  opacity: 0;
  transform: translateX(24px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.show { opacity: 1; transform: none; }
.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }
.toast-info { border-left-color: var(--primary); }
.toast-icon { flex: none; display: flex; margin-top: 1px; }
.toast-success .toast-icon { color: var(--success); }
.toast-error .toast-icon { color: var(--danger); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info .toast-icon { color: var(--primary); }
.toast-msg { flex: 1; font-size: 13.5px; word-break: break-all; padding-top: 1px; }
.toast-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
  padding: 0 2px;
}
.toast-close:hover { color: var(--text); }

/* ---------- 十九、加载与空状态 ---------- */
.spinner {
  width: 26px;
  height: 26px;
  flex: none;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.skeleton-wrap { display: flex; flex-direction: column; gap: 10px; padding: 6px 0; }
.skeleton {
  height: 14px;
  border-radius: 6px;
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 46px 20px;
  color: var(--muted);
  text-align: center;
}
.empty-icon {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
}
.empty-state p { margin: 0; font-size: 13.5px; }

/* ---------- 二十、响应式 ---------- */
@media (max-width: 899px) {
  .app-view { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: sticky;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    overflow-x: auto;
  }
  .logo-area { padding: 0; flex: none; }
  .logo-sub { display: none; }
  .logo-badge { width: 34px; height: 34px; }
  .logo-badge::after { inset: 8px; }
  .logo-title { font-size: 14px; }
  .nav { flex-direction: row; gap: 6px; padding: 0; flex: 1; }
  .nav-item { white-space: nowrap; padding: 8px 13px; }
  .topbar { padding: 12px 16px; }
  .page { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .mail-grid { grid-template-columns: 1fr; }
  .preview-frame { height: 480px; }
}
@media (max-width: 480px) {
  .stats-grid { gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 18px; }
  .form-grid { grid-template-columns: 1fr; }
}
