/* لوحة مالك GooPark - هوية GooPark (أزرق الشعار على الإسفلت). العنصر اللافت الوحيد: صف المواقف في
   "نظرة عامة" بخطوط زرقاء كخطوط الأرضية؛ كل ما عداه هادئ ووظيفي. */
:root {
  --asphalt: #17181b;
  --asphalt-2: #1f2024;
  --asphalt-3: #2a2b30;
  --line: #1aa8f6;          /* أزرق شعار GooPark = لون خطوط المواقف */
  --line-ink: #04121d;
  --concrete: #ecebe6;
  --dust: #a9a8a2;
  --faint: rgba(255, 255, 255, .09);
  --go: #2fa86a;
  --stop: #e0504f;
  --wait: #f0a52a;
  /* رموز ما كان ثابتاً للداكن فقط - الوضع الفاتح يعيد تعريفها تحت [data-theme="light"] */
  --side: #141518;
  --strong: #fff;
  --nav-fg: #cfcfc9;
  --hover: rgba(255, 255, 255, .05);
  --soft: rgba(255, 255, 255, .1);
  --edge-hover: rgba(255, 255, 255, .25);
  --red-fg: #ff8b8a;
  --amber-fg: #ffc65c;
  --blue-fg: #7fd0ff;
  --green-fg: #7fdcac;
  --plate-edge: #e8e8e2;
  --car: #5b5d66;
  --shade: rgba(0, 0, 0, .55);
  --pop-shadow: rgba(0, 0, 0, .4);
  --grid: rgba(255, 255, 255, .06);
  color-scheme: dark;
  --r: 10px;
  --font: "Tajawal", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--asphalt); color: var(--concrete); font: 16px/1.6 var(--font); }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.25; }
h1 { font-size: 1.6rem; font-weight: 800; }
h2 { font-size: 1.2rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
.muted { color: var(--dust); }
.small { font-size: .85rem; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
a { color: var(--line); }
:focus-visible { outline: 2px solid var(--line); outline-offset: 2px; }

/* أزرار وحقول */
.btn { font: inherit; font-weight: 700; border: 1px solid var(--faint); background: var(--asphalt-3); color: var(--concrete); border-radius: var(--r); padding: .6em 1.1em; cursor: pointer; }
.btn:hover { border-color: var(--edge-hover); }
.btn.primary { background: var(--line); color: var(--line-ink); border-color: var(--line); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--stop); }
.btn.small { padding: .35em .8em; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: progress; }
input, select, textarea { font: inherit; color: var(--concrete); background: var(--asphalt); border: 1px solid var(--faint); border-radius: var(--r); padding: .55em .75em; width: 100%; }
input[type="checkbox"] { width: auto; accent-color: var(--line); }
label { display: grid; gap: .3em; font-weight: 500; font-size: .92rem; }
label.check { display: flex; align-items: center; gap: .5em; }
.stack { display: grid; gap: .9rem; }
.row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .9rem; }

/* الدخول */
.login { max-width: 380px; margin: 0 auto; padding: 12vh 16px 32px; }
/* الشعار ثلاثي الأبعاد على بطاقة فاتحة: الخلفية داكنة، والشعار المسطّح ممنوع */
.login-logo { display: inline-block; background: #f5f8fa; border-radius: 14px; padding: 10px 16px; margin-bottom: 28px; }
.login-logo img { height: 72px; display: block; }
.msg { min-height: 1.6em; color: var(--wait); }

/* الرأس والتبويبات */
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--faint); position: sticky; top: 0; background: var(--asphalt); z-index: 5; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-sign { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 8px; background: #1d4fa8; color: #fff; font-weight: 800; font-size: 1.4rem; font-family: Arial, sans-serif; flex: none; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.top-actions { flex: 1; justify-content: flex-end; min-width: 0; flex-wrap: wrap; }
/* أزرار الرأس سطر واحد كلٌّ منها، والرأس يلتفّ للسطر التالي في الشاشة الضيقة بدل تراكب الأزرار على العنوان */
.top { flex-wrap: wrap; }
.top-actions .btn { white-space: nowrap; text-decoration: none; }
.top-actions select { width: auto; max-width: 100%; min-width: 0; text-overflow: ellipsis; }
.tabs { display: flex; gap: 4px; overflow-x: auto; padding: 8px 12px 0; border-bottom: 1px solid var(--faint); scrollbar-width: none; }
.tabs button { font: inherit; background: none; border: 0; color: var(--dust); padding: .7em .9em; border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--concrete); border-bottom-color: var(--line); font-weight: 700; }
.view { max-width: 1120px; margin: 0 auto; padding: 20px 16px 64px; }
.view:focus { outline: none; }

