:root {
  --ink: var(--brand-ink, #0b111d);
  --ink-soft: var(--brand-ink-soft, #172131);
  --paper: var(--brand-paper, #f4f5f1);
  --surface: var(--brand-surface, #ffffff);
  --surface-soft: var(--brand-surface-soft, #f8f9f6);
  --line: var(--brand-line, rgb(11 17 29 / 12%));
  --line-strong: var(--brand-line-strong, rgb(11 17 29 / 20%));
  --muted: var(--brand-muted, #667085);
  --accent: var(--brand-accent, #ff6b5f);
  --accent-strong: color-mix(in srgb, var(--accent) 54%, var(--ink));
  --accent-soft: color-mix(in srgb, var(--accent) 14%, white);
  --on-accent: var(--brand-on-accent, var(--ink));
  --blue: var(--brand-focus, #a8d8ff);
  --success: #176346;
  --danger: #9f3028;
  --danger-soft: #fff0ed;
  color: var(--ink);
  background: var(--paper);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-synthesis: none;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 280px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 92% 0%, rgb(168 216 255 / 20%), transparent 28rem), var(--paper);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  border-bottom: 1px solid rgb(11 17 29 / 8%);
  background: rgb(244 245 241 / 88%);
  backdrop-filter: blur(18px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100% - 2rem, 76rem);
  min-height: 4.5rem;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  text-decoration: none;
}

.brand-mark,
.restaurant-mark {
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 800;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 22%, transparent);
}

.brand-mark {
  width: 2rem;
  height: 2rem;
  border-radius: 0.65rem;
  font-size: 1rem;
}

.header-action {
  min-height: 2.65rem;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  color: var(--ink-soft);
  background: rgb(255 255 255 / 55%);
  font-weight: 700;
  cursor: pointer;
}

.header-actions,
.app-nav {
  display: flex;
  align-items: center;
}

.header-actions {
  min-width: 0;
  gap: 0.65rem;
}

.app-nav {
  gap: 0.2rem;
  padding: 0.2rem;
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  background: rgb(255 255 255 / 55%);
}

.app-nav[hidden] {
  display: none;
}

.app-nav-link {
  min-height: 2.25rem;
  padding: 0.55rem 0.75rem;
  border-radius: 0.65rem;
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-weight: 750;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.app-nav-link:hover {
  color: var(--ink);
  background: rgb(255 255 255 / 80%);
}

.app-nav-link[aria-current="page"] {
  color: var(--on-accent);
  background: var(--accent);
  box-shadow: 0 5px 14px color-mix(in srgb, var(--accent) 18%, transparent);
}

main {
  width: min(100% - 2rem, 38rem);
  margin: clamp(1.5rem, 6vh, 4rem) auto 4rem;
  outline: none;
}

main.queue-app {
  width: min(100% - 2rem, 76rem);
  margin-top: 1rem;
}

.card {
  min-width: 0;
  padding: clamp(1.4rem, 5vw, 2.5rem);
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  background: rgb(255 255 255 / 94%);
  box-shadow: 0 18px 55px rgb(11 17 29 / 7%);
}

.billing-panel {
  margin-top: 1rem;
  padding-block: 1.25rem;
}

.billing-attention {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid rgb(184 119 22 / 34%);
  border-radius: 0.9rem;
  color: var(--ink-soft);
  background: rgb(255 244 220 / 96%);
  box-shadow: 0 10px 30px rgb(11 17 29 / 5%);
}

.billing-attention[hidden] {
  display: none;
}

.billing-attention-critical {
  border-color: rgb(179 48 48 / 30%);
  background: rgb(255 236 233 / 96%);
}

.billing-attention > div {
  display: grid;
  min-width: 0;
  gap: 0.15rem;
}

.billing-attention strong {
  color: var(--ink);
}

.billing-attention span {
  color: var(--muted);
  line-height: 1.4;
}

.billing-attention .secondary {
  flex: 0 0 auto;
  text-decoration: none;
}

.billing-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(18rem, 32rem);
  gap: 1.5rem;
  align-items: center;
}

.billing-checkout {
  display: grid;
  gap: 0.85rem;
}

.billing-actions {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
}

.billing-cancellation {
  display: grid;
  gap: 0.2rem;
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid rgb(30 125 88 / 24%);
  border-radius: 0.75rem;
  color: var(--ink-soft);
  background: rgb(30 125 88 / 8%);
}

.billing-cancellation span {
  color: var(--muted);
}

.success {
  color: var(--success);
  font-weight: 700;
}

@media (max-width: 52rem) {
  .billing-summary {
    grid-template-columns: 1fr;
  }
}

.eyebrow {
  margin: 0 0 0.5rem;
  color: var(--accent-strong);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.65rem, 5vw, 2.35rem);
  line-height: 1.05;
  letter-spacing: -0.045em;
}

h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.5rem, 5vw, 2rem);
  letter-spacing: -0.035em;
}

.lede {
  margin: 1rem 0 1.75rem;
  color: var(--muted);
  line-height: 1.55;
}

.stack {
  display: grid;
  gap: 1rem;
}

.field {
  display: grid;
  gap: 0.45rem;
  min-width: 0;
  font-weight: 700;
}

input {
  width: 100%;
  min-width: 0;
  min-height: 3.25rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.7rem;
  color: var(--ink);
  background: var(--surface);
}

select {
  width: 100%;
  min-width: 0;
  min-height: 3.25rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.7rem;
  color: var(--ink);
  background: var(--surface);
}

input:focus-visible,
button:focus-visible,
a:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.primary,
.secondary,
.google-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.25rem;
  padding: 0.75rem 1rem;
  border-radius: 0.8rem;
  font-weight: 750;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease;
}

.primary {
  border: 1px solid var(--accent);
  color: var(--on-accent);
  background: var(--accent);
  box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 20%, transparent);
}

.secondary,
.google-button {
  border: 1px solid var(--line-strong);
  color: var(--ink-soft);
  background: var(--surface);
}

.primary:hover,
.secondary:hover,
.google-button:hover,
.header-action:hover {
  transform: translateY(-1px);
}

.google-button {
  width: 100%;
  gap: 0.75rem;
}

.google-logo {
  width: 1.15rem;
  height: 1.15rem;
  flex: 0 0 auto;
}

.primary:hover {
  background: color-mix(in srgb, var(--accent) 84%, white);
  box-shadow: 0 12px 26px color-mix(in srgb, var(--accent) 28%, transparent);
}

.secondary:hover,
.google-button:hover,
.header-action:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.text-button,
.inline-link {
  padding: 0;
  border: 0;
  color: var(--accent-strong);
  background: transparent;
  font-weight: 750;
  text-decoration: underline;
  cursor: pointer;
}

.divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.75rem;
  align-items: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.divider::before,
.divider::after {
  height: 1px;
  background: var(--line);
  content: "";
}

.auth-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.35rem;
}

