/* ==========================================================================
   ORDER FOR YOU - ULTRA-CLEAN APPLE LIGHT COMPONENTS, DRAWER & MAP STYLES
   ========================================================================== */

/* GLASS CARDS & PANELS */
.apple-glass-card {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-lg);
}

/* ניגודיות נגישה בכרטיסי הפרופיל במצב כהה */
:root[data-theme="dark"] .courier-profile-summary {
  color: #f8fafc;
  background: linear-gradient(145deg, #101e33, #132946) !important;
  border-color: #365273 !important;
}

:root[data-theme="dark"] .courier-profile-summary h3,
:root[data-theme="dark"] .courier-profile-summary dd,
:root[data-theme="dark"] .restaurant-profile-card h3,
:root[data-theme="dark"] .restaurant-profile-card dd {
  color: #f8fafc !important;
}

:root[data-theme="dark"] .courier-profile-summary > p,
:root[data-theme="dark"] .courier-profile-summary dt,
:root[data-theme="dark"] .restaurant-profile-card dt,
:root[data-theme="dark"] .restaurant-photo-editor small,
:root[data-theme="dark"] .courier-photo-editor small {
  color: #cbd5e1 !important;
}

:root[data-theme="dark"] .courier-profile-summary dl div,
:root[data-theme="dark"] .restaurant-profile-card dl div,
:root[data-theme="dark"] .restaurant-photo-editor,
:root[data-theme="dark"] .courier-photo-editor,
:root[data-theme="dark"] .delivery-proof-panel {
  color: #f8fafc;
  background: #18283d !important;
  border: 1px solid #334a66 !important;
}

:root[data-theme="dark"] .restaurant-profile-avatar {
  background: #1d3554 !important;
  border: 1px solid #3b5b7e;
}

:root[data-theme="dark"] .profile-avatar-mark {
  border-color: #3b5b7e;
}

:root[data-theme="dark"] .courier-wallet-card {
  color: #fff !important;
  background: linear-gradient(145deg, #07111f, #15365b) !important;
  border: 1px solid #34577d !important;
}

:root[data-theme="dark"] .courier-wallet-card h3,
:root[data-theme="dark"] .courier-wallet-card strong {
  color: #fff !important;
}

:root[data-theme="dark"] .courier-wallet-card span,
:root[data-theme="dark"] .courier-wallet-card small {
  color: #d7e2ef !important;
}

:root[data-theme="dark"] .wallet-periods div {
  background: rgba(255, 255, 255, 0.1) !important;
  border: 1px solid rgba(255, 255, 255, 0.16);
}

/* HAMBURGER 3-BAR BUTTON */
.hamburger-btn {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 34px;
  height: 24px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 2px;
  z-index: 1100;
}

.hamburger-btn .bar {
  width: 100%;
  height: 3.5px;
  background-color: #0f172a;
  border-radius: 4px;
  transition: var(--transition-fast);
}

.hamburger-btn:hover .bar {
  background-color: var(--accent-blue);
}

/* SLIDE-OUT MOBILE HAMBURGER SIDE DRAWER */
.drawer-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(8px);
  z-index: 2500;
  animation: fadeIn 0.25s ease;
}

.drawer-backdrop.hidden { display: none; }

.mobile-drawer {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 320px;
  max-width: 85vw;
  background: #ffffff;
  border-left: 2px solid var(--border-color);
  border-radius: 0;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: -10px 0 40px rgba(0,0,0,0.15);
  animation: slideDrawer 0.35s var(--ease-apple);
}

@keyframes slideDrawer {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 1.5px solid var(--border-color);
}

.user-badge-drawer {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar-icon {
  font-size: 2rem;
  background: #f1f5f9;
  padding: 8px;
  border-radius: var(--radius-md);
}

.close-btn {
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  color: #0f172a;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
}

.drawer-nav-menu {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 24px;
  flex: 1;
}

.menu-group-title {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 800;
  margin-bottom: 4px;
}

.drawer-nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #f8fafc;
  border: 1.5px solid var(--border-color);
  color: #0f172a;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-fast);
  font-family: inherit;
  width: 100%;
  text-align: right;
}

.drawer-nav-item {
  position: relative;
  min-height: 50px;
  padding: 12px 14px;
  border-radius: 13px;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.drawer-nav-item:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
  transform: translateX(-2px);
}

.drawer-nav-item:active {
  transform: scale(0.985);
}

.drawer-nav-item:hover {
  background: var(--accent-blue);
  color: #ffffff;
  border-color: transparent;
}

.drawer-footer {
  padding-top: 18px;
  border-top: 1.5px solid var(--border-color);
}

.logout-btn {
  background: #fff1f2;
  border: 1.5px solid #fecdd3;
  color: #e11d48;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  transition: var(--transition-fast);
  font-family: inherit;
}

.logout-btn:hover {
  background: #ffe4e6;
  border-color: #fda4af;
}

/* MOTORCYCLE MARKER FOR REAL-TIME COURIER GPS */
.courier-motorcycle-marker {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.motorcycle-pin-bubble {
  width: 44px;
  height: 44px;
  background: #ffffff;
  border: 2.5px solid #0071e3;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 4px 16px rgba(0, 113, 227, 0.35);
  position: relative;
}

.gps-pulse {
  position: absolute;
  top: -4px; left: -4px; right: -4px; bottom: -4px;
  border-radius: 50%;
  border: 2px solid #0071e3;
  animation: pulseGpsRing 2s infinite ease-out;
}

@keyframes pulseGpsRing {
  0% { transform: scale(0.9); opacity: 1; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* NATIVE NAVIGATION CHIPS */
.native-nav-group {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.nav-chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #0f172a;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s ease;
}

.nav-chip-btn:hover {
  background: #0071e3;
  color: #ffffff;
  border-color: transparent;
}

/* ADMIN STAT CARDS GRID & TABLES */
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.admin-stat-card {
  background: #ffffff;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.admin-stat-card .stat-icon {
  font-size: 2.4rem;
  background: #f1f5f9;
  padding: 10px;
  border-radius: var(--radius-md);
}

.stat-lbl {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-weight: 700;
}

.stat-val {
  font-size: 2rem;
  font-weight: 900;
  color: #0f172a;
}

.stat-val.green { color: var(--accent-green); }
.stat-val.blue { color: var(--accent-blue); }

.security-tag {
  font-size: 0.82rem;
  background: rgba(16, 185, 129, 0.1);
  color: #047857;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-weight: 700;
}

/* APPLE TABLES */
.apple-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
}

.apple-table th {
  background: #f8fafc;
  padding: 14px 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 800;
  border-bottom: 1.5px solid var(--border-color);
}

.apple-table td {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
}

.apple-table tr:last-child td { border-bottom: none; }

/* Responsive administration workspace */
#adminView .dashboard-layout {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

#adminView .admin-sidebar {
  position: sticky;
  top: 96px;
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 128px);
  padding: 20px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(226, 232, 240, 0.92);
  border-radius: 24px;
  box-shadow: 0 22px 55px rgba(15, 23, 42, 0.09);
  backdrop-filter: blur(18px);
}

#adminView .sidebar-menu {
  display: grid;
  gap: 8px;
  margin: 24px 0;
}

#adminView .admin-nav-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  color: #475569;
  text-align: right;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 12px;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  transition: 160ms ease;
}

#adminView .admin-nav-item:hover {
  color: #1d4ed8;
  background: #f8fafc;
  border-color: #e2e8f0;
}

#adminView .admin-nav-item.active {
  color: #1d4ed8;
  background: #eff6ff;
  border-color: #bfdbfe;
  box-shadow: inset -3px 0 #2563eb;
}

#adminView .sidebar-footer {
  margin-top: auto;
}

#adminView .content-body {
  min-width: 0;
}

.admin-page {
  display: none;
}

.admin-page.active {
  display: block;
  animation: workspacePageIn 220ms ease;
}

#adminView .apple-glass-card {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

#adminView .apple-table {
  min-width: 860px;
}

.admin-review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.admin-review-actions .apple-btn,
#adminView .apple-table .apple-btn {
  min-height: 38px;
  padding: 8px 11px;
  font-size: 0.82rem;
  white-space: nowrap;
}

#adminView .page-header h2 {
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  letter-spacing: -0.035em;
}

#adminView .admin-stat-card {
  border-radius: 20px;
  background: linear-gradient(145deg, #ffffff, #f8fbff);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

#adminView .admin-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 35px rgba(15, 23, 42, 0.09);
}

