/* Operator console styling. Hand-written, no framework, no build step —
   it ships as one file inside the image alongside the templates.

   Layout is driven entirely by CSS: the templates stay plain semantic HTML
   (h1/h2 + section + table), so a page can be added without touching this
   file. */

:root {
  --bg: #0b0d12;
  --bg-accent: #12161f;
  --panel: #151922;
  --panel-hi: #1b202b;
  --line: #262c3a;
  --line-soft: #1f2431;
  --text: #e8ebf2;
  --muted: #8f98ad;
  --accent: #6aa5ff;
  --accent-soft: rgba(106, 165, 255, .14);
  --good: #46c46a;
  --warn: #e0a52b;
  --bad: #fb6a62;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .7);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 480px at 15% -12%, rgba(106, 165, 255, .10), transparent 70%),
    radial-gradient(900px 420px at 95% 0%, rgba(70, 196, 106, .06), transparent 65%),
    var(--bg);
  color: var(--text);
  font: 14px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

code, .mono { font-family: var(--mono); font-size: 12.5px; }
code {
  background: rgba(255, 255, 255, .045);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  padding: 1px 5px;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---- chrome ---- */

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  padding: 11px 24px;
  background: rgba(17, 21, 29, .82);
  /* Rows scroll under the bar; the blur keeps the nav legible over them. */
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-name { font-weight: 650; letter-spacing: -.01em; }
.brand-mark {
  width: 9px; height: 9px; border-radius: 3px;
  background: linear-gradient(135deg, var(--accent), #9d7bff);
  box-shadow: 0 0 12px rgba(106, 165, 255, .55);
}

.topbar nav { display: flex; align-items: center; gap: 4px; margin-right: auto; }
.topbar nav a {
  color: var(--muted); padding: 6px 11px; border-radius: 999px; font-weight: 500;
  transition: background .12s ease, color .12s ease;
}
.topbar nav a:hover { color: var(--text); background: rgba(255, 255, 255, .05); text-decoration: none; }
.topbar nav a.on { color: var(--text); background: var(--accent-soft); box-shadow: inset 0 0 0 1px rgba(106, 165, 255, .3); }

.topbar .meta { display: flex; align-items: center; gap: 12px; }
.topbar .who {
  max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--muted); font-size: 13px;
}

.tag {
  padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
}
.tag.prod { background: rgba(251, 106, 98, .16); color: var(--bad); }
.tag.dev { background: var(--accent-soft); color: var(--accent); }

main { max-width: 1180px; margin: 0 auto; padding: 30px 24px 80px; }
h1 { font-size: 25px; line-height: 1.25; margin: 0 0 22px; font-weight: 650; letter-spacing: -.02em; }
h1 .pill { vertical-align: middle; margin-left: 6px; }
h2 { font-size: 13px; margin: 30px 0 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
h3 { font-size: 13px; margin: 22px 0 8px; font-weight: 600; color: var(--muted); }
.muted { color: var(--muted); font-weight: 400; text-transform: none; letter-spacing: 0; }
.note { font-size: 12.5px; margin-top: 10px; }
.crumb { margin: 0 0 10px; font-size: 13px; }

/* ---- cards ---- */

.cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 12px; margin-bottom: 4px;
}
.card {
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, var(--panel-hi), var(--panel));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px 15px; display: flex; flex-direction: column; gap: 3px;
  box-shadow: var(--shadow);
}
/* A 2px top rule reads as a status colour without tinting the whole card. */
.card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: transparent; }
.card.good::before { background: var(--good); }
.card.warn::before { background: var(--warn); }
.card.bad::before { background: var(--bad); }
.card .label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .07em; font-weight: 600; }
.card .value { font-size: 24px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.card.good .value { color: var(--good); }
.card.bad .value { color: var(--bad); }
.card .sub { color: var(--muted); font-size: 12px; }

.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 26px; }

/* ---- tables ---- */

table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
th, td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
/* Deliberately NOT `position: sticky`: the topbar's height changes when its
   nav wraps, so any fixed `top` offset leaves the header row floating over a
   data row on some viewport widths. */
th {
  background: var(--panel-hi);
  color: var(--muted); font-weight: 650; font-size: 11px;
  text-transform: uppercase; letter-spacing: .07em; white-space: nowrap;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background .1s ease; }
tbody tr:hover { background: rgba(255, 255, 255, .028); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
/* Wide tables scroll inside their own box rather than pushing the page out.
   The border/radius moves to the wrapper so the rounded corners survive. */
.scroll {
  overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); background: var(--panel);
}
.scroll table { border: none; border-radius: 0; box-shadow: none; min-width: 940px; }

