/* ================================================================
   NADAC Championships — event/ pages, styled to match the NADAC
   Trial Secretary desktop app: flat theme, purple identity,
   green = good, amber = warning, red = problem. No gradients,
   no shadows — borders and solid fills only. Touch targets sized
   for ring-side tablets.
   ================================================================ */
:root {
  --purple: #534ab7;
  --purple-dark: #433ba0;
  --purple-soft: #ecebf7;
  --purple-softer: #f5f4fc;
  --green: #2e9e5b;
  --green-soft: #e6f4ec;
  --amber: #d99000;
  --amber-soft: #fbf1da;
  --red: #d64545;
  --red-soft: #fae9e9;
  --bg: #f4f4f8;
  --surface: #ffffff;
  --border: #e2e2ea;
  --border-strong: #cfcfdb;
  --text: #1d1d24;
  --text-muted: #6b6b78;
  --radius: 8px;
  --radius-sm: 6px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }

header.bar {
  position: sticky; top: 0; z-index: 20;
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 10px 14px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
}
header.bar h1 { font-size: 17px; margin-right: 8px; white-space: nowrap; color: var(--text); }
header.bar a.home {
  margin-left: auto; color: var(--purple-dark); background: var(--purple-soft);
  text-decoration: none; font-size: 13px; font-weight: 600;
  padding: 7px 14px; border-radius: var(--radius-sm);
}
header.bar select, header.bar input[type=search], header.bar input[type=text] {
  font-size: 15px; font-family: inherit; padding: 8px 10px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text);
}
/* ── How wide a page is allowed to get ──────────────────────────
 *  `main` was capped at a flat 1100px, which on the office's monitor
 *  left a 15-column run order squeezed into the middle third of the
 *  screen with `.tbl-wrap` scrolling sideways over empty desk either
 *  side. The cap is now a VARIABLE a page opts out of, rather than one
 *  number for everything: a READING page (a form, the hub, a sign-up)
 *  still wants a comfortable measure — text set 1700px wide is worse,
 *  not better — while a TABLE page wants the window.
 *  `main class="wide"` is that opt-in. Nothing gets wider by accident. */
main { padding: 16px 14px; max-width: var(--page-max, 1180px); margin: 0 auto; }
main.wide { --page-max: 1700px; }
/* Room to breathe once there is room to spare — and a wider gutter so
 * a full-width table never runs into the edge of the glass. */
@media (min-width: 900px)  { main { padding: 20px 22px; } }
@media (min-width: 1500px) { main { padding: 22px 32px; } }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px;
}
.card h2 { font-size: 15px; margin: 0 0 12px; }
.muted { color: var(--text-muted); font-size: 13px; }

