/* ============================================================================
   WINE TASTING BOOK & PROVO — SISTEMA VISUAL UNIFICADO (DARK + LIGHT)
   ============================================================================
   Direção visual unificada Sommelier: modo escuro predefinido (`data-theme="dark"`)
   com alternância imediata para modo claro (`data-theme="light"`), sem @import.
   ============================================================================ */

:root, [data-theme="dark"] {
  /* --- 1. Superfícies & Fundo (Sommelier Dark) --- */
  --bg: #0E0C0E;
  --bg-gradient: radial-gradient(ellipse at 50% 0%, rgba(200, 30, 69, 0.09), transparent 58%);
  --bg-card: #171317;
  --bg-card-hover: #211B21;
  --bg-card-hi: #261F26;
  --bg-glass: rgba(23, 19, 23, 0.90);
  --bg-input: #120F12;

  /* --- 2. Tipografia & Contraste WCAG 2.2 AA --- */
  --text: #F5F2EF;
  --text-dim: #BCB3BA;
  --text-faint: #9B9099;
  --text-inverse: #FFFFFF;

  /* --- 3. Contornos Subtis e Foco --- */
  --border: #342A34;
  --border-hover: #4A3B4A;
  --border-subtle: #282028;
  --border-focus: #FB7185;

  /* --- 4. Acentos da Marca (Rubi de Cave & Âmbar Dourado) --- */
  --wine: #C81E45;
  --wine-light: #E11D48;
  --wine-bright: #FB7185;
  --wine-deep: #7A122B;
  --wine-subtle: rgba(200, 30, 69, 0.16);

  --gold: #F0B429;
  --on-gold: #140F0A;
  --gold-light: #FACC15;
  --gold-dim: #D97706;
  --gold-gradient: #F0B429;
  --gold-glow: rgba(240, 180, 41, 0.18);
  --btn-gold-text: #140F0A;

  --green: #4CAF7D;
  --green-subtle: rgba(76, 175, 125, 0.16);
  --red-error: #F87171;
  --danger: #F87171;

  /* --- 5. Famílias Tipográficas & Raios --- */
  --font-display: 'Newsreader', Georgia, serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --letter-spacing-heading: -0.015em;
  --control-radius: 10px;
  --card-radius: 14px;
  --badge-radius: 6px;

  /* --- 6. Sombras --- */
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.42);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.62);
  --shadow-gold: 0 4px 20px rgba(240, 180, 41, 0.22);
  --shadow-wine: 0 4px 20px rgba(200, 30, 69, 0.30);
  --focus-ring: 0 0 0 3px var(--border-focus);

  /* --- 7. Dimensões Táteis & Escala Espacial --- */
  --control-h: 44px;
  --btn-h: 46px;
  --icon-target: 44px;
  --icon-radius: 12px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --transition-ui: 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);

  /* --- 8. Roteiros e Eventos Urbanos --- */
  --city-surface: #171317;
  --city-surface-subtle: #120F12;
  --city-primary: #C81E45;
  --city-primary-hover: #E11D48;
  --city-primary-subtle: #261F26;
  --city-primary-soft: #261F26;
  --city-text: #F5F2EF;
  --city-text-muted: #BCB3BA;
  --city-text-subtle: #9B9099;
  --city-dim: #BCB3BA;
  --city-faint: #9B9099;
  --city-border: #342A34;
  --city-fav-inactive-color: #9B9099;
  --city-fav-active-color: #FBBF24;
  --city-fav-active-bg: rgba(251, 191, 36, 0.16);
  --city-card-shadow: var(--shadow-sm);
  --city-card-hover-shadow: var(--shadow-md);
}

[data-theme="light"] {
  --bg: #F6F3EE;
  --bg-gradient: none;
  --bg-card: #FFFFFF;
  --bg-card-hover: #EFEAE2;
  --bg-card-hi: #EAE3D9;
  --bg-glass: rgba(255, 255, 255, 0.92);
  --bg-input: #FFFFFF;

  --text: #1A1517;
  --text-dim: #574D51;
  --text-faint: #685C61;
  --text-inverse: #FFFFFF;

  --border: #DDD4CA;
  --border-hover: #C8BCB0;
  --border-subtle: #E8E0D7;
  --border-focus: #8E1F3D;

  --wine: #8E1F3D;
  --wine-light: #A62447;
  --wine-bright: #BE2D55;
  --wine-deep: #4A1020;
  --wine-subtle: rgba(142, 31, 61, 0.09);

  --gold: #946600;
  --on-gold: #FFFFFF;
  --gold-light: #B07B00;
  --gold-dim: #734F00;
  --gold-gradient: #946600;
  --gold-glow: rgba(148, 102, 0, 0.14);
  --btn-gold-text: #FFFFFF;

  --green: #15803D;
  --green-subtle: rgba(21, 128, 61, 0.12);
  --red-error: #B91C1C;
  --danger: #B91C1C;

  --shadow-sm: 0 2px 10px rgba(26, 21, 23, 0.05);
  --shadow-md: 0 8px 24px rgba(26, 21, 23, 0.09);
  --shadow-gold: 0 4px 18px rgba(148, 102, 0, 0.15);
  --shadow-wine: 0 4px 18px rgba(142, 31, 61, 0.18);

  --city-surface: #FFFFFF;
  --city-surface-subtle: #F6F3EE;
  --city-primary: #8E1F3D;
  --city-primary-hover: #A62447;
  --city-primary-subtle: #EAE3D9;
  --city-primary-soft: #EAE3D9;
  --city-text: #1A1517;
  --city-text-muted: #574D51;
  --city-text-subtle: #685C61;
  --city-dim: #574D51;
  --city-faint: #685C61;
  --city-border: #DDD4CA;
  --city-fav-inactive-color: #685C61;
  --city-fav-active-color: #92400E;
  --city-fav-active-bg: #FEF3C7;
  --city-card-shadow: var(--shadow-sm);
  --city-card-hover-shadow: var(--shadow-md);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
picture { display: block; width: 100%; height: 100%; }

html, body {
  margin: 0; padding: 0;
  background-color: var(--bg);
  background-image: var(--bg-gradient);
  background-repeat: no-repeat;
  color: var(--text);
  font-family: var(--font-body, 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overscroll-behavior-y: contain;
  overflow-x: clip;
}

/* Acessibilidade WCAG 2.2 AA — Atalho para saltar blocos repetidos */
.skip-link {
  position: absolute;
  top: -120px;
  left: 16px;
  background: var(--gold);
  color: var(--text-inverse);
  padding: 12px 20px;
  border-radius: var(--control-radius);
  font-weight: 700;
  font-size: 14px;
  z-index: 10000;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  transition: top 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.skip-link:focus {
  top: 16px;
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

#app {
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  outline: none !important;
}

/* Prevenção de moldura/quadrado indesejado de foco em contentores e cabeçalhos */
#app:focus,
#app:focus-visible,
.screen,
.screen:focus,
.screen:focus-visible,
[tabindex="-1"],
[tabindex="-1"]:focus,
[tabindex="-1"]:focus-visible,
h1:focus,
h2:focus,
h3:focus,
.nav-title:focus,
.home-title:focus {
  outline: none !important;
  box-shadow: none !important;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* Otimização de Leitura para Ecrãs Ultrawide (>1920px) */
@media (min-width: 1921px) {
  #app {
    max-width: 1440px;
    margin-left: auto;
    margin-right: auto;
  }
}

.screen {
  padding: calc(16px + var(--safe-t)) calc(16px + var(--safe-r)) calc(40px + var(--safe-b)) calc(16px + var(--safe-l));
  max-width: 640px; margin: 0 auto;
  animation: fadeIn .28s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Tipografia (Adaptável por Perfil) */
h1, h2, h3, .nav-title, .home-title {
  font-family: var(--font-display, 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
  letter-spacing: var(--letter-spacing-heading, -0.02em);
  font-weight: 750;
}

h1 { font-size: 28px; font-weight: 800; line-height: 1.2; margin: 0 0 10px; }
h2 { font-size: 22px; font-weight: 750; line-height: 1.25; margin: 0 0 10px; }
h3 { font-size: 18px; font-weight: 700; line-height: 1.3; margin: 0 0 8px; }
p  { line-height: 1.6; color: var(--text-dim); margin: 0 0 14px; font-size: 15.5px; }
.muted { color: var(--text-faint); font-size: 13.5px; }
.center { text-align: center; }

/* Marca & Logótipo Superior */
.brand {
  display: inline-flex; align-items: center; gap: 12px;
  font-family: var(--font-display, 'Plus Jakarta Sans', sans-serif);
  margin-bottom: 24px;
}
.brand-btn {
  background: none; border: none; padding: 6px 0;
  cursor: pointer; text-align: left; width: auto;
  transition: opacity var(--transition-ui), transform var(--transition-ui);
  touch-action: manipulation;
}
.brand-btn:hover { opacity: .95; transform: translateY(-1px); }
.brand-btn:active { opacity: .8; transform: scale(0.98); }
.brand-logo-img {
  width: 40px; height: 40px; border-radius: 12px; object-fit: contain;
  box-shadow: var(--shadow-sm);
  border: none;
}
.brand-text-col {
  display: flex; flex-direction: column;
}
.brand-title {
  font-size: 16.5px; font-weight: 800; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--text);
}
.brand-sub {
  font-family: var(--font-body, 'Plus Jakarta Sans', sans-serif);
  font-size: 12px; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--text-dim);
  margin-top: 2px;
}

.brand-header-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 20px;
}
.brand-header-left {
  display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1;
}
.brand-header-bar .brand { margin-bottom: 0; min-width: 0; }

.provo-theme-btn {
  min-width: 44px; min-height: 44px; padding: 8px 12px;
  border-radius: var(--control-radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  font-family: inherit; font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  cursor: pointer; flex-shrink: 0;
  transition: background-color var(--transition-ui), color var(--transition-ui), border-color var(--transition-ui);
}
.provo-theme-btn:hover { background: var(--bg-card-hover); color: var(--gold); border-color: var(--border-hover); }
.provo-theme-btn:focus-visible { outline: 3px solid var(--border-focus); outline-offset: 2px; }

.provo-account-btn {
  max-width: 140px;
}
.provo-account-btn .theme-toggle-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 480px) {
  .provo-account-btn .theme-toggle-label {
    display: none;
  }
}

.account-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.15s ease-out;
}
.account-modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--modal-radius, 16px);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px;
  box-sizing: border-box;
}
.account-menu-item {
  width: 100%;
  margin-bottom: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--control-radius);
  padding: 12px 14px;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background var(--transition-fast), border-color var(--transition-fast);
  box-sizing: border-box;
  text-decoration: none;
}
.account-menu-item:hover,
.account-menu-item:focus-visible {
  background: var(--bg-card-hi);
  border-color: var(--gold);
}
.account-menu-details {
  margin-bottom: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--control-radius);
  padding: 12px 14px;
  box-sizing: border-box;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}