.kv th {
  width: 38%; background: transparent;
  text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 500;
}
/* Long, low-value strings must not blow the table width open. */
.ua, .details {
  max-width: 340px; font-size: 12px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.pill {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 650; letter-spacing: .01em;
}
.pill.good { background: rgba(70, 196, 106, .15); color: var(--good); box-shadow: inset 0 0 0 1px rgba(70, 196, 106, .25); }
.pill.warn { background: rgba(224, 165, 43, .15); color: var(--warn); box-shadow: inset 0 0 0 1px rgba(224, 165, 43, .25); }
.pill.bad { background: rgba(251, 106, 98, .15); color: var(--bad); box-shadow: inset 0 0 0 1px rgba(251, 106, 98, .25); }
.pill.muted { background: rgba(143, 152, 173, .14); color: var(--muted); box-shadow: inset 0 0 0 1px rgba(143, 152, 173, .22); }

/* ---- forms ---- */

input, select, button {
  font: inherit; color: inherit;
  background: #0e121a; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 8px 11px;
}
input::placeholder { color: #5d6478; }
input:focus, select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
button {
  background: linear-gradient(180deg, #7fb1ff, var(--accent));
  border-color: transparent; color: #08101f; font-weight: 650; cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .35);
  transition: filter .12s ease, transform .06s ease;
}
button:hover { filter: brightness(1.07); }
button:active { transform: translateY(1px); }
button[disabled] { opacity: .38; cursor: not-allowed; filter: none; }
button.danger { background: linear-gradient(180deg, #ff8b84, var(--bad)); color: #22090a; }
button.ghost, button.link, .link {
  background: none; border: 1px solid var(--line); color: var(--muted);
  font-weight: 500; box-shadow: none; padding: 6px 11px;
}
button.ghost:hover, button.link:hover { color: var(--text); border-color: var(--muted); filter: none; }
.link { border: none; padding: 0; color: var(--accent); }

.filters { display: flex; gap: 8px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.filters input[type="search"] { min-width: 300px; }
.inline { display: inline; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Stacked label+input pairs — the password reset form, and the login card. */
.stack { display: flex; flex-direction: column; gap: 12px; max-width: 340px; }
.stack label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--muted); }

.pager { display: flex; gap: 16px; align-items: center; margin-top: 16px; }

/* Sort chips on the endpoints page. */
.chip {
  padding: 5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 500;
  color: var(--muted); border: 1px solid var(--line); background: var(--panel);
}
.chip:hover { color: var(--text); border-color: var(--muted); text-decoration: none; }
.chip.on { color: var(--accent); background: var(--accent-soft); border-color: rgba(106, 165, 255, .45); }
h2 .more { float: right; font-size: 11.5px; font-weight: 500; }

/* ---- endpoints table ---- */

.verb {
  display: inline-block; min-width: 52px; text-align: center;
  padding: 2px 7px; border-radius: 5px; font: 650 11px/1.5 var(--mono);
  letter-spacing: .04em; background: rgba(143, 152, 173, .14); color: var(--muted);
}
.verb.get { background: var(--accent-soft); color: var(--accent); }
.verb.post { background: rgba(70, 196, 106, .15); color: var(--good); }
.verb.put, .verb.patch { background: rgba(224, 165, 43, .15); color: var(--warn); }
.verb.delete { background: rgba(251, 106, 98, .15); color: var(--bad); }

/* Share-of-traffic bar: one element, width driven by the --pct custom
   property the template sets, so no chart library and no inline <style>. */
.bar {
  display: block; height: 6px; min-width: 60px; border-radius: 999px;
  background: rgba(255, 255, 255, .06); position: relative; overflow: hidden;
}
.bar::after {
  content: ""; position: absolute; inset: 0 auto 0 0; width: var(--pct, 0%);
  background: linear-gradient(90deg, var(--accent), #9d7bff); border-radius: 999px;
}

.codes { white-space: nowrap; }
/* Routes with no traffic since the last restart stay listed but recede. */
tr.idle td { opacity: .55; }
tr.idle:hover td { opacity: 1; }
.filters .spacer { margin-left: 10px; }
.code {
  display: inline-flex; align-items: center; gap: 5px; margin-right: 5px;
  padding: 1px 7px; border-radius: 5px; font: 600 11.5px/1.6 var(--mono);
  background: rgba(143, 152, 173, .12); color: var(--muted);
}
.code i { font-style: normal; opacity: .75; font-weight: 500; }
.code.ok { background: rgba(70, 196, 106, .13); color: var(--good); }
.code.warn { background: rgba(224, 165, 43, .13); color: var(--warn); }
.code.bad { background: rgba(251, 106, 98, .13); color: var(--bad); }

.flash, .error {
  border-radius: var(--radius-sm); padding: 10px 14px; margin: 0 0 18px;
  border: 1px solid; font-size: 13.5px;
}
.flash { background: var(--accent-soft); border-color: rgba(106, 165, 255, .4); color: #bcd6ff; }
.error { background: rgba(251, 106, 98, .1); border-color: rgba(251, 106, 98, .45); color: #ffb4af; }

/* ---- login ---- */

.login {
  max-width: 380px; margin: 11vh auto 0; text-align: center;
  background: linear-gradient(180deg, var(--panel-hi), var(--panel));
  border: 1px solid var(--line); border-radius: 14px;
  padding: 34px 30px 30px; box-shadow: var(--shadow);
}
.login h1 { margin-bottom: 4px; font-size: 21px; }
.login form { display: flex; flex-direction: column; gap: 12px; margin-top: 26px; text-align: left; }
.login label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--muted); }
.login button { margin-top: 6px; padding: 10px; }

/* ---- small screens ---- */

@media (max-width: 720px) {
  .topbar { gap: 12px; padding: 10px 14px; }
  .topbar nav { order: 3; width: 100%; margin-right: 0; overflow-x: auto; }
  .topbar .meta { margin-left: auto; }
  th { position: static; }
  main { padding: 20px 14px 60px; }
  .filters input[type="search"] { min-width: 0; flex: 1; }
}