button, .btn {
  font-family: inherit; font-size: 15px; font-weight: 600;
  padding: 9px 16px; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: var(--purple); color: #fff; cursor: pointer; touch-action: manipulation;
}
button:not(:disabled):hover, .btn:not(:disabled):hover { background: var(--purple-dark); }
button:disabled { opacity: .5; cursor: not-allowed; }
.btn-green  { background: var(--green); }
.btn-green:not(:disabled):hover { background: #257f49; }
.btn-red    { background: var(--red); }
.btn-red:not(:disabled):hover { background: #bd3a3a; }
.btn-amber  { background: var(--amber); }
.btn-amber:not(:disabled):hover { background: #b87a00; }
.btn-ghost  { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn-ghost:not(:disabled):hover { background: var(--bg); }
.btn-big    { font-size: 18px; padding: 14px 18px; width: 100%; }

table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .03em;
  color: var(--text-muted); padding: 6px 10px; border-bottom: 1px solid var(--border);
  background: var(--surface);
}
table.list td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.list tr:last-child td { border-bottom: none; }
table.list tr.sel td { background: var(--purple-soft); }
table.list tr.break-row td { background: var(--purple-softer); font-style: italic; color: var(--text-muted); }
.tbl-wrap { overflow-x: auto; }

.pill {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px; letter-spacing: .01em; white-space: nowrap;
}
.pill-open   { background: var(--green-soft); color: var(--green); }
.pill-taken  { background: var(--purple-softer); color: var(--text-muted); border: 1px solid var(--border); }
.pill-chute  { background: var(--amber-soft); color: var(--amber); }
.pill-absent { background: var(--red-soft); color: var(--red); }
.pill-ran    { background: var(--green-soft); color: var(--green); }
.pill-review { background: var(--amber-soft); color: var(--amber); border: 1px solid var(--amber); }
.pill-bonus  { background: var(--green-soft); color: var(--green); border: 1px solid var(--green); }

/* Easier 10-point bonus line (Pre-Elite / Double Digit years) — the
   scribe has to tell the judge BEFORE the dog runs, so it shouts. */
.pill-easy {
  background: var(--purple-soft); color: var(--purple-dark);
  border: 1px solid var(--purple); font-weight: 700;
}

/* Bar change between two consecutive dogs in the run order — the crew
   resets the jumps here. Made to stand out (office, 2026-09): a lilac band
   with a thick purple edge and big dark-purple type, so it reads clearly
   against the dogs but stays a step below the amber LEVEL change. One
   style for the scoring list (.bar-row) and both builder previews
   (.jump-divider). */
table.list tr.bar-row td, table.list tr.jump-divider td {
  background: #dcd9f5; color: var(--purple-dark);
  font-weight: 800; letter-spacing: .03em; text-transform: uppercase; font-size: 14px;
  padding: 8px 12px; border-top: 2px solid var(--purple);
}
table.list tr.bar-row td:first-child, table.list tr.jump-divider td:first-child {
  border-left: 6px solid var(--purple);
}
.bar-flag { color: var(--amber); font-weight: 800; }

/* Anything below that sets its own `display` would otherwise beat the
   UA's [hidden] rule — the trap index.php hit with label.fld. */
[hidden] { display: none !important; }

/* Scoring sheet: the easier bonus line, and the pending-review tick. */
.easy-line {
  display: block; background: var(--purple-soft); border: 1px solid var(--purple);
  border-radius: var(--radius-sm); padding: 10px 12px; margin: 4px 0 10px;
  color: var(--purple-dark); font-weight: 700; font-size: 15px;
}
.review-tick {
  display: flex; align-items: center; gap: 9px; cursor: pointer;
  background: var(--amber-soft); border: 1px solid var(--amber);
  border-radius: var(--radius-sm); padding: 11px 12px;
  color: var(--amber); font-weight: 600; font-size: 14px;
}
.review-tick input { width: 18px; height: 18px; accent-color: var(--amber); }
.reviewed-line {
  display: block; background: var(--green-soft); border: 1px solid var(--green);
  border-radius: var(--radius-sm); padding: 9px 12px; margin: 4px 0 10px;
  color: var(--green); font-weight: 600; font-size: 14px;
}

.grid { display: grid; gap: 12px; }
@media (min-width: 700px) { .grid.cols2 { grid-template-columns: 1fr 1fr; } }

label.fld { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin: 10px 0 4px; }
input[type=text], input[type=number], input[type=password], input[type=search], select, textarea {
  width: 100%; font-size: 15px; font-family: inherit; padding: 9px 10px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px var(--purple-soft);
}
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.row > * { flex: 1 1 140px; }
.row > .fit { flex: 0 0 auto; }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--text); color: #fff; padding: 11px 20px;
  border-radius: var(--radius-sm); font-weight: 600; font-size: 14px;
  opacity: 0; transition: opacity .25s; pointer-events: none; z-index: 99; max-width: 92vw;
}
#toast.show { opacity: .97; }
#toast.err { background: var(--red); }

/* Staff sign-in screen */
body.gate-body { display: grid; place-items: center; min-height: 100vh; }
.gate-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px; width: min(380px, 92vw); text-align: center;
}
.gate-card h1 { font-size: 19px; margin: 0 0 6px; }
.gate-card p { color: var(--text-muted); font-size: 14px; }
.gate-card input { margin: 14px 0; text-align: center; }
.gate-card button { width: 100%; }
.gate-err { color: var(--red); font-weight: 600; }

/* Scoring fault pad */
.pad { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 700px) { .pad { grid-template-columns: repeat(4, 1fr); } }
.pad button { font-size: 15px; padding: 13px 8px; line-height: 1.25; }
.pad button .pts { display: block; font-size: 12px; font-weight: 500; opacity: .85; }

/* Scoring sheet (full-screen focus while scoring one dog) */
.sheet-veil { position: fixed; inset: 0; z-index: 50; background: rgba(29,29,36,.5);
              display: none; overflow-y: auto; padding: 10px; }
.sheet-veil.open { display: block; }
.sheet { background: var(--bg); border: 1px solid var(--border-strong);
         border-radius: var(--radius); max-width: 720px; margin: 0 auto 24px; padding: 14px; }
.sheet-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.sheet-head h2 { margin: 0; font-size: 19px; flex: 1; }
.sheet-head .ord { font-size: 14px; color: var(--text-muted); white-space: nowrap; }
.time-big input { font-size: 30px; font-weight: 700; text-align: center; padding: 12px;
                  color: var(--purple-dark); }
