/* ==========================================================================
   克莱因蓝企业控制台 · Design System
   International Klein Blue (IKB) #002FA7 enterprise theme.
   Hand-written, zero external CSS framework / CDN.
   ========================================================================== */

:root {
  --klein: #002fa7;          /* International Klein Blue */
  --klein-bright: #1e50c8;   /* hover / lighter accent   */
  --klein-deep: #001e6c;     /* sidebar top              */
  --klein-darker: #00103a;   /* sidebar bottom           */
  --klein-50: #eef2fd;
  --klein-100: #dde6fb;
  --klein-200: #bcccf6;

  --ink-900: #0a1330;
  --ink-800: #1b2545;
  --ink-700: #313c5e;
  --ink-500: #5b6486;
  --ink-400: #8a90a8;
  --ink-300: #b9bed0;

  --line: #e4e8f2;
  --line-soft: #eef1f7;
  --bg: #f3f5fb;
  --surface: #ffffff;

  --good: #16a34a;
  --good-bg: #e7f6ec;
  --warn: #d98a00;
  --warn-bg: #fdf3e0;
  --bad: #dc2626;
  --bad-bg: #fdeaea;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(10, 19, 48, 0.05), 0 1px 3px rgba(10, 19, 48, 0.07);
  --shadow-md: 0 8px 24px rgba(10, 19, 48, 0.10);
  --shadow-lg: 0 24px 60px rgba(10, 19, 48, 0.22);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--bg);
  color: var(--ink-800);
  font-size: 14px;
  line-height: 1.5;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; color: var(--ink-900); }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--klein-50);
  color: var(--klein);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 0.85em;
}

/* ============================ Shell layout ============================ */

.shell { display: flex; min-height: 100vh; }

/* ============================ Sidebar ============================ */

.sidebar {
  width: 248px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--klein-deep) 0%, var(--klein-darker) 100%);
  color: #fff;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand__logo {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--klein);
  box-shadow: 0 6px 18px rgba(0, 47, 167, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.5px;
}

.brand__title { font-size: 15px; font-weight: 600; line-height: 1.2; }
.brand__subtitle {
  font-size: 11px;
  color: var(--klein-200);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 2px;
}

.sidebar__nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }

.nav__group-label {
  font-size: 11px;
  color: rgba(188, 204, 246, 0.6);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 12px 12px 6px;
}

.nav__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--klein-200);
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
  position: relative;
}
.nav__item:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.nav__item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav__item__badge {
  margin-left: auto;
  min-width: 22px;
  text-align: center;
  background: var(--klein);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
}

.nav__item--active {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-weight: 500;
}
.nav__item--active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 22px;
  border-radius: 0 4px 4px 0;
  background: #fff;
}

.sidebar__foot {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11px;
  color: rgba(188, 204, 246, 0.7);
  line-height: 1.6;
}

/* ============================ Main column ============================ */

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar__title { font-size: 20px; }
.topbar__subtitle { font-size: 13px; color: var(--ink-500); margin-top: 2px; }
.topbar__right { display: flex; align-items: center; gap: 18px; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--ink-500);
}
.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--good);
  box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.16);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  background: var(--klein-50);
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--ink-700);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s;
}
.user-chip:hover { background: var(--klein-100); }
.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--klein);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}

.dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 180px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  z-index: 30;
}
.dropdown__item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--ink-700);
}
.dropdown__item:hover { background: var(--klein-50); }
.dropdown__item--danger { color: var(--bad); }

.page { padding: 28px 32px; display: flex; flex-direction: column; gap: 20px; }

/* ============================ Cards ============================ */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line-soft);
}
.card__header h2 { font-size: 16px; }
.card__header p { font-size: 13px; color: var(--ink-500); margin-top: 3px; }
.card__body { padding: 24px; }
.card__body--tight { padding: 16px 24px; }

