/* Web app styles. Fonts and color tokens (--bg, --accent, --font, ...) come from brand.css,
   which base.html links first. */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; color: var(--fg);
  background: radial-gradient(900px 360px at 0% -10%, rgba(6, 36, 255, .10), transparent 70%),
    var(--bg);
  font: 15px/1.55 var(--font); }
::selection { background: var(--violet); color: var(--fg); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
main { max-width: 1200px; margin: 0 auto; padding: 24px 16px 48px; }
h1 { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.1rem); line-height: 1.1; font-weight: 700;
  letter-spacing: -.02em; text-transform: uppercase; margin: .5rem 0 1.25rem;
  overflow-wrap: anywhere; }
h1 code { color: var(--accent); font-size: .8em; }
h2 { font-size: 1.15rem; font-weight: 600; letter-spacing: -.01em; margin: 2rem 0 .75rem; }
.card h2:first-child { margin-top: 0; }
code { font-family: var(--mono); font-size: .88em; letter-spacing: -.01em; text-transform: none; }
.mono { font-family: var(--mono); font-size: .88em; letter-spacing: -.01em; }

/* Header: the hosted white lockup, never redrawn, next to the app name. */
.top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
  gap: 8px 16px; padding: 14px 16px; border-bottom: 1px solid var(--border);
  background: rgba(10, 10, 12, .85); }
.brand { display: inline-flex; align-items: center; gap: 14px; color: var(--fg);
  text-decoration: none; }
.brand .logo { display: block; height: 24px; width: auto; }
.brand .app { font: 500 .75rem/1 var(--mono); letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent); border-left: 1px solid var(--border); padding-left: 14px;
  white-space: nowrap; }
.session { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; min-width: 0; }
.session > a { text-decoration: none; font-weight: 500; }
.session > a:hover { text-decoration: underline; }
.logout { display: flex; align-items: center; gap: 10px; margin: 0; min-width: 0; }
.logout .muted { overflow-wrap: anywhere; }

.card { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin: 16px 0; }
.narrow { max-width: 420px; margin: 48px auto; }
.muted, .hint { color: var(--muted); }
.hint { font-size: .88rem; margin: 0; }
.stack { display: grid; gap: 14px; max-width: 720px; }

/* Forms */
label { display: grid; gap: 6px; font-weight: 500; }
label.inline { display: inline-flex; align-items: center; gap: 8px; font-weight: 400;
  margin-right: 16px; }
input:not([type=checkbox]):not([type=radio]):not([type=hidden]) { font: inherit;
  font-weight: 400; min-width: 0; padding: 10px 12px; border: 1px solid var(--dim);
  border-radius: var(--radius); background: var(--bg); color: var(--fg); }
input::placeholder { color: var(--muted); opacity: .7; }
input:not([type=checkbox]):not([type=radio]):hover { border-color: var(--muted); }
input:not([type=checkbox]):not([type=radio]):focus { outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 16px;
  height: 16px; margin: 0; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px;
  margin: 0; }
legend { font: 500 .72rem/1 var(--mono); letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); padding: 0 6px; }
button { font: inherit; font-weight: 600; letter-spacing: .01em; padding: 10px 20px;
  border-radius: var(--radius); border: 1px solid var(--accent); background: var(--accent);
  color: var(--bg); cursor: pointer; justify-self: start; }
button:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button:disabled { opacity: .4; cursor: not-allowed; }
button:disabled:hover { background: var(--accent); border-color: var(--accent); }
button.link { background: none; border: 0; color: var(--accent); padding: 0; font-weight: 500; }
button.link:hover { color: var(--accent-hover); text-decoration: underline;
  text-underline-offset: 3px; }

/* Messages */
.error, .warning, .ok { border-left: 3px solid; padding: 10px 14px; margin: 12px 0; }
.error { color: var(--error); background: rgba(255, 107, 107, .08); }
.warning { color: var(--warning); background: rgba(255, 181, 71, .08); }
.ok { color: var(--ok); background: rgba(61, 214, 140, .08); }
ul.error, ul.warning, ul.ok { padding-left: 32px; }

/* Tables scroll inside their box; the page never scrolls sideways. */
.scroll { overflow-x: auto; max-width: 100%; border: 1px solid var(--border);
  background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { text-align: left; vertical-align: top; padding: 10px 12px;
  border-bottom: 1px solid var(--border); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--carbon); }
th { color: var(--muted); font: 500 .72rem/1.4 var(--mono); letter-spacing: .08em;
  text-transform: uppercase; white-space: nowrap; }
/* Both tables open with the date column. */
tbody td:first-child { font-family: var(--mono); font-size: .82rem; white-space: nowrap; }
.url { overflow-wrap: anywhere; max-width: 320px; }

/* Audit states */
.state { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px;
  border-radius: var(--radius); font: 700 .72rem/1.5 var(--mono); letter-spacing: .05em;
  text-transform: uppercase; border: 1px solid currentColor; white-space: nowrap;
  vertical-align: middle; }
.state.queued { color: var(--muted); }
.state.running { color: var(--accent); background: rgba(80, 186, 255, .10); }
.state.done { color: var(--ok); background: rgba(61, 214, 140, .10); }
.state.failed { color: var(--error); background: rgba(255, 107, 107, .10); }
.state.interrupted { color: var(--warning); background: rgba(255, 181, 71, .10); }
.state.running::before { content: ""; width: 6px; height: 6px; background: currentColor;
  animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .state.running::before { animation: none; } }

dl.meta { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; margin: 0; }
dl.meta dt { color: var(--muted); font: 500 .72rem/2 var(--mono); letter-spacing: .08em;
  text-transform: uppercase; }
dl.meta dd { margin: 0; overflow-wrap: anywhere; min-width: 0; }

/* Progress */
progress { width: min(420px, 100%); height: 6px; vertical-align: middle; appearance: none;
  border: 0; border-radius: var(--radius); background: var(--border); }
progress::-webkit-progress-bar { background: var(--border); }
progress::-webkit-progress-value { background: var(--accent); }
progress::-moz-progress-bar { background: var(--accent); }
[data-field="count"] { font-family: var(--mono); font-size: .88em; }
pre.lines { white-space: pre-wrap; overflow-wrap: anywhere; font: .78rem/1.6 var(--mono);
  color: var(--muted); max-height: 320px; overflow-y: auto; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
pre.lines:empty { display: none; }

@media (max-width: 560px) {
  main { padding-top: 16px; }
  .card { padding: 16px; }
  .narrow { margin: 24px auto; }
  .brand { gap: 10px; }
  .brand .logo { height: 20px; }
  .brand .app { padding-left: 10px; }
  dl.meta { grid-template-columns: 1fr; gap: 0; }
  dl.meta dd { margin-bottom: 10px; }
}

/* Download button inside the judgments table: a POST form that reads as a link. */
form.download { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin: 4px 0 0; }
form.download .hint { font-size: .8rem; }
