/* 主题：默认白天（light），html[data-theme="dark"] 为暗色 */
:root {
  --bg: #f3f5fb;
  --bg-soft: #eef1f8;
  --card: #ffffff;
  --card-2: #f7f9fe;
  --panel: rgba(255, 255, 255, 0.88);
  --line: rgba(17, 24, 39, 0.08);
  --line-strong: rgba(17, 24, 39, 0.14);
  --text: #131722;
  --muted: #6b7280;
  --mono: #475569;
  --primary: #4f6ef7;
  --primary-2: #0ea5e9;
  --primary-grad: linear-gradient(135deg, #4f6ef7, #7c93ff);
  --brand: #f0a500;
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #e5484d;
  --radius: 16px;
  --shadow: 0 18px 45px rgba(17, 24, 39, 0.1);
  --shadow-soft: 0 1px 2px rgba(17, 24, 39, 0.04);
  --sidebar-bg: rgba(255, 255, 255, 0.86);
  --input-bg: #ffffff;
  --hover: rgba(17, 24, 39, 0.045);
  --subtle: rgba(17, 24, 39, 0.035);
  --modal-bg: #ffffff;
  --toast-bg: #ffffff;
  --code-bg: #f7f9fd;
  --backdrop: rgba(15, 23, 42, 0.32);
  --glow-1: rgba(79, 110, 247, 0.12);
  --glow-2: rgba(14, 165, 233, 0.09);
  --chart-grid: rgba(17, 24, 39, 0.08);
  --avatar-grad: linear-gradient(135deg, #4f6ef7, #0ea5e9);
  --active-bg: linear-gradient(135deg, rgba(79, 110, 247, 0.14), rgba(14, 165, 233, 0.08));
  --active-border: rgba(79, 110, 247, 0.28);
  --active-text: #1d4ed8;
  --ok-ink: #15803d;
  --ok-wash: rgba(22, 163, 74, 0.1);
  --ok-line: rgba(22, 163, 74, 0.32);
  --warn-ink: #b45309;
  --warn-wash: rgba(217, 119, 6, 0.1);
  --warn-line: rgba(217, 119, 6, 0.32);
  --danger-ink: #b91c1c;
  --danger-wash: rgba(229, 72, 77, 0.1);
  --danger-line: rgba(229, 72, 77, 0.32);
  --blue-ink: #1d4ed8;
  --blue-wash: rgba(79, 110, 247, 0.1);
  --blue-line: rgba(79, 110, 247, 0.3);
  --chip-bg: rgba(79, 110, 247, 0.07);
  --chip-text: #2440b3;
  --chip-line: rgba(79, 110, 247, 0.45);
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #0a0b10;
  --bg-soft: #0e1017;
  --card: #12141c;
  --card-2: #171a24;
  --panel: rgba(18, 20, 28, 0.9);
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #e8eaf2;
  --muted: #8a8fa3;
  --mono: #b9c0d4;
  --primary: #6c8cff;
  --primary-2: #7ce0ff;
  --primary-grad: linear-gradient(135deg, #6c8cff, #8aa4ff);
  --brand: #ffc83d;
  --ok: #7ce0a3;
  --warn: #ffcf5c;
  --danger: #ff6b6b;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --shadow-soft: none;
  --sidebar-bg: rgba(12, 14, 20, 0.92);
  --input-bg: rgba(9, 10, 15, 0.75);
  --hover: rgba(255, 255, 255, 0.05);
  --subtle: rgba(255, 255, 255, 0.03);
  --modal-bg: #12141c;
  --toast-bg: #171a24;
  --code-bg: #0a0c12;
  --backdrop: rgba(3, 4, 8, 0.72);
  --glow-1: rgba(108, 140, 255, 0.14);
  --glow-2: rgba(124, 224, 255, 0.08);
  --chart-grid: rgba(255, 255, 255, 0.08);
  --avatar-grad: linear-gradient(135deg, #6c8cff, #7ce0ff);
  --active-bg: linear-gradient(135deg, rgba(108, 140, 255, 0.24), rgba(124, 224, 255, 0.1));
  --active-border: rgba(108, 140, 255, 0.35);
  --active-text: #ffffff;
  --ok-ink: #b7ffd8;
  --ok-wash: rgba(124, 224, 163, 0.1);
  --ok-line: rgba(124, 224, 163, 0.35);
  --warn-ink: #ffe6a6;
  --warn-wash: rgba(255, 207, 92, 0.1);
  --warn-line: rgba(255, 207, 92, 0.35);
  --danger-ink: #ffc0c0;
  --danger-wash: rgba(255, 107, 107, 0.1);
  --danger-line: rgba(255, 107, 107, 0.4);
  --blue-ink: #c7d4ff;
  --blue-wash: rgba(108, 140, 255, 0.12);
  --blue-line: rgba(108, 140, 255, 0.4);
  --chip-bg: rgba(108, 140, 255, 0.08);
  --chip-text: #dbe4ff;
  --chip-line: rgba(108, 140, 255, 0.5);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Noto Sans SC",
    "Microsoft YaHei", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s ease, color 0.2s ease;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 500px at 12% -10%, var(--glow-1), transparent 60%),
    radial-gradient(700px 420px at 100% 0%, var(--glow-2), transparent 55%);
}

a {
  color: var(--primary-2);
  text-decoration: none;
}

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

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 10px;
}

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 18px;
  position: relative;
}

.login-card {
  width: min(420px, 100%);
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 30px;
  box-shadow: var(--shadow);
  text-align: center;
  backdrop-filter: blur(12px);
}

.login-card img {
  width: 84px;
  height: 84px;
  border-radius: 22px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #fff8e8;
}

.login-card h1 {
  font-size: 22px;
  margin: 16px 0 6px;
  letter-spacing: 0.02em;
}

.login-card p {
  color: var(--muted);
  margin: 0 0 22px;
  font-size: 13px;
}

.login-card .field {
  text-align: left;
}

/* ---------- 布局 ---------- */
.layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 236px 1fr;
  position: relative;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: var(--sidebar-bg);
  backdrop-filter: blur(14px);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  z-index: 5;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 12px;
}