/* ============================ Stat cards ============================ */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--klein);
}
.stat-card--good::after { background: var(--good); }
.stat-card--warn::after { background: var(--warn); }
.stat-card--bad::after { background: var(--bad); }

.stat-card__label {
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-500);
  font-weight: 500;
}
.stat-card__value {
  font-size: 30px;
  font-weight: 700;
  color: var(--ink-900);
  margin-top: 6px;
  line-height: 1.1;
}
.stat-card__hint { font-size: 12px; color: var(--ink-400); margin-top: 6px; }

.hero-card {
  grid-column: span 4;
  background: linear-gradient(120deg, var(--klein) 0%, var(--klein-bright) 100%);
  color: #fff;
  border: 0;
}
.hero-card .card__body { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.hero-card h2 { color: #fff; font-size: 22px; }
.hero-card p { color: rgba(255, 255, 255, 0.82); margin-top: 8px; max-width: 540px; }

/* ============================ Forms ============================ */

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12px; font-weight: 500; color: var(--ink-700); }
.field-input,
.field-select,
.field-textarea {
  width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  color: var(--ink-800);
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field-input:focus,
.field-select:focus,
.field-textarea:focus {
  outline: none;
  border-color: var(--klein);
  box-shadow: 0 0 0 3px rgba(0, 47, 167, 0.14);
}
.field-textarea { resize: vertical; min-height: 72px; }
.field-input:disabled { background: var(--bg); color: var(--ink-400); cursor: not-allowed; }

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.form-grid .col-span-2 { grid-column: span 2; }

/* ============================ Buttons ============================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}
.btn--primary { background: var(--klein); color: #fff; box-shadow: 0 6px 16px rgba(0, 47, 167, 0.28); }
.btn--primary:hover { background: var(--klein-bright); }
.btn--primary:disabled { background: var(--ink-300); box-shadow: none; cursor: not-allowed; }
.btn--ghost { background: #fff; color: var(--ink-700); border-color: var(--line); }
.btn--ghost:hover { background: var(--klein-50); border-color: var(--klein-200); color: var(--klein); }
.btn--danger { background: var(--bad-bg); color: var(--bad); }
.btn--danger:hover { background: #f9d9d9; }
.btn--block { width: 100%; }
.btn--sm { padding: 7px 12px; font-size: 13px; }

.btn-text {
  background: transparent;
  border: 0;
  color: var(--klein);
  font-size: 13px;
  padding: 4px 6px;
  border-radius: 6px;
}
.btn-text:hover { background: var(--klein-50); }
.btn-text--danger { color: var(--bad); }
.btn-text--danger:hover { background: var(--bad-bg); }

/* ============================ Toolbar ============================ */

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.search-input { width: 220px; }

.bulkbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 24px;
  background: var(--klein-50);
  border-bottom: 1px solid var(--line-soft);
}
.bulkbar__count { font-size: 13px; color: var(--klein); font-weight: 600; }

/* ============================ Table ============================ */

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table thead th {
  text-align: left;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--ink-500);
  background: var(--bg);
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.data-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.data-table tbody tr:hover td { background: var(--klein-50); }
.data-table .col-checkbox { width: 40px; }
.data-table .col-actions { text-align: right; white-space: nowrap; }
.cell-name { font-weight: 600; color: var(--ink-900); }
.cell-sub { font-size: 12px; color: var(--ink-400); margin-top: 2px; }
.cell-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; color: var(--ink-500); }

.avatar-cell { display: flex; align-items: center; gap: 12px; }
.avatar-circle {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--klein-100);
  color: var(--klein);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}

.empty-row { text-align: center; color: var(--ink-400); padding: 56px 0; }

/* ============================ Pills ============================ */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 11px;
  border-radius: 999px;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.pill--active { background: var(--good-bg); color: var(--good); }
.pill--pending { background: var(--warn-bg); color: var(--warn); }
.pill--disabled { background: var(--bad-bg); color: var(--bad); }
.pill--muted { background: var(--line-soft); color: var(--ink-500); }
.pill--muted::before { display: none; }