.account-menu-details summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  user-select: none;
  font-family: inherit;
  margin: 0;
  padding: 0;
}
.account-menu-details summary::-webkit-details-marker,
.account-menu-details summary::marker {
  display: none;
}
.account-menu-details:hover {
  background: var(--bg-card-hi);
}
.account-menu-details[open] {
  border-color: var(--gold);
}

/* Hero Principal */
.home-hero { text-align: center; padding: 20px 0 28px; }
.home-hero-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 88px; height: 88px; margin: 0 auto 16px;
  border-radius: 24px;
  background: var(--bg-card-hi);
  border: none;
  box-shadow: var(--shadow-md);
  transition: transform var(--transition-ui), box-shadow var(--transition-ui);
}
.home-hero-badge:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.hero-crest { width: 64px; height: 64px; object-fit: contain; }
.home-title {
  font-size: 29px; font-weight: 800; letter-spacing: var(--letter-spacing-heading, -0.02em);
  color: var(--text);
  margin-bottom: 10px;
}
.home-tagline {
  font-size: 15px; line-height: 1.6; color: var(--text-dim);
  max-width: 440px; margin: 0 auto; font-weight: 400;
  letter-spacing: 0.01em;
}

/* Botões de Ação Ergonómicos (Target >= 44px) */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: var(--btn-h); padding: 13px 20px;
  border: none; border-radius: var(--control-radius);
  background: var(--wine); color: var(--text-inverse);
  font-size: 16px; font-weight: 700; font-family: inherit;
  cursor: pointer; transition: all var(--transition-ui);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  touch-action: manipulation;
}
.btn:hover { background: var(--wine-light); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.btn:active { transform: scale(.98); filter: brightness(1.08); }
.btn:focus-visible { outline: 3px solid var(--border-focus); outline-offset: 2px; }

.btn-ghost {
  background: var(--bg-card-hi);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: none;
}
.btn-ghost:hover { color: var(--gold); background: var(--bg-card-hover); border-color: var(--border-hover); }

.btn-soft {
  background: var(--bg-card-hi);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-soft:hover { background: var(--bg-card-hover); color: var(--text); border-color: var(--border-hover); }

.btn-gold {
  background: var(--gold);
  color: var(--btn-gold-text, var(--text-inverse)); font-weight: 700;
  border: none;
  box-shadow: var(--shadow-gold);
}
.btn-gold:hover { background: var(--gold-light); box-shadow: var(--shadow-md); transform: translateY(-1px); }

/* Ação DESTRUTIVA. Antes era `btn-ghost` com texto vermelho inline — cada
 * ecrã inventava a sua. Contorno + texto na cor de erro, sem fundo cheio:
 * "apagar" nunca deve competir visualmente com a ação principal do ecrã. */
.btn-danger {
  background: transparent;
  border: 1.5px solid var(--red-error, #b91c1c);
  color: var(--red-error, #b91c1c);
  box-shadow: none;
}
.btn-danger:hover {
  background: color-mix(in srgb, var(--red-error, #b91c1c) 10%, transparent);
  color: var(--red-error, #b91c1c);
  box-shadow: none;
}

.btn-sm { min-height: 44px; font-size: 13.5px; padding: 8px 14px; border-radius: 10px; }
.btn-link {
  background: none; border: none; color: var(--text-dim);
  text-decoration: underline; padding: 12px; font-size: 14.5px;
  cursor: pointer; width: 100%; font-family: inherit;
  transition: color var(--transition-ui);
}
.btn-link:hover { color: var(--gold); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* Cartões Enológicos — Superfícies com Contorno Subtil e Sombra */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--card-radius);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-ui), transform var(--transition-ui), background-color var(--transition-ui), border-color var(--transition-ui);
}
.card-tap { cursor: pointer; touch-action: manipulation; }
.card-tap:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); background: var(--bg-card-hover); border-color: var(--border); }
.card-tap:active { transform: scale(.985); }

/* Gate 18+ / consentimento */
.gate {
  display: flex; flex-direction: column; justify-content: flex-start;
  min-height: 100dvh; width: 100%; max-width: 640px; margin: 0 auto;
  padding: calc(16px + var(--safe-t)) calc(16px + var(--safe-r)) calc(40px + var(--safe-b)) calc(16px + var(--safe-l));
  box-sizing: border-box;
}
.gate-body { width: 100%; margin: auto 0; }
.gate-icon { font-size: 48px; color: var(--gold); text-align: center; margin-bottom: 18px; }
.check-row { display: flex; align-items: flex-start; gap: 12px; padding: 13px 4px; cursor: pointer; touch-action: manipulation; border-radius: 8px; }
.check-row:focus-visible { outline: 3px solid var(--border-focus); outline-offset: 2px; background: rgba(0,0,0,0.03); }
.check-box {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 8px;
  border: 1.5px solid var(--border); background: var(--bg-card-hi);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: transparent; transition: all var(--transition-ui);
}
.check-row.on .check-box { background: var(--wine); border-color: var(--wine); color: var(--text-inverse); }
.check-label { font-size: 15px; line-height: 1.45; color: var(--text-dim); }
.gate-privacy-link { color: var(--text-dim); text-decoration: underline; transition: color var(--transition-ui); }
.gate-privacy-link:hover { color: var(--gold); }
.gate-privacy-link:focus-visible { color: var(--gold); outline: 3px solid var(--border-focus); outline-offset: 2px; }

/* Lista de vinhos */
.wine-item { display: flex; align-items: center; gap: 13px; }
.wine-num {
  flex-shrink: 0; width: 40px; height: 40px; border-radius: var(--icon-radius);
  background: var(--bg-card-hi); color: var(--gold);
  border: none;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px;
}
.wine-item.done .wine-num { background: var(--wine); color: #fff; }
.wine-info { flex: 1; min-width: 0; }
.wine-name { font-size: 15.5px; font-weight: 600; line-height: 1.3; }
.wine-meta { font-size: 12.5px; color: var(--text-faint); margin-top: 3px; }
.wine-score { flex-shrink: 0; font-size: 14px; color: var(--gold); font-weight: 600; }
/* Um botão DENTRO de `.wine-item` não pode herdar o `width: 100%` do `.btn`:
 * o flexbox dava-lhe a largura toda e o `.wine-info` encolhia até partir o
 * texto. `flex: 0 0 auto` (não só `width: auto`) evita a compressão. */
.wine-item > .btn { width: auto; flex: 0 0 auto; }

/* ----------------------------------------------------------------------
 * A linha tocável canónica — ver public/static/ui.js (`rowCard`).
 * Reutiliza os tokens `.wine-*` para casas, eventos, espaços e vinhos; o que
 * era bespoke (`.dir-card`, `.spot-card`, ...) passa a viver aqui.
 * -------------------------------------------------------------------- */
.row-card { padding: 14px 15px; }
/* Cartão com imagem de topo: 4:3 em mobile, mais alta mas contida em desktop. */
.row-card-has-banner { padding-top: 0; overflow: hidden; }
.row-banner {
  position: relative; margin: 0 -15px 13px;
  aspect-ratio: 4 / 3; height: auto; overflow: hidden;
  background: var(--bg-card-hi);
}
.row-banner img { display: block; width: 100%; height: 100%; object-fit: cover; }
.row-banner-badge {
  position: absolute; top: 10px; right: 10px;
  background: var(--gold); color: var(--on-gold, #fff);
  font-size: 11px; font-weight: 700; padding: 4px 10px;
  border-radius: var(--badge-radius); text-transform: uppercase; letter-spacing: .04em;
  box-shadow: var(--shadow-sm);
}
/* A linha é o alvo tocável; o `onclick` vive nela, não no cartão, para que
 * as ações do rodapé (direções, contactos) não abram a ficha por engano. */
.row-card > [role="button"] { display: block; cursor: pointer; touch-action: manipulation; }
/* Foco visível na linha tocável (WCAG 2.4.11): o alvo por teclado é o
 * `[role=button]` interior, não o cartão. */
.row-card > [role="button"]:focus-visible { outline: 3px solid var(--border-focus); outline-offset: 3px; border-radius: var(--control-radius); }
.row-card .row { align-items: center; }
.row-lead { width: 40px; height: 40px; }
.row-lead-lg { width: 50px; height: 50px; font-size: 21px; }
.row-lead img { width: 100%; height: 100%; object-fit: contain; background: #fff; border-radius: inherit; padding: 3px; }
.row-lead[style*="--lead-bg"] { background: var(--lead-bg); color: #fff; }
.row-lead[style*="--lead-bg"] img { background: #fff; }
.row-eyebrow {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--gold); display: flex; align-items: center; gap: 5px;
  margin-bottom: 2px;
}
.row-meta { color: var(--text-dim); }
.row-tagline {
  font-size: 13px; color: var(--text-dim); line-height: 1.4; margin-top: 5px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.row-tag { margin-top: 7px; display: flex; flex-wrap: wrap; gap: 5px 9px; align-items: center; }
.row-chev { display: none !important; }
/* Preço em destaque à direita (eventos/roteiros). */
.row-price {
  flex-shrink: 0; text-align: right; padding: 5px 12px;
  border-radius: var(--control-radius); background: var(--bg-card-hi);
  border: 1px solid var(--border-subtle);
}
.row-price-value { font-size: 16px; font-weight: 800; color: var(--gold); line-height: 1.15; }
.row-price-label { font-size: 12px; font-weight: 600; color: var(--text-dim); line-height: 1.15; margin-top: 2px; }
/* Ações dentro do cartão ocupam a largura total disponível. */
.row-actions { display: flex; gap: 8px; margin-top: 11px; flex-wrap: wrap; width: 100%; }
.row-actions:empty { display: none; }
.row-actions .btn { flex: 1 1 180px; width: 100%; }

/* Estado vazio canónico. */
.empty-state .empty-icon-wrap { font-size: 38px; color: var(--gold); opacity: .9; }
.empty-state.empty-tall { margin-top: 32px; }
.empty-state.empty-tall .empty-icon-wrap { font-size: 44px; opacity: .5; }
.empty-state .empty-title { margin-top: 16px; }
.empty-state p { font-size: 15px; line-height: 1.5; max-width: 320px; margin: 8px auto 0; color: var(--text-dim); }
.empty-actions { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 100%; margin: 18px auto 0; }

/* Copos de pontuação — o elemento central da app */
.glasses { display: flex; justify-content: center; gap: 6px; margin: 6px 0 4px; }
.glass {
  background: none; border: none; padding: 8px 4px;
  font-size: 40px; line-height: 1; cursor: pointer;
  color: var(--text-faint); transition: transform .12s, color .12s;
  filter: grayscale(1) opacity(.35);
  min-width: 48px; min-height: 48px;
  display: inline-flex; align-items: center; justify-content: center;
}
.glass.on { color: var(--gold); filter: none; opacity: 1; }
.glass:active { transform: scale(1.22); }
.glasses-lg .glass { font-size: 46px; }
.score-label { text-align: center; font-size: 14px; color: var(--text-dim); min-height: 20px; }

/* Chips de sabor & Filtros */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 14px; border-radius: 22px;
  border: none; background: var(--bg-card-hi);
  color: var(--text-dim); font-size: 13.5px; font-family: inherit;
  cursor: pointer; transition: all var(--transition-ui);
  min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  touch-action: manipulation;
}
.chip i {
  font-size: 13px;
  color: var(--gold);
  transition: transform var(--transition-ui);
}
.chip:hover {
  background: var(--bg-card-hover);
  color: var(--text);
  transform: translateY(-1px);
}
.chip.on {
  background: var(--wine);
  color: var(--text-inverse);
  box-shadow: var(--shadow-sm);
}
.chip.on i {
  color: var(--text-inverse);
}
.chip:active { transform: scale(0.96); }

/* Sim/Não (intenção de compra) */
.yesno { display: flex; gap: 10px; }
.yesno button {
  flex: 1; min-height: 52px; border-radius: 13px;
  border: none; background: var(--bg-card-hi);
  color: var(--text-dim); font-size: 16px; font-weight: 600; font-family: inherit;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: all .14s;
}
.yesno button.on-yes { background: var(--green); color: var(--text-inverse); }
.yesno button.on-no  { background: var(--wine-deep); color: #fff; }

/* Nota + voz */
textarea {
  width: 100%; min-height: 84px; padding: 13px;
  border-radius: 13px; border: 1px solid var(--border);
  background: var(--bg-input); color: var(--text);
  font-size: 16px; font-family: inherit; resize: vertical;
}
textarea:focus-visible { outline: 3px solid var(--border-focus); outline-offset: 2px; }
.mic-btn {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  width: 100%; min-height: 50px; margin-top: 9px;
  border-radius: 13px; border: 1px solid var(--border);
  background: var(--bg-card-hi); color: var(--text-dim);
  font-size: 15px; font-family: inherit; cursor: pointer;
}
.mic-btn.rec { background: var(--wine); border-color: var(--wine); color: #fff; animation: pulse 1.3s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .62; } }

/* Ficha do vinho */
.wine-hero { text-align: center; padding: 8px 0 18px; }
.wine-hero .type-badge {
  display: inline-block; padding: 5px 13px; border-radius: 20px;
  background: var(--bg-card-hi); color: var(--gold);
  border: 1px solid var(--border-subtle);
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em;
  margin-bottom: 12px;
}
.wine-hero h1 { font-size: 25px; line-height: 1.2; }
.wine-hero .producer { color: var(--gold); font-size: 15.5px; margin-top: 5px; font-weight: 500; }
.wine-hero .vintage { font-size: 32px; font-weight: 300; color: var(--text-faint); margin-top: 6px; letter-spacing: .04em; }

.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; margin: 16px 0; }
.fact { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: 11px; padding: 11px 13px; }
.fact-label { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-faint); }
.fact-value { font-size: 14.5px; font-weight: 600; margin-top: 3px; }
.fact-wide { grid-column: 1 / -1; }

.tags { display: flex; gap: 7px; flex-wrap: wrap; justify-content: center; margin-top: 11px; }
.tag { padding: 4px 11px; border-radius: 14px; font-size: 12px; font-weight: 600; background: var(--green-subtle); color: var(--green); }
.tag-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--bg-card-hi); border: 1px solid var(--border-subtle); color: var(--text-dim);
}

.desc { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: 14px; padding: 15px; font-size: 14.5px; line-height: 1.62; color: var(--text-dim); }

/* Confirmação de gravação: informação, não botão — nada para tocar aqui */
.saved-hint {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  color: var(--green); font-size: 14.5px; font-weight: 600;
  margin-bottom: 12px;
}

/* Barra fixa inferior */
.sticky-bar {
  position: sticky; bottom: 0;
  padding: 12px 0 calc(12px + var(--safe-b));
  background: linear-gradient(to top, var(--bg) 62%, transparent);
  margin-top: 14px;
}

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(26px + var(--safe-b));
  transform: translateX(-50%);
  background: var(--bg-card-hi); border: 1px solid var(--border);
  color: var(--text); padding: 13px 20px; border-radius: 26px;
  font-size: 14px; z-index: 999; display: flex; align-items: center; gap: 9px;
  box-shadow: var(--shadow-md);
  animation: toastIn .22s ease;
  max-width: calc(100vw - 32px);
  width: max-content;
  box-sizing: border-box;
  text-align: center;
}
body.has-tabbar .toast {
  bottom: calc(78px + var(--safe-b));
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 14px); } to { opacity: 1; transform: translate(-50%, 0); } }
.toast.ok i { color: var(--green); }
.toast.warn i { color: var(--gold); }
.toast.toast-with-action {
  gap: 14px;
  justify-content: space-between;
}
.toast-action-btn {
  background: var(--wine);
  border: none;
  color: var(--text-inverse);
  padding: 4px 12px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}
.toast-action-btn:hover {
  background: var(--wine-light);
}
.cellar-item-del-btn {
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 15px;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 8px;
  margin-left: 2px;
  transition: color 0.15s ease;
}
.cellar-item-del-btn:hover {
  color: var(--danger, #ef4444);
}

/* Cabeçalho de navegação */
.nav { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; min-height: 44px; }
.nav-back {
  background: none; border: none; color: var(--text-dim); font-size: 20px;
  min-width: 45px; min-height: 45px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; border-radius: 12px;
  transition: background-color .15s ease, color .15s ease;
}
.nav-back:hover, .nav-back:active { background: var(--bg-card-hi); color: var(--gold); }
.nav-back:focus-visible { outline: 3px solid var(--border-focus); outline-offset: 2px; }
.nav-title {
  font-size: 16.5px; font-weight: 600; flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Progresso */
.progress { height: 4px; background: var(--border); border-radius: 3px; overflow: hidden; margin-bottom: 18px; }
.progress-fill { height: 100%; background: var(--wine-bright); transition: width .35s ease; }

/* Scanner */
.scanner-wrap { position: relative; border-radius: 18px; overflow: hidden; background: #000; aspect-ratio: 3/4; }
.scanner-wrap video { width: 100%; height: 100%; object-fit: cover; }
.scan-frame {
  position: absolute; inset: 16% 12%;
  border: 2.5px solid rgba(255,255,255,.85); border-radius: 16px;
  box-shadow: 0 0 0 100vmax rgba(0,0,0,.42);
}
.scan-hint-txt { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; color: #fff; font-size: 13.5px; text-shadow: 0 1px 6px #000; }

/* Selo de idioma */
.lang-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 24px; margin-bottom: 12px; }
.lang-btn {
  padding: 8px 14px; min-height: 44px; min-width: 44px;
  border-radius: var(--badge-radius); border: none;
  background: var(--bg-card-hi); color: var(--text-dim);
  font-size: 13px; font-weight: 650; cursor: pointer; font-family: inherit;
  transition: all var(--transition-ui); touch-action: manipulation;
}
.lang-btn:hover { background: var(--bg-card-hover); color: var(--text); }
.lang-btn.on { background: var(--wine); color: var(--text-inverse); box-shadow: var(--shadow-sm); }

/* Labels persistentes para campos acessíveis */
.form-label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-dim);
  margin: 0 0 6px 2px;
  text-align: left;
}

/* Invólucro de palavra-passe com alternador de visibilidade */
.pass-field-wrap {
  position: relative;
  display: block;
  width: 100%;
}
.pass-field-wrap input {
  padding-right: 48px !important;
}
.btn-toggle-pass {
  position: absolute;
  right: 2px;
  top: 0;
  width: 44px;
  height: var(--control-h, 44px);
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  border-radius: var(--control-radius);
  touch-action: manipulation;
  transition: color var(--transition-ui);
}
.btn-toggle-pass:hover { color: var(--gold); }
.btn-toggle-pass:focus-visible { color: var(--gold); outline: 3px solid var(--border-focus); outline-offset: 2px; }

/* Badge de incentivo / bónus de onboarding */
.onboard-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 20px;
  background: rgba(124, 25, 46, 0.1);
  border: none;
  color: var(--gold);
  font-weight: 600;
  font-size: 13px;
}

/* Shimmer Skeleton Loaders (WCAG AA & Ergonomia) */
@keyframes skeleton-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton-block {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hi) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.6s ease-in-out infinite;
  border-radius: var(--control-radius);
}

.skeleton-card {
  background: var(--bg-card);
  border: none;
  border-radius: var(--card-radius);
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  gap: 14px;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

.skeleton-thumb {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  flex-shrink: 0;
}

.skeleton-text-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skeleton-line {
  height: 14px;
  border-radius: 4px;
}

.skeleton-line.title {
  width: 65%;
  height: 16px;
}

.skeleton-line.sub {
  width: 40%;
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-block {
    animation: none;
    background: var(--bg-card-hi);
  }
}

/* Onboarding & Coach Mark */
.rating-coach-card {
  transition: opacity var(--transition-ui), transform var(--transition-ui);
}
.rating-coach-card .coach-dismiss {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  border-radius: var(--control-radius);
  touch-action: manipulation;
  transition: color var(--transition-ui), background-color var(--transition-ui);
  margin: -10px -10px -10px auto;
}
.rating-coach-card .coach-dismiss:hover, .rating-coach-card .coach-dismiss:focus-visible {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}
.empty-welcome {
  padding: 28px 16px;
  text-align: center;
}
.empty-welcome .empty-icon-wrap {
  margin-bottom: 4px;
}

/* Inputs com Focus Ring Acessível e Prevenção de Auto-Zoom */
input[type=email], input[type=password], input[type=text], input[type=number], input[type=search], input[type=tel], input[type=url] {
  width: 100%; min-height: var(--control-h); padding: 0 14px;
  border-radius: var(--control-radius); border: 1px solid var(--border);
  background: var(--bg-input); color: var(--text);
  font-size: 16px; font-family: inherit; margin-bottom: 12px;
  transition: box-shadow var(--transition-ui), background-color var(--transition-ui), border-color var(--transition-ui);
}
input:focus-visible { outline: 3px solid var(--border-focus); outline-offset: 2px; background: var(--bg-card); border-color: var(--border-focus); }
select { font-family: inherit; }

/* Evitar zoom automático irritante do iOS Safari ao focar campos */
@media screen and (max-width: 768px) {
  input, select, textarea {
    font-size: 16px !important;
  }
}

/* Linha de input com ação embutida perfeitamente alinhada (ex: GPS, Busca) */
.input-action-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  margin-bottom: 12px;
}
.input-action-row input[type=text],
.input-action-row input[type=number],
.input-action-row input {
  flex: 1 1 auto;
  min-width: 0;
  width: auto !important;
  margin-bottom: 0 !important;
}
.input-action-row .btn-inline-action {
  flex: 0 0 auto;
  width: auto !important;
  min-width: 72px;
  min-height: var(--control-h, 44px);
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--control-radius);
  background: var(--bg-card-hi);
  border: none;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
  transition: all var(--transition-ui);
}
.input-action-row .btn-inline-action:hover {
  background: var(--bg-card-hover);
  color: var(--gold);
}
.input-action-row .btn-inline-action:active {
  transform: scale(0.97);
}
.tag-gold { background: rgba(124, 25, 46, 0.1); color: var(--gold); border: none; }
.tag-wine { background: var(--wine-subtle); color: var(--wine); border: none; }

