:root {
  --bg: #f6f3ee; --panel: #ffffff; --panel2: #faf8f4; --line: #e4ded3; --line2: #efeae1; --ink: #221f1a; --muted: #7a7266;
  --accent: #7b2d3b; --accent-ink: #fff;
  --booked: #2f6f9f; --booked-bg: #e3eef6; --seated: #3f8a4a; --seated-bg: #e2f1e4; --left: #8a8175; --left-bg: #ece8e1;
  --warn: #c98a07; --high: #b3261e; --high-bg: #fdecea;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
  --label: 84px; --rowh: 38px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1a18; --panel: #262420; --panel2: #2d2a26; --line: #3a3630; --line2: #302d28; --ink: #f1ede6; --muted: #a39b8f;
    --accent: #c46a7a; --accent-ink: #1b1a18;
    --booked: #6aa8d6; --booked-bg: #243442; --seated: #74c17f; --seated-bg: #25382a; --left: #a39b8f; --left-bg: #33302b;
    --warn: #e3b341; --high: #f2857d; --high-bg: #402624;
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif; }
body { display: flex; flex-direction: column; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.grow { flex: 1; }

/* top bar */
.top { flex: 0 0 auto; z-index: 10; display: flex; align-items: center; gap: 12px; padding: 8px 14px; flex-wrap: wrap;
  padding-top: max(8px, env(safe-area-inset-top)); background: var(--bg); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; letter-spacing: .2px; color: var(--accent); white-space: nowrap; }
.tabs { display: flex; gap: 4px; }
.tabs a { padding: 6px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 500; }
.tabs a.on { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.datenav { display: flex; align-items: center; gap: 6px; }
.datebtn { position: relative; padding: 6px 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel);
  font-weight: 600; min-width: 168px; text-align: center; cursor: pointer; white-space: nowrap; }
.datebtn.is-today { border-color: var(--accent); }
.datebtn input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.covers { color: var(--muted); font-size: 13px; white-space: nowrap; }
.covers b { color: var(--ink); }
.top-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.live { width: 9px; height: 9px; border-radius: 50%; background: var(--left); }
.live.on { background: var(--seated); }
.btn { border: 1px solid var(--line); background: var(--panel); border-radius: 9px; padding: 7px 14px; cursor: pointer; white-space: nowrap; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.danger { color: var(--high); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.icon { padding: 7px 11px; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.menu { position: fixed; right: 12px; top: 54px; z-index: 30; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.18); padding: 6px; min-width: 200px; }
.menu .who { padding: 8px 12px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 12px; border-radius: 8px; cursor: pointer; }
.menu button:hover { background: var(--panel2); }

main { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
main > section { flex: 1 1 auto; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch; }

/* day note */
.nicon { flex: 0 0 auto; width: 17px; height: 17px; fill: var(--booked); }
#bNote { align-self: stretch; display: inline-flex; align-items: center; }
#bNote .nicon { fill: none; stroke: var(--muted); stroke-width: 1.3; }
#bNote.has .nicon { fill: var(--booked); stroke: var(--booked); }
.daynote { flex: 0 0 auto; display: flex; gap: 9px; align-items: flex-start; padding: 7px 14px; background: var(--booked-bg);
  border-bottom: 1px solid var(--line); cursor: pointer; font-size: 14px; }
.daynote .nicon { margin-top: 2px; }
.daynote span { white-space: pre-line; overflow-wrap: anywhere; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical;
  -webkit-line-clamp: 3; line-clamp: 3; }

/* timeline */
#vTimeline { position: relative; }
.tl { position: relative; min-width: 100%; }
.tl-head { position: sticky; top: 0; z-index: 6; display: flex; height: 30px; background: var(--bg); border-bottom: 1px solid var(--line); }
.tl-corner { position: sticky; left: 0; z-index: 7; flex: 0 0 var(--label); background: var(--bg); border-right: 1px solid var(--line); }
.tl-hours { position: relative; flex: 1 0 auto; }
.tl-hours span { position: absolute; top: 6px; transform: translateX(-50%); font-size: 12px; color: var(--muted); }
.tl-hours span.h { color: var(--ink); font-weight: 600; }
.tl-area { position: sticky; left: 0; z-index: 4; width: 100vw; max-width: 100%; padding: 12px 14px 5px; font-weight: 650; font-size: 16px; }
.tl-area small { font-weight: 400; color: var(--muted); font-size: 13px; margin-left: 8px; }
.tl-row { display: flex; min-height: var(--rowh); border-top: 1px solid var(--line2); }
.tl-row.drop .tl-track { background-color: color-mix(in srgb, var(--accent) 10%, transparent); }
.tl-label { position: sticky; left: 0; z-index: 4; flex: 0 0 var(--label); display: flex; align-items: center; justify-content: space-between;
  padding: 0 8px 0 14px; background: var(--bg); border-right: 1px solid var(--line); font-weight: 600; }
.tl-label small { font-weight: 400; font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0 6px; }
.tl-label.off { color: var(--muted); font-weight: 400; }
.tl-track { position: relative; flex: 1 0 auto; cursor: cell;
  background-image: linear-gradient(to right, var(--line) 1px, transparent 1px), linear-gradient(to right, var(--line2) 1px, transparent 1px);
  background-size: var(--hour) 100%, var(--q) 100%; }
.nowline { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--high); z-index: 3; pointer-events: none; }
.nowline::before { content: ""; position: absolute; top: 24px; left: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--high); }

.bar { position: absolute; height: calc(var(--rowh) - 6px); display: flex; align-items: center; gap: 6px; padding: 0 2px 0 8px;
  border-radius: 7px; border-left: 4px solid var(--booked); background: var(--booked-bg); box-shadow: var(--shadow);
  cursor: pointer; overflow: hidden; white-space: nowrap; font-size: 14px; user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none; }
.bar .nm { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.bar .ic { flex: 0 0 auto; font-size: 12px; color: var(--muted); }
.bar .px, .pax { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; min-width: 21px; height: 21px;
  padding: 0 5px; border: 1px solid currentColor; border-radius: 999px; font-size: 12px; color: var(--muted); }
.bar .adv { flex: 0 0 auto; border: 0; height: 100%; padding: 0 9px; margin-left: 2px; cursor: pointer; font-size: 13px; font-weight: 700;
  background: color-mix(in srgb, var(--booked) 22%, transparent); color: var(--ink); }
.bar.st-seated { border-left-color: var(--seated); background: var(--seated-bg); }
.bar.st-seated .adv { background: color-mix(in srgb, var(--seated) 28%, transparent); }
.bar.st-left { border-left-color: var(--left); background: var(--left-bg); color: var(--muted); box-shadow: none; }
.bar.late { outline: 2px solid var(--warn); outline-offset: -2px; }
.bar.over { background-image: repeating-linear-gradient(135deg, transparent 0 7px, color-mix(in srgb, var(--warn) 30%, transparent) 7px 9px); }
.bar.clash { outline: 2px solid var(--high); outline-offset: -2px; }
.bar.linked { filter: brightness(.93) saturate(1.3); }
.bar.ghost { position: fixed; z-index: 50; pointer-events: none; opacity: .92; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.bar.dragging { opacity: .35; }
.dragtip { position: fixed; z-index: 51; pointer-events: none; background: var(--ink); color: var(--bg); border-radius: 6px; padding: 2px 8px; font-size: 13px; font-weight: 600; }
.zoom { position: fixed; right: 14px; bottom: max(14px, env(safe-area-inset-bottom)); z-index: 8; display: flex; gap: 6px; }
.zoom .btn { box-shadow: var(--shadow); }

/* list */
.list { max-width: 1100px; margin: 0 auto; padding: 8px 14px 80px; }
.list h3 { margin: 18px 0 6px; font-size: 16px; }
.list h3 small { font-weight: 400; color: var(--muted); margin-left: 8px; font-size: 13px; }
.lrow { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line);
  border-left: 4px solid var(--booked); border-radius: 10px; margin-bottom: 6px; cursor: pointer; }
.lrow.st-seated { border-left-color: var(--seated); }
.lrow.st-left { border-left-color: var(--left); color: var(--muted); }
.lrow.st-cancelled, .lrow.st-noshow { border-left-color: var(--high); color: var(--muted); }
.lrow.st-cancelled .nm, .lrow.st-noshow .nm { text-decoration: line-through; }
.lrow .src { flex: 0 0 20px; text-align: center; color: var(--muted); }
.lrow .tm { flex: 0 0 104px; font-variant-numeric: tabular-nums; font-weight: 600; }
.lrow .tm small { font-weight: 400; color: var(--muted); margin-left: 4px; }
.lrow .who { flex: 1 1 auto; min-width: 0; }
.lrow .who .nt { display: block; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow .tb { flex: 0 0 auto; text-align: right; font-size: 12px; color: var(--muted); }
.tchip { display: inline-block; min-width: 26px; text-align: center; padding: 1px 7px; margin-left: 3px; border-radius: 999px;
  background: var(--left-bg); color: var(--ink); font-size: 13px; font-weight: 600; }
.tchip.none { background: var(--high-bg); color: var(--high); }
.lrow .act { flex: 0 0 112px; text-align: right; }
.empty { text-align: center; color: var(--muted); padding: 48px 0; }
.linkbtn { border: 0; background: none; color: var(--muted); text-decoration: underline; cursor: pointer; padding: 6px 0; }

/* month */
.month { max-width: 1500px; margin: 0 auto; padding: 8px 14px 80px; }
.mhead, .mgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.mhead span { padding: 8px; font-weight: 600; }
.mhead i { font-style: normal; }
.mgrid { border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.mcell { position: relative; min-height: 124px; padding: 6px 8px 10px; display: flex; flex-direction: column; align-items: flex-start; gap: 5px;
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--panel); cursor: pointer; }
.mcell:hover { background: var(--panel2); }
.mcell.out { background: var(--bg); }
.mcell.out .mnum { color: var(--muted); font-weight: 400; }
.mcell.today { box-shadow: inset 0 0 0 2px var(--accent); }
.mnum { font-size: 18px; font-weight: 600; }
.mnum small { font-size: 14px; font-weight: 400; color: var(--muted); }
.mchip { max-width: 100%; padding: 2px 10px; border-radius: 999px; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mnote { position: absolute; top: 3px; right: 3px; border: 0; background: none; padding: 5px; line-height: 0; cursor: pointer; }
.mtext { max-width: 100%; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mchip b { font-weight: 600; }
.mchip i { font-style: normal; }
.mchip.b { background: var(--seated-bg); color: var(--seated); }
.mchip.p { background: var(--left-bg); color: var(--ink); }
.mchip.w { background: var(--high-bg); color: var(--high); }
.mchip.c { background: color-mix(in srgb, var(--warn) 20%, var(--panel)); color: var(--warn); font-weight: 600; }

/* dialogs */
dialog { border: 1px solid var(--line); border-radius: 16px; padding: 0; background: var(--panel); color: var(--ink);
  width: min(620px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; box-shadow: 0 16px 60px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(0,0,0,.4); }
#dlg2 { width: min(420px, calc(100vw - 24px)); }
.sheet { display: flex; flex-direction: column; gap: 12px; padding: 18px 20px 0; }
.sheet h2 { margin: 0; font-size: 20px; display: flex; align-items: center; gap: 10px; }
.sheet footer { position: sticky; bottom: 0; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap;
  padding: 10px 0 16px; background: var(--panel); border-top: 1px solid var(--line2); }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
input, select, textarea { border: 1px solid var(--line); background: var(--panel2); border-radius: 9px; padding: 8px 10px; color: var(--ink);
  font-size: 16px; width: 100%; }
textarea { resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 10px; }
.paxrow { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.paxrow button { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel2); cursor: pointer; font-weight: 600; }
.paxrow button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.paxrow input { width: 72px; }
.sugg { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.sugg button { text-align: left; border: 0; border-bottom: 1px solid var(--line2); background: var(--panel2); padding: 8px 10px; cursor: pointer; }
.sugg button:last-child { border-bottom: 0; }
.sugg small { color: var(--muted); margin-left: 8px; }
.tpick h4 { margin: 8px 0 4px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.tpick .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--panel2); border-radius: 9px; padding: 6px 10px; cursor: pointer; font-weight: 600; min-width: 46px; }
.chip small { font-weight: 400; color: var(--muted); font-size: 11px; margin-left: 3px; }
.chip.busy { background: var(--high-bg); border-color: color-mix(in srgb, var(--high) 40%, var(--line)); color: var(--high); text-decoration: line-through; }
.chip.sel { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); text-decoration: none; }
.chip.sel small { color: inherit; }
.note { font-size: 13px; color: var(--muted); margin: 0; }
.note.warn { color: var(--high); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; }
.facts dt { color: var(--muted); font-size: 13px; padding-top: 2px; }
.facts dd { margin: 0; }
.facts a { color: inherit; }
.status { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--booked-bg); color: var(--booked); }
.status.seated { background: var(--seated-bg); color: var(--seated); }
.status.left { background: var(--left-bg); color: var(--left); }
.status.cancelled, .status.noshow { background: var(--high-bg); color: var(--high); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions .btn.big { padding: 12px 20px; font-size: 16px; font-weight: 600; }
.results { display: flex; flex-direction: column; gap: 6px; max-height: 50dvh; overflow: auto; }
.results .lrow { margin: 0; }
.results .tm { flex-basis: 150px; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; background: var(--ink); color: var(--bg);
  padding: 10px 18px; border-radius: 999px; box-shadow: 0 8px 30px rgba(0,0,0,.25); max-width: calc(100vw - 32px);
  pointer-events: none; }
#toast button { pointer-events: auto; }

/* settings */
.settings { max-width: 900px; margin: 0 auto; padding: 14px 14px 80px; display: flex; flex-direction: column; gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.card h3 { margin: 0 0 4px; }
.card > p { margin: 0 0 12px; }
.area-ed { border-top: 1px solid var(--line); padding: 12px 0; }
.area-ed .ahead { display: flex; gap: 8px; margin-bottom: 8px; }
.trow { display: grid; grid-template-columns: 1.2fr 70px 70px auto auto; gap: 8px; align-items: center; margin-bottom: 6px; }
.trow label { flex-direction: row; align-items: center; gap: 6px; }
.trow input[type=checkbox] { width: auto; }
.thead { font-size: 12px; color: var(--muted); }
table.plain { width: 100%; border-collapse: collapse; font-size: 14px; }
table.plain td, table.plain th { text-align: left; padding: 7px 8px 7px 0; border-top: 1px solid var(--line2); }
table.plain th { font-size: 12px; color: var(--muted); font-weight: 500; border-top: 0; }
.code { font: 700 30px/1.2 ui-monospace, Menlo, monospace; letter-spacing: 3px; margin: 8px 0; }
.inline { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline label { flex: 1 1 150px; }

/* login */
.loginpage { display: block; }
.login { max-width: 360px; margin: 10vh auto 0; padding: 24px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow); }
.login h1 { margin: 0; font-size: 22px; color: var(--accent); }
.login form { display: flex; flex-direction: column; gap: 12px; }
.login p { margin: 0; font-size: 13px; }
#err { color: var(--high); font-size: 14px; min-height: 1.2em; }
.seg { display: flex; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { flex: 1; border: 0; background: none; padding: 7px; border-radius: 8px; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); font-weight: 600; }

@media (max-width: 760px) {
  .brand, .covers { display: none; }
  .datebtn { min-width: 0; }
  #today { display: none; }
  .lrow .tb small { display: none; }
  .lrow .act { flex-basis: auto; }
  .row3 { grid-template-columns: 1fr 1fr; }
  :root { --label: 62px; }
  .month { padding: 4px 6px 80px; }
  .mhead i, .mchip i, .mtext { display: none; }
  .mnote { top: 0; right: 0; }
  .mhead span { padding: 6px 4px; font-size: 13px; }
  .mcell { min-height: 92px; padding: 4px; gap: 4px; }
  .mnum { font-size: 15px; }
  .mchip { padding: 1px 7px; font-size: 12px; }
  .mchip.c { font-size: 9.5px; padding: 1px 3px; letter-spacing: -.2px; }
  .tl-label small { display: none; }
}
