@font-face { font-family: 'Changa'; font-weight: 500; src: url('/fonts/changa-arabic-500-normal.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E; }
@font-face { font-family: 'Changa'; font-weight: 700; src: url('/fonts/changa-arabic-700-normal.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E; }
@font-face { font-family: 'Changa'; font-weight: 500; src: url('/fonts/changa-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Changa'; font-weight: 700; src: url('/fonts/changa-latin-700-normal.woff2') format('woff2'); }

/* هوية النادي: الكحلي للشريط الجانبي والعناوين، والأزرق للأزرار، والأخضر والأحمر للفوز والخسارة والحالات فقط */
:root {
  --navy: #122D58; --blue: #19568C; --blue-dark: #12446F; --sky: #1E60A7; --green: #07806A; --red: #C8102E; --amber: #9A4310;
  --bg: #F4F6FA; --card: #FFFFFF; --soft: #EEF2F7; --line: #E2E7EF; --field: #D3DBE6; --ink: #1B2433; --muted: #64708A; --tint: #E3EDF8; --lilac: #BCD3EC;
  --side: #122D58; --side-ink: #C9D6EA; --side-on: #FFFFFF; --side-hl: rgba(255, 255, 255, .12); --side-line: rgba(255, 255, 255, .1);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { display: flex; background: var(--bg); color: var(--ink); font: 500 15px/1.65 'Changa', system-ui, sans-serif; }
#side { width: 232px; flex: none; background: var(--side); color: var(--side-ink); padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.brand { display: flex; gap: 10px; align-items: center; padding: 0 6px 16px; border-bottom: 1px solid var(--side-line); margin-bottom: 14px; }
.brand img { width: 42px; height: 48px; object-fit: contain; background: #fff; border-radius: 10px; padding: 2px; }
.brand b { display: block; font-size: 16px; line-height: 1.3; color: var(--side-on); }
.brand small { color: var(--side-ink); font-size: 12.5px; }
#create-btn { width: 100%; margin-bottom: 14px; background: #fff; border-color: #fff; color: var(--navy); }
#create-btn:hover { background: var(--tint); }
.nav-group { margin-bottom: 14px; }
.nav-group > small { display: block; font-size: 12px; color: var(--side-ink); opacity: .7; padding: 0 12px 4px; }
#nav a, #more-nav a { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-radius: 10px; color: inherit; text-decoration: none; margin-bottom: 2px; }
#nav a:hover { background: var(--side-hl); color: var(--side-on); }
#nav a.on { background: var(--side-hl); color: var(--side-on); font-weight: 700; }
.count { background: #F59E0B; color: #1B2433; font-size: 12px; font-weight: 700; border-radius: 10px; padding: 0 7px; line-height: 1.6; }
#me { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: auto; padding: 12px 6px 0; border-top: 1px solid var(--side-line); }
#me b { display: block; font-size: 14px; color: var(--side-on); line-height: 1.3; }
#me small { color: var(--side-ink); font-size: 12.5px; }
#me button { padding: 4px 12px; font-size: 13px; background: transparent; color: var(--side-on); border-color: var(--side-line); }
#me button:hover { background: var(--side-hl); }

/* قائمة «إنشاء» ولوحة «المزيد» في الجوال */
.menu-pop { position: fixed; inset: 0; z-index: 20; display: none; }
.menu-pop.open { display: block; }
.menu-pop .shade { position: absolute; inset: 0; background: rgba(14, 27, 51, .35); }
.menu-pop .sheet { position: absolute; top: 76px; inset-inline-start: 16px; width: 260px; background: var(--card); border-radius: 14px; padding: 8px; box-shadow: 0 18px 40px -16px rgba(18, 45, 88, .45); }
.menu-pop .sheet a { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; }
.menu-pop .sheet a:hover { background: var(--soft); }
.menu-pop .sheet a small { display: block; color: var(--muted); font-size: 12.5px; }
.menu-pop .sheet h2 { margin: 6px 12px 8px; }
#tabbar { display: none; }

/* الرئيسية */
.hello { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.hello h1 { margin: 0; }
.hello .lead { margin: 0; }
.next-match { border-radius: 14px; padding: 18px 20px; color: #fff; background: linear-gradient(135deg, var(--navy), var(--blue) 60%, var(--sky)); display: grid; gap: 10px; margin-bottom: 16px; }
.next-match .meta { font-size: 13px; opacity: .85; }
.next-match .teams { display: flex; gap: 12px; align-items: center; font-size: 22px; font-weight: 700; line-height: 1.3; }
.next-match .teams img { width: 46px; height: 46px; object-fit: contain; background: #fff; border-radius: 10px; padding: 3px; }
.next-match .teams i { font-style: normal; font-size: 15px; opacity: .65; }
.next-match .when { display: flex; gap: 8px; flex-wrap: wrap; font-size: 13.5px; }
.next-match .when span { background: rgba(255, 255, 255, .15); border-radius: 8px; padding: 1px 9px; }
.next-match .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.next-match .acts .btn { background: #fff; border-color: #fff; color: var(--navy); }
.next-match .acts .btn.ghost { background: transparent; border-color: rgba(255, 255, 255, .45); color: #fff; }
.next-match.none { background: var(--card); color: var(--ink); border: 1px dashed var(--field); }
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--soft); }
.list-row:first-of-type { border-top: 0; }
.list-row .what { display: flex; gap: 8px; align-items: center; min-width: 0; }
.list-row .what a { color: var(--ink); font-weight: 700; text-decoration: none; }
.list-row .what a:hover { color: var(--blue); }
.list-row.task .what { flex: 1; }
.task-ctl { flex-wrap: nowrap; flex-shrink: 0; }
.task-ctl select { width: 150px; }
@media (max-width: 640px) {
  .list-row.task { flex-wrap: wrap; }
  .list-row.task .what { flex-basis: 100%; }
  .task-ctl { width: 100%; padding-right: 26px; }
  .task-ctl select { flex: 1; width: auto; }
}
.list-row small { display: block; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.pill { font-size: 12px; border-radius: 8px; padding: 0 8px; font-weight: 700; white-space: nowrap; line-height: 1.7; }
.pill.late { background: #FDE7EA; color: #9B0E25; }
.pill.today { background: #FEF3C7; color: #8A4B08; }
.pill.soon { background: var(--tint); color: var(--blue-dark); }
.pill.sens { background: #FDE7EA; color: #9B0E25; }
.pill.ok { background: #DDF5E8; color: #05663F; }
.stat-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat-strip .card { margin: 0; padding: 12px 14px; }
.stat-strip b { display: block; font-size: 22px; color: var(--navy); font-variant-numeric: tabular-nums; }
.stat-strip span { font-size: 13px; color: var(--muted); }
button.move { padding: 2px 8px; min-height: 0; font-size: 11px; line-height: 1.6; }
.more-link { display: block; text-align: center; margin-top: 8px; font-size: 13.5px; }
#main { flex: 1; min-width: 0; padding: 26px 30px 70px; max-width: 1280px; }
h1 { font-size: 25px; margin: 0 0 4px; font-weight: 700; color: var(--navy); }
h2 { font-size: 17px; margin: 0 0 12px; font-weight: 700; color: var(--navy); }
.lead { color: var(--muted); margin: 0 0 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin-bottom: 16px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
label { display: block; font-size: 13.5px; color: var(--muted); }
label > span.req::after { content: ' *'; color: var(--red); }
input, select, textarea { display: block; width: 100%; margin-top: 3px; padding: 8px 10px; border: 1px solid var(--field); border-radius: 10px; background: #fff; color: var(--ink); font: inherit; }
textarea { min-height: 90px; resize: vertical; line-height: 1.7; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--sky); outline-offset: 1px; }
input[type=checkbox] { display: inline-block; width: auto; margin: 0 0 0 6px; vertical-align: middle; accent-color: var(--blue); }
input[type=color] { height: 36px; padding: 2px; }
.check { color: var(--ink); font-size: 14px; display: flex; align-items: center; }
button, .btn { display: inline-block; border: 1px solid var(--field); background: #fff; color: var(--navy); border-radius: 10px; padding: 7px 15px; font: 700 14px/1.5 'Changa', sans-serif; cursor: pointer; text-decoration: none; }
button:hover, .btn:hover { background: var(--soft); }
button.primary, .btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
button.primary:hover, .btn.primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
button.good { background: var(--green); border-color: var(--green); color: #fff; }
button.good:hover { background: #05664F; border-color: #05664F; }
button.danger { color: var(--red); border-color: #F2C9CF; }
button:disabled { opacity: .55; cursor: wait; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.spread { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; }
.mt { margin-top: 14px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.badge { display: inline-block; padding: 0 9px; border-radius: 10px; font-size: 12.5px; background: var(--tint); color: var(--blue-dark); white-space: nowrap; }
.badge.draft { background: var(--line); color: #474A5C; }
.badge.review { background: #FFE9DC; color: var(--amber); }
.badge.approved, .badge.done { background: #DBF5E9; color: #05664F; }
.badge.sensitive, .badge.failed { background: #FFE3E2; color: var(--red); }
.badge.running, .badge.queued { background: var(--tint); color: var(--blue-dark); }
table { width: 100%; border-collapse: collapse; }
table.simple td:nth-child(2) { width: 100%; }
table.simple td:nth-child(2) input { width: 100%; }
th { text-align: right; font-size: 13px; color: var(--muted); font-weight: 500; padding: 6px 8px; border-bottom: 1px solid var(--line); }
td { padding: 8px; border-bottom: 1px solid var(--soft); vertical-align: middle; }
tr.link { cursor: pointer; }
tr.link:hover td { background: var(--bg); }
.stat { font-size: 30px; font-weight: 700; color: var(--navy); line-height: 1.2; }
.issue { padding: 8px 12px; border-radius: 10px; margin-bottom: 7px; font-size: 14px; }
.issue.block { background: #FFE9E8; color: #8D0B21; }
.issue.warn { background: #FFF1E6; color: #7A3A0C; }
.issue.ok { background: #E3F7EE; color: #05664F; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: none; color: var(--muted); padding: 8px 14px; }
.tabs button.on { color: var(--blue-dark); border-color: var(--blue); }
.thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.thumb { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.thumb img, .thumb video { display: block; width: 100%; aspect-ratio: 4/5; object-fit: cover; background: var(--soft); }
.thumb .cap { padding: 7px 9px; font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { position: relative; width: 74px; height: 74px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.chip img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: pointer; }
.chip button { position: absolute; top: 2px; left: 2px; padding: 0 6px; font-size: 12px; line-height: 18px; border-radius: 6px; }
.logo-sm { width: 32px; height: 32px; object-fit: contain; vertical-align: middle; }
.preview { width: 100%; border: 1px solid var(--line); border-radius: 12px; display: block; background: var(--soft); }
.scene-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; background: var(--bg); }
.progress { height: 7px; background: var(--line); border-radius: 4px; overflow: hidden; min-width: 110px; }
.progress div { height: 100%; background: var(--sky); }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-right: 1px solid var(--line); }
.cal > div { min-height: 96px; padding: 5px 6px; border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); font-size: 12.5px; background: #fff; }
.cal .head { min-height: 0; text-align: center; color: var(--muted); background: var(--soft); }
.cal .off { background: var(--soft); color: #A0A3B5; }
.cal .today { background: var(--tint); }
.cal .num { font-weight: 700; }
.cal .ev { display: block; margin-top: 3px; padding: 1px 5px; border-radius: 6px; background: var(--blue); color: #fff; line-height: 1.45; }
.cal .tk { display: block; margin-top: 3px; padding: 1px 5px; border-radius: 6px; background: var(--tint); color: var(--blue-dark); line-height: 1.45; }
.cal .tk.done { opacity: .5; text-decoration: line-through; }
pre.guide { background: var(--soft); border-radius: 10px; padding: 10px 12px; direction: ltr; text-align: left; font: 13px/1.7 ui-monospace, Menlo, monospace; overflow-x: auto; margin: 8px 0; }
.body-text { white-space: pre-wrap; }
.empty { color: var(--muted); padding: 18px; text-align: center; }
.spin { display: inline-block; width: 13px; height: 13px; border: 2px solid var(--lilac); border-top-color: var(--blue); border-radius: 50%; animation: s .8s linear infinite; vertical-align: -2px; margin-left: 5px; }
@keyframes s { to { transform: rotate(360deg); } }
.drop { display: flex; align-items: center; justify-content: center; min-height: 64px; padding: 12px; border: 2px dashed var(--field); border-radius: 12px; background: var(--bg); color: var(--muted); text-align: center; cursor: pointer; font-size: 14px; margin-top: 3px; }
.drop:hover, .drop.over { border-color: var(--blue); background: var(--tint); color: var(--blue-dark); }
.drop:focus-within { outline: 2px solid var(--sky); outline-offset: 1px; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; padding: 0; margin: 0; border: 0; }
.library { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; max-height: 260px; overflow-y: auto; margin-top: 8px; padding: 6px; background: var(--soft); border-radius: 10px; }
.library button { padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; background: none; }
.library button.on { border-color: var(--blue); }
.library img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.stepper { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.stepper button { display: flex; align-items: center; gap: 8px; background: #fff; color: var(--muted); }
.stepper button span { display: inline-flex; width: 22px; height: 22px; align-items: center; justify-content: center; border-radius: 50%; background: var(--line); color: var(--muted); font-size: 13px; }
.stepper button.on { color: var(--blue-dark); border-color: var(--blue); }
.stepper button.on span { background: var(--blue); color: #fff; }
.stepper button.done span { background: var(--green); color: #fff; }
.scoreboard { display: grid; grid-template-columns: minmax(0, 1fr) 84px 20px 84px minmax(0, 1fr); align-items: center; gap: 10px; background: var(--soft); border-radius: 12px; padding: 14px; text-align: center; }
.scoreboard > i { font-style: normal; font-size: 26px; color: var(--muted); }
.scoreboard .side img, .board .side img { display: block; width: 72px; height: 72px; object-fit: contain; margin: 0 auto 6px; }
.scoreboard .side b, .board .side b { font-size: 15px; color: var(--navy); }
input.big { font-size: 34px; font-weight: 700; text-align: center; padding: 6px 2px; color: var(--navy); margin: 0; }
input.big:read-only { background: var(--line); }
.sets-grid { display: grid; grid-template-columns: 90px repeat(5, minmax(0, 1fr)); gap: 6px; align-items: center; }
input.set { text-align: center; margin: 0; padding: 6px 2px; }
.board { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 12px; text-align: center; }
.board .nums { display: flex; gap: 12px; align-items: center; font-size: 46px; font-weight: 700; color: var(--navy); line-height: 1; }
.board .nums i { font-style: normal; color: var(--muted); font-size: 30px; }
.board .sets { grid-column: 1 / -1; display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.out-row { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--soft); flex-wrap: wrap; }
.out-row:last-child { border-bottom: 0; }
.sticky { position: sticky; top: 14px; }
a.ev { text-decoration: none; }
#main a:not(.btn):not(.ev) { color: var(--blue-dark); }
#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 9px 20px; border-radius: 10px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 10; max-width: 80vw; }
#toast.show { opacity: 1; }
#toast.err { background: var(--red); }

/* شاشة الصياغة المقسومة */
.write-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 16px; align-items: start; }
.write-split > .card { margin-bottom: 0; }
.pane-empty { display: flex; align-items: center; justify-content: center; min-height: 340px; padding: 20px; color: var(--muted); text-align: center; background: var(--soft); border-radius: 10px; }
.alt-title { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--soft); }
.alt-title:last-child { border-bottom: 0; }

/* مراحل النص */
.stages { display: flex; gap: 6px; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; }
.stages li { display: flex; align-items: center; gap: 7px; padding: 3px 12px 3px 6px; border-radius: 16px; background: var(--soft); color: var(--muted); font-size: 13.5px; }
.stages li span { display: inline-flex; width: 22px; height: 22px; align-items: center; justify-content: center; border-radius: 50%; background: var(--line); font-size: 12.5px; }
.stages li.done { color: #05664F; }
.stages li.done span { background: var(--green); color: #fff; }
.stages li.on { background: var(--tint); color: var(--blue-dark); font-weight: 700; }
.stages li.on span { background: var(--blue); color: #fff; }
.stages li.on.approved { background: #DBF5E9; color: #05664F; }
.stages li.on.approved span { background: var(--green); }
.facts { white-space: pre-wrap; font-size: 14px; background: var(--soft); border-radius: 10px; padding: 10px 12px; max-height: 260px; overflow-y: auto; }

/* لوحة المراجعة */
.filters { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters button { padding: 4px 13px; border-radius: 16px; font-weight: 500; font-size: 13.5px; color: var(--ink); }
.filters button.on { background: var(--tint); border-color: var(--lilac); color: var(--blue-dark); font-weight: 700; }
.filters button i { font-style: normal; color: var(--muted); margin-inline-start: 4px; }
.lanes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
.lane { background: var(--soft); border-radius: 12px; padding: 12px; min-height: 200px; }
.lane > header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; padding: 0 2px; }
.lane > header b { color: var(--navy); }
.lane-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.lane-card:last-child { margin-bottom: 0; }
.lane-card h3 { font-size: 15px; line-height: 1.45; margin: 6px 0 3px; font-weight: 700; }
.lane-card h3 a { color: var(--navy) !important; text-decoration: none; }
.lane-card h3 a:hover { color: var(--blue-dark) !important; }
.lane-card p { margin: 0; font-size: 13px; line-height: 1.55; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lane-card footer { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 9px; }
.lane-card footer button, .lane-card footer .btn { padding: 3px 11px; font-size: 13px; }

/* مكتبة القوالب */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.tpl-card { display: block; width: 100%; padding: 0; text-align: right; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; font-weight: 500; }
.tpl-card:hover { background: var(--card); border-color: var(--blue); box-shadow: 0 4px 16px rgba(92, 65, 255, .13); }
.tpl-card img { display: block; width: 100%; aspect-ratio: 4/5; object-fit: contain; background: var(--soft); }
.tpl-card .cap { display: block; padding: 9px 11px; }
.tpl-card b { display: block; color: var(--navy); line-height: 1.4; }
.tpl-card small { display: flex; justify-content: space-between; gap: 6px; color: var(--muted); font-weight: 500; margin-top: 3px; }
.tpl-thumb { width: 72px; flex: none; aspect-ratio: 4/5; object-fit: contain; background: var(--soft); border-radius: 8px; }

/* الجوال: عمود واحد، قائمة تُسحب أفقياً، ولوحة مراجعة تُتصفح مرحلة مرحلة */
@media (max-width: 900px) {
  body { display: block; }
  #side { width: 100%; height: auto; position: sticky; top: 0; z-index: 5; padding: 10px 16px; flex-direction: row; align-items: center; }
  .brand { padding: 0; margin: 0; border: 0; }
  .brand img { width: 32px; height: 36px; }
  #create-btn, #nav, #me { display: none; }
  #main { padding: 18px 16px 96px; max-width: none; }
  #tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; inset-inline: 0; bottom: 0; z-index: 15; background: var(--card); border-top: 1px solid var(--line); padding: 6px 4px calc(8px + env(safe-area-inset-bottom)); }
  #tabbar a, #tabbar button { display: grid; justify-items: center; gap: 1px; font: 600 11.5px 'Changa', sans-serif; color: var(--muted); text-decoration: none; background: none; border: 0; padding: 2px 0; min-height: 0; position: relative; }
  #tabbar svg { width: 22px; height: 22px; }
  #tabbar .on { color: var(--blue); }
  #tabbar .plus svg { width: 38px; height: 38px; margin-top: -16px; }
  #tabbar .count { position: absolute; top: -2px; inset-inline-end: 22%; font-size: 10.5px; padding: 0 5px; }
  .menu-pop .sheet { top: auto; bottom: 0; inset-inline: 0; width: auto; border-radius: 18px 18px 0 0; padding: 12px 10px calc(16px + env(safe-area-inset-bottom)); max-height: 80vh; overflow-y: auto; }
  #more-nav .nav-group > small { color: var(--muted); opacity: 1; }
  #more-nav a { color: var(--ink); }
  #more-nav a.on { background: var(--tint); color: var(--blue-dark); font-weight: 700; }
  .next-match .teams { font-size: 19px; }
  .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  h1 { font-size: 22px; }
  .card { padding: 14px; }
  .split, .g2, .g3, .g4, .write-split { grid-template-columns: minmax(0, 1fr); }
  .sticky { position: static; }
  /* 16px يمنع iOS من تكبير الصفحة عند التركيز على الحقل */
  input, select, textarea { font-size: 16px; }
  input.big { font-size: 28px; }
  button, .btn { min-height: 40px; }
  .chip button { min-height: 0; }
  .card > table, .card table { display: block; overflow-x: auto; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; }
  .tabs button { flex: none; }
  .filters { flex-wrap: nowrap; overflow-x: auto; margin-inline: -16px; padding-inline: 16px; scrollbar-width: none; }
  .filters button { flex: none; min-height: 34px; }
  .lanes { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; margin-inline: -16px; padding: 0 16px 8px; -webkit-overflow-scrolling: touch; }
  .lane { flex: 0 0 86%; scroll-snap-align: center; min-height: 0; }
  .pane-empty { min-height: 110px; }
  .tpl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .design-make .card.sticky { order: -1; }
  .design-make .preview { width: auto; max-width: 100%; max-height: 46vh; margin-inline: auto; }
  .scoreboard { grid-template-columns: minmax(0, 1fr) 58px 12px 58px minmax(0, 1fr); gap: 6px; padding: 10px; }
  .scoreboard .side img, .board .side img { width: 52px; height: 52px; }
  .scoreboard .side b { font-size: 13px; }
  .sets-grid { grid-template-columns: 62px repeat(5, minmax(0, 1fr)); gap: 4px; }
  .board .nums { font-size: 36px; }
  .cal > div { min-height: 62px; padding: 3px; font-size: 11px; }
  #toast { width: calc(100vw - 32px); max-width: none; text-align: center; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 25; }
}
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }

/* صفحات الدخول: نصف للهوية ونصف للنموذج، وفي الجوال تصير الهوية شريطاً فوق النموذج */
body.auth { display: grid; grid-template-columns: 1fr; min-height: 100%; padding: 0; }
.auth-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100vh; }
.auth-id { background: linear-gradient(160deg, var(--navy), var(--blue) 70%, var(--sky)); color: #fff; display: grid; align-content: center; justify-items: center; gap: 6px; padding: 32px 24px; text-align: center; }
.auth-id img { width: 104px; height: 118px; object-fit: contain; background: #fff; border-radius: 22px; padding: 8px; margin-bottom: 10px; }
.auth-id b { font-size: 26px; line-height: 1.3; }
.auth-id small { opacity: .8; font-size: 14px; }
.auth-box { width: 100%; max-width: 420px; justify-self: center; align-self: center; padding: 32px 20px; }
.auth-box .card { padding: 24px; }
.auth-box form > * + * { margin-top: 12px; }
.auth-box button[type=submit] { width: 100%; }
.auth-box .link { display: block; margin-top: 14px; text-align: center; font-size: 14px; color: var(--blue-dark); background: none; border: 0; cursor: pointer; font-weight: 500; }
@media (max-width: 760px) {
  .auth-split { grid-template-columns: 1fr; grid-template-rows: auto 1fr; min-height: 100vh; }
  .auth-id { padding: 28px 16px 24px; grid-auto-flow: row; }
  .auth-id img { width: 64px; height: 72px; border-radius: 14px; padding: 5px; margin-bottom: 4px; }
  .auth-id b { font-size: 20px; }
  .auth-box { align-self: start; padding: 20px 16px 32px; }
}

/* القوائم البسيطة على الجوال: الترتيب والاسم في سطر، والأزرار تحتهما */
@media (max-width: 640px) {
  .card table.simple { display: table; }
  table.simple tr:first-child { display: none; }
  table.simple tr { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--soft); }
  table.simple td { border: 0; padding: 0; }
  table.simple td:nth-child(3) { grid-column: 1 / -1; }
  table.simple td:nth-child(3) .row { flex-wrap: nowrap; justify-content: flex-start; }
}