/* Confirmação da palavra-passe */
.pass-hint {
  min-height: 20px; margin: -4px 0 10px 4px;
  font-size: 13px; line-height: 20px;
}
.pass-hint.bad  { color: var(--gold); }
.pass-hint.good { color: var(--green); }

/* Conta e "sair" no ecrã principal */
.account-card { margin-top: 14px; }
.account-row { display: flex; align-items: center; gap: 12px; }
.account-id { flex: 1; min-width: 0; }
.account-email {
  font-size: 14.5px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.btn-logout {
  flex-shrink: 0; display: flex; align-items: center; gap: 7px;
  min-height: 44px; padding: 10px 15px;
  background: var(--bg-card-hi); color: var(--text-dim);
  border: none; border-radius: 12px;
  font-size: 13.5px; font-weight: 600; font-family: inherit; cursor: pointer;
}
.btn-logout:active { opacity: .7; }

.account-links { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 10px; }
.account-links .btn { margin-top: 0; min-width: 0; width: 100%; font-size: 15px; padding-left: 16px; padding-right: 16px; }

/* Resumo final */
.summary-hero { text-align: center; padding: 26px 0; }
.summary-num { font-size: 62px; font-weight: 200; color: var(--gold); line-height: 1; }
.fav-card { background: var(--wine); color: var(--text-inverse); border: none; }
.fav-card .fact-label { color: rgba(255,255,255,.68); }

/* Estado offline */
.offline-badge {
  position: fixed; top: calc(8px + var(--safe-t)); left: 50%; transform: translateX(-50%);
  background: var(--gold); color: var(--on-gold); padding: 5px 14px; border-radius: 14px;
  font-size: 12px; font-weight: 700; z-index: 998;
}

/* Contador de fecho da prova: fixo no topo como o aviso de offline, porque a
 * informação é sobre a sessão inteira. Dourado e não vermelho (reservado para
 * os últimos 2 minutos, .urgent) porque aos 10 minutos é aviso, não erro. */
.closing-badge {
  position: fixed; top: calc(8px + var(--safe-t)); left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 7px;
  background: var(--gold); color: var(--on-gold);
  padding: 6px 15px; border-radius: 14px;
  font-size: 12.5px; font-weight: 700; z-index: 997;
  box-shadow: 0 3px 14px rgba(0,0,0,.35);
  /* Puramente informativo: nunca deve intercetar o toque num vinho que esteja
     por baixo dele. */
  pointer-events: none;
}
/* O aviso de offline usa o mesmo canto. Sem isto, o de baixo ficava tapado --
   e ficar sem rede nos últimos minutos da prova é precisamente quando as duas
   informações são as duas necessárias. */
.closing-badge.stacked { top: calc(40px + var(--safe-t)); }
.closing-badge.urgent {
  background: var(--wine-bright); color: #fff;
  animation: closingPulse 1.6s ease-in-out infinite;
}
@keyframes closingPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .74; }
}
/* Quem escolheu menos movimento no sistema não leva um aviso a pulsar. */
@media (prefers-reduced-motion: reduce) {
  .closing-badge.urgent { animation: none; }
}

