/* Account pages (login, school, jury, admin). Builds on main.css tokens and form styles. */

body.app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.app-main { flex: 1; width: 100%; max-width: var(--wrap); margin-inline: auto; padding: clamp(20px, 4vw, 40px) var(--gutter) 64px; }
.app-main--narrow { max-width: 760px; }

/* ---------- Header ---------- */
.app-top { background: var(--bg); border-bottom: 1px solid var(--olive-line); position: sticky; top: 0; z-index: 40; }
.app-top__inner { max-width: var(--wrap); margin-inline: auto; padding: 0 var(--gutter); height: 76px; display: flex; align-items: center; gap: 14px; }
.app-top__logo img { height: 62px; width: auto; }
.app-top__area { font-family: var(--font-display); font-weight: 700; font-size: 19px; padding-inline-start: 14px; border-inline-start: 1.5px solid var(--olive-line); line-height: 1.1; }
.app-top__right { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; min-width: 0; }
.app-top__who { font-size: 14px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 22ch; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--olive-line); background: transparent; color: var(--ink); cursor: pointer; }
.icon-btn:hover { border-color: var(--olive); background: var(--olive-tint); }
.icon-btn .icon { width: 18px; height: 18px; }
@media (max-width: 640px) {
  .app-top__inner { height: 64px; gap: 10px; }
  .app-top__logo img { height: 50px; }
  .app-top__area { font-size: 16px; padding-inline-start: 10px; }
  .app-top__who { display: none; }
}

