:root {
  --bg-1: #eef2ff;
  --bg-2: #f7f8fc;
  --bg-3: #ecfdf5;
  --card: #ffffff;
  --card-radius: 16px;
  --card-shadow: 0 8px 30px rgba(31, 41, 55, 0.08);
  --card-shadow-hover: 0 12px 36px rgba(31, 41, 55, 0.12);
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --text: #1f2937;
  --muted: #64748b;
  --faint: #94a3b8;
  --border: #cfd8e5;
  --border-soft: #e5eaf2;
  /* 可操作面语义描边：静态/可点/破坏性/禁用 */
  --border-card: rgba(207, 216, 229, 0.78);
  --border-action: #bfd7fb;
  --border-action-hover: #8ab4f8;
  --border-danger: #fecaca;
  --border-danger-hover: #fca5a5;
  --border-disabled: #d6dee9;
  --focus-ring: rgba(37, 99, 235, 0.18);
  --ok: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
  --danger-soft: #fef2f2;
  --radius-input: 8px;
  --sidebar: 220px;
  --font: -apple-system, "system-ui", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --mono: "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: linear-gradient(135deg, var(--bg-1) 0%, var(--bg-2) 45%, var(--bg-3) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
}

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

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: var(--mono); }
.tabular { font-variant-numeric: tabular-nums; }

/* ---------- auth ---------- */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}

.auth-card {
  width: 420px;
  max-width: 100%;
  background: var(--card);
  border-radius: var(--card-radius);
  box-shadow: 0 20px 50px rgba(31, 41, 55, 0.1);
  padding: 32px;
}

.brand-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  margin-bottom: 18px;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.28);
}

.brand-logo svg { width: 26px; height: 26px; }

.auth-title {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.2px;
}

.auth-sub {
  margin: 0 0 24px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 7px;
  color: var(--text);
}

.input, select.input, textarea.input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

textarea.input {
  height: auto;
  min-height: 90px;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.55;
}

.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.input[readonly] {
  background: #f8fafc;
  color: var(--muted);
}

.input:disabled {
  background: #f8fafc;
  color: var(--faint);
  cursor: not-allowed;
}

.password-wrap { position: relative; }
.password-wrap .input { padding-right: 58px; }