.auth-link-separator {
  width: 1px;
  height: 1rem;
  flex: 0 0 auto;
  background: var(--line-strong);
}

.legal-consent {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 0.7rem;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.legal-consent input {
  width: 1.1rem;
  height: 1.1rem;
  margin: 0.15rem 0 0;
  accent-color: var(--accent);
}

.legal-consent a {
  color: var(--accent-strong);
  font-weight: 700;
}

.app-legal-footer {
  width: min(calc(100% - 2rem), 72rem);
  margin: 0 auto;
  padding: 1.5rem 0 2rem;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

.app-legal-footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1rem;
}

.app-legal-footer a {
  color: var(--muted);
  font-weight: 650;
}

.app-legal-footer p {
  margin: 0.65rem 0 0;
}

.hint,
.error,
.success {
  margin: 0;
  line-height: 1.5;
}

.hint {
  color: var(--muted);
  font-size: 0.9rem;
}

.error {
  padding: 0.8rem;
  border-radius: 0.6rem;
  color: var(--danger);
  background: var(--danger-soft);
}

.warning {
  margin: 0;
  padding: 0.8rem;
  border: 1px solid #e8c779;
  border-radius: 0.6rem;
  color: #6f4e18;
  background: #fff6df;
  line-height: 1.5;
}

.success {
  color: var(--success);
}

.qr-panel {
  display: grid;
  justify-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--surface-soft);
}

