/* ---------- tokens ---------- */
:root {
  --bg: #fbfbfa;
  --surface: #ffffff;
  --surface-2: #f5f5f3;
  --border: #ececea;
  --border-strong: #d8d8d5;
  --ink: #0a0a0a;
  --ink-2: #1f1f1d;
  --muted: #6b6b68;
  --faint: #9a9a96;
  --accent: #0a0a0a;            /* primary action = ink, Linear/Vercel style */

  /* status colors — used sparingly */
  --live: #00857a;              /* in-progress teal */
  --live-tint: #e6f3f1;
  --ok: #1f7a4d;
  --ok-tint: #e7f3ec;
  --warn: #a86600;
  --warn-tint: #fbf2e1;
  --bad: #a83232;
  --bad-tint: #faecea;

  /* type */
  --font-sans: "Geist", "Geist Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* scale (4px base) */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;

  /* shadow */
  --shadow-1: 0 1px 0 rgba(0,0,0,0.02), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-2: 0 4px 24px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
}

button { font-family: inherit; }
input, textarea { font-family: inherit; }

/* ---------- layout ---------- */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky; top: 0; z-index: 10;
}
.topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
}
.topbar .brand .mark {
  width: 22px; height: 22px;
  background: var(--ink);
  border-radius: 6px;
  display: grid; place-items: center;
  color: white;
}
.topbar .pill {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-btn {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 7px 14px;
  cursor: pointer;
  transition: background 120ms, border-color 120ms;
}
.topbar-btn:hover { background: var(--surface-2); border-color: var(--ink); }

.topbar-account {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px 4px 4px;
  cursor: pointer;
  font: inherit;
  transition: border-color 120ms, background 120ms;
}
.topbar-account:hover { border-color: var(--ink); }
.topbar-account .avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  display: grid; place-items: center;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-mono);
}
.topbar-account .account-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.1;
}
.topbar-account .account-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.topbar-account .account-email {
  font-size: 12.5px;
  color: var(--ink);
  font-weight: 500;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 540px) {
  .topbar-account .account-text { display: none; }
  .topbar-account { padding: 4px; }
  .topbar .pill { display: none; }
}

/* ---------- auth dialog ---------- */
.auth-card {
  width: min(420px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-2);
  padding: 24px;
  animation: pop 200ms cubic-bezier(.2,.9,.3,1);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.auth-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.auth-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.2;
}
.auth-sub {
  margin: -6px 0 4px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
}
.auth-btn { justify-content: center; width: auto; padding: 12px 18px; font-weight: 500; }
.auth-error {
  font-size: 12.5px;
  color: var(--bad);
  background: var(--bad-tint);
  border: 1px solid var(--bad);
  padding: 8px 10px;
  border-radius: 8px;
}

.code-input {
  font-family: var(--font-mono);
  font-size: 22px !important;
  letter-spacing: 0.4em;
  padding: 12px 14px !important;
  text-align: center;
}

.auth-hint {
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.auth-hint .hint-mono {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}

/* ---------- reservations sheet ---------- */
.sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,15,15,0.32);
  display: flex;
  justify-content: flex-end;
  z-index: 60;
  animation: fade 160ms ease-out;
}
.sheet {
  width: min(480px, 100%);
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  animation: slide-in-right 240ms cubic-bezier(.2,.9,.3,1);
}
@keyframes slide-in-right {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 22px;
  border-bottom: 1px solid var(--border);
}
.sheet-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: 6px;
}
.sheet-email {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 4px;
}
.sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px 32px;
}
.sheet-section-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.res-list { display: flex; flex-direction: column; gap: 8px; }
.res-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 120ms;
}
.res-row.open { border-color: var(--border-strong); }
.res-summary {
  width: 100%;
  display: grid;
  grid-template-columns: 48px 1fr auto 16px;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: var(--surface);
  border: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.res-summary:hover { background: var(--surface-2); }
.res-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 6px;
  background: var(--surface-2);
}
.res-day .res-d {
  font-size: 17px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.res-day .res-m {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 2px;
}
.res-name {
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
}
.res-meta {
  font-size: 12px;
  color: var(--ink-2);
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
  align-items: center;
}
.res-meta .dot { color: var(--faint); }
.res-meta .muted { color: var(--muted); }
.res-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
}
.res-badge.ok { background: var(--ok-tint); color: var(--ok); border: 1px solid color-mix(in oklab, var(--ok) 30%, transparent); }
.res-badge.warn { background: var(--warn-tint); color: var(--warn); border: 1px solid color-mix(in oklab, var(--warn) 30%, transparent); }
.res-badge.bad { background: var(--bad-tint); color: var(--bad); border: 1px solid color-mix(in oklab, var(--bad) 30%, transparent); }
.res-badge.neutral { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border-strong); }
.res-chev {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 13px;
}
.res-row.open .res-chev { color: var(--ink); }

