/* =========================================================================
   TIK Delivery — unified design system (v5 redesign)
   One consistent, mobile-first theme shared by the customer site, the admin
   panel, and the restaurant/driver portals. Every color/spacing/radius value
   routes through the CSS variables below, so the whole app can be retuned
   from one place.
   ========================================================================= */

:root {
  /* Brand */
  --color-primary: #ff4b3e;
  --color-primary-dark: #e13527;
  --color-primary-light: #fff1ef;
  --color-accent: #5925dc;
  --color-accent-dark: #46199c;

  /* Neutrals */
  --color-bg: #f7f7f8;
  --color-card: #ffffff;
  --color-text: #15171c;
  --color-muted: #6b7280;
  --color-border: #e5e7eb;
  --color-border-strong: #d1d5db;

  /* Semantic */
  --color-success-bg: #ecfdf3;
  --color-success-text: #067647;
  --color-error-bg: #fef3f2;
  --color-error-text: #b42318;
  --color-warning-bg: #fffaeb;
  --color-warning-text: #b54708;
  --color-info-bg: #eff4ff;
  --color-info-text: #3538cd;
  --color-transit-bg: #f4f3ff;
  --color-transit-text: #5925dc;

  /* Shape + elevation */
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow: 0 2px 8px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-lg: 0 16px 40px rgba(16, 24, 40, 0.14);
  --shadow-btn: 0 4px 14px rgba(255, 75, 62, 0.28);
  --shadow-btn-hover: 0 10px 24px rgba(255, 75, 62, 0.34);
  --tint-primary: rgba(255, 75, 62, 0.07);
  --tint-accent: rgba(89, 37, 220, 0.07);

  /* Motion */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --fast: 0.15s;
  --normal: 0.25s;

  /* Type */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-heading: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Layout */
  --header-h: 64px;
  --bottom-nav-h: 62px;
}

/* ===== Reset / base ===== */

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: 700; line-height: 1.25; margin: 0 0 8px; letter-spacing: -0.01em; }

p { margin: 0 0 10px; }

a { color: inherit; text-decoration: none; }

img { max-width: 100%; }

button, input, select, textarea { font-family: inherit; }

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 18px;
}

.muted { color: var(--color-muted); }
.small { font-size: 0.85em; }

/* ===== Header (customer-facing) ===== */

.site-header {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  min-height: var(--header-h);
}

.logo {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.02em;
}

.logo-icon { font-size: 1.25rem; }

.header-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cart-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 9px 16px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  transition: border-color var(--fast) var(--ease), color var(--fast) var(--ease), background var(--fast) var(--ease);
}

.cart-link:hover { border-color: var(--color-primary); color: var(--color-primary-dark); background: var(--tint-primary); }

.account-link {
  font-weight: 600;
  font-size: 0.9rem;
  padding: 9px 12px;
  border-radius: 999px;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
  white-space: nowrap;
}

.account-link:hover { background: var(--tint-primary); }

.account-link-primary {
  background: var(--color-primary);
  color: #fff !important;
  padding: 9px 18px;
  box-shadow: var(--shadow-btn);
}

.account-link-primary:hover { background: var(--color-primary-dark); box-shadow: var(--shadow-btn-hover); }

/* On phones, the bottom app-nav (below) owns Cart/Account — keep the top
   header to just the logo + cart badge so it stays out of the way while
   scrolling a menu with one thumb. */
@media (max-width: 760px) {
  .header-nav .account-link:not(.account-link-primary) { display: none; }
}

.cart-badge {
  background: var(--color-accent);
  color: #fff;
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 0.72rem;
  font-weight: 700;
  margin-left: 2px;
}

/* ===== Bottom app nav (customer site, phones only) ===== */
/* This is what makes the site feel like an installed app on a phone: a fixed
   tab bar for the three things people repeatedly jump between while
   ordering. Hidden entirely on desktop, where the top header nav suffices. */