@media (max-width: 960px) {
  #adminView .dashboard-layout {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  #adminView .admin-sidebar {
    position: sticky;
    top: 76px;
    z-index: 20;
    min-height: 0;
    padding: 12px;
    border-radius: 18px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
  }

  #adminView .sidebar-header,
  #adminView .sidebar-footer {
    display: none;
  }

  #adminView .sidebar-menu {
    display: flex;
    gap: 8px;
    margin: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  #adminView .sidebar-menu::-webkit-scrollbar {
    display: none;
  }

  #adminView .admin-nav-item {
    flex: 0 0 auto;
    width: auto;
    min-height: 44px;
    white-space: nowrap;
  }

  #adminView .content-body,
  #adminView .admin-page {
    min-width: 0;
  }

  #adminView .admin-page > .apple-glass-card {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 640px) {
  .app-viewport {
    padding: 12px;
  }

  .app-header {
    height: 64px;
    padding-inline: 12px;
  }

  .header-actions .primary {
    display: none !important;
  }

  .menu-toggle-btn {
    padding: 8px 10px;
    font-size: 0.82rem;
  }

  #adminView .dashboard-layout {
    gap: 14px;
  }

  #adminView .admin-sidebar {
    top: 68px;
  }

  .admin-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 20px;
  }

  #adminView .admin-stat-card {
    align-items: flex-start;
    gap: 9px;
    min-height: 120px;
    padding: 14px;
  }

  #adminView .admin-stat-card .stat-icon {
    padding: 7px;
    font-size: 1.45rem;
  }

  #adminView .stat-val {
    font-size: 1.65rem;
  }

  #adminView .page-header {
    margin-bottom: 14px;
  }

  #adminView .apple-glass-card {
    padding: 0;
    border-radius: 16px;
  }

  #adminView .apple-table th,
  #adminView .apple-table td {
    padding: 12px;
  }
}

/* Courier availability — map bottom control */
.map-availability-card {
  position: absolute;
  right: 50%;
  bottom: 18px;
  z-index: 1100;
  width: min(470px, calc(100% - 32px));
  color: #334155;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(203, 213, 225, 0.9);
  border-radius: 22px;
  box-shadow:
    0 20px 45px rgba(15, 23, 42, 0.2),
    0 2px 7px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  transform: translateX(50%);
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.courier-available-dock {
  position: absolute;
  inset-inline-start: 16px;
  bottom: 116px;
  z-index: 1090;
  display: grid;
  width: min(380px, calc(100% - 32px));
  max-height: 240px;
  overflow: auto;
  background: rgba(255, 255, 255, .96);
  border: 1px solid rgba(147, 197, 253, .8);
  border-radius: 18px;
  box-shadow: 0 18px 42px rgba(15, 23, 42, .22);
  backdrop-filter: blur(18px);
}

.courier-available-dock.hidden {
  display: none;
}

.courier-offer-dock-heading,
.courier-offer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 13px;
}

.courier-offer-dock-heading {
  color: #1e3a8a;
  background: #eff6ff;
  border-bottom: 1px solid #dbeafe;
}

.courier-offer-dock-heading small {
  color: #475569;
}

.courier-offer-row {
  width: 100%;
  color: #0f172a;
  text-align: start;
  background: transparent;
  border: 0;
  border-bottom: 1px solid #e2e8f0;
  cursor: pointer;
}

.courier-offer-row:last-child {
  border-bottom: 0;
}

.courier-offer-row:hover {
  background: #f8fafc;
}

.courier-offer-route {
  display: grid;
  min-width: 0;
}

.courier-offer-route small {
  overflow: hidden;
  color: #64748b;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.courier-offer-pay {
  flex: 0 0 auto;
  color: #047857;
  font-size: 1.1rem;
  font-weight: 900;
}

:root[data-theme="dark"] .courier-available-dock {
  background: rgba(17, 28, 44, .97);
  border-color: #3b82f6;
}

:root[data-theme="dark"] .courier-offer-dock-heading {
  color: #dbeafe;
  background: #172b49;
  border-color: #334e73;
}

:root[data-theme="dark"] .courier-offer-dock-heading small,
:root[data-theme="dark"] .courier-offer-route small {
  color: #b8c7da;
}

:root[data-theme="dark"] .courier-offer-row {
  color: #f8fafc;
  border-color: #2a3a50;
}

:root[data-theme="dark"] .courier-offer-row:hover {
  background: #1b2a40;
}

:root[data-theme="dark"] .courier-offer-pay {
  color: #6ee7b7;
}

.map-availability-card.is-online {
  border-color: rgba(34, 197, 94, 0.42);
  box-shadow:
    0 20px 45px rgba(15, 23, 42, 0.18),
    0 0 0 4px rgba(34, 197, 94, 0.09);
}

.map-availability-card.is-offline {
  background: rgba(248, 250, 252, 0.96);
}

.map-availability-control {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 68px;
  align-items: center;
  gap: 12px;
  min-height: 82px;
  padding: 12px 14px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.availability-signal-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  color: #64748b;
  background: #eef2f7;
  border-radius: 15px;
  transition: color 180ms ease, background 180ms ease, transform 180ms ease;
}

.availability-signal-icon svg {
  width: 25px;
  height: 25px;
}

.is-online .availability-signal-icon {
  color: #15803d;
  background: #dcfce7;
}

.map-availability-control:active .availability-signal-icon {
  transform: scale(0.94);
}

.availability-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.35;
}

.availability-copy strong {
  color: #0f172a;
  font-size: 0.96rem;
  font-weight: 900;
}

.is-online .availability-copy strong {
  color: #166534;
}

.availability-copy small {
  margin-top: 3px;
  overflow: hidden;
  color: #64748b;
  font-size: 0.73rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.courier-availability-switch {
  position: relative;
  display: grid;
  place-items: center;
  width: 68px;
  min-height: 52px;
}

.courier-availability-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.availability-switch-track {
  position: relative;
  display: block;
  width: 64px;
  height: 36px;
  background: #cbd5e1;
  border-radius: 999px;
  box-shadow: inset 0 1px 3px rgba(15, 23, 42, 0.15);
  transition: background 200ms ease;
}

.availability-switch-thumb {
  position: absolute;
  top: 4px;
  left: 4px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: transparent;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.28);
  transition: transform 220ms cubic-bezier(.2, .8, .2, 1), color 180ms ease;
}

.availability-switch-thumb svg {
  width: 16px;
  height: 16px;
}

.courier-availability-switch input:checked + .availability-switch-track {
  background: #22c55e;
}

.courier-availability-switch input:checked + .availability-switch-track .availability-switch-thumb {
  color: #16a34a;
  transform: translateX(28px);
}

.courier-availability-switch input:focus-visible + .availability-switch-track {
  outline: 3px solid rgba(37, 99, 235, 0.3);
  outline-offset: 3px;
}

@media (max-width: 600px) {
  .map-availability-card {
    bottom: 12px;
    width: calc(100% - 20px);
    border-radius: 19px;
  }

  .map-availability-control {
    grid-template-columns: 44px minmax(0, 1fr) 62px;
    gap: 10px;
    min-height: 76px;
    padding: 10px;
  }

  .availability-signal-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
  }

  .availability-copy strong {
    font-size: 0.9rem;
  }

  .availability-copy small {
    font-size: 0.68rem;
  }

  .courier-availability-switch {
    width: 62px;
    min-height: 52px;
  }

  .availability-switch-track {
    width: 58px;
    height: 34px;
  }

  .availability-switch-thumb {
    width: 26px;
    height: 26px;
  }

  .courier-availability-switch input:checked + .availability-switch-track .availability-switch-thumb {
    transform: translateX(24px);
  }
}

.history-filter-bar {
  display: flex;
  align-items: end;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px;
}

.history-filter-bar label {
  display: grid;
  gap: 5px;
  color: #64748b;
  font-size: 0.75rem;
  font-weight: 800;
}

.history-filter-bar input {
  min-height: 44px;
}

.delivery-progress {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  margin: 12px 0;
}

.delivery-progress span {
  position: relative;
  padding-top: 9px;
  color: #94a3b8;
  font-size: 0.62rem;
  font-weight: 800;
  text-align: center;
  border-top: 4px solid #e2e8f0;
}

.delivery-progress span.done {
  color: #15803d;
  border-color: #22c55e;
}

.field-help {
  color: #64748b;
  font-size: 0.7rem;
}

.table-action-btn {
  min-height: 38px;
  padding: 7px 11px;
  color: #1d4ed8;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
}

@media (max-width: 600px) {
  .history-filter-bar {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Restaurant live delivery tracking */
.restaurant-live-tracking {
  margin: 14px 0 0;
  overflow: hidden;
  background: #f8fafc;
  border: 1px solid #dbe4ef;
  border-radius: 18px;
}

.tracking-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.94);
}

.tracking-heading > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.tracking-heading strong {
  color: #0f172a;
  font-size: 0.9rem;
}

.tracking-heading small {
  color: #64748b;
  font-size: 0.72rem;
}

.tracking-live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-inline-end: 4px;
  background: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.13);
  animation: trackingPulse 1.8s ease-in-out infinite;
}

.tracking-open-map {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 9px 12px;
  color: #1d4ed8;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 11px;
  font-size: 0.76rem;
  font-weight: 800;
  text-decoration: none;
}

.restaurant-tracking-map {
  width: 100%;
  height: 230px;
  background: #eaf0f7;
}

@keyframes trackingPulse {
  50% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0.03); }
}

/* Separate courier history, profile and settings */
#courierDetailsPage .panel-page {
  display: none;
}

#courierDetailsPage .panel-page.active {
  display: block;
}

.courier-detail-page {
  padding: clamp(18px, 4vw, 34px);
}

.courier-page-heading {
  margin-bottom: 22px;
}

.courier-page-heading > span {
  color: #2563eb;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.03em;
}

.courier-page-heading h2 {
  margin: 4px 0;
  color: #0f172a;
  font-size: clamp(1.45rem, 4vw, 2rem);
}