/* الأقسام */
.panel { background: var(--asphalt-2); border: 1px solid var(--faint); border-radius: 14px; padding: 18px; margin-bottom: 16px; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }

/* صف المواقف: كل موقف خانة بين خطين أزرقين. المشغول سيارة داكنة، والمحجوز للمشتركين مخطّط */
.bays { display: grid; grid-template-columns: repeat(auto-fill, minmax(26px, 1fr)); border-inline-start: 3px solid var(--line); margin: 6px 0 14px; }
.bay { height: 52px; border-inline-end: 3px solid var(--line); border-bottom: 3px solid var(--line); position: relative; }
.bay.taken::after { content: ""; position: absolute; inset: 9px 5px; border-radius: 5px; background: var(--car); box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .25); }
.bay.reserved { background: repeating-linear-gradient(-45deg, transparent 0 6px, rgba(26, 168, 246, .16) 6px 9px); }
.bays-legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: .85rem; color: var(--dust); }
.bays-legend i { display: inline-block; width: 14px; height: 14px; vertical-align: -2px; margin-inline-end: 6px; border-radius: 3px; }
.occ-line { font-size: 1.05rem; }
.occ-line b { font-size: 2.2rem; font-weight: 800; color: var(--concrete); }

/* أرقام المال */
.money { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.money .amount { font-size: 1.8rem; font-weight: 800; }
.channels { list-style: none; padding: 0; margin: .4em 0 0; display: grid; gap: .2em; color: var(--dust); }
.channels li { display: flex; justify-content: space-between; }
/* الإجمالي: خلايا بخطوط فاصلة أفقية وعمودية (فجوة 1px فوق خلفية الخط) فلا يبدو الصف الثاني منفصلاً */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1px; margin-top: 8px; background: var(--faint); border: 1px solid var(--faint); border-radius: 12px; overflow: hidden; }
.fact { background: var(--asphalt-2); padding: 12px 14px; }
.fact.alert b { color: var(--stop); }
.fact b { display: block; font-size: 1.4rem; }
.fact.alert { border-color: var(--wait); }

