/* The Operations View is a ledger: one system typeface, hairline rules, square corners, and
   colour reserved for what is owed. Two accents and no third. */

:root {
  color-scheme: light dark;
  --paper: #faf9f6;
  --ink: #17170f;
  --muted: #6b6a5f;
  --rule: #d9d5c9;
  --rule-strong: #b4b0a2;
  --band: #f2f0e9;
  --owed: #a02d17;
  --pending: #8a5b00;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121210;
    --ink: #e9e6da;
    --muted: #8d8a7d;
    --rule: #2c2b26;
    --rule-strong: #474540;
    --band: #1a1a16;
    --owed: #e8705a;
    --pending: #d3a03f;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 13px/1.4 var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
input:focus, button:focus { outline: 2px solid var(--ink); outline-offset: 0; }
a:hover { text-decoration-thickness: 2px; }

/* -- the bar ------------------------------------------------------------- */

.bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--rule-strong);
  position: sticky;
  top: 0;
  background: var(--paper);
  z-index: 3;
}

.bar nav { display: flex; gap: 20px; }

.bar a {
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: .09em;
  font-size: 11px;
  color: var(--muted);
  padding-bottom: 2px;
}

.bar a.on { color: var(--ink); box-shadow: 0 2px 0 var(--ink); }
.bar a:hover { color: var(--ink); }
.who { font-size: 11px; color: var(--muted); }
.who a { text-transform: none; letter-spacing: 0; margin-left: 12px; text-decoration: underline; }

main { padding: 18px 20px 60px; }

/* -- the page head ------------------------------------------------------- */

.head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 12px; }
h1 { font-size: 17px; font-weight: 600; margin: 0; letter-spacing: -.01em; }
h2 {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .09em;
  color: var(--muted); margin: 30px 0 8px;
}
.count { font-size: 11px; color: var(--muted); margin-left: auto; }

/* The last unattended pass, one line above the table. */
.poll {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px;
  font-size: 11px; color: var(--muted); margin: 0 0 10px;
}
.poll .key { text-transform: uppercase; letter-spacing: .09em; font-weight: 600; }
.poll .date { white-space: nowrap; color: var(--ink); }
.poll .stage { white-space: nowrap; }
.poll .owed { color: var(--owed); font-weight: 600; }

.filter { display: flex; gap: 0; }
.filter input, .filter button {
  font: inherit; border: 1px solid var(--rule-strong); background: var(--paper);
  color: var(--ink); border-radius: 0; padding: 3px 8px; height: 26px;
}
.filter input { width: 220px; border-right: 0; }
.filter button { cursor: pointer; color: var(--muted); }
.filter button:hover { color: var(--ink); }

/* -- the grid ------------------------------------------------------------ */

table { border-collapse: collapse; width: 100%; }

thead th {
  position: sticky; top: 41px; background: var(--paper); z-index: 2;
  text-align: left; font-weight: 600; font-size: 10px; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted); white-space: nowrap;
  padding: 5px 10px 5px 0; border-bottom: 1px solid var(--rule-strong);
}
thead th a { text-decoration: none; }
thead th a:hover { color: var(--ink); }
thead th.sorted { color: var(--ink); }
thead th.sorted.asc a::after { content: " \2191"; }
thead th.sorted.desc a::after { content: " \2193"; }

tbody td {
  padding: 4px 10px 4px 0; border-bottom: 1px solid var(--rule);
  vertical-align: top; white-space: nowrap;
}
tbody tr:nth-child(even) { background: var(--band); }
tbody tr:hover { background: transparent; box-shadow: inset 0 0 0 1px var(--rule-strong); }

td.number, th.number { text-align: right; padding-right: 14px; }
td.date, th.date { white-space: nowrap; color: var(--ink); }
td.wrap { white-space: normal; max-width: 460px; }
td.excerpt { color: var(--muted); }
td.hash { color: var(--muted); letter-spacing: .04em; }
td.owed { color: var(--owed); font-weight: 600; }

tfoot td {
  padding: 6px 10px 6px 0; border-top: 1px solid var(--rule-strong); font-weight: 600;
}

/* -- state --------------------------------------------------------------- */

.state { text-transform: uppercase; font-size: 10px; letter-spacing: .07em; color: var(--muted); }
.state.nudge_due, .state.deemed_denied, .state.failed,
.state.interrupted { color: var(--owed); font-weight: 600; }
.state.needs_parser, .state.extended, .state.running { color: var(--pending); }
.state.delivered, .state.succeeded, .state.no_records, .state.partial,
.state.correspondence { color: var(--ink); }

/* -- facts on the request page ------------------------------------------- */

.facts { width: auto; margin-bottom: 8px; }
.facts tbody tr:nth-child(even) { background: none; }
.facts tbody tr:hover { box-shadow: none; }
.facts th {
  text-align: left; font-weight: 600; font-size: 10px; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted); padding: 4px 14px 4px 0; white-space: nowrap;
  border-bottom: 1px solid var(--rule);
}
.facts td { padding-right: 40px; }

/* -- sign in ------------------------------------------------------------- */

body.entry { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
body.entry main { padding: 0; width: 280px; }
body.entry h1 {
  font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted);
  margin-bottom: 18px;
}
body.entry button {
  font: inherit; padding: 6px 14px; border: 1px solid var(--ink); background: var(--ink);
  color: var(--paper); border-radius: 0; cursor: pointer;
}
.error { color: var(--owed); margin: 0 0 12px; }
