:root {
  --bg: #f4f2ec; --panel: #fbfaf6; --panel-2: #efece4; --fg: #16150f; --mute: #6b685d; --faint: #9a968a;
  --line: #e0dccf; --line-2: #cfcabb; --acc: #c2410c; --acc-bg: #fde7d6; --ok: #15803d; --ok-bg: #dcf3e2;
  --warn: #a16207; --warn-bg: #fbf0cf; --bad: #b91c1c; --bad-bg: #fbe1df; --info: #1d4ed8; --info-bg: #dfe8fb;
  --prem: #7c3aed; --prem-bg: #ede6fd;
  --r: 10px; --sans: "Geist", ui-sans-serif, system-ui, sans-serif; --mono: "Geist Mono", ui-monospace, Menlo, monospace;
  --serif: "Instrument Serif", ui-serif, Georgia, serif;
  --shadow: 0 1px 0 rgba(22,21,15,.04), 0 8px 24px -12px rgba(22,21,15,.18);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11110e; --panel: #181814; --panel-2: #20201b; --fg: #eeebe2; --mute: #a29e91; --faint: #6f6c62;
    --line: #2a2924; --line-2: #3a3832; --acc: #fb923c; --acc-bg: #3a2414; --ok: #4ade80; --ok-bg: #12301d;
    --warn: #facc15; --warn-bg: #33290d; --bad: #f87171; --bad-bg: #3a1615; --info: #93b4ff; --info-bg: #17223b;
    --prem: #c4b5fd; --prem-bg: #251c3d; --shadow: 0 1px 0 rgba(0,0,0,.3), 0 10px 30px -12px rgba(0,0,0,.6);
  }
}
:root[data-theme="dark"] {
  --bg: #11110e; --panel: #181814; --panel-2: #20201b; --fg: #eeebe2; --mute: #a29e91; --faint: #6f6c62;
  --line: #2a2924; --line-2: #3a3832; --acc: #fb923c; --acc-bg: #3a2414; --ok: #4ade80; --ok-bg: #12301d;
  --warn: #facc15; --warn-bg: #33290d; --bad: #f87171; --bad-bg: #3a1615; --info: #93b4ff; --info-bg: #17223b;
  --prem: #c4b5fd; --prem-bg: #251c3d; --shadow: 0 1px 0 rgba(0,0,0,.3), 0 10px 30px -12px rgba(0,0,0,.6);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font: 14.5px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
code, .mono { font-family: var(--mono); font-size: .92em; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--mute); }