.bottom-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--color-border);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav-inner {
  display: flex;
  height: var(--bottom-nav-h);
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--color-muted);
  position: relative;
  transition: color var(--fast) var(--ease);
}

.bottom-nav-icon { font-size: 1.32rem; line-height: 1; }

.bottom-nav-item.active { color: var(--color-primary); }

.bottom-nav-badge {
  position: absolute;
  top: 2px;
  right: calc(50% - 20px);
  background: var(--color-accent);
  color: #fff;
  border-radius: 999px;
  padding: 0 5px;
  font-size: 0.62rem;
  font-weight: 700;
  min-width: 15px;
  text-align: center;
  line-height: 1.5;
}

@media (max-width: 760px) {
  .bottom-nav { display: block; }
  body.has-bottom-nav { padding-bottom: calc(var(--bottom-nav-h) + 10px); }
}

/* ===== Hero / search ===== */

.hero {
  position: relative;
  padding: 40px 0 30px;
  text-align: center;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -160px;
  left: 50%;
  transform: translateX(-50%);
  width: 680px;
  height: 440px;
  background:
    radial-gradient(circle at 28% 35%, rgba(255, 75, 62, 0.14), transparent 60%),
    radial-gradient(circle at 72% 55%, rgba(89, 37, 220, 0.10), transparent 55%);
  filter: blur(10px);
  z-index: -1;
  pointer-events: none;
}

.hero h1 { font-size: 2.2rem; margin-bottom: 10px; letter-spacing: -0.02em; }
.hero .accent-text { color: var(--color-primary); }
.hero p { color: var(--color-muted); max-width: 560px; margin: 0 auto 22px; font-size: 1rem; }

.search-form {
  display: flex;
  justify-content: center;
  gap: 6px;
  max-width: 480px;
  margin: 0 auto;
  background: var(--color-card);
  padding: 6px;
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-border);
}

.search-form input {
  flex: 1;
  min-width: 0;
  padding: 12px 18px;
  border-radius: 999px;
  border: none;
  background: transparent;
  font-size: 1rem;
  font-family: inherit;
  color: var(--color-text);
}

.search-form input:focus { outline: none; }

.search-form button {
  padding: 12px 24px;
  border-radius: 999px;
  border: none;
  background: var(--color-primary);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease), background var(--fast) var(--ease);
  flex-shrink: 0;
}

.search-form button:hover { background: var(--color-primary-dark); box-shadow: 0 8px 18px rgba(255, 75, 62, 0.3); }

/* ===== Filter chips ===== */

.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 22px 0 6px;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.filter-bar::-webkit-scrollbar { display: none; }

.filter-chip {
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-card);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-muted);
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color var(--fast) var(--ease), color var(--fast) var(--ease), background var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}

.filter-chip:hover { border-color: var(--color-primary); color: var(--color-primary-dark); }

.filter-chip.active {
  background: var(--color-primary);
  border-color: transparent;
  color: #fff;
  box-shadow: var(--shadow-btn);
}

/* ===== Restaurant grid / cards ===== */

.restaurant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 18px;
  margin: 24px 0 48px;
}

@media (max-width: 560px) {
  .restaurant-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
}

.restaurant-card {
  background: var(--color-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--color-border);
  transition: transform var(--normal) var(--ease), box-shadow var(--normal) var(--ease);
}

.restaurant-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

.restaurant-card-image {
  height: 140px;
  background-size: cover;
  background-position: center;
  background-color: #f1f0f5;
}

.restaurant-card-image.placeholder-image {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--color-primary-light), #ffe4e0);
  font-size: 2.4rem;
}