.chips-line { display: flex; flex-wrap: wrap; gap: 8px; min-height: 44px; align-items: center;
              background: var(--surface); border: 1px dashed var(--border-strong);
              border-radius: var(--radius-sm); padding: 8px; }
.chips-line .hint { color: var(--text-muted); font-size: 13px; padding-left: 4px; }
.fault-chip { display: inline-flex; align-items: center; gap: 7px;
              background: var(--red-soft); color: var(--red); border: 1px solid var(--red);
              border-radius: 999px; padding: 7px 12px; font-size: 14px; font-weight: 600; cursor: pointer; }
.fault-chip .x { font-weight: 800; }
.fault-chip.bonus { background: var(--green-soft); color: var(--green); border-color: var(--green); }
.sheet-total { display: flex; justify-content: space-between; align-items: center;
               font-size: 21px; font-weight: 700; margin: 12px 2px; }
.sheet-total .clean { color: var(--green); }
.btn-submit { width: 100%; font-size: 19px; padding: 15px; background: var(--green);
              border-radius: var(--radius-sm); }
.btn-submit:not(:disabled):hover { background: #257f49; }

/* "Up next" bar after a submit */
.nextbar { display: flex; align-items: center; gap: 12px;
           background: var(--purple-soft); border: 1px solid var(--purple);
           border-radius: var(--radius); padding: 12px 16px; margin-bottom: 14px; }
.nextbar b { font-size: 16px; color: var(--purple-dark); }
.nextbar .muted2 { color: var(--text-muted); font-size: 12px; font-weight: 600;
                   text-transform: uppercase; letter-spacing: .03em; }
.nextbar button { margin-left: auto; }

/* Hub menu */
.hub { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.hub a {
  display: block; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; text-decoration: none; color: var(--text);
}
.hub a:hover { border-color: var(--purple); background: var(--purple-softer); }
.hub .emoji { font-size: 26px; display: block; margin-bottom: 8px; }
.hub b { font-size: 15px; font-weight: 600; }
.hub p { margin: 5px 0 0; color: var(--text-muted); font-size: 13px; }

/* Live refresh (gate / scoring): a row whose status just changed glows
   amber for a few seconds, the same flash the public order page uses. */
@keyframes ringflash { from { background: #fff6d8; } to { background: transparent; } }
table.list tr.fresh td { animation: ringflash 5s ease-out; }

/* The "not updating" bar every live page shares (event_live_js()). */
.live-bar { position: sticky; top: 0; z-index: 50; background: var(--red); color: #fff;
            padding: 10px 16px; font-weight: 600; font-size: 15px; text-align: center; }
.live-bar.ok { background: var(--green); }
.live-bar[hidden] { display: none; }

/* The time box's live reading of what was typed (event_time_js()). */
.time-hint { font-size: 14px; color: var(--muted); margin: 4px 0 0; min-height: 1.2em; }
.time-hint.bad { color: var(--red); font-weight: 600; }
/* The scoring sheet's warning when the dog on it is marked absent. */
.absent-warn { background: var(--red-soft); color: var(--red); border: 1px solid var(--red);
               border-radius: var(--radius-sm); padding: 10px 12px; margin: 0 0 12px; font-weight: 600; }
.absent-warn[hidden] { display: none; }

/* THE LEVEL DIVIDER (pre-trial, office 2026-09): a level change is a course
   reset, so it has to be impossible to miss on every Tuesday list — the
   scribe sheet, the order page and the public order. Dark band, heavy top
   rule, big type; the first level of the run gets the band without the
   "level change" wording. */
table.list tr.level-divider td {
  background: var(--purple); color: #fff; font-weight: 800; font-size: 16px;
  letter-spacing: .05em; text-transform: uppercase; padding: 10px 12px;
  border-top: 5px solid var(--purple-dark, #3c3489);
}
table.list tr.level-divider.first td { border-top: 0; }
/* The CHANGE itself is amber, not the site's purple, so it jumps out of a
   purple page (office, 2026-09). Dark text: white on this amber is too
   faint to read at a glance. The run's opening band stays purple. */
table.list tr.level-divider:not(.first) td {
  background: var(--amber); color: #1f1600; border-top: 6px solid #8a5a00;
  border-bottom: 2px solid #8a5a00; font-size: 17px;
}
table.list tr.level-divider td .ld-sub { font-weight: 600; font-size: 13px; letter-spacing: 0;
  text-transform: none; opacity: .85; margin-left: 10px; }