.spinner {
  width: 34px; height: 34px; margin: 22px auto;
  border: 3px solid var(--border); border-top-color: var(--wine-bright);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty { text-align: center; padding: 50px 20px; color: var(--text-faint); }
.empty i { font-size: 42px; margin-bottom: 14px; opacity: .5; }

/* ==================================================================== *
 * MENU PRINCIPAL (ecrã de entrada)
 * <nav> com <button>s e não `div.card` com onclick: teclado, leitor de ecrã e
 * alvo de toque no item inteiro (app usada com uma mão e um copo na outra).
 * ==================================================================== */

/* ---- O item TEMPORÁRIO: a prova onde a pessoa está ----
 * Distingue-se pelo halo (sombra mais forte) e pelo ponto "ao vivo".
 */
.live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--gold); flex-shrink: 0;
  animation: liveDot 1.8s ease-in-out infinite;
  box-shadow: 0 0 8px var(--gold);
}
@keyframes liveDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .4; transform: scale(.78); }
}
@media (prefers-reduced-motion: reduce) {
  .live-dot { animation: none; }
}

/* ---- A demonstração: convite, não um sítio onde a pessoa está ---- */
.demo-slot { margin-top: 8px; }

/* Convite a criar conta, para quem ainda não tem */
.guest-card {
  margin-top: 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--card-radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.guest-text { display: flex; align-items: flex-start; gap: 14px; }
.guest-icon { color: var(--gold); font-size: 20px; margin-top: 2px; flex-shrink: 0; }
.guest-title { font-size: 16px; font-weight: 700; color: var(--text); line-height: 1.35; }
.guest-sub { font-size: 13.5px; color: var(--text-dim); margin-top: 4px; line-height: 1.5; }

/* ==================================================================== *
 * Mesas e identidade da casa
 * ==================================================================== */

.brand-house {
  display: flex; align-items: center; gap: 11px;
  padding-bottom: 12px; margin-bottom: 4px;
  border-bottom: none;
}
.house-logo {
  width: 42px; height: 42px; border-radius: 9px;
  object-fit: contain;
  background: rgba(0,0,0,.04);
  padding: 3px; flex-shrink: 0;
}
.brand-house .brand-text { display: flex; flex-direction: column; min-width: 0; }
.house-name {
  font-size: 16px; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.house-sub { font-size: 12.5px; color: var(--text-faint); margin-top: 1px; }

/* Ecrã de espera: mesa válida, prova ainda não atribuída. */
.await-card {
  margin-top: 34px; padding: 30px 22px;
  background: var(--bg-card); border: none;
  box-shadow: var(--shadow-sm);
  border-radius: 16px; text-align: center;
}
.await-icon { font-size: 54px; margin-bottom: 14px; }
.await-body {
  color: var(--text-dim); line-height: 1.55; font-size: 15px;
  max-width: 34ch; margin: 10px auto 0;
}
.await-table {
  display: inline-flex; align-items: center; gap: 7px;
  margin-top: 18px; padding: 7px 15px;
  background: var(--bg-card-hi); border-radius: 999px;
  font-size: 13.5px; color: var(--text-dim);
}
.await-table i { color: var(--gold); }

/* Links da casa no fim da prova */
.house-links {
  margin-top: 26px; padding-top: 20px;
  border-top: none;
}
.house-links .btn { margin-bottom: 9px; text-decoration: none; }

/* ==================================================================== *
 * DIRETÓRIO DE CASAS — onde provar ou comprar vinho
 * Lê-se de pé e na rua: linhas compactas (para comparar várias) e botões de
 * direções sempre visíveis no cartão, sem abrir a ficha.
 * ==================================================================== */

.dir-h1 { margin-bottom: 4px; }
.dir-sub { font-size: 14.5px; margin-bottom: 16px; }

/* -- Filtros --------------------------------------------------------- */

/* Rolam na horizontal em vez de mudarem de linha: com muitas cidades o
 * embrulho empurrava a primeira casa para fora do ecrã. As margens negativas
 * fazem os chips sangrar até à borda, com o padding a repor o alinhamento. */
.dir-chips {
  display: flex; gap: 8px;
  overflow-x: auto;
  margin: 0 -16px 10px; padding: 2px 16px 6px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.dir-chips::-webkit-scrollbar { display: none; }
.dir-chip {
  flex-shrink: 0;
  padding: 9px 15px; border-radius: 20px;
  border: none; background: var(--bg-card-hi);
  color: var(--text-dim); font-size: 13.5px; font-weight: 500;
  font-family: inherit; white-space: nowrap; cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all .14s;
}
.dir-chip.on { background: var(--wine); color: var(--text-inverse); }
.dir-chip:active { transform: scale(.94); }
/* A segunda fila (cidades) é subordinada à primeira: chips menores para se
   perceber a hierarquia sem precisar de um título a dizê-lo. */
.dir-cities .dir-chip { font-size: 12.5px; padding: 7px 13px; }

/* -- Cartão de uma casa ---------------------------------------------- */

/* O logo com recurso às iniciais: a maioria das casas pequenas não tem
 * ficheiro e um quadrado vazio faz a lista parecer avariada. `--dir-bg` vem
 * inline do JS (cor de marca de cada casa, não pode viver numa folha). */
.dir-logo {
  flex-shrink: 0; width: 50px; height: 50px; border-radius: var(--icon-radius);
  background: var(--dir-bg, var(--wine));
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.dir-logo img {
  width: 100%; height: 100%;
  object-fit: contain;                     /* nunca deformar o logo do cliente */
  /* Um logo com fundo transparente ficaria ilegível sobre a cor de marca da
     própria casa; o branco garante contraste seja qual for a cor. */
  background: #fff; padding: 3px;
}
.dir-logo span { font-size: 21px; font-weight: 700; color: #fff; letter-spacing: .02em; }

.dir-kind {
  padding: 2.5px 8px; border-radius: 11px;
  background: var(--bg-card-hi); color: var(--gold);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
}
/* A distância é o dado que decide a escolha quando há várias casas: ganha
   peso e a cor viva para se ler antes do resto da linha. */
.dir-dist { color: var(--wine-bright); font-weight: 700; }

/* Na ficha, sim: largura total e dourado cheio. */
.dir-actions-lg { margin-top: 14px; }
.dir-actions-lg .btn {
  width: 100%; min-height: 50px; padding: 14px 18px;
  font-size: 15px; border-radius: 14px; border: none;
}
.dir-actions-lg .btn.btn-gold { background: var(--gold); color: var(--btn-gold-text, var(--text-inverse)); }
.dir-actions-lg .btn.btn-soft { background: var(--bg-card-hi); color: var(--text); }
.dir-actions-lg .btn i { font-size: 15px; }

.dir-loading { text-align: center; padding: 44px 20px; color: var(--text-faint); font-size: 14.5px; }
.dir-loading i { color: var(--wine-bright); margin-right: 8px; }

/* -- Ficha da casa --------------------------------------------------- */

/* O cabeçalho usa a cor da casa muito diluída em degradê para o fundo, para
 * dar identidade sem trocar o tema escuro -- o texto tem de continuar legível
 * com qualquer cor de marca, incluindo um amarelo. */
.house-hero {
  text-align: center; padding: 24px 18px 22px; margin-bottom: 14px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--dir-bg, var(--wine)) 22%, transparent), transparent);
  border: none;
  box-shadow: var(--shadow-sm);
}
.house-hero .dir-logo-lg {
  width: 78px; height: 78px; border-radius: 18px; margin: 0 auto 14px;
}
.house-hero .dir-logo-lg span { font-size: 32px; }
.house-hero h1 { font-size: 24px; line-height: 1.2; margin-bottom: 8px; }
.house-tagline { font-size: 15px; color: var(--text-dim); margin: 0 auto 10px; max-width: 32ch; }
.house-desc { font-size: 14.5px; line-height: 1.62; margin: 0; }

/* Morada e horário: ícone à esquerda, rótulo e valor à direita. */
.house-fact {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 0; font-size: 14.5px; line-height: 1.5;
}
.house-fact + .house-fact { border-top: 1px solid var(--border); }
.house-fact > i {
  flex-shrink: 0; width: 20px; margin-top: 3px;
  color: var(--wine-bright); font-size: 15px; text-align: center;
}
.house-fact .fact-label { margin-bottom: 3px; }
/* O horário vem escrito pela casa num campo livre; sem isto, "Ter-Sáb 10-19\n
   Dom fechado" colapsava numa linha só. */
.house-fact div > div:last-child { white-space: pre-line; }

/* Contactos a toda a largura útil do cartão para paridade com o resto da app. */
.house-contacts { display: grid; grid-template-columns: 1fr; gap: 8px; }
.house-contacts .btn { min-height: 48px; font-size: 14px; padding: 10px 12px; }
/* Um telefone longo ou um email não podem esticar o cartão para fora do ecrã. */
.house-contacts .btn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Navegador antigo sem color-mix: o degradê cai para nada e fica só a borda.
   Aceitável -- perde-se a cor da casa, não se perde informação nenhuma. */
@supports not (background: color-mix(in srgb, red 10%, transparent)) {
  .house-hero { background: var(--bg-card); }
}

/* A folha de QR das mesas NÃO se estiliza aqui (é do painel, regras no <style>
 * do `src/index.tsx`). O antigo bloco @media print era estilo morto: quem
 * evita QR cortados é o `.qr-card { break-inside: avoid }` do index.tsx. */

/* ============================================================================
   Provas pela Cidade & Verde Cool (UI/UX Pro Max Architecture)
   ============================================================================ */

.city-search-row {
  display: flex;
  gap: var(--space-2);
  align-items: stretch;
  margin-bottom: 12px;
  width: 100%;
  height: var(--control-h);
}

.city-search-box {
  position: relative;
  flex: 1;
  display: flex;
  align-items: stretch;
  min-width: 0;
  height: 100%;
}

input#city-search-input,
input.city-search-input,
.city-search-input {
  width: 100%;
  height: 100%;
  min-height: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 0 38px 0 13px;
  background: var(--bg-input) !important;
  border: 1px solid var(--border);
  border-radius: var(--control-radius);
  font-size: 15px;
  font-family: inherit;
  color: var(--city-text) !important;
  outline: none;
  line-height: normal;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-ui), background-color var(--transition-ui), border-color var(--transition-ui);
}

input#city-search-input::placeholder,
input.city-search-input::placeholder,
.city-search-input::placeholder {
  color: var(--city-text-subtle) !important;
  opacity: 0.85;
}

input#city-search-input:focus,
input.city-search-input:focus,
.city-search-input:focus {
  outline: 3px solid var(--border-focus);
  outline-offset: 2px;
  background: var(--city-surface) !important;
  color: var(--city-text) !important;
}

.city-search-icon {
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--city-text-subtle);
  font-size: 13px;
  pointer-events: none;
  transition: color var(--transition-ui);
}

