/* The console. Same Abyss palette as the app and the site, so the three read
   as one thing — but flatter and denser, because this is a workbench rather
   than a page anybody is meant to enjoy looking at. */

:root {
  --abyss: #03101B;
  --deep: #07202F;
  --midwater: #0A3B4E;
  --shallow: #0E5C6B;
  --cyan: #3FE0D0;
  --biolum: #7CF5FF;
  --goby: #FFB454;
  --coral: #FF6B7A;
  --kelp: #5AD68A;
  --anemone: #B98CFF;

  --ink: #EAF7FA;
  --ink-dim: rgba(234, 247, 250, .68);
  --ink-faint: rgba(234, 247, 250, .42);
  --hairline: rgba(255, 255, 255, .09);
  --rim: rgba(124, 245, 255, .22);
  --panel: rgba(8, 24, 36, .82);

  --font: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 14px;
}

* { box-sizing: border-box; }

/* An author rule that sets `display` beats the user agent's `[hidden]`, whatever
   the specificity — so `.stack`, `.rows` and the section grids all kept showing
   things the script had hidden. This puts `hidden` back in charge. */
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  color: var(--ink);
  background:
    radial-gradient(1200px 700px at 12% -10%, rgba(14, 92, 107, .5), transparent 60%),
    radial-gradient(900px 600px at 92% 0%, rgba(10, 59, 78, .45), transparent 55%),
    var(--abyss);
  background-attachment: fixed;
}

h1, h2 { margin: 0; font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 16px; }
code { font-family: var(--mono); font-size: .88em; color: var(--biolum); }
a { color: var(--cyan); }
:focus-visible { outline: 2px solid var(--biolum); outline-offset: 2px; border-radius: 6px; }

/* ------------------------------------------------------------------ mark */
/* The mudskipper's eye, reduced to what still reads at 28px. */
.mark {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(150deg, var(--shallow), var(--deep));
  border: 1px solid var(--rim); box-shadow: 0 0 24px rgba(63, 224, 208, .18);
}
.mark span { width: 15px; height: 15px; border-radius: 50%; background: var(--goby);
             box-shadow: 0 0 12px rgba(255, 180, 84, .7), inset -3px -3px 0 rgba(0, 0, 0, .35); }
.mark.small { width: 28px; height: 28px; border-radius: 9px; }
.mark.small span { width: 9px; height: 9px; }

/* ------------------------------------------------------------------ gate */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.gate-card {
  width: min(420px, 100%); padding: 32px; border-radius: 20px;
  background: var(--panel); border: 1px solid var(--hairline);
  backdrop-filter: blur(14px); text-align: center;
}
.gate-card .mark { margin: 0 auto 16px; }
.gate-card h1 { font-size: 22px; }
.gate-sub { color: var(--ink-dim); font-size: 14px; margin: 8px 0 24px; }
.gate-note {
  margin: 18px 0 0; padding: 10px 12px; border-radius: 10px; font-size: 13px; line-height: 1.5;
  background: rgba(255, 107, 122, .12); border: 1px solid rgba(255, 107, 122, .3); color: #FFC9CF;
  text-align: left;
}
.gate-note.ok { background: rgba(90, 214, 138, .12); border-color: rgba(90, 214, 138, .3); color: #BFF0D2; }

/* ----------------------------------------------------------------- forms */
.stack { display: grid; gap: 14px; text-align: left; }
label { display: grid; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--ink-dim); }
label small { font-weight: 500; color: var(--ink-faint); font-size: 11.5px; }
label.inline { display: flex; align-items: center; gap: 7px; font-size: 12.5px; }
input, select, textarea {
  font: inherit; font-size: 14px; color: var(--ink);
  padding: 9px 11px; border-radius: 9px;
  background: rgba(3, 16, 27, .6); border: 1px solid var(--hairline);
}
input[type="checkbox"] { width: auto; padding: 0; accent-color: var(--cyan); }
input:focus, select:focus, textarea:focus { border-color: var(--rim); outline: none; box-shadow: 0 0 0 3px rgba(63, 224, 208, .12); }
select option { background: var(--deep); }
textarea { resize: vertical; min-height: 60px; font-family: var(--mono); font-size: 12.5px; }

button {
  font: inherit; font-weight: 700; font-size: 13.5px; cursor: pointer;
  padding: 8px 14px; border-radius: 9px; border: 1px solid transparent;
  transition: filter .15s, background .15s;
}
button:hover { filter: brightness(1.12); }
.primary { background: var(--cyan); color: #03101B; }
.ghost { background: transparent; border-color: var(--hairline); color: var(--ink-dim); }
.ghost:hover { color: var(--ink); border-color: var(--rim); }
.danger { background: transparent; border-color: rgba(255, 107, 122, .35); color: #FFA8B2; }

/* ------------------------------------------------------------------- bar */
.bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 12px 22px; background: rgba(3, 16, 27, .84);
  border-bottom: 1px solid var(--hairline); backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-text { font-weight: 800; font-size: 14.5px; }
.brand-text small { font-weight: 700; font-size: 10.5px; color: var(--ink-faint); margin-left: 3px; }
.tabs { display: flex; gap: 3px; margin-inline: auto; flex-wrap: wrap; }
.tabs button { background: transparent; color: var(--ink-faint); }
.tabs button:hover { color: var(--ink-dim); }
.tabs button.on { background: rgba(63, 224, 208, .12); color: var(--biolum); }
.who { display: flex; align-items: center; gap: 12px; font-size: 12.5px; color: var(--ink-faint); }

main { max-width: 1180px; margin-inline: auto; padding: 24px 22px 80px; display: grid; gap: 18px; }
main > section { display: grid; gap: 18px; }

/* ----------------------------------------------------------------- panel */
.panel {
  background: var(--panel); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 18px;
}
.panel-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.panel-head h2 { margin-right: auto; }
.hint.tight { margin: 0; }
.mono.wrap { word-break: break-all; }
.hint { margin: 0 0 14px; font-size: 12.5px; line-height: 1.6; color: var(--ink-faint); max-width: 70ch; }
.split { display: grid; gap: 18px; grid-template-columns: 1fr 1fr; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }

/* ----------------------------------------------------------------- cards */
.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); }
.card {
  background: var(--panel); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 15px 17px;
}
.card .k { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint); }
.card .v { font-size: 25px; font-weight: 800; margin-top: 5px; letter-spacing: -.02em; }
.card .s { font-size: 12px; color: var(--ink-faint); margin-top: 3px; }
.card.warn .v { color: var(--goby); }
.card.bad .v { color: var(--coral); }

