/*
  Artha — execution desk.

  Typography
  ----------
  Figtree for the interface. Rounded terminals and near-circular bowls, so it
  reads warm rather than clinical at the small uppercase sizes this page leans
  on. Chosen over the obvious geometric rounds — Poppins, Inter, Space Grotesk —
  precisely because those three are the house style of every generated dashboard.

  DM Mono for every number, with tabular figures forced on. Round counters to
  match Figtree, and unambiguous digits: numerals here are scanned down columns,
  not read in sentences, so they must align to the pixel.

  Both fall back to a system stack. If the font host is unreachable the page
  keeps its layout and loses only the personality.

  Restraint
  ---------
  Near-monochrome. One accent — amber, for cost — used only where it carries
  meaning, plus two semantic colours that appear on maybe four elements each.
  Rules are hairlines and mostly absent; space does the separating. There are no
  card shadows, no gradients, no rounded corners, and no icon anywhere.
*/

:root {
  --ground:  #0A0C0F;
  --panel:   #0F1318;
  --hover:   #141920;
  --line:    #1B2129;
  --line-hi: #29313B;

  --ink:   #E8EBEF;
  --ink-2: #8C97A4;
  --ink-3: #59636E;

  --accent: #E0A458;
  --up:     #4FA88E;
  --down:   #CF6A5A;

  --ui:   "Figtree", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --mono: "DM Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --ground:  #FBFBFC;
    --panel:   #FFFFFF;
    --hover:   #F3F5F7;
    --line:    #E7EAEE;
    --line-hi: #D3D9E0;
    --ink:   #0D1116;
    --ink-2: #5A6673;
    --ink-3: #8A94A0;
    --accent: #9C6A18;
    --up:     #1D7A62;
    --down:   #A9422F;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

.mono, td.n, th.n, .num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

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

header.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 34px;
  height: 52px; padding: 0 30px;
  background: var(--ground);
  border-bottom: 1px solid var(--line);
}

.brand {
  font-size: 15px; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase;
}

nav { display: flex; gap: 26px; }
nav a {
  font-size: 13px; color: var(--ink-3);
  padding: 2px 0; border-bottom: 1px solid transparent;
  transition: color .12s;
}
nav a:hover { color: var(--ink-2); }
nav a.on { color: var(--ink); border-bottom-color: var(--accent); }

.status { margin-left: auto; display: flex; gap: 26px; align-items: center; }
.stat { display: flex; align-items: baseline; gap: 7px; }
.stat dt {
  font-size: 10.5px; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--ink-3);
}
.stat dd {
  margin: 0; font-family: var(--mono); font-size: 12.5px; font-weight: 400;
  font-variant-numeric: tabular-nums; color: var(--ink-2);
}
.stat dd.warn { color: var(--accent); }
.stat dd.bad  { color: var(--down); }

.signout {
  background: none; border: 0; cursor: pointer; padding: 0;
  font-family: var(--ui); font-size: 11px; letter-spacing: 0.11em;
  text-transform: uppercase; color: var(--ink-3);
  border-bottom: 1px solid transparent; transition: color .12s;
}
.signout:hover { color: var(--down); border-bottom-color: var(--down); }

main { padding: 46px 30px 120px; max-width: 1180px; }

/* ---------------------------------------------------------------- headings */

h1 {
  font-size: 22px; font-weight: 600; letter-spacing: -0.008em;
  margin: 0 0 6px;
}
.sub {
  color: var(--ink-2); font-size: 13.5px; margin: 0 0 40px; max-width: 70ch;
}
h2 {
  font-size: 11px; font-weight: 600; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--ink-3);
  margin: 48px 0 14px;
}

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

table { border-collapse: collapse; width: 100%; }
thead th {
  font-size: 10.5px; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600; text-align: left;
  padding: 0 18px 11px; white-space: nowrap;
  border-bottom: 1px solid var(--line-hi);
}
tbody td {
  padding: 13px 18px; color: var(--ink-2);
  border-bottom: 1px solid var(--line); vertical-align: baseline;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--hover); }
td.n, th.n { text-align: right; white-space: nowrap; color: var(--ink); }
td.name { color: var(--ink); }
td.rank {
  font-family: var(--mono); font-size: 12px; color: var(--ink-3);
  font-variant-numeric: tabular-nums; text-align: right; width: 40px;
}
tr.you td { background: color-mix(in srgb, var(--accent) 7%, transparent); }
tr.you td.name { color: var(--accent); }
tbody td:first-child, thead th:first-child { padding-left: 0; }
tbody td:last-child,  thead th:last-child  { padding-right: 0; }

/* ---------------------------------------------------------------- bits */

.tag {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.06em;
  color: var(--ink-3);
}
.tag.ok   { color: var(--up); }
.tag.run  { color: var(--accent); }
.tag.fail { color: var(--down); }

.bar { display: flex; height: 3px; gap: 1px; }
.bar i { display: block; }