.city-search-input:focus ~ .city-search-icon,
.city-search-box:focus-within .city-search-icon {
  color: var(--city-primary);
}

/* Botão de Favoritos */
.city-fav-btn {
  width: var(--control-h);
  height: 100%;
  min-width: var(--control-h);
  max-width: var(--control-h);
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--control-radius);
  background: var(--city-surface);
  color: var(--city-fav-inactive-color);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
  transition: background var(--transition-ui), color var(--transition-ui), box-shadow var(--transition-ui), border-color var(--transition-ui);
}

.city-fav-btn:hover {
  color: #fbbf24;
  border-color: var(--border-hover);
}

.city-fav-btn:active {
  transform: scale(0.96);
}

.city-fav-btn.is-active {
  background: var(--city-fav-active-bg);
  color: var(--city-fav-active-color);
  border-color: var(--city-fav-active-color);
  box-shadow: var(--shadow-sm);
}

.city-fav-btn:focus-visible {
  outline: 3px solid var(--border-focus);
  outline-offset: 2px;
}

/* Barra de Chips de Filtro — Grelha Ergonómica (44px, 2 colunas em mobile, 4 em >=560px) */
.city-filter-chips {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  margin-bottom: 14px;
}
@media (min-width: 560px) {
  .city-filter-chips {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.city-filter-chip,
.city-filter-select {
  min-width: 0;
  min-height: 44px;
  height: 44px;
  padding: 6px 10px;
  white-space: nowrap;
  border-radius: var(--control-radius);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--city-surface);
  color: var(--city-text-muted);
  box-sizing: border-box;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-ui);
}