.restaurant-card-body { padding: 14px 16px 16px; }
.restaurant-card-body h3 { margin: 0 0 4px; font-size: 1.02rem; }
.restaurant-card-body .meta {
  font-size: 0.82rem;
  margin-top: 6px;
  color: var(--color-muted);
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.empty-state {
  color: var(--color-muted);
  padding: 40px 16px;
  text-align: center;
  grid-column: 1 / -1;
  font-size: 1rem;
}

/* ===== Restaurant / menu page ===== */

.restaurant-header { padding: 26px 0 10px; }
.restaurant-header h1 { margin-bottom: 4px; font-size: 1.7rem; }
.restaurant-header .meta { font-size: 0.9rem; margin-top: 8px; color: var(--color-muted); }

.restaurant-banner {
  height: 160px;
  border-radius: var(--radius);
  background-size: cover;
  background-position: center;
  background-color: #f1f0f5;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.menu-category { margin: 30px 0; }
.menu-category h2 {
  border-bottom: 2px solid var(--color-border);
  padding-bottom: 10px;
  margin-bottom: 14px;
  font-size: 1.18rem;
  position: relative;
}

.menu-category h2::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 40px;
  height: 2px;
  background: var(--color-primary);
}

.menu-items { display: flex; flex-direction: column; gap: 10px; }

.menu-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  background: var(--color-card);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--color-border);
  transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}

.menu-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.menu-item.unavailable { opacity: 0.55; }
.menu-item.unavailable:hover { transform: none; box-shadow: var(--shadow); }

.menu-item-image {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  background-size: cover;
  background-position: center;
  background-color: var(--color-bg);
  flex-shrink: 0;
}

.menu-item-info { flex: 1; min-width: 0; }
.menu-item-info h4 { margin: 0 0 3px; font-size: 0.98rem; }
.menu-item-info p { margin: 2px 0; }
.menu-item-info .price { font-weight: 700; margin-top: 6px; color: var(--color-primary-dark); font-size: 1rem; }

.add-form { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.qty-input {
  width: 52px;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  text-align: center;
  font-weight: 600;
  font-family: inherit;
}

.add-form button, .unavailable-label {
  padding: 10px 18px;
  border-radius: 999px;
  border: none;
  background: var(--color-primary);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease), background var(--fast) var(--ease);
}

.add-form button:hover { background: var(--color-primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-btn); }
.add-form button:active { transform: translateY(0); }

.unavailable-label {
  background: var(--color-border);
  color: var(--color-muted);
}

.floating-cart-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-primary);
  color: #fff;
  padding: 15px 30px;
  border-radius: 999px;
  font-weight: 700;
  box-shadow: 0 12px 30px rgba(255, 75, 62, 0.38);
  z-index: 55;
  transition: transform var(--fast) var(--ease);
}

.floating-cart-bar:hover { transform: translateX(-50%) translateY(-2px); }

body.has-bottom-nav .floating-cart-bar { bottom: calc(var(--bottom-nav-h) + 14px); }

/* ===== Flash messages ===== */

.flash-success, .flash-error, .warning {
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  margin: 16px 0;
  font-size: 0.94rem;
}

.flash-success { background: var(--color-success-bg); color: var(--color-success-text); }
.flash-error { background: var(--color-error-bg); color: var(--color-error-text); }
.warning { background: var(--color-warning-bg); color: var(--color-warning-text); }

.flash-error ul { margin: 0; padding-left: 20px; }

/* ===== Cart page ===== */

.cart-table { width: 100%; border-collapse: separate; border-spacing: 0 8px; margin: 18px 0; }
.cart-table td { padding: 13px 14px; background: var(--color-card); box-shadow: var(--shadow-xs); border: 1px solid var(--color-border); border-right: none; border-left: none; }
.cart-table td:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); font-weight: 600; border-left: 1px solid var(--color-border); }
.cart-table td:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; border-right: 1px solid var(--color-border); }

.cart-actions { display: flex; gap: 10px; margin-bottom: 24px; flex-wrap: wrap; }

.cart-summary {
  background: var(--color-card);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-border);
  max-width: 440px;
}

/* ===== Buttons (shared everywhere) ===== */

.btn-primary {
  display: inline-block;
  padding: 13px 26px;
  border-radius: 999px;
  border: none;
  background: var(--color-primary);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  box-shadow: var(--shadow-btn);
  transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease), background var(--fast) var(--ease);
  font-size: 0.98rem;
}

