/* ---------- tokens ---------- */
:root {
  /* Qoder Sites Nudge baseline */
  --site-bg: #0a0c11;
  --site-fg: #e9edf6;
  --site-accent: #e8b46c;
  --site-on-accent: #23190a;
  --site-surface: #11151e;
  --site-muted: #929bb0;
  --site-border: rgba(255, 255, 255, 0.075);
  --site-font: "SF Pro Text", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --site-radius: 16px;
  --site-space: 1;
  --site-type: 1;
  --site-motion: 1;

  --bg: var(--site-bg);
  --text: var(--site-fg);
  --gold: var(--site-accent);
  --gold-ink: var(--site-on-accent);
  --panel: var(--site-surface);
  --muted: var(--site-muted);
  --line: var(--site-border);
  --bg-glow: #111726;
  --panel-2: #161b26;
  --panel-3: #1b2130;
  --line-strong: rgba(255, 255, 255, 0.14);
  --faint: #626d82;
  --gold-soft: rgba(232, 180, 108, 0.12);
  --blue: #7fa8ff;
  --blue-soft: rgba(127, 168, 255, 0.12);
  --green: #5fce93;
  --green-soft: rgba(95, 206, 147, 0.12);
  --red: #f07878;
  --red-soft: rgba(240, 120, 120, 0.12);
  --purple: #b79aff;
  --purple-soft: rgba(183, 154, 255, 0.12);
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.45);
  --radius: var(--site-radius);
  --font: var(--site-font);
  --mono: ui-monospace, "SF Mono", Menlo, Monaco, "Cascadia Mono", monospace;
}

[data-theme="light"] {
  --bg: #f4f2ed;
  --bg-glow: #fbf8f0;
  --panel: #fffdf8;
  --panel-2: #f7f3ea;
  --panel-3: #efe9dd;
  --line: rgba(36, 31, 22, 0.09);
  --line-strong: rgba(36, 31, 22, 0.17);
  --text: #241f17;
  --muted: #6e6658;
  --faint: #938a7b;
  --gold: #a8742c;
  --gold-soft: rgba(168, 116, 44, 0.1);
  --blue: #3f68c4;
  --blue-soft: rgba(63, 104, 196, 0.1);
  --green: #23855a;
  --green-soft: rgba(35, 133, 90, 0.1);
  --red: #c04848;
  --red-soft: rgba(192, 72, 72, 0.1);
  --purple: #7350b8;
  --purple-soft: rgba(115, 80, 184, 0.1);
  --shadow: 0 20px 50px rgba(58, 45, 24, 0.16);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background:
    radial-gradient(1100px 500px at 82% -8%, rgba(232, 180, 108, 0.075), transparent 62%),
    radial-gradient(900px 520px at 18% 110%, rgba(74, 105, 180, 0.08), transparent 65%),
    var(--bg);
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
::selection { background: var(--gold-soft); color: var(--text); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 26px;
  padding: 26px 18px 20px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.018), transparent 30%);
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; }
.brand-mark {
  width: 42px; height: 42px; flex: 0 0 auto;
  display: grid; place-items: center;
  color: #241a0c;
  background: linear-gradient(145deg, #f3ce94, #d79a47);
  border-radius: 13px;
  box-shadow: 0 8px 24px rgba(232, 180, 108, 0.22), inset 0 1px 0 rgba(255,255,255,0.5);
}
.brand-text h1 { font-size: 15.5px; font-weight: 650; letter-spacing: 0.01em; }
.brand-text p { margin-top: 4px; font-size: 8.5px; letter-spacing: 0.14em; color: var(--faint); font-weight: 600; }

.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-link {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 10px 11px;
  border: 1px solid transparent; border-radius: 10px;
  background: none; color: var(--muted); text-align: left;
  transition: background .16s ease, color .16s ease, border-color .16s ease;
}
.side-link:hover { background: rgba(255,255,255,0.035); color: var(--text); }
.side-link.is-active {
  color: var(--text);
  background: linear-gradient(90deg, var(--gold-soft), rgba(232,180,108,0.03));
  border-color: rgba(232, 180, 108, 0.16);
}
.side-link.is-active span:first-child { font-weight: 600; }
.side-count {
  min-width: 24px; padding: 1px 7px; border-radius: 99px;
  font: 500 11px/1.6 var(--mono); text-align: center;
  color: var(--faint); background: rgba(255,255,255,0.04);
}
.side-link.is-active .side-count { color: var(--gold); background: rgba(232,180,108,0.12); }
.side-section { border-top: 1px solid var(--line); padding-top: 20px; }
.side-label {
  padding: 0 9px; margin-bottom: 10px;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .13em;
  color: var(--faint); font-weight: 600;
}
.side-chips { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 7px; }
.filter-chip {
  border: 1px solid var(--line); border-radius: 8px;
  padding: 5px 9px; background: rgba(255,255,255,0.02);
  font-size: 11.5px; color: var(--muted);
  transition: all .15s ease;
}
.filter-chip:hover { color: var(--text); border-color: var(--line-strong); }
.filter-chip.is-active { color: var(--gold); border-color: rgba(232,180,108,0.4); background: var(--gold-soft); }
.side-note {
  margin-top: auto; display: flex; gap: 9px; align-items: flex-start;
  padding: 12px; border-radius: 12px;
  border: 1px solid var(--line); background: rgba(255,255,255,0.018);
}
.side-note strong { font-size: 11.5px; font-weight: 600; display: block; }
.side-note p { margin-top: 4px; font-size: 10.5px; line-height: 1.55; color: var(--faint); }
.side-note code { font-family: var(--mono); font-size: 10px; }
.dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; margin-top: 4px; background: var(--faint); }
.dot-live { background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }

