:root {
  --bg: #030406; --panel: #0a0e1a; --panel-2: #10162a; --line: rgba(120,150,255,.15); --line-2: rgba(120,150,255,.3);
  --white: #f5f7ff; --text: #c9d2ea; --muted: #8591b0; --blue: #2f6bff; --blue-2: #45d3ff; --glow: rgba(64,160,255,.5); --grad: linear-gradient(100deg, #5fe0ff 0%, #3a8cff 45%, #3a4fe0 100%);
  --ok: #2fd27a; --warn: #ffb547; --bad: #ff5468;
  --display: 'Sora', 'Inter', sans-serif; --wide: 'Syncopate', sans-serif; --body: 'Inter', system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--body); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button { font: inherit; cursor: pointer; }
a { color: var(--blue-2); }
h1 { font: 700 2rem/1.1 var(--display); color: var(--white); margin: 0; letter-spacing: -.03em; }
h2 { font-size: 1.05rem; color: var(--white); margin: 0 0 6px; }
.hint { color: var(--muted); font-size: .88rem; margin: 0 0 16px; }
.error { color: var(--bad); font-weight: 600; min-height: 1px; margin: 4px 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px; border-radius: 10px; border: 1px solid transparent; font-weight: 700; color: var(--white); text-decoration: none; transition: all .2s; white-space: nowrap; }
.btn.primary { background: var(--grad); box-shadow: 0 6px 20px -8px var(--glow); }
.btn.primary:hover { filter: brightness(1.1); }
.btn.ghost { background: transparent; border-color: var(--line-2); }
.btn.ghost:hover { background: rgba(255,255,255,.06); }
.btn.danger { background: var(--bad); }
.btn.danger:hover { background: #ff6b7d; }
.btn.warn { background: rgba(255,84,104,.12); border-color: rgba(255,84,104,.5); color: #ffb3bd; }
.btn.warn:hover { background: var(--bad); color: #fff; }
.btn.okb { background: rgba(47,210,122,.12); border-color: rgba(47,210,122,.45); color: #9cf0c2; }
.btn.okb:hover { background: var(--ok); color: #04130a; }
.btn.sm { padding: 7px 12px; font-size: .85rem; }
.btn.big { padding: 14px 22px; font-size: 1rem; width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.brand { display: flex; align-items: center; gap: 10px; color: var(--white); }
.brand .mark { width: 42px; height: 42px; filter: drop-shadow(0 0 10px var(--glow)); }
.brand span { display: flex; flex-direction: column; gap: 4px; }
.brand .word { height: 22px; width: auto; }
.brand small { font: 700 .5rem var(--wide); letter-spacing: .4em; color: var(--blue-2); }

/* login */
.login { min-height: 100svh; display: grid; place-items: center; padding: 20px; background: radial-gradient(ellipse at 50% 0%, rgba(31,107,255,.25), transparent 60%); }
.login-card { width: min(400px, 100%); padding: 34px; border-radius: 22px; background: var(--panel); border: 1px solid var(--line-2); box-shadow: 0 40px 80px -30px rgba(0,0,0,.8); display: grid; gap: 14px; }
.login-card h1 { margin: 14px 0 4px; }
.login-card .brand { justify-content: center; flex-direction: column; text-align: center; }
.login-card .brand .mark { width: 90px; height: 90px; }
.login-card .brand .word { height: 30px; }
.login-card h1 { text-align: center; }
.back { color: var(--muted); text-align: center; font-size: .9rem; text-decoration: none; }

/* fields */
.field { display: grid; gap: 6px; margin-bottom: 12px; min-width: 0; }
.field > span { font-weight: 600; color: var(--white); font-size: .85rem; }
.field > span i { color: var(--muted); font-style: normal; font-weight: 400; }
input, select, textarea { width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line-2); background: #070a14; color: var(--white); font: inherit; font-size: 16px; }
input:focus, select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(31,107,255,.2); }
input[type=date] { color-scheme: dark; }
.check { display: flex; align-items: center; gap: 10px; margin: 4px 0 14px; color: var(--white); font-weight: 600; }
.check input { width: 20px; height: 20px; accent-color: var(--blue); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row.three { grid-template-columns: 1fr 1fr 1fr; }

/* layout */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 20px; padding: 12px 24px; background: rgba(5,6,10,.9); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 4px; flex: 1; justify-content: center; }
.tabs button { position: relative; display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 10px; border: 0; background: transparent; color: var(--text); font-weight: 600; }
.tabs button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.tabs button:hover { background: rgba(255,255,255,.05); color: var(--white); }
.tabs button.active { background: rgba(31,107,255,.16); color: var(--white); }
.badge { font-style: normal; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--bad); color: #fff; font-size: .72rem; font-weight: 800; display: grid; place-items: center; }
.top-actions { display: flex; gap: 8px; }
.content { padding: 24px; max-width: 1400px; margin: 0 auto; }
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.date-nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.date-title { position: relative; }
.date-title h1 { cursor: pointer; }
.date-title input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.icon { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line-2); background: transparent; color: var(--white); font-size: 1.4rem; line-height: 1; }
.icon:hover { background: rgba(255,255,255,.06); }
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi { padding: 16px 18px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.kpi span { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; }
.kpi b { display: block; font: 700 1.9rem/1.2 var(--display); letter-spacing: -.03em; color: var(--white); }
.grid-2 { display: grid; grid-template-columns: 1.05fr 1fr; gap: 18px; align-items: start; }
.panel { padding: 20px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); margin-bottom: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.panel.form h2 { margin-top: 18px; } .panel.form h2:first-child { margin-top: 0; }
.legend { display: flex; gap: 12px; font-size: .8rem; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.c-booked { background: var(--blue); } .c-blocked { background: repeating-linear-gradient(45deg, #59617d 0 3px, #2a3046 3px 6px); } .c-free { background: #1a2140; border: 1px solid var(--line-2); }

.req-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 18px; border-radius: 14px; margin-bottom: 18px; background: rgba(255,181,71,.1); border: 1px solid rgba(255,181,71,.45); color: #ffd79a; font-weight: 600; }

/* timeline */
.timeline { display: grid; gap: 4px; }
.t-row { display: grid; grid-template-columns: 78px 1fr 92px 84px; align-items: center; gap: 10px; padding: 5px 8px; border-radius: 9px; }
.t-row:hover { background: rgba(255,255,255,.03); }
.t-row.now { background: rgba(31,107,255,.1); box-shadow: inset 3px 0 0 var(--blue); }
.t-row.past { opacity: .45; }
.t-time { font-weight: 700; color: var(--white); font-size: .88rem; }
.t-cells { display: flex; gap: 4px; }
.t-cells i { flex: 1; height: 22px; border-radius: 5px; background: #1a2140; border: 1px solid var(--line-2); max-width: 46px; }
.t-cells i.b { background: var(--grad); border-color: var(--blue); box-shadow: 0 0 10px -3px var(--glow); }
.t-cells i.k { background: repeating-linear-gradient(45deg, #59617d 0 3px, #2a3046 3px 6px); border-color: #59617d; }
.t-cells i.over { background: var(--bad); border-color: var(--bad); }
.t-status { font-size: .8rem; font-weight: 700; color: var(--ok); }
.t-status.full { color: var(--bad); } .t-status.low { color: var(--warn); }
.t-row .btn { padding: 5px 8px; font-size: .78rem; width: 100%; }
.day-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.closed-note { padding: 30px; text-align: center; color: var(--muted); }

/* booking cards */
.list { display: grid; gap: 10px; }
.bk { padding: 16px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line); display: grid; gap: 8px; }
.bk.req { border-color: rgba(255,181,71,.6); background: linear-gradient(180deg, rgba(255,181,71,.08), var(--panel-2)); }
.bk.cancelled { opacity: .7; }
.bk-top { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: baseline; }
.bk-name { font-size: 1.08rem; font-weight: 700; color: var(--white); }
.bk-when { font-weight: 700; color: var(--blue-2); }
.bk-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .9rem; }
.bk-meta a { color: var(--text); text-decoration: none; }
.bk-meta a:hover { color: var(--white); text-decoration: underline; }
.tag { display: inline-block; font-size: .72rem; font-weight: 800; padding: 3px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .05em; background: rgba(255,255,255,.08); color: var(--text); }
.tag.req { background: var(--warn); color: #241600; } .tag.cx { background: rgba(255,84,104,.18); color: #ff9aa6; } .tag.src { background: rgba(31,107,255,.16); color: #9cc0ff; }
.bk-notes { font-size: .88rem; color: var(--muted); background: rgba(0,0,0,.2); padding: 8px 10px; border-radius: 8px; }
.bk-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.empty { padding: 30px; text-align: center; color: var(--muted); border: 1px dashed var(--line-2); border-radius: 14px; }

.filters { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.filters input { flex: 1; min-width: 220px; }
.chips { display: flex; gap: 6px; }
.chips button { padding: 10px 16px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--text); font-weight: 600; }
.chips button.active { background: var(--white); color: var(--bg); border-color: var(--white); }

.big-stepper { display: inline-flex; align-items: center; gap: 10px; padding: 8px; border-radius: 16px; background: #070a14; border: 1px solid var(--line-2); margin-bottom: 8px; }
.big-stepper button { width: 54px; height: 54px; border-radius: 12px; border: 0; background: rgba(255,255,255,.08); color: var(--white); font-size: 1.8rem; }
.big-stepper button:hover { background: var(--blue); }
.big-stepper output { min-width: 70px; text-align: center; font: 700 2.4rem/1 var(--display); color: var(--white); }
.hours-edit { display: grid; gap: 8px; margin-bottom: 8px; }
.h-row { display: grid; grid-template-columns: 110px 90px 1fr 1fr; gap: 10px; align-items: center; }
.h-row b { color: var(--white); }
.h-row select { padding: 9px 10px; }
.h-row.closed select { opacity: .35; pointer-events: none; }
.toggle { display: flex; align-items: center; gap: 6px; font-size: .85rem; }
.toggle input { width: 18px; height: 18px; accent-color: var(--blue); }
.help ul { padding-left: 18px; margin: 8px 0; } .help li { margin-bottom: 8px; }

dialog { width: min(620px, calc(100% - 24px)); border-radius: 18px; border: 1px solid var(--line-2); background: var(--panel); color: var(--text); padding: 24px; box-shadow: 0 40px 100px rgba(0,0,0,.8); }
dialog::backdrop { background: rgba(0,0,0,.7); backdrop-filter: blur(4px); }
dialog h2 { font-size: 1.3rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; }
.toast { position: fixed; left: 50%; bottom: 24px; translate: -50% calc(100% + 60px); opacity: 0; visibility: hidden; background: var(--white); color: var(--bg); padding: 12px 22px; border-radius: 999px; font-weight: 700; z-index: 100; transition: translate .35s cubic-bezier(.2,.8,.2,1), opacity .3s, visibility .3s; box-shadow: 0 20px 40px rgba(0,0,0,.5); max-width: calc(100% - 32px); }
.toast.show { translate: -50% 0; opacity: 1; visibility: visible; }
.toast.bad { background: var(--bad); color: #fff; }

@media (max-width: 1100px) {
  .grid-2 { grid-template-columns: 1fr; }
  .tabs button span { display: none; }
  .tabs button { padding: 10px 12px; }
}
@media (max-width: 720px) {
  .topbar { padding: 10px 14px; gap: 10px; backdrop-filter: none; background: var(--bg); }
  .brand small { display: none; }
  .tabs { position: fixed; bottom: 0; left: 0; right: 0; justify-content: space-around; background: rgba(5,6,10,.97); border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
  .tabs button { flex-direction: column; gap: 2px; font-size: .66rem; padding: 6px 4px; flex: 1; }
  .tabs button span { display: block; }
  .tabs .badge { position: absolute; top: 0; right: 14%; }
  .top-actions a { display: none; }
  .content { padding: 16px 14px 100px; }
  .cards { grid-template-columns: 1fr 1fr; }
  .row, .row.three { grid-template-columns: 1fr; }
  .t-row { grid-template-columns: 60px 1fr 50px 62px; gap: 6px; padding: 5px 4px; }
  .t-time { font-size: .8rem; }
  .t-cells { gap: 3px; }
  .t-status { font-size: .72rem; }
  .h-row { grid-template-columns: 1fr 1fr; }
  h1 { font-size: 2rem; }
}

/* refresh button: spins while loading, shows when it last updated */
.top-actions { align-items: center; }
.refresh-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.refresh-btn.loading svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.updated-at { font-size: .72rem; color: var(--muted); white-space: nowrap; }
@media (max-width: 700px) { .updated-at { display: none; } }

/* staff logins */
.staff-panel h3 { margin: 0 0 12px; font-size: 1rem; color: var(--white); }
.staff-list { display: grid; gap: 10px; margin: 6px 0 22px; }
.staff-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px auto auto auto; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--panel-2); }
.staff-row.off { opacity: .6; }
.staff-row .who { min-width: 0; }
.staff-row .who b { color: var(--white); }
.staff-row .who small { display: block; color: var(--muted); font-size: .8rem; overflow-wrap: anywhere; }
.staff-row .tag { margin-left: 6px; vertical-align: 1px; }
.staff-row .pw-form { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.staff-row .pw-form input { flex: 1 1 220px; }
.staff-add { padding-top: 18px; border-top: 1px solid var(--line); }
.staff-fields { display: grid; grid-template-columns: 1fr 1fr 1.3fr 140px; gap: 12px; }
.pw-wrap { display: flex; gap: 8px; }
.pw-wrap input { flex: 1; min-width: 0; }
.who-am-i { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.who-am-i b { color: var(--white); font-weight: 600; }
.admin-only-note { margin-top: 4px; }
@media (max-width: 900px) {
  .staff-fields { grid-template-columns: 1fr 1fr; }
  .staff-row { grid-template-columns: 1fr 1fr; }
  .staff-row .who { grid-column: 1 / -1; }
}
@media (max-width: 1400px) { .who-am-i { display: none; } }
@media (max-width: 520px) { .staff-fields { grid-template-columns: 1fr; } }

/* schedule: one column per table (Table 1, Table 2...), tap a free table to mark a walk-in */
.timeline { --tables: 5; }
.t-row { grid-template-columns: 70px minmax(0, 1fr) 70px 76px; }
.t-cells { display: grid; grid-template-columns: repeat(var(--tables), minmax(0, 1fr)) auto; gap: 4px; }
.t-head { position: sticky; top: 62px; z-index: 2; background: var(--panel); padding-top: 8px; padding-bottom: 8px; }
.t-head:hover { background: var(--panel); }
.t-head .t-cells b { font-size: .72rem; color: var(--white); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell { height: 28px; min-width: 0; padding: 0 4px; border-radius: 6px; border: 1px solid var(--line-2); background: #1a2140; color: var(--white); font: 700 .7rem/26px inherit; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
button.cell { cursor: pointer; }
.cell.free { color: rgba(255, 255, 255, .22); transition: background .15s, color .15s, border-color .15s; }
.cell.free:hover, .cell.free:focus-visible { color: var(--white); background: rgba(47, 210, 122, .16); border-color: var(--ok); }
.cell.b { background: var(--grad); border-color: var(--blue); color: #04122e; }
.cell.w { background: linear-gradient(100deg, #2fd27a, #1fae9a); border-color: #2fd27a; color: #03170c; }
.cell.k { background: repeating-linear-gradient(45deg, #59617d 0 3px, #2a3046 3px 6px); border-color: #59617d; }
.cell.over { background: var(--bad); border-color: var(--bad); padding: 0 6px; }
.t-row.past .cell.free { pointer-events: none; }
.c-walkin { background: #2fd27a; }
.bk.flash { animation: flash 1.6s ease; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 2px var(--blue-2), 0 0 24px -4px var(--glow); } 100% { box-shadow: none; } }
@media (max-width: 700px) {
  .t-row { grid-template-columns: 54px minmax(0, 1fr) 0 0; gap: 6px; padding: 4px 2px; }
  .t-row .t-status, .t-row .t-act { display: none; }
  .t-head .t-cells b { font-size: .6rem; }
  .t-head { top: 54px; }
  .cell { font-size: .6rem; padding: 0 2px; }
}

.tag.table-tag { background: var(--grad); color: #04122e; font-size: .78rem; padding: 4px 10px; }

/* guest cancellations are information, not a to-do: a calm badge */
#reqBadge { background: #59617d; }