.legend { display: flex; flex-wrap: wrap; gap: 30px; margin-top: 18px; }
.legend span { display: flex; align-items: baseline; gap: 9px; font-size: 12px; }
.legend em {
  font-style: normal; font-size: 10px; letter-spacing: 0.11em;
  text-transform: uppercase; color: var(--ink-3);
}
.legend b {
  font-family: var(--mono); font-weight: 400; font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.legend i { width: 14px; height: 3px; display: block; align-self: center; }

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

textarea, input[type=password], input[type=text] {
  width: 100%; background: var(--panel); color: var(--ink);
  border: 1px solid var(--line-hi); padding: 14px 16px;
  font-family: var(--mono); font-size: 12.5px; font-weight: 300; line-height: 1.7;
}
textarea { min-height: 380px; resize: vertical; white-space: pre; }
textarea::placeholder, input::placeholder { color: var(--ink-3); }
textarea:focus, input:focus {
  outline: none; border-color: var(--accent);
}

.btn {
  background: transparent; color: var(--ink);
  border: 1px solid var(--ink-3); padding: 10px 26px;
  font-size: 12px; letter-spacing: 0.09em; text-transform: uppercase;
  cursor: pointer; transition: border-color .12s, color .12s;
}
.btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn:disabled { border-color: var(--line); color: var(--ink-3); cursor: not-allowed; }
.btn.primary { border-color: var(--accent); color: var(--accent); }
.btn.primary:hover:not(:disabled) { background: var(--accent); color: var(--ground); }

.btn.tiny { padding: 4px 12px; font-size: 10.5px; letter-spacing: .07em; }

.row { display: flex; gap: 14px; align-items: center; margin-top: 20px; }

.msg {
  padding: 13px 0 13px 17px; border-left: 1px solid var(--line-hi);
  font-size: 13px; color: var(--ink-2); margin: 22px 0;
}
.msg.err  { border-left-color: var(--down); color: var(--ink); }
.msg.good { border-left-color: var(--up); color: var(--ink); }
.msg code { font-family: var(--mono); font-size: 12px; color: var(--accent); }
.msg pre {
  margin: 10px 0 0; font-family: var(--mono); font-size: 11.5px;
  color: var(--ink-3); white-space: pre-wrap; overflow-x: auto;
}

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

.grid { display: grid; gap: 52px; margin-bottom: 8px; }
.grid.k4 { grid-template-columns: repeat(4, 1fr); }
.cell dt {
  font-size: 10.5px; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--ink-3);
}
.cell dd {
  margin: 9px 0 0; font-family: var(--mono); font-size: 30px; font-weight: 300;
  font-variant-numeric: tabular-nums; letter-spacing: -0.025em; line-height: 1;
}
.cell dd small {
  font-size: 11px; color: var(--ink-3); margin-left: 6px; letter-spacing: 0;
}
.cell p { margin: 10px 0 0; font-size: 12px; color: var(--ink-3); line-height: 1.45; }

/* A canvas without an explicit CSS height renders at its PIXEL-buffer height,
   which is height x devicePixelRatio -- double the intended size on retina.
   Pin both dimensions in CSS and let the buffer scale independently. */
canvas.chart { display: block; width: 100%; }
canvas.chart-spread { height: 90px; }
canvas.chart-leg { height: 210px; }

.note-inline { font-size: 11.5px; color: var(--ink-3); margin-top: 14px; }
.empty { color: var(--ink-3); padding: 70px 0; font-size: 13px; }

/* ---------------------------------------------------------------- brief */

.brief { max-width: 68ch; }

.downloads {
  display: grid; gap: 1px; background: var(--line);
  border: 1px solid var(--line); margin: 34px 0 46px;
}
.dl {
  display: block; background: var(--panel); padding: 15px 18px;
  transition: background .12s;
}
.dl:hover { background: var(--hover); }
.dl.missing { opacity: .55; }
.dl.missing b { color: var(--ink-3); }
.dl b { display: block; font-size: 14px; font-weight: 600; color: var(--accent); }
.dl span { display: block; font-size: 12.5px; color: var(--ink-2); margin-top: 3px; }
.dl em {
  display: block; font-style: normal; margin-top: 6px;
  font-family: var(--mono); font-size: 10.5px; color: var(--ink-3);
}
.brief p { color: var(--ink-2); margin: 0 0 15px; }
.brief h3 { font-size: 15px; font-weight: 600; color: var(--ink); margin: 26px 0 8px; letter-spacing: -.005em; }
.brief strong { color: var(--ink); font-weight: 600; }
.brief pre {
  border-left: 1px solid var(--line-hi); padding: 4px 0 4px 20px;
  overflow-x: auto; margin: 0 0 15px;
  font-family: var(--mono); font-size: 12px; font-weight: 300;
  color: var(--ink-2); line-height: 1.75;
}
.brief ul { padding-left: 0; list-style: none; margin: 0 0 15px; }
.brief li { position: relative; padding-left: 22px; margin-bottom: 9px; color: var(--ink-2); }
.brief li::before {
  content: ""; position: absolute; left: 0; top: 0.68em;
  width: 10px; height: 1px; background: var(--ink-3);
}

@media (max-width: 900px) {
  header.top { gap: 20px; padding: 0 18px; }
  main { padding: 32px 18px 90px; }
  .grid.k4 { grid-template-columns: repeat(2, 1fr); gap: 34px; }
  .status .stat:nth-child(n+3) { display: none; }
  nav { gap: 18px; }
}