/* ---------- Generic blocks ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; margin-bottom: 24px; }
.page-head h1 { font-size: clamp(28px, 4.5vw, 40px); }
.page-head p { color: var(--ink-soft); }
.box { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(20px, 3.5vw, 32px); }
.box + .box { margin-top: 20px; }
.box h2 { font-size: clamp(22px, 3vw, 28px); margin-bottom: 6px; }
.box__lead { color: var(--ink-soft); margin-bottom: 18px; }
.muted { color: var(--ink-soft); }
.small { font-size: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row--end { justify-content: flex-end; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 14px; }
hr.dash { border: 0; border-top: 1px dashed var(--olive-line); margin: 22px 0; }

.btn--quiet { background: transparent; color: var(--olive); box-shadow: none; padding-inline: 10px; min-height: 40px; }
.btn--quiet:hover { background: var(--olive-tint); transform: none; }
.btn--danger { --bg-btn: #fff; background: #fff; color: #a2402a; box-shadow: inset 0 0 0 1.5px #e9c2b4; }
.btn--danger:hover { background: #fbeee8; }
.btn--orange { background: var(--orange); color: var(--ink); box-shadow: 0 6px 18px -8px color-mix(in srgb, var(--orange) 80%, transparent); }
.btn--orange:hover { background: color-mix(in srgb, var(--orange) 88%, black); }
.btn--sm { min-height: 36px; padding: 6px 14px; font-size: 14px; }

.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 11px; font-size: 13px; font-weight: 500; white-space: nowrap; background: var(--olive-tint); color: var(--ink); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .55; }
.pill--ok { background: color-mix(in srgb, var(--olive) 16%, var(--bg)); color: var(--olive-dark); }
.pill--warn { background: var(--orange-tint); color: #9a3e1c; }
.pill--wait { background: #f1efe6; color: var(--ink-soft); }
.pill--bad { background: #fbe4dc; color: #a2402a; }

.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--olive-tint); font-size: 15px; }
.notice--warn { background: var(--orange-tint); }
.notice .icon { flex: none; margin-top: 2px; color: var(--olive); }
.notice--warn .icon { color: var(--orange); }

.progress { height: 12px; border-radius: 999px; background: var(--olive-tint); overflow: hidden; }
.progress > span { display: block; height: 100%; width: 0; background: var(--olive); border-radius: inherit; transition: width .4s ease; }
.progress--orange > span { background: var(--orange); }

.spinner { width: 44px; height: 44px; border-radius: 50%; border: 4px solid var(--olive-tint); border-top-color: var(--olive); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.center-card { max-width: 460px; margin: clamp(12px, 5vh, 56px) auto 0; }
.center-card .logo-lg { display: block; margin: 0 auto 18px; height: 140px; width: auto; }
.center-card h1 { font-size: clamp(26px, 5vw, 32px); text-align: center; margin-bottom: 6px; }
.center-card .box__lead { text-align: center; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-inline-end: 76px; }
.pw-wrap button { position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--olive); font-weight: 600; cursor: pointer; padding: 8px 10px; border-radius: 8px; }
.form-msg { border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 16px; font-size: 15px; background: var(--orange-tint); }
.form-msg--ok { background: var(--olive-tint); }
.link-btn { background: none; border: 0; color: var(--olive); font-weight: 600; cursor: pointer; padding: 4px 0; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--olive-line); }

/* ---------- Stepper (school) ---------- */
.steps { list-style: none; margin: 0 0 22px; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; counter-reset: step; }
.steps li { position: relative; text-align: center; font-size: 14px; color: var(--ink-mute); padding-top: 44px; }
.steps li::before {
  counter-increment: step; content: counter(step);
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; font-size: 17px;
  background: var(--bg); box-shadow: inset 0 0 0 2px var(--olive-line); color: var(--ink-mute); z-index: 1;
}
.steps li::after { content: ""; position: absolute; top: 16px; inset-inline-start: calc(50% + 20px); width: calc(100% - 34px); border-top: 2px dashed var(--olive-line); }
.steps li:last-child::after { display: none; }
.steps li.is-done { color: var(--ink); }
.steps li.is-done::before { content: "✓"; background: var(--olive); color: #fff; box-shadow: none; }
.steps li.is-current { color: var(--ink); font-weight: 600; }
.steps li.is-current::before { box-shadow: inset 0 0 0 2px var(--olive); color: var(--olive); }

/* ---------- Upload ---------- */
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center;
  border: 2px dashed color-mix(in srgb, var(--olive) 40%, var(--bg)); border-radius: var(--radius);
  background: var(--olive-tint); padding: 34px 18px; cursor: pointer; transition: background .15s ease, border-color .15s ease;
}
.drop:hover, .drop.is-over { background: color-mix(in srgb, var(--olive) 14%, var(--bg)); border-color: var(--olive); }
.drop:focus-within { outline: 3px solid var(--orange); outline-offset: 3px; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop__icon { width: 64px; height: 64px; border-radius: 50%; background: var(--olive); display: grid; place-items: center; margin-bottom: 4px; }
.drop__icon svg { width: 30px; height: 30px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.drop b { font-size: 18px; }
.tips { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 8px; font-size: 15px; color: var(--ink-soft); }
.tips li { display: flex; gap: 10px; }
.tips li::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--orange); margin-top: .65em; }
.file-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--olive-tint); margin-bottom: 16px; }
.file-row b { display: block; overflow-wrap: anywhere; }
.up-stats { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; color: var(--ink-soft); margin: 10px 0 16px; font-variant-numeric: tabular-nums; }
.up-pct { font-family: var(--font-display); font-size: 40px; font-weight: 800; color: var(--olive); line-height: 1; }