.btn-primary:hover {
  background: var(--color-primary-dark);
  box-shadow: var(--shadow-btn-hover);
  transform: translateY(-1px);
}

.btn-primary:active { transform: translateY(0); }

button.secondary, .btn-secondary {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  padding: 12px 22px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  transition: border-color var(--fast) var(--ease), color var(--fast) var(--ease), background var(--fast) var(--ease);
  text-align: center;
  display: inline-block;
  font-size: 0.95rem;
}

button.secondary:hover, .btn-secondary:hover { border-color: var(--color-primary); color: var(--color-primary-dark); background: var(--tint-primary); }

.link-button {
  background: none;
  border: none;
  color: var(--color-primary);
  cursor: pointer;
  padding: 0;
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
}

/* ===== Forms (shared everywhere: checkout, auth, account, admin, restaurant, driver) ===== */

.checkout-form, .form-card, .admin-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--color-card);
  padding: 22px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--color-border);
}

.checkout-form label, .form-card label, .admin-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
  font-size: 0.9rem;
}

.checkout-form input[type="text"],
.checkout-form input[type="tel"],
.checkout-form input[type="email"],
.checkout-form input[type="password"],
.checkout-form input[type="number"],
.checkout-form textarea,
.checkout-form select,
.form-card input[type="text"],
.form-card input[type="email"],
.form-card input[type="tel"],
.form-card input[type="password"],
.form-card input[type="number"],
.form-card textarea,
.form-card select,
.admin-form input[type="text"],
.admin-form input[type="password"],
.admin-form input[type="email"],
.admin-form input[type="tel"],
.admin-form input[type="number"],
.admin-form textarea,
.admin-form select,
body.admin-body input[type="text"],
body.admin-body input[type="password"] {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  font-size: 1rem;
  font-weight: 400;
  font-family: inherit;
  background: #fbfbfc;
  color: var(--color-text);
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
  width: 100%;
}

.checkout-form input:disabled, .form-card input:disabled, .admin-form input:disabled { background: var(--color-bg); color: var(--color-muted); }

.checkout-form input:focus,
.checkout-form textarea:focus,
.checkout-form select:focus,
.form-card input:focus,
.form-card textarea:focus,
.form-card select:focus,
.admin-form input:focus,
.admin-form textarea:focus,
.admin-form select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--tint-primary);
}

.checkout-form fieldset, .form-card fieldset, .admin-form fieldset {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin: 0;
}

.checkout-form legend, .form-card legend, .admin-form legend { font-weight: 700; padding: 0 8px; font-family: var(--font-heading); }

.admin-form input[type="file"] {
  padding: 10px;
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  background: var(--color-bg);
}

label.radio, label.checkbox {
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
  font-weight: 500 !important;
}

label.radio.choice-card {
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease);
  margin-bottom: 8px;
}

label.radio.choice-card:last-child { margin-bottom: 0; }
label.radio.choice-card:has(input:checked) { border-color: var(--color-primary); background: var(--tint-primary); }
label.radio.disabled, label.radio.choice-card.disabled { color: var(--color-muted); cursor: not-allowed; }

.badge {
  background: var(--color-accent);
  color: #fff;
  font-size: 0.7rem;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-left: 6px;
}

.form-row { display: flex; gap: 14px; flex-wrap: wrap; }
.form-row label { flex: 1; min-width: 140px; }

.order-summary {
  background: var(--color-card);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  border: 1px solid var(--color-border);
}

.order-summary h3 { font-family: var(--font-heading); margin-top: 0; }

.summary-line { display: flex; justify-content: space-between; padding: 6px 0; }
.summary-line.total {
  font-weight: 800;
  font-size: 1.05rem;
  border-top: 1px dashed var(--color-border-strong);
  margin-top: 8px;
  padding-top: 12px;
  color: var(--color-primary-dark);
}

