:root {
  --bg: #0b0d10;
  --panel: #12151a;
  --panel-2: #171b21;
  --border: #23272f;
  --text: #e6e9ee;
  --dim: #9aa3af;
  --faint: #6b7484;
  --accent: #35d07f;
  --accent-dim: #1d7a4c;
  --amber: #e8a13a;
  --red: #e5484d;
  --radius: 10px;
  --radius-s: 6px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 400 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent-dim); color: #fff; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
h1 { font-size: 28px; line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 10px; font-weight: 650; text-wrap: balance; }
h2 { font-size: 19px; letter-spacing: -0.01em; margin: 28px 0 10px; font-weight: 620; }
h3 { font-size: 15px; margin: 0 0 8px; font-weight: 620; }
p { margin: 0 0 12px; }
.dim { color: var(--dim); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }

/* top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; height: 54px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  position: sticky; top: 0; z-index: 20;
}
.wordmark { color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: -0.02em; font-size: 17px; }
.wordmark .dot { color: var(--accent); }
.topnav { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.topnav a { color: var(--dim); text-decoration: none; }
.topnav a:hover { color: var(--text); }
.balance-chip {
  font-family: var(--mono); font-size: 13px; color: var(--text);
  border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px;
  background: var(--panel-2);
}
.balance-chip b { color: var(--accent); font-weight: 600; }

/* layout */
.wrap { max-width: 1060px; margin: 0 auto; padding: 36px 20px 72px; }
.app-shell { display: grid; grid-template-columns: 208px 1fr; min-height: calc(100vh - 54px); }
.sidenav {
  border-right: 1px solid var(--border); background: var(--panel);
  padding: 18px 10px; display: flex; flex-direction: column; gap: 2px;
}
.sidenav a {
  color: var(--dim); text-decoration: none; font-size: 14px;
  padding: 7px 10px; border-radius: var(--radius-s);
}
.sidenav a:hover { color: var(--text); background: var(--panel-2); }
.sidenav a.active { color: var(--text); background: var(--panel-2); box-shadow: inset 2px 0 0 var(--accent); }
.sidenav .nav-label { font-size: 11px; color: var(--faint); padding: 14px 10px 4px; letter-spacing: 0.06em; text-transform: uppercase; }
.app-main { padding: 26px 28px 72px; min-width: 0; }
.app-main h1 { font-size: 22px; }

/* panels, tables, forms */
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.panel + .panel { margin-top: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stat-strip { display: flex; flex-wrap: wrap; gap: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.stat { padding: 14px 18px; border-right: 1px solid var(--border); min-width: 150px; flex: 1; }
.stat:last-child { border-right: none; }
.stat .v { font-size: 21px; font-weight: 650; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.stat .k { font-size: 12px; color: var(--dim); margin-top: 2px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--dim); font-weight: 550; font-size: 12.5px; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--panel-2); }
.table-wrap { overflow-x: auto; }
label { display: block; font-size: 13px; color: var(--dim); margin: 12px 0 5px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"] {
  width: 100%; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-s);
  padding: 9px 11px; font: inherit; font-size: 14px; caret-color: var(--accent);
}
input:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input::placeholder { color: var(--faint); }
.btn {
  display: inline-block; border: 1px solid var(--accent-dim); background: var(--accent);
  color: #06230f; font-weight: 620; font-size: 14px;
  padding: 8px 16px; border-radius: var(--radius-s); cursor: pointer; text-decoration: none;
  transition: filter 150ms ease-out;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; filter: none; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--border); font-weight: 550; }
.btn.ghost:hover { border-color: var(--dim); filter: none; }
.btn.danger { background: transparent; color: var(--red); border-color: #4a2326; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.form-error { color: #ff8589; font-size: 14px; margin-top: 10px; min-height: 20px; }
.badge { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--dim); }
.badge.ok { color: var(--accent); border-color: var(--accent-dim); }
.badge.bad { color: #ff8589; border-color: #4a2326; }
.badge.warn { color: var(--amber); border-color: #4d3a17; }
code, pre { font-family: var(--mono); font-size: 13px; }
pre.code {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; overflow-x: auto; line-height: 1.5; margin: 0;
}
.secret-box {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  background: var(--bg); border: 1px solid var(--accent-dim); border-radius: var(--radius-s);
  padding: 10px 12px; margin-top: 10px;
}
.secret-box code { word-break: break-all; color: var(--accent); }
.empty { color: var(--dim); padding: 18px 10px; text-align: center; font-size: 14px; }
.toast {
  position: fixed; right: 18px; bottom: 18px; z-index: 50;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius-s); padding: 10px 14px; font-size: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.45);
}
.toast.err { border-color: #4a2326; color: #ff8589; }
.row { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.row > div { flex: 1; min-width: 160px; }
.auth-panel { max-width: 400px; margin: 56px auto; }
.landing-grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 28px; align-items: start; margin-top: 22px; }
.status-line { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--dim); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.status-dot.on { background: var(--accent); }
.status-dot.off { background: var(--red); }
.credit-input { width: 110px !important; display: inline-block; }
@media (max-width: 820px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidenav { flex-direction: row; flex-wrap: wrap; border-right: none; border-bottom: 1px solid var(--border); }
  .sidenav .nav-label { width: 100%; padding-top: 8px; }
  .grid2, .landing-grid { grid-template-columns: 1fr; }
  .app-main { padding: 20px 16px 60px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
