:root {
  --red: #E70013; --red-dark: #B8000F; --ink: #14171f; --muted: #6b7280; --line: #e5e7eb;
  --bg: #f6f7f9; --card: #fff; --live: #E70013; --ok: #0f9d58; --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
}
@media (prefers-color-scheme: dark) {
  :root { --ink: #eceef2; --muted: #9aa1ad; --line: #2a2e37; --bg: #0f1115; --card: #171a21; --shadow: none; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: "Cairo", system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg); line-height: 1.5; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--red); }
img { max-width: 100%; }
h1 { font-size: 1.7rem; margin: 1.2rem 0 .8rem; line-height: 1.25; }
h2 { font-size: 1.15rem; margin: .4rem 0 .8rem; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.empty { color: var(--muted); padding: 1rem 0; }

/* top bar */
.topbar { background: var(--red); color: #fff; position: sticky; top: 0; z-index: 20; }
.topbar-inner { display: flex; align-items: center; gap: 1rem; min-height: 60px; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 800; white-space: nowrap; }
.brand img { background: #fff; border-radius: 50%; padding: 2px; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.brand:hover { color: #fff; }
.mainnav { display: flex; gap: .2rem; flex: 1; flex-wrap: wrap; }
.mainnav a { padding: .4rem .5rem; border-radius: 8px; font-weight: 600; font-size: .9rem; white-space: nowrap; }
.brand span { font-size: .98rem; }
@media (max-width: 1500px) and (min-width: 901px) { .brand span { max-width: 9.5rem; white-space: normal; line-height: 1.15; } }
.mainnav a:hover, .mainnav a.on { background: rgba(255,255,255,.18); color: #fff; }
.langs { display: flex; gap: .2rem; }
.langs a { padding: .2rem .5rem; border: 1px solid rgba(255,255,255,.4); border-radius: 6px; font-size: .85rem; }
.langs a.on { background: #fff; color: var(--red); }
.burger { display: none; background: none; border: 0; color: #fff; font-size: 1.5rem; cursor: pointer; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: currentColor; margin-inline-end: .4rem; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
@media (max-width: 860px) {
  .brand span { display: none; }
  .burger { display: block; margin-inline-start: auto; }
  .mainnav { display: none; position: absolute; top: 60px; inset-inline: 0; background: var(--red-dark); flex-direction: column; padding: .5rem 16px 1rem; }
  body.admin .mainnav { background: #111318; }
  .mainnav.open { display: flex; }
}

/* layout */
.grid-home { display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; margin-top: 1.2rem; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
@media (max-width: 860px) { .grid-home, .two-col { grid-template-columns: 1fr; } }
.panel { background: var(--card); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); margin-bottom: 1.2rem; border: 1px solid var(--line); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.section-head a { color: var(--red); font-weight: 600; font-size: .9rem; }
.footer { margin-top: 3rem; padding: 1.5rem 0; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }
.footer .wrap { display: flex; justify-content: space-between; }

/* cards */
.news-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.news-grid.three { grid-template-columns: repeat(3, 1fr); }
.news-grid .card.big:first-child { grid-column: 1 / -1; }
@media (max-width: 860px) { .news-grid, .news-grid.three { grid-template-columns: 1fr; } }
.card { background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--line); display: flex; flex-direction: column; }
.card .thumb { aspect-ratio: 16/9; background: linear-gradient(135deg, var(--red), #7a0009) center/cover no-repeat; }
.card-body { padding: .8rem 1rem 1rem; }
.card-body h3 { margin: .2rem 0; font-size: 1.02rem; line-height: 1.35; }
.card-body time { color: var(--muted); font-size: .8rem; }
.card-body p { color: var(--muted); margin: .4rem 0 0; font-size: .92rem; }

/* match rows */
.match-row { display: grid; grid-template-columns: 4.2rem 1fr auto 1fr auto; align-items: center; gap: .6rem; padding: .6rem .4rem; border-bottom: 1px solid var(--line); font-weight: 600; }
.match-row:last-child { border-bottom: 0; }
.match-row .when { font-size: .8rem; color: var(--muted); display: flex; flex-direction: column; line-height: 1.2; }
.match-row .team { display: flex; align-items: center; gap: .45rem; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.match-row .team.home { justify-content: flex-end; text-align: end; }
.match-row .score { min-width: 3.6rem; text-align: center; font-weight: 800; background: var(--bg); border-radius: 6px; padding: .1rem .4rem; }
.match-row.status-live .score, .match-row.status-halftime .score { background: var(--red); color: #fff; }
.match-row .tv { color: var(--red); font-size: .85rem; }
@media (max-width: 520px) { .match-row { grid-template-columns: 3.2rem 1fr auto 1fr; font-size: .9rem; } .match-row .tv { display: none; } }
/* narrow columns (home sidebar, phones): let club names wrap instead of clipping */
aside .match-row, .row-with-action .match-row { grid-template-columns: 3rem 1fr auto 1fr; font-size: .86rem; gap: .4rem; }
aside .match-row .team, .row-with-action .match-row .team { white-space: normal; line-height: 1.25; }
aside .match-row .crest, aside .match-row .tv { display: none; }
@media (max-width: 520px) { .match-row .team { white-space: normal; line-height: 1.25; } }
.live-pill { background: var(--live); color: #fff !important; border-radius: 5px; padding: .05rem .4rem; font-size: .75rem; font-weight: 800; }
.crest { border-radius: 50%; object-fit: contain; flex-shrink: 0; }
.crest-ph { display: inline-flex; align-items: center; justify-content: center; background: var(--bg); color: var(--muted); font-size: .7rem; border: 1px solid var(--line); }
.live-strip { background: var(--card); border: 2px solid var(--red); border-radius: var(--radius); padding: .8rem 1rem; margin-top: 1rem; }
.live-strip h2 { color: var(--red); }
.row-with-action { display: flex; align-items: center; gap: .5rem; } .row-with-action .match-row { flex: 1; }

/* tabs, tiles, tables */
.tabs { display: flex; gap: .3rem; margin: .5rem 0 1rem; border-bottom: 2px solid var(--line); overflow-x: auto; }
.tabs a, .tabs button { background: none; border: 0; padding: .6rem 1rem; font: inherit; font-weight: 700; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tabs .on { color: var(--red); border-bottom-color: var(--red); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .8rem; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; display: flex; align-items: center; gap: .8rem; font-weight: 700; box-shadow: var(--shadow); }
.tile .lvl { width: 40px; height: 40px; border-radius: 50%; background: var(--red); color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tiles.streams .tile { flex-direction: column; align-items: stretch; padding: 0 0 .8rem; overflow: hidden; }
.tiles.streams .tile > span, .tiles.streams .tile > small { padding: 0 .9rem; }
.tiles.streams .thumb { aspect-ratio: 16/9; background: #111 center/cover; position: relative; }
.tiles.streams .thumb .live-pill { position: absolute; top: .6rem; inset-inline-start: .6rem; }
h2.cat { margin-top: 1.6rem; color: var(--muted); font-size: .95rem; text-transform: uppercase; letter-spacing: .04em; }
h3.round { margin: 1.2rem 0 .3rem; font-size: .9rem; color: var(--muted); }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
.standings th, .standings td { padding: .5rem .45rem; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
.standings .l { text-align: start; } .standings .l a { display: inline-flex; align-items: center; gap: .5rem; font-weight: 600; }
.standings .pts { font-weight: 800; } .standings .pos { color: var(--muted); }
.standings tr.group th { background: var(--bg); text-align: start; }
@media (max-width: 600px) { .hide-sm { display: none; } }
.comp-links { list-style: none; padding: 0; margin: 0; } .comp-links li { padding: .35rem 0; border-bottom: 1px solid var(--line); }

/* match page */
.scoreboard { background: linear-gradient(135deg, #1c1f27, #2b0b0f); color: #fff; border-radius: var(--radius); padding: 1.2rem; margin-top: 1rem; text-align: center; }
.scoreboard .meta { opacity: .8; font-size: .9rem; } .scoreboard a:hover { color: #fff; text-decoration: underline; }
.sb-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem; margin: 1rem 0; }
.sb-team { display: flex; flex-direction: column; align-items: center; gap: .5rem; font-weight: 700; }
.sb-score { display: flex; flex-direction: column; align-items: center; }
.sb-score .big { font-size: 2.6rem; font-weight: 800; letter-spacing: .05em; } .sb-score .ko { font-size: 1.8rem; font-weight: 800; }
.player-box { margin: 1rem 0; background: #000; border-radius: var(--radius); overflow: hidden; position: relative; }
.player-box video { width: 100%; display: block; aspect-ratio: 16/9; background: #000; }
.player-box #offline { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; margin: 0; background: rgba(0,0,0,.6); text-align: center; padding: 1rem; }
.player-box #offline[hidden] { display: none; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: flex; gap: .6rem; align-items: center; padding: .45rem 0; border-bottom: 1px solid var(--line); }
.timeline li.away { flex-direction: row-reverse; text-align: end; }
.timeline .min { font-weight: 800; min-width: 2.6rem; }
.timeline .ico::before { content: "•"; }
.ev-goal .ico::before, .ev-penalty .ico::before { content: "⚽"; } .ev-own_goal .ico::before { content: "⚽↩"; }
.ev-yellow .ico::before { content: "🟨"; } .ev-red .ico::before { content: "🟥"; } .ev-sub .ico::before { content: "🔁"; } .ev-var .ico::before { content: "📺"; }
.plain { list-style: none; padding: 0; margin: 0; } .plain li { padding: .35rem 0; border-bottom: 1px solid var(--line); }
.club-head { display: flex; align-items: center; gap: 1rem; margin-top: 1rem; } .club-head h1 { margin: 0; }
.article-page { max-width: 760px; margin: 0 auto; } .article-page .hero { border-radius: var(--radius); margin: 1rem 0; width: 100%; }
.article-page time { color: var(--muted); } .lead { font-size: 1.15rem; color: var(--muted); }
.prose { font-size: 1.05rem; overflow-wrap: anywhere; } .prose img { height: auto; border-radius: 8px; }
.pager { display: flex; gap: 1rem; justify-content: center; margin: 1.5rem 0; align-items: center; }
.pager a { padding: .3rem .8rem; border: 1px solid var(--line); border-radius: 8px; }
.center-box { max-width: 420px; margin: 3rem auto; text-align: center; background: var(--card); padding: 2rem; border-radius: var(--radius); border: 1px solid var(--line); }

/* buttons & forms */
.btn { display: inline-flex; align-items: center; gap: .3rem; padding: .5rem 1rem; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { border-color: var(--red); color: var(--red); }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; } .btn.primary:hover { background: var(--red-dark); color: #fff; }
.btn.danger { color: var(--red); } .btn.small { padding: .2rem .6rem; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.flash { padding: .7rem 1rem; border-radius: 8px; margin: 1rem 0; background: #e7f6ee; color: #0b5c35; overflow-wrap: anywhere; }
.flash.error { background: #fde8ea; color: #9b0010; }
input, select, textarea { font: inherit; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); width: 100%; }
input[type=checkbox], input[type=radio] { width: auto; flex: none; }
textarea { resize: vertical; }
.login label { display: block; text-align: start; margin: .8rem 0; font-weight: 600; }
.login .btn { width: 100%; justify-content: center; margin-top: .6rem; }

/* admin */
body.admin .topbar { background: #1c1f27; }
body.admin .mainnav a { font-size: .88rem; padding: .35rem .55rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .8rem; margin-bottom: 1.2rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem; display: flex; flex-direction: column; }
.stat b { font-size: 1.6rem; color: var(--red); } .stat span { color: var(--muted); font-size: .9rem; }
.actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; } .actions form { margin: 0; }
.search input { width: 220px; max-width: 100%; }
table.data { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.data th, table.data td { padding: .55rem .7rem; text-align: start; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { background: var(--bg); font-size: .85rem; color: var(--muted); }
table.data td.actions { white-space: nowrap; }
table.data.compact td { padding: .35rem .5rem; font-size: .88rem; }
table.data tr.bad td { color: var(--red); }
.edit-form .fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .9rem 1.2rem; background: var(--card); padding: 1.2rem; border-radius: var(--radius); border: 1px solid var(--line); }
.edit-form .tri { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; padding: .8rem; background: var(--bg); border-radius: 10px; }
@media (max-width: 860px) { .edit-form .tri { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .9rem; }
.field.kind-bool { flex-direction: row; align-items: center; gap: .6rem; }
.img-field { display: flex; flex-direction: column; gap: .3rem; } .img-field .preview { max-height: 90px; width: auto; border-radius: 6px; }
.form-actions { margin: 1rem 0; display: flex; gap: .6rem; }
.inline-form { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .8rem; } .inline-form > * { width: auto; flex: 1 1 120px; }
.inline-form > .btn, .inline-form > input[type=hidden] { flex: 0 0 auto; }
td.actions .inline-form, td .inline-form { margin-top: 0; flex-wrap: nowrap; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .8rem; align-items: end; }
.grid-form label { display: flex; flex-direction: column; font-weight: 600; font-size: .9rem; gap: .3rem; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .4rem; margin: .8rem 0; }
.check { display: flex; align-items: center; gap: .5rem; padding: .3rem; border-bottom: 1px solid var(--line); }
.check span { flex: 1; } .check .group { width: 6em; padding: .2rem .4rem; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1rem; } .kv dt { font-weight: 700; } .kv dd { margin: 0; word-break: break-all; }
code { background: var(--bg); padding: .1rem .35rem; border-radius: 5px; font-size: .88em; }
.tag { display: inline-block; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: .1rem .6rem; font-size: .8rem; font-weight: 700; }

/* referee comms console */
.comms { display: grid; grid-template-columns: 1.3fr 1fr; gap: 1.2rem; }
@media (max-width: 860px) { .comms { grid-template-columns: 1fr; } }
.comms-controls { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.switch { display: flex; align-items: center; gap: .4rem; font-weight: 700; }
.ptt { width: 100%; min-height: 220px; border-radius: 24px; border: 3px solid var(--line); background: var(--bg); font: inherit; font-size: 1.3rem; font-weight: 800; color: var(--ink); cursor: pointer; user-select: none; touch-action: none; }
.ptt.talking { background: var(--red); border-color: var(--red-dark); color: #fff; transform: scale(.99); }
.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; margin-top: 1rem; }
.people { list-style: none; padding: 0; margin: 0 0 1rem; } .people li { padding: .4rem 0; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: .5rem; }
.people .spk { width: 10px; height: 10px; border-radius: 50%; background: var(--line); flex-shrink: 0; }
.people li.dyn .spk { background: #8fd3ae; } .people li.speaking .spk { background: var(--ok); box-shadow: 0 0 0 4px rgba(15,157,88,.25); }
.log { max-height: 260px; overflow-y: auto; font-size: .85rem; padding-inline-start: 1.2rem; color: var(--muted); }

/* ---- federal modules ---- */
main.with-side { display: grid; grid-template-columns: 220px 1fr; gap: 1.2rem; max-width: 1400px; }
.main-col { min-width: 0; }
.side { padding-top: 1.2rem; position: sticky; top: 70px; align-self: start; max-height: calc(100vh - 80px); overflow-y: auto; }
.side-group { margin-bottom: 1rem; }
.side-group h4 { margin: 0 0 .3rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.side-group a { display: block; padding: .3rem .6rem; border-radius: 6px; font-size: .9rem; font-weight: 600; }
.side-group a.on, .side-group a:hover { background: var(--card); color: var(--red); }
@media (max-width: 860px) { main.with-side { grid-template-columns: 1fr; } .side { position: static; max-height: none; display: flex; flex-wrap: wrap; gap: .3rem 1rem; } .side-group { margin: 0; } }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.ok-text { color: var(--ok); font-weight: 700; } .bad-text { color: var(--red); }
.problems { color: var(--red); margin: .4rem 0; }
.steps { display: flex; gap: .4rem; list-style: none; padding: 0; margin: 1rem 0; flex-wrap: wrap; }
.steps li { flex: 1; min-width: 140px; padding: .5rem .8rem; border-radius: 8px; background: var(--card); border: 1px solid var(--line); font-weight: 700; color: var(--muted); font-size: .9rem; }
.steps li.done { color: var(--ok); border-color: var(--ok); } .steps li.on { background: var(--red); color: #fff; border-color: var(--red); }
.tag.sheet-draft { background: #fff7e0; } .tag.sheet-locked { background: #e7f0ff; } .tag.sheet-closed { background: #fde8ea; } .tag.sheet-validated { background: #e7f6ee; color: #0b5c35; }
.tag.st-confirmed { background: #e7f6ee; color: #0b5c35; } .tag.st-declined { background: #fde8ea; color: #9b0010; } .tag.st-pending { background: #fff7e0; }
@media (prefers-color-scheme: dark) { .tag[class*="sheet-"], .tag[class*="st-"] { background: var(--bg) !important; color: var(--ink) !important; } }
.lineup-edit td { vertical-align: middle; } .lineup-edit select, .lineup-edit input:not([type=checkbox]):not([type=radio]) { padding: .2rem .3rem; }
.muted-panel { opacity: .6; }
.avatar { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; }
.avatar.ph { display: inline-flex; align-items: center; justify-content: center; background: var(--red); color: #fff; font-size: 2rem; font-weight: 800; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .6rem; }
.gallery a { display: block; border-radius: 10px; overflow: hidden; background: var(--card); }
.gallery img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; } .gallery span { display: block; padding: .3rem .5rem; font-size: .85rem; }
.thumb .play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 2.2rem; text-shadow: 0 2px 8px rgba(0,0,0,.6); }
.poll { margin-bottom: 1.2rem; } .poll h3 { margin: .2rem 0 .5rem; font-size: 1rem; }
.bar { position: relative; background: var(--bg); border-radius: 6px; margin: .3rem 0; padding: .35rem .6rem; display: flex; justify-content: space-between; overflow: hidden; }
.bar span { position: absolute; inset: 0 auto 0 0; background: rgba(231,0,19,.15); } [dir=rtl] .bar span { inset: 0 0 0 auto; }
.bar b, .bar i { position: relative; } .bar.mine { outline: 2px solid var(--red); }
.predict { display: grid; grid-template-columns: 1fr 3.5em 3.5em 1fr auto; gap: .4rem; align-items: center; padding: .4rem 0; border-bottom: 1px solid var(--line); }
.predict small { grid-column: 1 / -1; } .predict .team { font-weight: 600; font-size: .9rem; } .predict .team:first-of-type { text-align: end; }
.quizq { border: 1px solid var(--line); border-radius: 10px; margin-bottom: .8rem; padding: .6rem 1rem; } .quizq legend { font-weight: 700; }
.tickets { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: .8rem; }
.ticket { display: flex; gap: 1rem; background: var(--card); border: 2px dashed var(--red); border-radius: 12px; padding: .8rem; align-items: center; }
.ticket.used, .ticket.void { opacity: .55; border-style: solid; border-color: var(--line); } .ticket .qr { background: #fff; padding: 6px; border-radius: 6px; }
.product .buy { display: flex; justify-content: space-between; align-items: center; padding: .4rem .9rem 0; }
.scan-result { font-size: 1.4rem; font-weight: 800; padding: 1.4rem; border-radius: 12px; background: var(--bg); text-align: center; }
.scan-result.ok { background: #0f9d58; color: #fff; } .scan-result.ko { background: var(--red); color: #fff; }