.confirmation { max-width: 520px; margin: 32px auto; text-align: center; }
.confirmation-icon { font-size: 2.8rem; margin-bottom: 8px; }
.confirmation h1 { font-size: 1.6rem; }
.confirmation .order-summary { text-align: left; margin: 20px 0; }

/* ===== Footer ===== */

.site-footer {
  border-top: 1px solid var(--color-border);
  margin-top: 60px;
  padding: 26px 0;
  text-align: center;
  color: var(--color-muted);
  font-size: 0.88rem;
  background: var(--color-card);
}

body.has-bottom-nav .site-footer { margin-bottom: var(--bottom-nav-h); }

/* ===== Auth (login/register) ===== */

.auth-box {
  max-width: 420px;
  margin: 48px auto 60px;
  background: var(--color-card);
  padding: 32px 28px 26px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-border);
  text-align: center;
}

.auth-icon { font-size: 2.2rem; margin-bottom: 6px; }
.auth-box h1 { font-size: 1.45rem; margin-bottom: 6px; }
.auth-box > p.muted.small:first-of-type { margin-bottom: 18px; }

.auth-box .form-card {
  box-shadow: none;
  border: none;
  padding: 0;
  margin-top: 12px;
  text-align: left;
}

.auth-box .flash-error { text-align: left; }
.auth-box p.muted.small { margin-top: 16px; }

/* ===== Account page ===== */

.account-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 24px 0 50px;
  align-items: start;
}

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

.account-section {
  background: var(--color-card);
  border-radius: var(--radius);
  padding: 22px 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--color-border);
  margin-bottom: 18px;
}

.account-section h2 {
  margin-top: 0;
  font-size: 1.12rem;
  padding-bottom: 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--color-border);
}

.address-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 0;
  border-bottom: 1px solid var(--color-border);
}

.address-card.is-default { background: transparent; }
.address-card:last-of-type { border-bottom: none; }

.add-address-form { margin-top: 16px; background: transparent; padding: 0; box-shadow: none; border: none; }

.order-history-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 13px 10px;
  border-radius: var(--radius-sm);
  border-bottom: 1px solid var(--color-border);
  transition: background var(--fast) var(--ease);
}

.order-history-row:hover { background: var(--tint-primary); }
.order-history-row:last-child { border-bottom: none; }

.order-history-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

/* ===== Map picker (checkout, account, admin/restaurant forms) ===== */

.map-picker-wrap { margin: 10px 0 4px; }

.map-picker-controls { display: flex; gap: 8px; margin-bottom: 10px; position: relative; flex-wrap: wrap; }

.map-picker-search {
  flex: 1;
  min-width: 140px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  font-family: inherit;
  font-size: 1rem;
}

.map-picker-search:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--tint-primary);
}

.map-picker-locate-btn {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-card);
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
  font-family: inherit;
  transition: border-color var(--fast) var(--ease), color var(--fast) var(--ease);
}

.map-picker-locate-btn:hover { border-color: var(--color-primary); color: var(--color-primary-dark); }

.map-picker-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 30;
  margin-top: 4px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.map-picker-suggestion {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border: none;
  border-bottom: 1px solid var(--color-border);
  background: none;
  cursor: pointer;
  font-size: 0.92rem;
  font-family: inherit;
  color: var(--color-text);
}

.map-picker-suggestion:last-child { border-bottom: none; }
.map-picker-suggestion:hover { background: var(--tint-primary); }

.map-picker-map {
  height: 240px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--color-border);
  margin-bottom: 8px;
}

.map-picker-hint { font-size: 0.82rem; color: var(--color-muted); min-height: 1.2em; }

/* ===== Order status tracker (order-confirmation, account-order) ===== */

@keyframes tracker-fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@keyframes tracker-pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 75, 62, 0.4); }
  70% { box-shadow: 0 0 0 14px rgba(255, 75, 62, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 75, 62, 0); }
}

@keyframes tracker-check-pop {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes tracker-cancelled-in {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: none; }
}