/* ============================ Pagination ============================ */

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-top: 1px solid var(--line-soft);
  font-size: 13px;
  color: var(--ink-500);
}
.pagination__pages { display: flex; align-items: center; gap: 8px; }

/* ============================ Segmented ============================ */

.seg-group { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.seg {
  background: #fff;
  border: 0;
  padding: 9px 16px;
  font-size: 13px;
  color: var(--ink-700);
  border-right: 1px solid var(--line);
}
.seg:last-child { border-right: 0; }
.seg:hover { background: var(--klein-50); }
.seg--on { background: var(--klein); color: #fff; }
.seg--on:hover { background: var(--klein); }

/* ============================ Switch ============================ */

.switch {
  position: relative;
  width: 40px;
  height: 22px;
  border: 0;
  border-radius: 999px;
  background: var(--ink-300);
  padding: 0;
  transition: background 0.15s;
  flex-shrink: 0;
}
.switch--on { background: var(--klein); }
.switch__knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s;
}
.switch--on .switch__knob { transform: translateX(18px); }

.switch-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.switch-row:last-child { border-bottom: 0; }
.switch-row__label { font-size: 14px; font-weight: 500; color: var(--ink-800); }
.switch-row__hint { font-size: 12px; color: var(--ink-400); margin-top: 2px; }

/* ============================ Modal ============================ */

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(10, 19, 48, 0.45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 60;
}
.modal {
  width: 100%;
  max-width: 560px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modal-in 0.18s ease;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
}
.modal__header h3 { font-size: 16px; }
.modal__close { background: transparent; border: 0; font-size: 18px; color: var(--ink-400); line-height: 1; }
.modal__close:hover { color: var(--ink-700); }
.modal__body { padding: 24px; max-height: 70vh; overflow-y: auto; }
.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  background: var(--bg);
  border-top: 1px solid var(--line);
}

/* ============================ Settings 2-col ============================ */
.settings-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}
.settings-cols > .card { margin: 0; }

.export-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
@media (max-width: 900px) {
  .settings-cols { grid-template-columns: 1fr; }
}

/* ============================ Dashboard Metrics ============================ */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}
.metric {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  text-align: center;
}
.metric__value { font-size: 26px; font-weight: 800; color: var(--ink-700); line-height: 1.2; }
.metric__label { margin-top: 6px; font-size: 12px; color: var(--ink-500); }
.metric--good .metric__value { color: #16a34a; }
.metric--bad .metric__value { color: #d23b3b; }
.metric--klein { background: var(--klein-50); border-color: transparent; }
.metric--klein .metric__value { color: var(--klein); }

/* 仪表盘双列布局：趋势图 + 最近记录 */
.dash-cols {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
}
.dash-cols > .card { margin: 0; }
@media (max-width: 1000px) {
  .dash-cols { grid-template-columns: 1fr; }
}

/* 运行进度条 */
.run-progress-track {
  margin-top: 14px;
  height: 8px;
  border-radius: 999px;
  background: var(--klein-50);
  overflow: hidden;
}
.run-progress-track__bar {
  height: 100%;
  border-radius: 999px;
  background: var(--klein);
  transition: width 0.4s ease;
}

/* 近 7 天趋势柱状图 */
.trend-chart {
  display: flex;
  align-items: stretch;
  gap: 10px;
  height: 180px;
}
.trend-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.trend-col__bars {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 5px;
}
.trend-col__bar {
  width: 16px;
  min-height: 2px;
  border-radius: 4px 4px 0 0;
}
.trend-col__date { font-size: 12px; color: var(--ink-500); }
.trend-legend {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--ink-500);
}
.trend-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  vertical-align: middle;
  margin-right: 4px;
}

/* ============================ Account Runner ============================ */
.run-bar {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}
.run-bar__field { width: 140px; }
.run-bar__actions { display: flex; gap: 10px; margin-left: auto; }

