/* ============================================================
   Spaten Tisch — painel de hostess
   Identidade: vintage-bávaro claro (Key Visual Spaten).
   Creme + menta/teal + vermelho Spaten. Tablet-first,
   responsivo (landscape sidebar ↔ portrait bottom-nav), sem build.
   ============================================================ */

:root {
  --cream: #F4EAD7;
  --cream-2: #EADDC6;
  --paper: #FBF6EC;
  --paper-card: #FFFDF8;

  --mint: #8FD4C7;
  --mint-2: #BEE6DD;
  --mint-soft: #DBF0EB;

  --teal: #4E9AA0;
  --teal-deep: #37767C;
  --teal-ink: #2A5C61;

  --red: #DC241F;
  --red-deep: #B4160F;
  --red-soft: #FBE4E2;

  --ink: #1C1B19;
  --ink-soft: #5B5853;
  --ink-faint: #908C84;

  --line: #E0D3BD;
  --line-soft: #EADFCC;

  --shadow: 0 1px 2px rgba(28, 27, 25, 0.05), 0 8px 24px rgba(28, 27, 25, 0.07);
  --shadow-lg: 0 12px 40px rgba(28, 27, 25, 0.16);

  --radius: 18px;
  --radius-sm: 12px;
  --tap: 48px;

  --rail-w: 104px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --display: Oswald, var(--sans);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; height: 100%; }

body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--cream);
  background-image: repeating-conic-gradient(from 45deg at 50% 50%,
      var(--cream) 0deg 90deg, var(--cream-2) 90deg 180deg);
  background-size: 56px 56px;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  touch-action: manipulation;
  user-select: none;
}

input, textarea, select { user-select: text; }
.hidden { display: none !important; }

/* wordmark da marca */
.wordmark {
  font-family: "UnifrakturCook", serif;
  line-height: 1;
  color: inherit;
}
.wordmark small {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: lowercase;
}

/* ============================================================
   LOGIN / TROCA DE SENHA
   ============================================================ */
.auth-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(24px + var(--safe-top)) 20px calc(24px + var(--safe-bottom));
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 30px 26px 26px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.auth-brand { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; margin-bottom: 8px; }
.auth-crest { width: 74px; height: auto; filter: drop-shadow(0 3px 8px rgba(28,27,25,0.18)); }
.auth-brand .wordmark { font-size: 26px; }
.auth-brand .wordmark small { font-size: 20px; letter-spacing: 3px; display: inline; margin-left: 3px; }
.auth-sub { margin: 2px 0 0; font-size: 13px; color: var(--ink-faint); font-weight: 500; }
.auth-card label {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 13px; color: var(--ink-soft); font-weight: 600;
}

input[type="email"], input[type="password"], input[type="text"],
input[type="date"], input[type="number"], input[type="tel"], input[type="search"] {
  width: 100%;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  font-size: 16px; /* >=16px evita zoom no iOS */
  font-family: var(--sans);
  min-height: var(--tap);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(78, 154, 160, 0.2);
}
.erro { color: var(--red-deep); font-size: 13.5px; min-height: 18px; margin: 2px 0 0; font-weight: 600; }

/* ============================================================
   BOTÕES
   ============================================================ */