.player { width: 100%; aspect-ratio: 16 / 9; background: #1d1d1b; border-radius: var(--radius-sm); display: block; }
.player-wrap { border-radius: var(--radius-sm); overflow: hidden; background: #1d1d1b; }

.state { display: flex; gap: 16px; align-items: flex-start; }
.state__badge { flex: none; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--olive); }
.state__badge svg { width: 26px; height: 26px; fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.state__badge--warn { background: var(--orange); }
.state h3 { font-size: 22px; margin-bottom: 4px; }

.result-hero { text-align: center; padding: 10px 0; }
.result-hero .big { font-family: var(--font-display); font-size: 56px; font-weight: 800; color: var(--olive); line-height: 1; margin: 14px 0 4px; }
.result-hero h3 { font-size: clamp(22px, 3.4vw, 28px); }

dl.facts { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: 10px 20px; margin: 0; font-size: 15px; }
dl.facts dt { color: var(--ink-mute); }
dl.facts dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
@media (max-width: 520px) { dl.facts { grid-template-columns: 1fr; gap: 2px; } dl.facts dd { margin-bottom: 10px; } }

details.box > summary { cursor: pointer; font-family: var(--font-display); font-weight: 700; font-size: 20px; list-style: none; display: flex; justify-content: space-between; align-items: center; }
details.box > summary::after { content: "+"; font-size: 26px; color: var(--olive); }
details.box[open] > summary::after { content: "–"; }
details.box[open] > summary { margin-bottom: 18px; }

/* ---------- Jury ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn { border: 1.5px solid var(--olive-line); background: var(--bg); border-radius: 999px; padding: 7px 14px; font-size: 14px; cursor: pointer; color: var(--ink); }
.chip-btn[aria-pressed="true"] { background: var(--olive); border-color: var(--olive); color: #fff; }
.chip-btn small { opacity: .75; margin-inline-start: 4px; }
.toolbar select { width: auto; min-height: 40px; padding-block: 6px; font-size: 14px; }

.entries { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.entry { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; cursor: pointer; text-align: start; border: 0; padding: 0; font: inherit; color: inherit; transition: transform .15s ease, box-shadow .15s ease; }
.entry:hover { transform: translateY(-2px); box-shadow: 0 1px 2px rgb(47 47 47 / .05), 0 18px 36px -14px rgb(47 47 47 / .26); }
.entry__thumb { position: relative; aspect-ratio: 16 / 9; background: #2b2b28 center / cover no-repeat; }
.entry__dur { position: absolute; bottom: 8px; inset-inline-end: 8px; background: rgb(0 0 0 / .7); color: #fff; font-size: 12px; padding: 2px 7px; border-radius: 6px; direction: ltr; }
.entry__body { padding: 12px 14px 14px; display: grid; gap: 6px; }
.entry__top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.entry__code { font-family: var(--font-display); font-weight: 800; font-size: 20px; }
.entry__score { font-family: var(--font-display); font-weight: 800; color: var(--olive); font-size: 18px; }

.score-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr); gap: 24px; align-items: start; }
.score-layout__video { position: sticky; top: 96px; }
@media (max-width: 920px) { .score-layout { grid-template-columns: 1fr; } .score-layout__video { position: static; } }
.crit { padding: 14px 0; border-bottom: 1px dashed var(--olive-line); }
.crit:first-child { padding-top: 0; }
.crit__head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.crit__head label { font-weight: 600; }
.crit__head small { color: var(--ink-mute); }
.crit__ctl { display: flex; align-items: center; gap: 12px; }
.crit__ctl input[type=range] { flex: 1; accent-color: var(--olive); height: 32px; min-width: 0; }
.crit__ctl input[type=number] { width: 84px; min-height: 44px; text-align: center; font-weight: 600; padding: 8px; }
.score-total { display: flex; justify-content: space-between; align-items: baseline; padding: 16px 0 6px; }
.score-total b { font-family: var(--font-display); font-size: 40px; color: var(--olive); line-height: 1; }
textarea { width: 100%; min-height: 90px; font: inherit; font-size: 15px; color: var(--ink); background: var(--bg); border: 1.5px solid var(--olive-line); border-radius: var(--radius-sm); padding: 12px 14px; resize: vertical; }
textarea:focus { outline: none; border-color: var(--olive); background: #fff; box-shadow: 0 0 0 4px color-mix(in srgb, var(--olive) 16%, transparent); }

/* ---------- Admin ---------- */
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; border-bottom: 1.5px solid var(--olive-line); margin-bottom: 24px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; background: none; border: 0; padding: 12px 16px; font-size: 15px; font-weight: 500; color: var(--ink-soft); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1.5px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--olive); font-weight: 600; }
.tabs button:hover { color: var(--ink); }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--card); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 16px 18px; }
.stat b { display: block; font-family: var(--font-display); font-size: 34px; font-weight: 800; line-height: 1.1; color: var(--ink); }
.stat span { font-size: 14px; color: var(--ink-mute); }
.stat--olive b { color: var(--olive); }
.stat--orange b { color: var(--orange); }