@keyframes live-dot-blink {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1); }
}

.order-tracker {
  position: relative;
  margin: 28px 0 14px;
  padding: 24px 10px 6px;
  background: var(--color-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--color-border);
  animation: tracker-fade-in 0.5s var(--ease) both;
}

.tracker-track {
  position: absolute;
  top: 44px;
  left: 11%;
  right: 11%;
  height: 3px;
  background: var(--color-border);
  border-radius: 3px;
  z-index: 0;
}

.tracker-track-fill {
  height: 100%;
  width: 0%;
  border-radius: 3px;
  background: var(--color-primary);
  transition: width 0.7s var(--ease);
}

.tracker-steps {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
}

.tracker-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.tracker-dot {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-card);
  border: 3px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--color-muted);
  transition: background 0.35s var(--ease), border-color 0.35s var(--ease), color 0.35s var(--ease), transform 0.35s var(--ease);
}

.tracker-step.completed .tracker-dot {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.tracker-step.active .tracker-dot {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: var(--color-card);
  animation: tracker-pulse 1.8s ease-out infinite;
}

.tracker-check { display: none; }
.tracker-step.completed .tracker-check { display: inline-block; animation: tracker-check-pop 0.4s var(--ease); }
.tracker-step.completed .tracker-num { display: none; }

.tracker-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--color-muted);
  text-align: center;
  padding: 0 2px;
  transition: color 0.35s var(--ease);
}

.tracker-step.completed .tracker-label,
.tracker-step.active .tracker-label {
  color: var(--color-text);
}

.tracker-cancelled {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 28px 0 14px;
  padding: 16px 20px;
  background: var(--color-error-bg);
  color: var(--color-error-text);
  border-radius: var(--radius);
  border: 1px solid var(--color-error-text);
  animation: tracker-cancelled-in 0.4s var(--ease) both;
}

.tracker-cancelled-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-error-text);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  font-weight: 700;
}

.tracker-cancelled strong { display: block; margin-bottom: 2px; }
.tracker-cancelled p { margin: 0; }

.tracker-live-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 0 20px;
  font-size: 0.8rem;
  color: var(--color-muted);
  transition: color 0.2s var(--ease);
}

.tracker-live-note.flash { color: var(--color-primary-dark); font-weight: 600; }

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-primary);
  flex-shrink: 0;
  animation: live-dot-blink 1.6s ease-in-out infinite;
}

.tracker-live-note.flash .live-dot { animation: none; background: var(--color-accent); }

.driver-info {
  background: var(--tint-primary);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 0 0 20px;
  font-size: 0.92rem;
}

.driver-info p { margin: 0; }

.eta-info {
  background: var(--color-info-bg);
  color: var(--color-info-text);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 0 0 20px;
  font-size: 0.92rem;
}

.eta-info p { margin: 0; }
.eta-info p + p { margin-top: 6px; }
.eta-info .prep-delay-notice { color: var(--color-warning-text); font-weight: 600; }

@media (max-width: 560px) {
  .tracker-label { font-size: 0.64rem; }
  .tracker-dot { width: 30px; height: 30px; font-size: 0.72rem; }
  .tracker-track { top: 38px; }
}

/* =========================================================================
   Admin panel / restaurant portal / driver portal — same design system as
   above (unified in v5; these used to keep a separate flat theme, now they
   share the same colors, radii, shadows and type as the customer site).
   ========================================================================= */

.admin-body { background: var(--color-bg); }

.login-box {
  max-width: 360px;
  margin: 64px auto;
  background: var(--color-card);
  padding: 30px 28px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-border);
}

.login-box h1 { font-size: 1.35rem; }

.login-box form { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.login-box label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 0.9rem; }

/* --- App shell: sidebar on desktop/tablet, a horizontal top bar on phones
   so the driver/restaurant/admin portals work one-handed. No JS needed —
   it's a pure flex-direction flip at the breakpoint. --- */

.admin-shell { display: flex; min-height: 100vh; }

