/* ==========================================================================
   Tokens — "placa esmaltada": cobalto de placa de mesa, esmalte branco,
   latão do sino de balcão. Um tema escuro para salões à noite.
   ========================================================================== */
:root {
  --bg: #F2F4F8;
  --surface: #FFFFFF;
  --surface-2: #E9EDF5;
  --ink: #0F1430;
  --ink-2: #2A3050;
  --muted: #596080;
  --line: #DCE1EC;

  --cobalt: #1B3A9E;
  --cobalt-hi: #2D52C8;
  --cobalt-lo: #112874;
  --cobalt-ink: #1B3A9E;
  --cobalt-soft: #E2E8F8;
  --enamel: #FBFBF7;

  --brass: #C9962D;
  --brass-hi: #E9C271;
  --brass-lo: #8C6416;
  --brass-soft: #F6ECD4;
  --pepper: #CF3E27;
  --pepper-soft: #FBE4DF;
  --amber: #B86E00;
  --amber-soft: #FCEED6;
  --leaf: #1B7F52;
  --leaf-soft: #DAF0E4;

  --r-lg: 22px;
  --r: 16px;
  --r-sm: 11px;
  --shadow-1: 0 1px 2px rgba(15, 20, 48, .06), 0 6px 18px -10px rgba(15, 20, 48, .22);
  --shadow-2: 0 2px 6px rgba(15, 20, 48, .08), 0 22px 48px -18px rgba(15, 20, 48, .35);

  --font-display: 'Big Shoulders Display', 'Oswald', 'Arial Narrow', Impact, sans-serif;
  --font-body: 'Schibsted Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Consolas, monospace;

  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.16, 1, .3, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #090D20;
    --surface: #111735;
    --surface-2: #19204A;
    --ink: #ECEFFA;
    --ink-2: #C9CEE6;
    --muted: #97A0C4;
    --line: #242C58;
    --cobalt-ink: #93A9FF;
    --cobalt-soft: #1A2560;
    --brass-soft: #372B12;
    --pepper: #FF6B52;
    --pepper-soft: #3E1812;
    --amber: #F0A43A;
    --amber-soft: #3A2A0E;
    --leaf: #4FD196;
    --leaf-soft: #0F3222;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 20px -12px rgba(0, 0, 0, .6);
    --shadow-2: 0 2px 6px rgba(0, 0, 0, .35), 0 24px 50px -18px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #090D20;
  --surface: #111735;
  --surface-2: #19204A;
  --ink: #ECEFFA;
  --ink-2: #C9CEE6;
  --muted: #97A0C4;
  --line: #242C58;
  --cobalt-ink: #93A9FF;
  --cobalt-soft: #1A2560;
  --brass-soft: #372B12;
  --pepper: #FF6B52;
  --pepper-soft: #3E1812;
  --amber: #F0A43A;
  --amber-soft: #3A2A0E;
  --leaf: #4FD196;
  --leaf-soft: #0F3222;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 20px -12px rgba(0, 0, 0, .6);
  --shadow-2: 0 2px 6px rgba(0, 0, 0, .35), 0 24px 50px -18px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html.is-locked, html.is-locked body { overflow: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, h4, p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; }
img, svg { display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--cobalt-hi); outline-offset: 2px; border-radius: 6px; }

.i { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Placa esmaltada (assinatura visual) ---------- */
.plate {
  --edge: 7px;
  position: relative;
  isolation: isolate;
  color: var(--enamel);
  background:
    radial-gradient(130% 110% at 18% -10%, var(--cobalt-hi) 0%, var(--cobalt) 48%, var(--cobalt-lo) 100%);
  border-radius: var(--r-lg);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .28),
    inset 0 -2px 0 rgba(0, 0, 0, .25),
    0 1px 1px rgba(10, 20, 70, .3),
    0 18px 40px -20px rgba(17, 40, 116, .75);
}
/* filete de esmalte branco, como nas placas de rua */
.plate::before {
  content: '';
  position: absolute;
  inset: var(--edge);
  border: 2px solid rgba(251, 251, 247, .92);
  border-radius: calc(var(--r-lg) - var(--edge));
  pointer-events: none;
  z-index: -1;
}
/* brilho do vidro esmaltado */
.plate::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(160deg, rgba(255, 255, 255, .18) 0%, rgba(255, 255, 255, 0) 38%);
  pointer-events: none;
}
.rivet {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #FFFFFF 0%, #C4C9DC 40%, #666E92 100%);
  box-shadow: 0 1px 1px rgba(0, 0, 0, .35);
}

