/* Identidade FF Express Pro: rosa #FF2D7A, azul #1E3A8A, fundo escuro #0F172A, letra Metropolis. */
@font-face { font-family: 'Metropolis'; font-style: normal; font-weight: 400; font-display: swap; src: url('/vendor/metropolis/metropolis-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Metropolis'; font-style: normal; font-weight: 600; font-display: swap; src: url('/vendor/metropolis/metropolis-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Metropolis'; font-style: normal; font-weight: 700; font-display: swap; src: url('/vendor/metropolis/metropolis-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Metropolis'; font-style: normal; font-weight: 800; font-display: swap; src: url('/vendor/metropolis/metropolis-latin-800-normal.woff2') format('woff2'); }
@font-face { font-family: 'Metropolis'; font-style: italic; font-weight: 800; font-display: swap; src: url('/vendor/metropolis/metropolis-latin-800-italic.woff2') format('woff2'); }

:root {
  --brand: #ff2d7a;
  --brand-dark: #e0145f;
  --brand-soft: #ffe3ee;
  --navy: #1e3a8a;
  --night: #0f172a;
  --bg: #f6f6fa;
  --surface: #ffffff;
  --surface-2: #eef0f6;
  --text: #0f172a;
  --muted: #5b6478;
  --border: #e3e6ef;
  --ok: #16a34a;
  --ok-soft: #dcfce7;
  --warn: #c2410c;
  --warn-soft: #ffedd5;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --info: #1e3a8a;
  --info-soft: #e0e7ff;
  --shadow: 0 6px 24px rgba(15, 23, 42, 0.08);
  --radius: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand-dark: #ff5c98;
    --brand-soft: #3b1230;
    --bg: #0f172a;
    --surface: #162033;
    --surface-2: #1e293b;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --border: #273449;
    --ok: #4ade80;
    --ok-soft: #12351f;
    --warn: #fb923c;
    --warn-soft: #3a2310;
    --danger: #f87171;
    --danger-soft: #3b1518;
    --info: #8ea8ff;
    --info-soft: #1b2a55;
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 "Metropolis", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; }
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* ---------- Topo ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar .container { display: flex; align-items: center; gap: 12px; min-height: 60px; }
.logo { display: flex; align-items: center; gap: 10px; white-space: nowrap; text-decoration: none; color: var(--text); }
.logo .mark { width: 38px; height: 38px; border-radius: 10px; display: block; }
.wordmark { font-weight: 800; font-style: italic; font-size: 1.25rem; letter-spacing: -0.02em; }
.wordmark i { font-style: italic; color: var(--brand); }
.wordmark b { display: inline-block; background: var(--brand); color: #fff; padding: 1px 7px 0 5px; border-radius: 7px; margin-right: 6px; font-weight: 800; }
.logo .sub { font-weight: 700; color: var(--muted); font-size: 0.95rem; }
.logo picture { display: block; flex: none; }
.logo-img { display: block; height: 34px; width: auto; }
.login-box .logo { flex-wrap: wrap; row-gap: 4px; }
.login-box .logo picture { width: min(100%, 270px); }
.login-box .logo-img { height: auto; width: 100%; }
/* O logótipo encolhe com o ecrã, para os botões da direita caberem sempre (sem a página fugir para o lado). */
.topbar .logo { flex: none; }
.topbar .logo-img { height: auto; width: clamp(88px, 36vw, 177px); }
@media (max-width: 360px) { .topbar .about-link { display: none; } .topbar .logo-img { width: 32vw; } }
.topbar .spacer { flex: 1; }
@media (max-width: 480px) { .hide-sm { display: none; } .topbar .container { gap: 8px; } }
@media (max-width: 420px) { .topbar .logo .mark { display: none; } .wordmark { font-size: 1.1rem; } }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; font-weight: 600; text-decoration: none; color: var(--text);
  transition: transform 0.05s, background 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 6px 18px rgba(255, 45, 122, 0.3); }
.btn.primary:hover:not(:disabled) { background: var(--brand-dark); }
.btn.ok { background: #16a34a; border-color: #16a34a; color: #fff; }
.btn.danger { color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.small { padding: 6px 10px; font-size: 0.9rem; border-radius: 10px; }
.btn.block { width: 100%; padding: 14px; font-size: 1.05rem; }
.icon-btn { width: 36px; height: 36px; padding: 0; border-radius: 50%; }

/* ---------- Formulários ---------- */
label { display: block; font-weight: 600; font-size: 0.92rem; margin: 12px 0 6px; }
input, select, textarea {
  width: 100%; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea { resize: vertical; min-height: 64px; }
/* Palavra-passe com olho para a ver (ver-senha.js). */
.pw-wrap { position: relative; display: block; }
.pw-wrap > input { padding-right: 48px; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; padding: 0;
  display: grid; place-items: center; border: 0; border-radius: 10px; background: transparent; color: var(--muted, #888); cursor: pointer; }
.pw-toggle:hover, .pw-toggle[aria-pressed="true"] { color: var(--brand); }
.pw-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.pw-toggle .i { width: 20px; height: 20px; }
/* Telemóvel com indicativo do país: o seletor mostra só "PT +351"; a lista completa abre por cima (select invisível). */
.phone-field { display: flex; gap: 6px; align-items: stretch; }
.phone-field > input[type="tel"] { flex: 1; min-width: 0; }
.phone-field .cc-pick, .phone-field .cc-fixed { position: relative; flex: 0 0 auto; margin: 0; display: flex; align-items: center; gap: 4px;
  padding: 0 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2, var(--surface)); font-weight: 700; font-size: 0.88rem; white-space: nowrap; }
.phone-field .cc-pick { padding-right: 26px; font-size: 0.92rem; }
.phone-field .cc-pick::after { content: ''; position: absolute; right: 11px; top: 50%; width: 6px; height: 6px; margin-top: -5px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); opacity: 0.55; pointer-events: none; }
.phone-field .cc-pick select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; padding: 0; }
.phone-field .cc-pick:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.phone-field .cc-fixed { color: var(--muted); }
.mbway-only + .hint { margin: 6px 0 0; font-size: 0.82rem; }
.row:has(.phone-field) { flex-wrap: wrap; }
.row:has(.phone-field) > div { flex: 1 1 180px; min-width: 0; }
.row > div:has(.phone-field) { flex: 1.3 1 230px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }
.hint { color: var(--muted); font-size: 0.88rem; }
.error-text { color: var(--danger); font-weight: 600; }

.segmented { display: flex; background: var(--surface-2); border-radius: 14px; padding: 4px; gap: 4px; }
.segmented button { flex: 1; border: 0; background: transparent; padding: 10px; border-radius: 10px; font-weight: 700; cursor: pointer; color: var(--muted); }
.segmented button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.radio-list { display: grid; gap: 8px; }
.radio-list label { display: flex; align-items: center; gap: 10px; margin: 0; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); cursor: pointer; font-weight: 500; }
.radio-list input { width: auto; margin: 0; accent-color: var(--brand); }
.radio-list label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }

/* ---------- Cartões e etiquetas ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.badge { display: inline-block; padding: 3px 8px; border-radius: 6px; font-size: 0.8rem; font-weight: 700; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.open, .badge.entregue, .badge.pronto { background: var(--ok-soft); color: var(--ok); }
.badge.closed, .badge.cancelado { background: var(--danger-soft); color: var(--danger); }
.badge.recebido { background: var(--warn-soft); color: var(--warn); }
.badge.preparacao { background: var(--brand-soft); color: var(--brand); }
.badge.a_caminho { background: var(--info-soft); color: var(--info); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 120px);
  background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 12px; z-index: 1000;
  max-width: calc(100% - 32px); box-shadow: var(--shadow); transition: transform 0.25s; font-weight: 600;
}
.toast.show { transform: translate(-50%, 0); }
.toast.error { background: var(--danger); color: #fff; }

.empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.empty .big { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 16px; background: var(--surface-2); color: var(--muted); margin-bottom: 8px; }
.empty .big .i { width: 30px; height: 30px; }

/* ---------- Ícones (SVG de traço, herdam a cor do texto) ---------- */
.i { width: 1.15em; height: 1.15em; flex: none; display: inline-block; vertical-align: -0.2em; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.with-i { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Mapa ---------- */
.map { height: 280px; border-radius: 14px; border: 1px solid var(--border); overflow: hidden; z-index: 0; }
.map.tall { height: 360px; }
.map-pin { background: none; border: 0; }
.map-pin span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50% 50% 50% 4px; transform: rotate(-45deg); background: var(--night); border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.35); }
.map-pin span .i { transform: rotate(45deg); width: 18px; height: 18px; color: #fff; }
.map-pin.brand span { background: var(--brand); }
.map-pin.courier span { border-radius: 50%; transform: none; background: var(--surface); border: 3px solid var(--brand); }
.map-pin.courier span .i { transform: none; color: var(--brand); }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(20, 10, 5, 0.5); z-index: 200; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: var(--surface); width: 100%; max-width: 480px; border-radius: 20px 20px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); max-height: 90vh; overflow: auto; }
@media (min-width: 600px) { .modal-backdrop { align-items: center; } .modal { border-radius: 20px; } }

.qty { display: inline-flex; align-items: center; gap: 4px; background: var(--surface-2); border-radius: 10px; padding: 3px; }
.qty button { width: 32px; height: 32px; border-radius: 8px; border: 0; background: var(--surface); cursor: pointer; font-weight: 800; font-size: 1.1rem; }
.qty span { min-width: 26px; text-align: center; font-weight: 700; }

.login-box { max-width: 380px; margin: 10vh auto; }
.login-box .logo { justify-content: center; margin-bottom: 16px; }
.login-box .logo .mark { width: 56px; height: 56px; border-radius: 14px; }
.alcohol-note { background: var(--danger-soft); color: var(--danger); border-radius: 8px; padding: 6px 8px; font-size: 0.88rem; font-weight: 600; margin: 6px 0; }

/* ---------- Mota FF: animação de carregamento ---------- */
.scooter { display: block; width: 100%; height: auto; overflow: visible; }
.scooter .sc-w { fill: currentColor; }
.scooter .sc-a { fill: var(--sc-accent, #ec1e66); }
.scooter .sc-s { stroke: var(--sc-accent, #ec1e66); }
.scooter .sc-l { fill: currentColor; opacity: 0.55; }
.scooter .sc-wheel { animation: sc-spin 0.45s linear infinite; }
@keyframes sc-spin { to { transform: rotate(360deg); } }

.ff-loader { display: grid; justify-items: center; gap: 6px; padding: 48px 16px; color: var(--muted); text-align: center; }
.ff-loader-ride { width: 132px; color: var(--brand); --sc-accent: var(--surface); animation: sc-bump 0.36s ease-in-out infinite alternate; }
.ff-loader-ride .sc-lines rect { animation: sc-speed 0.5s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: right center; }
.ff-loader-ride .sc-lines rect:nth-child(2n) { animation-delay: -0.25s; }
.ff-loader-road { width: 190px; height: 4px; border-radius: 999px; background: repeating-linear-gradient(90deg, var(--border) 0 22px, transparent 22px 36px); background-size: 36px 4px; animation: sc-road 0.4s linear infinite; }
.ff-loader p { margin: 8px 0 0; font-weight: 700; }
@keyframes sc-bump { from { transform: translateY(0) rotate(0deg); } to { transform: translateY(-3px) rotate(-1.5deg); } }
@keyframes sc-speed { from { transform: scaleX(0.55); opacity: 0.35; } to { transform: scaleX(1.1); opacity: 0.8; } }
@keyframes sc-road { to { background-position: -36px 0; } }

/* Barra fina no topo quando um pedido ao servidor demora. */
#ff-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 2000; pointer-events: none; opacity: 0; transition: opacity 0.2s; overflow: hidden; }
#ff-progress.on { opacity: 1; }
#ff-progress::before { content: ''; position: absolute; top: 0; bottom: 0; width: 40%; border-radius: 0 3px 3px 0;
  background: var(--brand); animation: ff-progress 1s ease-in-out infinite; }
@keyframes ff-progress { from { left: -40%; } to { left: 100%; } }

/* Botão a trabalhar: roda a girar antes do texto. */
.btn.loading { position: relative; pointer-events: none; opacity: 0.85; }
.btn.loading::before { content: ''; width: 1em; height: 1em; margin-right: 8px; border-radius: 50%; display: inline-block; vertical-align: -0.15em;
  border: 2.5px solid currentColor; border-right-color: transparent; animation: sc-spin 0.7s linear infinite; }

@media (prefers-reduced-motion: reduce) {
  .scooter .sc-wheel, .ff-loader-ride, .ff-loader-ride .sc-lines rect, .ff-loader-road { animation: none; }
  #ff-progress::before { animation-duration: 2.5s; }
}

/* Regras da palavra-passe (clientes, Cozinha e estafeta) */
.pw-rules { list-style: none; margin: 6px 0 4px; padding: 0; display: grid; gap: 3px; font-size: 0.85rem; color: var(--muted); }
.pw-rules li::before { content: '○ '; }
.pw-rules li.ok { color: #22c55e; }
.pw-rules li.ok::before { content: '✓ '; }

/* Verificação em 2 passos (Cozinha e estafeta) */
.tf-on { color: var(--ok, #16a34a); }
.tf-steps { padding-left: 20px; display: grid; gap: 8px; line-height: 1.45; }
.tf-qr { width: 190px; max-width: 70vw; margin: 8px 0; background: #fff; padding: 8px; border-radius: 10px; }
.tf-qr svg { display: block; width: 100%; height: auto; }
.tf-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; max-width: 320px; }
.tf-codes code { font-size: 1.05rem; padding: 6px 8px; border-radius: 8px; background: var(--surface-2); text-align: center; letter-spacing: 0.05em; }

/* Avisos da equipa (Cozinha / estafeta): ativar as notificações neste aparelho. */
.staff-push { display: flex; gap: 12px; align-items: flex-start; margin: 12px 0; }
.staff-push .hint { margin: 4px 0 10px; }
.staff-push-i { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--brand, #ff2d7a) 14%, transparent); color: var(--brand, #ff2d7a); }
.staff-push-i svg { width: 22px; height: 22px; }
