:root {
  --navy: #0f2742; --navy-2: #1b3a5e; --sky: #2b78c2; --sky-soft: #e7f0fa; --amber: #f2a33a;
  --bg: #f3f5f8; --card: #fff; --line: #dde3ea; --text: #1a2433; --muted: #66758a;
  --ok: #1f8a4c; --ok-soft: #e4f4ea; --warn: #b36b00; --warn-soft: #fff3df; --bad: #c0392b; --bad-soft: #fde8e6; --info: #2b78c2; --info-soft: #e7f0fa;
  --radius: 10px; --shadow: 0 1px 2px rgba(15, 39, 66, .06), 0 2px 8px rgba(15, 39, 66, .05);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px; color: var(--text); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--sky); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 0; }
h3 { font-size: .95rem; margin: 1rem 0 .5rem; }
small, .small { font-size: .85em; }
.muted { color: var(--muted); }
.block { display: block; }
.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.text-ok { color: var(--ok); font-weight: 600; } .text-bad { color: var(--bad); font-weight: 600; }

/* Shell */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { background: var(--navy); color: #fff; display: flex; align-items: center; gap: 1.5rem; padding: .6rem 1.5rem; position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: .6rem; color: #fff; }
.brand:hover { text-decoration: none; }
.brand span { display: flex; flex-direction: column; line-height: 1.1; }
.brand small { color: #9fb4cc; font-size: .72rem; }
.brand-logo { height: 48px; width: auto; display: block; margin: -4px 0; }
.login-logo { height: 120px; width: auto; align-self: center; }
.report-logo { height: 64px; width: auto; display: block; margin: 0 auto .4rem; }
.mainnav { display: flex; gap: .25rem; flex: 1; flex-wrap: wrap; }
.mainnav a { color: #c9d6e5; padding: .45rem .75rem; border-radius: 6px; font-weight: 500; }
.mainnav a:hover { background: var(--navy-2); color: #fff; text-decoration: none; }
.mainnav a.active { background: var(--navy-2); color: #fff; box-shadow: inset 0 -2px 0 var(--amber); }
.userbox { display: flex; align-items: center; gap: .6rem; }
.userbox .username { color: #fff; font-weight: 500; }
.userbox .btn-ghost { color: #c9d6e5; border-color: #3a5577; }
.main { flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: 1.5rem; }
.footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 1.5rem; }
.subnav { display: flex; gap: 1.2rem; border-bottom: 1px solid var(--line); margin-bottom: 1.25rem; padding-bottom: .5rem; flex-wrap: wrap; }
.subnav a { color: var(--muted); font-weight: 500; }

/* Page & layout */
.page { display: flex; flex-direction: column; gap: 1.25rem; }
.page.narrow { max-width: 720px; margin: 0 auto; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.page-head p { margin: .3rem 0 0; }
.page-actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.grid2, .grid3, .grid2-wide { display: grid; gap: 1.25rem; }
.grid2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid2-wide { grid-template-columns: minmax(0, 3fr) minmax(300px, 2fr); align-items: start; }
.grid2 .grid2, .card .grid2 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem; }
.card .grid3 { gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.span2 { grid-column: 1 / -1; }
@media (max-width: 860px) { .grid2-wide { grid-template-columns: 1fr; } .topbar { flex-wrap: wrap; gap: .5rem; } }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.stack-sm { display: flex; flex-direction: column; gap: .5rem; }
.row { display: flex; gap: .5rem; align-items: center; }
.row.wrap, .wrap { flex-wrap: wrap; }
.row.between, .between { justify-content: space-between; }
.gap { gap: .75rem; }
.indent { padding-left: 1.6rem; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .75rem; }
.card-ok { border-top: 4px solid var(--ok); }
.card-warn { border-top: 4px solid var(--amber); }
.card-highlight { border-color: #b9d3ee; box-shadow: 0 0 0 3px var(--sky-soft); }
.card-link { color: inherit; display: block; }
.card-link:hover { text-decoration: none; border-color: var(--sky); }
.card-link h2 { margin-bottom: .4rem; }
.card.inset { box-shadow: none; background: #fafbfd; margin-top: .75rem; }
.narrow-card { max-width: 480px; }
.stat-big { font-size: 1.35rem; font-weight: 700; color: var(--navy); }
.empty { color: var(--muted); padding: .75rem 0; font-style: italic; }
.loading { color: var(--muted); padding: 2rem; text-align: center; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .75rem; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; display: flex; flex-direction: column; color: inherit; border-left: 4px solid var(--sky); }
a.stat:hover { text-decoration: none; border-color: var(--sky); }
.stat b { font-size: 1.5rem; color: var(--navy); font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .82rem; }
.stat-ok { border-left-color: var(--ok); } .stat-warn { border-left-color: var(--amber); } .stat-bad { border-left-color: var(--bad); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .5rem .95rem; border-radius: 7px; border: 1px solid var(--line); background: #fff; color: var(--text); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #b8c3cf; text-decoration: none; background: #fafbfc; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--sky); border-color: var(--sky); color: #fff; }
.btn-primary:hover { background: #2367a8; border-color: #2367a8; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ok:hover { background: #18723e; }
.btn-danger { background: #fff; border-color: #e7b3ad; color: var(--bad); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: rgba(0, 0, 0, .04); border-color: transparent; }
.btn-small { padding: .3rem .65rem; font-size: .85rem; }
.btn-icon { background: none; border: 1px solid transparent; border-radius: 6px; cursor: pointer; font-size: 1rem; padding: .2rem .45rem; color: var(--muted); }
.btn-icon:hover:not(:disabled) { background: var(--bg); border-color: var(--line); }
.btn-icon:disabled { opacity: .3; }
.btn-oauth { width: 100%; padding: .7rem; font-weight: 600; }
.confirm-inline { display: inline-flex; align-items: center; gap: .4rem; font-size: .9rem; }

/* Forms */
.field { display: flex; flex-direction: column; gap: .3rem; }
.field-label { font-size: .82rem; font-weight: 600; color: #3c4a5e; }
.field-hint { font-size: .78rem; color: var(--muted); }
input, select, textarea { font: inherit; padding: .5rem .65rem; border: 1px solid #c9d2dc; border-radius: 7px; background: #fff; color: var(--text); width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus, .rte-body:focus { outline: 2px solid #9cc3ea; outline-offset: 0; border-color: var(--sky); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--sky); }
input:disabled { background: #f2f4f7; }
.check { display: flex; gap: .6rem; align-items: flex-start; cursor: pointer; line-height: 1.4; }
.check input { margin-top: .2rem; flex: none; }
fieldset { border: 0; padding: 0; margin: 0; }
fieldset:disabled { opacity: .5; }
.fieldset { border: 1px solid var(--line); border-radius: 8px; padding: .75rem 1rem 1rem; display: flex; flex-direction: column; gap: .75rem; }
.fieldset legend { font-weight: 600; font-size: .9rem; padding: 0 .3rem; }
.form-actions { margin-top: 1rem; display: flex; gap: .5rem; }
.search { max-width: 260px; }
.narrow-field { max-width: 420px; }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; align-self: flex-start; }
.segmented button { border: 0; background: #fff; padding: .55rem 1.2rem; font: inherit; font-weight: 600; cursor: pointer; color: var(--muted); }
.segmented button + button { border-left: 1px solid var(--line); }
.segmented button.on { background: var(--navy); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: .3rem .8rem; cursor: pointer; font-size: .88rem; user-select: none; }
.chip input { display: none; }
.chip.on { background: var(--sky-soft); border-color: var(--sky); color: var(--navy); font-weight: 600; }
.item-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .35rem 0; border-bottom: 1px dashed var(--line); }
.item-row:last-child { border-bottom: 0; }
.item-row select { width: 70px; }
.cost-box { background: #f7f9fc; border-radius: 8px; padding: .75rem 1rem; }
.cost-box h3 { margin-top: 0; }

/* Tables */
.table-wrap { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: .6rem .75rem; border-bottom: 1px solid var(--line); background: #fafbfc; }
.table td { padding: .6rem .75rem; border-bottom: 1px solid #edf0f4; vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table.compact th, .table.compact td { padding: .4rem .5rem; }
.card > .table th:first-child, .card > .table td:first-child { padding-left: 0; }
.table-wrap > .table th:first-child, .table-wrap > .table td:first-child { padding-left: 1.25rem; }
.cost td { border-bottom: 0; padding: .2rem 0; }
.cost .total td { border-top: 1px solid var(--line); font-weight: 700; padding-top: .4rem; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #f7faff; }
tr.open td { background: var(--sky-soft); }
tr.detail-row > td { background: #fbfcfe; padding: 1rem 1.25rem; }
.money { font-variant-numeric: tabular-nums; }

/* Badges */
.badge { display: inline-block; padding: .14rem .55rem; border-radius: 999px; font-size: .74rem; font-weight: 600; white-space: nowrap; vertical-align: middle; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-muted { background: #eef1f4; color: var(--muted); }
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 4px; background: #d6dce3; }
.dot-valid { background: var(--ok); } .dot-expiring, .dot-pending { background: var(--amber); } .dot-missing, .dot-expired, .dot-rejected { background: var(--bad); }

/* Alerts & toasts */
.alert { padding: .7rem 1rem; border-radius: 8px; border: 1px solid; line-height: 1.45; }
.alert-error { background: var(--bad-soft); border-color: #f2c1bb; color: #8d2a20; }
.alert-warn { background: var(--warn-soft); border-color: #f5d9a8; color: #7a4a00; }
.alert-ok { background: var(--ok-soft); border-color: #bfe3cc; color: #17663a; }
.alert-info { background: var(--info-soft); border-color: #c6dcf2; color: #1d4f80; }
.toasts { position: fixed; bottom: 1.25rem; right: 1.25rem; display: flex; flex-direction: column; gap: .5rem; z-index: 100; }
.toast { background: var(--navy); color: #fff; padding: .7rem 1.1rem; border-radius: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, .2); max-width: 380px; }
.toast-error { background: var(--bad); }

/* Tabs */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tab { background: none; border: 0; padding: .55rem .9rem; font: inherit; font-weight: 500; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--navy); border-bottom-color: var(--amber); font-weight: 600; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 39, 66, .45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 1rem; z-index: 50; overflow-y: auto; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 560px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.modal-wide { max-width: 860px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.modal-body { padding: 1.25rem; }

/* Lists */
.linklist, .doclist, .verify-list { list-style: none; margin: 0; padding: 0; }
.linklist li, .doclist li { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .5rem 0; border-bottom: 1px solid #eef1f4; }
.linklist li:last-child, .doclist li:last-child { border-bottom: 0; }
.linklist a { display: flex; flex-direction: column; color: inherit; }
.linklist a small { color: var(--muted); }
.verify-list li { display: grid; grid-template-columns: auto 1fr auto; gap: .75rem; align-items: center; padding: .6rem 0; border-bottom: 1px solid #eef1f4; }
.event-list { display: flex; flex-direction: column; }
.event-row { display: grid; grid-template-columns: 54px 1fr auto; gap: 1rem; align-items: center; padding: .7rem 0; border-bottom: 1px solid #eef1f4; color: inherit; }
.event-row:last-child { border-bottom: 0; }
.event-row:hover { text-decoration: none; background: #fafcff; }
.event-date { background: var(--navy); color: #fff; border-radius: 8px; text-align: center; padding: .3rem 0; line-height: 1.1; }
.event-date span { font-size: .7rem; text-transform: uppercase; color: var(--amber); display: block; }
.event-date b { font-size: 1.3rem; }
.event-info { display: flex; flex-direction: column; }
.event-info small { color: var(--muted); }
.event-tags { display: flex; gap: .3rem; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .25rem 1rem; margin: .5rem 0; font-size: .9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* Uploads & thumbs */
.upload { display: flex; align-items: center; gap: .6rem; }
.upload-empty { width: 64px; height: 48px; border: 1px dashed #c3ccd6; border-radius: 6px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: .72rem; }
.thumbs { display: flex; gap: .5rem; flex-wrap: wrap; margin: .4rem 0; }
.thumb { display: block; width: 96px; height: 64px; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); background: #f0f3f6; }
.upload-compact .thumb { width: 64px; height: 48px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-file { display: flex; align-items: center; justify-content: center; font-size: .75rem; }
.doc-form { border-top: 1px solid var(--line); padding-top: .75rem; margin-top: .5rem; }
.doc-current { margin-bottom: .75rem; }

/* Checks */
.checks h3 { margin-top: .75rem; }
.checks ul, .checks-list { list-style: none; padding: 0; margin: 0; }
.checks li { padding: .2rem 0; }
.checks li.ok span { color: var(--ok); font-weight: 700; } .checks li.bad span { color: var(--bad); font-weight: 700; }
.checks-list li { display: grid; grid-template-columns: 24px 1fr auto auto; gap: .5rem; align-items: center; padding: .4rem 0; border-bottom: 1px solid #eef1f4; }
.checks-list .mark { font-weight: 700; }
.checks-list li.ok .mark { color: var(--ok); } .checks-list li.bad .mark { color: var(--bad); }
.review-cols { display: grid; grid-template-columns: 3fr 2fr; gap: 1.5rem; }
@media (max-width: 860px) { .review-cols { grid-template-columns: 1fr; } }

/* Editors */
.rte { border: 1px solid #c9d2dc; border-radius: 7px; overflow: hidden; }
.rte-bar { display: flex; flex-wrap: wrap; gap: 2px; padding: 4px; background: #f6f8fa; border-bottom: 1px solid var(--line); }
.rte-bar button { background: none; border: 1px solid transparent; border-radius: 4px; padding: .25rem .5rem; cursor: pointer; font: inherit; font-size: .85rem; }
.rte-bar button:hover { background: #fff; border-color: var(--line); }
.rte-body { min-height: 160px; padding: .6rem .8rem; }
.rich p:first-child { margin-top: 0; }
.rich { line-height: 1.55; }
.items-grid { display: grid; grid-template-columns: 2fr 2fr 90px 70px 32px; gap: .4rem; align-items: center; }
.items-head { order: -1; }
.class-edit { border: 1px solid var(--line); border-radius: 8px; padding: .75rem; }
.class-name { font-weight: 600; max-width: 260px; }
.class-edit input, .class-edit select { padding: .35rem .5rem; }
.officials-grid { grid-template-columns: repeat(auto-fit, minmax(430px, 1fr)); }
.officials-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; margin-bottom: .5rem; }
.officials-form select { font-size: .88rem; padding: .35rem; }

/* Login */
.login-wrap { display: flex; justify-content: center; padding: 3vh 0; }
.login-card { max-width: 420px; width: 100%; text-align: center; display: flex; flex-direction: column; gap: .9rem; padding: 2rem; }
.login-card form, .login-card .field { text-align: left; }
.login-buttons { display: flex; flex-direction: column; gap: .5rem; }
.divider { display: flex; align-items: center; gap: .75rem; color: var(--muted); font-size: .8rem; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.devlogin select { flex: 1; }

/* Reports */
.report-head { text-align: center; border-bottom: 3px solid var(--navy); padding-bottom: .75rem; margin-bottom: 1rem; }
.report-head p { margin: .3rem 0 0; color: var(--muted); }
.report-block { margin: 1.25rem 0 1.75rem; break-inside: avoid; }
.report-block h2 { border-left: 4px solid var(--amber); padding-left: .6rem; margin-bottom: .5rem; }
.report-body { background: #fff; padding: 1.5rem; border-radius: var(--radius); border: 1px solid var(--line); }
.card .report-body { border: 0; padding: 0; }
.officials { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin: .5rem 0; font-size: .85rem; background: #f6f8fa; border-radius: 6px; padding: .5rem .75rem; }
.officials dt { font-weight: 600; color: var(--muted); font-size: .75rem; text-transform: uppercase; }
.officials dd { margin: 0; }
.report-table td, .report-table th { padding: .4rem .6rem; }
.podium-1 td { background: #fff8e6; }

@media print {
  .no-print, .topbar, .footer, .tabs, .subnav, .toasts { display: none !important; }
  .main { padding: 0; max-width: none; }
  body, :root { background: #fff; }
  .report-body, .card { border: 0; box-shadow: none; padding: 0; }
  .report-block { page-break-inside: avoid; }
  a { color: inherit; }
}

.card > .field, .card > .grid2, .card > .grid3, .card > .check, .card > fieldset { margin-bottom: .8rem; }
.card > .row + .rich { margin-top: .9rem; }
.another { text-align: center; }

.pct-input input.invalid { border-color: var(--bad); }

input.invalid { border-color: var(--bad); }
.free-known a { font-weight: 500; }
.trophy { display: inline-flex; align-items: center; gap: .25rem; background: #fff3d6; color: #7a5200; border-radius: 999px; padding: .1rem .55rem; font-size: .75rem; font-weight: 600; margin-left: .4rem; white-space: nowrap; }
.award-form { display: inline-flex; gap: .3rem; margin-left: .5rem; vertical-align: middle; }
.award-form select { width: auto; padding: .2rem .4rem; font-size: .82rem; }
.trophy-table td { vertical-align: middle; }
.trophy-table select, .trophy-table input { padding: .3rem .45rem; font-size: .88rem; }
.trophies-grid { display: grid; grid-template-columns: 2fr 3fr 160px 32px; gap: .4rem; align-items: center; }

/* ---- Scoring ---------------------------------------------------------------------------------- */
.k-input { width: 80px; text-align: right; }
.grow { flex: 1; min-width: 0; }
.figure-table input:not(.k-input) { width: 100%; }
.figure-table tr.compulsory td { background: var(--info-soft); }
.score-list td .btn-ghost { margin-left: .5rem; }
.score-list td.actions { text-align: right; }
.class-scoring { margin: .5rem 0; }
.class-scoring summary { cursor: pointer; font-size: .9rem; color: var(--muted); }
.penalty-values { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem .75rem; margin-top: .5rem; }
.penalty-values input { width: 100%; }

.grade-sheet { display: flex; flex-direction: column; gap: .75rem; }
.grade-grid-wrap { display: flex; gap: 1.25rem; align-items: flex-start; flex-wrap: wrap; }
.grade-grid-wrap.disabled { opacity: .45; }
.grade-grid { border-collapse: collapse; font-variant-numeric: tabular-nums; }
.grade-grid th, .grade-grid td { border: 1px solid var(--line); padding: 0; }
.grade-grid thead th { background: #f3f6f9; padding: .3rem .5rem; font-size: .85rem; }
.grade-grid th.fig { text-align: left; padding: .2rem .6rem; font-weight: 600; white-space: nowrap; background: #f8fafb; }
.grade-grid td.k { padding: .2rem .6rem; color: var(--muted); }
.grade-grid th.judge { min-width: 74px; }
.grade-grid th.judge small { font-weight: 400; color: var(--muted); max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grade-grid td.cell input { width: 74px; border: 0; border-radius: 0; text-align: center; font-size: 1.05rem; font-weight: 600; padding: .28rem 0; background: #fff; caret-color: transparent; cursor: pointer; }
.grade-grid td.cell input:focus { outline: 3px solid var(--sky); outline-offset: -3px; background: #fff8d6; }
.grade-grid td.cell input.hz { color: var(--bad); }
.grade-grid td.cell input.avg { color: var(--info); }
.grade-grid td.cell { position: relative; }
.grade-grid .avg-value { position: absolute; right: 4px; bottom: 2px; font-size: .68rem; color: var(--info); pointer-events: none; }
.grade-grid tr.positioning th, .grade-grid tr.positioning td { border-top: 2px solid #9aa9b8; }
.grade-grid tr.bad th.fig { color: var(--bad); }
.grade-grid td.cell input.conflict { background: var(--bad-soft); }
.grade-grid td.cell input.conflict:focus { background: #fbd3ce; }
.grade-grid tfoot td, .grade-grid tfoot th { padding: .3rem .5rem; background: #f3f6f9; font-weight: 600; text-align: center; }
.penalty-entry { min-width: 240px; flex: 1; }
.penalty-entry h3 { margin-top: 0; }
.penalty-row { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .15rem 0; }
.penalty-row input { width: 60px; text-align: center; padding: .25rem; }
.penalty-row input:focus { outline: 3px solid var(--sky); background: #fff8d6; }
.flight-total { margin-top: .75rem; border-top: 1px solid var(--line); padding-top: .5rem; display: flex; flex-direction: column; gap: .15rem; }
.flight-total > div { display: flex; justify-content: space-between; }
.flight-total .pct { font-size: 1.6rem; font-weight: 700; justify-content: flex-end; color: var(--navy); }

/* ---- Live scoring: committee tab ---------------------------------------------------------------- */
.live-link-row { display: flex; gap: 1.5rem; align-items: flex-start; flex-wrap: wrap; }
.qr-preview { width: 150px; height: 150px; border: 1px solid var(--line); border-radius: 6px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; }
.btn.disabled { opacity: .5; pointer-events: none; }
.live-picks { display: flex; flex-direction: column; gap: .6rem; }
.live-pick { border-bottom: 1px solid var(--line); padding-bottom: .5rem; }
.live-pick:last-child { border-bottom: 0; }
.live-pick-progs { display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin: .25rem 0 0 1.6rem; }
.radio-row { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; }
.stack-tight { display: flex; flex-direction: column; gap: .35rem; }
.trend { font-weight: 700; }
.trend.up { color: #1f9d55; }
.trend.down { color: #d64532; }
.trend.flat { color: #8a97a8; }

/* ---- Live scoring: public screen ------------------------------------------------------------------- */
.live {
  --live-bg: #0b1d33; --live-panel: rgba(255, 255, 255, .05); --live-line: rgba(255, 255, 255, .1);
  --live-text: #f4f7fb; --live-muted: #9fb2c8; --live-accent: #f2a33a;
  min-height: 100vh; min-height: 100dvh; background: radial-gradient(ellipse at top, #16365a 0%, var(--live-bg) 65%);
  color: var(--live-text); display: flex; flex-direction: column; font-variant-numeric: tabular-nums;
}
.live-message { align-items: center; justify-content: center; text-align: center; gap: .5rem; padding: 2rem; }
.live-message p { color: var(--live-muted); font-size: 1.2rem; }
.live-head { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--live-line); }
.live-logo { flex: none; }
.live-title { flex: 1; min-width: 0; }
.live-title h1 { margin: 0; font-size: 1.25rem; line-height: 1.2; color: #fff; }
.live-title span { color: var(--live-muted); font-size: .9rem; }
.live-status { display: flex; flex-direction: column; align-items: flex-end; font-weight: 800; letter-spacing: .08em; color: #ff5a4f; }
.live-status small { font-weight: 400; letter-spacing: 0; color: var(--live-muted); font-size: .75rem; }
.live-badge { display: inline-flex; align-items: center; }
.live-dot { display: inline-block; width: .6em; height: .6em; border-radius: 50%; background: #ff5a4f; margin-right: .35em; animation: live-pulse 1.6s infinite; }
@keyframes live-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
.live-tabs { display: flex; gap: .4rem; padding: .6rem 1.25rem; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--live-line); }
.live-tabs button { flex: none; background: var(--live-panel); color: var(--live-muted); border: 1px solid var(--live-line); border-radius: 999px; padding: .3rem .9rem; font: inherit; cursor: pointer; }
.live-tabs button.active { background: var(--live-accent); border-color: var(--live-accent); color: #10233a; font-weight: 700; }
.live-tabs .live-pause { margin-left: auto; }
.live-body { flex: 1; display: flex; gap: 1.5rem; padding: 1rem 1.25rem; min-height: 0; }
.live-slide { flex: 1; min-width: 0; animation: live-in .5s ease-out; }
@keyframes live-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
.live-class { margin: 0 0 .6rem; font-size: 1.6rem; color: #fff; }
.live-class small { color: var(--live-muted); font-weight: 400; font-size: .6em; }
.live-empty { flex: 1; display: flex; align-items: center; justify-content: center; text-align: center; color: var(--live-muted); }
.live-table { width: 100%; border-collapse: collapse; }
.live-table th { text-align: left; color: var(--live-muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; padding: .4rem .5rem; border-bottom: 2px solid var(--live-line); }
.live-table th small { text-transform: none; letter-spacing: 0; font-weight: 400; }
.live-table td { padding: .5rem; border-bottom: 1px solid var(--live-line); vertical-align: middle; }
.live-table tbody tr:nth-child(odd) td { background: rgba(255, 255, 255, .025); }
.live-table .rank { width: 2.5em; text-align: center; font-weight: 800; color: var(--live-accent); }
.live-table .pilot .name { font-weight: 700; display: block; }
.live-table .pilot small { color: var(--live-muted); font-size: .75em; }
.live-table .flight { text-align: right; white-space: nowrap; }
.live-table th.flight { text-align: right; }
.live-table .total { color: #fff; }
.live-table .val { font-weight: 600; }
.live-table .val small { display: block; color: var(--live-muted); font-weight: 400; font-size: .7em; }
.live-table .val.total { font-weight: 800; color: var(--live-accent); }
.live-table .none { color: var(--live-muted); }
.live-table .dnf { color: #ffb4ab; font-weight: 700; font-size: .85em; }
.live-table .trend { font-size: 1.15em; }
.live-legend { color: var(--live-muted); font-size: .85rem; margin-top: .75rem; }
.live-foot { position: relative; min-height: 6px; }
.live-progress { position: absolute; left: 0; bottom: 0; height: 6px; width: 100%; background: var(--live-accent); transform-origin: left; animation: live-progress linear forwards; }
@keyframes live-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.live-paused { text-align: center; color: var(--live-muted); padding: .4rem; font-size: .85rem; }

/* Large screens (PC, TV, projector): everything scales with the screen height */
.live-big .live-head { padding: 1.5vh 2.5vw; }
.live-big .live-logo { width: 7.5vh; height: auto; }
.live-big .live-title h1 { font-size: 4vh; }
.live-big .live-title span { font-size: 2vh; }
.live-big .live-status { font-size: 2.6vh; }
.live-big .live-status small { font-size: 1.6vh; }
.live-big .live-tabs { padding: 1vh 2.5vw; }
.live-big .live-tabs button { font-size: 1.9vh; padding: .5vh 1.4vw; }
.live-big .live-body { padding: 2vh 2.5vw; gap: 2.5vw; }
.live-big .live-class { font-size: 5vh; margin-bottom: 1.2vh; }
.live-big .live-table th { font-size: max(.8rem, 1.7vh); }
.live-big .live-table td { height: var(--row-h); padding: 0 1vw; font-size: calc(var(--row-h) * .38); }
.live-big .live-table .pilot small { font-size: .62em; }
.live-big .live-legend { font-size: 1.8vh; }
.live-big .live-empty h2 { font-size: 4vh; }
.live-qr { flex: none; width: 22vh; align-self: flex-end; text-align: center; color: var(--live-muted); font-size: 1.7vh; }
.live-qr .qr { width: 100%; height: auto; border-radius: 1vh; }
.live-qr p { margin: .8vh 0 0; }

/* Phones */
.live-small .live-head { padding: .75rem 1rem; gap: .6rem; }
.live-small .live-logo { width: 44px; height: auto; }
.live-small .live-title h1 { font-size: 1.05rem; }
.live-small .live-title span { font-size: .8rem; }
.live-small .live-tabs { padding: .5rem 1rem; position: sticky; top: 0; background: var(--live-bg); z-index: 1; }
.live-small .live-body { padding: .75rem .5rem; }
.live-small .live-class { font-size: 1.3rem; padding: 0 .5rem; }
.live-small .live-table { font-size: .9rem; }
.live-small .live-table td, .live-small .live-table th { padding: .45rem .35rem; }
.live-small .live-table .pilot .name { font-size: .95rem; }
.stack-card > * + * { margin-top: 1rem; }
.stack-card > .card-head + * { margin-top: 0; }

/* ---- Order of flight: class order ---- */
.class-order ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.class-order li { display: flex; align-items: center; gap: .6rem; padding: .4rem 0; border-bottom: 1px solid var(--line); }
.class-order li:last-child { border-bottom: 0; }
.class-order-pos { width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--navy); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700; flex: none; }
.text-warn { color: #a5620b; }

/* Sign in with Apple: Apple's black button style */
.btn-oauth.btn-apple { background: #000; color: #fff; border-color: #000; font-weight: 600; }
.btn-oauth.btn-apple:hover { background: #222; border-color: #222; color: #fff; }
.login-note { margin: .4rem 0 0; text-align: center; }
