/* The service's shared skin.
 *
 * The custom properties are lifted verbatim from the monitor's app.html so the
 * two halves of the product look like one thing. Everything below them is
 * layout the monitor does not need: page chrome, cards, tables, forms, charts.
 *
 * This is the only stylesheet the service pages share. Each page keeps its own
 * page-specific rules inline, which is what makes a page editable and
 * reloadable on its own. */

:root{
  --bg:#0b1017; --bg-1:#0f1621; --bg-2:#141d2b; --bg-3:#1a2536;
  --line:#22304a; --line-2:#2c3d5c;
  --fg:#dce6f5; --fg-dim:#8ea0bd; --fg-faint:#5d708f;
  --blue:#3b82f6; --blue-2:#60a5fa; --blue-dim:#1d4ed8; --blue-ghost:#12203a;
  --ok:#34d399; --warn:#fbbf24; --err:#f87171; --run:#38bdf8; --idle:#64748b;
  --mono:'JetBrains Mono',ui-monospace,'SF Mono',Menlo,Consolas,monospace;
  --sans:'Inter',system-ui,-apple-system,'Segoe UI',sans-serif;
  --top:52px;
}
*{box-sizing:border-box}
html,body{margin:0;min-height:100%}
body{background:var(--bg);color:var(--fg);font:13.5px/1.55 var(--sans)}

/* Pages paint their own markup immediately, then common.js adds the header and
   some of them redirect once they learn there is no session — which showed as
   another page flashing past. Hold the first paint until the chrome is in
   place. `.ready` is set by common.js, and also by a timer in the page head, so
   a script error degrades to "shown slightly late" rather than "never shown". */
body{opacity:0}
body.ready{opacity:1;transition:opacity .1s ease-out}
a{color:var(--blue-2);text-decoration:none}
a:hover{text-decoration:underline}
button,select,input,textarea{font:inherit;color:inherit}
::-webkit-scrollbar{width:10px;height:10px}
::-webkit-scrollbar-track{background:var(--bg)}
::-webkit-scrollbar-thumb{background:var(--line);border-radius:5px;border:2px solid var(--bg)}
::-webkit-scrollbar-thumb:hover{background:var(--line-2)}

/* ------------------------------------------------------------------ chrome */
header.top{
  height:var(--top); display:flex; align-items:center; gap:18px; padding:0 16px;
  background:linear-gradient(180deg,var(--bg-2),var(--bg-1));
  border-bottom:1px solid var(--line); position:sticky; top:0; z-index:50;
}
.brand{display:flex;align-items:center;gap:8px;font-weight:600;white-space:nowrap;color:var(--fg)}
.brand .dot{width:8px;height:8px;border-radius:50%;background:var(--run);
            box-shadow:0 0 0 3px rgba(56,189,248,.12)}
nav.top-nav{display:flex;gap:2px;flex:1}
nav.top-nav a{
  padding:6px 11px;border-radius:7px;color:var(--fg-dim);font-weight:500;
}
nav.top-nav a:hover{background:var(--bg-3);color:var(--fg);text-decoration:none}
nav.top-nav a.on{background:var(--blue-ghost);color:var(--blue-2)}
.who{display:flex;align-items:center;gap:10px;color:var(--fg-dim);white-space:nowrap}
.who b{color:var(--fg);font-weight:600}

/* A run of yours is live: visible from every page, so navigating away from a
 * run does not mean losing track of it. */
.livebar{
  display:none;align-items:center;gap:12px;padding:6px 16px;font-size:12px;
  background:rgba(251,191,36,.09);border-bottom:1px solid rgba(251,191,36,.3);color:var(--warn);
}
.livebar.show{display:flex}
.livebar .track{flex:1;max-width:280px;height:5px;border-radius:3px;background:var(--bg-3);overflow:hidden}
.livebar .fill{height:100%;background:var(--warn)}