.brand img {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #fff8e8;
}

.brand b {
  font-size: 15px;
  display: block;
  letter-spacing: 0.02em;
}

.brand span {
  font-size: 11px;
  color: var(--muted);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: var(--muted);
  border-radius: 12px;
  font-size: 13.5px;
  transition: 0.16s ease;
}

.nav a svg {
  width: 17px;
  height: 17px;
  flex: none;
}

.nav a:hover {
  color: var(--text);
  background: var(--hover);
}

.nav a.active {
  color: var(--active-text);
  background: var(--active-bg);
  border: 1px solid var(--active-border);
}

.sidebar .spacer {
  flex: 1;
}

/* ---------- 侧边栏账号区 ---------- */
.side-user {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.avatar-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
  border: 0;
  background: transparent;
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  transition: background 0.16s ease;
}

.avatar-btn:hover {
  background: var(--hover);
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex: none;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--avatar-grad);
  box-shadow: 0 6px 14px rgba(79, 110, 247, 0.28);
}

.avatar svg {
  width: 18px;
  height: 18px;
}

.side-user-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.side-user-meta b {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-user-meta span {
  font-size: 11px;
  color: var(--muted);
}

.theme-toggle {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--subtle);
  color: var(--muted);
  cursor: pointer;
  transition: 0.16s ease;
}

.theme-toggle:hover {
  color: var(--text);
  background: var(--hover);
}

.user-menu {
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: calc(100% + 8px);
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--modal-bg);
  box-shadow: var(--shadow);
  z-index: 20;
}

.user-menu[hidden] {
  display: none;
}

.user-menu button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--danger-ink);
  font-size: 12.5px;
  cursor: pointer;
}

.user-menu button:hover {
  background: var(--danger-wash);
}

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

.view {
  padding: 26px 26px 48px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.page-head h2 {
  margin: 0 0 6px;
  font-size: 20px;
}

.page-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
}

/* ---------- 卡片 ---------- */
.grid {
  display: grid;
  gap: 14px;
}

.grid.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card {
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-soft);
}

.kpi-label {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.kpi-value {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.kpi-sub {
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--muted);
}

.card h3 {
  margin: 0 0 14px;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card h3 span {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 400;
}

/* ---------- 表格 ---------- */
.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  font-size: 12.8px;
}

th {
  color: var(--muted);
  font-weight: 500;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--subtle);
  position: sticky;
  top: 0;
}