.restaurant-card {
  padding: 1rem 1.2rem;
  border-radius: 1rem;
  box-shadow: 0 10px 32px rgb(11 17 29 / 6%);
}

.restaurant-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.restaurant-identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.9rem;
}

.restaurant-mark {
  width: 2.8rem;
  height: 2.8rem;
  flex: 0 0 auto;
  border-radius: 0.85rem;
}

.restaurant-summary .eyebrow {
  margin-bottom: 0.25rem;
  color: var(--muted);
  letter-spacing: 0.1em;
}

.restaurant-summary h1 {
  font-size: clamp(1.45rem, 4vw, 1.85rem);
}

.restaurant-summary .secondary {
  flex: 0 0 auto;
}

.compact-button {
  min-height: 2.75rem;
  padding: 0.65rem 0.9rem;
}

.qr-page-panel {
  display: grid;
  gap: 0.9rem;
  margin-top: 1rem;
  justify-items: start;
}

.qr-page-panel h2,
.qr-page-panel p {
  margin-block: 0;
}

.qr-page-panel img {
  display: block;
  width: min(100%, 20rem);
  height: auto;
  aspect-ratio: 1;
}

.qr-url {
  max-width: 100%;
  color: var(--accent-strong);
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.queue-panel {
  margin-top: 1rem;
  padding: clamp(1.25rem, 3vw, 1.8rem);
}

.queue-panel-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.queue-panel-header .eyebrow {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.live-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: #39a878;
  box-shadow: 0 0 0 0.25rem rgb(57 168 120 / 13%);
}

.queue-status {
  flex: 0 0 auto;
  text-align: right;
}

.queue-list {
  display: grid;
  gap: 0.75rem;
  margin: 1.1rem 0 0;
  padding: 0;
  list-style: none;
}

.queue-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem 1.5rem;
  align-items: center;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--surface);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.queue-item:hover {
  border-color: var(--line-strong);
  box-shadow: 0 8px 24px rgb(11 17 29 / 6%);
}

.queue-item-conversation-open {
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
}

.queue-item-head {
  display: flex;
  align-items: center;
  grid-column: 1;
  justify-content: flex-start;
  gap: 0.75rem;
}

.queue-guest {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.7rem;
}

.queue-avatar {
  display: grid;
  width: 2.3rem;
  height: 2.3rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 0.72rem;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: 0.85rem;
  font-weight: 800;
}

.queue-item-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1.08rem;
  letter-spacing: -0.02em;
}

