/* Nexor panel. Black frame, white canvas, one colour: a red terracotta, tuned to hold up on pure black as well as on
   pure white. It marks the brand, the primary action, where you are and what just changed; the darker red is what the
   firewall stops ("engelle"). Green lets through, amber waits. Motion only answers a change, and never when the system
   asks for less motion. */

@font-face { font-family: "Plex Sans"; font-weight: 400; font-display: swap; src: url("/ui/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Plex Sans"; font-weight: 400; font-display: swap; src: url("/ui/ibm-plex-sans-latin-ext-400-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Plex Sans"; font-weight: 500; font-display: swap; src: url("/ui/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Plex Sans"; font-weight: 500; font-display: swap; src: url("/ui/ibm-plex-sans-latin-ext-500-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Plex Sans"; font-weight: 600; font-display: swap; src: url("/ui/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Plex Sans"; font-weight: 600; font-display: swap; src: url("/ui/ibm-plex-sans-latin-ext-600-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Plex Mono"; font-weight: 400; font-display: swap; src: url("/ui/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+FEFF, U+FFFD; }
@font-face { font-family: "Plex Mono"; font-weight: 400; font-display: swap; src: url("/ui/ibm-plex-mono-latin-ext-400-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+1E00-1E9F; }

/* White. White text on the terracotta button: 5.0:1. */
:root {
  --ground: #F4F4F4;
  --surface: #FFFFFF;
  --ink: #000000;
  --muted: #666666;
  --line: #E3E3E3;
  --sel: #F2F2F2;
  --brand: #C2452A;
  --brand-ink: #FFFFFF;
  --brand-soft: #FBEAE5;
  --accept: #2E7D32;
  --drop: #9E2A1B;
  --wait: #A15C00;
  --focus: #C2452A;
  --accept-soft: #E8F3E8;
  --drop-soft: #FBE9E6;
  --wait-soft: #FBF0DE;
  /* The frame (top bar and menu) is black in both themes. */
  --frame: #000000;
  --frame-ink: #FFFFFF;
  --frame-muted: #9A9A9A;
  --frame-line: #1F1F1F;
  --frame-sel: #151515;
  --nav: 232px;
  --bar: 52px;
  color-scheme: light;
}

/* Black. The terracotta is lifted so it reads on black: 6.0:1, and black text on the button. */
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #000000;
    --surface: #0F0F0F;
    --ink: #FFFFFF;
    --muted: #A0A0A0;
    --line: #262626;
    --sel: #181818;
    --brand: #E0623F;
    --brand-ink: #000000;
    --brand-soft: #2A120B;
    --accept: #66BB6A;
    --drop: #F2735A;
    --wait: #F0B429;
    --focus: #E0623F;
    --accept-soft: #10240F;
    --drop-soft: #2B120D;
    --wait-soft: #2B2108;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--ground);
  color: var(--ink);
  font: 400 14px/1.5 "Plex Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 22px; line-height: 1.25; }
h2 { font-size: 16px; line-height: 1.35; }
p { margin: 0; max-width: 70ch; }
a { color: inherit; }
.mono { font-family: "Plex Mono", ui-monospace, monospace; font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Controls */
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea {
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; min-height: 36px; width: 100%;
}
textarea { resize: vertical; min-height: 84px; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }
label.field { display: grid; gap: 6px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
label.field > input, label.field > select, label.field > textarea { color: var(--ink); font-size: 14px; font-weight: 400; }
.hint { font-size: 12.5px; color: var(--muted); font-weight: 400; }

button {
  cursor: pointer; border: 1px solid var(--line); background: var(--surface); border-radius: 6px;
  padding: 7px 14px; min-height: 36px; font-weight: 500; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
}
button:hover { border-color: var(--muted); }
button.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
button.primary:hover { filter: brightness(1.07); }
button.danger { color: var(--drop); }
button.ghost { border-color: transparent; background: transparent; color: var(--muted); padding: 6px 8px; min-height: 30px; }
button.ghost:hover { color: var(--ink); background: var(--sel); }
button:disabled { opacity: 0.4; cursor: not-allowed; }
/* Faded terracotta on black reads as brown: a disabled primary goes neutral instead. */
button.primary:disabled { opacity: 1; background: var(--sel); border-color: var(--line); color: var(--muted); filter: none; }
.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.toggle input { width: 34px; height: 20px; min-height: 0; appearance: none; border-radius: 999px; background: var(--line); border: 0; position: relative; cursor: pointer; padding: 0; flex: none; }
.toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #FFFFFF; }
.toggle input:checked { background: var(--brand); }
.toggle input:checked::after { left: 17px; }
.toggle input:focus { box-shadow: 0 0 0 3px var(--brand-soft); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; padding: 2px; gap: 2px; background: var(--surface); }
.seg button { border: 0; min-height: 30px; padding: 4px 14px; background: transparent; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--surface); }
.seg button.accept[aria-pressed="true"] { background: var(--accept); color: #FFFFFF; }
.seg button.drop[aria-pressed="true"] { background: var(--drop); color: #FFFFFF; }

/* Frame: top bar and menu */
.app { display: grid; grid-template-columns: var(--nav) minmax(0, 1fr); grid-template-rows: var(--bar) 1fr; min-height: 100vh; }
.bar {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; padding: 0 16px 0 18px;
  background: var(--frame); color: var(--frame-ink); border-bottom: 2px solid var(--brand); position: sticky; top: 0; z-index: 10;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; letter-spacing: 0.01em; width: calc(var(--nav) - 18px); }
.brand::before { content: ""; width: 24px; height: 24px; background: url("/ui/icon.svg") center / contain no-repeat; flex: none; }
.bar select { width: auto; min-width: 200px; background: var(--frame-sel); color: var(--frame-ink); border-color: var(--frame-line); min-height: 34px; }
.bar .state { font-size: 12.5px; color: var(--frame-muted); display: inline-flex; align-items: center; gap: 7px; }
.bar .spacer { flex: 1; }
.bar button.ghost { color: var(--frame-muted); }
.bar button.ghost:hover { color: var(--frame-ink); background: var(--frame-sel); }
.menu-toggle { display: none; }

.nav { background: var(--frame); color: var(--frame-muted); padding: 14px 10px 24px; position: sticky; top: var(--bar); height: calc(100vh - var(--bar)); overflow-y: auto; }
.nav .group { margin-top: 18px; padding: 0 10px 6px; font-size: 11.5px; color: #6E6E6E; font-weight: 500; }
.nav .group:first-child { margin-top: 0; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; text-decoration: none; color: var(--frame-muted); position: relative;
}
.nav a:hover { color: var(--frame-ink); background: var(--frame-sel); }
.nav a[aria-current="page"] { color: var(--frame-ink); background: var(--frame-sel); }
.nav a[aria-current="page"]::before { content: ""; position: absolute; left: -10px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
.nav svg, button svg { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav .count { margin-left: auto; font-size: 11.5px; color: var(--frame-ink); background: var(--brand); border-radius: 999px; padding: 0 7px; line-height: 18px; }

main { padding: 28px 32px 120px; min-width: 0; }
.page { max-width: 1240px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head > div { display: grid; gap: 4px; margin-right: auto; }
.page-head p { color: var(--muted); }

/* Status */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.on { background: var(--accept); }
.dot.off { background: var(--drop); }
.dot.wait { background: var(--wait); }
.dot.live { background: var(--accept); box-shadow: 0 0 0 0 rgb(102 187 106 / 0.5); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.pill.accept { color: var(--accept); background: var(--accept-soft); }
.pill.drop { color: var(--drop); background: var(--drop-soft); }
.pill.wait { color: var(--wait); background: var(--wait-soft); }
.pill.neutral { color: var(--muted); background: var(--sel); }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border: 1px solid var(--line); border-radius: 5px; font-size: 12.5px; white-space: nowrap; background: var(--surface); }
.chip b { font-weight: 500; }
.chip.zone::before { content: ""; width: 6px; height: 6px; border-radius: 2px; background: var(--ink); opacity: 0.55; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }

/* Surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.card > header { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.card > header h2 { margin-right: auto; }
.card .body { padding: 16px; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.empty { padding: 40px 24px; display: grid; gap: 10px; justify-items: start; }
.empty h2 { font-size: 18px; }
.empty p { color: var(--muted); }
.note { background: var(--wait-soft); border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.note.bad { background: var(--drop-soft); color: var(--ink); }
.note.err { font-family: "Plex Mono", monospace; font-size: 12px; white-space: pre-wrap; max-height: 10em; overflow: auto; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--sel); }
td.num, th.num { text-align: right; }
td.pos { color: var(--muted); width: 36px; }
tr.implicit td { color: var(--muted); font-size: 13px; background: var(--ground); }
.row-tools { display: inline-flex; gap: 2px; opacity: 0; }
tr:hover .row-tools, tr:focus-within .row-tools { opacity: 1; }
.hits { text-align: right; white-space: nowrap; }
.hits b { font-weight: 500; display: block; }
.hits span { font-size: 12px; color: var(--muted); }
.bar-cell { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.meter { height: 6px; border-radius: 3px; background: var(--sel); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--brand); border-radius: 3px; }

/* Overview */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: grid; gap: 12px; cursor: pointer; text-align: left; font-weight: 400; min-height: 0; align-items: stretch; }
.tile:hover { border-color: var(--muted); }
.tile .top { display: flex; align-items: center; gap: 10px; }
.tile .top b { font-size: 15px; font-weight: 600; margin-right: auto; }
.tile .facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile .facts div { display: grid; gap: 1px; }
.tile .facts span { font-size: 11.5px; color: var(--muted); }
.tile .facts strong { font-weight: 500; font-size: 14px; }
.spark { width: 100%; height: 44px; display: block; }
.spark path.line { fill: none; stroke: var(--brand); stroke-width: 1.6; }
.spark path.area { fill: var(--brand-soft); stroke: none; }
.feed td { padding-top: 9px; padding-bottom: 9px; }

/* Drawer */
.scrim { position: fixed; inset: 0; background: rgb(0 0 0 / 0.38); z-index: 30; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(500px, 100vw); z-index: 31; background: var(--surface);
  border-left: 1px solid var(--line); display: grid; grid-template-rows: auto 1fr auto; box-shadow: -24px 0 48px rgb(0 0 0 / 0.18);
}
.drawer > header { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.drawer > header h2 { font-size: 18px; margin-right: auto; }
.drawer .content { overflow-y: auto; padding: 20px 22px; display: grid; gap: 18px; align-content: start; }
.drawer > footer { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; }
.drawer > footer .grow { margin-right: auto; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.says { border-left: 3px solid var(--brand); padding: 8px 0 8px 12px; font-size: 14px; }
.says span { color: var(--muted); font-size: 12px; display: block; margin-bottom: 2px; }
.picker { display: flex; flex-wrap: wrap; gap: 6px; }
.picker button { min-height: 28px; padding: 2px 10px; font-weight: 400; font-size: 13px; border-radius: 999px; }
.picker button[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
pre { background: var(--ground); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; overflow-x: auto; margin: 0; font-family: "Plex Mono", monospace; font-size: 12.5px; white-space: pre; }
ol.steps { padding-left: 20px; display: grid; gap: 14px; margin: 0; }
ol.steps li > * + * { margin-top: 6px; }

/* Save bar */
.savebar {
  position: fixed; left: var(--nav); right: 0; bottom: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 12px 32px; background: var(--surface); border-top: 1px solid var(--line);
}
.savebar .state { margin-right: auto; display: flex; align-items: center; gap: 8px; min-width: 0; }

/* Filters */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters input { width: 260px; }
.filters select { width: auto; }

/* Sign-in */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: #000000; }
.login form { width: min(400px, 100%); display: grid; gap: 16px; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--brand); border-radius: 12px; padding: 28px; }
.login h1 { font-size: 26px; display: inline-flex; align-items: center; gap: 10px; }
.login h1::before { content: ""; width: 30px; height: 30px; background: url("/ui/icon.svg") center / contain no-repeat; }

dialog { border: 1px solid var(--line); border-radius: 12px; padding: 0; background: var(--surface); color: var(--ink); width: min(640px, calc(100vw - 32px)); }
dialog::backdrop { background: rgb(0 0 0 / 0.55); }
dialog .body { padding: 22px; display: grid; gap: 14px; }
dialog .actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

#toast { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); z-index: 50; display: grid; gap: 6px; }
#toast > div { background: var(--ink); color: var(--surface); border-radius: 8px; padding: 10px 14px; max-width: min(560px, calc(100vw - 32px)); box-shadow: 0 8px 24px rgb(0 0 0 / 0.2); }
#toast > div.bad { background: var(--drop); color: #FFFFFF; }

/* Phones: the menu slides over the page. */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .menu-toggle { display: inline-flex; }
  .brand { width: auto; }
  .bar select { min-width: 0; max-width: 46vw; }
  .bar .state { display: none; }
  .nav { position: fixed; left: 0; top: var(--bar); bottom: 0; width: 260px; z-index: 25; transform: translateX(-100%); height: auto; }
  .nav.open { transform: none; }
  main { padding: 20px 16px 120px; }
  .savebar { left: 0; padding: 10px 16px; flex-wrap: wrap; }
  .pair { grid-template-columns: 1fr; }
  .filters input { width: 100%; }
  .grid.two { grid-template-columns: 1fr; }
}

/* Motion: each one answers something that happened. */
@media (prefers-reduced-motion: no-preference) {
  .drawer { animation: slide-in 220ms cubic-bezier(0.2, 0.8, 0.2, 1); }
  .scrim { animation: fade-in 180ms ease-out; }
  .nav { transition: transform 200ms cubic-bezier(0.2, 0.8, 0.2, 1); }
  tr.new td { animation: arrive 1.4s ease-out; }
  .bump { animation: bump 900ms ease-out; }
  .dot.live.beat { animation: beat 900ms ease-out; }
  #toast > div { animation: rise 200ms ease-out; }
  .toggle input::after { transition: left 140ms ease-out; }
  ::view-transition-old(main), ::view-transition-new(main) { animation-duration: 140ms; }
  .spark path.line { stroke-dasharray: 1000; animation: draw 900ms ease-out; }
}
main { view-transition-name: main; }
@keyframes slide-in { from { transform: translateX(32px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes arrive { from { background: var(--brand-soft); } to { background: transparent; } }
@keyframes bump { 0% { color: var(--brand); } 100% { color: inherit; } }
@keyframes beat { 0% { box-shadow: 0 0 0 0 rgb(102 187 106 / 0.55); } 100% { box-shadow: 0 0 0 8px rgb(102 187 106 / 0); } }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }
@keyframes draw { from { stroke-dashoffset: 1000; } to { stroke-dashoffset: 0; } }
