/* منصة تسجيل المعتمرين — زجاجي فاتح بإطار ذهبي رفيع
   التخطيط: غلاف واحد بعرض أقصى 1240px، رأس زجاجي، أقسام زجاجية تلتف على الجوال. */
:root {
  --bg: #F6F2EA;
  --ink: #2B3035;
  --ink-2: #3D434A;
  --muted: #5B6168;
  --gold: #B8872F;
  --gold-deep: #7A5516;
  --glass: rgba(255, 255, 255, .58);
  --glass-strong: rgba(255, 255, 255, .84);
  --field: #FFFFFF;
  --field-line: #CFC6B2;
  --line: #DDD4C0;
  --sunken: #EFE9DB;
  --sel: rgba(184, 135, 47, .24);
  --btn: #2F3438;
  --btn-ink: #FFFFFF;
  --btn-off: #8B9096;
  --track: rgba(43, 48, 53, .14);
  --bar: #B8872F;
  --bar-dark: #2F3438;
  --glow-a: rgba(184, 135, 47, .40);
  --glow-b: rgba(70, 84, 92, .30);
  --shadow: rgba(60, 48, 20, .08);
  --ok-bg: #E3F2EA;  --ok-fg: #1E6B48;  --ok-line: #BFDCCB;
  --warn-bg: #FFEFD0; --warn-fg: #6B3A00;
  --bad-bg: #FBE4E2;  --bad-fg: #8C2620;
  --neutral-bg: #EFE9DB; --neutral-fg: #3D434A;
  --reserve: #8A4B00;
  --logo-plate: transparent;
  --paper: #FFFFFF; --paper-ink: #1F2327; --paper-mute: #5B6168; --paper-line: #8C8472; --paper-head: #F1EBDD; --paper-row: #D9D2C0;
  --font: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14171A; --ink: #ECE8DE; --ink-2: #D4D0C6; --muted: #A5AAB0; --gold: #D4A24A; --gold-deep: #E3BC72;
    --glass: rgba(34, 38, 43, .62); --glass-strong: rgba(40, 45, 50, .9);
    --field: #1E2226; --field-line: #454C54; --line: #3A4047; --sunken: #262B30; --sel: rgba(212, 162, 74, .22);
    --btn: #D4A24A; --btn-ink: #17191B; --btn-off: #596068; --track: rgba(236, 232, 222, .16);
    --bar: #D4A24A; --bar-dark: #C9C4B8; --glow-a: rgba(212, 162, 74, .20); --glow-b: rgba(90, 110, 125, .24); --shadow: rgba(0, 0, 0, .35);
    --ok-bg: #183326; --ok-fg: #7FD1A5; --ok-line: #285740; --warn-bg: #3B2E12; --warn-fg: #F0C47A;
    --bad-bg: #3A1B19; --bad-fg: #F2A19B; --neutral-bg: #2A2F34; --neutral-fg: #D4D0C6; --reserve: #E9A860;
    --logo-plate: rgba(255, 255, 255, .92);
    color-scheme: dark;
  }
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] {
  --bg: #14171A; --ink: #ECE8DE; --ink-2: #D4D0C6; --muted: #A5AAB0; --gold: #D4A24A; --gold-deep: #E3BC72;
  --glass: rgba(34, 38, 43, .62); --glass-strong: rgba(40, 45, 50, .9);
  --field: #1E2226; --field-line: #454C54; --line: #3A4047; --sunken: #262B30; --sel: rgba(212, 162, 74, .22);
  --btn: #D4A24A; --btn-ink: #17191B; --btn-off: #596068; --track: rgba(236, 232, 222, .16);
  --bar: #D4A24A; --bar-dark: #C9C4B8; --glow-a: rgba(212, 162, 74, .20); --glow-b: rgba(90, 110, 125, .24); --shadow: rgba(0, 0, 0, .35);
  --ok-bg: #183326; --ok-fg: #7FD1A5; --ok-line: #285740; --warn-bg: #3B2E12; --warn-fg: #F0C47A;
  --bad-bg: #3A1B19; --bad-fg: #F2A19B; --neutral-bg: #2A2F34; --neutral-fg: #D4D0C6; --reserve: #E9A860;
  --logo-plate: rgba(255, 255, 255, .92);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; font-family: var(--font); color: var(--ink); font-variant-numeric: tabular-nums;
  background:
    radial-gradient(900px 520px at 88% -8%, var(--glow-a), transparent 62%),
    radial-gradient(820px 620px at 4% 108%, var(--glow-b), transparent 62%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
}
button, input, select, textarea { font-family: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: inherit; text-decoration: none; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible, textarea:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
input::placeholder { color: var(--muted); opacity: .8; }
/* حقل داخل صندوق: الإطار على الصندوق كله لا على الحقل */
.top-search input:focus-visible, .searchbar input:focus-visible, .phone-box input:focus-visible { outline: none; }
.top-search:focus-within, .searchbar:focus-within, .phone-box:focus-within { outline: 2px solid var(--ink); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ltr { direction: ltr; unicode-bidi: plaintext; text-align: right; }

/* ---------- الغلاف ---------- */
.shell {
  max-width: 1240px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px;
  padding-block: 20px 40px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.glass {
  border: 1px solid var(--gold); border-radius: 18px; background: var(--glass);
  backdrop-filter: blur(20px) saturate(140%); -webkit-backdrop-filter: blur(20px) saturate(140%);
  box-shadow: 0 8px 30px var(--shadow);
}
.pad { padding: 18px; }
.pad-lg { padding: 22px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-lg { display: flex; flex-direction: column; gap: 18px; }
.rowf { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.between { justify-content: space-between; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.h2 { font-size: 18px; font-weight: 700; margin: 0; }
.h1 { font-size: 24px; font-weight: 700; margin: 0; }
.note { font-size: 13px; line-height: 1.7; color: var(--muted); }

/* ---------- الرأس ---------- */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; padding: 10px 18px; }
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.logo { height: 52px; width: auto; display: block; border-radius: 10px; background: var(--logo-plate); padding: 2px 4px; }
.brand-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.brand-t b { font-size: 18px; line-height: 1.3; }
.brand-t span { font-size: 13px; color: var(--muted); }
.top-search {
  flex: 1 1 260px; min-width: 0; max-width: 100%; display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 14px;
  border-radius: 12px; background: var(--field); border: 1px solid var(--field-line); color: var(--muted);
}
.top-search input { flex: 1; min-width: 0; height: 44px; border: 0; background: transparent; font-size: 16px; color: var(--ink); }
.top-spacer { flex: 1 1 20px; }
.nav { display: flex; gap: 6px; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { display: flex; align-items: center; height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid transparent; font-size: 16px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.nav a[aria-current="page"] { background: var(--sel); border-color: var(--gold); font-weight: 700; color: var(--ink); }
.who { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); min-width: 0; max-width: 100%; }
.who b { color: var(--ink); font-size: 14px; }
.demo-tag { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--warn-bg); color: var(--warn-fg); white-space: nowrap; }

/* ---------- أزرار وحقول ---------- */
.btn {
  min-height: 48px; padding: 0 20px; border-radius: 12px; font-size: 16px; font-weight: 700;
  border: 1px solid var(--btn); background: var(--btn); color: var(--btn-ink); display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
}
.btn:disabled { background: var(--btn-off); border-color: var(--btn-off); color: #fff; opacity: .85; }
.btn-lg { min-height: 60px; font-size: 20px; border-radius: 14px; }
.btn-ghost { background: var(--glass-strong); color: var(--ink); border-color: var(--ink); }
.btn-ghost:disabled { background: var(--sunken); border: 1px dashed var(--muted); color: var(--muted); opacity: 1; }
.btn-danger { background: var(--glass-strong); color: var(--bad-fg); border-color: var(--bad-fg); }
.btn-reserve { background: var(--reserve); border-color: var(--reserve); color: #fff; }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: 14px; border-radius: 10px; }
.icon-btn { width: 44px; min-width: 44px; padding: 0; }
.auth-theme { position: fixed; top: max(12px, env(safe-area-inset-top, 0px)); inset-inline-end: max(12px, env(safe-area-inset-right, 0px)); z-index: 5; }
.btn-locked { background: var(--sunken); color: var(--muted); border: 1px dashed var(--muted); }
.btn-locked:disabled { background: var(--sunken); color: var(--muted); border: 1px dashed var(--muted); opacity: 1; }
.btn-link { background: transparent; border: 0; color: var(--ink); text-decoration: underline; min-height: 40px; padding: 0 8px; font-weight: 600; }

.fld {
  height: 52px; width: 100%; padding: 0 14px; border: 1px solid var(--field-line); border-radius: 12px;
  background: var(--field); font-size: 18px; color: var(--ink);
}
.fld.sm { height: 44px; font-size: 15px; padding: 0 10px; border-radius: 10px; }
select.fld { appearance: none; -webkit-appearance: none; padding-left: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 12px center; }
.lbl { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.fgrp { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.fgrp-h { display: flex; align-items: center; justify-content: space-between; min-height: 22px; gap: 8px; }
.phone-box { display: flex; height: 52px; border: 1px solid var(--field-line); border-radius: 12px; background: var(--field); overflow: hidden; direction: ltr; }
.phone-box span { display: flex; align-items: center; padding: 0 12px; background: var(--sunken); color: var(--ink-2); font-size: 16px; font-weight: 600; border-right: 1px solid var(--field-line); }
.phone-box input { flex: 1; min-width: 0; border: 0; padding: 0 12px; font-size: 18px; background: transparent; color: var(--ink); letter-spacing: .5px; }
.seg { display: flex; gap: 8px; }
.seg button { flex: 1; min-width: 0; height: 52px; padding: 0 4px; border-radius: 12px; font-size: 16px; font-weight: 600; border: 1px solid var(--field-line); background: var(--field); color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--btn); color: var(--btn-ink); border-color: var(--btn); }
.seg.sm button { height: 44px; font-size: 14px; border-radius: 10px; }
.pillrow { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { height: 44px; padding: 0 20px; border-radius: 999px; border: 1px solid var(--gold); background: var(--glass-strong); font-size: 15px; font-weight: 600; color: var(--ink); }
.pill[aria-pressed="true"] { background: var(--btn); color: var(--btn-ink); border-color: var(--btn); font-weight: 700; }
.pill.sm { height: 40px; padding: 0 14px; font-size: 14px; border-color: var(--field-line); }

.chip { font-size: 13px; font-weight: 600; padding: 3px 12px; border-radius: 999px; white-space: nowrap; display: inline-block; }
.chip-ok { background: var(--ok-bg); color: var(--ok-fg); }
.chip-warn { background: var(--warn-bg); color: var(--warn-fg); }
.chip-bad { background: var(--bad-bg); color: var(--bad-fg); }
.chip-neutral { background: var(--neutral-bg); color: var(--neutral-fg); }
.chip-dark { background: var(--btn); color: var(--btn-ink); }

.banner { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-radius: 14px; border: 1px solid var(--gold); font-size: 17px; font-weight: 600; line-height: 1.5; }
.banner.warn { background: var(--warn-bg); color: var(--warn-fg); }
.banner.ok { background: var(--ok-bg); color: var(--ok-fg); }
.banner.bad { background: var(--bad-bg); color: var(--bad-fg); }
.banner.plain { background: var(--glass-strong); color: var(--ink); }
.banner svg { flex: none; }
.dash-note { padding: 8px 14px; border-radius: 12px; background: var(--glass); border: 1px dashed var(--gold); font-size: 13px; line-height: 1.7; color: var(--ink-2); }

.bar { display: block; height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--bar); border-radius: 3px; }
.bar.lg { height: 12px; border-radius: 6px; }
.bar.lg > i { border-radius: 6px; }
.bar.dark > i { background: var(--bar-dark); }
.bar.reserve > i { background: var(--reserve); }
.bar.ok > i { background: var(--ok-fg); }

/* ---------- صفوف القوائم ---------- */
.item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 14px; background: var(--glass-strong); border: 1px solid var(--line); min-width: 0; }
.item.sel { background: var(--sel); border-color: var(--gold); }
.item .nm { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .sub { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.item.in { background: var(--ok-bg); border-color: var(--ok-line); }
.iconbtn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; border: 1px solid var(--field-line); background: var(--field); color: var(--ink); flex: none; }
.empty { padding: 28px 10px; text-align: center; font-size: 16px; color: var(--muted); line-height: 1.8; }

/* ---------- التسجيل ---------- */
.trips-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.trip-chip { display: flex; flex-direction: column; gap: 8px; text-align: right; padding: 12px 16px; min-height: 92px; border-radius: 16px; border: 1px solid var(--gold); background: var(--glass); color: var(--ink); backdrop-filter: blur(20px) saturate(140%); -webkit-backdrop-filter: blur(20px) saturate(140%); box-shadow: 0 8px 30px var(--shadow); min-width: 0; }
.trip-chip[aria-pressed="true"] { background: var(--sel); }
.trip-chip .l1 { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.trip-chip .l1 b { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trip-chip .l1 span { font-size: 16px; font-weight: 600; white-space: nowrap; }
.trip-chip .chip { align-self: flex-start; }
.reg-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 14px; align-items: start; }
.f-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px 14px; }
.s-3 { grid-column: span 3; } .s-4 { grid-column: span 4; } .s-5 { grid-column: span 5; } .s-6 { grid-column: span 6; }
.s-7 { grid-column: span 7; } .s-8 { grid-column: span 8; } .s-12 { grid-column: span 12; }
.dob { display: grid; grid-template-columns: 1fr 1.5fr 1.2fr; gap: 8px; }
.dob select.fld { font-size: 17px; padding-right: 8px; padding-left: 28px; background-position: left 6px center; height: 52px; }
.save-row { display: flex; gap: 12px; flex-wrap: wrap; }
.save-row .btn:first-child { flex: 1 1 260px; }
.last { display: flex; align-items: center; gap: 10px; padding: 8px 14px; min-height: 52px; border-radius: 14px; border: 1px solid var(--gold); }
.last.ok { background: var(--ok-bg); color: var(--ok-fg); }
.last.warn { background: var(--warn-bg); color: var(--warn-fg); }
.last span { flex: 1; font-size: 16px; font-weight: 600; }
.dupnote { padding: 10px 14px; border-radius: 12px; background: var(--warn-bg); color: var(--warn-fg); font-size: 14px; font-weight: 600; line-height: 1.6; border: 1px solid var(--gold); }
.errnote { padding: 10px 14px; border-radius: 12px; background: var(--bad-bg); color: var(--bad-fg); font-size: 15px; font-weight: 600; line-height: 1.6; }

/* ---------- البحث والبطاقة ---------- */
.split { display: grid; grid-template-columns: 420px minmax(0, 1fr); gap: 14px; align-items: start; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.info { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 12px; background: var(--glass-strong); border: 1px solid var(--line); min-width: 0; }
.info span:first-child { font-size: 13px; color: var(--muted); }
.info span:last-child { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.subcard { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 14px; background: var(--glass-strong); border: 1px solid var(--line); flex: 1 1 260px; min-width: 0; }
.subcard .h { font-size: 16px; font-weight: 700; }
.logbox { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 12px; background: var(--glass-strong); border: 1px solid var(--line); }
.logbox li { font-size: 13px; line-height: 1.7; color: var(--ink-2); }
.logbox ul { margin: 0; padding: 0 18px 0 0; }
.cancelled-name { text-decoration: line-through; color: var(--muted); }

/* ---------- الإركاب ---------- */
.stats { display: grid; grid-template-columns: 1.4fr 1fr 1fr auto; gap: 14px; }
.tile { display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 14px 18px; }
.tile .k { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.tile .v { font-size: 30px; font-weight: 700; line-height: 1; }
.tile .v small { font-size: 18px; font-weight: 600; color: var(--muted); }
.phase-btn { min-width: 170px; border-radius: 18px; font-size: 18px; padding: 0 20px; }
.board-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.listbox { display: flex; flex-direction: column; gap: 8px; max-height: 560px; overflow-y: auto; padding-inline-end: 2px; }
.searchbar { display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 16px; border-radius: 14px; background: var(--field); border: 1px solid var(--field-line); color: var(--muted); }
.searchbar input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 19px; height: 52px; color: var(--ink); }
.board-btn { min-width: 124px; height: 48px; padding: 0 14px; border-radius: 12px; font-size: 16px; font-weight: 700; border: 1px solid var(--btn); background: var(--btn); color: var(--btn-ink); }
.board-btn.out { background: var(--field); color: var(--ink); border-color: var(--ink); }
.board-btn.res { background: var(--reserve); border-color: var(--reserve); color: #fff; }
.board-btn.skip { min-width: 96px; background: var(--field); border-color: var(--bad-fg); color: var(--bad-fg); }
.board-btn.lock { background: var(--sunken); color: var(--muted); border: 1px dashed var(--muted); cursor: not-allowed; }
.board-btn.lock.sm { font-size: 13px; }
.modal-back { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(20, 22, 24, .35); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.modal { width: min(480px, 100%); max-height: 100%; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 24px; background: var(--glass-strong); }
.busbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- لوحة التحكم ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.kpi { display: flex; flex-direction: column; gap: 6px; padding: 18px; }
.kpi .k { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.kpi .v { font-size: 42px; font-weight: 700; line-height: 1.1; }
.kpi .s { font-size: 13px; color: var(--muted); }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; }
.bar-row { display: flex; align-items: center; gap: 12px; }
.bar-row .a { width: 96px; font-size: 15px; font-weight: 600; flex: none; }
.bar-row .b { flex: 1; min-width: 0; }
.bar-row .c { width: 150px; font-size: 14px; color: var(--ink-2); text-align: left; flex: none; }
.gender-bar { display: flex; height: 28px; border-radius: 8px; overflow: hidden; border: 1px solid var(--field-line); }
.gender-bar i { display: block; }
.tbl-scroll { overflow-x: auto; }
.bus-grid { display: grid; grid-template-columns: 1.3fr 1.5fr 1.5fr 1fr .7fr 1.2fr; gap: 10px; align-items: center; min-width: 900px; }
.bus-grid.head { font-size: 13px; font-weight: 600; color: var(--ink-2); padding: 0 4px; }
.bus-grid.body { padding: 8px 4px; border-top: 1px solid var(--line); }

/* ---------- الإدارة ---------- */
.adm-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: 14px; align-items: start; }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper button { width: 48px; height: 48px; border-radius: 12px; font-size: 22px; font-weight: 700; border: 1px solid var(--field-line); background: var(--field); color: var(--ink); }
.stepper button.plus { background: var(--btn); border-color: var(--btn); color: var(--btn-ink); }
.stepper output { flex: 1; height: 48px; display: flex; align-items: center; justify-content: center; border-radius: 12px; background: var(--glass-strong); border: 1px solid var(--line); font-size: 20px; font-weight: 700; }
.rolecard { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; text-align: right; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--field-line); background: var(--field); color: var(--ink); width: 100%; }
.rolecard[aria-pressed="true"] { border-color: var(--ink); background: var(--sel); }
.rolecard b { font-size: 16px; } .rolecard span { font-size: 13px; color: var(--ink-2); }
.matrix { display: grid; align-items: stretch; }
.matrix .hd { font-size: 14px; font-weight: 700; color: var(--ink-2); text-align: center; padding: 8px 6px; }
.matrix .lb { display: flex; align-items: center; font-size: 15px; font-weight: 600; padding: 10px 6px; border-top: 1px solid var(--line); }
.matrix .cl { display: flex; align-items: center; justify-content: center; padding: 6px; border-top: 1px solid var(--line); }
.perm { min-width: 76px; height: 44px; border-radius: 999px; font-size: 15px; font-weight: 700; border: 1px solid var(--field-line); background: var(--field); color: var(--muted); }
.perm[aria-pressed="true"] { border-color: var(--ok-fg); background: var(--ok-bg); color: var(--ok-fg); }
.perm:disabled { cursor: default; }
.code-box { direction: ltr; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 20px; font-weight: 700; letter-spacing: 2px; padding: 8px 14px; border-radius: 10px; background: var(--sunken); border: 1px dashed var(--gold); }

/* ---------- الدخول ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px max(16px, env(safe-area-inset-right, 0px)) 20px max(16px, env(safe-area-inset-left, 0px)); }
.auth-card { width: min(440px, 100%); display: flex; flex-direction: column; gap: 14px; padding: 26px; }

/* ---------- التنبيه ---------- */
.toasts { position: fixed; z-index: 80; left: 0; right: 0; bottom: max(16px, env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { pointer-events: auto; max-width: min(560px, 100%); padding: 12px 18px; border-radius: 14px; font-size: 15px; font-weight: 600; line-height: 1.6; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); background: var(--btn); color: var(--btn-ink); }
.toast.bad { background: var(--bad-fg); color: #fff; }
.toast.ok { background: var(--ok-fg); color: #fff; }
.loading { padding: 40px; text-align: center; color: var(--muted); font-size: 16px; }

/* ---------- بيان الإركاب ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 18px; }
.paper-wrap { overflow-x: auto; padding-bottom: 10px; }
.sheet { width: 794px; max-width: none; margin: 0 auto; background: var(--paper); color: var(--paper-ink); padding: 14mm 12mm; font-size: 14px; box-shadow: 0 10px 40px var(--shadow); border-radius: 4px; }
.sheet .hd { display: flex; align-items: center; gap: 18px; padding-bottom: 10px; border-bottom: 2px solid #B8872F; }
.sheet .hd img { height: 84px; width: auto; display: block; background: transparent; padding: 0; }
.sheet .hd .mid { flex: 1; text-align: center; }
.sheet .hd .mid b { font-size: 26px; display: block; }
.sheet .hd .mid span { font-size: 15px; color: var(--paper-mute); }
.sheet .hd .dt { font-size: 15px; min-width: 190px; display: flex; flex-direction: column; gap: 4px; }
.sheet .mut { color: var(--paper-mute); }
.sheet .boxes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.sheet .boxes.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sheet .box { border: 1px solid var(--paper-line); border-radius: 6px; padding: 6px 10px; font-size: 15px; }
.sheet .box.span2 { grid-column: span 2; }
.sheet .box b { display: block; }
.sheet table { width: 100%; border-collapse: collapse; margin-top: 12px; border: 1px solid var(--paper-line); }
.sheet thead { display: table-header-group; }
.sheet th { background: var(--paper-head); font-size: 14px; padding: 6px 8px; text-align: right; border-bottom: 1px solid var(--paper-line); }
.sheet td { padding: 0 8px; height: 27px; font-size: 14px; border-bottom: 1px solid var(--paper-row); white-space: nowrap; }
.sheet tr { break-inside: avoid; page-break-inside: avoid; }
.sheet td.c, .sheet th.c { text-align: center; width: 36px; padding: 0 4px; }
.sheet td.nm { font-weight: 600; max-width: 230px; overflow: hidden; text-overflow: ellipsis; }
.sheet .cb { display: inline-block; width: 16px; height: 16px; border: 1.5px solid var(--paper-ink); border-radius: 3px; vertical-align: middle; position: relative; }
.sheet .cb.on::after { content: ""; position: absolute; inset: 1px 4px 4px 3px; border: solid var(--paper-ink); border-width: 0 2.5px 2.5px 0; transform: rotate(40deg); }
.sheet tr.sec td { background: var(--paper-head); font-weight: 700; height: 28px; border-top: 1px solid var(--paper-line); }
.sheet .tot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 15px; font-weight: 600; margin-top: 16px; break-inside: avoid; }
.sheet .sigs { display: flex; gap: 40px; margin-top: 18px; font-size: 15px; break-inside: avoid; }
.sheet .sigs div { flex: 1; display: flex; flex-direction: column; gap: 26px; font-weight: 700; }
.sheet .sigs i { border-bottom: 1px solid var(--paper-ink); display: block; }
.sheet .foot { display: flex; justify-content: space-between; font-size: 12px; color: var(--paper-mute); margin-top: 14px; }
.sheet + .sheet { margin-top: 16px; }

/* ---------- متجاوب ---------- */
@media (max-width: 960px) {
  .reg-grid, .split, .board-grid, .adm-two { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: 1fr 1fr; }
  .stats .phase-btn { grid-column: span 2; min-height: 56px; }
}
@media (max-width: 700px) {
  .f-grid > * { grid-column: span 12; }
  .shell { padding-block: 12px 32px; gap: 12px; }
  .top { padding: 10px 12px; gap: 10px; }
  .logo { height: 44px; }
  .who { width: 100%; justify-content: space-between; }
  .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .item.wrapm > .grow { flex: 1 1 100%; }
  .item.wrapm .board-btn { flex: 1 1 110px; }
  .brand-t b { font-size: 16px; }
  .trips-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .trip-chip { padding: 10px 12px; }
  .bar-row { flex-wrap: wrap; }
  .bar-row .a { width: 100%; } .bar-row .c { width: auto; }
  .kpi .v { font-size: 34px; }
  .pad-lg { padding: 16px; }
  .banner { font-size: 15px; }
  .item { flex-wrap: wrap; }
}
@media (max-width: 440px) {
  .stats { grid-template-columns: 1fr; }
  .stats .phase-btn { grid-column: auto; }
  .trip-chip .l1 b { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

@media print {
  @page { size: A4; margin: 10mm; }
  html, body { background: #fff !important; min-height: 0; }
  .no-print, .toasts { display: none !important; }
  .shell { padding: 0 !important; max-width: none; gap: 0; }
  .paper-wrap { overflow: visible; padding: 0; }
  .sheet { width: 100%; padding: 0; box-shadow: none; border-radius: 0; margin: 0; }
  .sheet + .sheet { break-before: page; margin-top: 0; }
}