.queue-pill {
  margin: 0;
  padding: 0.3rem 0.58rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.queue-pill-waiting {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.queue-pill-called {
  color: #6f4e18;
  background: #fbebc9;
}

.queue-pill-coming {
  color: #176346;
  background: #dcf4e8;
}

.queue-pill-overdue {
  color: var(--danger);
  background: var(--danger-soft);
}

.queue-item dl {
  display: flex;
  grid-column: 1;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
  margin: 0;
  padding-left: 3rem;
}

.queue-item dl div {
  display: inline-flex;
  gap: 0.35rem;
}

.queue-item dt {
  color: var(--muted);
  font-size: 0.86rem;
}

.queue-item dd {
  margin: 0;
  font-weight: 700;
  font-size: 0.86rem;
}

.queue-actions {
  display: flex;
  grid-column: 2;
  grid-row: 1 / span 2;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.6rem;
  margin: 0;
}

.queue-actions .primary,
.queue-actions .secondary,
.queue-actions .text-button {
  min-height: 2.5rem;
  padding-inline: 0.9rem;
  white-space: nowrap;
}

.messages-button {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.message-count {
  display: inline-grid;
  min-width: 1.35rem;
  min-height: 1.35rem;
  place-items: center;
  padding-inline: 0.35rem;
  border-radius: 999px;
  color: white;
  background: var(--danger);
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1;
}

.queue-action-danger {
  color: var(--danger);
}

.queue-item > .hint {
  grid-column: 1;
  padding-left: 3rem;
}

.queue-empty {
  display: grid;
  justify-items: center;
  gap: 0.25rem;
  margin: 1rem 0 0;
  padding: 2.75rem 1rem;
  border: 1px dashed var(--line-strong);
  border-radius: 1rem;
  color: var(--muted);
  text-align: center;
}

.queue-empty strong {
  color: var(--ink-soft);
}

.conversation-panel {
  display: grid;
  gap: 1rem;
  grid-column: 1 / -1;
  margin-top: 0.35rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background: var(--surface-soft);
}

.conversation-panel h4 {
  margin: 0;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.conversation-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  min-width: 0;
}

.conversation-header > div {
  min-width: 0;
}

.conversation-header .text-button {
  flex: 0 0 auto;
}

.conversation-messages {
  display: grid;
  gap: 0.65rem;
  max-height: 24rem;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.conversation-message {
  max-width: 92%;
  padding: 0.75rem;
  border-radius: 0.75rem;
  background: #e9eeec;
}

.conversation-message p {
  margin: 0;
  overflow-wrap: anywhere;
}

.conversation-message-meta {
  margin-bottom: 0.3rem !important;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.conversation-message-staff {
  justify-self: end;
  color: var(--on-accent);
  background: var(--accent);
}

.conversation-message-staff .conversation-message-meta {
  color: color-mix(in srgb, var(--on-accent) 72%, transparent);
}

.conversation-message-system {
  justify-self: center;
  color: var(--ink-soft);
  background: #eef0eb;
}

.conversation-reply {
  display: grid;
  gap: 0.75rem;
}

textarea {
  width: 100%;
  min-width: 0;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.7rem;
  color: var(--ink);
  background: var(--surface);
  resize: vertical;
}

@media (max-width: 760px) {
  .header-inner {
    flex-wrap: wrap;
    gap: 0.55rem;
    padding-block: 0.5rem;
  }

  .header-actions {
    flex: 1 1 auto;
    justify-content: flex-end;
  }

  .app-nav {
    max-width: 100%;
    overflow-x: auto;
  }

  .queue-panel-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.45rem;
  }

  .queue-status {
    text-align: left;
  }

  .queue-item {
    grid-template-columns: 1fr;
  }

  .queue-item-head,
  .queue-item dl,
  .queue-item > .hint,
  .queue-actions {
    grid-column: 1;
  }

  .queue-item dl,
  .queue-item > .hint {
    padding-left: 3rem;
  }

  .queue-actions {
    grid-row: auto;
    justify-content: flex-start;
    padding-left: 3rem;
  }
}

@media (max-width: 420px) {
  .header-inner,
  main {
    width: min(100% - 1.25rem, 38rem);
  }

  .header-inner {
    min-height: 4rem;
  }

  .header-actions {
    flex-basis: 100%;
    justify-content: space-between;
  }

  .app-nav-link {
    padding-inline: 0.6rem;
    font-size: 0.82rem;
  }

  main,
  main.queue-app {
    margin-top: 0.65rem;
  }

  .card {
    border-radius: 1rem;
  }

  .restaurant-card,
  .queue-panel {
    padding: 1rem;
  }

  .billing-attention {
    align-items: stretch;
    flex-direction: column;
  }

  .billing-attention .secondary {
    width: 100%;
  }

  .actions > * {
    width: 100%;
  }

  .restaurant-summary {
    align-items: stretch;
    flex-direction: column;
  }

  .restaurant-summary .compact-button {
    width: 100%;
  }

  .queue-item {
    padding: 0.9rem;
  }

  .queue-item dl,
  .queue-item > .hint,
  .queue-actions {
    padding-left: 0;
  }

  .queue-item dl {
    display: grid;
    gap: 0.3rem;
  }

  .queue-item dl div {
    justify-content: space-between;
  }

  .queue-actions .primary,
  .queue-actions .secondary {
    flex: 1 1 auto;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .card {
    animation: reveal 220ms ease-out;
  }

  @keyframes reveal {
    from {
      opacity: 0;
      transform: translateY(0.4rem);
    }
  }
}