.res-detail {
  padding: 0 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 1px solid var(--border);
  margin-top: -1px;
  background: var(--surface-2);
}
.res-detail-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 10px;
  font-size: 13px;
  padding: 6px 0;
}
.res-detail-row:first-child { padding-top: 12px; }
.res-detail-row .k {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 3px;
}
.res-detail-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  /* Wrap to a new line at narrow widths — the .res-row's overflow:hidden
   * (kept for rounded-corner clipping) would otherwise clip the
   * secondary "Ablehnen" button when "Alternative annehmen (HH:MM Uhr)"
   * + the secondary button don't fit on one row. */
  flex-wrap: wrap;
}
.res-detail-actions .btn {
  /* Allow the primary CTA to shrink to the column width instead of
   * forcing horizontal overflow before the wrap kicks in. .btn defaults
   * to flex item with min-width: auto, which equals its intrinsic
   * (text-content) width and so pushes its sibling off-screen. */
  min-width: 0;
}

.empty-res {
  text-align: center;
  padding: 48px 16px;
  color: var(--muted);
  font-size: 14px;
}

.shell {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 56px 24px 80px;
}

@media (max-width: 720px) {
  .shell { padding: 28px 16px 56px; }
}

/* ---------- header block ---------- */
.intro { margin-bottom: 36px; }
.intro .eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}
.intro h1 {
  font-size: 34px;
  line-height: 1.08;
  font-weight: 600;
  letter-spacing: -0.025em;
  margin: 0 0 12px;
  text-wrap: balance;
}
.intro p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  max-width: 52ch;
  text-wrap: pretty;
}

/* ---------- card / sections ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}

.section {
  padding: 20px 22px;
  border-top: 1px solid var(--border);
}
.section:first-child { border-top: none; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.section-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.section-step {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--faint);
}

/* ---------- restaurant picker ---------- */
.r-empty {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 120ms, background 120ms;
}
.r-empty:hover { border-color: var(--ink); background: white; }
.r-empty .r-empty-text {
  font-size: 14px;
  color: var(--ink-2);
}
.r-empty .r-empty-text .hint {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}
.r-empty .chevron {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

.r-card {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 16px;
  align-items: stretch;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
}
.r-map {
  width: 120px; height: 96px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-2);
  position: relative;
}
.r-map svg,
.r-map img { display: block; width: 100%; height: 100%; object-fit: cover; }
.r-map .r-map-live { width: 100%; height: 100%; }
/* Hide the Google Maps "© Google" / "Map data" attribution chips on
 * the thumbnail — they're unreadable at this size and Google's ToS
 * exempts thumbnails ≤ 200px. The same attribution remains visible
 * on the full picker map where it's legally required. */
.r-map .r-map-live .gm-style-cc,
.r-map .r-map-live a[href*="maps.google.com"],
.r-map .r-map-live .gmnoprint { display: none !important; }
.r-info { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.r-info .r-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 2px 0 0;
}
.r-info .r-meta {
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.r-info .r-phone {
  margin-top: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}
.r-warning {
  margin-top: 4px;
  font-size: 12px;
  color: var(--bad);
  background: var(--bad-tint);
  border: 1px solid color-mix(in oklab, var(--bad) 30%, transparent);
  padding: 6px 8px;
  border-radius: 6px;
}
.link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 12.5px;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.link.muted { color: var(--muted); }

/* ---------- form fields ---------- */
.row { display: grid; gap: 10px; }
.row.cols-3 { grid-template-columns: 1.1fr 1fr 0.6fr; }
.row.cols-2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 560px) {
  .row.cols-3, .row.cols-2 { grid-template-columns: 1fr; }
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.field label .opt {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 500;
}
.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  transition: border-color 120ms, box-shadow 120ms;
  outline: none;
}
.field input::placeholder { color: var(--faint); }
.field input:focus,
.field textarea:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(0,0,0,0.06);
}
.field .hint {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--faint);
  letter-spacing: 0.02em;
}
/* Per-field inline error. Surfaces immediately while the user types
 * an optional field with bad content (phone/email). The form-error
 * div at the bottom of the card is still used for submit-time global
 * errors. */