.eye {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 30px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
}
.eye:hover { background: #f1f5f9; color: var(--text); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-input);
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
  white-space: nowrap;
}
.btn:hover { background: #f8fafc; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }

.btn-block { width: 100%; height: 40px; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 7px; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { background: #f1f5f9; color: var(--text); }
.btn-danger { color: var(--danger); border-color: var(--border-danger); background: var(--danger-soft); }
.btn-danger:hover { background: #fee2e2; border-color: var(--border-danger-hover); }

.hint {
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  margin-top: 16px;
  text-align: center;
}

.session-note {
  margin: 0 0 12px;
  padding: 8px 12px;
  border-radius: 8px;
  background: #f1f5f9;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}
.session-note[hidden] { display: none; }

.error {
  display: none;
  margin: 0 0 14px;
  padding: 9px 12px;
  border-radius: 8px;
  background: var(--danger-soft);
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 13px;
}
.error.show { display: block; }

/* ---------- layout ---------- */
.layout { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar);
  padding: 22px 14px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(14px);
  border-right: 1px solid rgba(207, 216, 229, 0.6);
  display: flex;
  flex-direction: column;
  z-index: 20;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 20px;
}

.sidebar-brand .brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  margin: 0;
}
.sidebar-brand .brand-logo svg { width: 20px; height: 20px; }

.brand-name { font-weight: 650; font-size: 15px; letter-spacing: -0.2px; }
.brand-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  cursor: pointer;
  text-align: left;
}
.nav-item:hover { background: #f1f5f9; color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-item svg { width: 18px; height: 18px; flex: none; }

.sidebar-footer {
  margin-top: auto;
  padding: 14px 8px 0;
  border-top: 1px solid var(--border-soft);
  font-size: 11px;
  color: var(--faint);
  line-height: 1.7;
}

.main {
  margin-left: var(--sidebar);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  background: rgba(247, 248, 252, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(207, 216, 229, 0.55);
  flex-wrap: wrap;
}

.topbar #logout { margin-left: auto; }

.page-title { font-size: 17px; font-weight: 650; letter-spacing: -0.2px; }

.content { padding: 24px; width: 100%; }

.view { display: none; }
.view.active { display: block; animation: fade-in 0.18s ease-out; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

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

/* ---------- metrics row (7 cards) ---------- */
.grid-metrics {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}
.grid-metrics .card.stat { padding: 16px; }
.grid-metrics .stat-label { font-size: 12px; }
.grid-metrics .stat-value {
  font-size: clamp(16px, 1.2vw, 18px);
  line-height: 1.25;
  overflow-wrap: break-word;
}
.grid-metrics .stat-note { margin-top: auto; font-size: 11.5px; line-height: 1.45; overflow-wrap: anywhere; }
.metrics-meta { margin: 0 0 16px; font-size: 11.5px; color: var(--faint); }

/* ---------- NAS page ---------- */
#nas-stats { margin-bottom: 16px; }
#nas-stats .card.stat { padding: 16px 18px; }
#nas-stats .stat-value { font-size: 18px; }
.reason-tags { display: flex; flex-wrap: wrap; gap: 8px; min-height: 22px; }
.reason-tags[hidden] { display: none; }
.reason-tags[hidden] + .divider { display: none; }
.nas-tabs { margin: 0 0 16px; }
.nas-panel[hidden] { display: none; }
@media (max-width: 860px) { #nas-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { #nas-stats { grid-template-columns: 1fr; } }

/* ---------- cards ---------- */
.card {
  background: var(--card);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  padding: 22px 24px;
  border: 1px solid var(--border-card);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.card-title { font-size: 14.5px; font-weight: 650; margin: 0; }
.card-title-meta { font-size: 12px; color: var(--muted); font-weight: 500; margin-left: 6px; font-variant-numeric: tabular-nums; }
.card-sub { font-size: 12px; color: var(--muted); margin: 4px 0 0; }
.card-head .spacer { margin-left: auto; }

.stat { display: flex; flex-direction: column; gap: 8px; }
.stat-label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat-value { font-size: 24px; font-weight: 650; letter-spacing: -0.4px; font-variant-numeric: tabular-nums; }
.stat-note { font-size: 12px; color: var(--muted); }
.stat-value.sm { font-size: 18px; }

.stat-link {
  appearance: none;
  width: 100%;
  font: inherit;
  color: inherit;
  text-align: left;
  align-items: stretch;
  cursor: pointer;
  border-color: var(--border-action);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.stat-link:hover {
  border-color: var(--border-action-hover);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.1);
  transform: translateY(-1px);
}
.stat-link:active { transform: none; }
.stat-link:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.stat-go {
  margin-left: auto;
  color: var(--faint);
  font-size: 14px;
  line-height: 1;
  transition: color 0.15s ease, transform 0.15s ease;
}
.stat-link:hover .stat-go,
.stat-link:focus-visible .stat-go { color: var(--primary); transform: translateX(2px); }

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--faint);
}
.dot.ok { background: var(--ok); }
.dot.bad { background: var(--danger); }
.dot.warn { background: var(--warn); }

.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  background: #f1f5f9;
  color: var(--muted);
  white-space: nowrap;
}
.badge.ok { background: #ecfdf5; color: #047857; }
.badge.warn { background: #fffbeb; color: #b45309; }
.badge.bad { background: var(--danger-soft); color: #b91c1c; }
.badge.blue { background: var(--primary-soft); color: var(--primary); }
.badge[hidden] { display: none; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  font-size: 12px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}
.table td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: 0; }
.table .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.table .cell-line { display: flex; align-items: center; min-height: 30px; }
.table .truncate { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- forms / actions ---------- */
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

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

.action-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--border-action);
  background: #fff;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.05s;
}
.action-tile:hover { border-color: var(--border-action-hover); box-shadow: 0 6px 18px rgba(37, 99, 235, 0.1); }
.action-tile:active { transform: translateY(1px); }
.action-tile:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; box-shadow: 0 0 0 3px var(--focus-ring); }
.action-tile strong { font-size: 13.5px; font-weight: 600; }
.action-tile span { font-size: 12px; color: var(--muted); line-height: 1.5; }
.action-tile.danger { border-color: var(--border-danger); background: #fffafa; }
.action-tile.danger:hover { border-color: var(--border-danger-hover); box-shadow: 0 6px 18px rgba(239, 68, 68, 0.1); }
.action-tile.danger strong { color: #b91c1c; }
.action-tile:disabled,
.action-tile.danger:disabled {
  border: 1px dashed var(--border-disabled);
  background: #f7f9fc;
  cursor: not-allowed;
  opacity: 1;
  box-shadow: none;
}
.action-tile:disabled strong,
.action-tile.danger:disabled strong { color: var(--faint); }
.action-tile:disabled > span:not(.badge) { color: var(--faint); }
.action-tile:disabled:hover { border-color: var(--border-disabled); box-shadow: none; }
.action-tile:disabled:active { transform: none; }

.list { display: flex; flex-direction: column; gap: 10px; }
.list-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 10px;
  background: #f8fafc;
  font-size: 12.5px;
}
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 550; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .meta { color: var(--muted); margin-top: 3px; font-size: 11.5px; }

/* ---------- charts ---------- */
.chart-label {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 6px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--muted);
  white-space: normal;
}
.chart-latest { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.chart-latest.pending { font-weight: 500; color: var(--faint); }
.chart { width: 100%; height: 110px; position: relative; cursor: crosshair; }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart .grid-line { stroke: #eef2f7; stroke-width: 1; }
.chart .area { opacity: 0.12; }
.chart .line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart .hover-line { stroke: #94a3b8; stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }
.chart .hover-dot, .chart .last-dot { pointer-events: none; }
.chart .hover-dot { stroke: #fff; stroke-width: 2; }
.chart-tip {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  padding: 6px 9px;
  border-radius: 8px;
  background: #0f172a;
  color: #f8fafc;
  font-size: 11.5px;
  line-height: 1.45;
  white-space: normal;
  max-width: min(260px, calc(100vw - 24px));
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.22);
  transform: translate(-50%, -100%);
}
.chart-tip strong { font-weight: 600; font-variant-numeric: tabular-nums; }
.chart-tip span { display: block; color: #cbd5e1; font-size: 10.5px; }
.chart-empty {
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--faint);
  font-size: 12px;
  border: 1px dashed var(--border-disabled);
  border-radius: 10px;
}
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  margin: 0 0 8px;
  font-size: 11.5px;
  color: var(--muted);
  min-width: 0;
}
.chart-legend[hidden] { display: none; }
.chart-legend .legend-item { display: inline-flex; align-items: center; gap: 5px; min-width: 0; white-space: nowrap; }
.chart-legend .legend-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.chart-legend .legend-name { overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.chart-legend .legend-value { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.chart-note { margin: 6px 0 0; font-size: 11px; color: var(--faint); }
.chart-note[hidden] { display: none; }
.chart-tip.chart-tip-multi { padding: 7px 10px; }
.chart-tip-multi .tip-row { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.chart-tip-multi .tip-row + .tip-row { margin-top: 2px; }
.chart-tip-multi .tip-swatch { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.chart-tip-multi .tip-amount { font-style: normal; color: #cbd5e1; font-size: 10.5px; font-variant-numeric: tabular-nums; }
.chart-tip-multi .tip-time { margin-top: 3px; }

.segmented {
  display: inline-flex;
  padding: 2px;
  background: #f1f5f9;
  border-radius: 8px;
  gap: 2px;
  box-shadow: inset 0 0 0 1px var(--border-card);
}
.segmented button {
  height: 26px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  border-radius: 6px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}
.segmented button.active { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08); }

/* ---------- logs ---------- */
.log {
  margin: 0;
  padding: 14px 16px;
  background: #0f172a;
  color: #cbd5e1;
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  height: 420px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
}
.log .err { color: #fca5a5; }

.log-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.log-toolbar .input { height: 32px; }
.log-toolbar select.input { width: 190px; }
.log-toolbar input.input { width: 180px; }

/* ---------- modal / drawer ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 60;
  padding: 20px;
}
.modal-backdrop.open { display: flex; }

.modal {
  width: 480px;
  max-width: 100%;
  background: #fff;
  border-radius: var(--card-radius);
  box-shadow: 0 30px 70px rgba(15, 23, 42, 0.25);
  padding: 24px;
}
.modal h3 { margin: 0 0 8px; font-size: 17px; font-weight: 650; }
.modal p { margin: 0 0 14px; color: var(--muted); line-height: 1.65; font-size: 13px; }
.modal .warn-box {
  padding: 10px 12px;
  border-radius: 8px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  font-size: 12.5px;
  line-height: 1.6;
  margin-bottom: 14px;
}
.modal .warn-box.danger { background: var(--danger-soft); border-color: #fecaca; color: #b91c1c; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 520px;
  max-width: 100%;
  background: #fff;
  box-shadow: -20px 0 60px rgba(15, 23, 42, 0.18);
  transform: translateX(105%);
  transition: transform 0.22s ease;
  z-index: 70;
  display: flex;
  flex-direction: column;
}
.drawer.open { transform: none; }
.drawer-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-soft);
}
.drawer-head .title { font-weight: 650; }
.drawer-body { flex: 1; padding: 16px 18px; overflow: hidden; display: flex; flex-direction: column; }
.drawer-body .log { flex: 1; height: auto; }

/* ---------- misc ---------- */
.toast-host {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 90;
}
.toast {
  min-width: 220px;
  max-width: 360px;
  padding: 11px 14px;
  border-radius: 10px;
  background: #0f172a;
  color: #fff;
  font-size: 13px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.25);
  animation: fade-in 0.16s ease-out;
}
.toast.ok { background: #065f46; }
.toast.bad { background: #991b1b; }

.divider { height: 1px; background: var(--border-soft); margin: 18px 0; }

.kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px 14px; font-size: 12.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--text); word-break: break-all; }

.empty {
  padding: 28px 12px;
  text-align: center;
  color: var(--faint);
  font-size: 12.5px;
}

.progress {
  height: 6px;
  border-radius: 999px;
  background: #eef2f7;
  overflow: hidden;
}
.progress > i { display: block; height: 100%; border-radius: 999px; background: var(--primary); }
.progress.warn > i { background: var(--warn); }
.progress.bad > i { background: var(--danger); }

.disk-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.disk-item {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: #fff;
}
.disk-head { display: flex; align-items: center; gap: 8px; }
.disk-name { font-weight: 650; overflow-wrap: anywhere; }
.disk-pct { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12.5px; }
.disk-meta { font-size: 12px; color: var(--muted); }
.disk-paths { font-size: 11.5px; color: var(--faint); overflow-wrap: anywhere; }

.prompt-out {
  min-height: 120px;
  max-height: 320px;
  overflow: auto;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid var(--border-soft);
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
}

@media (max-width: 1599px) {
  .grid-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 1199px) {
  .grid-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #overview-stats > .stat:last-child { grid-column: 1 / -1; }
}

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

@media (max-width: 860px) {
  :root { --sidebar: 0px; }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 30;
    width: 100%;
    height: auto;
    flex-direction: row;
    align-items: center;
    padding: 8px 12px;
    overflow: hidden;
    border-right: 0;
    border-bottom: 1px solid var(--border-soft);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
  }
  .sidebar-brand { padding: 0 10px 0 0; flex: none; gap: 0; }
  .sidebar-brand .brand-sub { display: none; }
  .sidebar-brand .brand-name { display: none; }
  .nav {
    flex: 1;
    min-width: 0;
    flex-direction: row;
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav-item { height: 34px; white-space: nowrap; flex: none; }
  .sidebar-footer { display: none; }
  .main { margin-left: 0; }
  .topbar { position: static; padding: 10px 14px; }
  .content { padding: 14px; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .disk-list { grid-template-columns: 1fr; }
  .disk-head { flex-wrap: wrap; row-gap: 6px; }
  .grid-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #overview-stats > .stat:last-child { grid-column: 1 / -1; }
  .quick-actions { grid-template-columns: 1fr; }
  .drawer { width: 100%; }
  .card { padding: 16px; }
  .card-head { flex-wrap: wrap; row-gap: 8px; }
  .table-wrap { -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
  .table-wide { min-width: 560px; }
  .table .truncate { max-width: 160px; }
  .log { height: min(420px, 55vh); }
  .log-toolbar select.input, .log-toolbar input.input { width: 100%; }
  .log-toolbar .input { height: 40px; font-size: 16px; }
  .input, select.input, textarea.input { font-size: 16px; }
  .toast-host { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); }
  .toast { max-width: none; }
  .modal-backdrop { padding: 12px; }
  .modal { padding: 18px; max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); overflow: auto; }
  .drawer-head { min-width: 0; }
  .drawer-head .title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

@media (max-width: 480px) {
  .content { padding: 12px 10px calc(12px + env(safe-area-inset-bottom)); }
  .card { padding: 14px; }
  .grid-metrics { gap: 10px; }
  .grid-metrics .card.stat { padding: 13px 12px; }
  .grid-metrics .stat-value { font-size: 16px; }
  .grid-metrics .stat-note { font-size: 11px; }
  .kv { grid-template-columns: 92px 1fr; }
}