/* layout */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { border-right: 1px solid var(--line); padding: 18px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; background: var(--bg); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; font-weight: 600; font-size: 16px; letter-spacing: -.01em; }
.brand img { width: 26px; height: 26px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--mute); font-weight: 500; }
.nav a:hover { color: var(--fg); background: var(--panel-2); }
.nav a.on { color: var(--fg); background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); }
.nav svg { width: 17px; height: 17px; flex: none; }
.side .grow { flex: 1; }
.me { border-top: 1px solid var(--line); padding: 12px 8px 0; font-size: 13px; color: var(--mute); display: grid; gap: 6px; }
.me b { color: var(--fg); font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
main.page { padding: 34px 44px 80px; max-width: 1180px; width: 100%; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.head h1 { font: 400 40px/1 var(--serif); margin: 0; letter-spacing: -.01em; }
.head .sub { color: var(--mute); margin-top: 8px; }
.crumb { font-size: 13px; color: var(--mute); margin-bottom: 10px; }
.crumb a { text-decoration: none; } .crumb a:hover { text-decoration: underline; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack > * + * { margin-top: 14px; }
.mute { color: var(--mute); } .faint { color: var(--faint); } .small { font-size: 13px; } .tiny { font-size: 12px; }
.hr { height: 1px; background: var(--line); margin: 18px 0; }

/* panels */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.card .desc { color: var(--mute); font-size: 13.5px; margin: 0 0 16px; }
.card.flush { padding: 0; overflow: hidden; }
.section-title { font: 600 11.5px var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--faint); margin: 30px 0 12px; }
.stat { padding: 16px 18px; }
.stat .k { font-size: 12.5px; color: var(--mute); } .stat .v { font: 400 30px/1.1 var(--serif); margin-top: 6px; }

/* buttons & inputs */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel); cursor: pointer; font-weight: 500; text-decoration: none; white-space: nowrap; line-height: 1.3; }
.btn:hover { border-color: var(--fg); }
.btn.primary { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn.primary:hover { opacity: .88; }
.btn.acc { background: var(--acc); border-color: var(--acc); color: #fff; }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.btn.danger:hover { background: var(--bad-bg); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }
label.f { display: grid; gap: 6px; font-size: 13px; font-weight: 500; }
label.f .hint { font-weight: 400; color: var(--mute); font-size: 12.5px; }
.in, select.in, textarea.in { width: 100%; padding: 9px 12px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--bg); outline: none; }
.in:focus { border-color: var(--fg); box-shadow: 0 0 0 3px color-mix(in srgb, var(--fg) 10%, transparent); }
textarea.in { font-family: var(--mono); font-size: 13px; min-height: 120px; resize: vertical; }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); }
.check:first-child { border-top: 0; }
.check .t { font-weight: 500; } .check .d { color: var(--mute); font-size: 13px; }
.switch { position: relative; width: 36px; height: 21px; flex: none; margin-top: 1px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line-2); border-radius: 99px; transition: .15s; cursor: pointer; }
.switch span:before { content: ""; position: absolute; width: 15px; height: 15px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span:before { transform: translateX(15px); }
.copy { display: flex; align-items: center; gap: 6px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 6px 6px 12px; font: 12.5px var(--mono); }
.copy span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 500; background: var(--panel-2); color: var(--mute); white-space: nowrap; }
.badge:before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain:before { display: none; }
.b-ok { background: var(--ok-bg); color: var(--ok); } .b-bad { background: var(--bad-bg); color: var(--bad); }
.b-warn { background: var(--warn-bg); color: var(--warn); } .b-info { background: var(--info-bg); color: var(--info); }
.b-prem { background: var(--prem-bg); color: var(--prem); } .b-acc { background: var(--acc-bg); color: var(--acc); }
.pulse:before { animation: pulse 1.2s infinite; } @keyframes pulse { 50% { opacity: .25; } }

/* site cards */
.sites { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.site { display: block; text-decoration: none; padding: 0; overflow: hidden; transition: border-color .15s, transform .15s; }
.site:hover { border-color: var(--line-2); transform: translateY(-1px); }
.site .thumb { height: 120px; background: repeating-linear-gradient(135deg, var(--panel-2) 0 10px, var(--panel) 10px 20px); border-bottom: 1px solid var(--line); display: grid; place-items: center; position: relative; overflow: hidden; }
.site .thumb iframe { position: absolute; inset: 0; width: 400%; height: 400%; transform: scale(.25); transform-origin: 0 0; border: 0; pointer-events: none; background: #fff; }
.site .body { padding: 14px 16px; }
.site .name { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.fav { width: 18px; height: 18px; border-radius: 4px; object-fit: contain; background: var(--panel-2); flex: none; }
.fav.lg { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); }
.site .url { color: var(--mute); font-size: 12.5px; font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.site .meta { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; font-size: 12.5px; color: var(--mute); }

/* dropzone */
.drop { border: 1.5px dashed var(--line-2); border-radius: 14px; padding: 34px 20px; text-align: center; background: var(--panel); transition: .15s; cursor: pointer; }
.drop.over { border-color: var(--acc); background: var(--acc-bg); }
.drop .big { font: 400 26px/1.15 var(--serif); }
.drop .mute { margin-top: 6px; }
.drop.compact { padding: 22px; }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 24px; overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--mute); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--fg); } .tabs a.on { color: var(--fg); border-color: var(--fg); }