.courier-page-heading p {
  margin: 0;
  color: #64748b;
}

.courier-profile-summary {
  margin-bottom: 20px;
  padding: 24px;
  text-align: center;
  background: linear-gradient(145deg, #f8fbff, #eef5ff);
  border: 1px solid #dbeafe;
  border-radius: 22px;
}

.profile-avatar-mark {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin: 0 auto 12px;
  color: #fff;
  background: linear-gradient(145deg, #2563eb, #0f766e);
  border: 5px solid #fff;
  border-radius: 24px;
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.24);
  font-size: 0.9rem;
  font-weight: 900;
  overflow: hidden;
}

.profile-avatar-mark.small {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  margin: 0;
  border-radius: 20px;
}

.courier-profile-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.courier-photo-editor {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding: 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
}

.courier-photo-editor > div:last-child {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.courier-photo-editor small {
  flex-basis: 100%;
  color: #64748b;
  font-size: 0.7rem;
}

.photo-picker-btn {
  display: inline-flex;
  cursor: pointer;
}

.text-danger-btn {
  min-height: 40px;
  padding: 8px 10px;
  color: #be123c;
  background: transparent;
  border: 0;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.assigned-courier-photo,
.assigned-courier-initials {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 13px;
}

.assigned-courier-photo {
  object-fit: cover;
}

.assigned-courier-initials {
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, #2563eb, #0f766e);
  font-weight: 900;
}

.delivery-proof-panel {
  display: grid;
  gap: 9px;
  padding: 14px;
  background: #f8fafc;
  border: 1px solid #dbe4ef;
  border-radius: 16px;
  text-align: right;
}

.delivery-proof-panel p {
  margin: 0;
  color: #64748b;
  font-size: 0.78rem;
}

.delivery-proof-preview {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 12px;
}

.proof-status {
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 800;
}

.proof-table-thumb {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 10px;
}

.courier-wallet-card {
  margin-bottom: 18px;
  padding: 20px;
  background: linear-gradient(145deg, #0f172a, #1e3a5f);
  border-radius: 22px;
  color: #fff;
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.2);
}

.wallet-heading,
.wallet-periods {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.wallet-heading h3 {
  margin: 2px 0 14px;
  color: #fff;
  font-size: 2rem;
}

.wallet-heading > div > span,
.courier-wallet-card > small {
  color: #cbd5e1;
  font-size: 0.72rem;
}

.wallet-periods {
  margin-bottom: 14px;
}

.wallet-periods div {
  flex: 1;
  display: grid;
  gap: 3px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
}

.settings-subnav {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  padding: 6px;
  overflow-x: auto;
  background: var(--card-bg, #fff);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  scrollbar-width: none;
}

.settings-subnav button {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 8px 13px;
  color: var(--text-secondary);
  background: transparent;
  border: 0;
  border-radius: 13px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.settings-subnav button.active {
  color: #fff;
  background: var(--accent-blue);
}

.language-mode-control {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  padding: 5px;
  margin-top: 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 14px;
}

.language-mode-control button {
  min-height: 42px;
  padding: 8px;
  color: var(--text-sub);
  background: transparent;
  border: 0;
  border-radius: 10px;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.language-mode-control button.active {
  color: #fff;
  background: var(--accent-blue);
}

.settings-section-hidden {
  display: none !important;
}

/* האייקון נגזר ממצב התצוגה עצמו, כך שגם לאחר רענון הוא לעולם לא נשאר הפוך. */
[data-theme-toggle] {
  font-size: 0 !important;
}

[data-theme-toggle]::after {
  content: "🌙";
  font-size: 1.05rem;
}

.header-language-picker {
  position: relative;
}

.header-language-menu {
  position: absolute;
  top: calc(100% + 10px);
  inset-inline-end: 0;
  z-index: 250;
  display: grid;
  min-width: 150px;
  padding: 7px;
  background: var(--bg-card);
  border: 1px solid var(--border-color-strong);
  border-radius: 15px;
  box-shadow: var(--shadow-lg);
}

.header-language-menu.hidden {
  display: none;
}

.header-language-menu button {
  min-height: 40px;
  padding: 8px 12px;
  color: var(--text-main);
  text-align: start;
  background: transparent;
  border: 0;
  border-radius: 10px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.header-language-menu button:hover,
.header-language-menu button.active {
  color: var(--accent-blue);
  background: var(--bg-secondary);
}

:root[data-theme="dark"] .header-language-menu {
  background: #111c2c;
  border-color: #40536d;
}

:root[data-theme="dark"] .header-language-menu button {
  color: #e2e8f0;
}

:root[data-theme="dark"] .header-language-menu button:hover,
:root[data-theme="dark"] .header-language-menu button.active {
  color: #fff;
  background: #24344b;
}

:root[data-theme="dark"] [data-theme-toggle]::after {
  content: "☀️";
}

.shared-system-info {
  display: grid;
  gap: 7px;
  margin-top: 14px;
  padding: 14px;
  color: var(--text-secondary);
  background: color-mix(in srgb, var(--accent-blue) 7%, var(--card-bg, #fff));
  border: 1px solid var(--border-color);
  border-radius: 14px;
}

.app-version-line {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  width: fit-content;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  color: var(--text-secondary, #64748b);
  background: color-mix(in srgb, var(--primary-color, #2563eb) 9%, transparent);
  font-size: 0.78rem;
}

.app-version-line b {
  color: var(--primary-color, #2563eb);
  direction: ltr;
}

.admin-settings-card {
  display: block;
  width: min(760px, 100%);
  margin-inline: auto;
  padding: 20px;
}

.admin-settings-pane {
  display: grid;
  gap: 16px;
}

.settings-pane-heading {
  display: flex;
  align-items: center;
  gap: 13px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
}

.settings-pane-heading h3,
.settings-pane-heading p {
  margin: 0;
}

.settings-pane-heading p {
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 0.86rem;
}

.settings-pane-icon {
  display: inline-flex;
  flex: 0 0 46px;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  background: color-mix(in srgb, var(--accent-blue) 10%, var(--card-bg, #fff));
  border-radius: 15px;
  font-size: 1.3rem;
  line-height: 1;
}

.settings-readonly-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 15px;
  background: var(--surface-muted, #f8fafc);
  border: 1px solid var(--border-color);
  border-radius: 14px;
}

.admin-settings-subnav {
  width: min(760px, 100%);
  margin-inline: auto;
  margin-bottom: 14px;
}

.shared-system-info strong {
  color: var(--text-primary);
}

.shared-system-info p {
  margin: 0;
  line-height: 1.55;
}

.shared-system-info a {
  width: fit-content;
  color: var(--accent-blue);
  font-weight: 700;
  text-decoration: none;
}

.system-pause-control {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 16px;
  cursor: pointer;
}

.system-pause-control span {
  display: grid;
  gap: 4px;
}

.system-pause-control small {
  color: #9a3412;
}

.system-pause-control input {
  width: 48px;
  height: 26px;
  accent-color: #ea580c;
}

:root[data-theme="dark"] .system-pause-control {
  color: #ffedd5;
  background: #431407;
  border-color: #9a3412;
}

:root[data-theme="dark"] .system-pause-control small {
  color: #fdba74;
}

@media (max-width: 600px) {
  .settings-subnav {
    margin-inline: -4px;
    border-radius: 15px;
  }

  .settings-subnav button {
    min-height: 46px;
    padding-inline: 11px;
  }
}

.wallet-periods span {
  color: #cbd5e1;
  font-size: 0.66rem;
}

.wallet-periods strong {
  font-size: 0.9rem;
}

.courier-wallet-card .apple-btn {
  margin-bottom: 8px;
}

.table-action-btn.danger {
  color: #be123c;
  background: #fff1f2;
  border-color: #fecdd3;
}

.courier-profile-summary h3 {
  margin: 0;
  color: #0f172a;
  font-size: 1.35rem;
}

.courier-profile-summary > p {
  margin: 4px 0 18px;
  color: #64748b;
}

.courier-profile-summary dl {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0;
}

.courier-profile-summary dl div {
  padding: 12px 8px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid #e2e8f0;
  border-radius: 14px;
}

.courier-profile-summary dt {
  color: #64748b;
  font-size: 0.68rem;
}

.courier-profile-summary dd {
  margin: 4px 0 0;
  color: #0f172a;
  font-weight: 900;
}

@media (max-width: 600px) {
  .restaurant-tracking-map {
    height: 210px;
  }

  .courier-profile-summary dl {
    grid-template-columns: 1fr;
  }
}

/* Role-aware header: one navigation system per workspace */
body[data-view="admin"] .app-header .header-actions,
body[data-view="courier"] .app-header .header-actions {
  display: none !important;
}

body[data-view="admin"] .app-header,
body[data-view="courier"] .app-header {
  justify-content: space-between;
}

body[data-view="courier"] .app-viewport {
  padding-bottom: calc(106px + env(safe-area-inset-bottom));
}

/* Courier app-style bottom navigation */
.courier-bottom-nav {
  position: fixed;
  right: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 2200;
  display: grid;
  grid-template-columns: repeat(5, minmax(52px, 1fr));
  align-items: end;
  width: min(620px, calc(100vw - 28px));
  min-height: 74px;
  padding: 8px 10px 7px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(203, 213, 225, 0.88);
  border-radius: 25px;
  box-shadow: 0 18px 55px rgba(15, 23, 42, 0.2);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  transform: translateX(50%);
}

.restaurant-bottom-nav {
  grid-template-columns: repeat(5, minmax(54px, 1fr));
}

body[data-view="restaurant"] .app-viewport {
  padding-bottom: calc(112px + env(safe-area-inset-bottom));
}

.restaurant-profile-card {
  width: min(620px, 100%);
  margin-inline: auto;
  text-align: center;
}

.restaurant-profile-avatar {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin: 0 auto 12px;
  border-radius: 24px;
  background: #eff6ff;
  font-size: 2rem;
}

.restaurant-profile-avatar {
  overflow: hidden;
}

.restaurant-profile-avatar .courier-profile-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.restaurant-photo-editor {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px;
  background: #f8fafc;
  border-radius: 18px;
}

.restaurant-profile-card dl {
  display: grid;
  gap: 10px;
  margin: 20px 0;
  text-align: right;
}

.restaurant-profile-card dl div {
  padding: 12px 14px;
  background: #f8fafc;
  border-radius: 14px;
}

.restaurant-profile-card dt {
  color: #64748b;
  font-size: .8rem;
}

.restaurant-profile-card dd {
  margin: 4px 0 0;
  font-weight: 800;
}

.password-change-card {
  width: min(620px, 100%);
  margin: 18px auto 0;
  padding: 22px;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  background: #fff;
}

.size-selector {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.size-option {
  min-width: 0;
  cursor: pointer;
}

.size-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.size-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 54px;
  padding: 8px 5px;
  border: 1px solid #dbe3ef;
  border-radius: 14px;
  background: #f8fafc;
  font-size: .84rem;
  font-weight: 800;
  text-align: center;
}

.size-option input:checked + .size-box {
  color: #1d4ed8;
  border-color: #60a5fa;
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, .12);
}

.settings-organized-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.settings-organized-card > .security-card-box,
.settings-organized-card > button {
  grid-column: 1 / -1;
}

.settings-organized-card .security-card-box {
  margin: 0;
}

@media (max-width: 620px) {
  .settings-organized-card {
    grid-template-columns: 1fr;
    padding: 16px;
    gap: 12px;
  }

  .settings-organized-card > * {
    grid-column: 1 !important;
  }

  .size-box {
    min-height: 48px;
    flex-direction: column;
    gap: 2px;
    padding: 6px 2px;
    font-size: .72rem;
  }
}

.courier-bottom-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  min-width: 0;
  min-height: 56px;
  padding: 5px 3px;
  color: #64748b;
  background: transparent;
  border: 0;
  border-radius: 14px;
  font: inherit;
  font-size: 0.68rem;
  font-weight: 800;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.courier-bottom-item .bottom-nav-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.courier-bottom-item.active {
  color: #2563eb;
  background: #eff6ff;
}

.courier-bottom-item:active {
  transform: scale(0.96);
}

.courier-bottom-item.is-available {
  color: #15803d;
}

.courier-bottom-item.logout-item {
  color: #be123c;
}

.courier-bottom-item.map-center-item {
  padding-top: 0;
  color: #1d4ed8;
  background: transparent;
}

.map-center-bubble {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin-top: -30px;
  color: #fff;
  background: linear-gradient(145deg, #3b82f6, #1d4ed8);
  border: 5px solid #fff;
  border-radius: 21px;
  box-shadow: 0 12px 25px rgba(37, 99, 235, 0.38);
  font-size: 1.55rem;
}

@media (max-width: 700px) {
  body[data-view="courier"] .app-header {
    height: 58px;
  }

  body[data-view="courier"] .logo-text {
    font-size: 1rem;
  }

  body[data-view="courier"] .brand-logo-image {
    width: 40px;
    height: 40px;
  }

  body[data-view="courier"] #courierMapPage {
    height: calc(100dvh - 168px);
    min-height: 430px;
  }

  .courier-bottom-nav {
    right: 0;
    bottom: 0;
    width: 100%;
    min-height: 72px;
    padding-bottom: max(7px, env(safe-area-inset-bottom));
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 22px 22px 0 0;
    transform: none;
  }

  .courier-bottom-item {
    min-height: 55px;
    font-size: 0.64rem;
  }

  .map-center-bubble {
    width: 56px;
    height: 56px;
  }
}

/* אייקוני SVG אחידים ונגישים */
.ofy-icon {
  width: 1.15em;
  height: 1.15em;
  display: inline-block;
  flex: 0 0 auto;
  vertical-align: -0.18em;
}

.ofy-inline-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-inline: 0.12em;
  color: currentColor;
}

.network-status-banner {
  position: fixed;
  inset: 0 0 auto;
  z-index: 10050;
  min-height: 44px;
  padding: 9px max(16px, env(safe-area-inset-right)) 9px max(16px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: #fff;
  background: #9a3412;
  font-weight: 700;
  font-size: 0.88rem;
  box-shadow: 0 8px 26px rgba(67, 20, 7, 0.2);
}

body.is-offline .app-header { margin-top: 44px; }

.icon-only {
  width: 44px;
  min-width: 44px;
  padding-inline: 0 !important;
}

.health-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.health-card {
  padding: 18px;
  border: 1px solid var(--border-color);
  border-radius: 18px;
  background: var(--bg-card, #fff);
  box-shadow: var(--shadow-sm);
}

.health-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.health-state {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 0 5px rgba(22, 163, 74, .11);
}

.health-state.warn {
  background: #d97706;
  box-shadow: 0 0 0 5px rgba(217, 119, 6, .11);
}

.health-card small { color: var(--text-sub); }

/* מצב כהה נשמר במכשיר ומכבד גם את העדפת מערכת ההפעלה. */
:root[data-theme="dark"] {
  --bg-main: #0b1220;
  --bg-secondary: #151f30;
  --bg-card: #101a29;
  --text-main: #f1f5f9;
  --text-sub: #a9b6c8;
  --border-color: #273449;
  --border-color-strong: #3a4960;
}

:root[data-theme="dark"] body,
:root[data-theme="dark"] .view-section,
:root[data-theme="dark"] .content-body {
  background: var(--bg-main);
  color: var(--text-main);
}

:root[data-theme="dark"] .app-header,
:root[data-theme="dark"] .sidebar,
:root[data-theme="dark"] .apple-glass-card,
:root[data-theme="dark"] .admin-panel,
:root[data-theme="dark"] .modal-card,
:root[data-theme="dark"] .mobile-drawer,
:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea {
  background: var(--bg-card) !important;
  color: var(--text-main);
  border-color: var(--border-color);
}

:root[data-theme="dark"] .apple-table tr,
:root[data-theme="dark"] .admin-stat-card {
  background: #111c2c;
  color: var(--text-main);
}

@media (max-width: 760px) {
  .health-grid { grid-template-columns: 1fr; }

  /* טבלאות ניהול הופכות לכרטיסים קריאים בנייד במקום גלילה אופקית. */
  #adminView .apple-glass-card:has(.apple-table) {
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  #adminView .apple-table,
  #adminView .apple-table tbody,
  #adminView .apple-table tr,
  #adminView .apple-table td {
    display: block;
    width: 100%;
  }

  #adminView .apple-table thead { display: none; }

  #adminView .apple-table tr {
    margin-bottom: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    box-shadow: var(--shadow-sm);
  }

  #adminView .apple-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 9px 0;
    border-bottom: 1px solid var(--border-color);
    text-align: start;
  }

  #adminView .apple-table td:last-child { border-bottom: 0; }
  #adminView .apple-table td::before {
    content: attr(data-label);
    color: var(--text-sub);
    font-size: .78rem;
    font-weight: 700;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}

/* בורר תצוגה תלת-מצבי בהגדרות */
.theme-mode-control {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  padding: 5px;
  margin-top: 14px;
  border-radius: 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

.theme-mode-control button {
  min-height: 42px;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-sub);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.theme-mode-control button.active {
  background: var(--bg-card);
  color: var(--accent-blue);
  box-shadow: 0 2px 10px rgba(15, 23, 42, .1);
}

/* שכבת Dark מלאה. נמצאת בסוף הקובץ כדי לגבור גם על רכיבים ותיקים עם צבע קבוע. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg-main: #08111f;
  --bg-card: #111c2c;
  --bg-secondary: #182538;
  --border-color: #2a3a50;
  --border-color-strong: #40536d;
  --text-main: #f8fafc;
  --text-sub: #c0cbda;
  --text-muted: #91a1b7;
  --accent-blue: #60a5fa;
  --accent-blue-hover: #3b82f6;
  --accent-blue-glow: rgba(96, 165, 250, .22);
  --accent-green: #34d399;
  --accent-green-hover: #10b981;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .3);
  --shadow-md: 0 8px 22px rgba(0, 0, 0, .28);
  --shadow-lg: 0 18px 42px rgba(0, 0, 0, .36);
}

:root[data-theme="dark"] body {
  background-image:
    radial-gradient(circle at 10% 0%, rgba(59, 130, 246, .14), transparent 30rem),
    radial-gradient(circle at 90% 25%, rgba(16, 185, 129, .09), transparent 26rem);
}

:root[data-theme="dark"] .app-header {
  background: rgba(8, 17, 31, .88) !important;
}

:root[data-theme="dark"] .logo-text,
:root[data-theme="dark"] .logo-text b,
:root[data-theme="dark"] h1,
:root[data-theme="dark"] h2,
:root[data-theme="dark"] h3,
:root[data-theme="dark"] h4,
:root[data-theme="dark"] h5,
:root[data-theme="dark"] label,
:root[data-theme="dark"] dt,
:root[data-theme="dark"] dd,
:root[data-theme="dark"] strong,
:root[data-theme="dark"] .status-label,
:root[data-theme="dark"] .live-order-main strong,
:root[data-theme="dark"] .admin-panel-heading h3,
:root[data-theme="dark"] .courier-page-heading h2,
:root[data-theme="dark"] .stat-val {
  color: var(--text-main);
}

:root[data-theme="dark"] p,
:root[data-theme="dark"] small,
:root[data-theme="dark"] .sub-text,
:root[data-theme="dark"] .field-tip,
:root[data-theme="dark"] .stat-lbl,
:root[data-theme="dark"] .panel-eyebrow,
:root[data-theme="dark"] .admin-kicker,
:root[data-theme="dark"] .live-order-main span,
:root[data-theme="dark"] .courier-snapshot-row span,
:root[data-theme="dark"] .bar-label {
  color: var(--text-sub);
}

:root[data-theme="dark"] .landing-card,
:root[data-theme="dark"] .auth-card,
:root[data-theme="dark"] .apple-glass-card,
:root[data-theme="dark"] .delivery-card,
:root[data-theme="dark"] .active-delivery-card,
:root[data-theme="dark"] .history-filter-bar,
:root[data-theme="dark"] .settings-organized-card,
:root[data-theme="dark"] .security-card-box,
:root[data-theme="dark"] .device-settings-card,
:root[data-theme="dark"] .password-change-card,
:root[data-theme="dark"] .restaurant-profile-card,
:root[data-theme="dark"] .courier-profile-card,
:root[data-theme="dark"] .courier-wallet-card,
:root[data-theme="dark"] .profile-summary-card,
:root[data-theme="dark"] .admin-stat-card,
:root[data-theme="dark"] .admin-panel,
:root[data-theme="dark"] .health-card,
:root[data-theme="dark"] .live-order-row,
:root[data-theme="dark"] .courier-snapshot-row,
:root[data-theme="dark"] .performance-item,
:root[data-theme="dark"] .current-card-badge,
:root[data-theme="dark"] .claimed-details,
:root[data-theme="dark"] .modal-card,
:root[data-theme="dark"] .mobile-drawer,
:root[data-theme="dark"] .sidebar {
  background: var(--bg-card) !important;
  color: var(--text-main);
  border-color: var(--border-color) !important;
}

:root[data-theme="dark"] .content-body,
:root[data-theme="dark"] .panel-page,
:root[data-theme="dark"] .dash-page,
:root[data-theme="dark"] .courier-detail-page,
:root[data-theme="dark"] .admin-page,
:root[data-theme="dark"] .map-overlay-card,
:root[data-theme="dark"] .admin-empty-mini,
:root[data-theme="dark"] .daily-bar-track,
:root[data-theme="dark"] .availability-container,
:root[data-theme="dark"] .map-title-pill,
:root[data-theme="dark"] .preset-data-pill {
  background-color: var(--bg-main) !important;
  color: var(--text-main);
  border-color: var(--border-color) !important;
}

:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] option {
  background: #0b1626 !important;
  color: var(--text-main) !important;
  border-color: var(--border-color-strong) !important;
}

:root[data-theme="dark"] input::placeholder,
:root[data-theme="dark"] textarea::placeholder {
  color: #8393a8;
  opacity: 1;
}

:root[data-theme="dark"] .apple-table,
:root[data-theme="dark"] .apple-table th,
:root[data-theme="dark"] .apple-table td,
:root[data-theme="dark"] .deliveries-table,
:root[data-theme="dark"] .deliveries-table th,
:root[data-theme="dark"] .deliveries-table td {
  color: var(--text-main);
  border-color: var(--border-color);
}

:root[data-theme="dark"] .apple-table th,
:root[data-theme="dark"] .deliveries-table th {
  background: #162236;
  color: #d8e2ef;
}

:root[data-theme="dark"] .apple-table tr:hover,
:root[data-theme="dark"] .deliveries-table tr:hover,
:root[data-theme="dark"] .nav-item:hover,
:root[data-theme="dark"] .drawer-nav-item:hover {
  background: #1b2a40;
}

:root[data-theme="dark"] .nav-item,
:root[data-theme="dark"] .drawer-nav-item,
:root[data-theme="dark"] .courier-bottom-item,
:root[data-theme="dark"] .restaurant-bottom-item,
:root[data-theme="dark"] .clean-btn.secondary,
:root[data-theme="dark"] .apple-btn.secondary,
:root[data-theme="dark"] .apple-btn.outline,
:root[data-theme="dark"] .table-action-btn {
  color: #dce7f5;
  background: var(--bg-secondary);
  border-color: var(--border-color-strong);
}

:root[data-theme="dark"] .nav-item.active,
:root[data-theme="dark"] .drawer-nav-item.active,
:root[data-theme="dark"] .courier-bottom-item.active,
:root[data-theme="dark"] .restaurant-bottom-item.active {
  color: #93c5fd;
  background: rgba(59, 130, 246, .16);
}

:root[data-theme="dark"] .bottom-navigation,
:root[data-theme="dark"] .courier-bottom-nav,
:root[data-theme="dark"] .restaurant-bottom-nav {
  background: rgba(13, 24, 39, .94) !important;
  border-color: var(--border-color);
}

:root[data-theme="dark"] .status-badge.pending {
  color: #fde68a;
  background: rgba(217, 119, 6, .18);
  border-color: rgba(245, 158, 11, .38);
}

:root[data-theme="dark"] .status-badge.delivered,
:root[data-theme="dark"] .courier-live-status.available {
  color: #86efac;
  background: rgba(22, 163, 74, .16);
  border-color: rgba(34, 197, 94, .35);
}

:root[data-theme="dark"] .status-badge.claimed {
  color: #93c5fd;
  background: rgba(37, 99, 235, .18);
  border-color: rgba(96, 165, 250, .4);
}

:root[data-theme="dark"] .courier-live-status.offline {
  color: #cbd5e1;
  background: #1d293b;
  border-color: #475569;
}

:root[data-theme="dark"] .courier-live-status.blocked,
:root[data-theme="dark"] .text-danger-btn,
:root[data-theme="dark"] .danger-item {
  color: #fca5a5 !important;
}

:root[data-theme="dark"] .theme-mode-control {
  background: #0b1626;
}

:root[data-theme="dark"] .theme-mode-control button {
  color: #b8c5d6;
}

:root[data-theme="dark"] .theme-mode-control button.active {
  color: #bfdbfe;
  background: #24344b;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .35);
}

:root[data-theme="dark"] .settings-subnav {
  background: #111c2c !important;
  border-color: #40536d !important;
}

:root[data-theme="dark"] .settings-subnav button {
  color: #dce7f5 !important;
}

:root[data-theme="dark"] .settings-subnav button:hover {
  color: #fff !important;
  background: #1d2c42 !important;
}

:root[data-theme="dark"] .settings-subnav button.active {
  color: #fff !important;
  background: #2563eb !important;
  box-shadow: 0 5px 15px rgba(37, 99, 235, .3);
}

:root[data-theme="dark"] .language-mode-control {
  background: #0b1626;
  border-color: #40536d;
}

:root[data-theme="dark"] .language-mode-control button {
  color: #d6e0ed;
}

:root[data-theme="dark"] .language-mode-control button.active {
  color: #fff;
  background: #2563eb;
}

/* מסך הכניסה מקבל שכבת ניגודיות עצמאית, במיוחד בלשונית השליח. */
:root[data-theme="dark"] .master-auth-card {
  background: #101b2b !important;
  border-color: #3a4b63 !important;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .48);
}

:root[data-theme="dark"] .role-segmented-control {
  background: #081321;
  border-color: #40536d;
}

:root[data-theme="dark"] .segment-btn {
  color: #b9c8da;
}

:root[data-theme="dark"] .segment-btn:hover {
  color: #fff;
  background: rgba(96, 165, 250, .1);
  border-radius: 10px;
}

:root[data-theme="dark"] .segment-btn.active {
  color: #fff;
  background: #263852;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
}

:root[data-theme="dark"] .master-auth-card .form-group label,
:root[data-theme="dark"] .master-auth-card .auth-footer-link {
  color: #dce7f5 !important;
}

:root[data-theme="dark"] .master-auth-card input,
:root[data-theme="dark"] .master-auth-card select {
  color: #f8fafc !important;
  background: #07111f !important;
  border-color: #486079 !important;
}

:root[data-theme="dark"] .master-auth-card input::placeholder {
  color: #91a4bc !important;
}

:root[data-theme="dark"] .master-auth-card .link-action-btn {
  color: #8ec5ff;
}

:root[data-theme="dark"] .master-auth-card .apple-btn.primary-alt {
  color: #fff;
  background: #0f766e;
  border: 1px solid #2dd4bf;
  box-shadow: 0 9px 24px rgba(13, 148, 136, .24);
}

:root[data-theme="dark"] .master-auth-card .apple-btn.primary-alt:hover {
  background: #0d9488;
}

html[dir="ltr"] body {
  direction: ltr;
}

html[dir="ltr"] input,
html[dir="ltr"] textarea,
html[dir="ltr"] select {
  text-align: left;
}

@media (max-width: 560px) {
  .language-mode-control { grid-template-columns: repeat(2, 1fr); }
}

:root[data-theme="dark"] .leaflet-popup-content-wrapper,
:root[data-theme="dark"] .leaflet-popup-tip {
  background: #111c2c;
  color: #f8fafc;
}

@media (max-width: 560px) {
  .theme-mode-control { grid-template-columns: 1fr; }
}

/* Command-center overview inspired by modern logistics dashboards */
.admin-overview-heading {
  align-items: flex-end;
}

.admin-kicker,
.panel-eyebrow {
  display: block;
  margin-bottom: 4px;
  color: #2563eb;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin-live-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 13px;
  color: #166534;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.admin-metrics-row {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
}

#adminView .admin-metrics-row .admin-stat-card {
  position: relative;
  min-height: 132px;
  padding: 18px;
  overflow: hidden;
}

#adminView .admin-metrics-row .admin-stat-card::after {
  position: absolute;
  inset: auto -22px -34px auto;
  width: 95px;
  height: 95px;
  content: "";
  background: currentColor;
  border-radius: 50%;
  opacity: 0.045;
}

.admin-metrics-row .stat-icon {
  display: inline-flex;
  flex: 0 0 48px;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0 !important;
  font-size: 1.55rem !important;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  line-height: 1;
  text-align: center;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 50% !important;
}

.admin-metrics-row small {
  display: block;
  margin-top: 3px;
  color: #64748b;
  font-size: 0.72rem;
}

.admin-metrics-row small b {
  color: #16a34a;
}

.metric-blue { color: #2563eb; }
.metric-green { color: #16a34a; }
.metric-indigo { color: #4f46e5; }
.metric-orange { color: #ea580c; }
.metric-purple { color: #9333ea; }
.metric-blue .stat-icon { background: #eff6ff !important; }
.metric-green .stat-icon { background: #f0fdf4 !important; }
.metric-indigo .stat-icon { background: #eef2ff !important; }
.metric-orange .stat-icon { background: #fff7ed !important; }
.metric-purple .stat-icon { background: #faf5ff !important; }

.admin-command-grid {
  display: grid;
  grid-template-columns: minmax(250px, 0.78fr) minmax(420px, 1.8fr) minmax(230px, 0.72fr);
  grid-template-areas: "orders map performance";
  gap: 14px;
  margin-bottom: 14px;
}

.admin-orders-panel { grid-area: orders; }
.admin-map-panel { grid-area: map; }
.admin-performance-panel { grid-area: performance; }

.admin-panel {
  min-width: 0;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #e5eaf1;
  border-radius: 20px;
  box-shadow: 0 10px 32px rgba(15, 23, 42, 0.055);
  overflow: hidden;
}

.admin-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 17px 18px 14px;
  border-bottom: 1px solid #edf0f4;
}

.admin-panel-heading h3 {
  color: #111827;
  font-size: 1rem;
  font-weight: 900;
}

.panel-link-btn {
  padding: 7px;
  color: #2563eb;
  background: transparent;
  border: 0;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.admin-live-list {
  max-height: 390px;
  overflow-y: auto;
}

.live-order-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 13px 15px;
  border-bottom: 1px solid #eef1f5;
}

.live-order-row:last-child {
  border-bottom: 0;
}

.order-symbol {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 11px;
}

.live-order-main {
  min-width: 0;
}

.live-order-main strong,
.live-order-main span {
  display: block;
}

.live-order-main strong {
  font-size: 0.83rem;
}

.live-order-main span {
  overflow: hidden;
  color: #64748b;
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-order-row time {
  grid-column: 2;
  color: #94a3b8;
  font-size: 0.68rem;
}

.live-order-status,
.courier-live-status {
  padding: 4px 8px;
  border: 1px solid;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  white-space: nowrap;
}

.live-order-status.waiting {
  color: #b45309;
  background: #fffbeb;
  border-color: #fde68a;
}

.live-order-status.moving {
  color: #1d4ed8;
  background: #eff6ff;
  border-color: #bfdbfe;
}

.map-heading {
  min-height: 68px;
}

.map-legend-inline {
  display: flex;
  gap: 10px;
  color: #64748b;
  font-size: 0.7rem;
}

.map-legend-inline span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.legend-dot.courier { background: #16a34a; }
.legend-dot.delivery { background: #2563eb; }

.admin-activity-map {
  width: 100%;
  height: 390px;
  background: #eef3f8;
}

.map-loading-state {
  display: grid;
  place-items: center;
  height: 100%;
  color: #64748b;
  font-weight: 700;
}

.admin-map-pin {
  display: grid !important;
  place-items: center;
  background: transparent;
}

.admin-map-pin span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  background: #fff;
  border: 3px solid;
  border-radius: 13px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.22);
}

.courier-pin span { border-color: #22c55e; }
.delivery-pin span { border-color: #3b82f6; }

.performance-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.performance-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: #fbfcfe;
  border: 1px solid #e8edf3;
  border-radius: 15px;
}

.performance-icon {
  display: inline-flex;
  flex: 0 0 38px;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  font-size: 1.15rem;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.performance-icon.blue { color: #2563eb; background: #eff6ff; }
.performance-icon.green { color: #16a34a; background: #f0fdf4; }
.performance-icon.orange { color: #ea580c; background: #fff7ed; }
.performance-item div { min-width: 0; }
.performance-item span,
.performance-item strong { display: block; }
.performance-item > .performance-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.performance-item div span { color: #64748b; font-size: 0.72rem; }
.performance-item strong { margin-top: 2px; font-size: 1.08rem; }

.admin-insights-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(420px, 1.6fr);
  gap: 14px;
}

.daily-bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  gap: 9px;
  height: 250px;
  padding: 22px 18px 16px;
}

.daily-bar-column {
  display: grid;
  grid-template-rows: 20px 1fr 24px;
  align-items: end;
  justify-items: center;
  width: 100%;
  height: 100%;
}

.daily-bar-track {
  position: relative;
  width: min(34px, 72%);
  height: 100%;
  overflow: hidden;
  background: #f1f5f9;
  border-radius: 9px 9px 4px 4px;
}

.daily-bar-track i {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: block;
  min-height: 5px;
  background: linear-gradient(180deg, #60a5fa, #2563eb);
  border-radius: inherit;
}

.bar-value {
  color: #475569;
  font-size: 0.7rem;
  font-weight: 800;
}

.bar-label {
  color: #64748b;
  font-size: 0.72rem;
}

.courier-snapshot-list {
  display: grid;
}

.courier-snapshot-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  padding: 13px 18px;
  border-bottom: 1px solid #edf0f4;
}

.courier-snapshot-row:last-child { border-bottom: 0; }
.courier-avatar-mini {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: #1d4ed8;
  background: #dbeafe;
  border-radius: 50%;
  font-weight: 900;
}
.courier-snapshot-row div { min-width: 0; }
.courier-snapshot-row strong,
.courier-snapshot-row div span { display: block; }
.courier-snapshot-row strong { font-size: 0.84rem; }
.courier-snapshot-row div span { color: #64748b; font-size: 0.72rem; }
.courier-live-status.available { color: #15803d; background: #f0fdf4; border-color: #bbf7d0; }
.courier-live-status.offline { color: #475569; background: #f8fafc; border-color: #cbd5e1; }
.courier-live-status.blocked { color: #b91c1c; background: #fef2f2; border-color: #fecaca; }

.admin-empty-mini {
  display: grid;
  place-items: center;
  min-height: 180px;
  padding: 24px;
  color: #64748b;
  text-align: center;
}
.admin-empty-mini span { margin-bottom: 8px; font-size: 2rem; }
.admin-empty-mini strong,
.admin-empty-mini small { display: block; }

@media (max-width: 1250px) {
  .admin-metrics-row {
    grid-template-columns: repeat(3, minmax(170px, 1fr));
  }

  .admin-command-grid {
    grid-template-columns: minmax(280px, 0.8fr) minmax(420px, 1.4fr);
    grid-template-areas:
      "orders map"
      "performance map";
  }
}

@media (max-width: 900px) {
  .admin-metrics-row {
    display: flex;
    margin-inline: -12px;
    padding: 0 12px 8px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }

  .admin-metrics-row::-webkit-scrollbar { display: none; }

  #adminView .admin-metrics-row .admin-stat-card {
    flex: 0 0 min(230px, 72vw);
    scroll-snap-align: start;
  }

  .admin-command-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "map"
      "orders"
      "performance";
  }

  .admin-insights-grid {
    grid-template-columns: 1fr;
  }

  .admin-activity-map {
    height: 360px;
  }
}

@media (max-width: 640px) {
  .admin-overview-heading {
    align-items: flex-start;
  }

  .admin-live-chip {
    align-self: flex-start;
  }

  #adminView .admin-metrics-row .admin-stat-card {
    flex: 0 0 205px;
    min-height: 118px;
  }

  .admin-panel {
    border-radius: 17px;
  }

  .admin-panel-heading {
    padding: 14px;
  }

  .map-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-activity-map {
    height: 310px;
  }

  .live-order-row {
    padding-inline: 12px;
  }

  .daily-bars {
    height: 220px;
    padding-inline: 10px;
  }
}

/* MODALS & OVERLAYS */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.hidden { display: none; }

.modal-card {
  width: 100%;
  max-width: 480px;
  animation: popIn 0.3s var(--ease-apple);
}

.admin-account-modal {
  width: min(620px, calc(100vw - 28px));
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
}

.admin-modal-heading,
.admin-modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-modal-heading {
  margin-bottom: 20px;
}

.admin-modal-heading h3 {
  margin: 4px 0 0;
}

.admin-modal-actions {
  justify-content: flex-start;
  margin-top: 20px;
}

.admin-form-note {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: #eff6ff;
  color: #31527c;
  font-size: .9rem;
  line-height: 1.55;
}

.device-settings-card {
  margin-block: 16px;
}

.device-settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

@media (max-width: 520px) {
  .device-settings-actions .apple-btn {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .admin-modal-actions {
    flex-direction: column-reverse;
  }

  .admin-modal-actions .apple-btn {
    width: 100%;
  }
}

@keyframes popIn {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.broadcast-alert {
  background: #ffffff;
  border: 2px solid var(--accent-blue);
  border-radius: var(--radius-lg);
  padding: 28px;
  text-align: center;
}

.delivery-alert-top-sheet {
  align-items: flex-start;
  padding-top: max(18px, env(safe-area-inset-top));
  background: rgba(15, 23, 42, 0.24);
}

.delivery-alert-top-sheet .broadcast-alert {
  width: min(760px, calc(100vw - 24px));
  max-width: 760px;
  max-height: calc(100dvh - 36px);
  padding: 20px;
  overflow-y: auto;
  border: 1px solid rgba(147, 197, 253, 0.9);
  border-radius: 22px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.3);
  animation: deliveryDropIn 380ms cubic-bezier(0.16, 1, 0.3, 1);
}

.delivery-alert-top-sheet .alert-hero-pay {
  margin: 8px 0 14px;
}

.delivery-alert-top-sheet .alert-info-cards {
  margin-bottom: 14px;
}

.delivery-alert-top-sheet .info-card small {
  display: block;
  margin-top: 3px;
  color: #64748b;
  font-size: 0.72rem;
}

@keyframes deliveryDropIn {
  from {
    opacity: 0;
    transform: translateY(-45px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (min-width: 700px) {
  .delivery-alert-top-sheet .broadcast-alert {
    display: grid;
    grid-template-columns: 0.72fr 1fr;
    gap: 10px 18px;
    text-align: right;
  }

  .delivery-alert-top-sheet .alert-header,
  .delivery-alert-top-sheet .alert-actions,
  .delivery-alert-top-sheet .alert-footer-notes {
    grid-column: 1 / -1;
  }

  .delivery-alert-top-sheet .alert-hero-pay {
    align-self: center;
    text-align: center;
  }

  .delivery-alert-top-sheet .alert-info-cards {
    align-self: center;
  }

  .delivery-alert-top-sheet .alert-route-details {
    grid-column: 1 / -1;
    margin-bottom: 4px;
  }

  .delivery-alert-top-sheet .alert-actions {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
  }
}

@media (max-width: 699px) {
  .delivery-alert-top-sheet {
    padding-inline: 8px;
  }

  .delivery-alert-top-sheet .broadcast-alert {
    width: 100%;
    padding: 16px;
    border-radius: 18px;
  }

  .delivery-alert-top-sheet .alert-hero-pay span:nth-child(2) {
    font-size: 3rem;
  }

  .delivery-alert-top-sheet .alert-route-details {
    margin-bottom: 12px;
  }
}

.alert-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.alert-badge {
  background: rgba(239, 68, 68, 0.15);
  color: #dc2626;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
}

.alert-hero-pay {
  margin: 16px 0;
  color: #0f172a;
}

.alert-hero-pay .currency { font-size: 2rem; font-weight: 800; }
.alert-hero-pay span:nth-child(2) { font-size: 3.8rem; font-weight: 900; line-height: 1; }

.alert-info-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.info-card {
  background: #f8fafc;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.alert-route-details {
  background: #f8fafc;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
  text-align: right;
}

.route-point { display: flex; align-items: center; gap: 12px; }
.route-line { height: 20px; width: 2px; background: var(--border-color); margin: 6px 14px; }

/* ניגודיות מלאה לחלון המשלוח ולהגדרות הניהול במצב כהה. */
:root[data-theme="dark"] .delivery-alert-top-sheet {
  background: rgba(2, 6, 23, 0.72);
}

:root[data-theme="dark"] .delivery-alert-top-sheet .broadcast-alert {
  background: #101b2b !important;
  color: #f8fafc !important;
  border-color: #60a5fa !important;
}

:root[data-theme="dark"] .delivery-alert-top-sheet .alert-hero-pay,
:root[data-theme="dark"] .delivery-alert-top-sheet .alert-hero-pay span,
:root[data-theme="dark"] .delivery-alert-top-sheet .info-card strong,
:root[data-theme="dark"] .delivery-alert-top-sheet .route-point strong,
:root[data-theme="dark"] .delivery-alert-top-sheet .route-point p,
:root[data-theme="dark"] .delivery-alert-top-sheet .time-now,
:root[data-theme="dark"] .delivery-alert-top-sheet .lbl {
  color: #f8fafc !important;
}

:root[data-theme="dark"] .delivery-alert-top-sheet .info-card,
:root[data-theme="dark"] .delivery-alert-top-sheet .alert-route-details {
  background: #17243a !important;
  color: #f8fafc !important;
  border-color: #3c506c !important;
}

:root[data-theme="dark"] .delivery-alert-top-sheet .info-card small {
  color: #bfdbfe !important;
}

:root[data-theme="dark"] .delivery-alert-top-sheet .route-line {
  background: #526985;
}

:root[data-theme="dark"] .admin-settings-card,
:root[data-theme="dark"] .admin-settings-pane {
  color: #f8fafc !important;
}

:root[data-theme="dark"] .admin-settings-pane .settings-pane-heading,
:root[data-theme="dark"] .admin-settings-pane .form-group,
:root[data-theme="dark"] .admin-settings-pane label,
:root[data-theme="dark"] .admin-settings-pane span,
:root[data-theme="dark"] .admin-settings-pane strong {
  color: #f8fafc !important;
}

:root[data-theme="dark"] .admin-settings-pane .settings-pane-heading p,
:root[data-theme="dark"] .admin-settings-pane .field-tip {
  color: #c5d2e3 !important;
}

:root[data-theme="dark"] .admin-settings-pane .settings-readonly-row {
  background: #17243a !important;
  color: #f8fafc !important;
  border-color: #40536d !important;
}

:root[data-theme="dark"] .admin-settings-pane input,
:root[data-theme="dark"] .admin-settings-pane textarea {
  background: #07111f !important;
  color: #f8fafc !important;
  border-color: #486079 !important;
}

/* TOAST NOTIFICATIONS */
.toast-container {
  position: fixed;
  bottom: 24px; left: 24px;
  z-index: 4000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: #0f172a;
  color: #ffffff;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideToast 0.3s ease;
}

@keyframes slideToast {
  from { transform: translateX(-40px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* COURIER DASHBOARD LAYOUT & MAP */
.courier-layout { display: flex; flex-direction: column; min-height: calc(100vh - 55px); }

.courier-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: #ffffff;
  border-bottom: 1.5px solid var(--border-color);
  gap: 20px;
  flex-wrap: wrap;
}

.courier-user-profile { display: flex; align-items: center; gap: 12px; }
.courier-avatar { font-size: 2.2rem; background: #f1f5f9; padding: 8px; border-radius: var(--radius-md); }

.availability-container {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f8fafc;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border-color);
}

.status-label { font-size: 0.88rem; color: #0f172a; font-weight: 700; }
.apple-switch { position: relative; display: inline-block; width: 48px; height: 26px; }
.apple-switch input { display: none; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #cbd5e1; transition: 0.3s var(--ease-apple); }
.slider::before { position: absolute; content: ""; height: 20px; width: 20px; left: 3px; bottom: 3px; background-color: white; transition: 0.3s var(--ease-apple); box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
.slider.round { border-radius: 34px; }
.slider.round::before { border-radius: 50%; }
input:checked + .slider { background-color: var(--accent-green); }
input:checked + .slider::before { transform: translateX(22px); }

.badge-status { font-size: 0.85rem; font-weight: 800; padding: 4px 12px; border-radius: var(--radius-full); }
.badge-status.available { background: rgba(16, 185, 129, 0.15); color: #047857; }
.badge-status.unavailable { background: rgba(239, 68, 68, 0.15); color: #dc2626; }

.courier-quick-stats { display: flex; align-items: center; gap: 16px; }
.stat-pill { font-size: 0.88rem; background: #f8fafc; padding: 6px 14px; border-radius: var(--radius-full); border: 1.5px solid var(--border-color); font-weight: 700; }

.courier-content-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  padding: 20px 28px;
  flex: 1;
}

.map-wrapper {
  position: relative;
  height: 580px;
  padding: 0 !important;
  overflow: hidden;
}

.leaflet-map-box { width: 100%; height: 100%; }

.map-overlay-header {
  position: absolute;
  top: 16px; right: 16px; left: 16px;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.map-title-pill {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-map-btn {
  background: #ffffff;
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.map-controls-group {
  display: flex;
  align-items: center;
  gap: 7px;
}

.gps-live-btn {
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.gps-live-btn.is-live {
  color: #15803d;
  background: #f0fdf4;
  border-color: #86efac;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.12);
}

.secondary-map-btn {
  color: #475569;
}

@media (max-width: 600px) {
  .map-overlay-header {
    align-items: flex-start;
  }

  .map-controls-group {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .map-controls-group .icon-map-btn {
    min-height: 38px;
    padding: 7px 10px;
    font-size: 0.72rem;
    box-shadow: 0 5px 16px rgba(15, 23, 42, 0.12);
  }

  .map-title-pill {
    max-width: 52%;
    white-space: normal;
  }
}

.active-claimed-banner {
  position: absolute;
  bottom: 16px; left: 16px; right: 16px;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
  border: 2px solid var(--accent-blue);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.claimed-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.claimed-badge { background: var(--accent-blue); color: white; padding: 4px 12px; border-radius: var(--radius-full); font-size: 0.82rem; font-weight: 800; }
.claimed-timer { font-size: 0.85rem; display: flex; align-items: center; gap: 8px; font-weight: 700; }
.timer-clock { font-size: 1.1rem; font-weight: 900; color: #dc2626; }

.claimed-details { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.detail-node { display: flex; align-items: center; gap: 10px; }
.node-icon { font-size: 1.5rem; background: #f1f5f9; padding: 6px; border-radius: var(--radius-sm); }
.pay-tag { font-size: 1.1rem; font-weight: 900; color: var(--accent-green); }

/* MOBILE RESPONSIVE FIT */
@media (max-width: 900px) {
  .courier-content-grid { grid-template-columns: 1fr; }
  .map-wrapper { height: 380px; }
}
/* Refined landing experience */
.landing-hero-compact {
  padding-top: clamp(24px, 6vh, 72px);
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  padding: 7px 12px;
  color: #1e40af;
  background: rgba(219, 234, 254, 0.72);
  border: 1px solid rgba(147, 197, 253, 0.55);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}

.live-dot {
  width: 7px;
  height: 7px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 0 5px rgba(16, 185, 129, 0.12);
}

.hero-title-compact {
  max-width: 760px;
  margin-inline: auto;
  font-size: clamp(2.3rem, 6vw, 4.8rem);
  line-height: 1.02;
  letter-spacing: -0.055em;
}

.hero-title-compact span {
  color: var(--accent-blue);
}

.hero-subtitle-compact {
  max-width: 620px;
  margin: 20px auto 0;
  color: var(--text-sub);
  font-size: clamp(1rem, 2vw, 1.18rem);
}

.hero-benefits {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 20px;
  margin: 18px auto 30px;
  color: #475569;
  font-size: 0.88rem;
  font-weight: 600;
}

.email-link-notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 16px;
  padding: 14px 16px;
  color: #14532d;
  text-align: right;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 14px;
}

.email-link-notice.hidden {
  display: none;
}

.email-link-notice p {
  margin-top: 3px;
  color: #166534;
  font-size: 0.86rem;
}

.email-link-icon {
  display: grid;
  flex: 0 0 36px;
  place-items: center;
  width: 36px;
  height: 36px;
  background: #dcfce7;
  border-radius: 10px;
}

.password-reset-btn {
  display: block;
  margin: 10px auto 0;
  padding: 4px 8px;
}

.master-auth-card {
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.11);
}

input,
select,
textarea {
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent-blue) !important;
  box-shadow: 0 0 0 4px var(--accent-blue-glow) !important;
}

.apple-btn {
  min-height: 48px;
  letter-spacing: -0.01em;
}

.apple-btn.primary {
  box-shadow: 0 9px 22px rgba(37, 99, 235, 0.2);
}

.toast {
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.14);
}

@media (max-width: 640px) {
  .header-actions .secondary {
    display: none;
  }

  .logo-text {
    font-size: 1.05rem;
  }

  .brand-logo-image {
    width: 42px;
    height: 42px;
  }

  .header-start .menu-toggle-btn > span:last-child {
    display: none;
  }

  .header-start .menu-toggle-btn {
    width: 42px;
    height: 42px;
    padding: 0;
    justify-content: center;
  }

  .landing-hero-compact {
    padding-top: 18px;
  }

  .hero-title-compact {
    font-size: clamp(2.2rem, 12vw, 3.5rem);
  }

  .master-auth-card {
    border-radius: 20px;
  }
}

/* Focused role workspaces */
.role-hidden {
  display: none !important;
}

.restaurant-dashboard {
  display: block;
  max-width: 980px;
  margin-inline: auto;
}

.restaurant-dashboard > .sidebar {
  display: none;
}

.restaurant-dashboard > .content-body {
  width: 100%;
  min-width: 0;
}

.restaurant-dashboard .dash-page {
  display: none;
  animation: workspacePageIn 220ms ease;
}

.restaurant-dashboard .dash-page.active {
  display: block;
}

.restaurant-dashboard #pageCreateDelivery .page-header {
  align-items: flex-end;
}

.restaurant-dashboard #newDeliveryForm {
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.09);
}

.courier-layout {
  max-width: 1180px;
  margin-inline: auto;
}

.courier-top-bar {
  justify-content: center;
  min-height: 76px;
  margin-bottom: 18px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
}

.courier-user-profile,
.courier-secondary-info {
  display: none !important;
}

.availability-container {
  padding: 8px 14px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 999px;
}

.courier-focused-grid {
  display: block;
}

.courier-main-page {
  display: none;
  animation: workspacePageIn 220ms ease;
}

.courier-main-page.active {
  display: block;
}

#courierMapPage {
  height: calc(100vh - 205px);
  min-height: 560px;
  padding: 12px;
  overflow: hidden;
}

.map-unavailable {
  display: grid;
  place-content: center;
  height: 100%;
  min-height: 420px;
  color: var(--text-sub);
  text-align: center;
  background: linear-gradient(145deg, #f8fafc, #eef2ff);
  border-radius: 14px;
}

.map-unavailable span {
  font-size: 3rem;
}

.map-unavailable strong {
  margin-top: 10px;
  color: var(--text-main);
  font-size: 1.1rem;
}

.restaurant-dashboard .content-body {
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}

.restaurant-dashboard .delivery-form {
  border-radius: 22px;
}

.restaurant-dashboard .form-actions {
  position: sticky;
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 5;
  padding-top: 12px;
  background: linear-gradient(to bottom, transparent, #fff 28%);
}

.native-nav-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.nav-chip-btn {
  min-height: 40px;
  padding: 9px 12px;
  border-radius: 10px;
}

@media (min-width: 701px) and (max-width: 1100px) {
  .app-viewport {
    padding-inline: 24px;
  }

  #courierMapPage {
    min-height: 620px;
  }

  .restaurant-dashboard {
    max-width: 880px;
  }
}

#courierDetailsPage {
  width: min(760px, 100%);
  min-height: 560px;
  margin-inline: auto;
}

#courierDetailsPage .panel-tabs {
  justify-content: center;
}

#courierDetailsPage .panel-tab-btn[data-target="courierActiveTab"] {
  display: none;
}

@keyframes workspacePageIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 700px) {
  .restaurant-dashboard .page-header {
    align-items: stretch;
  }

  .restaurant-dashboard .preset-data-pill {
    width: 100%;
  }

  .courier-top-bar {
    min-height: 68px;
    margin-bottom: 12px;
  }

  #courierMapPage {
    height: calc(100dvh - 175px);
    min-height: 480px;
    padding: 8px;
    border-radius: 16px;
  }

  #courierDetailsPage {
    min-height: 480px;
  }

  .availability-container {
    width: 100%;
    justify-content: center;
  }

  .mobile-drawer {
    width: min(88vw, 360px);
    padding: max(20px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
  }

  .restaurant-dashboard .content-body {
    padding: 0;
  }

  .restaurant-dashboard .page-header h2 {
    font-size: 1.45rem;
  }

  .restaurant-dashboard .delivery-form {
    padding: 18px 14px;
    border-radius: 18px;
  }

  .restaurant-dashboard .form-grid {
    grid-template-columns: 1fr;
  }

  .restaurant-dashboard .form-group,
  .restaurant-dashboard .form-group.span-2 {
    grid-column: 1;
  }

  .size-selector {
    gap: 7px;
  }

  .size-box {
    min-height: 48px;
    padding: 6px 2px;
  }

  .map-overlay-header {
    gap: 8px;
  }

  .map-title-pill {
    max-width: 58%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .active-claimed-banner {
    left: 8px;
    right: 8px;
    bottom: 8px;
    max-height: calc(100% - 74px);
    overflow-y: auto;
  }

  .claimed-details {
    align-items: stretch;
    flex-direction: column;
  }

  .arrow-divider {
    transform: rotate(90deg);
  }
}