main{max-width:1180px;margin:0 auto;padding:22px 16px 60px}
main.wide{max-width:1500px}
h1{font-size:20px;font-weight:600;margin:0 0 4px}
h2{font-size:15px;font-weight:600;margin:26px 0 10px;color:var(--fg)}
.sub{color:var(--fg-dim);margin:0 0 20px;font-size:12.5px}

/* ------------------------------------------------------------------- cards */
.card{background:var(--bg-1);border:1px solid var(--line);border-radius:11px;padding:16px}
.card + .card{margin-top:14px}
.card h3{margin:0 0 12px;font-size:13px;font-weight:600;letter-spacing:.02em}
.grid{display:grid;gap:14px}
.cols-2{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
@media (max-width:900px){.cols-2{grid-template-columns:1fr}}

/* ------------------------------------------------------------------ inputs */
label{display:block;font-size:11.5px;color:var(--fg-dim);margin:0 0 4px;
      text-transform:uppercase;letter-spacing:.06em;font-weight:600}
input[type=text],input[type=password],input[type=email],input[type=number],select,textarea{
  width:100%;background:var(--bg-3);border:1px solid var(--line-2);border-radius:7px;
  padding:8px 10px;outline:none;
}
input:focus,select:focus,textarea:focus{border-color:var(--blue);box-shadow:0 0 0 2px rgba(59,130,246,.18)}
.field{margin-bottom:13px}
.row{display:flex;gap:10px}
.row > *{flex:1}
.hint{font-size:11.5px;color:var(--fg-faint);margin-top:4px;text-transform:none;letter-spacing:0}
.radios{display:flex;gap:16px;flex-wrap:wrap;align-items:center}
.radios label{display:flex;gap:6px;align-items:center;margin:0;text-transform:none;
              letter-spacing:0;font-size:13px;color:var(--fg);font-weight:400;cursor:pointer}
input[type=radio],input[type=checkbox]{accent-color:var(--blue);width:auto}

button,.btn{
  background:var(--bg-3);border:1px solid var(--line-2);border-radius:7px;
  padding:8px 14px;cursor:pointer;font-weight:500;color:var(--fg);display:inline-block;
}
button:hover,.btn:hover{background:var(--line);text-decoration:none}
button.primary,.btn.primary{background:var(--blue-dim);border-color:var(--blue);color:#fff}
button.primary:hover,.btn.primary:hover{background:var(--blue)}
button.danger{border-color:rgba(248,113,113,.5);color:var(--err)}
button.danger:hover{background:rgba(248,113,113,.14)}
button:disabled{opacity:.45;cursor:not-allowed}
button.small,.btn.small{padding:5px 10px;font-size:12px}

/* ------------------------------------------------------------------ status */
.badge{
  display:inline-block;padding:2px 7px;border-radius:5px;font-size:10.5px;font-weight:700;
  letter-spacing:.07em;text-transform:uppercase;border:1px solid var(--line-2);color:var(--fg-dim);
}
.badge.ok{color:var(--ok);border-color:rgba(52,211,153,.45)}
.badge.warn{color:var(--warn);border-color:rgba(251,191,36,.45)}
.badge.err{color:var(--err);border-color:rgba(248,113,113,.45)}
.badge.run{color:var(--run);border-color:rgba(56,189,248,.45)}
.badge.blue{color:var(--blue-2);border-color:rgba(96,165,250,.45)}

.notice{border-radius:8px;padding:10px 12px;font-size:12.5px;margin:0 0 14px;
        border:1px solid var(--line-2);background:var(--bg-2);color:var(--fg-dim)}
.notice.err{border-color:rgba(248,113,113,.4);background:rgba(248,113,113,.08);color:#fca5a5}
.notice.ok{border-color:rgba(52,211,153,.4);background:rgba(52,211,153,.07);color:#6ee7b7}
.notice.warn{border-color:rgba(251,191,36,.4);background:rgba(251,191,36,.07);color:#fcd34d}
.notice ul{margin:6px 0 0;padding-left:18px}

/* ------------------------------------------------------------------ tables */
table{width:100%;border-collapse:collapse;font-size:12.5px}
th,td{padding:7px 9px;text-align:left;border-bottom:1px solid var(--line)}
th{color:var(--fg-dim);font-weight:600;font-size:11px;text-transform:uppercase;
   letter-spacing:.06em;white-space:nowrap;cursor:default;position:sticky;top:var(--top);
   background:var(--bg-1);z-index:1}
th.sortable{cursor:pointer;user-select:none}
th.sortable:hover{color:var(--fg)}
td.num,th.num{text-align:right;font-family:var(--mono);font-variant-numeric:tabular-nums}
tbody tr:hover{background:var(--bg-2)}
.scroll-x{overflow-x:auto}
/* `overflow-x:auto` makes this div a scroll container, so the sticky offset
 * above resolves against the DIV's scrollport rather than the page's -- which
 * pushed the header a full --top DOWN from the top of the box and laid it over
 * the first row. Inside a scroll container the header belongs at its edge. */
.scroll-x th{top:0}

/* ------------------------------------------------------------------ charts */
.bars{display:flex;flex-direction:column;gap:3px}
.bar-row{display:grid;grid-template-columns:26px minmax(120px,210px) 1fr auto;
         gap:10px;align-items:center;padding:4px 6px;border-radius:6px}
.bar-row:hover{background:var(--bg-2)}
.bar-row .rank{color:var(--fg-faint);font-family:var(--mono);font-size:11.5px;text-align:right}
.bar-row .name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500}
/* `display:block` is load-bearing on BOTH of these. They are spans at every
 * call site, and `width`/`height` do not apply to a non-replaced inline box --
 * so the inline `style="width:NN%"` was discarded and the fill painted nothing.
 * The track only ever rendered because it is a grid item and got blockified by
 * its parent; the fill, one level deeper, is not. Every bar in the service was
 * an empty track, which reads as "always full" or "always zero" depending on
 * which rectangle you take for the bar.
 *
 * The fill is deliberately brighter than the track it sits in: bars are scaled
 * against the best score, so rank 1 is always 100% wide, and a full bar has to
 * be unmistakably full rather than indistinguishable from an empty one. */
.bar-track{display:block;height:12px;border-radius:3px;background:var(--bg-3);
           box-shadow:inset 0 0 0 1px rgba(0,0,0,.35);overflow:hidden;min-width:40px}
.bar-fill{display:block;height:100%;border-radius:3px;
          background:linear-gradient(90deg,var(--blue),var(--blue-2))}
.bar-row .score{font-family:var(--mono);font-variant-numeric:tabular-nums;
                font-size:12.5px;min-width:46px;text-align:right}
/* Time is information about an endpoint, not about a model. It gets text
 * beside the bar and never a bar of its own, and never the sort order. */
.bar-row .time{font-family:var(--mono);color:var(--fg-faint);font-size:11px;min-width:56px;
               text-align:right}
.bar-row .flags{display:flex;gap:4px}
.flag{font-size:10px;color:var(--fg-faint);border:1px solid var(--line);border-radius:4px;
      padding:0 4px;line-height:15px;font-family:var(--mono)}

.empty{color:var(--fg-faint);text-align:center;padding:34px 10px;font-size:13px}
.mono{font-family:var(--mono)}
.dim{color:var(--fg-dim)}
.faint{color:var(--fg-faint)}
.right{text-align:right}
.spread{display:flex;justify-content:space-between;align-items:center;gap:12px}
.stack{display:flex;flex-direction:column;gap:2px}
.big{font-size:30px;font-weight:600;font-family:var(--mono);line-height:1.1}
.kv{display:grid;grid-template-columns:auto 1fr;gap:4px 14px;font-size:12.5px}
.kv dt{color:var(--fg-dim)}
.kv dd{margin:0;font-family:var(--mono)}