.run-status {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-500);
}
.run-status__item b { color: var(--ink-700); font-size: 14px; }
.run-status__item--ok b { color: #16a34a; }
.run-status__item--err b { color: #d23b3b; }
.run-status__pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink-500);
  font-weight: 600;
}
.run-status__pill--on {
  background: var(--klein-50);
  color: var(--klein);
}

.log-autoscroll { font-size: 12px; color: var(--ink-500); display: inline-flex; align-items: center; gap: 6px; }

.log-panel {
  margin: 0 4px 4px;
  height: 360px;
  overflow-y: auto;
  background: #0b1020;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 12.5px;
  line-height: 1.7;
}
.log-line { display: flex; gap: 10px; white-space: pre-wrap; word-break: break-all; }
.log-line__ts { color: #5b6580; flex: 0 0 auto; }
.log-line__msg { color: #c7d0e0; }
.log-line--success .log-line__msg { color: #4ade80; }
.log-line--error .log-line__msg { color: #f87171; }
.log-line--warn .log-line__msg { color: #fbbf24; }

/* ============================ App Dialog ============================ */
.app-dialog { z-index: 80; }
.app-dialog__box { max-width: 400px; }
.app-dialog__box .modal__body { padding: 20px 24px; }
.app-dialog__msg {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-700);
  white-space: pre-wrap;
}
.app-dialog__input { margin-top: 16px; width: 100%; }

/* ============================ Toast ============================ */

.toast-stack {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  min-width: 240px;
  max-width: 360px;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--klein);
  box-shadow: var(--shadow-md);
  font-size: 14px;
  color: var(--ink-800);
  animation: toast-in 0.2s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
.toast--success { border-left-color: var(--good); }
.toast--error { border-left-color: var(--bad); }
.toast--info { border-left-color: var(--klein); }

/* ============================ Misc / dashboard ============================ */

.dept-bar { display: flex; flex-direction: column; gap: 14px; }
.dept-bar__row { display: grid; grid-template-columns: 110px 1fr 44px; align-items: center; gap: 12px; }
.dept-bar__name { font-size: 13px; color: var(--ink-700); }
.dept-bar__track { height: 10px; border-radius: 999px; background: var(--klein-50); overflow: hidden; }
.dept-bar__fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--klein), var(--klein-bright)); }
.dept-bar__count { font-size: 13px; font-weight: 600; color: var(--ink-800); text-align: right; }

.checkbox { width: 16px; height: 16px; accent-color: var(--klein); cursor: pointer; }

/* ============================ Proxy groups layout ============================ */

.proxy-layout { display: grid; grid-template-columns: 200px 1fr; gap: 20px; align-items: start; }
.group-list { display: flex; flex-direction: column; gap: 2px; }
.group-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--ink-700);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.group-item:hover { background: var(--klein-50); }
.group-item--active { background: var(--klein); color: #fff; font-weight: 500; }
.group-item--active:hover { background: var(--klein); }
.group-item__name {
  flex: 0 1 auto;
  min-width: 64px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.group-item__count {
  font-size: 12px;
  font-weight: 600;
  min-width: 18px;
  text-align: center;
  color: var(--ink-400);
}
.group-item--active .group-item__count { color: rgba(255, 255, 255, 0.85); }
.group-item__del {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: inherit;
  opacity: 0;
  font-size: 15px;
  line-height: 1;
  padding: 0 2px;
  border-radius: 5px;
}
.group-item:hover .group-item__del { opacity: 0.6; }
.group-item__del:hover { opacity: 1; background: rgba(0, 0, 0, 0.12); }

@media (max-width: 880px) {
  .proxy-layout { grid-template-columns: 1fr; }
}

/* ===================== 邮箱：快捷收件 / 导入 / 邮件抽屉 ===================== */

.cell-ellipsis {
  display: inline-block;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

.code-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  background: var(--klein-50);
  border: 1px solid var(--klein-100);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}
.code-box__label { font-size: 13px; color: var(--ink-500); }
.code-box__value {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--klein);
  font-family: var(--mono, monospace);
  user-select: all;
}
.code-raw-label { font-size: 12px; color: var(--ink-400); margin: 14px 0 6px; }

.count-badge {
  display: inline-block;
  min-width: 24px;
  text-align: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--klein-50);
  color: var(--klein);
  font-size: 12px;
  font-weight: 600;
}
.count-badge--full {
  background: #fdecec;
  color: #d23b3b;
}

