:root {
  --bg: #0b1020;
  --surface: #11182c;
  --surface-2: #16203a;
  --surface-3: #1b2745;
  --rail-bg: #0d1426;
  --line: #223050;
  --line-soft: #1b2740;
  --text: #e6ebf7;
  --text-2: #c3cee6;
  --muted: #8b9ab8;
  --faint: #6b7a99;
  --accent: #4f8cff;
  --accent-soft: rgba(79, 140, 255, 0.15);
  --accent-deep: #9dc0ff;
  --accent-strong: #3b78e7;
  --green: #22d3a7;
  --green-soft: rgba(34, 211, 167, 0.12);
  --red: #ff6b7a;
  --red-soft: rgba(255, 107, 122, 0.12);
  --amber: #f5b74a;
  --amber-soft: rgba(245, 183, 74, 0.12);
  --radius: 8px;
  --mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  --row-h: 30px;
  --head-h: 30px;
  --rail-w: 228px;
  --rail-w-min: 62px;
  --drawer-w: min(960px, 52vw);
  --sheet-min: 1080px;
  --cols: 28px 44px 92px 108px 54px minmax(120px, 0.9fr) minmax(180px, 1.5fr) 78px 74px 46px 56px 96px minmax(120px, 0.9fr);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.error { color: var(--red); margin: 8px 0 0; }
.mono { font-family: var(--mono); }
.spacer { flex: 1; }

/* ---------- login ---------- */
.login-wrap {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 520px at 100% -10%, rgba(79, 140, 255, 0.16), transparent 62%),
    radial-gradient(720px 420px at -10% 110%, rgba(34, 211, 167, 0.1), transparent 60%),
    var(--bg);
}
.login-card {
  width: 372px;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: 0.2px; }
.brand.big { font-size: 20px; }
.logo {
  width: 26px; height: 26px; border-radius: 7px;
  display: grid; place-items: center; flex: 0 0 auto;
  background: linear-gradient(135deg, var(--accent), #7c5cff);
  color: #fff; font-weight: 800; font-size: 13px;
}

/* ---------- app shell ---------- */
.app {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
  background: var(--surface);
}
.app.rail-collapsed { grid-template-columns: var(--rail-w-min) minmax(0, 1fr); }

/* ---------- left rail ---------- */
.rail {
  border-right: 1px solid var(--line);
  background: var(--rail-bg);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.rail-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 10px;
  min-height: 50px;
  border-bottom: 1px solid var(--line);
  background: var(--rail-bg);
}
.rail-brand { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; color: var(--text); }
.rail-toggle { margin-left: auto; }
.rail-scroll { flex: 1; overflow-y: auto; padding: 4px 8px 16px; }
.rail-group { margin-top: 2px; }
.rail-title {
  color: var(--faint);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 12px 8px 5px;
}
.rail-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 9px;
  margin: 1px 0;
  border: none;
  border-radius: 0 16px 16px 0;
  background: none;
  color: var(--text-2);
  font: inherit;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.rail-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-item b {
  font-weight: 400;
  font-size: 11.5px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.rail-icu {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 6px 9px 8px;
  margin: 1px 0 4px;
  border: none;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text-2);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.rail-icu span { font-size: 11px; color: var(--faint); }
.rail-icu b {
  font-weight: 500;
  font-size: 11.5px;
  line-height: 1.35;
  color: var(--text);
  word-break: break-all;
}
.rail-icu:hover { background: var(--surface-3); }
.rail-item:hover { background: var(--surface-3); }
.rail-item.active { background: var(--accent-soft); color: var(--accent-deep); font-weight: 500; }
.rail-item.active b { color: var(--accent-deep); font-weight: 500; }
.rail-foot {
  border-top: 1px solid var(--line);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.conn-state { color: var(--green); font-size: 11px; display: flex; align-items: center; gap: 5px; }
.conn-state::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--green); }

.app.rail-collapsed .rail-brand,
.app.rail-collapsed .rail-title,
.app.rail-collapsed .rail-icu b,
.app.rail-collapsed #rail-suffix-group,
.app.rail-collapsed .rail-foot span { display: none; }
.app.rail-collapsed .rail-head {
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 10px 4px;
  min-height: 0;
}
.app.rail-collapsed .rail-toggle { margin-left: 0; }
.app.rail-collapsed .rail-item {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 6px 2px;
  border-radius: 8px;
  line-height: 1.2;
}
.app.rail-collapsed .rail-item span {
  display: block;
  max-width: 100%;
  font-size: 9.5px;
  text-align: center;
  white-space: normal;
  overflow: hidden;
}
.app.rail-collapsed .rail-item b { display: block; font-size: 10px; }
.app.rail-collapsed .rail-scroll { padding: 4px 5px 12px; }
.app.rail-collapsed .rail-foot { justify-content: center; padding: 10px 4px; }

/* ---------- main ---------- */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--surface);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 50px;
  flex: 0 0 50px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.topbar-title { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 0 0 auto; }