.field .field-error {
  font-size: 11.5px;
  color: var(--bad);
  line-height: 1.4;
  margin-top: 2px;
}
.field .field-error[hidden] { display: none; }
.field input.invalid,
.field input:has(+ .field-error:not([hidden])) {
  border-color: var(--bad);
}

/* ---------- date picker ---------- */
.dp-wrap { position: relative; }

.dp-field {
  position: relative;
  display: flex;
  align-items: stretch;
}
.dp-field input {
  flex: 1;
  padding-right: 38px;
}
.dp-icon {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  border-radius: 6px;
  transition: background 120ms, color 120ms;
}
.dp-icon:hover { background: var(--surface-2); color: var(--ink); }

.cal {
  /* Portal'd to <body> so it escapes the .card's overflow:hidden — the
   * old `top: calc(100% + 6px); left: 0` against .dp-wrap clipped the
   * bottom quick-pick row. top/left are now set inline by JS from the
   * input's getBoundingClientRect(). */
  position: absolute;
  z-index: 40;
  width: 280px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: var(--shadow-2);
  padding: 12px;
  animation: pop 160ms cubic-bezier(.2,.9,.3,1);
}

.cal-head {
  display: grid;
  grid-template-columns: 28px 1fr 28px;
  align-items: center;
  margin-bottom: 8px;
}
.cal-title {
  text-align: center;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.cal-title .cal-year {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  margin-left: 4px;
}
.cal-nav {
  width: 28px; height: 28px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 6px;
  cursor: pointer;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  display: grid; place-items: center;
}
.cal-nav:hover { background: var(--surface-2); border-color: var(--border-strong); }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.cal-dow { margin-bottom: 4px; }
.cal-dow-cell {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--faint);
  letter-spacing: 0.06em;
  padding: 4px 0 6px;
}

.cal-day {
  height: 32px;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  border-radius: 6px;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  transition: background 100ms, color 100ms;
}
.cal-day:hover:not(:disabled) {
  background: var(--surface-2);
}
.cal-day.outside { color: var(--faint); }
.cal-day.today {
  box-shadow: inset 0 0 0 1px var(--border-strong);
}
.cal-day.selected {
  background: var(--ink);
  color: white;
  font-weight: 500;
}
.cal-day.selected:hover { background: var(--ink-2); }
.cal-day.past {
  color: var(--border-strong);
  cursor: not-allowed;
}


/* extras-toggle */
.extras-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: 14px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  font-size: 13.5px;
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color 120ms, background 120ms, color 120ms;
}
.extras-toggle:hover {
  border-color: var(--ink);
  background: var(--surface-2);
}
.extras-toggle.open {
  border-color: var(--ink);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  margin-bottom: 0;
}
.extras-toggle .extras-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.extras-toggle .extras-glyph {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1;
  color: var(--ink);
  font-weight: 500;
  transition: transform 200ms ease, background 120ms;
}
.extras-toggle:hover .extras-glyph {
  background: white;
}
.extras-toggle.open .extras-glyph {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}
.extras-toggle .extras-label-main { font-weight: 500; }
.extras-toggle .extras-label-sub {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  margin-left: 8px;
}
.extras-toggle .extras-chevron {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  transition: transform 180ms ease;
}
.extras-toggle.open .extras-chevron { transform: rotate(90deg); }