/* الجداول */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: start; padding: .55em .6em; border-bottom: 1px solid var(--faint); vertical-align: top; }
th { color: var(--dust); font-weight: 500; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.empty { color: var(--dust); padding: 18px 4px; }
.tag { display: inline-block; padding: .05em .55em; border-radius: 999px; font-size: .8rem; background: var(--asphalt-3); white-space: nowrap; }
.tag.go { background: rgba(47, 168, 106, .18); color: var(--green-fg); }
.tag.stop { background: rgba(224, 80, 79, .18); color: var(--red-fg); }
.tag.wait { background: rgba(240, 165, 42, .18); color: var(--amber-fg); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { font: inherit; font-size: .88rem; border: 1px solid var(--faint); background: none; color: var(--dust); border-radius: 999px; padding: .25em .9em; cursor: pointer; }
.chips button[aria-pressed="true"] { border-color: var(--line); color: var(--concrete); }

.qr { background: #fff; border-radius: 12px; padding: 14px; width: 220px; }
.qr img { width: 100%; display: block; }
.toast { position: fixed; inset-inline: 16px; bottom: 16px; max-width: 420px; margin-inline: auto; background: var(--concrete); color: var(--asphalt); padding: .8em 1.1em; border-radius: var(--r); font-weight: 700; z-index: 10; }
.toast.err { background: var(--stop); color: #fff; }

@media (max-width: 640px) {
  .occ-line b { font-size: 1.8rem; }
  .bay { height: 40px; }
  .bays { grid-template-columns: repeat(auto-fill, minmax(20px, 1fr)); }
  /* الجداول تصير صفوفاً مكدّسة على الجوال */
  table.stack-sm thead { display: none; }
  table.stack-sm tr { display: block; border-bottom: 1px solid var(--faint); padding: .5em 0; }
  table.stack-sm td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: .2em .2em; }
  table.stack-sm td::before { content: attr(data-l); color: var(--dust); }
}
@media print {
  body { background: #fff; color: #000; }
  .top, .tabs, .no-print { display: none !important; }
  .panel { border: 0; background: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* زر بشكل رابط داخل الجداول (حذف مناوبة، فتح صورة بلاغ) */
button.link { background: none; border: 0; padding: 0 2px; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }

/* الفريق: الصف قيد التعديل، وجدول «ماذا يستطيع كل دور» */
tr.editing td { background: rgba(26, 168, 246, .08); }
tr.editing td:first-child { box-shadow: inset 3px 0 0 var(--line); }
html[dir="ltr"] tr.editing td:first-child { box-shadow: inset -3px 0 0 var(--line); }
details.panel > summary { cursor: pointer; list-style: none; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::before { content: "▸"; color: var(--line); }
details.panel[open] > summary::before { content: "▾"; }
details.panel[open] > summary { margin-bottom: 12px; }
.roles-matrix th:not(:first-child), .roles-matrix td.tick { text-align: center; width: 9%; }
.roles-matrix th.group { color: var(--line); font-weight: 700; padding-top: 1em; }
.roles-matrix td.tick { color: var(--dust); }
.roles-matrix td.tick[aria-label="مسموح"] { color: var(--go); font-weight: 700; }
/* صلاحيات العضو في نموذج التعديل */
fieldset.perms { border: 1px solid var(--faint); border-radius: var(--r); padding: 12px 14px; margin: 0; display: grid; gap: 10px; }
fieldset.perms legend { padding: 0 6px; font-weight: 700; }
.perm-group { display: grid; gap: 4px; }
.perm-group b { color: var(--line); font-size: .9rem; }
.perm-group label { display: flex; gap: 8px; align-items: baseline; }

/* نافذة تغيير كلمة المرور */
.pass-dialog { background: var(--asphalt-2); color: inherit; border: 1px solid var(--faint); border-radius: 14px; padding: 20px; width: min(420px, calc(100vw - 32px)); }
.pass-dialog::backdrop { background: var(--shade); }
.pass-dialog h2 { margin: 0; }
/* القوائم المنسدلة: لون الخيارات من رموز الوضع (كانت بيضاء بنص باهت لأن خلفية الحقل شفافة) في كل اللوحة ولوحة المنصة */
select option, select optgroup { background: var(--asphalt-2); color: var(--concrete); }
select option:checked { background: #1a6fa8; color: #fff; }

/* ---------- الوضع الفاتح (اختيار المستخدم في هذا المتصفح: goopark.dash.theme) ----------
   نفس الهوية: أزرق الشعار على خلفية فاتحة ونص كحلي. الأزرق أغمق قليلاً ليُقرأ نصاً على الأبيض. */
:root[data-theme="light"] {
  --asphalt: #f2f6f9;
  --asphalt-2: #ffffff;
  --asphalt-3: #e6edf3;
  --line: #0a78c2;
  --line-ink: #ffffff;
  --concrete: #0b2f52;
  --dust: #5a6b7c;
  --faint: rgba(11, 47, 82, .13);
  --go: #1f8a54;
  --stop: #d64545;
  --wait: #c97d0a;
  --side: #ffffff;
  --strong: #0b2f52;
  --nav-fg: #24486b;
  --hover: rgba(11, 47, 82, .06);
  --soft: rgba(11, 47, 82, .08);
  --edge-hover: rgba(11, 47, 82, .3);
  --red-fg: #b93736;
  --amber-fg: #9a5c00;
  --blue-fg: #0a6aad;
  --green-fg: #1b7346;
  --plate-edge: #0b2f52;
  --car: #8796a5;
  --shade: rgba(11, 47, 82, .35);
  --pop-shadow: rgba(11, 47, 82, .16);
  --grid: rgba(11, 47, 82, .1);
  color-scheme: light;
}
/* زر الشمس/القمر: يظهر رمز الوضع الذي ينتقل إليه */
.theme-toggle .moon { display: none; }
:root[data-theme="light"] .theme-toggle .sun { display: none; }
:root[data-theme="light"] .theme-toggle .moon { display: inline; }
.theme-toggle svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; }