.topbar-title h1 { font-size: 15px; margin: 0; font-weight: 600; white-space: nowrap; }
.count-chip {
  display: inline-block;
  padding: 0 8px;
  border-radius: 99px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 11px;
  line-height: 18px;
  font-variant-numeric: tabular-nums;
}
.topbar-unit { color: var(--faint); font-size: 11px; }
.topbar-search { flex: 1 1 auto; max-width: 460px; margin-left: 18px; }
.search { width: 100%; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.topbar-actions .btn { padding: 6px 12px; font-size: 12.5px; }
.sort-select { padding: 6px 8px; font-size: 12px; color: var(--text-2); }

.quickbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 36px;
  height: auto;
  flex: 0 0 auto;
  padding: 6px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.qlabel {
  font-size: 11px;
  color: var(--faint);
  margin: 0 2px 0 4px;
  user-select: none;
}
.qchip {
  border: 1px solid transparent;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 99px;
  cursor: pointer;
  white-space: nowrap;
}
.qchip b { font-weight: 500; font-size: 11px; color: var(--faint); margin-left: 2px; font-variant-numeric: tabular-nums; }
.qchip:hover { background: var(--surface-3); }
.qchip.active { background: var(--accent-soft); color: var(--accent-deep); }
.qchip.active b { color: var(--accent-deep); }
.qchip.danger.active { background: var(--red-soft); color: var(--red); }
.qchip.danger.active b { color: var(--red); }
.qsep { width: 1px; height: 16px; background: var(--line); margin: 0 6px; flex: 0 0 auto; }
.quickbar-hint { color: var(--faint); font-size: 11px; white-space: nowrap; }

.bulkbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  border-bottom: 1px solid rgba(79, 140, 255, 0.35);
  background: var(--accent-soft);
  flex: 0 0 auto;
}

.app.page-logs .quickbar,
.app.page-logs .bulkbar,
.app.page-logs .sheet,
.app.page-logs .topbar-search,
.app.page-logs .topbar-actions,
.app.page-logs #export-csv { display: none; }

.oplog {
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
}
.app.page-logs .oplog { display: flex; }
.oplog-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
}
.log-fail {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
  font-size: 12px;
  white-space: nowrap;
}
.log-search { width: 220px; }
.oplog-scroll { flex: 1; min-height: 0; overflow: auto; }
.oplog-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.oplog-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  padding: 7px 10px;
  white-space: nowrap;
}
.oplog-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}
.oplog-table tr:hover td { background: rgba(79, 140, 255, 0.06); }
.oplog-table .log-msg { white-space: pre-wrap; word-break: break-word; }
.oplog-table .log-site {
  border: 0;
  background: none;
  color: var(--accent-deep);
  font: inherit;
  padding: 0;
  cursor: pointer;
  text-align: left;
}
.oplog-pager {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  padding: 8px 14px;
  border-top: 1px solid var(--line-soft);
}