/* ---------- Botões ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5em;
  min-height: 48px;
  padding: 0 1.15em;
  border-radius: 999px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: .005em;
  text-decoration: none;
  transition: transform .15s var(--ease), background-color .2s, box-shadow .2s, opacity .2s;
  -webkit-user-select: none;
  user-select: none;
}
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-cobalt { background: var(--cobalt); color: var(--enamel); box-shadow: 0 8px 20px -10px rgba(27, 58, 158, .8); }
.btn-quiet { background: var(--surface-2); color: var(--ink); }
.btn-line { border: 1.5px solid var(--line); color: var(--ink); background: var(--surface); }
.btn-danger { background: var(--pepper-soft); color: var(--pepper); }
.btn-block { width: 100%; }
.btn-sm { min-height: 38px; font-size: 14px; padding: 0 .95em; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--ink);
  background: var(--surface-2);
  transition: transform .15s var(--ease), background-color .2s;
}
.icon-btn:active { transform: scale(.94); }
.icon-btn .i { width: 20px; height: 20px; }

/* ---------- Chips / seleção ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: .4em;
  min-height: 40px;
  padding: 0 1em;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  font-size: 14.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color .2s, color .2s, border-color .2s, transform .15s var(--ease);
}
.chip:active { transform: scale(.96); }
.chip[aria-checked="true"], .chip[aria-pressed="true"], .chip.is-on {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: var(--surface-2);
}
.seg button {
  min-height: 40px;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--muted);
  transition: background-color .2s, color .2s;
}
.seg button[aria-checked="true"], .seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }

/* ---------- Campos ---------- */
.field { display: grid; gap: 6px; }
.field > span, .label { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .01em; }
.input, .textarea {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  font-size: 16px; /* evita zoom no iOS */
  transition: border-color .2s, box-shadow .2s;
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.45; }
.input:focus, .textarea:focus { outline: none; border-color: var(--cobalt-hi); box-shadow: 0 0 0 4px color-mix(in srgb, var(--cobalt-hi) 18%, transparent); }

/* ---------- Folhas (bottom sheets) ---------- */
.sheet { position: fixed; inset: 0; z-index: 60; display: grid; grid-template-columns: minmax(0, 1fr); align-items: end; justify-items: center; }
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 11, 30, .5);
  opacity: 0;
  transition: opacity .3s var(--ease);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.sheet.is-open .sheet-backdrop { opacity: 1; }
.sheet-panel {
  position: relative;
  width: min(100%, 560px);
  max-height: calc(100dvh - 24px - var(--safe-t));
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-radius: 26px 26px 0 0;
  box-shadow: var(--shadow-2);
  transform: translateY(104%);
  transition: transform .42s cubic-bezier(.22, 1, .36, 1);
  outline: none;
}
.sheet.is-open .sheet-panel { transform: translateY(0); }
.sheet-grip { display: grid; place-items: center; height: 22px; flex: none; cursor: grab; touch-action: none; }
.sheet-grip::before { content: ''; width: 40px; height: 5px; border-radius: 3px; background: var(--line); }
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 20px 12px;
  flex: none;
  touch-action: none;
}
.sheet-head h2 { font-family: var(--font-display); font-weight: 800; font-size: 30px; line-height: 1; text-transform: uppercase; letter-spacing: .01em; }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 4px 20px calc(24px + var(--safe-b)); -webkit-overflow-scrolling: touch; }

@media (min-width: 700px) {
  .sheet { align-items: center; padding: 24px; }
  .sheet-panel { border-radius: 26px; transform: translateY(24px) scale(.98); opacity: 0; transition: transform .35s var(--ease), opacity .25s; }
  .sheet.is-open .sheet-panel { transform: none; opacity: 1; }
  .sheet-grip { visibility: hidden; height: 14px; }
}

/* ---------- Toasts ---------- */
.toasts {
  position: fixed;
  left: 50%;
  bottom: calc(18px + var(--safe-b));
  transform: translateX(-50%);
  z-index: 90;
  display: grid;
  gap: 8px;
  width: min(92vw, 420px);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border-radius: 16px;
  background: var(--ink);
  color: var(--bg);
  font-size: 14.5px;
  font-weight: 500;
  box-shadow: var(--shadow-2);
  transform: translateY(14px);
  opacity: 0;
  transition: transform .35s var(--spring), opacity .25s;
  pointer-events: auto;
}
.toast.in { transform: none; opacity: 1; }
.toast--error { background: var(--pepper); color: #fff; }
.toast--ok { background: var(--leaf); color: #fff; }
.toast button { font-weight: 700; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- Endereço sem restaurante ---------- */
.sem-rest { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 12px; padding: 24px 16px; text-align: center; }
.sem-rest h1 { font-family: var(--font-display); font-weight: 900; font-size: 32px; text-transform: uppercase; line-height: 1; }
.sem-rest p { max-width: 36ch; color: var(--muted); }
.sem-rest-ico { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--cobalt-soft); color: var(--cobalt-ink); }
.sem-rest-ico .i { width: 30px; height: 30px; }
