/* لوحة GooPark v2 - الهيكل والأدوات الموحّدة (فوق park.css: الألوان والخطوط والأزرار والدخول).
   الهوية نفسها: إسفلت داكن وأزرق الشعار؛ العنصر اللافت: «يحتاج انتباهك» والرسوم، وكل ما عداه هادئ. */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; }

/* ---------- الهيكل ---------- */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side); border-inline-start: 1px solid var(--faint); padding: 14px 12px 24px; display: flex; flex-direction: column; gap: 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; scrollbar-width: thin; }
.logo-tile { background: #f5f8fa; border-radius: 12px; padding: 2px 10px; display: flex; align-items: center; justify-content: center; }
.logo-tile img { height: 58px; display: block; }
.lot-pick select { font-weight: 700; font-size: .9rem; background: var(--asphalt); }
.nav-group { display: grid; gap: 2px; }
.nav-group h4 { margin: 8px 10px 2px; font-size: .72rem; color: var(--dust); font-weight: 700; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; color: var(--nav-fg); font-weight: 500; font-size: .92rem; text-decoration: none; }
.nav-item:hover { background: var(--hover); color: var(--strong); }
.nav-item.on { background: rgba(26, 168, 246, .14); color: var(--strong); font-weight: 700; box-shadow: inset -3px 0 0 var(--line); }
/* الشريط الأزرق على حافة البداية في الاتجاهين (الظل لا يقبل خصائص منطقية) */
html[dir="ltr"] .nav-item.on { box-shadow: inset 3px 0 0 var(--line); }
.nav-item.platform { margin-top: auto; border: 1px dashed rgba(26, 168, 246, .4); }
.badge { margin-inline-start: auto; border-radius: 999px; padding: 0 7px; font-size: .72rem; font-weight: 700; background: var(--asphalt-3); color: var(--concrete); }
.badge.alert { background: var(--stop); color: #fff; }
.badge.warn { background: var(--wait); color: #241600; }
.main { min-width: 0; display: flex; flex-direction: column; }
#app .top { display: flex; align-items: center; gap: 10px; padding: 10px 22px; border-bottom: 1px solid var(--faint); position: sticky; top: 0; background: var(--asphalt); z-index: 20; flex-wrap: nowrap; }
.nav-select { display: none; width: auto; font-weight: 700; }
.search { flex: 1; max-width: 520px; display: flex; align-items: center; gap: 8px; background: var(--asphalt-2); border: 1px solid var(--faint); border-radius: var(--r); padding: 8px 12px; color: var(--dust); font: inherit; cursor: pointer; text-align: start; }
.search:hover { border-color: rgba(26, 168, 246, .45); }
.search span:not(.kbd) { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.kbd { border: 1px solid var(--faint); border-radius: 6px; padding: 0 6px; font-size: .72rem; direction: ltr; }
.spacer { flex: 1; }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--faint); background: transparent; color: var(--concrete); display: grid; place-items: center; position: relative; cursor: pointer; flex: none; }
.dot { position: absolute; top: -5px; inset-inline-end: -5px; background: var(--stop); color: #fff; border-radius: 999px; font-size: .65rem; padding: 0 5px; font-weight: 700; }
.me-wrap { position: relative; }
.me { display: flex; align-items: center; gap: 8px; background: none; border: 0; color: inherit; font: inherit; cursor: pointer; padding: 2px; }
.me-text { display: grid; text-align: start; line-height: 1.25; font-size: .86rem; }
.me-menu { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); background: var(--asphalt-2); border: 1px solid var(--faint); border-radius: 12px; padding: 6px; display: grid; min-width: 200px; z-index: 30; box-shadow: 0 12px 30px var(--pop-shadow); }
.me-menu button { background: none; border: 0; color: var(--concrete); font: inherit; text-align: start; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.me-menu button:hover { background: var(--hover); }
.me-menu .danger { color: var(--red-fg); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #1d4fa8; color: #fff; display: inline-grid; place-items: center; font-weight: 800; font-size: .8rem; flex: none; }
.content { padding: 20px 22px 60px; display: grid; gap: 16px; align-content: start; max-width: 1280px; width: 100%; }
.loading-line { color: var(--dust); padding: 30px 0; text-align: center; }

/* ---------- رأس الصفحة والمؤشرات والشرائح ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 1.45rem; }
.page-head p { margin: 2px 0 0; }
.section-label { color: var(--line); font-size: .76rem; font-weight: 700; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.kpi { background: var(--asphalt-2); border: 1px solid var(--faint); border-radius: 14px; padding: 14px 16px; }
.kpi .label { color: var(--dust); font-size: .82rem; }
.kpi .val { font-size: 1.65rem; font-weight: 800; line-height: 1.25; margin-top: 2px; }
.kpi .sub { font-size: .78rem; color: var(--dust); margin-top: 2px; }
.kpi .up { color: var(--green-fg); font-weight: 700; }
.kpi .down { color: var(--red-fg); font-weight: 700; }
.kpi.alert { border-color: rgba(224, 80, 79, .45); }
.chips .count { background: var(--soft); border-radius: 999px; padding: 0 6px; font-size: .75rem; margin-inline-start: 4px; }
.chips button[aria-pressed="true"] .count { background: rgba(4, 18, 29, .25); }

/* ---------- يحتاج انتباهك ---------- */
.attn { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.attn-item { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; background: var(--asphalt); border: 1px solid var(--faint); border-radius: 12px; padding: 10px 12px; }
.attn-item .ic-box { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; }
.ic-box.red { background: rgba(224, 80, 79, .16); color: var(--red-fg); }
.ic-box.amber { background: rgba(240, 165, 42, .16); color: var(--amber-fg); }
.ic-box.blue { background: rgba(26, 168, 246, .16); color: var(--blue-fg); }
.attn-item b { display: block; font-size: .92rem; }
.attn-item span { font-size: .78rem; color: var(--dust); }
.all-good { display: flex; align-items: center; gap: 10px; color: var(--green-fg); }

/* ---------- الجدول ---------- */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.field { display: flex; align-items: center; gap: 6px; background: var(--asphalt); border: 1px solid var(--faint); border-radius: 9px; padding: 0 10px; color: var(--dust); font-weight: 500; }
.field input, .field select { border: 0; background: transparent; padding: 7px 0; min-width: 0; }
.field input:focus, .field select:focus { outline: none; }
.field:focus-within { border-color: var(--line); }
.search-field { flex: 1; min-width: 200px; }
.field.big { padding: 4px 12px; font-size: 1.05rem; }
.th-sort { background: none; border: 0; color: inherit; font: inherit; font-weight: 700; cursor: pointer; padding: 0; }
.dtable table td { vertical-align: middle; }
.row-actions { white-space: nowrap; text-align: end; }
.btn.icon-only { padding: 5px 7px; line-height: 0; }
.btn.icon-only.danger { color: var(--red-fg); }
.btn.danger-fill { background: var(--stop); border-color: var(--stop); color: #fff; }
.btn.loading { opacity: .6; cursor: progress; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; gap: 10px; flex-wrap: wrap; }
.pages { display: flex; gap: 4px; }
.pages button { min-width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--faint); background: transparent; color: var(--concrete); font: inherit; font-size: .82rem; cursor: pointer; }
.pages button.on { background: var(--line); color: var(--line-ink); border-color: var(--line); font-weight: 800; }
.person { display: inline-flex; align-items: center; gap: 8px; }
.person b { font-weight: 700; }
.plate { display: inline-flex; align-items: center; gap: 6px; border: 1.5px solid var(--plate-edge); border-radius: 5px; padding: 0 6px; font-weight: 800; color: var(--strong); font-size: .82rem; direction: ltr; white-space: nowrap; }
.plate em { font-style: normal; font-size: .62rem; color: var(--dust); font-weight: 700; }
.tag.blue { background: rgba(26, 168, 246, .16); color: var(--blue-fg); }

/* ---------- النوافذ والدرج ---------- */
dialog.modal { background: var(--asphalt-2); color: inherit; border: 1px solid var(--faint); border-radius: 16px; padding: 20px; width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 40px); overflow-y: auto; color-scheme: dark; }
dialog.modal.wide { width: min(760px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: var(--shade); }
dialog.modal h2 { margin: 0; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .span2 { grid-column: 1 / -1; }
.form-grid fieldset { border: 1px solid var(--faint); border-radius: 10px; padding: 8px 12px; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.row.end { justify-content: flex-end; }
.drawer-shade { position: fixed; inset: 0; background: var(--shade); z-index: 40; }
.drawer { position: fixed; top: 0; bottom: 0; inset-inline-start: 0; width: min(420px, 100vw); background: var(--asphalt-2); border-inline-end: 1px solid rgba(26, 168, 246, .35); z-index: 41; display: flex; flex-direction: column; box-shadow: 0 0 40px rgba(0, 0, 0, .5); }
/* بالإنجليزية يخرج الدرج من حافة النهاية (اليمين) كعادة الواجهات اللاتينية، والعربية كما هي */
html[dir="ltr"] .drawer { inset-inline-start: auto; inset-inline-end: 0; border-inline-end: 0; border-inline-start: 1px solid rgba(26, 168, 246, .35); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--faint); }
.drawer-head h2 { margin: 0; font-size: 1.1rem; }
.drawer-body { padding: 16px; overflow-y: auto; display: grid; gap: 14px; align-content: start; }
.mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mini div { background: var(--asphalt); border-radius: 10px; padding: 8px; text-align: center; }
.mini b { display: block; font-size: 1.1rem; }
.mini span { font-size: .74rem; color: var(--dust); }
.actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.timeline { display: grid; gap: 6px; font-size: .84rem; }
.timeline > div { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dashed var(--faint); padding-bottom: 6px; }
.notice-list { display: grid; gap: 8px; }
.notice { background: var(--asphalt); border-radius: 10px; padding: 10px; display: grid; gap: 4px; }
.notice.unread { border-inline-start: 3px solid var(--line); }
.results { display: grid; gap: 4px; max-height: 50vh; overflow-y: auto; }
.result { display: flex; align-items: center; gap: 10px; background: none; border: 0; color: inherit; font: inherit; text-align: start; padding: 9px 10px; border-radius: 9px; cursor: pointer; }
.result:hover, .result:focus { background: rgba(26, 168, 246, .1); outline: none; }

/* ---------- الرسوم ---------- */
.chart { width: 100%; height: auto; display: block; font-family: var(--font); }
.legend { display: flex; gap: 14px; font-size: .78rem; color: var(--dust); margin-bottom: 4px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 5px; vertical-align: -1px; }
.grid2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 12px; }
.panel h2 .muted, .panel-head .muted { font-weight: 500; font-size: .82rem; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.panel-head h2 { margin: 0; }
.week-nav { display: flex; align-items: center; gap: 6px; }
.slot { display: inline-flex; align-items: center; gap: 4px; background: var(--asphalt-3); border-radius: 8px; padding-block: 2px; padding-inline: 4px 8px; margin: 2px; font-size: .82rem; }

/* ---------- الجوال ---------- */
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .nav-select { display: block; max-width: 46vw; }
  .search span:not(.kbd), .kbd { display: none; }
  .search { flex: none; width: 38px; height: 38px; padding: 0; justify-content: center; }
  .me-text { display: none; }
  #app .top { padding: 10px 12px; }
  .content { padding: 14px 12px 60px; }
  .grid2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
@media print {
  .side, #app .top, .no-print, .toolbar, .pager, .row-actions { display: none !important; }
  .shell { display: block; }
}
.bays-mini { display: flex; gap: 1px; margin: 8px 0 4px; width: 100%; overflow: hidden; }
.bays-mini i { flex: 1 1 0; min-width: 0; height: 14px; border-radius: 2px; background: var(--line); opacity: .9; }
.bays-mini i.full { background: rgba(26, 168, 246, .55); }

/* أزرار بشكل رابط: بلا خط تحتها، وبطاقة الشخص داخل رابط بلا خط */
a.btn { text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }

/* زر اللغة في زاوية بطاقة الدخول (قبل الدخول) */
.login { position: relative; }
.login > .login-tools { position: absolute; top: 16px; inset-inline-end: 16px; display: flex; gap: 8px; align-items: center; }
button.link:has(.person) { text-decoration: none; text-align: start; }

/* الجوال: قائمة الصفحات تأخذ ما بقي من الشريط فلا يدفع زر اللغة صورة الحساب خارج الشاشة */
@media (max-width: 960px) {
  #app .top .spacer { display: none; }
  .nav-select { flex: 1 1 auto; min-width: 0; max-width: none; }
  .lang-toggle { padding-inline: 8px; flex: none; }
}

/* سجل النشاط: التفاصيل الطويلة تلتف داخل الخلية بدل تمديد الجدول عرضياً */
.audit-detail { word-break: break-word; overflow-wrap: anywhere; max-width: 560px; }

/* منتقي اللوحة (الدولة ← الإمارة ← الرمز ← الرقم) في النماذج */
.plate-field { display: grid; gap: 8px; }
.plate-label { font-weight: 500; font-size: .92rem; }
.plate-rows { display: grid; gap: 8px; }
.plate-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; padding: 8px; border: 1px solid var(--faint); border-radius: 10px; }
.plate-row > label { flex: 1 1 110px; min-width: 0; font-size: .82rem; }
.plate-row > label.grow { flex-grow: 2; }
.plate-row [hidden] { display: none; }
.plate-out { flex: 1 0 100%; }
.plate-out:empty { display: none; }
.plate-field [data-pp-add] { justify-self: start; }

/* محرر العقد ونصه ولوحة التوقيع (صفحة العقود) */
.ce-note { border-inline-start: 3px solid var(--wait); background: rgba(240, 165, 42, .08); border-radius: 8px; padding: 8px 12px; white-space: pre-wrap; }
.ce-sec { border: 1px solid var(--faint); border-radius: 12px; padding: 10px 14px 14px; margin: 0; display: grid; gap: 10px; min-width: 0; }
.ce-sec legend { font-weight: 800; padding: 0 6px; }
.ce-opt, .ce-other { display: grid; gap: 6px; align-content: start; }
.ce-other[hidden], .sigpad-hint[hidden] { display: none; }
.contract-doc { display: grid; gap: 14px; max-height: 60vh; overflow-y: auto; }
.contract-doc article { background: var(--asphalt); border: 1px solid var(--faint); border-radius: 12px; padding: 14px 16px; }
.contract-doc h3 { margin: 0 0 8px; }
.contract-doc h4 { margin: 12px 0 4px; }
.contract-doc p { margin: 0 0 4px; white-space: pre-wrap; line-height: 1.7; }
.sigpad { position: relative; }
.sigpad canvas { display: block; width: 100%; height: 200px; background: #fff; border: 1.5px dashed var(--faint); border-radius: 12px; touch-action: none; cursor: crosshair; }
.sigpad-hint { position: absolute; inset: 0; display: grid; place-items: center; color: #9a9a9a; pointer-events: none; }

/* ساحة المنشأة التجارية: الزيارات والتحصيل (visits.js) */
.visits { display: grid; gap: 12px; }
.visit { background: var(--asphalt); border: 1px solid var(--faint); border-radius: 14px; padding: 14px; display: grid; gap: 12px; }
.visit-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.visit-head .plate { font-size: 1.15rem; padding: 2px 10px; }
.visit-opts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.visit-opt { font: inherit; background: var(--asphalt-2); color: var(--concrete); border: 1.5px solid var(--faint); border-radius: 12px; padding: 10px 8px; cursor: pointer; display: grid; gap: 0; justify-items: center; line-height: 1.35; }
.visit-opt > span:first-child { font-weight: 700; }
.visit-opt b { font-size: 1.3rem; }
.visit-opt > span:last-child { font-size: .76rem; color: var(--dust); }
.visit-opt:hover:not(:disabled) { border-color: rgba(26, 168, 246, .55); }
.visit-opt[aria-pressed="true"] { border-color: var(--line); background: rgba(26, 168, 246, .14); box-shadow: inset 0 0 0 1px var(--line); }
.visit-opt:disabled { opacity: .55; cursor: default; }
.visit-pay { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.visit-due b { font-size: 1.6rem; }

/* ساعات العمل والعطل وطباعة QR الخروج (إعدادات الساحة) */
.contents { display: contents; }
.hours-table td:last-child { text-align: end; }
.qr-sheet { display: grid; justify-items: center; gap: 10px; text-align: center; }
.qr-sheet .qr { width: 260px; }
.qr-sheet h3 { margin: 0; font-size: 1.25rem; }
@media print {
  .qr-sheet { color: #000; padding-top: 24px; }
  .qr-sheet .qr { width: 420px; border: 1px solid #000; }
  .qr-sheet h3 { font-size: 2rem; }
}
.form-grid input:disabled { opacity: .4; cursor: not-allowed; }
