/* The status page.
 *
 * The palette is `performance.py`'s, value for value: this page and the
 * digest's three-page PDF report on the same book, and two products is one
 * more than there is. Single-theme dark on purpose — the PDF is dark, and a
 * page that inverted itself on a light-mode laptop would stop matching the
 * artefact it sits beside.
 *
 * Green and red are reserved for the sign of a P&L figure, exactly as on
 * page 3 of the PDF. Nothing else may wear them: a check either ran or it did
 * not, and that has no sign. Amber marks what wants attention, blue marks the
 * bot acting, grey marks it idle.
 */

:root {
  --bg: #0d1117;
  --panel: #161b22;
  --edge: #262c36;
  --text: #e6edf3;
  --muted: #8b949e;
  --faint: #6e7681;
  --accent: #58a6ff;
  --alert: #d29922;
  --up: #26a69a;
  --down: #ef5350;

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --gap: 20px;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

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

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--edge);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 5;
}

.wordmark {
  font-family: var(--mono);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text);
}

.topbar nav { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.topbar nav a, .topbar nav button { color: var(--muted); font-size: 13px; }
.topbar nav a:hover { color: var(--text); }

.linkish {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; color: var(--muted);
}
.linkish:hover { color: var(--text); text-decoration: underline; }

main { max-width: 1120px; margin: 0 auto; padding: 28px 24px 72px; }

/* ---- chips ---- */

.chip {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--edge);
  color: var(--muted);
  white-space: nowrap;
}
.chip.live { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.chip.paper { color: var(--muted); }
.chip.alert { color: var(--alert); border-color: color-mix(in srgb, var(--alert) 45%, transparent); }

/* ---- banners and flashes ---- */

.banner {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  border: 1px solid color-mix(in srgb, var(--alert) 40%, transparent);
  background: color-mix(in srgb, var(--alert) 9%, var(--panel));
  border-radius: var(--radius);
  margin-bottom: var(--gap);
}
.banner strong { color: var(--alert); }

.flash { padding: 11px 16px; border-radius: var(--radius); margin-bottom: 12px;
         border: 1px solid var(--edge); background: var(--panel); }
.flash.error { border-color: color-mix(in srgb, var(--down) 45%, transparent); }
.flash.warn  { border-color: color-mix(in srgb, var(--alert) 45%, transparent); }

/* ---- panels ---- */

.panel {
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: var(--gap);
}

.panel > h2 {
  margin: 0 0 4px;
  font-size: 12px;
  font-family: var(--mono);
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
}
.panel > .sub { margin: 0 0 16px; color: var(--muted); font-size: 12.5px;
                max-width: 78ch; }

/* ---- stat tiles ---- */

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap);
         margin-bottom: var(--gap); }
.tile { background: var(--panel); border: 1px solid var(--edge);
        border-radius: var(--radius); padding: 18px 20px; }
.tile .label { font-size: 11px; font-family: var(--mono); letter-spacing: 0.1em;
               text-transform: uppercase; color: var(--muted); }
.tile .value { font-family: var(--mono); font-size: 30px; margin-top: 8px;
               font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.tile .note  { color: var(--muted); font-size: 12.5px; margin-top: 4px; }

/* ---- the schedule strip ---- */

.slots { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
         gap: 10px; }
.slot { border: 1px solid var(--edge); border-radius: 6px; padding: 10px 12px;
        background: var(--bg); }
.slot .t { font-family: var(--mono); font-size: 15px; font-variant-numeric: tabular-nums; }
.slot .s { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.slot.ran   { border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.slot.ran .s { color: var(--accent); }
.slot.miss  { border-color: color-mix(in srgb, var(--alert) 45%, transparent); }
.slot.miss .s { color: var(--alert); }
.slot.idle .t { color: var(--faint); }

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

.scroll { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; font-family: var(--mono); font-size: 10.5px;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted);
  font-weight: 600; padding: 0 12px 8px 0; border-bottom: 1px solid var(--edge);
  white-space: nowrap;
}
td { padding: 9px 12px 9px 0; border-bottom: 1px solid var(--edge); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-family: var(--mono);
                 font-variant-numeric: tabular-nums; padding-right: 18px; }
td.sym { font-family: var(--mono); font-weight: 600; }
.up { color: var(--up); }
.down { color: var(--down); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.wrap { max-width: 460px; white-space: normal; color: var(--muted); }

.empty { color: var(--muted); font-style: italic; padding: 8px 0; }

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

label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
input[type=text], input[type=password] {
  width: 100%; padding: 9px 11px; background: var(--bg);
  border: 1px solid var(--edge); border-radius: 6px; color: var(--text);
  font-family: var(--mono); font-size: 13px;
}
input:focus { border-color: var(--accent); outline: none; }
.field { margin-bottom: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

button.btn, a.btn {
  display: inline-block; padding: 9px 16px; border-radius: 6px;
  border: 1px solid var(--edge); background: var(--bg); color: var(--text);
  font: inherit; font-size: 13px; cursor: pointer;
}
button.btn:hover, a.btn:hover { border-color: var(--muted); text-decoration: none; }
button.btn.primary { border-color: color-mix(in srgb, var(--accent) 55%, transparent);
                     color: var(--accent); }
button.btn.danger  { border-color: color-mix(in srgb, var(--down) 45%, transparent);
                     color: var(--down); }
button.btn.alert   { border-color: color-mix(in srgb, var(--alert) 55%, transparent);
                     color: var(--alert); }
button.btn:disabled { opacity: 0.5; cursor: progress; }

.inline { display: inline; }

code, .code {
  font-family: var(--mono); font-size: 12.5px;
  background: var(--bg); border: 1px solid var(--edge);
  border-radius: 5px; padding: 2px 6px;
}
pre.code { display: block; padding: 14px 16px; overflow-x: auto; white-space: pre-wrap;
           word-break: break-all; }

/* ---- centred pages: login, enrol, error ---- */

.center { max-width: 460px; margin: 12vh auto; padding: 0 24px; text-align: center; }
.center h1 { font-family: var(--mono); font-size: 20px; letter-spacing: 0.1em;
             text-transform: uppercase; font-weight: 600; }
.center p { color: var(--muted); }
.center .panel { text-align: left; margin-top: 24px; }

.note { color: var(--muted); font-size: 12.5px; margin-top: 12px;
        max-width: 78ch; }

@media (max-width: 720px) {
  .tiles, .grid2 { grid-template-columns: 1fr; }
  main { padding: 20px 16px 60px; }
}

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