/* Shared component styles (plain CSS so they work with or without a Tailwind build step). */
html { -webkit-tap-highlight-color: transparent; }
body { overflow-x: hidden; }

.btn-primary, .btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 48px; padding: .75rem 1.25rem; border-radius: .75rem;
  font-weight: 600; font-size: 1rem; text-align: center; transition: background-color .15s, transform .05s;
}
.btn-primary { background: #0f172a; color: #fff; }
.btn-primary:hover { background: #1e293b; }
.btn-secondary { background: #fff; color: #0f172a; border: 1px solid #e2e8f0; }
.btn-secondary:hover { background: #f8fafc; border-color: #cbd5e1; }
.btn-primary:active, .btn-secondary:active { transform: scale(.98); }
.btn-secondary:disabled { opacity: .45; pointer-events: none; }

.nav-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 60px; font-size: .75rem; font-weight: 500; color: #64748b;
}
.nav-item.is-active { color: #059669; }

.stat-card { display: flex; flex-direction: column; gap: .25rem; padding: 1rem; border-radius: 1rem; background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / .05); }
.stat-label { font-size: .8125rem; color: #64748b; }
.stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1; }

.badge { display: inline-flex; align-items: center; gap: .375rem; flex-shrink: 0; padding: .25rem .625rem;
  border-radius: 9999px; font-size: .75rem; font-weight: 600; }
.dot { width: .5rem; height: .5rem; border-radius: 9999px; }

.chip { flex-shrink: 0; cursor: pointer; }
.chip-label { display: inline-flex; align-items: center; min-height: 40px; padding: 0 1rem; border-radius: 9999px;
  background: #fff; border: 1px solid #e2e8f0; font-size: .875rem; font-weight: 500; color: #334155; }
.chip input:checked + .chip-label { background: #0f172a; border-color: #0f172a; color: #fff; }
.chip input:focus-visible + .chip-label { outline: 2px solid #10b981; outline-offset: 2px; }

.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { scrollbar-width: none; }

.htmx-request { opacity: .6; transition: opacity .2s; }
.toast { animation: toast-in .2s ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } }

/* Header links (admin, md+) */
.top-link { padding: .5rem .75rem; border-radius: .625rem; color: #cbd5e1; font-weight: 500; }
.top-link:hover { background: rgb(255 255 255 / .08); color: #fff; }
.top-link.is-active { background: rgb(255 255 255 / .12); color: #fff; }

.count-badge { display: inline-grid; place-items: center; min-width: 1.125rem; height: 1.125rem; padding: 0 .25rem;
  border-radius: 9999px; background: #ef4444; color: #fff; font-size: .6875rem; font-weight: 700; line-height: 1; }

/* Status tones (kept in CSS so a future Tailwind build needs no safelist) */
.tone-amber  { background: #fef3c7; color: #92400e; } .tone-amber .dot  { background: #f59e0b; }
.tone-sky    { background: #e0f2fe; color: #075985; } .tone-sky .dot    { background: #0ea5e9; }
.tone-indigo { background: #e0e7ff; color: #3730a3; } .tone-indigo .dot { background: #6366f1; }
.tone-violet { background: #ede9fe; color: #5b21b6; } .tone-violet .dot { background: #8b5cf6; }
.tone-brand  { background: #d1fae5; color: #047857; } .tone-brand .dot  { background: #10b981; }
.tone-slate  { background: #f1f5f9; color: #475569; } .tone-slate .dot  { background: #94a3b8; }
.tone-red    { background: #fee2e2; color: #b91c1c; } .tone-red .dot    { background: #ef4444; }
.dot-pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.card { border-radius: 1rem; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .05); }
.section-title { font-size: .8125rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: #64748b; }
.route-line { position: relative; padding-left: 1.25rem; }
.route-line::before { content: ""; position: absolute; left: .3125rem; top: .6rem; bottom: .6rem; width: 2px;
  background: repeating-linear-gradient(#cbd5e1 0 4px, transparent 4px 7px); }
.route-pin { position: absolute; left: -1.25rem; width: .75rem; height: .75rem; border-radius: 9999px; margin-top: .3rem; }
.route-pin.pickup { background: #10b981; box-shadow: 0 0 0 3px #d1fae5; }
.route-pin.drop { background: #0f172a; border-radius: 2px; }
.chip-label.is-selected { background: #0f172a; border-color: #0f172a; color: #fff; }
.segment { display: flex; align-items: center; justify-content: center; min-height: 44px; border-radius: .625rem;
  font-size: .9375rem; font-weight: 600; color: #475569; }
.segment.is-selected { background: #fff; color: #0f172a; box-shadow: 0 1px 2px rgb(0 0 0 / .08); }
.kv { display: flex; justify-content: space-between; gap: 1rem; padding: .75rem 1rem; }
.kv dt { color: #64748b; flex-shrink: 0; }
.kv dd { text-align: right; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.back-link { display: inline-flex; align-items: center; gap: .25rem; min-height: 44px; margin-bottom: .25rem; font-size: .875rem; color: #64748b; }

/* Sticky primary actions above the driver bottom nav (one-handed reach) */
.action-bar { position: fixed; left: 0; right: 0; bottom: calc(60px + env(safe-area-inset-bottom)); z-index: 25;
  padding: .75rem 0; background: linear-gradient(to top, #f1f5f9 70%, rgb(241 245 249 / 0)); }
.action-bar .btn-primary, .action-bar .btn-secondary { min-height: 56px; font-size: 1.0625rem; }

/* Bottom sheet dialog */
dialog.sheet { margin: auto auto 0; width: 100%; max-width: 640px; border: 0; border-radius: 1.25rem 1.25rem 0 0;
  padding: 1.25rem 1rem calc(1.25rem + env(safe-area-inset-bottom)); }
dialog.sheet::backdrop { background: rgb(15 23 42 / .5); }
@media (min-width: 640px) { dialog.sheet { margin: auto; border-radius: 1.25rem; } }

summary::-webkit-details-marker { display: none; }
button:disabled { opacity: .6; }
.count-badge.hidden { display: none; }

/* Driver GPS sharing bar */
.gps-bar { position: sticky; top: 3.5rem; z-index: 29; color: #fff; background: #475569; }
.gps-bar[data-tone="ok"] { background: #047857; }
.gps-bar[data-tone="warn"] { background: #b45309; }
.gps-bar[data-tone="error"] { background: #b91c1c; }
.gps-bar[data-tone="done"] { background: #334155; }
.gps-dot { width: .625rem; height: .625rem; flex-shrink: 0; border-radius: 9999px; background: #fff; }
.gps-bar[data-tone="ok"] .gps-dot { animation: pulse 1.6s ease-in-out infinite; }