/* ----------------------------------------------------------------- chart */
/* Bars, drawn with grid rather than SVG — thirty numbers do not need a
   drawing library, and this way they inherit the palette. */
.chart { display: flex; align-items: flex-end; gap: 3px; height: 130px; }
.chart .bar {
  /* Capped, so a service with three days of history shows three bars rather
     than one band across the panel that reads as a progress meter. */
  flex: 1 1 0; min-width: 4px; max-width: 46px; border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, var(--cyan), rgba(14, 92, 107, .6));
  position: relative; min-height: 2px;
}
.chart .bar.err { background: linear-gradient(180deg, var(--coral), rgba(107, 30, 40, .6)); }
.chart .bar:hover::after {
  content: attr(data-label); position: absolute; bottom: 100%; left: 50%; transform: translate(-50%, -6px);
  background: var(--deep); border: 1px solid var(--rim); border-radius: 7px;
  padding: 5px 8px; font-size: 11.5px; white-space: nowrap; z-index: 5; color: var(--ink);
}

/* ----------------------------------------------------------------- rows */
.rows { display: grid; }
.row {
  display: grid; gap: 12px; align-items: center; padding: 11px 2px;
  border-top: 1px solid var(--hairline); font-size: 13.5px;
}
.rows .row:first-child { border-top: none; }
.row .name { font-weight: 700; }
.row .meta { font-size: 12px; color: var(--ink-faint); margin-top: 2px; }
.row .actions { display: flex; gap: 6px; justify-content: flex-end; }
.row.head { font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase;
            color: var(--ink-faint); border-top: none; padding-bottom: 6px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.empty { padding: 26px 0; text-align: center; color: var(--ink-faint); font-size: 13px; }

.rows.keys .row     { grid-template-columns: 2fr 1.3fr 1.5fr auto; }
.rows.models .row   { grid-template-columns: 2fr 1.6fr 1fr auto; }
.rows.providers .row{ grid-template-columns: 1.6fr 1.6fr 1fr auto; }
.rows.log .row      { grid-template-columns: 116px 68px 1.3fr 1.2fr 1fr; }
.rows.mini .row     { grid-template-columns: 1fr auto; }
@media (max-width: 720px) {
  .rows.keys .row, .rows.models .row, .rows.providers .row, .rows.log .row {
    grid-template-columns: 1fr; gap: 5px;
  }
  .row .actions { justify-content: flex-start; }
  .right { text-align: left; }
}

/* ------------------------------------------------------------------ pill */
.pill {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 800; letter-spacing: .02em;
  background: rgba(255, 255, 255, .07); color: var(--ink-dim);
}
.pill.ok    { background: rgba(90, 214, 138, .16); color: #9DE9BB; }
.pill.off   { background: rgba(255, 255, 255, .06); color: var(--ink-faint); }
.pill.bad   { background: rgba(255, 107, 122, .16); color: #FFA8B2; }
.pill.warn  { background: rgba(255, 180, 84, .16); color: #FFD39B; }
.pill.wire  { background: rgba(185, 140, 255, .16); color: #D6BEFF; }
.pill.strict{ background: rgba(124, 245, 255, .14); color: var(--biolum); }

/* ---------------------------------------------------------------- dialog */
dialog {
  border: 1px solid var(--hairline); border-radius: 18px; padding: 22px;
  background: #08192a; color: var(--ink); width: min(520px, calc(100% - 32px));
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}
dialog::backdrop { background: rgba(3, 16, 27, .72); backdrop-filter: blur(3px); }
dialog h2 { margin-bottom: 14px; }
dialog menu { display: flex; gap: 8px; justify-content: flex-end; margin: 20px 0 0; padding: 0; }
.dialog-error {
  margin: 14px 0 0; padding: 9px 11px; border-radius: 9px; font-size: 12.5px;
  background: rgba(255, 107, 122, .12); border: 1px solid rgba(255, 107, 122, .3); color: #FFC9CF;
}
.token {
  font-family: var(--mono); font-size: 13px; user-select: all; word-break: break-all;
  background: rgba(3, 16, 27, .7); border: 1px solid var(--rim);
  border-radius: 10px; padding: 13px; margin: 0; color: var(--biolum);
}
.checks { display: grid; gap: 6px; max-height: 190px; overflow-y: auto; padding: 4px 2px; }

/* ----------------------------------------------------------------- toast */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  padding: 10px 16px; border-radius: 11px; font-size: 13.5px; font-weight: 700; z-index: 50;
  background: var(--deep); border: 1px solid var(--rim); box-shadow: 0 12px 40px rgba(0, 0, 0, .5);
}
.toast.bad { border-color: rgba(255, 107, 122, .45); color: #FFC9CF; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