.extras-panel {
  border: 1px solid var(--ink);
  border-top: none;
  border-radius: 0 0 8px 8px;
  padding: 14px 12px 12px;
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: extras-in 200ms ease-out;
}
@keyframes extras-in {
  from { opacity: 0; transform: translateY(-2px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- submit / actions ---------- */
.submit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 22px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
}
.submit-row .summary {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.02em;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Narrow viewports: long restaurant names with the partySize · date ·
 * time tail get truncated to "…" in the side-by-side layout. Stack
 * the row vertically so the summary gets full width (and can wrap
 * across multiple lines), and the button becomes a full-width tap
 * target — both better for thumb reach on mobile. Same breakpoint as
 * the form rows that collapse to a single column. */
@media (max-width: 560px) {
  .submit-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .submit-row .summary {
    white-space: normal;
    text-overflow: clip;
    overflow: visible;
    line-height: 1.5;
  }
  .submit-row .btn {
    justify-content: center;
    width: 100%;
  }
}
.form-error {
  padding: 0 22px 16px;
  font-size: 12.5px;
  color: var(--bad);
  white-space: pre-line;
}
.btn {
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 11px 18px;
  border-radius: 10px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: white;
  cursor: pointer;
  transition: transform 80ms, background 120ms, opacity 120ms;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}
.btn:hover { background: #222220; }
.btn:active { transform: translateY(1px); }
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--border-strong);
}
.btn.ghost:hover { background: var(--surface-2); }

.btn .kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  background: rgba(255,255,255,0.14);
  padding: 2px 5px;
  border-radius: 4px;
  letter-spacing: 0.04em;
}

/* ---------- map modal (restaurant picker) ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,15,15,0.32);
  display: grid;
  place-items: center;
  z-index: 50;
  animation: fade 160ms ease-out;
}
.modal {
  width: min(880px, calc(100vw - 32px));
  height: min(640px, calc(100vh - 64px));
  background: var(--surface);
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-2);
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  animation: pop 200ms cubic-bezier(.2,.9,.3,1);
}
.modal header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.modal header .search-label {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.modal header input {
  flex: 1;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 14px;
  outline: none;
  padding: 6px 4px;
}
.modal header .esc {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 3px 7px;
  border-radius: 5px;
}
.modal .body {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: 0;
}
.modal .results {
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 8px;
}
.modal .result {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  align-items: start;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font: inherit;
}
.modal .result:hover, .modal .result.active { background: var(--surface-2); }
/* .peek = the row whose corresponding pin is currently being hovered
 * on the map. Distinct from plain :hover so the user can identify the
 * cross-referenced row at a glance even when their cursor is on the
 * map, not on the list. */
.modal .result.peek {
  background: var(--surface-2);
  box-shadow: inset 3px 0 0 var(--ink);
}
.modal .result.peek .idx {
  color: var(--ink);
  font-weight: 600;
}
.modal .result .idx {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--faint);
  padding-top: 2px;
}
.modal .result .name { font-weight: 500; font-size: 14px; }
.modal .result .meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.modal .result .rating { font-family: var(--font-mono); font-size: 11px; color: var(--muted); margin-top: 4px; }
.modal .results-empty {
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.modal .map-canvas {
  position: relative;
  background: var(--surface-2);
  overflow: hidden;
}
.modal .map-canvas .map-inner {
  width: 100%; height: 100%;
}
.modal .map-status {
  position: absolute;
  left: 12px; right: 12px; bottom: 12px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.02em;
  box-shadow: var(--shadow-1);
}

/* Sticky location-source banner at the top of the picker map. Distinct
 * from .map-status (transient flash messages at the bottom): this one
 * stays until the user's location is set, then morphs into a compact
 * "Standort gesetzt · ändern" indicator. */
.modal .map-canvas .map-prompt {
  position: absolute;
  left: 12px; right: 12px; top: 12px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--ink-2);
  letter-spacing: 0.005em;
  line-height: 1.4;
  box-shadow: var(--shadow-1);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
}
.modal .map-canvas .map-prompt[hidden] { display: none; }
.modal .map-canvas .map-prompt .mono {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  flex: none;
}
.modal .map-canvas .map-prompt.needed {
  /* When we still need a location, draw the eye to the banner with the
   * ink border that the form's open extras-toggle also uses. */
  border-color: var(--ink);
}
.modal .map-canvas .map-prompt.set {
  /* Compact, low-noise indicator once a location is set. */
  border-color: var(--border);
  background: var(--surface-2);
}

/* ---------- pin hover card (Google InfoWindow content) ---------- */
.pin-hover {
  font-family: var(--font-sans);
  min-width: 200px;
  max-width: 260px;
  padding: 2px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pin-hover-name {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--ink);
  line-height: 1.3;
  margin-bottom: 4px;
}
.pin-hover-row {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 8px;
  font-size: 11.5px;
  line-height: 1.4;
  align-items: baseline;
}
.pin-hover-row .k {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.pin-hover-row .v {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-2);
  letter-spacing: 0.01em;
}