.admin-sidebar {
  width: 220px;
  background: #181a20;
  color: #fff;
  padding: 22px 16px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.admin-sidebar h2 { font-size: 1.05rem; margin-bottom: 22px; color: #fff; }
.admin-sidebar nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.admin-sidebar nav a {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: #c6c8d0;
  font-weight: 500;
  font-size: 0.94rem;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.admin-sidebar nav a:hover, .admin-sidebar nav a.active { background: rgba(255, 255, 255, 0.08); color: #fff; }

.logout-link {
  display: block;
  margin-top: 30px;
  color: #ffb4a8;
  font-size: 0.84rem;
  font-weight: 600;
}

.admin-content { flex: 1; padding: 28px 32px; max-width: 1000px; width: 100%; }

@media (max-width: 860px) {
  .admin-shell { flex-direction: column; min-height: 0; }

  .admin-sidebar {
    width: 100%;
    padding: 10px 14px;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 14px;
    position: sticky;
    top: 0;
    z-index: 40;
  }

  /* Row 1: portal/driver name on the left, logout on the right. Row 2: the
     full-width nav strip below, so it never has to fight the name/logout
     text for space and rarely needs to scroll on a normal phone width. */
  .admin-sidebar h2 { order: 1; margin-bottom: 0; font-size: 0.96rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60vw; }

  .admin-sidebar nav {
    order: 3;
    flex: 0 0 100%;
    flex-direction: row;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 2px;
    margin: 2px -14px -10px;
    padding: 0 14px 10px;
  }

  .admin-sidebar nav::-webkit-scrollbar { display: none; }

  .admin-sidebar nav a { white-space: nowrap; padding: 8px 12px; font-size: 0.88rem; }

  .logout-link { order: 2; margin-top: 0; margin-left: auto; white-space: nowrap; flex-shrink: 0; }

  .admin-content { padding: 18px 16px 32px; max-width: 100%; }
}

.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.admin-toolbar h1 { font-size: 1.4rem; }

.image-preview {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: -6px 0 4px;
}

.image-preview-img {
  width: 68px;
  height: 68px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  flex-shrink: 0;
}

/* Tables: horizontally scrollable on narrow screens rather than squeezed
   illegibly small, so nothing needed to change per-page. */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 22px;
  border: 1px solid var(--color-border);
}

.admin-table th, .admin-table td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.9rem;
}

.admin-table tr:last-child td { border-bottom: none; }
.admin-table th { background: #fafafb; font-weight: 700; color: var(--color-text); }

@media (max-width: 700px) {
  .admin-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; border-radius: var(--radius-sm); }
}

.actions-cell { display: flex; gap: 12px; align-items: center; }

.inline-form { display: inline-flex; gap: 8px; align-items: center; margin: 0; }
.inline-form button { cursor: pointer; }

.category-form { margin: 14px 0 22px; display: flex; gap: 8px; flex-wrap: wrap; }
.category-form input { padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--color-border); min-width: 220px; font-family: inherit; }
.category-form button {
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--color-primary);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--fast) var(--ease);
}
.category-form button:hover { background: var(--color-primary-dark); }

.admin-category-block {
  background: transparent;
  margin-bottom: 24px;
}

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 14px; margin: 18px 0 30px; }

.stat-card {
  background: var(--color-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--color-border);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-card span:last-child { color: var(--color-muted); font-size: 0.86rem; font-weight: 500; }

.stat-number { font-size: 1.7rem; font-weight: 800; color: var(--color-primary); }

.status-badge {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  background: var(--color-border);
  white-space: nowrap;
  display: inline-block;
}

.status-pending { background: var(--color-warning-bg); color: var(--color-warning-text); }
.status-confirmed, .status-preparing { background: var(--color-info-bg); color: var(--color-info-text); }
.status-on_the_way { background: var(--color-transit-bg); color: var(--color-transit-text); }
.status-completed { background: var(--color-success-bg); color: var(--color-success-text); }
.status-cancelled { background: var(--color-error-bg); color: var(--color-error-text); }

.order-detail {
  background: var(--color-card);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  border: 1px solid var(--color-border);
  max-width: 620px;
}

.order-detail select { padding: 9px 12px; border-radius: var(--radius-sm); border: 1px solid var(--color-border); font-family: inherit; }

.status-button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 8px;
}