.city-filter-chip:hover,
.city-filter-select:hover {
  color: var(--city-text);
}

.city-filter-chip:active,
.city-filter-select:active {
  transform: scale(0.97);
}

.city-filter-chip.is-active,
.city-filter-select.is-active {
  background: var(--city-primary);
  color: var(--text-inverse);
  box-shadow: var(--shadow-sm);
}

.city-filter-select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='4' viewBox='0 0 7 4'%3E%3Cpath fill='%2375636c' d='M0 0l3.5 3.5 3.5-3.5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 4px center;
  background-size: 7px 4px;
  padding-right: 13px !important;
  padding-left: 4px !important;
  outline: none;
}

.city-filter-select.is-active {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='4' viewBox='0 0 7 4'%3E%3Cpath fill='%23ffffff' d='M0 0l3.5 3.5 3.5-3.5z'/%3E%3C/svg%3E");
}

/* Botão inline de limpar filtros quando vazio */
#btn-reset-filters-inline {
  flex: none !important;
  padding: 8px 18px !important;
  height: auto !important;
  min-height: 40px !important;
}

/* Alternador de Vista (Lista vs Mapa) */
.city-view-toggle {
  display: flex;
  background: var(--bg-card-hi);
  border-radius: var(--control-radius);
  padding: 3px;
  margin-bottom: 16px;
  height: var(--control-h);
  box-sizing: border-box;
}

.city-view-toggle-btn {
  flex: 1;
  height: 100%;
  min-height: 100%;
  padding: 6px 12px;
  border-radius: var(--control-radius);
  font-size: 12.5px;
  font-weight: 700;
  font-family: inherit;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  color: var(--city-text-muted);
  transition: all var(--transition-ui);
}