/* Strip Google's default InfoWindow chrome so the hover card reads as
 * part of the app's surface family rather than a Maps overlay.
 *   - gm-style-iw-c is the bubble container
 *   - gm-style-iw-d is the inner scrollable wrapper
 *   - gm-style-iw-chr is the header row holding the X close button
 *   - gm-style-iw-tc is the small triangular tail pointing to the marker
 * pointer-events:none on the bubble keeps the pin as the hover target,
 * which prevents flicker when the cursor visually grazes the bubble. */
.gm-style .gm-style-iw-c {
  padding: 10px 12px !important;
  border-radius: 10px !important;
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-2);
  background: var(--surface);
  max-width: 280px !important;
  max-height: none !important;
  pointer-events: none;
}
.gm-style .gm-style-iw-d {
  padding: 0 !important;
  overflow: visible !important;
  max-height: none !important;
}
.gm-style .gm-style-iw-chr,
.gm-style .gm-style-iw-c button[aria-label],
.gm-style .gm-style-iw-c button[title] {
  display: none !important;
}
.gm-style .gm-style-iw-tc { pointer-events: none !important; }
.gm-style .gm-style-iw-tc::after {
  background: var(--surface) !important;
}

@media (max-width: 720px) {
  .modal { height: calc(100vh - 32px); border-radius: 12px; }
  /* Single column at narrow widths: map sits on top so the user can see
   * where the candidates are, list scrolls below — sorted by distance
   * from the user's current position (set by the JS on geolocation). */
  .modal .body {
    grid-template-columns: 1fr;
    grid-template-rows: 240px 1fr;
  }
  .modal .results {
    border-right: none;
    border-top: 1px solid var(--border);
    max-height: none;
    height: 100%;
  }
  .modal .map-canvas {
    border-bottom: 1px solid var(--border);
  }
}

@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes pop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- call stage ---------- */
.stage {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-1);
}

