/* برق — التصميم الاحترافي (موبايل أولًا، ويشتغل على الكمبيوتر) */
:root {
  --bg: #f3f4f6; --card: #ffffff; --ink: #111827; --mut: #6b7280; --line: #e5e7eb;
  --accent: #0e7c66; --accent-on: #ffffff; --accent-soft: #d6f0ea; --accent-ink: #0e5c4c;
  --rail: #0f2a26; --rail-ink: #9fb3ad; --rail-on: #7fe0c6;
  --valid: #1f9d55; --review: #e8a100; --review-ink: #9a6a00; --wanted: #e5484d; --incomplete: #8a8f98;
  --review-bg: rgba(232, 161, 0, .12); --wanted-bg: rgba(229, 72, 77, .10);
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0e1113; --card: #151a1d; --ink: #e5ebe9; --mut: #84918d; --line: #232a2e;
  --accent: #2fbf9b; --accent-on: #04130f; --accent-soft: #11342c; --accent-ink: #7fe0c6;
  --rail: #080b0c; --rail-ink: #84918d; --rail-on: #7fe0c6;
  --valid: #34c77b; --review-ink: #f3c04a; --review-bg: rgba(232, 161, 0, .14); --wanted-bg: rgba(229, 72, 77, .14);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font-family: "Segoe UI", Tahoma, "Noto Naskh Arabic", Arial, sans-serif; font-size: 16px;
  -webkit-tap-highlight-color: transparent; overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
.muted { color: var(--mut); }

/* ------------------------------------------------ الهيكل: شريط تحت في الموبايل، جانبي في الكمبيوتر */
.app { height: 100vh; height: 100dvh; display: flex; flex-direction: column-reverse; overflow: hidden; }
.main { flex: 1; min-height: 0; display: flex; flex-direction: column; min-width: 0; }
.rail {
  background: var(--rail); display: flex; flex-direction: row; align-items: center; justify-content: space-around;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); gap: 2px;
}
.rail .logo, .rail .grow { display: none; }
.rail .nav {
  border: 0; background: transparent; color: var(--rail-ink); padding: 6px 0; border-radius: 12px; min-width: 58px;
  display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; position: relative;
}
.rail .nav svg { width: 23px; height: 23px; }
.rail .nav.on { background: rgba(47, 191, 155, .16); color: var(--rail-on); }
.rail .fdot { position: absolute; top: 4px; inset-inline-end: 14px; width: 8px; height: 8px; border-radius: 50%; background: #2fbf71; }
[data-theme="dark"] .i-moon, [data-theme="light"] .i-sun { display: none; }

@media (min-width: 760px) {
  .app { flex-direction: row; }
  .rail { flex-direction: column; justify-content: flex-start; width: 78px; padding: 14px 0; gap: 6px; }
  .rail .logo { display: block; width: 52px; margin-bottom: 14px; }
  .rail .grow { display: block; flex: 1; }
  /* على الشاشة الكبيرة: المحتوى في النص بعرض مريح */
  .main { background: var(--bg); }
  .bar, .now, .alert, .page { width: 100%; max-width: 1000px; margin-inline: auto; }
  .bar { border-inline: 1px solid var(--line); }
  .now { border-inline: 1px solid var(--line); }
}

/* ------------------------------------------------ الميكروفون */
.bar { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--card); border-bottom: 1px solid var(--line); }
.mic {
  width: 64px; height: 64px; flex: none; border: 0; border-radius: 18px; background: var(--accent); color: var(--accent-on);
  display: grid; place-items: center; transition: border-radius .2s, background .2s, transform .1s; position: relative;
}
.mic:active { transform: scale(.95); }
.mic svg { width: 30px; height: 30px; }
.mic .i-stop { display: none; fill: currentColor; stroke: none; }
.mic.live { background: var(--wanted); color: #fff; border-radius: 50%; }
.mic.live .i-mic { display: none; }
.mic.live .i-stop { display: block; }
.mic.busy::after {
  content: ""; position: absolute; inset: -5px; border-radius: inherit; border: 3px solid transparent;
  border-top-color: var(--review); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.wave { flex: 1; height: 40px; display: flex; align-items: center; gap: 3px; overflow: hidden; min-width: 0; }
.wave i { flex: 1; max-width: 5px; min-width: 3px; border-radius: 3px; background: var(--line); height: 5px; transition: height .1s; }
.wave.live i { background: var(--accent); }
.counts { text-align: center; font-size: 11px; color: var(--mut); min-width: 40px; }
.counts b { display: block; font-size: 20px; color: var(--ink); line-height: 1.2; }
.counts.wanted b { color: var(--wanted); }
.clear { border: 0; background: transparent; color: var(--mut); width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; }
.clear svg { width: 20px; height: 20px; }

.alert { margin: 8px 14px 0; padding: 10px 12px; border-radius: 12px; background: var(--wanted-bg); color: var(--wanted); font-size: 14px; font-weight: 600; line-height: 1.6; }

/* ------------------------------------------------ اللوحة اللي بتتقال دلوقتي */
.now { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--card); border-bottom: 1px solid var(--line); min-height: 78px; }
.now .lbl { font-size: 12px; color: var(--mut); width: 92px; white-space: nowrap; flex: none; line-height: 1.5; display: flex; flex-direction: column; gap: 2px; }
.now .lbl b { font-weight: 700; }
.now .lbl .st1 { display: flex; align-items: center; gap: 6px; }
.now .lbl small { font-size: 12px; color: var(--accent-ink); font-weight: 700; min-height: 16px; }
.now.done .lbl small { color: var(--mut); }
.now .big { flex: 1; min-width: 0; }
.now .plate { font-size: 32px; }
.now .wait { color: var(--line); letter-spacing: 3px; font-weight: 400; }
.now .said { display: block; font-size: 13px; color: var(--mut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 18px; }
.now .slot { display: inline-block; width: .6em; border-bottom: 3px solid var(--accent); margin: 0 2px; opacity: .5; height: .9em; vertical-align: baseline; }
.now.live { box-shadow: inset 0 -3px 0 var(--accent); }
.now.done.valid .plate { color: var(--valid); }
.now.done.review .plate { color: var(--review-ink); }
.now.done.wanted .plate { color: var(--wanted); }
.now.done.incomplete .plate, .now.done.invalid .plate { color: var(--incomplete); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--mut); }
.dot.s-connected, .dot.s-recognizing { background: #2fbf71; box-shadow: 0 0 0 3px rgba(47, 191, 113, .18); }
.dot.s-mic, .dot.s-connecting, .dot.s-reconnecting { background: var(--review); animation: blink 1s infinite; }
.dot.s-error { background: var(--wanted); }
.dot.s-speaking { background: var(--review); animation: blink .7s infinite; }
@keyframes blink { 50% { opacity: .35; } }

/* ------------------------------------------------ الصفحات */
.page { display: none; flex: 1; min-height: 0; flex-direction: column; }
.page.on { display: flex; animation: pageIn .2s ease; }
@keyframes pageIn { from { opacity: 0; transform: translateY(6px); } }
.scroll { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }

.plate { font-weight: 800; letter-spacing: 1px; unicode-bidi: plaintext; white-space: nowrap; }
.plate .dg { font-variant-numeric: tabular-nums; margin-inline-start: 6px; }

/* جدول التشيك */
table.plates { width: 100%; border-collapse: collapse; background: var(--card); }
.plates th { position: sticky; top: 0; z-index: 1; background: var(--bg); color: var(--mut); font-size: 12px; font-weight: 700; text-align: right; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.plates td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.plates tbody tr { cursor: pointer; }
.plates tbody tr:nth-child(even) td { background: rgba(127, 127, 127, .04); }
.plates .c-n { width: 44px; }
.plates td.n { color: var(--mut); font-size: 13px; }
.plates td .plate { font-size: 22px; }
.plates tr.review td { background: var(--review-bg) !important; }
.plates tr.wanted td { background: var(--wanted-bg) !important; }
.plates tr.wanted .plate { color: var(--wanted); }
.plates tr.incomplete .plate, .plates tr.invalid .plate, .plates tr.pending .plate { color: var(--mut); }
.plates tr.row-in { animation: rowIn .3s ease; }
@keyframes rowIn { from { opacity: 0; transform: translateY(-8px); } }
.sd { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 700; white-space: nowrap; }
.sd::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--mut)); flex: none; }
.sd.valid { --c: var(--valid); } .sd.review { --c: var(--review); } .sd.wanted { --c: var(--wanted); }
.sd.incomplete, .sd.invalid, .sd.pending { --c: var(--incomplete); }
.why { display: block; font-size: 12px; color: var(--mut); font-weight: 500; margin-top: 2px; }
.tag { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 20px; background: var(--accent-soft); color: var(--accent-ink); margin-inline-start: 6px; vertical-align: middle; }