.btn {
  appearance: none;
  border: 1.5px solid transparent;
  border-radius: 999px;
  padding: 0 20px;
  min-height: var(--tap);
  font-family: var(--display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.4px;
  color: var(--ink);
  background: var(--cream-2);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform 0.06s, filter 0.15s, background 0.15s, opacity 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-lg { min-height: 54px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--red); color: #fff; box-shadow: 0 6px 16px rgba(220, 36, 31, 0.28); }
.btn-primary:hover { background: var(--red-deep); }
.btn-outline { background: transparent; border-color: var(--line); color: var(--ink-soft); }
.btn-outline:hover { background: var(--paper); }
.btn-ghost { background: transparent; color: var(--ink-faint); border-color: transparent; }
.btn-success { background: var(--teal); color: #fff; }
.btn-success:hover { background: var(--teal-deep); }
.btn-danger { background: var(--red-soft); color: var(--red-deep); border-color: #f2c4c1; }
.btn-icon { min-width: var(--tap); padding: 0; font-size: 22px; background: transparent; color: var(--ink-soft); border-color: transparent; }
.btn-icon:hover { background: var(--paper); }
.btn .spin { width: 16px; height: 16px; }

/* ============================================================
   SHELL (sidebar + main)
   ============================================================ */
#app-screen { height: 100dvh; }
.app { display: flex; height: 100dvh; overflow: hidden; }

/* --- Sidebar (landscape) --- */
.rail {
  width: var(--rail-w); flex: 0 0 var(--rail-w);
  background: var(--teal-deep); color: #fff;
  display: flex; flex-direction: column; align-items: center;
  padding: calc(16px + var(--safe-top)) 10px calc(14px + var(--safe-bottom));
  gap: 8px; position: relative; overflow: hidden;
}
.rail::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: repeating-conic-gradient(from 45deg at 50% 50%,
    rgba(255, 255, 255, 0.05) 0deg 90deg, rgba(255, 255, 255, 0) 90deg 180deg);
  background-size: 46px 46px;
}
.rail-crest { width: 56px; height: auto; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.25)); position: relative; }
.rail-wordmark { font-size: 15px; text-align: center; position: relative; }
.rail-wordmark small { display: block; font-size: 16px; letter-spacing: 3px; margin-top: 2px; }
.rail-nav { display: flex; flex-direction: column; gap: 6px; width: 100%; margin-top: 14px; position: relative; }
.rail-spacer { flex: 1; }
.rail-me {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: transparent; border: 0; cursor: pointer; padding: 6px; border-radius: 14px; color: inherit;
}
.rail-me:hover { background: rgba(255, 255, 255, 0.08); }
.avatar {
  width: 46px; height: 46px; border-radius: 50%; background: var(--mint); color: var(--teal-ink);
  display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 18px;
}
.rail-me-role { font-size: 10.5px; color: rgba(255, 255, 255, 0.72); text-transform: capitalize; }

/* nav items (shared rail + botnav) */
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 12px 4px; border-radius: 14px; text-decoration: none;
  color: rgba(255, 255, 255, 0.72); font-size: 11px; font-weight: 600; letter-spacing: 0.2px;
  transition: 0.15s; cursor: pointer;
}
.nav-item svg { width: 26px; height: 26px; }
.rail-nav .nav-item.active { background: var(--mint); color: var(--teal-ink); }
.rail-nav .nav-item:not(.active):hover { background: rgba(255, 255, 255, 0.1); color: #fff; }

/* --- Main --- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: calc(16px + var(--safe-top)) calc(24px + var(--safe-right)) 14px calc(24px + var(--safe-left));
  background: var(--paper); border-bottom: 1px solid var(--line);
}
.brandmini { display: none; align-items: center; gap: 9px; }
.crest-mini { width: 34px; height: auto; }
.brandmini .wordmark { font-size: 17px; }
.brandmini .wordmark small { font-size: 15px; margin-left: 2px; }
.page-title { font-family: var(--display); font-weight: 600; font-size: 25px; margin: 0; letter-spacing: 0.3px; line-height: 1.05; }
.page-sub { display: block; font-family: var(--sans); font-weight: 600; font-size: 12px; color: var(--ink-faint); letter-spacing: 0.4px; text-transform: uppercase; margin-top: 2px; }

.datestep { display: flex; align-items: center; gap: 2px; background: var(--paper-card); border: 1px solid var(--line); border-radius: 999px; padding: 4px 6px; }
.datestep button { border: 0; background: transparent; width: 34px; height: 34px; border-radius: 50%; font-size: 20px; line-height: 1; color: var(--ink-soft); cursor: pointer; display: grid; place-items: center; }
.datestep button:hover { background: var(--mint-soft); }
.datestep input[type="date"] {
  min-height: 34px; padding: 4px 8px; font-size: 14px; width: auto; background: transparent;
  border: 0; font-family: var(--display); font-weight: 600; color: var(--ink); color-scheme: light;
}
.topbar .grow { flex: 1; }
.user-chip { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-soft); max-width: 24vw; overflow: hidden; }
#user-nome { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.role-badge { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; background: var(--mint); color: var(--teal-ink); padding: 3px 8px; border-radius: 999px; }

.main-scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; min-height: 0; }
.tab-content { display: none; flex: 1; flex-direction: column; min-height: 0; animation: fade 0.18s ease; }
.tab-content.active { display: flex; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ============================================================
   STATS STRIP
   ============================================================ */
.stats { display: flex; gap: 12px; padding: 16px 26px 4px; flex-wrap: wrap; }
.stat { flex: 1; min-width: 118px; background: var(--paper-card); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 12px 16px; box-shadow: var(--shadow); }
.stat .n { font-family: var(--display); font-weight: 700; font-size: 30px; line-height: 1; }
.stat .l { font-size: 12px; color: var(--ink-faint); margin-top: 3px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }
.stat.free .n { color: var(--ink); }
.stat.occ .n { color: var(--teal); }
.stat.late .n { color: var(--red); }
.stat.next .n { color: var(--teal-deep); }

/* ============================================================
   MAPA DE MESAS
   ============================================================ */
.floor-wrap { flex: 1; display: flex; min-height: 0; }
.floor { flex: 1; overflow-y: auto; padding: 16px 26px 96px; }
.floor-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 6px 2px 14px; }
.floor-title { font-family: var(--display); font-weight: 600; font-size: 14px; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-faint); margin: 0; }