/* ---------- dense sheet ---------- */
.sheet {
  flex: 1;
  min-height: 0;
  margin: 8px 14px 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  background: var(--surface);
}
.sheet-body {
  height: 100%;
  overflow: auto;
  scrollbar-gutter: stable;
}
.sheet-head, .row {
  display: grid;
  grid-template-columns: var(--cols);
  align-items: center;
  min-width: var(--sheet-min);
  font-size: 12px;
}
.sheet-head {
  position: sticky;
  top: 0;
  z-index: 3;
  height: var(--head-h);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  user-select: none;
}
.sheet-head > span,
.row > span {
  padding: 0 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  line-height: 1.2;
  border-right: 1px solid var(--line-soft);
}
.sheet-head > span { border-right-color: var(--line-soft); }
.sheet-head > span:last-child,
.row > span:last-child { border-right: none; }
.sheet-head .c-sel, .row .c-sel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.sheet-head [data-sort] { cursor: pointer; position: relative; }
.sheet-head [data-sort]:hover { background: var(--surface-3); color: var(--text); }
.sheet-head [data-sort].sort-asc::after { content: " ↑"; color: var(--accent); }
.sheet-head [data-sort].sort-desc::after { content: " ↓"; color: var(--accent); }
.sheet-head input[type='checkbox'],
.row input[type='checkbox'] {
  width: 13px;
  height: 13px;
  padding: 0;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.row {
  height: var(--row-h);
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
  color: var(--text-2);
  background: var(--surface);
}
.row:hover { background: var(--surface-2); }
.row.sel { background: rgba(79, 140, 255, 0.12); }
.row.active { background: rgba(79, 140, 255, 0.2); box-shadow: inset 3px 0 var(--accent); }
.row.active .c-name { color: var(--accent); font-weight: 500; }
.row .c-idx { color: var(--faint); font-size: 11px; text-align: right; font-variant-numeric: tabular-nums; padding-right: 10px; }
.row .c-name { color: var(--text); }
.row .c-url, .row .c-ctrl, .row .c-seed { color: var(--text-2); font-size: 11.5px; }
.row > [data-copy] { cursor: copy; }
.row > [data-copy]:hover {
  color: var(--text);
  box-shadow: inset 0 -1px 0 var(--accent);
}
.row > [data-copy].copied { color: var(--green); }
.row .c-suffix { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.row .c-created, .row .c-note { color: var(--muted); font-size: 11px; }
.row .c-status { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11.5px; }
.row .c-status .st-ms { font-variant-numeric: tabular-nums; }
.row .c-auto { display: flex; align-items: center; justify-content: center; }
.row .c-basic { display: flex; align-items: center; gap: 4px; cursor: pointer; }
.basic-why { font-style: normal; font-size: 10px; color: var(--red); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60px; }
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--faint);
  flex: 0 0 auto;
}
.dot.ok { background: var(--green); }
.dot.err { background: var(--red); }
.dot.busy { background: var(--amber); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.25; } }
.pill {
  display: inline-block;
  padding: 0 6px;
  border-radius: 4px;
  font-size: 10.5px;
  line-height: 17px;
  font-variant-numeric: tabular-nums;
  background: var(--surface-3);
  color: var(--muted);
}
.pill.ok { background: var(--green-soft); color: var(--green); }
.pill.err { background: var(--red-soft); color: var(--red); }
.hub-toggle {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 4px;
  font-size: 10.5px;
  line-height: 1;
  padding: 3px 7px;
  cursor: pointer;
}
.hub-toggle:hover { border-color: var(--accent); color: var(--accent); }
.hub-toggle.on {
  border-color: rgba(34, 211, 167, 0.45);
  color: var(--green);
  background: var(--green-soft);
}
.sheet-empty {
  padding: 64px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.sheet-empty b { color: var(--text); font-weight: 600; }

.statusbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 28px;
  height: 28px;
  padding: 0 14px;
  color: var(--faint);
  background: var(--surface);
  border-top: 1px solid var(--line-soft);
  margin-top: 6px;
}