tbody tr:hover {
  background: var(--hover);
}

tbody tr:last-child td {
  border-bottom: 0;
}

td.wrap {
  white-space: normal;
  max-width: 360px;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  color: var(--mono);
}

/* ---------- 按钮 ---------- */
.btn {
  border: 1px solid var(--line-strong);
  background: var(--subtle);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 13px;
  cursor: pointer;
  font-size: 12.5px;
  transition: 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.btn:hover {
  background: var(--hover);
  border-color: var(--line-strong);
}

.btn.primary {
  background: var(--primary-grad);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 8px 18px rgba(79, 110, 247, 0.25);
}

.btn.primary:hover {
  filter: brightness(1.06);
}

.btn.danger {
  border-color: var(--danger-line);
  color: var(--danger-ink);
  background: var(--danger-wash);
}

.btn.ghost {
  background: transparent;
}

.btn.sm {
  padding: 5px 9px;
  font-size: 11.5px;
  border-radius: 8px;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ---------- 表单 ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 14px;
}

.field label {
  font-size: 12px;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
  transition: 0.15s;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--glow-1);
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.field.inline {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.field.inline label {
  color: var(--text);
  font-size: 13px;
}

.field.inline input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

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

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.toolbar .grow {
  flex: 1;
  min-width: 180px;
}

.search {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search input {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 9px 12px 9px 34px;
  outline: none;
}

.search svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--muted);
}

/* ---------- 标签 ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  background: var(--subtle);
}

.badge.ok {
  color: var(--ok-ink);
  border-color: var(--ok-line);
  background: var(--ok-wash);
}

.badge.warn {
  color: var(--warn-ink);
  border-color: var(--warn-line);
  background: var(--warn-wash);
}

.badge.danger {
  color: var(--danger-ink);
  border-color: var(--danger-line);
  background: var(--danger-wash);
}

.badge.blue {
  color: var(--blue-ink);
  border-color: var(--blue-line);
  background: var(--blue-wash);
}

/* ---------- 分页 ---------- */
.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
}

/* ---------- 条形图 ---------- */
.bar-row {
  display: grid;
  grid-template-columns: 110px 1fr 48px;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
  font-size: 12px;
}

.bar-track {
  height: 8px;
  border-radius: 99px;
  background: var(--subtle);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
}

.bar-value {
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- 仪表盘图表 ---------- */
.dash-row {
  grid-template-columns: 1.6fr 1fr;
}

.chart-card h3 {
  margin-bottom: 10px;
}

.line-chart {
  position: relative;
}

.line-chart svg {
  width: 100%;
  height: auto;
  display: block;
}

.chart-tip {
  position: absolute;
  top: 6px;
  left: 0;
  min-width: 128px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--toast-bg);
  box-shadow: var(--shadow);
  font-size: 11.5px;
  color: var(--text);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
  z-index: 3;
}

.chart-tip.show {
  opacity: 1;
}

.chart-tip b {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--text);
}

.chart-tip .tip-row {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  line-height: 1.9;
  white-space: nowrap;
}

.chart-tip .tip-row i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}

