/* LIGHT OF FUTURE jury system — main stylesheet (no inline styles: strict CSP) */
:root {
    --bg: #0f1724;
    --surface: #18263a;
    --surface-2: #213350;
    --border: #34486a;
    --text: #edf2fa;
    --muted: #a3b3c9;
    --accent: #4cc3ff;
    --accent-strong: #0a84c6;
    --ok: #3ccf8e;
    --warn: #ffc857;
    --danger: #e5546a;
    --gold: #ffd45b;
    --radius: 10px;
    --focus: 0 0 0 3px rgba(76, 195, 255, .45);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
a { color: var(--accent); }
h1 { font-size: 1.6rem; margin: .2rem 0 1rem; }
h2 { font-size: 1.2rem; margin: 0 0 .8rem; color: var(--accent); }
code { font-family: ui-monospace, Consolas, monospace; font-size: .85em; }
code.wrap { white-space: pre-wrap; word-break: break-word; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.big { font-size: 1.25rem; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.warn-text { color: var(--warn); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.print-only { display: none; }
[hidden] { display: none !important; }
.card h2:not(:first-child) { margin-top: 1.6rem; }

/* Layout */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar-row { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .6rem 1rem; flex-wrap: wrap; }
.brand { color: var(--accent); font-weight: 700; text-decoration: none; letter-spacing: .04em; }
.topbar-right { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-inline-start: auto; }
.user-badge { color: var(--muted); font-size: .9rem; }
.main-nav { display: flex; gap: .2rem; padding: 0 .6rem .4rem; overflow-x: auto; }
.main-nav a { color: var(--text); text-decoration: none; padding: .45rem .75rem; border-radius: 8px; white-space: nowrap; font-size: .95rem; }
.main-nav a:hover { background: var(--surface-2); }
.main-nav a.active { background: var(--accent-strong); color: #fff; }
.container { max-width: 1200px; margin: 0 auto; padding: 1rem; }
.footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 2rem 1rem; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .5rem; }
.page-head h1 { margin: 0; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem; margin: 1rem 0; }
.card.narrow { max-width: 480px; margin-inline: auto; }
.warn-card { border-color: var(--warn); }
.danger-zone { border-color: var(--danger); }
.item { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding: .8rem 0; border-bottom: 1px solid var(--border); }
.item:last-child { border-bottom: 0; }
.item-main { flex: 1; min-width: 0; }

/* Forms */
input, select, textarea, button, .button {
    font: inherit;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    padding: .6rem .75rem;
    max-width: 100%;
}
input:focus, select:focus, textarea:focus, button:focus-visible, .button:focus-visible, a:focus-visible { outline: none; box-shadow: var(--focus); }
input[readonly] { opacity: .6; }
textarea { width: 100%; resize: vertical; }
label { display: block; color: var(--muted); font-size: .9rem; }
label > input:not([type=checkbox]):not([type=radio]), label > select, label > textarea { display: block; width: 100%; margin-top: .3rem; color: var(--text); }
label.checkbox { display: flex; align-items: center; gap: .5rem; color: var(--text); margin: .5rem 0; }
label.checkbox input { width: 1.15rem; height: 1.15rem; margin: 0; }
.hint { display: block; font-size: .8rem; margin-top: .25rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .9rem; align-items: end; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; grid-column: 1 / -1; margin-top: .8rem; }
.stack > * + * { margin-top: .9rem; }
.inline-form { display: inline-flex; align-items: center; gap: .3rem; margin: 0; }
.filter-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .7rem; align-items: end; }
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .2rem 1rem; }
.w-num { width: 6rem; }
select.compact { padding: .35rem .5rem; font-size: .9rem; }

button, .button { cursor: pointer; background: var(--accent-strong); border-color: transparent; color: #fff; font-weight: 600; text-decoration: none; display: inline-block; }
button:hover, .button:hover { filter: brightness(1.12); }
button.secondary, .button.secondary { background: var(--surface-2); border-color: var(--border); color: var(--text); }
button.danger, .button.danger { background: var(--danger); }
button:disabled { opacity: .5; cursor: not-allowed; }
.small-btn { padding: .35rem .65rem; font-size: .85rem; }
.actions { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }

/* Alerts & pills */
.alert { border-radius: var(--radius); padding: .75rem 1rem; margin: .7rem 0; border: 1px solid; }
.alert-success { background: rgba(60, 207, 142, .12); border-color: var(--ok); }
.alert-error { background: rgba(229, 84, 106, .14); border-color: var(--danger); }
.alert-warning { background: rgba(255, 200, 87, .12); border-color: var(--warn); }
.alert-info { background: rgba(76, 195, 255, .1); border-color: var(--accent); }
.pill { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: .8rem; background: var(--surface-2); border: 1px solid var(--border); white-space: nowrap; }
.pill-ok { border-color: var(--ok); color: var(--ok); }
.pill-warn { border-color: var(--warn); color: var(--warn); }
.pill-error { border-color: var(--danger); color: var(--danger); }
.pill-muted { color: var(--muted); }
.status-row { display: flex; gap: .5rem; flex-wrap: wrap; margin: .5rem 0; }
.chips { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .4rem; }
.chip { background: var(--surface-2); border-radius: 6px; padding: .1rem .5rem; font-size: .85rem; }
.checklist { list-style: none; padding: 0; }
.checklist .ok { color: var(--ok); }
.checklist .fail { color: var(--danger); }
.checklist .warn { color: var(--warn); }
pre.code { background: #0a111c; padding: .6rem .8rem; border-radius: 8px; overflow-x: auto; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .55rem .6rem; border-bottom: 1px solid var(--border); text-align: start; vertical-align: middle; }
th { color: var(--accent); font-weight: 600; font-size: .9rem; }
td.num, th.num { text-align: end; font-variant-numeric: tabular-nums; }
td.actions { justify-content: flex-end; }
tr.highlight td { background: rgba(76, 195, 255, .07); }
tr.inactive td { opacity: .6; }
tr.new-row td { background: rgba(255, 255, 255, .02); }
tr.podium-1 td:first-child { color: var(--gold); }
th.judge-col { max-width: 8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td input { width: 100%; }
td input.w-num { width: 6rem; }
.w-40 { width: 40%; }
progress { width: 70%; height: .8rem; vertical-align: middle; accent-color: var(--accent); }

/* Dashboard */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; display: flex; flex-direction: column; }
.stat-value { font-size: 2rem; font-weight: 700; color: var(--accent); }
.stat-label { color: var(--muted); }
.grand-prix { border-color: var(--gold); }
.grand-prix h2 { color: var(--gold); }
.podium-list { margin: .4rem 0 0; padding-inline-start: 1.2rem; }
.pagination { display: flex; gap: .3rem; flex-wrap: wrap; margin-top: 1rem; }
.pagination a { padding: .3rem .65rem; border: 1px solid var(--border); border-radius: 6px; text-decoration: none; }
.pagination a.active { background: var(--accent-strong); color: #fff; }

/* Judge app */
.judge-mode .container { max-width: 760px; padding: .7rem; }
.sync-bar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .5rem .8rem; position: sticky; top: 6.2rem; z-index: 5; }
.sync-bar #sync-now { margin-inline-start: auto; }
.judge-list { list-style: none; padding: 0; margin: 0; }
.judge-row { display: flex; align-items: center; gap: .8rem; width: 100%; text-align: start; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem .9rem; margin: .45rem 0; font-weight: 400; }
.judge-row:hover { filter: none; background: var(--surface-2); }
.judge-row .start { font-size: 1.3rem; font-weight: 700; min-width: 3.2rem; color: var(--accent); }
.judge-row .info { flex: 1; min-width: 0; }
.judge-row .info .cls { display: block; color: var(--muted); font-size: .85rem; }
.judge-tools { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin: .8rem 0; }
.judge-tools .full { grid-column: 1 / -1; }
.criterion { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem; margin: .7rem 0; }
.criterion-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.criterion-name { font-weight: 600; }
.score-buttons { display: grid; grid-template-columns: repeat(auto-fit, minmax(2.8rem, 1fr)); gap: .35rem; margin-top: .55rem; }
.score-buttons button { padding: .7rem 0; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); font-size: 1.05rem; }
.score-buttons button.selected { background: var(--accent-strong); border-color: var(--accent); color: #fff; }
.score-input { width: 7rem; font-size: 1.3rem; text-align: center; margin-top: .5rem; }
.judge-actions { display: flex; gap: .6rem; flex-wrap: wrap; position: sticky; bottom: 0; background: var(--bg); padding: .8rem 0; }
.judge-actions button { flex: 1; padding: .9rem; font-size: 1.05rem; }
.judge-summary { font-size: 1.1rem; margin: .6rem 0; }

@media (max-width: 640px) {
    h1 { font-size: 1.3rem; }
    .container { padding: .6rem; }
    .card { padding: .85rem; }
    th, td { padding: .45rem .4rem; font-size: .9rem; }
    .topbar { position: static; }
    .sync-bar { top: 0; }
    .user-badge { display: none; }
}

@media print {
    body { background: #fff; color: #000; font-size: 11pt; }
    .no-print, .topbar, .footer, .main-nav, button, .alert { display: none !important; }
    .print-only { display: block; }
    .card { background: #fff; border: 0; padding: 0; margin: 0 0 1rem; break-inside: avoid; }
    h1, h2, th { color: #000; }
    th, td { border-bottom: 1px solid #999; }
    a { color: #000; text-decoration: none; }
    .table-wrap { overflow: visible; }
}