/* ---------- right drawer ---------- */
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--drawer-w);
  max-width: 100vw;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -10px 0 34px rgba(0, 0, 0, 0.5);
  transform: translateX(101%);
  transition: transform 0.22s cubic-bezier(0.22, 0.61, 0.36, 1);
  z-index: 45;
}
.app.drawer-open .drawer { transform: translateX(0); }
.drawer-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--line);
  min-height: 58px;
  flex: 0 0 auto;
}
.drawer-title { min-width: 0; flex: 1; }
.drawer-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drawer-sub {
  color: var(--muted);
  font-size: 11.5px;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drawer-sub .sep { margin: 0 6px; color: var(--faint); }
.drawer-sub .copy-link {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 0;
  cursor: copy;
  max-width: 42%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}
.drawer-sub .copy-link:hover { color: var(--accent-deep); }
.drawer-sub .copy-link.copied { color: var(--green); }
.drawer-body td.copied,
.drawer-body .kv .v.copied,
.drawer-body .card.stat .v.copied,
.drawer-body .log-box.copied,
.drawer-body pre.copied,
.drawer-body .error.copied,
.oplog-table [data-copy].copied { color: var(--green); }
.drawer-body td,
.drawer-body .kv .v,
.drawer-body .card.stat .v,
.drawer-body .log-box,
.drawer-body pre,
.drawer-body .error { cursor: copy; }
.oplog-table [data-copy] { cursor: copy; }
.oplog-table [data-copy]:hover { color: var(--text); }
.drawer-tools { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.drawer .tabs { margin: 0; padding: 0 10px; border-bottom: 1px solid var(--line); flex-wrap: nowrap; overflow-x: auto; flex: 0 0 auto; }
.drawer .tab { padding: 0 12px; height: 38px; }
.drawer-body {
  flex: 1;
  overflow: auto;
  padding: 14px 16px 48px;
  background: var(--bg);
}
.drawer-body .card { padding: 12px 13px; margin-bottom: 12px; }
.drawer-body .card h3 { margin-bottom: 9px; }
.drawer-body .notice { margin-bottom: 12px; }
.drawer-body .toolbar { margin-bottom: 10px; }
.drawer-body .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.drawer-body .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.drawer-body .kv { grid-template-columns: 92px 1fr; }

/* ---------- buttons / fields ---------- */
.btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 6px 13px;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-size: 12.5px;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { background: var(--surface-2); border-color: #35507f; }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 500;
}
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.link { background: none; border: none; color: var(--muted); padding: 3px 0; }
.btn.link:hover { color: var(--accent); background: none; }
.btn.danger { border-color: rgba(255, 107, 122, 0.45); color: var(--red); }
.btn.danger:hover { background: var(--red-soft); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.wide { width: 100%; }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn.tiny { padding: 2px 4px; font-size: 11.5px; }
.icon-btn {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  line-height: 1;
}
.icon-btn:hover { border-color: var(--line); background: var(--surface-3); color: var(--text); }
.icon-btn-lg {
  width: 32px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 16px;
  line-height: 1;
  color: var(--muted);
}
.icon-btn-lg:hover { color: var(--accent); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12px; color: var(--muted); }
.field.check > span {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
}
.field.check input[type='checkbox'] {
  width: 16px;
  height: 16px;
  padding: 0;
  accent-color: var(--accent);
}
input, select, textarea {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 6px;
  padding: 7px 10px;
  font: inherit;
  font-size: 12.5px;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(79, 140, 255, 0.22);
}
textarea { resize: vertical; min-height: 70px; font-family: var(--mono); font-size: 12px; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tab {
  padding: 0 13px;
  height: 34px;
  cursor: pointer;
  color: var(--muted);
  border: none;
  border-bottom: 2px solid transparent;
  font: inherit;
  font-size: 12.5px;
  background: none;
  white-space: nowrap;
}
.tab:hover { color: var(--text); background: var(--surface-2); }
.tab.active { color: var(--accent-deep); border-bottom-color: var(--accent); font-weight: 500; }

/* ---------- cards / grids ---------- */
.grid { display: grid; gap: 12px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 980px) { .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px;
  min-width: 0;
}
.card h3 {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.02em;
}
.card .sub { color: var(--muted); font-size: 12px; }
.stat { display: flex; flex-direction: column; gap: 3px; }
.stat .k { color: var(--muted); font-size: 11.5px; }
.stat .v { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); }
.stat .v small { font-size: 12px; color: var(--muted); font-weight: 400; }

.kv { display: grid; grid-template-columns: 104px 1fr; gap: 6px 10px; font-size: 12.5px; }
.kv .k { color: var(--muted); }
.kv .v { word-break: break-all; color: var(--text-2); }

.bar { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--green)); }
.bar.warn > i { background: linear-gradient(90deg, var(--amber), var(--red)); }

/* ---------- tables inside panels ---------- */
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
th, td { text-align: left; padding: 6px 9px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; background: var(--surface-2); position: sticky; top: 0; font-size: 11px; z-index: 1; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
td.wrap { white-space: normal; max-width: 420px; word-break: break-all; }
.tag {
  display: inline-block; padding: 1px 7px; border-radius: 4px; font-size: 10.5px;
  border: 1px solid var(--line); color: var(--muted); line-height: 16px;
}
.tag.ok { color: var(--green); border-color: rgba(34, 211, 167, 0.4); background: var(--green-soft); }
.tag.warn { color: var(--amber); border-color: rgba(245, 183, 74, 0.4); background: var(--amber-soft); }
.tag.off { color: var(--muted); }

/* ---------- misc ---------- */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .spacer { flex: 1; }
.section { margin-bottom: 12px; }
.section-title { font-size: 12px; color: var(--muted); margin: 0 0 8px; letter-spacing: 0.04em; }
.notice {
  border: 1px solid rgba(79, 140, 255, 0.3); border-left: 3px solid var(--accent);
  background: rgba(79, 140, 255, 0.08); padding: 8px 11px; border-radius: 6px;
  font-size: 12px; color: var(--muted);
}
.loading { color: var(--muted); padding: 36px 0; text-align: center; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 18, 0.72);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 60;
}
.modal-card {
  width: 430px; max-width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 22px; display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.modal-card h2 { margin: 0 0 4px; font-size: 17px; font-weight: 600; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 70;
  background: var(--surface); border: 1px solid var(--line);
  padding: 10px 15px; border-radius: 8px; font-size: 12.5px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
}
.toast.err { border-color: rgba(255, 107, 122, 0.5); color: var(--red); }

.progress-line { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.progress-line .bar { flex: 1; }
.log-box {
  background: #0a1122; border: 1px solid var(--line); border-radius: 6px;
  padding: 9px; font-family: var(--mono); font-size: 11.5px; color: var(--text-2);
  max-height: 180px; overflow: auto; white-space: pre-wrap;
}

/* ---------- responsive ---------- */
@media (max-width: 1280px) {
  :root { --drawer-w: min(860px, 54vw); --rail-w: 210px; --sheet-min: 1040px; }
  .quickbar-hint { display: none; }
}
@media (max-width: 1000px) {
  :root { --drawer-w: 100vw; --rail-w: var(--rail-w-min); }
  .rail-brand, .rail-title, .rail-icu b, #rail-suffix-group, .rail-foot span { display: none; }
  .rail-head { flex-direction: column; justify-content: center; gap: 6px; padding: 10px 4px; min-height: 0; }
  .rail-toggle { margin-left: 0; }
  .rail-item {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 6px 2px;
    border-radius: 8px;
    line-height: 1.2;
  }
  .rail-item span {
    display: block;
    max-width: 100%;
    font-size: 9.5px;
    text-align: center;
    white-space: normal;
    overflow: hidden;
  }
  .rail-item b { font-size: 10px; }
  .rail-scroll { padding: 4px 5px 12px; }
  .topbar { gap: 8px; }
  .topbar-search { margin-left: 8px; max-width: none; }
}
@media (max-width: 820px) {
  .topbar { height: auto; flex-wrap: wrap; padding: 8px 12px; }
  .topbar-search { order: 3; flex: 1 1 100%; margin-left: 0; }
  .topbar-actions { margin-left: auto; }
  .quickbar { overflow-x: auto; padding: 0 8px; }
  .sheet { margin: 6px 8px 0; }
  .statusbar { padding: 0 10px; }
  .search { width: 100%; }
}
