/* بصيرة — قشرة الواجهة المشتركة بين الخريطة الخارجية وصفحة الداخل.
   أداة للفريق (اختبار وتطوير)، وليست واجهة المستخدم الكفيف النهائية. */

:root {
  --navy: #023f7d;
  --ink: #10233d;
  --muted: #46566b;
  --line: #d9e1ec;
  --ground: #f3f6fa;
  --tint: #e6eef8;
  --amber: #f2a900;
  --amber-ink: #b26b00;
  --warn-bg: #fff3d6;
  --warn-ink: #5c3d00;
  --ok-bg: #e3f4eb;
  --ok-ink: #0b5a37;
  --danger: #b3261e;
  --danger-bg: #fdecea;
  --bar-h: 56px;
  --step-h: 44px;
  --tab-h: 64px;
  font-family: Tajawal, Cairo, Tahoma, Arial, sans-serif;
  color: var(--ink);
  background: var(--ground);
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- الشريط العلوي ---------- */
.app-header {
  position: relative; z-index: 900;
  display: flex; align-items: center; gap: 10px;
  height: calc(var(--bar-h) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 12px 0;
  background: var(--navy); color: #fff;
}
.app-header .logo { width: 36px; height: 36px; border-radius: 9px; object-fit: contain; background: #fff; flex: none; }
.app-header .title { flex: 1; min-width: 0; line-height: 1.15; }
.app-header .title b { display: block; font-size: 1.05rem; font-weight: 800; }
.app-header .title small { display: block; font-size: .7rem; font-weight: 500; opacity: .8; }
.pill {
  display: inline-flex; align-items: center; gap: 5px; min-height: 28px; padding: 2px 11px; border-radius: 999px;
  font-size: .74rem; font-weight: 800; white-space: nowrap; background: var(--ok-bg); color: var(--ok-ink);
}
.pill.warn, .pill.muted { background: var(--warn-bg); color: var(--warn-ink); }
.pill.muted { background: #e9eef5; color: var(--muted); }
.pill.bad { background: var(--danger-bg); color: var(--danger); }

/* ---------- مراحل الرحلة ---------- */
.stepper {
  position: relative; z-index: 890;
  display: flex; align-items: stretch; height: var(--step-h);
  background: #fff; border-bottom: 1px solid var(--line); margin: 0; padding: 0; list-style: none;
}
.stepper li { flex: 1; display: flex; }
.stepper a {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  color: var(--muted); font-size: .8rem; font-weight: 700; text-decoration: none; border-bottom: 3px solid transparent;
}
.stepper a i {
  display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  background: #e9eef5; font-style: normal; font-size: .7rem; font-weight: 800;
}
.stepper li.on a { color: var(--navy); border-bottom-color: var(--amber); }
.stepper li.on a i { background: var(--navy); color: #fff; }
.stepper li.done a i { background: var(--ok-bg); color: var(--ok-ink); }

/* ---------- شريط التنبيه ---------- */
.strip {
  display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 9px 12px;
  background: var(--warn-bg); color: var(--warn-ink); font-size: .8rem; line-height: 1.55; font-weight: 500;
}
.strip b { font-weight: 800; }
.strip button { margin-inline-start: auto; min-width: 32px; min-height: 32px; border: 0; background: transparent; font-size: 1.1rem; line-height: 1; border-radius: 8px; }

/* ---------- أزرار وبطاقات ---------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin: 0 0 12px; }
.card h2, .card h3 { margin: 0 0 8px; font-size: 1rem; font-weight: 800; }
.card .hint, .hint { margin: 6px 0 0; font-size: .78rem; line-height: 1.6; color: var(--muted); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 48px; padding: 0 16px;
  border: 1.5px solid var(--navy); border-radius: 12px; background: #fff; color: var(--navy);
  font-weight: 800; font-size: .95rem; text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--navy); color: #fff; }
.btn.amber { background: var(--amber); border-color: var(--amber); color: #3b2800; }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.quiet { border-color: var(--line); color: var(--muted); }
.btn.block { width: 100%; }
.btn.rec .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--danger); }
.btn.rec.on { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.rec.on .dot { background: #fff; border-radius: 3px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1 1 130px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; min-height: 30px; padding: 2px 10px; border-radius: 999px;
  font-size: .76rem; font-weight: 700; background: #e9eef5; color: var(--muted);
}
.chip.ok { background: var(--ok-bg); color: var(--ok-ink); }
.chip.warn { background: var(--warn-bg); color: var(--warn-ink); }
.chip.bad { background: var(--danger-bg); color: var(--danger); }
.chip.info { background: var(--tint); color: var(--navy); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

label.field { display: block; margin: 0 0 6px; font-size: .8rem; font-weight: 700; color: var(--muted); }
select, input[type="text"], input[type="number"], input[type="search"] {
  width: 100%; min-height: 48px; padding: 0 12px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; margin: 0 0 12px;
}
input[type="range"] { width: 100%; min-height: 32px; margin: 0 0 10px; accent-color: var(--navy); }
details.fold { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 4px; }
details.fold summary { min-height: 44px; display: flex; align-items: center; font-weight: 800; font-size: .9rem; color: var(--navy); cursor: pointer; }
details.fold p { font-size: .82rem; line-height: 1.7; color: var(--muted); }

/* ---------- شريط التبويبات السفلي ---------- */
.tabbar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 1000;
  display: flex; height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: #fff; border-top: 1px solid var(--line);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: .72rem; font-weight: 700; text-decoration: none; position: relative;
}
.tabbar a[aria-current="page"] { color: var(--navy); }
.tabbar a[aria-current="page"]::before { content: ''; position: absolute; top: 0; width: 34px; height: 3px; border-radius: 0 0 3px 3px; background: var(--amber); }
.ic {
  width: 24px; height: 24px; background: currentColor; display: inline-block; flex: none;
  -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat;
}
.ic-nav { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 2l7 19-7-4-7 4z'/%3E%3C/svg%3E"); }
.ic-dest { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 22s7-6.3 7-12a7 7 0 10-14 0c0 5.7 7 12 7 12z'/%3E%3Ccircle cx='12' cy='10' r='2.5'/%3E%3C/svg%3E"); }
.ic-log { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 6h11M9 12h11M9 18h11M4 6h.01M4 12h.01M4 18h.01'/%3E%3C/svg%3E"); }
.ic-set { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7h10M18 7h2M4 17h2M10 17h10'/%3E%3Ccircle cx='16' cy='7' r='2'/%3E%3Ccircle cx='8' cy='17' r='2'/%3E%3C/svg%3E"); }
.ic-mic { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='3' width='6' height='11' rx='3'/%3E%3Cpath d='M5 11a7 7 0 0014 0M12 18v3'/%3E%3C/svg%3E"); }
.ic-speaker { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 9v6h4l5 4V5L8 9zM16.5 8.5a5 5 0 010 7'/%3E%3C/svg%3E"); }
.ic-cam { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8a2 2 0 012-2h2l2-2h6l2 2h2a2 2 0 012 2v10a2 2 0 01-2 2H5a2 2 0 01-2-2z'/%3E%3Ccircle cx='12' cy='13' r='3.5'/%3E%3C/svg%3E"); }
.ic-flag { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 21V4M5 4h12l-2 4 2 4H5'/%3E%3C/svg%3E"); }
.ic-door { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 21V4a1 1 0 011-1h10a1 1 0 011 1v17M3 21h18M14 12h.01'/%3E%3C/svg%3E"); }

@media (min-width: 700px) {
  .tabbar { left: 50%; right: auto; transform: translateX(-50%); width: 560px; border-inline: 1px solid var(--line); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