.chart-tip .tip-row span {
  margin-left: auto;
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.donut-seg {
  transition: stroke-width 0.18s ease, opacity 0.18s ease;
  cursor: pointer;
}

.donut-seg:hover {
  stroke-width: 23;
}

.donut-legend .row {
  transition: color 0.15s ease, background 0.15s ease;
  border-radius: 8px;
  padding: 2px 4px;
  margin: 0 -4px;
}

.donut-legend .row.active {
  background: var(--subtle);
}

.donut-legend .row.active .dot,
.donut-legend .row.active b {
  color: var(--text);
}

.hbar {
  border-radius: 8px;
  transition: background 0.15s ease;
}

.hbar:hover {
  background: var(--subtle);
}

.hbar:hover .hbar-label {
  color: var(--text);
  font-weight: 600;
}

.hbar:hover .hbar-fill {
  filter: brightness(1.12) saturate(1.1);
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  font-size: 11.5px;
  color: var(--muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-item i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.donut-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  min-height: 210px;
}

.donut-svg {
  width: 168px;
  height: 168px;
  flex: none;
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-width: 132px;
  font-size: 12px;
}

.donut-legend .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.donut-legend .dot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.donut-legend .dot i {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  display: inline-block;
}

.donut-legend b {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.donut-legend b em {
  font-style: normal;
  font-weight: 400;
  color: var(--muted);
  font-size: 10.5px;
  margin-left: 4px;
}

.hbar-chart {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 2px;
}

.hbar {
  display: grid;
  grid-template-columns: 106px 1fr 40px;
  gap: 10px;
  align-items: center;
  font-size: 12px;
}

.hbar-label {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hbar-track {
  height: 9px;
  border-radius: 99px;
  background: var(--subtle);
  overflow: hidden;
}

.hbar-fill {
  display: block;
  height: 100%;
  border-radius: 99px;
  transition: width 0.4s ease;
}

.hbar-value {
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- 空状态 ---------- */
.empty {
  padding: 42px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- 弹窗 ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--backdrop);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 50;
  animation: fade 0.16s ease;
}

.modal {
  width: min(620px, 100%);
  max-height: 86vh;
  overflow: auto;
  background: linear-gradient(180deg, var(--card), var(--modal-bg));
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  box-shadow: var(--shadow);
  animation: pop 0.18s ease;
}

.modal.wide {
  width: min(860px, 100%);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: inherit;
  z-index: 2;
}

.modal-head h3 {
  margin: 0;
  font-size: 16px;
}

.modal-body {
  padding: 20px;
}

.modal-foot {
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  position: sticky;
  bottom: 0;
  background: inherit;
}

.icon-btn {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  color: var(--muted);
}

.icon-btn:hover {
  color: var(--text);
  background: var(--hover);
}

pre.json {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  overflow: auto;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--mono);
  white-space: pre-wrap;
  word-break: break-word;
}

.code-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 4px;
}

.code-chip {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  border: 1px dashed var(--chip-line);
  background: var(--chip-bg);
  color: var(--chip-text);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12.5px;
  letter-spacing: 0.08em;
}

/* ---------- toast ---------- */
.toast-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 100;
}

.toast {
  background: var(--toast-bg);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--primary);
  border-radius: 12px;
  padding: 12px 14px;
  min-width: 220px;
  max-width: 380px;
  box-shadow: var(--shadow);
  font-size: 12.5px;
  animation: slide 0.2s ease;
}

.toast.error {
  border-left-color: var(--danger);
}

.toast.ok {
  border-left-color: var(--ok);
}

/* ---------- 辅助 ---------- */
.muted {
  color: var(--muted);
}

.right {
  text-align: right;
}

.flex {
  display: flex;
  gap: 10px;
  align-items: center;
}

.gap-8 {
  gap: 8px;
}

.mt-16 {
  margin-top: 16px;
}

.mb-12 {
  margin-bottom: 12px;
}

.split {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 14px;
}

.kv {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 8px 12px;
  font-size: 12.5px;
  line-height: 1.6;
}

.kv dt {
  color: var(--muted);
}

.kv dd {
  margin: 0;
  word-break: break-all;
}

.tabs {
  display: flex;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--subtle);
  border-radius: 12px;
  padding: 4px;
  width: fit-content;
}

.tabs button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 7px 14px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 12.5px;
}

.tabs button.active {
  background: var(--blue-wash);
  color: var(--blue-ink);
}

.link {
  background: none;
  border: 0;
  color: var(--primary-2);
  cursor: pointer;
  padding: 0;
  font-size: 12px;
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.99);
  }
}

@keyframes slide {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@media (max-width: 1100px) {
  .grid.cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .split,
  .dash-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    padding: 12px;
    gap: 10px;
  }
  .brand {
    padding: 0 8px;
  }
  .brand span,
  .sidebar .spacer {
    display: none;
  }
  .nav {
    flex-direction: row;
  }
  .nav a {
    padding: 8px 10px;
  }
  .nav a span {
    display: none;
  }
  .side-user {
    margin-left: auto;
    border-top: 0;
    padding-top: 0;
  }
  .side-user-meta {
    display: none;
  }
  .user-menu {
    left: auto;
    right: 0;
    bottom: auto;
    top: calc(100% + 8px);
    min-width: 156px;
  }
  .view {
    padding: 18px 14px 40px;
  }
  .grid.cols-4,
  .grid.cols-3,
  .grid.cols-2,
  .form-grid {
    grid-template-columns: 1fr;
  }
}
