/* Fonts served from this app (SIL Open Font License, see /fonts/LICENSE-*.txt). */
@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fonts/cormorant-garamond-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("/fonts/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fonts/inter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fonts/inter-latin-700-normal.woff2") format("woff2"); }

/* Eighteen Pies — Driver Dashboard styles (mobile-first, reuses brand tokens) */

:root {
  --cream: #faf6ef;
  --ivory: #fffdf9;
  --white: #ffffff;
  --ink: #262220;
  --soft: #6b625a;
  --wine: #641e29;
  --wine-deep: #4d1620;
  --wine-pale: #f5e8ea;
  --gold: #b3803f;
  --gold-pale: #f3e8d3;
  --border: #ece3d2;
  --border-strong: #ddccae;
  --success: #5c7a4f;
  --success-pale: #e6ede2;
  --error: #a3403a;
  --error-pale: #f7e6e4;
  --radius-sm: 4px;
  --radius-md: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--cream);
  color: var(--ink);
  font-size: 15px;
}

h1, h2, h3 { font-family: "Cormorant Garamond", Georgia, serif; font-weight: 600; margin: 0; color: var(--ink); }
a { color: inherit; }
button { font-family: inherit; cursor: pointer; }

/* ---------- Login screen ---------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 40px 28px;
  box-shadow: 0 12px 40px rgba(38, 34, 32, 0.08);
}
.login-logo {
  text-align: center;
  margin-bottom: 8px;
  font-family: "Times New Roman", serif;
  font-style: italic;
  font-size: 30px;
  color: var(--wine);
}
.login-tagline {
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--soft);
  margin-bottom: 26px;
}
.login-title { text-align: center; font-size: 15px; color: var(--ink); margin-bottom: 22px; font-weight: 600; font-family: inherit; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 6px; color: var(--soft); }
.field input, .field select {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 15px;
  background: var(--ivory);
}
.field input:focus, .field select:focus { outline: 2px solid var(--gold); border-color: transparent; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 13px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.15s;
}
.btn--primary { background: var(--wine); color: var(--white); }
.btn--primary:hover { background: var(--wine-deep); }
.btn--secondary { background: transparent; border-color: var(--border-strong); color: var(--ink); }
.btn--secondary:hover { background: var(--gold-pale); }
.btn--danger { background: var(--error-pale); color: var(--error); border-color: transparent; }
.btn--ghost { background: none; color: var(--soft); padding: 8px 10px; }
.btn--sm { padding: 8px 14px; font-size: 13px; }
.btn--full { width: 100%; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.login-error {
  background: var(--error-pale);
  color: var(--error);
  font-size: 12.5px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  display: none;
}
.login-error.is-visible { display: block; }
.login-hint { margin-top: 18px; text-align: center; font-size: 11.5px; color: var(--soft); }

/* ---------- App shell ---------- */
.app-shell { display: none; min-height: 100vh; flex-direction: column; }
.app-shell.is-visible { display: flex; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--white); border-bottom: 1px solid var(--border);
  padding: 14px 18px;
  display: flex; align-items: center; justify-content: space-between;
}
.topbar-brand { font-family: "Times New Roman", serif; font-style: italic; font-size: 19px; color: var(--wine); }
.topbar-user { font-size: 12px; color: var(--soft); text-align: right; }
.topbar-user strong { display: block; color: var(--ink); font-size: 13px; }

.tabs { display: flex; gap: 6px; padding: 10px 18px 0; background: var(--white); border-bottom: 1px solid var(--border); }
.tab {
  flex: 1; text-align: center; padding: 10px 8px; font-size: 13.5px; font-weight: 600;
  color: var(--soft); border-bottom: 2px solid transparent;
}
.tab.is-active { color: var(--wine); border-bottom-color: var(--wine); }

.main { flex: 1; padding: 16px 16px 40px; }

.summary-row { display: flex; gap: 10px; margin-bottom: 16px; }
.summary-card {
  flex: 1; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 12px 10px; text-align: center;
}
.summary-card .n { font-size: 22px; font-weight: 700; color: var(--wine); }
.summary-card .l { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--soft); margin-top: 2px; }

/* ---------- SPK cards ---------- */
.spk-card {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 16px; margin-bottom: 12px;
}
.spk-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.spk-order-no { font-weight: 700; font-size: 14.5px; }
.spk-customer { font-size: 14px; margin-bottom: 4px; }
.spk-address { font-size: 12.5px; color: var(--soft); margin-bottom: 10px; line-height: 1.4; }
.spk-meta-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.badge { display: inline-flex; align-items: center; padding: 4px 11px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
.badge--preparing { background: #eee6f5; color: #6b4a9c; }
.badge--payment_confirmed { background: var(--success-pale); color: var(--success); }
.badge--shipped { background: #dff0f5; color: #2b7996; }
.badge--delivered { background: var(--success-pale); color: var(--success); }
.badge--delivery_failed { background: var(--error-pale); color: var(--error); }
.badge--cod { background: var(--gold-pale); color: var(--gold); }

.empty-state { text-align: center; color: var(--soft); font-size: 13.5px; padding: 48px 20px; }

/* ---------- Detail view ---------- */
.detail-view { display: none; }
.detail-view.is-active { display: block; }
.detail-back { display: flex; align-items: center; gap: 6px; color: var(--soft); font-size: 13.5px; font-weight: 600; margin-bottom: 14px; }
.detail-panel {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 20px; margin-bottom: 16px;
}
.detail-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.detail-row:last-child { border-bottom: none; }
.detail-row dt { color: var(--soft); flex-shrink: 0; }
.detail-row dd { margin: 0; font-weight: 600; text-align: right; }
.section-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--soft); font-weight: 700; margin: 4px 0 8px; }
.action-link { color: var(--wine); font-weight: 600; }
.cod-banner {
  background: var(--gold-pale); color: var(--gold); border-radius: var(--radius-sm); padding: 10px 12px;
  font-size: 13px; font-weight: 700; margin-bottom: 14px;
}
.status-actions { display: flex; flex-direction: column; gap: 10px; }
.status-actions .btn { padding: 15px; font-size: 14.5px; }

.list-view { display: none; }
.list-view.is-active { display: block; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--white); padding: 12px 22px; border-radius: 999px;
  font-size: 13px; z-index: 200; opacity: 0; pointer-events: none; transition: opacity 0.2s; max-width: 90%; text-align: center;
}
.toast.is-visible { opacity: 1; }

@media (min-width: 640px) {
  .main { max-width: 560px; margin: 0 auto; width: 100%; padding: 24px 20px 40px; }
  .topbar, .tabs { padding-left: max(18px, calc((100% - 560px) / 2)); padding-right: max(18px, calc((100% - 560px) / 2)); }
}