.main { min-width: 0; padding: 26px 34px 40px; display: flex; flex-direction: column; gap: 20px; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  margin: -26px -34px 0; padding: 20px 34px 16px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}
.eyebrow { font-size: 9.5px; font-weight: 650; letter-spacing: .16em; color: var(--gold); margin-bottom: 6px; }
.heading h2 { font-size: 25px; font-weight: 650; letter-spacing: -0.02em; }
.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search {
  display: flex; align-items: center; gap: 8px;
  width: 250px; height: 36px; padding: 0 11px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel);
  color: var(--faint);
  transition: border-color .16s ease, box-shadow .16s ease;
}
.search:focus-within { border-color: rgba(232,180,108,0.45); box-shadow: 0 0 0 3px var(--gold-soft); }
.search input { width: 100%; border: 0; outline: 0; background: none; font-size: 12.5px; color: var(--text); }
.search input::placeholder { color: var(--faint); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 13px;
  border-radius: 10px; border: 1px solid transparent;
  font-size: 12.5px; font-weight: 550; white-space: nowrap;
  transition: transform .12s ease, background .15s ease, border-color .15s ease, color .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn.ghost { color: var(--muted); border-color: var(--line); background: var(--panel); }
.btn.ghost:hover { color: var(--text); border-color: var(--line-strong); background: var(--panel-2); }
.btn.primary { color: var(--gold-ink); background: linear-gradient(150deg, #f0c98e, #daa254); border-color: rgba(255,255,255,0.16); box-shadow: 0 6px 18px rgba(232,180,108,0.15); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: var(--red); border-color: rgba(240,120,120,0.3); background: var(--red-soft); }
.btn.danger:hover { background: rgba(240,120,120,0.18); }
.btn.small { height: 30px; padding: 0 10px; font-size: 11.5px; border-radius: 8px; }
.icon-btn {
  width: 36px; height: 36px; display: inline-grid; place-items: center;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel); color: var(--muted);
}
.icon-btn:hover { color: var(--text); border-color: var(--line-strong); }
.icon-sun { display: none; }
.icon-moon { display: block; }
[data-theme="light"] .icon-sun { display: block; }
[data-theme="light"] .icon-moon { display: none; }
.btn:disabled, .mini-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.mini-btn {
  width: 26px; height: 26px; display: inline-grid; place-items: center;
  border: 1px solid transparent; border-radius: 7px;
  background: none; color: var(--faint);
}
.mini-btn:hover { color: var(--text); background: rgba(255,255,255,0.05); border-color: var(--line); }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat-card {
  position: relative; overflow: hidden;
  padding: 16px 17px 14px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(255,255,255,0.035), rgba(255,255,255,0.008) 55%), var(--panel);
}
.stat-card::after {
  content: ""; position: absolute; inset: auto -40px -55px auto;
  width: 130px; height: 130px; border-radius: 50%;
  background: radial-gradient(circle, var(--gold-soft), transparent 70%);
  pointer-events: none;
}
.stat-warn::after { background: radial-gradient(circle, var(--red-soft), transparent 70%); }
.stat-label { font-size: 11px; color: var(--muted); letter-spacing: .04em; }
.stat-value { margin-top: 8px; font-size: 29px; line-height: 1; font-weight: 600; letter-spacing: -0.035em; font-variant-numeric: tabular-nums; }
.stat-value.money { color: var(--gold); }
.stat-meta { margin-top: 9px; font-size: 10.5px; color: var(--faint); }

.table-panel {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); overflow: hidden;
}
.table-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  padding: 13px 16px; border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.012);
}
.result { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.clear-btn { border: 0; background: none; color: var(--gold); font-size: 11.5px; padding: 2px 0; }
.clear-btn:hover { text-decoration: underline; }
.toolbar-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.select-wrap { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--faint); }
.select-wrap select {
  height: 30px; padding: 0 24px 0 9px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel-2); color: var(--text); font-size: 11.5px;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--faint) 50%), linear-gradient(135deg, var(--faint) 50%, transparent 50%);
  background-position: calc(100% - 13px) 13px, calc(100% - 9px) 13px;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; }