.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-faint); font-weight: 500; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 11px; height: 11px; border-radius: 4px; display: inline-block; }
.dot-livre { background: var(--paper-card); border: 1.5px solid var(--line); }
.dot-ocupada { background: var(--mint); }
.dot-reservada { background: var(--cream-2); }
.dot-expira { background: var(--red); }

.mesas-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 14px; }

.mesa {
  position: relative; border-radius: var(--radius); padding: 16px 16px 14px; min-height: 148px;
  display: flex; flex-direction: column; text-align: left;
  border: 1.5px solid var(--line); background: var(--paper-card); box-shadow: var(--shadow);
  cursor: pointer; transition: transform 0.12s, box-shadow 0.12s; overflow: hidden;
  font-family: var(--sans); color: var(--ink); width: 100%;
}
.mesa:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.mesa:active { transform: scale(0.98); }
.mesa .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.mesa .num { font-family: var(--display); font-weight: 700; font-size: 34px; line-height: 0.9; }
.mesa .seats { font-size: 12px; color: var(--ink-faint); font-weight: 600; }
.mesa-chip { font-family: var(--display); font-weight: 600; font-size: 11.5px; letter-spacing: 0.6px; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.mesa .body { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 3px; margin-top: 10px; }
.mesa .guest { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mesa .meta { font-size: 12.5px; color: var(--ink-soft); }

/* linha com anel de countdown */
.mesa .timeline { display: flex; align-items: center; gap: 9px; margin-top: 8px; }
.ring { width: 38px; height: 38px; flex: 0 0 38px; transform: rotate(-90deg); }
.ring .track { fill: none; stroke: rgba(28, 27, 25, 0.1); stroke-width: 4; }
.ring .prog { fill: none; stroke-width: 4; stroke-linecap: round; transition: stroke-dashoffset 0.5s linear, stroke 0.3s; }
.mesa .timer { font-family: var(--display); font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.mesa .timer small { display: block; font-family: var(--sans); font-weight: 500; font-size: 10.5px; color: var(--ink-faint); letter-spacing: 0.3px; text-transform: uppercase; }

.mesa .plus { margin-top: auto; font-family: var(--display); font-weight: 600; color: var(--teal); font-size: 14px; display: flex; align-items: center; gap: 6px; }

/* estados */
.mesa.livre { background: var(--paper-card); border-color: var(--line); }
.mesa.livre .mesa-chip { background: var(--mint-soft); color: var(--teal-ink); }

.mesa.ocupada { background: linear-gradient(170deg, var(--mint-soft), var(--mint-2)); border-color: var(--mint); }
.mesa.ocupada .mesa-chip { background: var(--teal); color: #fff; }
.mesa.ocupada .timer { color: var(--teal-deep); }
.mesa.ocupada .ring .prog { stroke: var(--teal); }

.mesa.reservada { background: var(--paper-card); border-color: var(--cream-2); }
.mesa.reservada .mesa-chip { background: var(--cream-2); color: var(--ink-soft); }

.mesa.expira { background: linear-gradient(170deg, #fff, var(--red-soft)); border-color: var(--red); border-width: 2px; }
.mesa.expira .mesa-chip { background: var(--red); color: #fff; }
.mesa.expira .timer { color: var(--red-deep); }
.mesa.expira .ring .prog { stroke: var(--red); }
.mesa.expira::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); border: 2px solid var(--red); opacity: 0; animation: pulse 1.6s ease-in-out infinite; pointer-events: none; }
@keyframes pulse { 0%, 100% { opacity: 0; } 50% { opacity: 0.55; } }

/* --- Aside: próximas reservas --- */
.aside { width: 294px; flex: 0 0 294px; border-left: 1px solid var(--line); background: var(--paper); overflow-y: auto; padding: 18px 18px calc(24px + var(--safe-bottom)); }
.aside-title { font-family: var(--display); font-weight: 600; font-size: 14px; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-faint); margin: 4px 2px 14px; }
.proximas-lista { display: flex; flex-direction: column; gap: 10px; }
.prox {
  display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: var(--radius-sm);
  background: var(--paper-card); border: 1px solid var(--line-soft); box-shadow: var(--shadow);
  cursor: pointer; transition: transform 0.1s, box-shadow 0.1s; width: 100%; text-align: left; font-family: var(--sans);
}
.prox:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.prox .time { font-family: var(--display); font-weight: 700; font-size: 18px; color: var(--teal-deep); width: 50px; text-align: center; flex: 0 0 50px; }
.prox .info { flex: 1; min-width: 0; }
.prox .info b { font-size: 14.5px; font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prox .info span { display: block; font-size: 12px; color: var(--ink-faint); margin-top: 1px; }
.prox .pax { background: var(--mint-soft); color: var(--teal-ink); font-family: var(--display); font-weight: 600; font-size: 13px; padding: 4px 9px; border-radius: 999px; flex: 0 0 auto; }
.prox.soon { border-color: var(--red); background: var(--red-soft); }
.prox.soon .time { color: var(--red-deep); }

/* ============================================================
   RESERVAS
   ============================================================ */
#tab-reservas { padding: 18px calc(26px + var(--safe-right)) calc(96px + var(--safe-bottom)) calc(26px + var(--safe-left)); overflow-y: auto; }
.reservas-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.search { display: flex; align-items: center; gap: 8px; background: var(--paper-card); border: 1px solid var(--line); border-radius: 999px; padding: 0 16px; color: var(--ink-faint); flex: 1; min-width: 180px; min-height: var(--tap); }
.search input { border: 0; background: transparent; outline: 0; font-size: 15px; font-family: var(--sans); color: var(--ink); width: 100%; min-height: auto; padding: 0; }
.chip-filtros { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { background: var(--paper-card); border: 1px solid var(--line); color: var(--ink-soft); border-radius: 999px; padding: 8px 15px; font-family: var(--display); font-size: 14px; font-weight: 600; letter-spacing: 0.3px; cursor: pointer; min-height: 42px; }
.chip.active { background: var(--teal); color: #fff; border-color: var(--teal); }

.reservas-lista { display: flex; flex-direction: column; gap: 10px; }
.reserva-card { background: var(--paper-card); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 14px 18px; display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow); }
.reserva-main { flex: 1; min-width: 0; }
.reserva-nome { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reserva-meta { font-size: 12.5px; color: var(--ink-soft); margin-top: 3px; }
.reserva-actions { display: flex; gap: 8px; flex-shrink: 0; }

.status-pill { font-family: var(--display); font-size: 11.5px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; padding: 4px 11px; border-radius: 999px; white-space: nowrap; }
.status-aguardando { background: var(--cream-2); color: var(--ink-soft); }
.status-checkin { background: var(--mint-soft); color: var(--teal-ink); }
.status-encerrada { background: var(--line-soft); color: var(--ink-faint); }
.status-noshow { background: var(--red-soft); color: var(--red-deep); }

.empty { color: var(--ink-faint); font-size: 14px; text-align: center; padding: 32px 12px; }

/* ============================================================
   RESUMO
   ============================================================ */
#tab-resumo { padding: 18px calc(26px + var(--safe-right)) calc(96px + var(--safe-bottom)) calc(26px + var(--safe-left)); overflow-y: auto; }
.kpi-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.kpi { background: var(--paper-card); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 14px 18px; min-width: 112px; box-shadow: var(--shadow); }
.kpi .kpi-num { font-family: var(--display); font-size: 28px; font-weight: 700; line-height: 1; }
.kpi .kpi-label { font-size: 12px; color: var(--ink-faint); margin-top: 6px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.kpi.kpi-livre .kpi-num { color: var(--ink); }
.kpi.kpi-ocup .kpi-num { color: var(--teal); }
.kpi.kpi-atraso .kpi-num { color: var(--red); }

.atrasadas-banner { background: var(--red-soft); border: 1px solid #f2c4c1; color: var(--red-deep); border-radius: var(--radius); padding: 13px 18px; margin: 16px 26px 0; font-size: 14px; font-weight: 600; }

.blocos-grid { display: flex; flex-direction: column; gap: 16px; }
.bloco { background: var(--paper-card); border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.bloco-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 18px; background: var(--paper); border-bottom: 1px solid var(--line-soft); }
.bloco-head h3 { margin: 0; font-family: var(--display); font-weight: 600; font-size: 16px; }
.bloco-head .bloco-cap { font-size: 12.5px; color: var(--ink-soft); font-weight: 500; }

/* ============================================================
   MÉTRICAS
   ============================================================ */
#tab-metricas { padding: 18px calc(26px + var(--safe-right)) calc(96px + var(--safe-bottom)) calc(26px + var(--safe-left)); overflow-y: auto; }
.metricas-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px; }
.metrica-card { background: var(--paper-card); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.metrica-card .m-num { font-family: var(--display); font-size: 32px; font-weight: 700; color: var(--teal-deep); line-height: 1; }
.metrica-card .m-label { font-size: 13px; color: var(--ink-soft); margin-top: 8px; font-weight: 600; }
.metrica-card .m-sub { font-size: 12px; color: var(--ink-faint); margin-top: 4px; }

/* ============================================================
   FAB (walk-in)
   ============================================================ */
.fab {
  position: fixed; z-index: 45;
  right: calc(22px + var(--safe-right)); bottom: calc(22px + var(--safe-bottom));
  min-height: 56px; padding: 0 22px 0 18px; border: 0; border-radius: 999px;
  background: var(--red); color: #fff; font-family: var(--display); font-weight: 600; font-size: 15px; letter-spacing: 0.4px;
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  box-shadow: 0 10px 28px rgba(220, 36, 31, 0.4);
  transition: transform 0.08s, background 0.15s;
}
.fab:hover { background: var(--red-deep); }
.fab:active { transform: scale(0.96); }

/* ============================================================
   BOTTOM NAV (portrait) — escondido em landscape
   ============================================================ */
.botnav { display: none; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(28, 27, 25, 0.44); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade 0.15s ease; }
.modal {
  width: 100%; max-width: 480px; background: var(--paper-card); border: 1px solid var(--line);
  border-radius: 22px; padding: 24px 22px calc(22px + var(--safe-bottom)); box-shadow: var(--shadow-lg);
  animation: slideup 0.22s cubic-bezier(0.2, 0.8, 0.2, 1); max-height: 88dvh; overflow-y: auto;
}
@keyframes slideup { from { transform: translateY(24px); opacity: 0.4; } to { transform: none; opacity: 1; } }
.modal h2 { margin: 0 0 4px; font-family: var(--display); font-weight: 600; font-size: 22px; }
.modal .modal-sub { color: var(--ink-soft); font-size: 13.5px; margin: 0 0 16px; }
.modal label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-soft); font-weight: 600; margin-bottom: 14px; }
.modal-actions { display: flex; gap: 10px; margin-top: 6px; }
.modal-actions .btn { flex: 1; }

/* grade de mesas no modal de check-in */
.mesa-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 8px; margin-bottom: 16px; }
.mesa-pick { aspect-ratio: 1/1; border-radius: var(--radius-sm); border: 1.5px solid var(--line); background: var(--paper); color: var(--ink); font-family: var(--display); font-weight: 700; font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.mesa-pick.ocupada { opacity: 0.4; cursor: not-allowed; border-style: dashed; }
.mesa-pick.sel { background: var(--teal); color: #fff; border-color: var(--teal); }

/* menu popover */
.menu-pop { position: fixed; z-index: 60; background: var(--paper-card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden; min-width: 210px; }
.menu-pop button { display: block; width: 100%; text-align: left; background: transparent; border: none; color: var(--ink); padding: 14px 18px; font-size: 14.5px; font-family: var(--sans); cursor: pointer; }
.menu-pop button:hover { background: var(--paper); }
.menu-pop .sep { height: 1px; background: var(--line-soft); }

/* ============================================================
   TOASTS (+ desfazer)
   ============================================================ */
.toasts { position: fixed; z-index: 80; left: 0; right: 0; bottom: calc(16px + var(--safe-bottom)); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast {
  pointer-events: auto; background: var(--ink); color: #fff;
  border-radius: var(--radius-sm); padding: 13px 16px; font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-lg); max-width: 480px; width: 100%;
  display: flex; align-items: center; gap: 12px; animation: toastin 0.2s ease;
}
.toast .toast-msg { flex: 1; }
.toast .toast-accent { width: 4px; align-self: stretch; border-radius: 4px; background: var(--ink-faint); }
.toast.ok .toast-accent { background: var(--mint); }
.toast.err .toast-accent { background: var(--red); }
.toast.info .toast-accent { background: var(--teal); }
.toast .toast-undo { pointer-events: auto; background: transparent; border: 1px solid rgba(255, 255, 255, 0.4); color: #fff; font-family: var(--display); font-weight: 600; font-size: 13px; letter-spacing: 0.4px; padding: 7px 14px; border-radius: 999px; cursor: pointer; flex: 0 0 auto; }
.toast .toast-undo:hover { background: rgba(255, 255, 255, 0.15); }
.toast.out { animation: toastout 0.2s ease forwards; }
@keyframes toastin { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toastout { to { transform: translateY(12px); opacity: 0; } }

/* ============================================================
   BANNER DE CONEXÃO
   ============================================================ */
.conn-banner { position: fixed; z-index: 90; top: 0; left: 0; right: 0; background: var(--red); color: #fff; text-align: center; font-size: 13px; font-weight: 600; padding: calc(6px + var(--safe-top)) 10px 6px; }

/* ============================================================
   SKELETON + SPINNER
   ============================================================ */
.skeleton { background: linear-gradient(90deg, var(--paper-card) 25%, var(--cream-2) 37%, var(--paper-card) 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border-radius: var(--radius); }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.skel-row { height: 64px; margin-bottom: 10px; }

.spin { display: inline-block; width: 18px; height: 18px; border: 2px solid rgba(255, 255, 255, 0.4); border-top-color: currentColor; border-radius: 50%; animation: rot 0.7s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }

/* ============================================================
   RESPONSIVO: portrait / telas estreitas
   ============================================================ */
@media (max-width: 860px) {
  .app { flex-direction: column; }
  .rail { display: none; }
  .main { height: 100dvh; }
  .main-scroll { padding-bottom: calc(72px + var(--safe-bottom)); }

  .topbar { padding: calc(14px + var(--safe-top)) 16px 12px; flex-wrap: wrap; gap: 10px; }
  .brandmini { display: flex; }
  .page-title { font-size: 21px; order: 3; flex: 1 0 100%; }
  .datestep { order: 4; }
  .user-chip { display: none; }

  .stats { padding: 12px 16px 2px; gap: 8px; }
  .stat { min-width: calc(50% - 4px); padding: 11px 13px; }
  .stat .n { font-size: 25px; }

  .atrasadas-banner { margin: 12px 16px 0; }

  .floor-wrap { flex-direction: column; }
  .floor { padding: 14px 16px 24px; overflow: visible; }
  .mesas-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .aside { width: auto; flex: none; border-left: 0; border-top: 1px solid var(--line); overflow: visible; }

  #tab-reservas, #tab-resumo, #tab-metricas { padding: 16px 16px 24px; overflow: visible; }

  .fab { bottom: calc(84px + var(--safe-bottom)); }
  .fab .fab-label { display: none; }
  .fab { padding: 0; width: 58px; height: 58px; justify-content: center; }

  .botnav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0;
    height: calc(68px + var(--safe-bottom)); padding: 0 6px var(--safe-bottom);
    background: var(--teal-deep); z-index: 40; box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.12);
  }
  .botnav .nav-item { flex: 1; padding: 10px 4px; }
  .botnav .nav-item.active { color: #fff; }
  .botnav .nav-item.active svg { color: var(--mint); }
}

@media (max-width: 520px) {
  .mesas-grid { grid-template-columns: repeat(2, 1fr); }
  .reserva-card { flex-wrap: wrap; }
  .reserva-actions { flex: 1 0 100%; }
  .reserva-actions .btn { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