.city-view-toggle-btn.is-active {
  background: var(--city-surface);
  color: var(--city-primary);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* Lista e Cartões de Espaços — Superfície com Contorno Nítido */
.spots-list, .city-events-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.spot-card {
  background: var(--city-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--card-radius);
  padding: 12px;
  display: flex;
  gap: 12px;
  position: relative;
  box-shadow: var(--city-card-shadow);
  cursor: pointer;
  margin-bottom: 0;
  transition: transform var(--transition-ui), box-shadow var(--transition-ui), border-color var(--transition-ui);
}

.spot-card:hover {
  box-shadow: var(--city-card-hover-shadow);
  border-color: var(--border);
  transform: translateY(-2px);
}

.spot-card:active {
  transform: scale(0.985);
}

/* Interior do cartão de espaço. Estava em ~25 atributos `style=""` inline, com
 * cores de estado fixas (#15803d/#9ca3af) e um overlay `rgba()` à mão; passou
 * a classes para o tema poder mudar num sítio só. */
.spot-thumb {
  position: relative; width: 92px; height: 92px; flex-shrink: 0;
  border-radius: var(--control-radius); overflow: hidden; background: var(--bg-card-hi);
}
.spot-thumb picture, .spot-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* Foto principal do espaço (vinho + tapa): 4:3 em mobile, mais alta mas controlada em desktop. */
.spot-hero-photo {
  position: relative; width: 100%;
  aspect-ratio: 4 / 3; height: auto;
  border-radius: var(--card-radius); overflow: hidden;
  margin-bottom: 14px; box-shadow: var(--city-card-shadow);
  background: var(--bg-card-hi);
}
.spot-hero-photo picture,
.spot-hero-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.spot-thumb-num {
  position: absolute; top: 5px; left: 5px; z-index: 2;
  background: rgba(20, 12, 18, .85); color: #fff;
  font-size: 10.5px; font-weight: 800; padding: 2px 6px;
  border-radius: var(--badge-radius); line-height: 1;
}
.spot-thumb-stamp {
  position: absolute; inset: 0; z-index: 3;
  background: color-mix(in srgb, var(--wine) 78%, transparent);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 20px;
}
.spot-body { flex: 1; min-width: 0; }
.spot-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; margin-bottom: 4px; }
.spot-name {
  font-weight: 700; font-size: 14.5px; color: var(--text); min-width: 0;
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.spot-name-num {
  background: var(--bg-card-hi); color: var(--gold);
  font-weight: 800; font-size: 12px; padding: 1px 6px;
  border-radius: var(--badge-radius); flex-shrink: 0;
}
.spot-fav {
  background: none; border: none; padding: 0; cursor: pointer;
  min-width: 44px; min-height: 44px; margin: -8px -8px -8px 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px; color: var(--text-faint); transition: transform .15s ease;
}
.spot-fav.on { color: #fbbf24; }
.spot-addr {
  font-size: 12px; color: var(--text-dim); margin: 0 0 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.spot-line {
  font-size: 12.5px; color: var(--gold); font-weight: 700; margin: 0 0 4px;
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.spot-line-wine { font-size: 12.5px; color: var(--text); font-weight: 400; }
.spot-foot {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 4px 8px; margin-top: 6px; font-size: 12px;
}
.spot-status { font-weight: 600; line-height: 1.3; color: var(--text-faint); }
.spot-status.open { color: var(--green, #15803d); }
.spot-price { font-weight: 700; color: var(--text); }
.spot-foot-right { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-shrink: 0; }

/* Estado Vazio de Pesquisa */
.city-empty-state {
  background: var(--city-surface);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
  border-radius: var(--card-radius);
  padding: 36px 20px;
  text-align: center;
  color: var(--city-text-muted);
  margin-bottom: 24px;
}

.city-empty-state-icon {
  font-size: 34px;
  color: var(--city-text-subtle);
  margin-bottom: 12px;
}

.city-empty-state-title {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--city-text);
  margin-bottom: 6px;
}

.city-empty-state-desc {
  font-size: 13px;
  color: var(--city-text-muted);
  margin-bottom: 16px;
}

/* ============================================================================
   Passaporte Enológico de Degustação (Hero Card & Widget)
   ============================================================================ */
.passport-widget {
  background: var(--city-surface);
  color: var(--city-text);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  padding: 18px 20px;
  margin-bottom: 20px;
  box-shadow: var(--city-card-shadow);
  cursor: pointer;
  transition: transform var(--transition-ui), box-shadow var(--transition-ui), border-color var(--transition-ui);
}

.passport-widget:hover {
  box-shadow: var(--city-card-hover-shadow);
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.passport-widget:active {
  transform: scale(0.99);
}

.passport-widget-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--control-radius);
  background: var(--bg-card-hi);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  font-size: 19px;
  flex-shrink: 0;
}

.passport-widget-super {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold);
  font-weight: 800;
  line-height: 1.1;
}

.passport-widget-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--city-text);
  letter-spacing: -0.01em;
  margin-top: 3px;
  line-height: 1.25;
}

.passport-widget-count {
  font-size: 20px;
  font-weight: 800;
  color: var(--gold);
  font-family: var(--font-display, inherit);
  line-height: 1;
}

.passport-widget-total {
  font-size: 12px;
  font-weight: 600;
  color: var(--city-text-muted);
  font-family: var(--font-body, inherit);
}

.passport-widget-track {
  background: var(--bg-card-hi);
  border-radius: 9999px;
  height: 8px;
  overflow: hidden;
  margin: 14px 0 10px;
}

.passport-widget-fill {
  background: var(--gold);
  height: 100%;
  border-radius: 9999px;
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.passport-widget-meta {
  font-size: 12px;
  color: var(--city-text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.passport-widget-spots-count {
  font-weight: 700;
  color: var(--city-text);
  margin-left: auto;
}

.passport-widget-actions {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ============================================================================
   BANNER DE PRIVACIDADE & COOKIES (RGPD / ePrivacy)
   ============================================================================ */
.privacy-banner {
  position: fixed;
  bottom: 16px;
  left: 16px;
  right: 16px;
  max-width: 680px;
  margin: 0 auto;
  z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: var(--shadow-md);
  animation: privacySlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes privacySlideUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.privacy-banner-closing {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Com barra inferior, o aviso de privacidade tem de subir acima dela --
 * de outra forma a barra ficava por baixo do aviso e os últimos tabs
 * (Ler / Provar / Eventos) deixavam de ser tocáveis. */
body.has-tabbar .privacy-banner {
  bottom: calc(76px + var(--safe-b) + 8px);
}

.privacy-banner-content {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
}

.privacy-banner-icon {
  font-size: 22px;
  color: var(--gold, #d4af37);
  flex-shrink: 0;
}

.privacy-banner-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-dim, #d8ccd2);
}

.privacy-banner-link {
  color: var(--gold, #d4af37);
  text-decoration: underline;
  font-weight: 600;
  margin-left: 4px;
  display: inline-block;
}

.privacy-banner-link:hover {
  color: var(--gold-light, #f5dfad);
}

.privacy-banner-btn {
  background: var(--wine);
  color: #ffffff;
  border: 1px solid var(--wine-light);
  padding: 10px 20px;
  border-radius: var(--control-radius);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.privacy-banner-btn:hover {
  background: var(--wine-light);
  border-color: var(--wine-bright);
  transform: translateY(-1px);
}

@media (max-width: 640px) {
  .privacy-banner {
    flex-direction: column;
    align-items: stretch;
    bottom: 12px;
    left: 12px;
    right: 12px;
    padding: 14px;
    gap: 12px;
  }
  .privacy-banner-btn {
    width: 100%;
    padding: 12px;
    text-align: center;
  }
}

/* ============================================================================
   Certificado Oficial de Mérito do Passaporte (Verde Cool & Festivais Urbanos)
   ============================================================================ */

.certificate-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(12, 7, 10, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
  animation: fadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.certificate-frame {
  position: relative;
  background: var(--bg-card);
  border: none;
  box-shadow: var(--shadow-md);
  border-radius: var(--card-radius);
  max-width: 540px;
  width: 100%;
  padding: 24px 20px;
  text-align: center;
  color: var(--text);
  margin: auto;
  box-sizing: border-box;
}

.certificate-inner-border {
  border: none;
  background: var(--bg-card-hi);
  border-radius: var(--card-radius);
  padding: 22px 18px;
  position: relative;
}

.certificate-crest {
  width: 58px;
  height: 58px;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-card);
  border: none;
  box-shadow: var(--shadow-sm);
  color: var(--gold);
}

.certificate-crest i {
  font-size: 26px;
  color: var(--gold);
}

.certificate-supertitle {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 6px;
}

.certificate-title {
  font-family: var(--font-display, Georgia, serif);
  font-size: 22px;
  font-weight: 800;
  line-height: 1.25;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}

.certificate-subtitle {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.certificate-recipient-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.certificate-recipient-name {
  font-family: var(--font-display, Georgia, serif);
  font-size: 20px;
  font-weight: 800;
  color: var(--gold);
  padding: 6px 10px;
  border-bottom: 2px solid var(--gold);
  margin: 0 auto 14px;
  max-width: 340px;
  word-break: break-word;
}

.certificate-text {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 18px;
}

.certificate-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: var(--bg-card);
  border: none;
  border-radius: var(--control-radius);
  padding: 12px 14px;
  margin-bottom: 18px;
  text-align: left;
}

.certificate-meta-item .label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.08em;
}

.certificate-meta-item .value {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  margin-top: 2px;
}

.certificate-modal-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 16px;
}

/* Modal do Passaporte Oficial com Provas e Carimbos */
.passport-modal-card {
  position: relative;
  background: var(--bg-card);
  border: none;
  box-shadow: var(--shadow-md);
  border-radius: var(--card-radius);
  max-width: 580px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  padding: 24px 20px;
  color: var(--text);
  margin: auto;
  box-sizing: border-box;
}

.passport-stamp-item {
  background: var(--bg-card-hi);
  border: none;
  border-radius: var(--control-radius);
  padding: 14px 16px;
  margin-bottom: 12px;
  transition: background-color var(--transition-ui);
  color: var(--text);
}

.passport-stamp-item:hover {
  background: var(--bg-card-hover);
}

.passport-empty-item {
  background: var(--bg-card-hi);
  border: none;
  border-radius: var(--control-radius);
  padding: 10px 12px;
  margin-bottom: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-dim);
  font-size: 12px;
}

/* Regras de Impressão & Exportação PDF */
@media print {
  @page {
    size: A4 portrait;
    margin: 1.2cm;
  }
  html, body {
    background: #ffffff !important;
    background-image: none !important;
    color: #111827 !important;
    margin: 0 !important;
    padding: 0 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  #app, .bottom-nav, .toast, .privacy-banner, .certificate-modal-actions, .skip-link, .offline-badge, .certificate-name-edit {
    display: none !important;
  }
  .certificate-modal-backdrop {
    position: static !important;
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    padding: 0 !important;
    display: block !important;
    width: 100% !important;
  }
  .certificate-frame {
    display: block !important;
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 auto !important;
    border: 3px double #946c00 !important;
    background: #ffffff !important;
    color: #111827 !important;
    box-shadow: none !important;
    padding: 30px !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
  .certificate-inner-border {
    border: 1.5px solid #946c00 !important;
    padding: 24px !important;
  }
  .certificate-crest {
    border-color: #946c00 !important;
    background: #fdfaf0 !important;
  }
  .certificate-crest i {
    color: #946c00 !important;
  }
  .certificate-supertitle {
    color: #946c00 !important;
  }
  .certificate-title {
    color: #111827 !important;
  }
  .certificate-subtitle {
    color: #4b5563 !important;
  }
  .certificate-recipient-name {
    color: #111827 !important;
    border-bottom: 2px solid #946c00 !important;
  }
  .certificate-text {
    color: #374151 !important;
  }
  .certificate-meta-grid {
    background: #f9fafb !important;
    border: 1px solid #d1d5db !important;
  }
  .certificate-meta-item .label {
    color: #6b7280 !important;
  }
  .certificate-meta-item .value {
    color: #111827 !important;
  }
}

/* Onboarding & Form Resilience Additions */
.auth-inline-error {
  display: none;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid var(--red-error);
  border-radius: var(--control-radius);
  color: var(--red-error);
  padding: 10px 14px;
  font-size: 13.5px;
  margin-bottom: 14px;
  line-height: 1.4;
  align-items: center;
  gap: 10px;
}
.auth-inline-error.show {
  display: flex;
}
.inapp-webview-banner {
  background: rgba(212, 175, 55, 0.15);
  border: 1px solid var(--gold);
  border-radius: var(--card-radius);
  padding: 12px 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
}
.inapp-webview-banner i {
  color: var(--gold);
  font-size: 18px;
  margin-top: 2px;
}
.pwa-install-banner {
  background: var(--bg-card-hi);
  border: none;
  border-radius: var(--card-radius);
  padding: 12px 16px;
  margin: 12px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}
/* O botão de instalar não pode herdar o `width:100%` do `.btn` dentro de um
 * flex: tomava a largura toda e espremia o texto para uma palavra por linha. */
.pwa-install-banner > .btn { width: auto; flex: 0 0 auto; }

/* Acessibilidade & Leitores de Ecrã (WCAG 2.2 AA) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}




/* ======================================================================
 * NAVEGAÇÃO PRINCIPAL (tab bar inferior em mobile, dock centrado em desktop)
 * ====================================================================== */
.tab-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  padding-bottom: var(--safe-b);
}
.tab-item {
  flex: 1;
  min-height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: 0;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 4px;
  transition: color var(--transition-ui), background-color var(--transition-ui);
}
.tab-item:hover { color: var(--text); }
.tab-item .tab-icon { font-size: 18px; line-height: 1; }
.tab-item.is-active { color: var(--gold); }
.tab-item:focus-visible {
  outline: 3px solid var(--border-focus);
  outline-offset: -3px;
  border-radius: 8px;
}
body.has-tabbar .screen { padding-bottom: calc(84px + var(--safe-b)); }

/* Botão de tema claro/escuro partilhado (`theme.js` / `ui.js`) */
.theme-toggle-btn {
  min-width: 44px; min-height: 44px; padding: 8px 12px;
  border-radius: var(--control-radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  font-family: inherit; font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  cursor: pointer; flex-shrink: 0;
  transition: background-color var(--transition-ui), color var(--transition-ui), border-color var(--transition-ui);
}
.theme-toggle-btn:hover { background: var(--bg-card-hover); color: var(--gold); border-color: var(--border-hover); }
.theme-toggle-btn:focus-visible { outline: 3px solid var(--border-focus); outline-offset: 2px; }
@media (max-width: 420px) {
  .nav-theme-toggle .theme-toggle-label { display: none; }
}

/* Utilitários ligeiros usados nos templates SPA */
.mr-1 { margin-right: 4px; }
.mr-1\.5 { margin-right: 6px; }
.mr-2 { margin-right: 8px; }
.py-8 { padding-top: 32px; padding-bottom: 32px; }
.py-10 { padding-top: 40px; padding-bottom: 40px; }
.py-12 { padding-top: 48px; padding-bottom: 48px; }
.text-wine { color: var(--wine-bright); }
.text-amber-400 { color: var(--gold); }

/* --- O LIVRO --- */
.book-filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  margin-bottom: 6px;
  -webkit-overflow-scrolling: touch;
}
.book-filters .city-filter-chip { flex: 0 0 auto; padding: 8px 14px; }
.book-entry-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.book-situation {
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.book-when { font-size: 12px; color: var(--text-dim); }
.book-note {
  margin-top: 8px;
  font-size: 13.5px;
  color: var(--text-dim);
  font-style: italic;
}
.book-links {
  display: flex;
  gap: 14px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.book-wine-link {
  color: var(--gold);
  font-size: 13px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Foco visível dos controlos de filtro da cidade (WCAG 2.4.11/1.4.11). */
.city-filter-select:focus-visible,
.city-filter-chip:focus-visible {
  outline: 3px solid var(--border-focus);
  outline-offset: 2px;
}

/* Adaptação Responsiva 2026: Mobile 720p/1080p -> Tablet -> Desktop >= 1440×900 */
@media (min-width: 900px) {
  .screen {
    max-width: 980px;
    padding: 28px 32px 104px;
  }
  body.has-tabbar .screen {
    padding-bottom: calc(104px + var(--safe-b));
  }
  .gate {
    max-width: 980px;
    padding: 28px 32px 56px;
  }
  .site-footer-inner {
    max-width: 980px;
  }
  .row-banner {
    aspect-ratio: auto;
    height: 215px;
  }
  .spot-hero-photo {
    aspect-ratio: auto;
    height: 290px;
  }
  .spot-hero-photo img {
    object-position: center 68%;
  }
  .spot-thumb {
    width: 112px;
    height: 112px;
  }
  .spots-list,
  .city-events-list,
  #dir-list:not(:has(.empty-state)):not(:has(.dir-loading)),
  .book-list-grid,
  .cellar-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
  }
  #dir-list:not(:has(.empty-state)):not(:has(.dir-loading)) > .card,
  .book-list-grid > .card,
  .cellar-grid > .card {
    margin-bottom: 0;
  }
  .tab-bar {
    left: 50%;
    right: auto;
    bottom: 16px;
    transform: translateX(-50%);
    width: min(640px, calc(100vw - 48px));
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 4px 8px;
  }
  .tab-item {
    border-radius: 12px;
    min-height: 50px;
    flex-direction: row;
    gap: 8px;
    font-size: 13px;
  }
}

@media (min-width: 1280px) {
  .screen,
  .gate,
  .site-footer-inner {
    max-width: 1180px;
  }
  .row-banner {
    height: 240px;
  }
  .spot-hero-photo {
    height: 320px;
  }
}

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

/* Rodapé público acessível */
.site-footer {
  padding: 2rem 1rem calc(2rem + var(--safe-b, 0px)) 1rem;
  background: var(--bg-card);
  border-top: 1px solid var(--border-subtle);
  color: var(--text-dim);
  text-align: center;
  font-size: 0.875rem;
}
.site-footer-inner {
  max-width: 920px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
}
.site-footer-links {
  display: flex;
  gap: 0.25rem 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}
.site-footer-sep {
  color: var(--text-faint);
  opacity: 0.5;
}
.site-footer-copy {
  margin: 0;
  color: var(--text-faint);
  font-size: 0.8125rem;
}
.site-footer a {
  color: var(--gold);
  text-decoration: none;
  font-weight: 600;
  min-height: 36px;
  padding: 6px 8px;
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
}
.site-footer a:hover {
  text-decoration: underline;
  background: var(--bg-card-hover);
}
.site-footer a:focus-visible {
  outline: 3px solid var(--border-focus);
  outline-offset: 2px;
}
body.has-tabbar .site-footer {
  padding-bottom: calc(96px + var(--safe-b, 0px)) !important;
}