/* السجل */
.search { display: flex; align-items: center; gap: 8px; margin: 12px 14px 6px; padding: 10px 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.search svg { width: 18px; height: 18px; color: var(--mut); }
.search input { flex: 1; border: 0; background: transparent; color: var(--ink); font: inherit; outline: none; min-width: 0; }
.filters { display: flex; gap: 6px; padding: 4px 14px 8px; overflow-x: auto; }
.filters button { border: 1px solid var(--line); background: var(--card); padding: 6px 12px; border-radius: 20px; font-size: 13px; white-space: nowrap; }
.filters button.on { background: var(--accent); color: var(--accent-on); border-color: var(--accent); }
.hsum { display: flex; gap: 8px; padding: 4px 14px 10px; }
.hsum div { flex: 1; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px; text-align: center; font-size: 12px; color: var(--mut); }
.hsum b { display: block; font-size: 20px; color: var(--ink); }
.day { padding: 12px 16px 4px; font-size: 13px; color: var(--mut); font-weight: 700; }
.hitem { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--card); cursor: pointer; }
.hitem .plate { font-size: 20px; flex: 1; }
.hitem time { font-size: 13px; color: var(--mut); }
.chip { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
.chip.valid { background: rgba(31, 157, 85, .14); color: var(--valid); }
.chip.review { background: rgba(232, 161, 0, .16); color: var(--review-ink); }
.chip.wanted { background: rgba(229, 72, 77, .15); color: var(--wanted); }
.chip.incomplete, .chip.invalid, .chip.pending { background: rgba(138, 143, 152, .16); color: var(--incomplete); }
.empty { text-align: center; color: var(--mut); padding: 40px 20px; }

/* التدريب */
.train { padding: 14px; display: flex; flex-direction: column; gap: 12px; max-width: 900px; }
.tcard { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.tcard h4 { margin: 0 0 8px; font-size: 15px; display: flex; gap: 8px; align-items: center; }
.tcard h4 i { font-style: normal; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--accent-on); display: inline-grid; place-items: center; font-size: 13px; }
.tcard p { margin: 0; font-size: 14px; }
.tcard textarea { width: 100%; min-height: 110px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; padding: 10px; resize: vertical; }
.row-btns { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.tbtn { border: 0; border-radius: 12px; padding: 10px 16px; font-weight: 700; background: var(--accent); color: var(--accent-on); }
.tbtn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.tscore { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; font-size: 12px; color: var(--mut); margin-bottom: 10px; }
.tscore b { display: block; font-size: 22px; color: var(--ink); }
.tscore .ok b { color: var(--valid); } .tscore .half b { color: var(--review-ink); } .tscore .bad b { color: var(--wanted); }
.tscroll { max-height: 50vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.ttable { width: 100%; border-collapse: collapse; font-size: 14px; }
.ttable th { position: sticky; top: 0; background: var(--bg); color: var(--mut); font-size: 12px; text-align: right; padding: 6px 8px; }
.ttable td { padding: 7px 8px; border-top: 1px solid var(--line); }
.ttable td.pl { font-weight: 700; unicode-bidi: plaintext; white-space: nowrap; }
.ttable td.heard { color: var(--mut); font-size: 12px; }
.ttable tr.err td { background: var(--wanted-bg); }
.k { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 20px; white-space: nowrap; }
.k-ok { background: rgba(31, 157, 85, .14); color: var(--valid); }
.k-half { background: rgba(232, 161, 0, .16); color: var(--review-ink); }
.k-bad { background: rgba(229, 72, 77, .15); color: var(--wanted); }
.chk { display: block; margin: 8px 0 4px; font-size: 13px; }
.dev summary { cursor: pointer; font-weight: 700; font-size: 14px; color: var(--mut); }
.lat { width: 100%; border-collapse: collapse; font-size: 13px; margin: 10px 0; }
.lat th, .lat td { padding: 5px 6px; border-bottom: 1px solid var(--line); text-align: right; }
.log { background: #0b0d10; color: #b8f7d4; font-size: 11px; max-height: 260px; overflow: auto; padding: 10px; border-radius: 10px; direction: ltr; text-align: left; white-space: pre-wrap; margin: 8px 0 0; }

/* ------------------------------------------------ النوافذ (من تحت في الموبايل، في النص في الكمبيوتر) */
.sheet-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 30; display: flex; align-items: flex-end; justify-content: center; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: 100%; max-width: 520px; background: var(--card); color: var(--ink); border-radius: 22px 22px 0 0;
  padding: 18px 18px calc(20px + env(safe-area-inset-bottom)); max-height: 88vh; overflow: auto; animation: up .22s ease;
}
@keyframes up { from { transform: translateY(40px); opacity: .4; } }
@media (min-width: 760px) { .sheet-bg { align-items: center; } .sheet { border-radius: 18px; } }
.sheet h3 { margin: 0 0 10px; font-size: 17px; }
.big-plate { font-size: 36px; text-align: center; margin: 6px 0 12px; }
.wanted-head { color: var(--wanted); font-weight: 800; font-size: 18px; text-align: center; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: 15px; margin: 8px 0 16px; }
.kv dt, .kv .k2 { color: var(--mut); }
.kv dd { margin: 0; font-weight: 700; word-break: break-word; }
.multi { text-align: center; color: var(--wanted); font-weight: 700; margin-bottom: 6px; }
.recsep { border-top: 1px dashed var(--line); margin: 6px 0; }
.act { width: 100%; border: 0; border-radius: 14px; padding: 14px; font-weight: 800; font-size: 17px; background: var(--accent); color: var(--accent-on); }
.act.red { background: var(--wanted); color: #fff; }
.act.ghost { background: transparent; color: var(--mut); margin-top: 6px; }
.finfo { font-size: 14px; color: var(--mut); margin: 0 0 14px; line-height: 1.7; }
.finfo b { color: var(--ink); }
.loading { opacity: .6; }

/* جدول التدريب المباشر */
.row-btns .grow { flex: 1; }
.live-sum { margin-inline-start: auto; font-size: 13px; font-weight: 600; color: var(--mut); display: flex; gap: 10px; }
.live-sum .ok { color: var(--valid); } .live-sum .bad { color: var(--wanted); }
.ttable.live tr.ok td { background: rgba(31, 157, 85, .10); }
.ttable.live tr.bad td { background: var(--wanted-bg); }
.ttable.live td.mk { font-size: 12px; white-space: nowrap; }
.ttable.live tr.ok td.mk { color: var(--valid); } .ttable.live tr.bad td.mk { color: var(--wanted); }

/* ================================================================
   الشكل الزجاجي (اختيار أحمد — 2026-10-06): لوجو برق في الخلفية
   ================================================================ */
[data-theme="dark"] {
  --bg: #060b18; --card: rgba(11, 16, 32, .74); --ink: #fff8e6; --mut: #b4b9c8; --line: rgba(240, 195, 90, .18);
  --accent: #e0b44c; --accent2: #b98520; --accent-on: #1a1204; --accent-soft: rgba(240, 195, 90, .16); --accent-ink: #f0c35a;
  --rail: rgba(6, 10, 22, .88); --rail-ink: #b4b9c8; --rail-on: #f0c35a;
  --valid: #4ade80; --wanted: #ff6b6b; --incomplete: #8f95a5; --wanted-bg: rgba(255, 107, 107, .15);
  --glass: blur(14px) saturate(1.15);
}
body { background: #060b18; }
body::before {
  /* اللوجو بس، وأطرافه بتختفي في الخلفية الكحلي */
  content: ""; position: fixed; z-index: -1; pointer-events: none;
  left: 50%; top: 20vh; height: 64vh; aspect-ratio: 16 / 9; transform: translateX(-50%);   /* في نص الصفحة (اختيار أحمد) */
  background: url("bg.webp") center / cover no-repeat;
  -webkit-mask-image: radial-gradient(ellipse 48% 50% at 50% 50%, #000 58%, transparent 100%);
  mask-image: radial-gradient(ellipse 48% 50% at 50% 50%, #000 58%, transparent 100%);
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, rgba(6, 11, 24, .35) 0%, rgba(6, 11, 24, .1) 45%, rgba(6, 11, 24, .6) 80%, #060b18 97%);
}
@media (min-width: 760px) { body::before { height: 72vh; top: 14vh; } }
.app { background: transparent; }
.main { background: transparent !important; }
.bar, .now, .rail, .hdr, .plates, .tcard, .search, .hcard, .wcard, .ccard, .stat, .tabs, .xbtn, .sheet {
  backdrop-filter: var(--glass); -webkit-backdrop-filter: var(--glass);
}
.plates th { background: rgba(6, 10, 22, .9); }
.plates tbody tr:nth-child(even) td { background: rgba(255, 255, 255, .025); }
table.plates { background: var(--card); }
.page .scroll { padding-bottom: 80px; }
.rail .nav.on { background: rgba(240, 195, 90, .14); }
.rail .fdot { background: var(--valid); }

/* الهيدر */
.hdr { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: rgba(6, 10, 22, .55); border-bottom: 1px solid var(--line); }
.hlogo { width: 34px; height: 34px; border-radius: 9px; object-fit: cover; border: 1px solid var(--line); }
.hname { color: var(--accent-ink); font-size: 18px; letter-spacing: .5px; }
.who { margin-inline-start: auto; border: 0; background: transparent; text-align: left; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.3; padding: 2px 4px; }
.who b { font-size: 14px; color: var(--ink); }
.who small { font-size: 11px; color: var(--mut); }
.badge { display: inline-block; font-size: 10px; font-weight: 800; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: var(--accent-on); border-radius: 6px; padding: 1px 6px; vertical-align: middle; }
@media (min-width: 760px) { .hdr { max-width: 1000px; width: 100%; margin-inline: auto; } .rail .logo { border-radius: 12px; } }

/* الميكروفون أصغر + اللوحة أصغر */
.bar { background: var(--card); gap: 10px; padding: 10px 12px; }
.mic { width: 56px; height: 56px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: var(--accent-on);
  box-shadow: 0 0 0 5px rgba(240, 195, 90, .15); }
.mic svg { width: 26px; height: 26px; }
.mic.live { background: var(--wanted); box-shadow: 0 0 0 5px rgba(255, 107, 107, .18); }
.wave.live i { background: var(--accent); }
.now { min-height: 64px; background: var(--card); }
.now .plate { font-size: 26px; }
.now.done.valid .plate { color: var(--valid); }
.newses { border: 1px solid var(--line); background: transparent; color: var(--accent-ink); border-radius: 12px; padding: 5px 7px; display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 10px; font-weight: 700; flex: none; }
.newses svg { width: 20px; height: 20px; }

/* الدخول */
.auth { position: fixed; inset: 0; display: flex; align-items: flex-end; justify-content: center; padding: 20px 20px calc(30px + env(safe-area-inset-bottom)); overflow: auto; }
@media (min-height: 700px) { .auth { align-items: flex-end; } }
.auth-box { width: 100%; max-width: 380px; }
.auth-sub { text-align: center; color: var(--accent-ink); font-weight: 700; font-size: 15px; margin-bottom: 22px; }
.fld { display: block; margin-bottom: 12px; }
.fld span { display: block; font-size: 13px; color: var(--mut); margin-bottom: 6px; }
.fld input { width: 100%; border: 1px solid var(--line); background: rgba(0, 0, 0, .35); color: var(--ink); border-radius: 12px; padding: 13px; font: inherit; font-size: 16px; }
.fld input:disabled { opacity: .5; }
.codein { text-align: center; font-family: Consolas, monospace !important; letter-spacing: 6px; font-size: 24px !important; direction: ltr; }
.auth-err { color: var(--wanted); text-align: center; min-height: 22px; font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.gbtn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; border: 0; border-radius: 14px; padding: 14px; font-weight: 800; font-size: 17px;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); color: var(--accent-on); text-decoration: none; }
.gbtn.small { width: auto; padding: 10px 14px; font-size: 14px; flex: none; }
.gbtn.wa, .act.wa { background: #1fa855; color: #fff; text-decoration: none; display: flex; align-items: center; justify-content: center; }
.wa-ico { width: 24px; height: 24px; fill: currentColor; stroke: none; }
.or { display: flex; align-items: center; gap: 10px; color: var(--mut); font-size: 12px; margin: 18px 0 12px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.wafab { position: fixed; left: 14px; bottom: calc(80px + env(safe-area-inset-bottom)); width: 52px; height: 52px; border-radius: 50%; background: #1fa855; color: #fff;
  display: grid; place-items: center; box-shadow: 0 8px 20px rgba(0, 0, 0, .45); z-index: 20; }
.wafab .wa-ico { width: 28px; height: 28px; }
@media (min-width: 760px) { .wafab { bottom: 20px; } }

/* السجل */
.htools { display: flex; align-items: center; gap: 8px; margin: 12px 14px 8px; }
.htools .search { flex: 1; margin: 0; }
.trash { width: 44px; height: 44px; flex: none; border-radius: 12px; border: 1px solid rgba(255, 107, 107, .5); background: transparent; display: grid; place-items: center; color: var(--wanted); }
.trash svg { width: 20px; height: 20px; }
.tabs { display: flex; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 4px; margin: 0 14px 10px; }
.tabs button { flex: 1; border: 0; background: transparent; color: var(--mut); font-weight: 700; padding: 10px 6px; border-radius: 10px; }
.tabs button.on { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: var(--accent-on); }
.tabs button span { font-size: 12px; opacity: .85; }
.xbtn { display: flex; gap: 6px; align-items: center; justify-content: center; border: 1px solid var(--line); background: var(--card); color: var(--accent-ink);
  border-radius: 12px; padding: 10px 14px; font-weight: 700; margin: 0 14px 12px; width: calc(100% - 28px); }
.xbtn svg { width: 18px; height: 18px; }
.wcard { border: 1px solid rgba(255, 107, 107, .45); background: var(--card); border-radius: 16px; padding: 12px; margin: 0 14px 10px; cursor: pointer; }
.wcard .h { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.wcard .h .plate { font-size: 22px; color: var(--wanted); }
.wcard .h time { margin-inline-start: auto; font-size: 12px; color: var(--mut); }
.wcard .kv { margin: 6px 0; font-size: 14px; }
.loc { display: inline-flex; gap: 5px; align-items: center; margin-top: 4px; font-size: 13px; color: var(--accent-ink); text-decoration: none; font-weight: 700; }
.x { width: 30px; height: 30px; flex: none; border-radius: 8px; border: 0; background: transparent; display: grid; place-items: center; color: var(--wanted); opacity: .7; }
.x svg { width: 16px; height: 16px; }
.sess { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--mut); margin: 14px 18px 6px; }
.sess b { color: var(--accent-ink); font-size: 13px; }
.sess span { margin-inline-start: auto; }
.hcard { background: var(--card); border: 1px solid var(--line); border-radius: 16px; margin: 0 14px; overflow: hidden; }
.hcard .hitem { background: transparent; }
.hcard .hitem:last-child { border-bottom: 0; }
.hwho { font-size: 12px; color: var(--mut); }

/* النوافذ */
.sheet { background: rgba(12, 18, 36, .97); border-top: 1px solid var(--line); }
.center { text-align: center; }
.center h3 { margin-bottom: 6px; }
.big-ico { width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center; margin: 2px auto 10px; background: rgba(240, 195, 90, .14); color: var(--accent-ink); }
.big-ico svg { width: 32px; height: 32px; }
.big-ico.red { background: var(--wanted-bg); color: var(--wanted); }
.row2 { display: flex; gap: 8px; }
.row2 > * { flex: 1; }
.row2 .act.ghost { margin-top: 0; border: 1px solid var(--line); color: var(--ink); }
.act { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: var(--accent-on); text-decoration: none; text-align: center; }
.act.red { background: var(--wanted); }
.act.redtxt { color: var(--wanted); }
.opt { display: block; width: 100%; border: 1px solid var(--line); background: transparent; color: var(--ink); border-radius: 14px; padding: 12px 14px; margin-bottom: 8px; text-align: right; font-size: 15px; }
.opt small { display: block; color: var(--mut); font-size: 12px; margin-top: 2px; }
.opt.red { color: var(--wanted); border-color: rgba(255, 107, 107, .45); }
.lbl { font-size: 13px; color: var(--mut); margin: 6px 0; }
.fname { display: flex; align-items: center; border: 1px solid var(--line); background: rgba(0, 0, 0, .35); border-radius: 12px; overflow: hidden; margin-bottom: 10px; }
.fname input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 15px; padding: 12px; outline: 0; }
.fname span { padding: 0 12px; color: var(--mut); font-size: 13px; direction: ltr; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.seg button { border: 1px solid var(--line); background: transparent; color: var(--ink); border-radius: 999px; padding: 8px 13px; font-size: 13px; }
.seg button.on { border-color: var(--accent); color: var(--accent-ink); font-weight: 700; background: rgba(240, 195, 90, .12); }
.chk2 { display: flex; align-items: center; gap: 10px; font-size: 14px; padding: 10px 0; border-top: 1px solid var(--line); }
.chk2 input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }

/* التحكم */
#pageAdmin .tabs { margin-top: 12px; }
.arow { display: flex; gap: 8px; align-items: center; margin: 0 14px 10px; }
.arow .search { flex: 1; margin: 0; }
.ccard { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px; margin: 0 14px 10px; }
.ccard .h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ccard .h b { font-size: 16px; }
.code { font-family: Consolas, monospace; direction: ltr; letter-spacing: 2px; font-size: 15px; color: var(--accent-ink); font-weight: 800; background: rgba(240, 195, 90, .1); border-radius: 8px; padding: 3px 8px; }
.ccard .h .code { margin-inline-start: auto; }
.ccard .left { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--mut); margin: 10px 0 5px; }
.ccard .left b { color: var(--ink); font-size: 13px; }
.pbar { height: 7px; border-radius: 9px; background: var(--line); overflow: hidden; }
.pbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent2), var(--accent)); }
.pbar i.r { background: var(--wanted); }
.cacts { display: flex; gap: 6px; margin-top: 10px; }
.cacts > * { flex: 1; border: 1px solid var(--line); background: transparent; color: var(--ink); border-radius: 10px; padding: 8px 4px; font-size: 12px; font-weight: 700; text-align: center; text-decoration: none; }
.cacts > [data-act="more"] { flex: 0 0 38px; }
.cacts .g { color: var(--accent-ink); border-color: rgba(240, 195, 90, .5); }
.cacts .w { color: #fff; background: #1fa855; border-color: #1fa855; }
.cacts .r { color: var(--wanted); }
.ccard.off { opacity: .6; }
.pill { font-size: 11px; font-weight: 800; border-radius: 99px; padding: 2px 9px; }
.pill.on { background: rgba(74, 222, 128, .15); color: var(--valid); }
.pill.end { background: var(--wanted-bg); color: var(--wanted); }
.pill.stop { background: rgba(255, 255, 255, .1); color: var(--mut); }
.dur { display: flex; gap: 8px; margin-bottom: 10px; }
.dur input { width: 92px; text-align: center; border: 1px solid var(--line); background: rgba(0, 0, 0, .35); color: var(--ink); border-radius: 12px; padding: 10px; font: inherit; font-size: 20px; font-weight: 800; }
.dur .seg { margin: 0; flex: 1; flex-wrap: nowrap; }
.dur .seg button { flex: 1; font-size: 15px; border-radius: 12px; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.quick button { border: 1px dashed var(--line); background: transparent; color: var(--mut); border-radius: 10px; padding: 7px 10px; font-size: 12px; }
.gen { text-align: center; border: 1px dashed rgba(240, 195, 90, .6); border-radius: 14px; padding: 12px; margin: 6px 0 14px; }
.gen small { display: block; color: var(--mut); font-size: 12px; }
.gen b { display: block; font-family: Consolas, monospace; direction: ltr; letter-spacing: 5px; font-size: 30px; color: var(--accent-ink); margin: 6px 0; }
.ends { font-size: 13px; color: var(--mut); text-align: center; margin: 2px 0 12px; }
.ends b { color: var(--ink); }
.addsub { display: flex; background: rgba(0, 0, 0, .25); border: 1px solid var(--line); border-radius: 14px; padding: 4px; margin-bottom: 10px; }
.addsub button { flex: 1; border: 0; background: transparent; color: var(--mut); font-weight: 800; padding: 10px; border-radius: 10px; font-size: 15px; }
.addsub button.on { background: rgba(74, 222, 128, .15); color: var(--valid); }
.addsub button.on.minus { background: var(--wanted-bg); color: var(--wanted); }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 0 14px 12px; }
@media (min-width: 760px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.stat small { color: var(--mut); font-size: 12px; }
.stat b { display: block; font-size: 24px; margin-top: 2px; }
.stat b.g { color: var(--accent-ink); } .stat b.o { color: var(--valid); }
.urow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
.urow:last-child { border-bottom: 0; }
.urow b { font-size: 15px; }
.urow .u1 { color: var(--accent-ink); margin-inline-start: auto; }
.urow small { width: 100%; color: var(--mut); }
#aSettings .tcard { margin: 0 14px 10px; }
#aSettings .finfo { margin: 8px 0 0; }
#sSleep .addsub { margin: 10px 0 0; }
.micoff { text-align: center; color: var(--mut); font-size: 13px; font-weight: 700; margin-bottom: 8px; }

/* ---- الساعات والفلوس (v18) */
.qchip { margin-inline-start: auto; font-size: 12px; font-weight: 800; border-radius: 99px; padding: 5px 11px; white-space: nowrap;
  background: rgba(74, 222, 128, .15); color: var(--valid); }
.qchip.low { background: var(--wanted-bg); color: var(--wanted); }
.money { text-align: left; }
.money b { color: var(--ink); }
.cur2 { display: block; font-size: 11px; color: var(--mut); font-weight: 400; }
.stat .money.big b { display: block; font-size: 22px; margin-top: 2px; color: var(--accent-ink); }
.useg { margin: 0 14px 10px; }
.urow.total { border-top: 2px solid var(--line); }
#sPrice, #sShow { margin: 0 14px 10px; }
#sPrice .finfo, #sShow .finfo { margin: 6px 0 10px; }
.redtxt { color: var(--wanted) !important; }

/* ---- ملف الأدمن + ملفك (v22) */
.fcard { border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin: 0 0 10px; background: rgba(255, 255, 255, .03); }
.fcard.on { border-color: var(--valid); background: rgba(74, 222, 128, .07); }
.fcard.off { opacity: .55; }
.fcard .t { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 13px; color: var(--mut); }
.fcard .t b { color: var(--ink); font-size: 14px; }
.fcard .t .pill { margin-inline-start: auto; }
.fcard .n { font-weight: 800; font-size: 16px; word-break: break-all; }
.fcard small { display: block; color: var(--mut); font-size: 12px; margin-top: 2px; }
.fcard .fbusy { color: var(--accent-ink); font-weight: 700; }
.toast2 { position: fixed; left: 14px; right: 14px; top: 140px; z-index: 40; background: rgba(12, 18, 36, .97); border: 1px solid var(--accent);
  border-radius: 14px; padding: 12px 14px; font-size: 14px; color: var(--ink); max-width: 560px; margin: 0 auto; cursor: pointer; }
.who small.low { color: var(--wanted); font-weight: 800; }
.alert { white-space: pre-line; }

/* عمود الموقع + قايمة الدبوس */
.plates .c-loc { width: 1%; white-space: nowrap; }
.plates td.lc { padding-inline: 8px 12px; white-space: nowrap; }
body.noloc .plates .c-loc, body.noloc .plates td.lc { display: none; }
.pin { display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; cursor: pointer;
  background: var(--accent-soft); color: var(--accent-ink); border: 1px solid color-mix(in srgb, var(--accent-ink) 30%, transparent); }
.pin svg { width: 14px; height: 14px; flex: none; }
.pin.approx { background: transparent; color: #e08a1e; border: 1px dashed #e08a1e; }
.noloc { color: var(--mut); font-size: 12px; white-space: nowrap; }
.lhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 2px 0 4px; }
.lplate { font-size: 28px; font-weight: 800; }
.lplate.wanted { color: var(--wanted); }
.op { display: flex; align-items: center; gap: 14px; width: 100%; padding: 13px 14px; margin-bottom: 10px; border-radius: 14px; text-decoration: none; text-align: right;
  font: inherit; font-size: 17px; font-weight: 800; color: var(--ink); background: rgba(127, 127, 127, .06); border: 1px solid var(--line); cursor: pointer; }
.op small { display: block; font-size: 12px; font-weight: 400; color: var(--mut); }
.op .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.op .ic svg { width: 22px; height: 22px; }
.op .ic.map { background: rgba(66, 133, 244, .18); color: #4f8ff7; }
.op .ic.wa { background: rgba(37, 211, 102, .16); color: #1fa855; }
.op .ic.cp { background: var(--accent-soft); color: var(--accent-ink); }

/* v32: شريط البحث + الكتابة بإيد + التعديل والمسح */
.tbar { display: flex; gap: 6px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--card); }
.tbar .sr { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: rgba(0, 0, 0, .3); border-radius: 12px; padding: 0 10px; height: 42px; }
.tbar .sr input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 15px; outline: 0; }
.tbar .sr small { color: var(--mut); font-size: 12px; white-space: nowrap; }
.tbar .tb { height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--accent-soft); color: var(--accent-ink); font: inherit; font-size: 13px; font-weight: 800; padding: 0 10px; white-space: nowrap; flex: none; cursor: pointer; }
.plates tr[data-f], .plates tr[data-del] { display: none; }
.rtag.tag { margin-inline-start: 8px; vertical-align: middle; font-size: 11px; }
.bigin { direction: rtl; unicode-bidi: plaintext; font-size: 28px !important; text-align: center; letter-spacing: 2px; font-weight: 800 !important; }
.res { border-radius: 14px; padding: 12px 14px; margin: 8px 0 12px; font-size: 15px; line-height: 1.8; }
.res.w { background: var(--wanted-bg); border: 1px solid var(--wanted); }
.res.w b { color: var(--wanted); }
.res.ok { background: rgba(74, 222, 128, .1); border: 1px solid rgba(74, 222, 128, .4); }
.row2 { display: flex; gap: 8px; margin-top: 10px; }
.row2 .act { flex: 1; }
.act.sec { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.act:disabled { opacity: .45; }
.madd { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.madd .chip { font-size: 14px; }
.undobar { position: fixed; left: 14px; right: 14px; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 35; background: rgba(12, 18, 36, .97); color: var(--ink); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; font-size: 15px; box-shadow: 0 8px 24px rgba(0, 0, 0, .4); }
.undobar button { float: left; border: 0; background: transparent; color: var(--accent-ink); font: inherit; font-weight: 800; font-size: 16px; cursor: pointer; }
@media (min-width: 760px) { .undobar { left: auto; right: 110px; width: 420px; bottom: 24px; } }

/* v32: نغمة التنبيه */
.tone { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; font-weight: 700; cursor: pointer; }
.tone.on { border-color: var(--accent-ink); background: var(--accent-soft); }
.tone .pl { margin-inline-start: auto; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .08); color: var(--ink); font-size: 14px; cursor: pointer; flex: none; }
.tone .rad { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--mut); flex: none; }
.tone.on .rad { border: 6px solid var(--accent-ink); }
.vol { display: flex; align-items: center; gap: 10px; margin: 6px 0 10px; }
.vol input { flex: 1; accent-color: var(--accent); }

/* v32: التصدير بالجلسات */
.sesr { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 6px; cursor: pointer; }
.sesr input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.sesr span { display: flex; flex-direction: column; }
.sesr small { color: var(--mut); font-size: 12px; }
.sesr em { margin-inline-start: auto; font-style: normal; color: var(--accent-ink); font-weight: 800; font-size: 13px; white-space: nowrap; }
#xSes { max-height: 34vh; overflow: auto; margin-bottom: 8px; }
.xall { float: left; color: var(--accent-ink); font-weight: 800; cursor: pointer; }

/* v32: ملخص اللوحات اللي بقت مطلوبة بعد تغيير الملف */
.sumsub { font-size: 14px; color: var(--mut); font-weight: 700; }
.sumlist { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 12px; max-height: 40vh; overflow: auto; }
.sumr { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--wanted); border-radius: 12px; background: var(--wanted-bg); }
.sumr .plate { font-size: 22px; font-weight: 800; }
.sumr small { color: var(--mut); margin-inline-start: auto; }
.res.rc { margin-top: 0; }

/* v32: كاميرا رقم الشاصيه */
.act.vinb { margin-top: 10px; background: transparent; border: 1px solid var(--accent-ink); color: var(--accent-ink); }
.cam { position: relative; border-radius: 14px; overflow: hidden; background: #000; aspect-ratio: 4 / 3; margin-bottom: 10px; }
.cam video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam .frame { position: absolute; left: 8%; right: 8%; top: 38%; height: 24%; border: 3px solid #f0c35a; border-radius: 10px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .45); }
.cam .frame span { position: absolute; top: -30px; left: 0; right: 0; text-align: center; color: #fff; font-size: 13px; font-weight: 700; }
.vinin { text-align: center; font-size: 20px !important; letter-spacing: 2px; font-weight: 800; }
/* v32: رسالة "مطلوبة" فوق أي نافذة مفتوحة (زي خانة الكتابة بإيد أو الكاميرا) */
#matchOverlay { z-index: 38; }

/* v33: الكتابة بإيد — خانتين (حروف / أرقام) + رسم اللوحة السعودي */
.mboxes { display: flex; gap: 10px; direction: rtl; margin-bottom: 4px; }
.mbox { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.mbox small { color: var(--mut); font-size: 12px; text-align: center; }
.mbox input { width: 100%; border: 2px solid var(--line); background: rgba(0, 0, 0, .35); color: var(--ink); border-radius: 14px; font: inherit; font-size: 30px; font-weight: 800; text-align: center; padding: 10px 6px; outline: 0; letter-spacing: 4px; direction: ltr; }
.mbox input:focus { border-color: var(--accent-ink); box-shadow: 0 0 0 3px var(--accent-soft); }
.mkb { text-align: center; font-size: 14px; color: var(--accent-ink); font-weight: 700; margin: 8px 0 10px; min-height: 22px; }
.mread { text-align: center; font-size: 15px; color: var(--mut); margin: 2px 0 10px; min-height: 26px; }
.mread b { color: var(--accent-ink); font-size: 22px; }
.ksa { direction: ltr; display: flex; margin: 4px auto 6px; width: 290px; max-width: 100%; background: #fff; color: #111; border: 3px solid #111; border-radius: 10px; overflow: hidden; font-weight: 800; }
.ksa .cells { flex: 1; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.ksa .c { display: flex; justify-content: space-around; align-items: center; font-size: 24px; height: 44px; border-left: 2px solid #111; }
.ksa .c:nth-child(1), .ksa .c:nth-child(3) { border-left: 0; }
.ksa .c:nth-child(1), .ksa .c:nth-child(2) { border-bottom: 2px solid #111; }
.ksa .c span { width: 1.1em; text-align: center; }
.ksa .c.en { font-size: 21px; font-family: Arial, sans-serif; }
.ksa .strip { width: 28px; background: #1e5d3a; color: #fff; font-size: 11px; writing-mode: vertical-rl; letter-spacing: 2px; display: flex; align-items: center; justify-content: center; border-left: 2px solid #111; }

/* v33.1: اللوحة اللي لسه متسجلة (لحد ما يبدأ يكتب اللي بعدها) */
.ksa.done { box-shadow: 0 0 0 3px #4ade80; }

/* v34: الكود مربوط بجهاز */
.dev { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 6px 0 2px; padding: 7px 10px; border-radius: 10px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); flex-wrap: wrap; }
.dev b { color: var(--ink); }
.dev .ub { margin-inline-start: auto; border: 1px solid var(--line); background: transparent; color: var(--accent-ink); font: inherit; font-weight: 800; border-radius: 9px; padding: 4px 10px; cursor: pointer; }
.dev.warn { border-color: var(--wanted); background: var(--wanted-bg); }
.dev.warn b { color: var(--wanted); }
.auth-err { white-space: pre-line; }