.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
table.data { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.data th { text-align: start; font-weight: 600; color: var(--ink-mute); font-size: 13px; padding: 10px 12px; border-bottom: 1.5px solid var(--olive-line); white-space: nowrap; }
table.data td { padding: 12px; border-bottom: 1px solid color-mix(in srgb, var(--olive) 12%, var(--bg)); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data td.num { font-variant-numeric: tabular-nums; font-weight: 600; }
table.data .sub { display: block; font-size: 13px; color: var(--ink-mute); overflow-wrap: anywhere; }
table.data tr.is-q td:first-child { box-shadow: inset 3px 0 0 var(--olive); }
[dir="rtl"] table.data tr.is-q td:first-child { box-shadow: inset -3px 0 0 var(--olive); }
.gov-block + .gov-block { margin-top: 18px; }
.gov-block h3 { font-size: 20px; margin-bottom: 10px; display: flex; gap: 10px; align-items: baseline; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid3 { display: grid; grid-template-columns: 1.4fr 1.4fr .6fr auto; gap: 8px; align-items: end; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } .grid3 { grid-template-columns: 1fr 1fr; } }
.toggle { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; font-size: 15px; margin-bottom: 14px; }
.toggle input { flex: none; width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--olive); }
.radio-cards { display: grid; gap: 10px; }
.radio-card { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1.5px solid var(--olive-line); border-radius: var(--radius-sm); cursor: pointer; }
.radio-card:has(input:checked) { border-color: var(--olive); background: var(--olive-tint); }
.radio-card input { margin-top: 4px; accent-color: var(--olive); width: 18px; height: 18px; flex: none; }
.radio-card small { display: block; color: var(--ink-mute); font-size: 13.5px; }
.stage-edit { border: 1.5px solid var(--olive-line); border-radius: var(--radius-sm); padding: 16px; margin-bottom: 14px; }
.stage-edit__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-weight: 600; }
.lang-tag { font-size: 12px; font-weight: 600; color: var(--olive); background: var(--olive-tint); border-radius: 6px; padding: 1px 7px; margin-inline-start: 6px; }
.savebar { position: sticky; bottom: 0; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); padding: 14px 0; margin-top: 18px; border-top: 1px solid var(--olive-line); display: flex; gap: 10px; justify-content: flex-end; z-index: 5; }

/* ---------- Modal ---------- */
dialog.modal { border: 0; border-radius: var(--radius); padding: 0; width: min(760px, calc(100vw - 24px)); max-height: calc(100vh - 24px); box-shadow: 0 30px 80px -20px rgb(0 0 0 / .45); color: var(--ink); background: var(--card); }
dialog.modal::backdrop { background: rgb(30 30 28 / .55); }
.modal__head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--olive-line); }
.modal__head h3 { font-size: 20px; }
.modal__body { padding: 20px; overflow: auto; }

/* ---------- Toasts ---------- */
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 12px; font-size: 15px; box-shadow: 0 12px 30px -10px rgb(0 0 0 / .4); animation: fadeUp .25s ease both; transition: opacity .4s ease, transform .4s ease; }
.toast--err { background: #a2402a; color: #fff; }
.toast.is-out { opacity: 0; transform: translateY(8px); }

.empty { text-align: center; padding: 48px 16px; color: var(--ink-soft); }
.empty .icon { width: 44px; height: 44px; color: var(--olive-line); margin: 0 auto 10px; display: block; }