.code-usage {
  font-size: 13px;
  color: var(--ink-500);
  margin-bottom: 12px;
}
.code-usage b { color: var(--klein); font-size: 15px; }

.field__hint {
  font-size: 12px;
  color: var(--ink-400);
  margin-top: 6px;
}

.receive-card { margin-bottom: 16px; }
.receive-card__head { padding: 18px 20px 0; }
.receive-card__head h2 { font-size: 16px; }
.receive-card__head p { font-size: 13px; color: var(--ink-500); margin-top: 4px; }
.receive-bar { display: flex; gap: 12px; padding: 16px 20px 20px; }
.receive-bar .field-input { flex: 1; max-width: 420px; }

.modal--lg { max-width: 720px; }
.import-hint {
  font-size: 13px;
  color: var(--ink-500);
  line-height: 1.8;
  margin-bottom: 12px;
}
.import-hint code {
  background: var(--klein-50);
  color: var(--klein);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 12px;
}
.import-textarea { width: 100%; min-height: 240px; font-family: var(--mono, monospace); font-size: 12px; }

.mail-drawer { position: fixed; inset: 0; z-index: 70; }
.mail-drawer__mask { position: absolute; inset: 0; background: rgba(10, 19, 48, 0.45); backdrop-filter: blur(2px); }
.mail-drawer__panel {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 480px;
  max-width: 92vw;
  background: #fff;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: drawer-in 0.22s ease;
}
@keyframes drawer-in { from { transform: translateX(100%); } to { transform: none; } }
.mail-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.mail-drawer__head h3 { font-size: 16px; }
.mail-drawer__account { font-size: 12px; color: var(--ink-500); margin-top: 4px; word-break: break-all; }
.mail-drawer__head__tools { display: flex; align-items: center; gap: 12px; }
.mail-drawer__body { flex: 1; overflow-y: auto; padding: 12px 16px 24px; }

.mail-empty { padding: 48px 16px; text-align: center; color: var(--ink-400); font-size: 14px; }
.mail-empty--error { color: var(--danger, #d92d20); }
.mail-empty__hint { margin-top: 8px; font-size: 12px; color: var(--ink-400); }

.mail-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.mail-item:hover { border-color: var(--klein); }
.mail-item--open { box-shadow: var(--shadow-sm); }
.mail-item__row { display: flex; align-items: center; gap: 8px; }
.mail-item__subject { flex: 1; font-weight: 600; font-size: 14px; color: var(--ink-700); }
.mail-item__folder {
  font-size: 11px;
  color: var(--klein);
  background: var(--klein-50);
  padding: 1px 8px;
  border-radius: 999px;
  flex: 0 0 auto;
}
.mail-item__meta { font-size: 12px; color: var(--ink-500); margin-top: 4px; word-break: break-all; }
.mail-item__preview { font-size: 13px; color: var(--ink-400); margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-item__full {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: 13px;
  color: var(--ink-700);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 360px;
  overflow-y: auto;
  font-family: inherit;
}

[hidden] { display: none !important; }

@media (max-width: 1080px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-card { grid-column: span 2; }
}
@media (max-width: 720px) {
  .sidebar { display: none; }
  .stat-grid { grid-template-columns: 1fr; }
  .hero-card { grid-column: span 1; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .col-span-2 { grid-column: span 1; }
  .page, .topbar { padding-left: 16px; padding-right: 16px; }
}
