:root {
  color-scheme: light;
  /* Surface, type and divider roles follow the Tilda booking widget. */
  --paper: #fff;
  --ink: #17243b;
  --muted: #526179;
  --divider: #e0e6ef;
  --panel: #f4f7fb;
  --accent: #2056c5;
  --accent-hover: #1948a9;
  --accent-soft: #edf3ff;
  --free-bg: #daf3e8;
  --free-ink: #17684d;
  --soon-bg: #fff0c8;
  --soon-ink: #855300;
  --busy-bg: #fce4e4;
  --busy-ink: #9c3039;
  font: 16px/1.5 system-ui, sans-serif;
  background: var(--panel);
  color: var(--ink);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body, h1, h2, h3, h4, p, dl, dd { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.layout { width: min(1240px, calc(100% - 64px)); margin-inline: auto; }
.muted { color: var(--muted); font-size: .875rem; }

.topbar { background: var(--paper); border-bottom: 1px solid var(--divider); }
.topbar-inner { min-height: 65px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 15px; }
.brand strong { background: var(--accent); color: white; padding: 5px 9px; border-radius: 6px; letter-spacing: .13em; font-size: .875rem; }
.brand span { color: var(--muted); font-size: .875rem; }
.login-layout { display: grid; min-height: calc(100dvh - 65px); align-items: start; justify-items: center; padding: clamp(36px, 12vh, 105px) 16px 32px; }
.login-card { width: min(440px, 100%); padding: clamp(20px, 5vw, 32px); }
.login-card h1 { font-size: clamp(1.55rem, 5vw, 2rem); }
.login-form { display: grid; gap: 16px; margin-top: 21px; }
.login-form .primary { margin-top: 3px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 14px; padding: 21px 0 17px; }
.heading-date { color: var(--muted); font-size: .875rem; }
.heading-date::first-letter { text-transform: uppercase; }
h1 { font-size: clamp(1.7rem, 3.2vw, 2.45rem); line-height: 1.17; letter-spacing: -.04em; }
h2 { font-size: 1.24rem; letter-spacing: -.018em; }
h3 { font-size: 1.22rem; letter-spacing: -.02em; }
h4 { font-size: .875rem; }

.primary, .secondary, .close {
  border: 1px solid transparent; border-radius: 8px; min-height: 42px; padding: 8px 14px; font-size: .875rem; font-weight: 650;
}
.primary { color: white; background: var(--accent); }
.primary:hover { background: var(--accent-hover); }
.primary:disabled, .secondary:disabled, select:disabled { opacity: .58; cursor: default; }
.primary span { margin-right: 3px; }
.secondary { color: var(--accent); background: var(--paper); border-color: var(--divider); }
.secondary:hover { background: var(--accent-soft); }
.close { background: var(--panel); min-height: 40px; min-width: 40px; padding: 0; font-size: 1.4rem; }
.close:hover { background: var(--accent-soft); }

.card { background: var(--paper); border: 1px solid var(--divider); border-radius: 12px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 21px; }
.section-actions { display: flex; align-items: center; gap: 8px; }
.floor-card { padding-bottom: 16px; }
.floor-card h2 + p { margin-top: 2px; }
.clock { background: var(--panel); color: var(--ink); font-size: .875rem; font-weight: 650; border-radius: 6px; padding: 5px 10px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.floor-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(230px, 28%); gap: 18px; padding: 0 21px; }
.map-column { min-width: 0; }
.map-scroll { overflow: auto; background: var(--panel); border-radius: 9px; }
.map-stage { position: relative; width: clamp(480px, 100%, 540px); margin-inline: auto; aspect-ratio: 800 / 589; }
#floor, #floor-tables { position: absolute; inset: 0; width: 100%; height: 100%; }
.table-target { position: absolute; padding: 0; border: 0; background: transparent; transform: translate(-50%, -50%); }
.table-target:focus-visible { outline-offset: 1px; border-radius: 4px; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 12px 0 0; padding: 0; color: var(--muted); font-size: .8125rem; }
.legend li { display: flex; align-items: center; gap: 6px; }
.swatch { width: 11px; height: 11px; border-radius: 3px; }
.free, .confirmed { background-color: var(--free-bg); color: var(--free-ink); }
.soon, .pending { background-color: var(--soon-bg); color: var(--soon-ink); }
.busy, .cancelled { background-color: var(--busy-bg); color: var(--busy-ink); }
.table-details { display: flex; flex-direction: column; align-items: stretch; gap: 17px; padding: 16px; background: var(--panel); border-radius: 9px; }
.availability p { margin-top: 6px; font-size: .875rem; }
.table-details > button { margin-top: auto; }
.upcoming { list-style: none; margin: 5px 0 0; padding: 0; font-size: .875rem; }
.upcoming li { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 5px 0; }
.upcoming li + li { border-top: 1px solid var(--divider); }
.upcoming li span:last-child { color: var(--muted); text-align: right; }

.booking-card { margin: 18px 0 32px; }
.tabs { display: flex; overflow: auto; gap: 18px; padding-inline: 21px; border-bottom: 1px solid var(--divider); }
.tabs button { background: transparent; border: 0; border-bottom: 2px solid transparent; padding: 8px 1px 9px; white-space: nowrap; color: var(--muted); font-size: .875rem; font-weight: 650; min-height: 42px; }
.tabs button:focus-visible { outline-offset: -2px; }
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; align-items: end; gap: 10px; background: var(--panel); padding: 12px 21px; }
label { display: grid; min-width: 0; gap: 4px; font-size: .875rem; font-weight: 600; }
input, select, textarea { min-width: 0; width: 100%; border: 1px solid #c8d3e2; border-radius: 7px; background: var(--paper); padding: 8px 9px; min-height: 42px; font-weight: 400; }
select { appearance: none; padding-right: 27px; background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%23526179' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 9px center; }
.table-scroll { overflow: auto; }
table { width: 100%; min-width: 790px; border-collapse: collapse; text-align: left; font-size: .875rem; }
th, td { padding: 9px 10px; vertical-align: middle; }
th:first-child, td:first-child { padding-left: 21px; }
th:last-child, td:last-child { padding-right: 21px; }
th { color: var(--muted); font-weight: 650; background: var(--panel); white-space: nowrap; }
td { border-top: 1px solid var(--divider); }
tbody tr:hover { background: #f9fbfe; }
td:first-child { white-space: nowrap; font-variant-numeric: tabular-nums; }
td:last-child { min-width: 135px; overflow-wrap: anywhere; color: var(--muted); }
.row-date, .guest-phone { display: block; color: var(--muted); font-size: .8125rem; }
.guest-button { display: block; text-align: left; padding: 0; border: 0; background: transparent; color: var(--accent); font-weight: 650; }
.guest-button:hover .guest-name { text-decoration: underline; }
.pill { display: inline-flex; align-items: center; width: max-content; min-height: 26px; border-radius: 6px; padding: 2px 8px; font-size: .8125rem; font-weight: 650; white-space: nowrap; }
select.pill { display: inline-block; border: 1px solid #ddbd6a; padding-right: 26px; cursor: pointer; background-color: var(--soon-bg); color: var(--soon-ink); }
.empty { padding: 25px 21px; color: var(--muted); }
.booking-actions { padding: 12px 21px; border-top: 1px solid var(--divider); }

dialog { color: var(--ink); border: 1px solid var(--divider); border-radius: 12px; width: min(510px, calc(100% - 28px)); max-height: calc(100dvh - 28px); padding: 20px; box-shadow: 0 24px 70px #17243b40; }
dialog::backdrop { background: #17243b65; }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.guest-details { display: grid; grid-template-columns: minmax(90px, auto) 1fr; gap: 8px 16px; }
.guest-details dt { color: var(--muted); }
.guest-details dd { overflow-wrap: anywhere; }
.create-form, .form-grid { display: grid; gap: 10px; }
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dialog-actions { margin-top: 3px; display: flex; gap: 8px; justify-content: end; }
.error { color: var(--busy-ink); font-size: .875rem; }
.toast { position: fixed; bottom: 18px; right: 18px; max-width: calc(100% - 36px); z-index: 1; background: var(--ink); color: var(--paper); padding: 10px 15px; border-radius: 8px; }

@media (max-width: 760px) {
  .layout { width: calc(100% - 28px); }
  .floor-layout { grid-template-columns: minmax(0, 1fr); gap: 12px; padding-inline: 13px; }
  .section-heading, .filters { padding-inline: 13px; }
  .tabs { gap: 13px; padding-inline: 13px; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .table-details { gap: 11px; }
}

@media (max-width: 410px) {
  .brand { gap: 7px; }
  .brand span { font-size: .75rem; }
  .primary, .secondary { padding-inline: 9px; }
  .page-heading { gap: 8px; }
}