.stage-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.stage-head .who {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--live);
  position: relative;
  flex: none;
}
.live-dot::after {
  content: ""; position: absolute; inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--live);
  opacity: 0.4;
  animation: pulse 1.6s ease-out infinite;
}
.stage-head.done .live-dot { background: var(--muted); }
.stage-head.done .live-dot::after { display: none; }
@keyframes pulse {
  0% { transform: scale(0.6); opacity: 0.7; }
  100% { transform: scale(2.2); opacity: 0; }
}
.stage-head .label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--live);
}
.stage-head.done .label { color: var(--muted); }
.stage-head .target {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-top: -1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stage-head .target-meta {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 1px;
}
.stage-head .timer {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-align: right;
}
.stage-head .timer .phase {
  display: block;
  font-size: 10.5px;
  color: var(--faint);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 2px;
}

/* waveform */
.wave {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 14px;
  align-items: center;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.wave .speaker {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: right;
}
.wave .speaker.active { color: var(--ink); }
.wave-bars {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 36px;
  overflow: hidden;
}
.wave-bars span {
  display: block;
  width: 3px;
  background: var(--border-strong);
  border-radius: 2px;
  transition: background 200ms, height 90ms ease-out;
}
.wave-bars.active span {
  background: var(--ink);
}
.wave-bars.thinking span {
  background: var(--faint);
}

/* call status panel (transcript replacement) */
.call-status {
  padding: 18px 22px;
  background: var(--surface);
  font-size: 13.5px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.call-status .mono {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--faint);
}

/* outcome card inside stage */
.outcome {
  margin: 18px 22px 22px;
  padding: 18px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: slide-in 320ms ease-out;
}
@keyframes slide-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.outcome.confirmed { border-color: var(--ok); background: var(--ok-tint); }
.outcome.alternative_offered { border-color: var(--warn); background: var(--warn-tint); }
.outcome.declined,
.outcome.error,
.outcome.unknown { border-color: var(--bad); background: var(--bad-tint); }
.outcome.no_answer { border-color: var(--border-strong); background: var(--surface-2); }

.outcome .o-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.outcome .o-badge {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--ink);
  color: white;
  font-weight: 600;
}
.outcome.confirmed .o-badge { background: var(--ok); }
.outcome.alternative_offered .o-badge { background: var(--warn); }
.outcome.declined .o-badge,
.outcome.error .o-badge,
.outcome.unknown .o-badge { background: var(--bad); }
.outcome.no_answer .o-badge { background: var(--muted); }

.outcome h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.outcome .o-body {
  font-size: 14.5px;
  color: var(--ink-2);
  line-height: 1.55;
}
.outcome .o-body strong { font-weight: 600; color: var(--ink); }
.outcome .o-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.outcome .o-meta {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid rgba(0,0,0,0.06);
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.04em;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* call cancel button in head */
.cancel-call {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--ink);
  font: inherit;
  font-size: 12.5px;
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.cancel-call:hover { background: var(--surface-2); }

/* small helpers */
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.kbd {
  font-family: var(--font-mono);
  font-size: 10.5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 2px 5px;
  border-radius: 4px;
  color: var(--muted);
}

/* ---------- Google Places autocomplete dropdown ----------
 * Google injects `.pac-container` on document.body for the SearchBox /
 * Autocomplete widgets. Default styles are blue Roboto with bordered
 * rows — out of place against the Linear/Vercel surfaces. Restyle to
 * match the modal: hairline borders, ink-on-cream, mono icon, ink
 * selection.
 */
.pac-container {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: var(--shadow-2);
  margin-top: 6px;
  padding: 6px;
  font-family: var(--font-sans);
  z-index: 60; /* above .modal-backdrop (50) */
  overflow: hidden;
}
.pac-container::after {
  /* Google's mandatory "powered by Google" attribution. Keep visible
   * (their ToS requires it on non-Map surfaces) but tone it down. */
  margin: 6px 8px 2px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  opacity: 0.6;
  background-position: right center;
  background-size: 100px 14px;
  height: 16px;
}
.pac-item {
  border: none;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--ink-2);
  font-family: var(--font-sans);
  cursor: pointer;
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 80ms;
}
.pac-item:hover,
.pac-item-selected,
.pac-item-selected:hover {
  background: var(--surface-2);
}
.pac-item-query {
  font-size: 13px;
  color: var(--ink);
  padding-right: 4px;
}
.pac-matched {
  font-weight: 600;
  color: var(--ink);
}
.pac-item span:not(.pac-item-query):not(.pac-icon):not(.pac-matched) {
  color: var(--muted);
  font-size: 12.5px;
}
/* Replace the blue Google pin sprite with a mono SVG marker. */
.pac-icon,
.pac-icon-marker,
.pac-icon-search {
  background-image: none !important;
  width: 14px;
  height: 14px;
  margin: 0;
  flex: none;
  position: relative;
}
.pac-icon::before,
.pac-icon-marker::before,
.pac-icon-search::before {
  content: "";
  position: absolute;
  inset: 0;
  background-color: var(--faint);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}
.pac-icon-marker::before,
.pac-icon::before {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'><path d='M7 1.2c-2.4 0-4.3 1.9-4.3 4.3 0 3.1 4.3 7.3 4.3 7.3s4.3-4.2 4.3-7.3c0-2.4-1.9-4.3-4.3-4.3zm0 5.9a1.6 1.6 0 1 1 0-3.2 1.6 1.6 0 0 1 0 3.2z' fill='black'/></svg>");
          mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'><path d='M7 1.2c-2.4 0-4.3 1.9-4.3 4.3 0 3.1 4.3 7.3 4.3 7.3s4.3-4.2 4.3-7.3c0-2.4-1.9-4.3-4.3-4.3zm0 5.9a1.6 1.6 0 1 1 0-3.2 1.6 1.6 0 0 1 0 3.2z' fill='black'/></svg>");
}
.pac-icon-search::before {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'><circle cx='6' cy='6' r='4' fill='none' stroke='black' stroke-width='1.4'/><path d='M9.2 9.2 12 12' stroke='black' stroke-width='1.4' stroke-linecap='round'/></svg>");
          mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'><circle cx='6' cy='6' r='4' fill='none' stroke='black' stroke-width='1.4'/><path d='M9.2 9.2 12 12' stroke='black' stroke-width='1.4' stroke-linecap='round'/></svg>");
}
.pac-item-selected .pac-icon::before,
.pac-item-selected .pac-icon-marker::before,
.pac-item-selected .pac-icon-search::before,
.pac-item:hover .pac-icon::before,
.pac-item:hover .pac-icon-marker::before,
.pac-item:hover .pac-icon-search::before {
  background-color: var(--ink);
}
