:root {
  --bg: #f5f5f2;
  --card: #ffffff;
  --text: #1d1d1b;
  --muted: #6b6b66;
  --line: #e2e1dc;
  --accent: #f2b705;
  --accent-ink: #1d1d1b;
  --ok: #2f7d32;
  --ok-bg: #e8f3e8;
  --err: #b3261e;
  --err-bg: #fbe9e7;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161615; --card: #22221f; --text: #ecebe6; --muted: #a3a29c; --line: #3a3935;
    --ok-bg: #1f3320; --err-bg: #3a1d1a; --ok: #8bc98e; --err: #f2a49d;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: inherit; }
h1 { font-size: 1.7rem; margin: .4em 0 .5em; }
h2 { font-size: 1.25rem; margin: 1.2em 0 .5em; }
h3 { font-size: 1.05rem; margin: 0; }
code { background: var(--bg); padding: .1em .35em; border-radius: 4px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

.top { background: #1d1d1b; color: #fff; border-bottom: 4px solid var(--accent); }
.top-row { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: center; justify-content: space-between; padding: 12px 16px; }
.brand { font-weight: 700; text-decoration: none; font-size: 1.1rem; }
.brand span { color: var(--accent); }
.nav { display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: center; }
.nav a, .nav .link { color: #fff; text-decoration: none; opacity: .85; }
.nav a:hover, .nav .link:hover { opacity: 1; text-decoration: underline; }
main { padding-top: 16px; padding-bottom: 32px; min-height: 70vh; }
.foot { color: var(--muted); font-size: .85rem; padding-bottom: 24px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }
.narrow { max-width: 480px; margin: 40px auto; }
.grid { display: grid; gap: 16px; }
.contests { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.contest-card { text-decoration: none; display: block; transition: border-color .15s; }
.contest-card:hover { border-color: var(--accent); }
.contest-card h2 { margin-top: 0; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: .9rem; color: var(--muted); }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .82rem; font-weight: 600; }
.badge.open { background: var(--ok-bg); color: var(--ok); }
.badge.closed { background: var(--line); color: var(--muted); }
.status { font-size: .8rem; font-weight: 600; }
.status.pending { color: #a86b00; }
.status.approved { color: var(--ok); }
.status.rejected { color: var(--err); }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; background: var(--card); border: 1px solid var(--line); }
.flash.ok { background: var(--ok-bg); border-color: transparent; color: var(--ok); }
.flash.error { background: var(--err-bg); border-color: transparent; color: var(--err); }

.stack { display: flex; flex-direction: column; gap: 12px; }
.stack > .btn { align-self: flex-start; }
.card > h1:first-child, .card > h2:first-child, .stack > h3:first-child { margin-top: 0; }
label { display: flex; flex-direction: column; gap: 4px; font-size: .92rem; }
label.check { flex-direction: row; align-items: flex-start; gap: 8px; }
label.check input { margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], textarea, select {
  font: inherit; color: inherit; background: var(--card); padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; width: 100%; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
input[type=file] { font: inherit; max-width: 100%; }

.btn { display: inline-block; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 8px; padding: 9px 18px; }
.btn:hover { filter: brightness(.95); }
.btn.small { padding: 5px 12px; font-size: .88rem; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: var(--err); color: #fff; }
.link { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-decoration: underline; }
.link.danger { color: var(--err); }
form.inline { display: inline; }

.upload { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 16px; }
.photos { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.photo { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.photo img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--line); }
.photo figcaption { padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.full { margin: 0; }
.full img { display: block; max-width: 100%; max-height: 80vh; margin: 0 auto; border-radius: var(--radius); }

.jury-list { display: flex; flex-direction: column; gap: 4px; }
.jury-item { display: grid; grid-template-columns: 260px 1fr; gap: 18px; align-items: start; }
.jury-item img { width: 100%; border-radius: 8px; display: block; }
.jury-item.done { border-left: 4px solid var(--ok); }
.scores { display: flex; flex-wrap: wrap; gap: 6px; }
.score { flex-direction: row; }
.score input { position: absolute; opacity: 0; }
.score span { display: inline-flex; width: 38px; height: 38px; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-weight: 600; }
.score input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.score input:focus-visible + span { outline: 2px solid var(--accent); }

.subnav, .tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.subnav a, .tabs a { text-decoration: none; padding: 6px 12px; border-radius: 8px; background: var(--card); border: 1px solid var(--line); font-size: .92rem; }
.tabs a.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.stats { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.stat { display: flex; flex-direction: column; text-decoration: none; margin: 0; }
.stat b { font-size: 1.8rem; }
.stat span { color: var(--muted); }
.stat.attention { border-color: var(--accent); }

.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .85rem; color: var(--muted); font-weight: 600; }
.table tr.inactive td { opacity: .55; }
.table img.mini { width: 64px; height: 48px; object-fit: cover; border-radius: 4px; display: block; }
.row-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row-form input[type=text] { width: auto; flex: 1 1 160px; }
.row-form select { width: auto; }
.actions { white-space: nowrap; }
.actions form { margin-bottom: 4px; }
details summary { list-style: none; cursor: pointer; }
details[open] form { margin-top: 6px; min-width: 220px; }
.pw { font-size: 1.05rem; letter-spacing: .04em; }
.consent-text { font-size: .92rem; }

@media (max-width: 640px) {
  h1 { font-size: 1.4rem; }
  .jury-item { grid-template-columns: 1fr; }
  .card { padding: 14px; }
}