.provider-table { width: 100%; border-collapse: collapse; min-width: 920px; }
.provider-table th {
  text-align: left; padding: 10px 14px;
  font-size: 9.5px; font-weight: 650; letter-spacing: .11em; text-transform: uppercase;
  color: var(--faint); border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.012);
  white-space: nowrap;
}
.provider-table td {
  padding: 11px 14px; border-top: 1px solid var(--line);
  vertical-align: middle;
}
.provider-table tbody tr { cursor: pointer; transition: background .14s ease; }
.provider-table tbody tr:first-child td { border-top: 0; }
.provider-table tbody tr:hover { background: rgba(255,255,255,0.025); }
.provider-table tbody tr.is-open { background: var(--gold-soft); }
.provider-table tbody tr.is-open td:first-child { box-shadow: inset 3px 0 0 var(--gold); }
.col-no { width: 48px; }
.col-type { width: 128px; }
.col-speed { width: 82px; }
.col-keys { width: 150px; }
.col-balance { width: 100px; }
.col-status { width: 180px; }
.col-actions { width: 92px; }
.no-cell { font: 500 12px var(--mono); color: var(--faint); }
.provider-cell { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.name-line { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.provider-name { font-size: 13.5px; font-weight: 600; letter-spacing: .005em; }
.provider-url {
  max-width: 430px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font: 10.5px var(--mono); color: var(--faint);
}
.provider-url.is-empty { opacity: .5; font-style: italic; }
.badge-row { display: flex; flex-wrap: wrap; gap: 4px; }
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 18px; padding: 0 6px; border-radius: 5px;
  font-size: 9.5px; font-weight: 550; letter-spacing: .02em;
  color: var(--muted); background: rgba(255,255,255,0.045);
  border: 1px solid transparent; white-space: nowrap;
}
.badge.gold { color: var(--gold); background: var(--gold-soft); border-color: rgba(232,180,108,0.14); }
.badge.blue { color: var(--blue); background: var(--blue-soft); border-color: rgba(127,168,255,0.14); }
.badge.purple { color: var(--purple); background: var(--purple-soft); border-color: rgba(183,154,255,0.14); }
.badge.green { color: var(--green); background: var(--green-soft); border-color: rgba(95,206,147,0.14); }
.badge.red { color: var(--red); background: var(--red-soft); border-color: rgba(240,120,120,0.14); }
.badge.muted { color: var(--faint); background: rgba(255,255,255,0.03); }
.type-stack { display: flex; flex-wrap: wrap; gap: 4px; }
.type-chip {
  font-size: 9.5px; padding: 2px 6px; border-radius: 5px;
  border: 1px solid var(--line); color: var(--muted); background: transparent;
  white-space: nowrap;
}
.type-chip.official { color: var(--gold); border-color: rgba(232,180,108,0.22); }
.type-chip.relay { color: var(--blue); border-color: rgba(127,168,255,0.22); }
.type-chip.vision { color: var(--purple); border-color: rgba(183,154,255,0.22); }
.speed { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.speed-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.speed-dot.fast { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.speed-dot.mid { background: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.speed-dot.slow { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.key-cell { display: flex; align-items: center; gap: 6px; min-width: 0; }
.key-mask {
  font: 10.5px var(--mono); color: var(--muted);
  max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.key-count { font: 9.5px var(--mono); color: var(--faint); }
.balance-cell { font: 500 12px var(--mono); color: var(--text); font-variant-numeric: tabular-nums; }
.balance-cell.empty { color: var(--faint); font-weight: 400; }
.status-stack { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.live-line { display: flex; align-items: center; gap: 5px; font-size: 9.5px; color: var(--faint); white-space: nowrap; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.live-dot.ok { background: var(--green); }
.live-dot.error { background: var(--red); }
.live-dot.warn { background: var(--gold); }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 3px; }
.row-chevron { color: var(--faint); transition: transform .15s ease; }
tr:hover .row-chevron { transform: translateX(2px); color: var(--muted); }

.empty-state { padding: 60px 20px; text-align: center; }
.empty-mark { font: 300 34px var(--mono); color: var(--faint); margin-bottom: 8px; }
.empty-state h3 { font-size: 14px; font-weight: 600; }
.empty-state p { margin-top: 5px; font-size: 12px; color: var(--faint); }

.page-foot {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 2px 4px; font-size: 10.5px; color: var(--faint);
}

/* ---------- drawer ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(4, 6, 10, 0.62);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  animation: fadeIn .18s ease;
}
.drawer {
  position: fixed; top: 0; right: 0; z-index: 60;
  width: min(560px, 100vw); height: 100dvh;
  border-left: 1px solid var(--line-strong);
  background: var(--panel);
  box-shadow: var(--shadow);
  animation: slideIn .24s cubic-bezier(.22,.8,.28,1);
}
.drawer-inner { height: 100%; display: flex; flex-direction: column; }
.drawer-head {
  padding: 20px 22px 16px; border-bottom: 1px solid var(--line);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  background: linear-gradient(180deg, var(--gold-soft), transparent);
}
.drawer-kicker { font-size: 9.5px; letter-spacing: .14em; color: var(--gold); font-weight: 650; margin-bottom: 5px; }
.drawer-head h2 { font-size: 22px; font-weight: 650; letter-spacing: -.02em; }
.drawer-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 9px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 22px 26px; }
.drawer-foot {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 13px 22px; border-top: 1px solid var(--line);
  background: var(--panel-2);
}
.drawer-foot .spacer { flex: 1; }
.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.fact {
  padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px;
  background: rgba(255,255,255,0.018);
}
.fact-label { font-size: 9.5px; color: var(--faint); margin-bottom: 4px; }
.fact-value { font-size: 12px; font-weight: 550; font-variant-numeric: tabular-nums; }
.fact-value.mono { font-family: var(--mono); }
.detail-section { margin-top: 22px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.section-head h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 650; }
.endpoint-box {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--panel-2);
}
.endpoint-box code {
  flex: 1; min-width: 0; font: 10.5px var(--mono); color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.endpoint-box.empty code { color: var(--faint); font-family: var(--font); font-size: 11px; font-style: italic; }
.account-card {
  padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: rgba(255,255,255,0.018);
}
.account-card + .account-card { margin-top: 8px; }
.account-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.account-label { display: flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 550; }
.account-index { font: 9.5px var(--mono); color: var(--faint); }
.account-key {
  display: flex; align-items: center; gap: 7px; margin-top: 7px;
  padding: 5px 7px; border-radius: 6px; background: rgba(0,0,0,0.16);
}
[data-theme="light"] .account-key { background: rgba(36,31,22,0.045); }
.account-key code {
  flex: 1; min-width: 0; font: 10.5px var(--mono); color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.account-meta {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 7px;
  font-size: 9.5px; color: var(--faint);
}
.account-meta code { font-family: var(--mono); font-size: 9px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.test-line { display: inline-flex; align-items: center; gap: 5px; }
.test-line .live-dot { flex: 0 0 auto; }
.note-box {
  padding: 11px 12px; border-left: 2px solid var(--gold);
  border-radius: 0 8px 8px 0; background: var(--gold-soft);
  font-size: 11.5px; line-height: 1.65; color: var(--muted); white-space: pre-wrap;
}
.note-box.empty { border-left-color: var(--line-strong); background: rgba(255,255,255,0.02); color: var(--faint); font-style: italic; }
.report-link { margin-top: 9px; font-size: 10.5px; color: var(--faint); }

/* ---------- modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center; padding: 20px;
  background: rgba(4, 6, 10, 0.68);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  animation: fadeIn .16s ease;
}
.modal-card {
  width: min(760px, 100%); max-height: min(88vh, 900px);
  display: flex; flex-direction: column;
  border: 1px solid var(--line-strong); border-radius: 18px;
  background: var(--panel); box-shadow: var(--shadow);
  animation: popIn .2s cubic-bezier(.22,.8,.28,1);
}
.modal-card > form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 22px 14px; border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.modal-head h3 { font-size: 18px; font-weight: 650; letter-spacing: -.01em; }
.modal-head p { margin-top: 4px; font-size: 11px; color: var(--faint); }
.modal-body { flex: 1 1 auto; padding: 18px 22px; overflow-y: auto; min-height: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 13px 22px; border-top: 1px solid var(--line); background: var(--panel-2); border-radius: 0 0 18px 18px; flex: 0 0 auto; }
.form-grid { display: grid; grid-template-columns: 1.4fr 0.6fr; gap: 13px 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field > label, .field > span.label { font-size: 10.5px; color: var(--muted); font-weight: 550; letter-spacing: .02em; }
.field input[type="text"], .field input[type="number"], .field select, .field textarea {
  width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--panel-2); color: var(--text); font-size: 12.5px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field select { height: 38px; padding-top: 0; padding-bottom: 0; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 0; border-color: rgba(232,180,108,0.45); box-shadow: 0 0 0 3px var(--gold-soft); }
.form-hint { font-size: 10.5px; line-height: 1.55; color: var(--faint); }
.modal-card.modal-sm { width: min(440px, 100%); }
.field textarea { resize: vertical; min-height: 66px; line-height: 1.55; }
.field-hint { font-size: 10px; color: var(--faint); }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg label {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 11.5px; color: var(--muted); background: var(--panel-2); cursor: pointer;
}
.seg label:has(input:checked) { border-color: rgba(232,180,108,0.36); color: var(--gold); background: var(--gold-soft); }
.seg input { accent-color: var(--gold); margin: 0; }
.account-editor { display: flex; flex-direction: column; gap: 9px; }
.account-row {
  display: grid; grid-template-columns: 110px 1fr 1.2fr 30px; gap: 7px; align-items: start;
  padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,0.015);
}
.account-row input { width: 100%; }
.account-row input[type="text"] { padding: 8px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); color: var(--text); font-size: 11.5px; }
.account-row input[type="text"]:focus { outline: 0; border-color: rgba(232,180,108,0.45); }
.account-row .mini-btn { align-self: center; color: var(--red); }
.account-row-heads { display: grid; grid-template-columns: 110px 1fr 1.2fr 30px; gap: 7px; padding: 0 10px; font-size: 9.5px; color: var(--faint); }
.form-error { margin-top: 12px; padding: 9px 10px; border-radius: 8px; background: var(--red-soft); color: var(--red); font-size: 11.5px; display: none; }
.form-error.is-visible { display: block; }

.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 100;
  transform: translate(-50%, 10px);
  padding: 10px 15px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--panel-3);
  color: var(--text); font-size: 12px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
  max-width: min(420px, 90vw);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { border-color: rgba(240,120,120,0.4); color: var(--red); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { transform: translateX(34px); opacity: .4; } to { transform: translateX(0); opacity: 1; } }
@keyframes popIn { from { transform: translateY(8px) scale(.985); opacity: .4; } to { transform: none; opacity: 1; } }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .main { padding-left: 24px; padding-right: 24px; }
  .topbar { margin-left: -24px; margin-right: -24px; padding-left: 24px; padding-right: 24px; }
  .search { width: 210px; }
  .provider-url { max-width: 300px; }
}
@media (max-width: 980px) {
  .app { grid-template-columns: 212px minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .top-actions .btn.ghost { display: none; }
}
@media (max-width: 820px) {
  .app { display: block; }
  .sidebar {
    position: relative; height: auto; width: 100%;
    flex-direction: row; align-items: center; gap: 14px; flex-wrap: wrap;
    padding: 14px 16px; border-right: 0; border-bottom: 1px solid var(--line);
    overflow: visible;
  }
  .brand { padding: 0; }
  .brand-mark { width: 34px; height: 34px; border-radius: 10px; }
  .brand-text p { display: none; }
  .side-nav { flex-direction: row; gap: 4px; overflow-x: auto; max-width: 100%; }
  .side-link { width: auto; padding: 7px 10px; white-space: nowrap; font-size: 12px; gap: 8px; }
  .side-link .side-count { display: none; }
  .side-section, .side-note { display: none; }
  .main { padding: 18px 16px 34px; }
  .topbar { position: relative; margin: 0; padding: 0 0 14px; background: none; backdrop-filter: none; border-bottom: 0; }
  .top-actions { width: 100%; }
  .search { flex: 1; width: auto; min-width: 180px; }
  .top-actions .btn.ghost { display: inline-flex; }
  .heading h2 { font-size: 22px; }
  .table-toolbar { align-items: flex-start; }
  .provider-table { min-width: 760px; }
  .page-foot { flex-direction: column; gap: 4px; }
}
@media (max-width: 620px) {
  .col-type, .col-speed, .col-balance, .col-keys, .col-actions { display: none; }
  .provider-table { min-width: 0; }
  .provider-table th, .provider-table td { padding-left: 8px; padding-right: 8px; }
  .col-no { width: 36px; }
  .col-status { width: 112px; }
  .provider-url { max-width: 185px; }
  .drawer { width: 100vw; max-width: 100vw; }
  .drawer-body { overflow-x: hidden; }
  .endpoint-box code { white-space: nowrap; }
  .stats { gap: 8px; }
  .stat-card { padding: 13px 13px 11px; border-radius: 12px; }
  .stat-value { font-size: 23px; }
  .stat-meta { font-size: 9.5px; }
  .top-actions .btn.ghost { padding: 0 10px; }
  .top-actions .btn.primary { flex: 1; }
  .search { flex-basis: 100%; order: -1; }
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .drawer-head { padding: 16px 16px 13px; }
  .drawer-body { padding: 14px 16px 22px; }
  .drawer-foot { padding: 11px 16px; }
  .modal-overlay { padding: 0; align-items: end; }
  .modal-card { max-height: 94vh; border-radius: 18px 18px 0 0; }
  .modal-foot { border-radius: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .account-row { grid-template-columns: 1fr 1fr 30px; }
  .account-row .acc-url { grid-column: 1 / 3; }
  .account-row-heads { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}


/* ---------- Nudge variable consumers ---------- */
body { font-size: calc(14px * var(--site-type, 1)); }
.heading h2 { font-size: calc(25px * var(--site-type, 1)); }
.brand-text h1 { font-size: calc(15.5px * var(--site-type, 1)); }
.provider-name { font-size: calc(13.5px * var(--site-type, 1)); }
.drawer-head h2 { font-size: calc(22px * var(--site-type, 1)); }
.modal-head h3 { font-size: calc(18px * var(--site-type, 1)); }
.stat-value { font-size: calc(29px * var(--site-type, 1)); }
.main { gap: calc(20px * var(--site-space, 1)); }
.stats { gap: calc(12px * var(--site-space, 1)); }
.topbar { padding-top: calc(20px * var(--site-space, 1)); padding-bottom: calc(16px * var(--site-space, 1)); }
.modal-card, .stat-card, .table-panel { border-radius: var(--site-radius); }
.btn { transition-duration: calc(.15s * var(--site-motion, 1)); }
.side-link, .provider-table tbody tr { transition-duration: calc(.16s * var(--site-motion, 1)); }
.drawer { animation-duration: calc(.24s * var(--site-motion, 1)); }
.toast { transition-duration: calc(.2s * var(--site-motion, 1)); }

/* ---------- cloud sync ---------- */
.sync-btn { position: relative; }
.sync-dot {
  position: absolute; top: 6px; right: 6px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--faint); border: 1px solid var(--panel);
}
.sync-dot[data-state="synced"] { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.sync-dot[data-state="syncing"] { background: var(--gold); animation: syncPulse 1.1s ease-in-out infinite; }
.sync-dot[data-state="conflict"], .sync-dot[data-state="error"] { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
@keyframes syncPulse { 50% { opacity: .35; } }
#syncModalRoot .modal-foot { flex-wrap: wrap; }
#syncModalRoot .spacer { flex: 1; }
.sync-copy { font-size: 12px; line-height: 1.7; color: var(--muted); margin-bottom: 12px; }
.sync-hint { margin-top: 9px; }
.sync-summary { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 9px; font-size: 11.5px; color: var(--muted); }
.sync-pill {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px;
  border-radius: 6px; font-size: 10.5px; font-weight: 600;
  color: var(--faint); background: rgba(255,255,255,0.04);
}
.sync-pill[data-state="synced"] { color: var(--green); background: var(--green-soft); }
.sync-pill[data-state="syncing"] { color: var(--gold); background: var(--gold-soft); }
.sync-pill[data-state="conflict"], .sync-pill[data-state="error"] { color: var(--red); background: var(--red-soft); }
.sync-alert {
  margin: 10px 0 0; padding: 9px 10px; border-radius: 8px;
  border: 1px solid rgba(240,120,120,0.24); background: var(--red-soft);
  color: var(--red); font-size: 11.5px; line-height: 1.6;
}
@media (max-width: 620px) {
  #syncModalRoot .modal-foot .btn { flex: 1; }
}