.status-btn {
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-card);
  color: var(--color-text);
  font-weight: 600;
  font-size: 0.86rem;
  cursor: pointer;
  transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease), color var(--fast) var(--ease);
}

.status-btn:hover { border-color: var(--color-primary); color: var(--color-primary-dark); }

.status-btn.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  cursor: default;
}

.needs-driver-select { padding: 9px 10px; border-radius: var(--radius-sm); border: 1px solid var(--color-border); font-family: inherit; }

.map-link {
  color: var(--color-primary);
  text-decoration: underline;
  font-weight: 600;
}

.map-link:hover { color: var(--color-primary-dark); }

/* ===== Install prompt banner (customer + driver, PWA) ===== */

.install-banner {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--color-text);
  color: #fff;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin: 14px 0;
  font-size: 0.88rem;
}

.install-banner.visible { display: flex; }

.install-banner button {
  background: #fff;
  color: var(--color-text);
  border: none;
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 0.84rem;
}

.install-banner .dismiss {
  background: none;
  color: rgba(255, 255, 255, 0.7);
  padding: 8px;
  font-weight: 400;
}

/* ===== Driver queue (dashboard "receive orders" redesign) ===== */

.queue-list { display: flex; flex-direction: column; gap: 10px; margin: 4px 0 28px; }

.queue-card {
  background: var(--color-card);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--color-border);
}

.queue-card-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.queue-card-title { font-weight: 700; font-size: 1rem; }
.queue-card-title:hover { color: var(--color-primary); }

.queue-card-address { display: block; margin: 4px 0; }

.queue-card-action { margin-top: 10px; }
.queue-card-action .btn-primary { width: 100%; }

.new-order-banner {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--color-accent);
  color: #fff;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin: 0 0 16px;
  font-weight: 600;
  animation: tracker-fade-in 0.3s var(--ease) both;
}

.new-order-banner.visible { display: flex; }

.new-order-banner button {
  background: #fff;
  color: var(--color-accent);
  border: none;
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}

.driver-daily-summary { margin-top: -6px; }

.driver-notes-callout {
  background: var(--color-warning-bg);
  color: var(--color-warning-text);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin: 4px 0;
  font-weight: 600;
}

/* ===== Restaurant "New orders" quick-accept ===== */

.accept-time-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.accept-time-btn {
  flex: 1 1 auto;
  min-width: 64px;
  padding: 10px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-card);
  color: var(--color-text);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  text-align: center;
}

.accept-time-btn:hover { border-color: var(--color-primary); color: var(--color-primary-dark); }

.accept-time-btn.default {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.accept-time-btn.delay {
  border-color: var(--color-warning-text);
  color: var(--color-warning-text);
}

.accept-time-hint { margin: -2px 0 16px; }

.accept-panel {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 4px 0 16px;
}

.accept-prompt { margin: 0 0 4px; font-weight: 600; }

/* Native (Capacitor/iOS app) offline banner — assets/js/native-bridge.js.
   Hidden by default; only ever shown inside the native shell, since the
   plain website/PWA has no reliable equivalent of the OS-level Network
   plugin this reads from. */
.native-offline-banner {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  z-index: 2000;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  background: var(--color-warning-bg, #fff4e5);
  color: var(--color-warning-text, #8a5a00);
  text-align: center;
  font-size: 14px;
  font-weight: 600;
}

.native-offline-banner.visible {
  display: block;
}

.legal-page {
  max-width: 680px;
  margin: 0 auto;
  padding-bottom: 32px;
}

.legal-page h2 {
  margin-top: 28px;
}