/* tables */
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.t th { text-align: left; font-weight: 500; color: var(--mute); font-size: 12.5px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel-2); white-space: nowrap; }
.t td { padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.t tr:last-child td { border-bottom: 0; }
.t tr.click { cursor: pointer; } .t tr.click:hover td { background: var(--panel-2); }
.empty { padding: 40px 20px; text-align: center; color: var(--mute); }

/* log */
.log { background: #0e0e0b; color: #d9d5c8; font: 12.5px/1.6 var(--mono); padding: 16px 18px; border-radius: var(--r); max-height: 560px; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.log .e { color: #fca5a5; } .log .o { color: #86efac; }

/* chart */
.chart { display: flex; align-items: flex-end; gap: 3px; height: 150px; padding-top: 10px; }
.chart .bar { flex: 1; background: var(--acc); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .85; position: relative; }
.chart .bar:hover { opacity: 1; }
.chart .bar:hover:after { content: attr(data-tip); position: absolute; bottom: 100%; left: 50%; transform: translate(-50%, -6px); background: var(--fg); color: var(--bg); font-size: 11.5px; padding: 3px 7px; border-radius: 5px; white-space: nowrap; z-index: 3; }
.meter { height: 8px; background: var(--panel-2); border-radius: 99px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--acc); }
.list-bar { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 13.5px; }
.list-bar .lb { position: relative; padding: 5px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 12.5px; }
.list-bar .lb i { position: absolute; inset: 0; background: var(--acc-bg); border-radius: 5px; z-index: 0; }
.list-bar .lb span { position: relative; }
.list-bar .n { padding: 5px 0; color: var(--mute); font-variant-numeric: tabular-nums; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(10,10,8,.45); display: grid; place-items: center; z-index: 50; padding: 20px; animation: fade .12s; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; width: min(620px, 100%); max-height: calc(100vh - 40px); overflow: auto; box-shadow: 0 30px 80px -20px rgba(0,0,0,.45); }
.modal header { padding: 20px 22px 0; } .modal header h2 { margin: 0; font: 400 28px/1.1 var(--serif); }
.modal .mb { padding: 18px 22px; } .modal footer { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; background: var(--panel-2); }
@keyframes fade { from { opacity: 0; } }
.choice { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.choice label { border: 1px solid var(--line-2); border-radius: 10px; padding: 12px 14px; cursor: pointer; display: grid; gap: 2px; }
.choice input { display: none; }
.choice label:has(input:checked) { border-color: var(--fg); box-shadow: inset 0 0 0 1px var(--fg); background: var(--bg); }
.choice b { font-weight: 600; } .choice small { color: var(--mute); }

/* toasts */
#toasts { position: fixed; bottom: 20px; right: 20px; display: grid; gap: 8px; z-index: 100; }
.toast { background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 13.5px; box-shadow: var(--shadow); max-width: 380px; animation: fade .15s; }
.toast.err { background: var(--bad); color: #fff; }

/* auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth .art { background: #16150f; color: #efece4; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth .art h1 { font: 400 clamp(44px, 5.4vw, 76px)/.98 var(--serif); margin: 0; letter-spacing: -.02em; max-width: 9ch; }
.auth .art h1 em { color: #fb923c; }
.auth .art ul { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 8px; color: #b8b4a7; font-size: 14px; }
.auth .art li:before { content: "— "; color: #fb923c; }
.plinths { position: absolute; right: -40px; bottom: -10px; display: grid; gap: 10px; justify-items: end; opacity: .9; }
.plinths i { display: block; height: 34px; border-radius: 4px; background: #24231d; }
.plinths i:nth-child(1) { width: 120px; } .plinths i:nth-child(2) { width: 220px; } .plinths i:nth-child(3) { width: 330px; background: #fb923c; }
.auth form { align-self: center; justify-self: center; width: min(380px, 90%); display: grid; gap: 14px; }
.auth form h2 { font: 400 34px/1 var(--serif); margin: 0 0 6px; }
.err-box { background: var(--bad-bg); color: var(--bad); padding: 10px 12px; border-radius: 8px; font-size: 13.5px; }
.note { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: 13.5px; color: var(--mute); }
.note b { color: var(--fg); }
.prem-hero { background: linear-gradient(135deg, var(--prem-bg), var(--panel)); border-color: color-mix(in srgb, var(--prem) 30%, var(--line)); }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 16px; font-size: 13.5px; }
.kv dt { color: var(--mute); } .kv dd { margin: 0; overflow: hidden; text-overflow: ellipsis; }
.env-row { display: grid; grid-template-columns: 1fr 1.6fr auto; gap: 8px; margin-bottom: 8px; }
.mobile-top { display: none; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 30% 0 0; z-index: 40; transform: translateX(-102%); transition: .2s; box-shadow: var(--shadow); }
  .side.open { transform: none; }
  .mobile-top { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 30; }
  main.page { padding: 22px 16px 60px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr 1fr; }
  .auth { grid-template-columns: 1fr; } .auth .art { min-height: 260px; padding: 28px; }
  .head h1 { font-size: 32px; }
  .kv { grid-template-columns: 1fr; } .kv dt { margin-top: 6px; }
  .env-row { grid-template-columns: 1fr; }
  .t { display: block; overflow-x: auto; }
}
@media (max-width: 560px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }
