/* NEFLiCCS 2026 portal. Colours come from the Halimafactor logo: ring orange,
   red-orange figure, grey figure, white. Light and dark themes share one set of
   variables, so every component follows the toggle. */
:root {
  --orange: #f56504;
  --orange-strong: #c94d00;   /* buttons: white text on it passes 5:1 */
  --orange-hover: #a84000;
  --red: #ff3300;
  --link: #b84700;
  --page: #f4f1ed;
  --paper: #ffffff;
  --paper-2: #faf7f3;
  --ink: #26221f;
  --muted: #5d5650;
  --line: #e0d9d1;
  --field-line: #a9a198;
  --header: #25211e;
  --header-ink: #ffffff;
  --header-muted: #d6d0c9;
  --soft: #fff1e6;
  --ok: #1d7a46;       --ok-bg: #e6f4ec;   --ok-line: #9bd1b2;   --ok-ink: #115130;
  --err-bg: #ffe9e4;   --err-line: #f2a595; --err-ink: #7a1d0a;
  --warn-bg: #fff4d6;  --warn-line: #e8cf84; --warn-ink: #5b4400;
  --grey-bg: #ececec;  --grey-line: #cfcfcf; --grey-ink: #444;
  --jr-bg: #fff1e6; --jr-line: #f7c299; --jr-ink: #8a3700;
  --in-bg: #eef0f5; --in-line: #c9cfe0; --in-ink: #333b57;
  --sr-bg: #efefef; --sr-line: #cfcfcf; --sr-ink: #3b3b3b;
  --focus: #1a5fd0;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 6px 18px rgba(0, 0, 0, .06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --link: #ff9a5c;
  --page: #11161b;
  --paper: #1a222a;
  --paper-2: #202b35;
  --ink: #eef2f5;
  --muted: #b3c0cb;
  --line: #2f3d49;
  --field-line: #5b6b78;
  --header: #0b1015;
  --soft: #2b2018;
  --ok: #5fd08d;       --ok-bg: #12301f;   --ok-line: #2e6b47;   --ok-ink: #b8f0cf;
  --err-bg: #3a1c17;   --err-line: #7d392e; --err-ink: #ffcfc6;
  --warn-bg: #3a3014;  --warn-line: #7a672a; --warn-ink: #ffe9a8;
  --grey-bg: #2a333b;  --grey-line: #424f5a; --grey-ink: #d5dde4;
  --jr-bg: #3a2414; --jr-line: #86512a; --jr-ink: #ffd2ae;
  --in-bg: #232a3d; --in-line: #44507a; --in-ink: #d2d9f5;
  --sr-bg: #2a2f35; --sr-line: #48515a; --sr-ink: #dfe4e8;
  --focus: #ffd24a;
  --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--ink); font: 16px/1.5 var(--font); min-height: 100vh;
  display: flex; flex-direction: column; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6rem; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .8rem; }
a { color: var(--link); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

/* ---- header ---------------------------------------------------------- */
.top { background: var(--header); color: var(--header-ink); border-bottom: 5px solid var(--orange); }
.top-inner { max-width: 1100px; margin: 0 auto; padding: .7rem 16px; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .75rem; color: var(--header-ink); text-decoration: none; margin-right: auto; }
.brand img { width: 52px; height: 52px; border-radius: 50%; background: #fff; flex: none; }
.brand b { display: block; font-size: 1.05rem; letter-spacing: .05em; text-transform: uppercase; line-height: 1.15; }
.brand small { display: block; color: var(--header-muted); font-size: .8rem; }
.clock { text-align: right; line-height: 1.2; }
.clock b { display: block; font-size: 1.45rem; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.clock span { font-size: .78rem; color: var(--header-muted); }
.theme-btn { background: transparent; color: var(--header-ink); border: 1px solid rgba(255, 255, 255, .45); border-radius: 999px;
  padding: .35rem .85rem; font: inherit; font-size: .85rem; cursor: pointer; min-height: 38px; }
.theme-btn:hover { background: rgba(255, 255, 255, .14); }
.nav-row { background: rgba(255, 255, 255, .06); border-top: 1px solid rgba(255, 255, 255, .08); }
.nav { max-width: 1100px; margin: 0 auto; padding: .25rem 12px; display: flex; gap: .3rem; flex-wrap: wrap; align-items: center; }
.nav a, .nav button { color: var(--header-ink); background: transparent; border: 0; border-radius: 8px; padding: .5rem .85rem;
  font: inherit; text-decoration: none; cursor: pointer; min-height: 42px; display: inline-flex; align-items: center; }
.nav a:hover, .nav button:hover { background: rgba(255, 255, 255, .13); }
.nav a[aria-current="page"] { background: var(--orange-strong); }
.nav .who { color: var(--header-muted); font-size: .85rem; padding: 0 .5rem; margin-left: auto; }

main { width: 100%; max-width: 1100px; margin: 0 auto; padding: 22px 16px 50px; flex: 1; }
footer { text-align: center; color: var(--muted); font-size: .88rem; padding: 18px 16px 26px; border-top: 1px solid var(--line); background: var(--paper); }
footer p { margin: 0 0 .25rem; }
footer .small { font-size: .8rem; }

/* ---- components ------------------------------------------------------ */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }

/* home: sign-in at the front door, like the FMCK dashboard */
.stage { position: relative; border-radius: 16px; overflow: hidden; margin-bottom: 18px; box-shadow: var(--shadow);
  background: linear-gradient(150deg, #f56504 0%, #ec4a00 45%, #d63a00 100%); isolation: isolate; }
.stage::before { content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(150deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, .02));
  clip-path: polygon(0 66%, 100% 30%, 100% 100%, 0 100%); }
.stage::after { content: ""; position: absolute; z-index: -1; right: -60px; top: -60px; width: 260px; height: 260px; border-radius: 50%;
  background: rgba(255, 255, 255, .09); }
.stage-grid { display: grid; gap: 18px 22px; padding: 26px 20px; grid-template-columns: 1fr; align-items: start;
  grid-template-areas: "intro" "card" "actions"; }
.stage-intro { grid-area: intro; } .stage-card { grid-area: card; } .stage-actions { grid-area: actions; margin-top: 0 !important; }
@media (min-width: 880px) {
  .stage-grid { grid-template-columns: 1.15fr .85fr; padding: 34px 32px; align-items: center;
    grid-template-areas: "intro card" "actions card"; grid-template-rows: auto auto; }
  .stage-intro { align-self: end; } .stage-actions { align-self: start; }
}
.stage h1 { color: #fff; font-size: 2rem; margin: 0 0 .4rem; text-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.stage .lead { color: #fff; font-size: 1.05rem; text-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.stage .row { margin-top: .6rem; }
.stage .venue { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; font-weight: 700; }
.stage .venue-label { background: rgba(255, 255, 255, .22); border: 1px solid rgba(255, 255, 255, .6); border-radius: 999px;
  padding: .05rem .7rem; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
.stage .btn.light { background: #fff; color: #a8330a; border-color: #fff; }
.stage .btn.light:hover { background: #ffe8dc; }
.stage .btn.outline { background: transparent; color: #fff; border-color: #fff; }
.stage .btn.outline:hover { background: rgba(255, 255, 255, .18); }
.signin-card { background: var(--paper); color: var(--ink); border-radius: 14px; padding: 22px; box-shadow: 0 10px 30px rgba(0, 0, 0, .28); }
.signin-card .logo-lg { display: block; width: 84px; height: 84px; margin: 0 auto .5rem; border-radius: 50%; background: #fff; }
.signin-card h2 { text-align: center; margin-bottom: .1rem; }
.signin-card .sub { text-align: center; color: var(--muted); font-size: .9rem; margin-bottom: .4rem; }
.signin-card .links { font-size: .9rem; color: var(--muted); margin-top: 1rem; }
.signin-card .links p { margin: 0 0 .5rem; }
.auth-page { max-width: 460px; margin: 18px auto 0; }

.counters { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 16px; }
.counter { background: var(--paper); border-left: 6px solid var(--orange); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.counter .num { font-size: 1.8rem; font-weight: 800; color: var(--link); font-variant-numeric: tabular-nums; }
.counter.closed { border-left-color: var(--field-line); }
.counter.closed .num { color: var(--muted); }
.guide { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.guide li { counter-increment: step; display: flex; gap: .9rem; align-items: flex-start; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.guide li:last-child { border-bottom: 0; padding-bottom: 0; }
.guide li::before { content: counter(step); flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--orange-strong); color: #fff; font-weight: 800; font-size: .95rem; margin-top: .05rem; }

label { display: block; font-weight: 600; margin: .8rem 0 .25rem; }
input, select, textarea { width: 100%; min-height: 44px; padding: .55rem .7rem; font: inherit; color: var(--ink); background: var(--paper); border: 1.5px solid var(--field-line); border-radius: 8px; }
textarea { min-height: 120px; line-height: 1.45; }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; margin-right: .4rem; }
.check { display: flex; align-items: center; font-weight: 500; margin: .5rem 0; }
.hint { color: var(--muted); font-size: .86rem; margin-top: .2rem; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 44px; padding: .5rem 1rem; font: inherit; font-weight: 700;
  border-radius: 8px; cursor: pointer; background: var(--orange-strong); color: #fff; border: 2px solid var(--orange-strong); text-decoration: none; }
.btn:hover { background: var(--orange-hover); border-color: var(--orange-hover); }
.btn.ghost { background: transparent; color: var(--link); border-color: var(--link); }
.btn.ghost:hover { background: var(--soft); }
.btn.danger { background: #c42600; border-color: #c42600; }
.btn.small { min-height: 36px; padding: .25rem .7rem; font-size: .88rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.alert { padding: .7rem .9rem; border-radius: 8px; margin: .6rem 0; border: 1px solid; }
.alert.error { background: var(--err-bg); border-color: var(--err-line); color: var(--err-ink); }
.alert.ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-ink); }
.alert.info { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }

.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 700; border: 1px solid; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok-ink); border-color: var(--ok-line); }
.badge.late { background: var(--err-bg); color: var(--err-ink); border-color: var(--err-line); }
.badge.flag { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-line); }
.badge.grey { background: var(--grey-bg); color: var(--grey-ink); border-color: var(--grey-line); }
.badge.level-Junior { background: var(--jr-bg); color: var(--jr-ink); border-color: var(--jr-line); }
.badge.level-Intermediate { background: var(--in-bg); color: var(--in-ink); border-color: var(--in-line); }
.badge.level-Senior { background: var(--sr-bg); color: var(--sr-ink); border-color: var(--sr-line); }

.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
table { border-collapse: collapse; width: 100%; font-size: .93rem; }
th, td { text-align: left; padding: .55rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--paper-2); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }

.tabs { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: 14px; border-bottom: 2px solid var(--line); }
.tabs a { padding: .55rem .9rem; text-decoration: none; color: var(--ink); border-radius: 8px 8px 0 0; font-weight: 600; }
.tabs a:hover { background: var(--soft); }
.tabs a[aria-current="page"] { background: var(--orange-strong); color: #fff; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: .7rem 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }

.judge { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .judge { grid-template-columns: 300px 1fr; } }
.entrylist button { width: 100%; text-align: left; background: var(--paper); color: var(--ink); border: 1.5px solid var(--line); border-radius: 8px; padding: .6rem .7rem; margin-bottom: 6px; cursor: pointer; font: inherit; }
.entrylist button[aria-pressed="true"] { border-color: var(--orange-strong); background: var(--soft); }
.entrylist .done { color: var(--ok); font-weight: 700; }
.preview { width: 100%; height: 480px; border: 1px solid var(--line); border-radius: 8px; background: #eee; }
.scoregrid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.total { font-size: 1.6rem; font-weight: 800; color: var(--link); }

.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--header); color: #fff; padding: .7rem 1.1rem; border-radius: 10px; box-shadow: var(--shadow); z-index: 20; max-width: 92vw; }

/* phones: one card per row instead of a sideways-scrolling table */
@media (max-width: 640px) {
  .clock b { font-size: 1.15rem; }
  .brand b { font-size: .92rem; }
  .brand img { width: 44px; height: 44px; }
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { padding: .7rem .8rem; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; }
  table.stack td { display: flex; gap: .7rem; border: 0; padding: .3rem 0; }
  table.stack td::before { content: attr(data-label); flex: 0 0 92px; font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); padding-top: .15rem; }
  .tablewrap { border: 0; background: transparent; overflow-x: visible; }
  table.stack td > * { min-width: 0; }
  table.stack .badge { white-space: normal; align-self: flex-start; }
  table.stack td > div { flex: 1 1 auto; }
}

/* ---- print: reports -------------------------------------------------- */
.print-only { display: none; }
@media print {
  @page { size: A4; margin: 14mm 12mm; }
  :root, :root[data-theme="dark"] { --page: #fff; --paper: #fff; --paper-2: #f3f3f3; --ink: #000; --muted: #333; --line: #bbb; }
  body { background: #fff; color: #000; font-size: 11pt; display: block; }
  .top, footer, .no-print, .tabs, .toast { display: none !important; }
  main { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 0; padding: 0; }
  .print-only { display: block; }
  .report-head { display: flex; gap: 12px; align-items: center; border-bottom: 3px solid var(--orange); padding-bottom: 8px; margin-bottom: 8px; }
  .report-head img { width: 56px; height: 56px; }
  table { font-size: 10pt; }
  thead { display: table-header-group; }
  tr { break-inside: avoid; }
  th { position: static; }
  .page-break { break-before: page; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
