:root {
  color-scheme: light;
  --canvas: #f7f8f6;
  --surface: #ffffff;
  --surface-soft: #f2f4f0;
  --surface-hover: #edf1eb;
  --text: #26312b;
  --muted: #6e7b72;
  --subtle: #89948c;
  --line: #e0e5df;
  --line-strong: #cbd5cc;
  --green: #285b49;
  --green-hover: #204b3c;
  --green-soft: #edf5ef;
  --green-line: #c8dccc;
  --green-text: #285b49;
  --occupied: #f1f1ed;
  --occupied-text: #73786e;
  --mine: #edf5f4;
  --mine-text: #356b69;
  --mine-line: #bad4d0;
  --warning: #996b32;
  --warning-soft: #fbf4e8;
  --warning-line: #e9d6b9;
  --danger: #b34d42;
  --danger-soft: #fbefed;
  --focus: #6c9c81;
  --backdrop: #18281f38;
  --shadow: 0 12px 42px #182d2112, 0 2px 8px #182d2108;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --number: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #171c19;
  --surface: #1e2521;
  --surface-soft: #252d27;
  --surface-hover: #2d372f;
  --text: #e4eae5;
  --muted: #a2aea5;
  --subtle: #839287;
  --line: #343f36;
  --line-strong: #4b5b4f;
  --green: #285b49;
  --green-hover: #326c57;
  --green-soft: #24392c;
  --green-line: #3d604b;
  --green-text: #a4d2b6;
  --occupied: #2b2e27;
  --occupied-text: #b2b5a6;
  --mine: #243837;
  --mine-text: #9ac7c0;
  --mine-line: #42635e;
  --warning: #e0b67e;
  --warning-soft: #392f23;
  --warning-line: #63503a;
  --danger: #edaa9e;
  --danger-soft: #3b2926;
  --focus: #8dbb9e;
  --backdrop: #070e0a80;
  --shadow: 0 16px 48px #0004, 0 2px 8px #0003;
}

* { box-sizing: border-box; }
html { min-width: 0; scrollbar-gutter: stable; }
body { margin: 0; background: var(--canvas); color: var(--text); font: 13px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
body:has(dialog[open]) { overflow: hidden; }
button, input, select { font: inherit; }
button { color: inherit; border: 0; background: transparent; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button, a, input, select, summary { outline-offset: 3px; }
:focus-visible { outline: 2px solid var(--focus); }
button:disabled { opacity: .45; cursor: not-allowed; }
button[aria-busy="true"] { cursor: wait; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3, strong { font-weight: 600; }
button, input, select, a, summary { touch-action: manipulation; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: 8px; left: 12px; z-index: 200; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 7px; transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }
.icon { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; vertical-align: middle; }
[data-icon] { display: inline-flex; align-items: center; justify-content: center; }
.muted { color: var(--muted); }

/* Navigation stays quiet so the booking controls lead the page. */
.topbar { height: 60px; display: flex; align-items: center; gap: 32px; padding: 0 max(24px, calc((100% - 1080px) / 2)); border-bottom: 1px solid var(--line); background: var(--surface); }
.brand { display: flex; align-items: center; gap: 9px; flex-shrink: 0; min-height: 44px; }
.brand-mark { width: 27px; height: 27px; border-radius: 7px; background: var(--green); color: #fff; }
.brand-mark .icon { width: 17px; height: 17px; }
.brand strong { font-size: 16px; letter-spacing: -.3px; }
.brand-divider { width: 1px; height: 14px; background: var(--line-strong); margin: 0 3px 0 5px; }
.brand-caption { font-size: 12px; color: var(--muted); }
.main-nav { display: flex; align-items: stretch; align-self: stretch; gap: 24px; }
.nav-item { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 1px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.nav-item:hover, .nav-item.active { color: var(--text); }
.nav-item.active { font-weight: 600; }
.nav-item.active::after { content: ""; position: absolute; bottom: -1px; height: 2px; background: var(--green-text); left: 0; right: 0; border-radius: 2px 2px 0 0; }
.nav-count, .count-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 19px; padding: 0 5px; border-radius: 5px; font: 11px/1 var(--number); background: var(--surface-soft); color: var(--muted); }
.header-actions { display: flex; align-items: center; gap: 3px; margin-left: auto; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex-shrink: 0; border-radius: 7px; color: var(--muted); }
.icon-button:hover:not(:disabled) { background: var(--surface-soft); color: var(--text); }
.profile-button { min-height: 40px; display: flex; align-items: center; gap: 8px; border-radius: 7px; padding: 0 7px; margin-left: 6px; font-size: 12px; }
.profile-button:hover { background: var(--surface-soft); }
.profile-button > #profile-name { max-width: 90px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-arrow .icon { width: 13px; height: 13px; color: var(--subtle); }
.avatar, .record-avatar { flex-shrink: 0; display: grid; place-items: center; width: 27px; height: 27px; border: 1px solid var(--green-line); background: var(--green-soft); color: var(--green-text); border-radius: 50%; font-size: 11px; font-weight: 500; }

main { max-width: 1128px; margin: 0 auto; padding: 26px 24px 0; outline: none !important; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 35px; margin-bottom: 17px; }
h1 { font-size: 23px; line-height: 1.3; letter-spacing: -.6px; }
.availability { display: inline-flex; align-items: baseline; gap: 5px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.availability strong { font-size: 17px; font-weight: 600; color: var(--green-text); font-variant-numeric: tabular-nums; }
.availability .icon { width: 14px; height: 14px; align-self: center; color: var(--green-text); }
.connection-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 13px; margin-bottom: 18px; background: var(--warning-soft); border: 1px solid var(--warning-line); border-radius: 7px; color: var(--warning); font-size: 12px; }
.connection-banner button { color: inherit; font-weight: 600; min-height: 32px; flex-shrink: 0; text-decoration: underline; text-underline-offset: 3px; }

/* A single row of seven dates preserves the calendar's rhythm. */
.date-section { margin-bottom: 18px; }
.date-toolbar { display: flex; align-items: center; justify-content: space-between; min-height: 36px; gap: 12px; margin-bottom: 10px; }
.month-group { display: flex; align-items: center; gap: 10px; min-width: 0; }
.month-group > strong { font-size: 13px; white-space: nowrap; }
#offscreen-selection { color: var(--green-text); font-size: 11px; }
.date-actions { display: flex; align-items: center; gap: 9px; }
.text-button { min-height: 34px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 0 7px; border-radius: 6px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.text-button:hover { color: var(--green-text); background: var(--surface-hover); }
.text-button .icon { width: 14px; height: 14px; }
.date-jump { position: relative; min-height: 34px; display: flex; align-items: center; gap: 5px; padding: 0 5px; color: var(--muted); font-size: 12px; cursor: pointer; border-radius: 6px; overflow: hidden; }
.date-jump:hover { color: var(--text); background: var(--surface-hover); }
.date-jump .icon { width: 14px; height: 14px; }
.date-jump input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.date-jump:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.date-jump input::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.week-arrows { display: flex; gap: 2px; padding-left: 5px; border-left: 1px solid var(--line); }
.week-arrows .icon-button { width: 32px; height: 32px; }
.week-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.date-tile { position: relative; min-width: 0; height: 83px; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 3px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; }
.date-tile:hover:not(:disabled) { border-color: var(--line-strong); background: var(--surface-soft); }
.weekday { font-size: 11px; color: var(--muted); }
.day-number { font: 500 23px/1.2 var(--number); letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.date-caption { font-size: 11px; color: var(--muted); }
.date-tile.active, .date-tile[aria-pressed="true"] { background: var(--green-soft); border-color: var(--green-text); box-shadow: inset 0 0 0 1px var(--green-text); color: var(--green-text); }
.date-tile.active .weekday, .date-tile.active .date-caption { color: var(--green-text); }
.date-tile.today .weekday { color: var(--green-text); font-weight: 600; }
.date-tile:disabled { background: var(--surface-soft); opacity: .48; }

/* All desk decisions share one compact surface. */
.workspace-surface { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.filter-bar { min-height: 56px; padding: 9px 17px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.time-filter { display: flex; align-items: center; gap: 9px; min-width: 0; }
.filter-label { color: var(--subtle); }
.filter-label .icon { width: 16px; height: 16px; }
.period-switch { display: flex; align-items: center; gap: 3px; padding: 3px; background: var(--surface-soft); border-radius: 7px; min-width: 0; }
.period-switch button { min-height: 30px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 0 12px; border-radius: 5px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.period-switch button small { font-size: 11px; font-weight: 400; opacity: .82; font-variant-numeric: tabular-nums; }
.period-switch button:hover:not(.active) { background: var(--surface-hover); color: var(--text); }
.period-switch button.active { background: var(--surface); box-shadow: 0 1px 3px #172a1d12, 0 0 0 1px var(--line); color: var(--text); font-weight: 600; }
.view-switch { display: flex; align-items: center; gap: 3px; padding: 3px; border-radius: 7px; background: var(--surface-soft); }
.view-switch button { display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 30px; border-radius: 5px; padding: 0 9px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.view-switch .icon { width: 14px; height: 14px; }
.view-switch button.active { color: var(--text); background: var(--surface); box-shadow: 0 1px 3px #172a1d12, 0 0 0 1px var(--line); }
.view-switch button:hover:not(.active) { color: var(--text); }
.custom-time-filter { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px 19px; background: var(--surface-soft); border-bottom: 1px solid var(--line); font-size: 12px; }
.custom-time-filter > span:first-child { margin-right: 5px; color: var(--muted); }
.custom-time-filter select { min-height: 34px; padding: 0 8px; font-size: 12px; width: 84px; }
.floor-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 21px 8px; }
.location-label { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.location-label .icon { width: 14px; height: 14px; color: var(--muted); }
.location-label .muted { font-weight: 400; margin-left: 3px; }
.legend { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 11px; }
.legend > span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.state-symbol { width: 14px; height: 14px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--green-line); background: var(--green-soft); color: var(--green-text); border-radius: 4px; font: 10px/1 var(--font); }
.state-symbol.occupied { background: var(--occupied); border-color: var(--line-strong); color: var(--occupied-text); }
.state-symbol.mine { background: var(--mine); border-color: var(--mine-line); color: var(--mine-text); font-size: 7px; }
.state-symbol.selected { background: var(--green); border-color: var(--green); }
.floor-plan { padding: 6px 28px 11px; }
.plan-line { display: flex; align-items: center; gap: 12px; max-width: 720px; margin: 0 auto 12px; color: var(--subtle); }
.plan-line > span { flex: 1; height: 1px; background: var(--line); }
.plan-line small { font-size: 10px; letter-spacing: 1px; white-space: nowrap; }
.zones { display: grid; grid-template-columns: 3fr 2fr; gap: 44px; max-width: 720px; margin: 0 auto; }
.zone { min-width: 0; }
.zone-label { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; font-size: 11px; color: var(--muted); }
.zone-label > span { display: grid; place-items: center; width: 19px; height: 19px; border-radius: 4px; background: var(--surface-soft); color: var(--text); font: 600 11px/1 var(--number); }
.zone-label small { margin-left: auto; color: var(--subtle); font: 11px/1 var(--number); }
.desk-grid { display: grid; gap: 9px 12px; }
.six-desks { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.two-desks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.desk-wrap { min-width: 0; position: relative; }
.desk { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; position: relative; width: 100%; height: 76px; border: 1px solid var(--green-line); background: var(--green-soft); border-radius: 7px; color: var(--green-text); }
.desk::before { content: ""; position: absolute; top: -1px; left: calc(50% - 11px); width: 22px; height: 3px; border-radius: 0 0 3px 3px; background: currentColor; opacity: .23; }
.desk:hover { transform: translateY(-1px); border-color: var(--green-text); }
.desk-number { font: 500 24px/1 var(--number); letter-spacing: -.8px; font-variant-numeric: tabular-nums; }
.desk-number small { margin-right: 4px; font: 11px/1 var(--font); letter-spacing: 0; }
.desk-status { display: inline-flex; align-items: center; justify-content: center; gap: 4px; max-width: 100%; font-size: 11px; line-height: 1.2; white-space: nowrap; }
.desk-status .icon { width: 12px; height: 12px; }
.desk.occupied { background: var(--occupied); border-color: var(--line); color: var(--occupied-text); }
.desk.occupied:hover { border-color: var(--line-strong); }
.desk.mine { background: var(--mine); border-color: var(--mine-line); color: var(--mine-text); }
.desk.unknown { background: var(--surface-soft); border-color: var(--line); color: var(--subtle); }
.desk.selected { background: var(--green); border-color: var(--green); color: #fff; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--green-line); }
.desk.selected::before { background: #fff; opacity: .55; }
.desk-tooltip { pointer-events: none; position: absolute; bottom: calc(100% + 9px); left: 50%; z-index: 10; min-width: 152px; max-width: 240px; width: max-content; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); opacity: 0; visibility: hidden; transform: translate(-50%, 4px); }
.desk-tooltip strong, .desk-tooltip span { display: block; font-size: 11px; line-height: 1.7; }
.desk-tooltip span { color: var(--muted); }
.desk-wrap:hover .desk-tooltip, .desk-wrap:focus-within .desk-tooltip { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.tea-area { border-top: 1px dashed var(--line-strong); margin-top: 17px; padding-top: 12px; }
.tea-label { display: flex; align-items: center; justify-content: center; gap: 7px; color: var(--muted); font-size: 11px; margin-bottom: 9px; }
.tea-label .icon { width: 17px; height: 17px; color: var(--subtle); }
#zone-c { width: 100%; }
.temporary-desk { height: 53px; flex-direction: row; gap: 13px; background: var(--surface-soft); border-color: var(--line-strong); }
.temporary-desk .desk-number { font-size: 21px; }
.plan-caption { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 15px; font-size: 11px; color: var(--subtle); }
.plan-caption .icon { width: 12px; height: 12px; }
.floor-bottom { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 5px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.floor-bottom > span { display: inline-flex; align-items: center; gap: 6px; }
.floor-bottom .icon { width: 13px; height: 13px; }
.floor-bottom .text-button { font-size: 11px; padding-right: 0; }

/* Timeline is a second view of the same selected time range. */
.timeline-view { padding: 13px 21px 15px; }
.timeline-header, .timeline-row { display: grid; grid-template-columns: 52px minmax(0, 1fr); align-items: center; gap: 10px; }
.timeline-header { padding-bottom: 8px; color: var(--muted); font-size: 11px; }
.timeline-ticks { display: flex; justify-content: space-between; font: 11px/1.5 var(--number); font-variant-numeric: tabular-nums; }
.timeline-ticks > span { width: 0; text-align: center; }
.timeline-ticks > span:first-child { text-align: left; }
.timeline-ticks > span:last-child { text-align: right; }
.timeline-row { min-height: 43px; border-top: 1px solid var(--line); }
.timeline-desk { display: flex; align-items: center; gap: 4px; padding: 0; min-height: 36px; color: var(--muted); font-size: 12px; text-align: left; }
button.timeline-desk:hover { color: var(--green-text); }
.timeline-track { position: relative; height: 36px; background: repeating-linear-gradient(90deg, transparent 0, transparent calc(11.111% - 1px), var(--line) calc(11.111% - 1px), var(--line) 11.111%); }
.selected-range { position: absolute; top: 0; bottom: 0; pointer-events: none; background: var(--green-soft); border-left: 1px solid var(--green-line); border-right: 1px solid var(--green-line); }
.timeline-block { position: absolute; top: 4px; height: 28px; padding: 0 7px; min-width: 1px; display: flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--occupied); color: var(--text); font-size: 11px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; text-align: left; }
.timeline-block:hover { border-color: var(--green-text); z-index: 1; }
.timeline-block.own { background: var(--mine); border-color: var(--mine-line); color: var(--mine-text); }
.timeline-block.outside { opacity: .48; }
.timeline-time { color: var(--muted); font-size: 10px; }
.timeline-caption { margin-top: 11px; font-size: 11px; color: var(--muted); }

/* Lists use rows and separators instead of extra cards. */
.daily-section, .history-section { margin-top: 15px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
summary { list-style: none; cursor: pointer; }
summary::-webkit-details-marker { display: none; }
.daily-section > summary, .history-section > summary { min-height: 48px; display: flex; align-items: center; gap: 8px; padding: 0 18px; font-size: 12px; font-weight: 500; }
.daily-section > summary > span:first-child { display: inline-flex; align-items: center; gap: 8px; }
.details-chevron { margin-left: auto; color: var(--subtle); }
.details-chevron .icon { width: 14px; height: 14px; }
details[open] > summary .details-chevron { transform: rotate(180deg); }
.record-row { display: grid; grid-template-columns: minmax(100px, 1fr) minmax(110px, .8fr) 130px 70px; align-items: center; gap: 14px; min-height: 51px; padding: 9px 18px; border-top: 1px solid var(--line); font-size: 12px; }
.record-person { display: flex; align-items: center; gap: 8px; min-width: 0; }
.record-person strong { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.record-avatar { width: 25px; height: 25px; font-size: 10px; border-color: var(--line); background: var(--surface-soft); color: var(--muted); }
.record-desk { color: var(--muted); }
.record-time { font-variant-numeric: tabular-nums; white-space: nowrap; }
.record-duration { text-align: right; font-size: 11px; color: var(--muted); }
.empty-daily, .empty-list { padding: 20px 18px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }
.list-heading { display: flex; align-items: center; gap: 8px; margin: 22px 0 12px; }
.list-heading h2 { font-size: 13px; }
.list-heading .muted { font-size: 12px; }
.my-booking-card { display: flex; align-items: center; gap: 16px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); margin-bottom: 9px; }
.my-seat-number { flex-shrink: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; width: 56px; height: 57px; background: var(--green-soft); border-radius: 7px; color: var(--green-text); font: 500 24px/1 var(--number); }
.my-seat-number small { font: 10px/1 var(--font); }
.my-booking-info { flex: 1; min-width: 0; }
.my-booking-info h3 { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 13px; margin-bottom: 5px; }
.my-booking-info p { color: var(--muted); font-size: 12px; line-height: 1.8; }
.my-booking-info p .icon { width: 13px; height: 13px; margin-right: 5px; }
.booking-tag { display: inline-flex; align-items: center; font-size: 10px; font-weight: 400; color: var(--green-text); background: var(--green-soft); border-radius: 4px; padding: 2px 6px; }
.booking-tag.ended, .booking-tag.past { color: var(--muted); background: var(--surface-soft); }
.row-action, .cancel-button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 36px; flex-shrink: 0; border: 1px solid var(--line); border-radius: 6px; padding: 0 11px; color: var(--muted); font-size: 12px; }
.row-action:hover, .cancel-button:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }
.history-section .my-booking-card { border: 0; border-top: 1px solid var(--line); border-radius: 0; margin: 0; background: transparent; }
.empty-state { padding: 49px 24px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); text-align: center; }
.empty-state > .icon { width: 30px; height: 30px; color: var(--subtle); margin-bottom: 15px; stroke-width: 1.3; }
.empty-state h2, .empty-state h3 { font-size: 15px; }
.empty-state p { max-width: 360px; margin: 8px auto 0; color: var(--muted); font-size: 12px; line-height: 1.8; }
.empty-state .primary-button { width: auto; margin: 20px auto 0; min-width: 126px; }
.page-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 0 22px; color: var(--subtle); font-size: 11px; }
.connection-state { min-height: 32px; display: inline-flex; align-items: center; gap: 6px; padding: 0; color: var(--muted); font-size: 11px; text-align: left; }
.connection-state::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--green-text); flex-shrink: 0; }
.connection-state .icon { width: 12px; height: 12px; }
.connection-state:hover { color: var(--text); }
.connection-state.error { color: var(--warning); }
.connection-state.error::before { background: var(--warning); }
.footer-dot { padding: 0 5px; }

/* Native dialogs provide focus containment and predictable dismissal. */
dialog { color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); padding: 0; box-shadow: var(--shadow); }
dialog::backdrop { background: var(--backdrop); }
dialog[open] { animation: dialog-in 180ms ease-out; }
.reservation-dialog { position: fixed; inset: 10px 10px 10px auto; margin: 0; width: 372px; height: calc(100dvh - 20px); max-width: calc(100vw - 20px); max-height: none; border-radius: 12px; overflow: hidden; }
.reservation-dialog[open] { animation: drawer-in 180ms ease-out; }
#booking-form { height: 100%; display: flex; flex-direction: column; }
.drawer-header { display: flex; justify-content: space-between; gap: 10px; flex-shrink: 0; padding: 22px 20px 18px; border-bottom: 1px solid var(--line); }
.eyebrow { display: block; color: var(--muted); font-size: 11px; margin-bottom: 9px; }
.drawer-header h2 { display: flex; align-items: baseline; gap: 5px; line-height: 1.1; }
#selected-number { font: 500 31px/1.1 var(--number); letter-spacing: -1px; }
.drawer-header h2 > span:last-child { font-size: 14px; font-weight: 500; }
.drawer-header p { font-size: 12px; margin-top: 9px; color: var(--muted); }
.drawer-header-actions { display: flex; align-items: flex-start; gap: 1px; margin-top: -5px; margin-right: -8px; }
.drawer-header-actions .icon-button { width: 31px; height: 34px; }
.drawer-header-actions .icon { width: 15px; height: 15px; }
.drawer-header-actions > button:last-child { margin-left: 6px; }
.drawer-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 18px 20px 22px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.selected-status { display: flex; align-items: flex-start; gap: 7px; padding: 9px 10px; border: 1px solid var(--green-line); border-radius: 6px; background: var(--green-soft); color: var(--green-text); font-size: 12px; line-height: 1.6; }
.selected-status .icon { width: 15px; height: 15px; margin-top: 2px; }
.selected-status.unavailable { color: var(--warning); border-color: var(--warning-line); background: var(--warning-soft); }
.drawer-date { display: flex; align-items: center; gap: 8px; padding: 17px 0 4px; font-size: 12px; }
.drawer-date .icon { width: 15px; height: 15px; color: var(--muted); }
.drawer-date strong { font-weight: 500; }
.drawer-date > span:last-child { margin-left: auto; color: var(--muted); }
.drawer-field { margin-top: 20px; }
.field-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 9px; font-size: 12px; font-weight: 500; }
.field-label > span { color: var(--subtle); font-weight: 400; font-size: 11px; }
.period-switch.compact { width: 100%; }
.period-switch.compact button { flex: 1; padding: 0 5px; min-height: 32px; gap: 0; }
.period-switch.compact small { display: none; }
input, select { min-width: 0; color: var(--text); border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); }
input:not([type="date"]) { width: 100%; height: 42px; padding: 0 11px; font-size: 13px; }
input::placeholder { color: var(--subtle); }
input:focus, select:focus { border-color: var(--focus); }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--danger); }
.time-selects { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.time-selects label { min-width: 0; flex: 1; height: 41px; display: flex; align-items: center; gap: 6px; padding: 0 9px; border: 1px solid var(--line-strong); border-radius: 6px; }
.time-selects label:focus-within { border-color: var(--focus); outline: 2px solid var(--focus); outline-offset: 2px; }
.time-selects label > span { color: var(--muted); font-size: 11px; white-space: nowrap; }
.time-selects select { width: 100%; height: 100%; border: 0; padding: 0; font-size: 13px; outline: none; background: transparent; font-variant-numeric: tabular-nums; }
.time-dash { color: var(--subtle); font-size: 12px; }
.saved-identity { min-height: 43px; display: flex; align-items: center; gap: 8px; padding: 0 9px; border: 1px solid var(--line); border-radius: 6px; }
.saved-identity strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 500; }
.saved-identity .avatar { width: 25px; height: 25px; }
.saved-identity .text-button { margin-left: auto; padding-right: 2px; font-size: 11px; }
.conflict-section, .free-section { margin-top: 21px; }
.conflict-section h3, .free-section h3 { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; margin-bottom: 9px; }
.conflict-section h3 { color: var(--warning); }
.conflict-section h3 .icon { width: 14px; height: 14px; }
.conflict-record { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.conflict-record:last-child { border-bottom: 0; }
.conflict-record > span:last-child { color: var(--muted); font-size: 11px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.conflict-record strong { font-weight: 500; }
.free-slots { display: flex; flex-wrap: wrap; gap: 7px; }
.free-slots button { display: inline-flex; align-items: center; justify-content: center; min-height: 34px; padding: 0 9px; border-radius: 5px; border: 1px solid var(--green-line); color: var(--green-text); background: var(--green-soft); font-size: 11px; font-variant-numeric: tabular-nums; }
.free-slots button:hover { border-color: var(--green-text); }
.free-slots > span, .free-slots > p { color: var(--muted); font-size: 12px; }
.seat-schedule { margin-top: 22px; padding-top: 15px; border-top: 1px solid var(--line); }
.seat-schedule > summary { display: flex; align-items: center; gap: 6px; min-height: 30px; color: var(--muted); font-size: 12px; }
.seat-schedule > summary > [data-icon], .seat-schedule > summary > .icon { margin-left: auto; }
.seat-schedule > summary .icon { width: 13px; height: 13px; }
.seat-schedule[open] > summary > [data-icon] { transform: rotate(180deg); }
#seat-records { padding-top: 6px; }
#seat-records .record-row { grid-template-columns: 1fr auto; gap: 6px; padding: 9px 0; min-height: 42px; }
#seat-records .record-desk, #seat-records .record-duration { display: none; }
#seat-records .record-time { font-size: 11px; color: var(--muted); }
.drawer-footer { flex-shrink: 0; position: sticky; bottom: 0; padding: 14px 20px 18px; background: var(--surface); border-top: 1px solid var(--line); }
.drawer-summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 11px; font-size: 12px; color: var(--muted); }
.drawer-summary strong { font-size: 12px; font-weight: 500; color: var(--text); white-space: nowrap; }
.primary-button { min-height: 42px; width: 100%; display: flex; align-items: center; justify-content: center; gap: 9px; padding: 0 15px; border-radius: 7px; color: #fff; background: var(--green); font-size: 13px; font-weight: 500; }
.primary-button:hover:not(:disabled) { background: var(--green-hover); }
.primary-button:active:not(:disabled) { transform: translateY(1px); }
.primary-button .icon { width: 16px; height: 16px; }
.primary-button:disabled { opacity: .5; }
.primary-button.small { width: auto; min-height: 36px; font-size: 12px; padding: 0 12px; }
.primary-button .spinner, .primary-button[aria-busy="true"]::before { content: ""; width: 14px; height: 14px; border: 2px solid #ffffff60; border-top-color: #fff; border-radius: 50%; animation: busy-pulse 180ms ease-in-out infinite alternate; }
.primary-button:has(.spinner)[aria-busy="true"]::before { display: none; }
.form-error, .inline-error { color: var(--danger); font-size: 12px; line-height: 1.6; }
.form-error { padding: 0 0 10px; }
.inline-error { display: block; margin-top: 5px; }
.inline-error:empty { display: none; }
.custom-time-filter .inline-error { margin: 0; }

.small-dialog { width: 370px; max-width: calc(100vw - 32px); max-height: calc(100dvh - 40px); margin: auto; padding: 22px; border-radius: 12px; overflow-y: auto; overscroll-behavior: contain; }
.dialog-heading, .dialog-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.dialog-heading h2, .small-dialog h2 { font-size: 17px; letter-spacing: -.3px; }
.dialog-heading .icon-button, .dialog-top .icon-button { margin: -7px -8px -7px 0; }
.dialog-top > .icon { width: 22px; height: 22px; color: var(--green-text); }
.small-dialog p { font-size: 12px; line-height: 1.8; color: var(--muted); }
.dialog-description { margin-bottom: 18px; }
.form-label { display: block; margin: 15px 0 7px; font-size: 12px; font-weight: 500; }
.small-dialog .primary-button { margin-top: 19px; }
.small-dialog .form-error { color: var(--danger); margin-top: 9px; padding: 0; }
.logout-button { width: 100%; margin-top: 8px; }
.dialog-actions { display: flex; gap: 9px; margin-top: 20px; }
.dialog-actions > button { flex: 1; margin: 0 !important; min-height: 42px; }
.secondary-button { display: flex; justify-content: center; align-items: center; min-height: 40px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 7px; font-size: 12px; background: var(--surface); }
.secondary-button:hover { background: var(--surface-soft); }
.dialog-details { margin: 16px 0; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 12px; line-height: 1.9; }
.dialog-note { font-size: 11px !important; color: var(--subtle) !important; }
.rules-list { margin: 16px 0; padding-left: 19px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.rules-list li { padding-left: 3px; margin: 9px 0; }
.success-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 9px; background: var(--green-soft); color: var(--green-text); margin-bottom: 15px; }
.success-icon .icon { width: 20px; height: 20px; }
.toast { position: fixed; bottom: 22px; left: 50%; z-index: 100; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px); display: flex; align-items: center; gap: 9px; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); box-shadow: var(--shadow); font-size: 12px; animation: toast-in 180ms ease-out; }
.toast > .icon { color: var(--green-text); width: 18px; height: 18px; }
.toast.warning > .icon { color: var(--warning); }
.toast-text { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.toast-text strong { font-size: 12px; font-weight: 500; }
.toast-text small { font-size: 11px; color: var(--muted); }
.toast-action { min-height: 32px; margin-left: 9px; border-radius: 5px; padding: 0 8px; color: var(--green-text); font-size: 12px; font-weight: 500; white-space: nowrap; }
.toast-action:hover { background: var(--green-soft); }
.toast .icon-button { width: 28px; height: 30px; }
.noscript { padding: 20px; text-align: center; }

.desk, .desk-tooltip, .details-chevron { transition: transform 160ms ease, opacity 160ms ease; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes drawer-in { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: translateX(0); } }
@keyframes sheet-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 6px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes busy-pulse { from { opacity: .45; transform: scale(.9); } to { opacity: 1; transform: scale(1); } }

@media (max-width: 900px) {
  .topbar { gap: 24px; }
  .brand-caption, .brand-divider { display: none; }
  .period-switch button { padding: 0 10px; }
  .period-switch button small { display: none; }
  .zones { gap: 42px; max-width: 660px; }
}

@media (max-width: 760px) {
  .desk-tooltip { display: none; }
}

@media (max-width: 700px) {
  html { scrollbar-gutter: auto; }
  .topbar { padding: 0 16px; gap: 20px; }
  .main-nav { gap: 18px; }
  .nav-item { font-size: 12px; }
  .header-actions { gap: 0; }
  .header-actions > .icon-button { width: 40px; height: 44px; }
  .help-button, #profile-name, .profile-arrow { display: none; }
  .profile-button { min-width: 38px; height: 44px; margin: 0; padding: 0 5px; }
  main { padding: 22px 18px 0; }
  .page-heading { margin-bottom: 15px; }
  h1 { font-size: 21px; }
  .availability { font-size: 11px; }
  .availability strong { font-size: 15px; }
  .date-toolbar { gap: 6px; }
  .date-actions { gap: 3px; }
  .date-actions .text-button, .date-jump { min-height: 40px; }
  .week-arrows .icon-button { width: 35px; height: 40px; }
  .week-strip { gap: 5px; }
  .date-tile { height: 79px; border-radius: 7px; }
  .day-number { font-size: 22px; }
  .date-caption, .weekday { font-size: 11px; }
  .filter-bar { padding: 7px 11px; gap: 8px; }
  .filter-label { display: none; }
  .period-switch button { min-height: 38px; padding: 0 9px; font-size: 11px; }
  .view-switch button { min-height: 38px; padding: 0 8px; }
  .view-switch button > span:last-child { display: none; }
  .view-switch .icon { width: 16px; height: 16px; }
  .floor-heading { padding: 13px 14px 9px; flex-wrap: wrap; gap: 10px; }
  .legend { gap: 12px; }
  .floor-plan { padding: 7px 17px 12px; }
  .zones { gap: 26px; }
  .zone-label { gap: 5px; }
  .zone-label small { display: none; }
  .desk-grid { gap: 9px; }
  .desk { height: 76px; }
  .desk-number { font-size: 23px; }
  .desk-status { font-size: 11px; gap: 3px; }
  .temporary-desk { height: 53px; }
  .tea-area { margin-top: 17px; }
  .floor-bottom { padding: 7px 14px; align-items: flex-start; flex-wrap: wrap; gap: 2px; }
  .floor-bottom > span { min-height: 27px; }
  .floor-bottom .text-button { min-height: 34px; }
  .record-row { grid-template-columns: minmax(85px, 1fr) minmax(90px, .8fr) auto; gap: 8px; padding: 10px 14px; }
  .record-duration { display: none; }
  .record-person { gap: 6px; }
  .timeline-view { padding-left: 15px; padding-right: 15px; }
  .timeline-header, .timeline-row { grid-template-columns: 39px minmax(0, 1fr); gap: 6px; }
  .timeline-block { padding: 0 4px; font-size: 11px; }
  .timeline-time { display: none; }
  .timeline-ticks { font-size: 10px; }
  .reservation-dialog { inset: auto 0 0; margin: 0; width: 100%; max-width: 100%; height: min(760px, 90dvh); max-height: 90dvh; border-radius: 15px 15px 0 0; border-bottom: 0; }
  .reservation-dialog[open] { animation: sheet-in 180ms ease-out; }
  .drawer-header { padding: 19px 22px 15px; }
  .drawer-header::before { content: ""; position: absolute; top: 7px; left: calc(50% - 16px); width: 32px; height: 3px; border-radius: 3px; background: var(--line-strong); }
  .drawer-header-actions .icon-button { width: 36px; height: 44px; }
  .drawer-header-actions { margin-top: -1px; }
  .drawer-scroll { padding: 16px 22px 22px; }
  .drawer-footer { padding: 13px 22px calc(15px + env(safe-area-inset-bottom)); }
  .drawer-field { margin-top: 17px; }
  .period-switch.compact button { min-height: 38px; font-size: 12px; }
  input:not([type="date"]), .time-selects select { font-size: 16px; }
  .time-selects label, .saved-identity { min-height: 44px; }
  .saved-identity .text-button, .free-slots button { min-height: 40px; }
  .primary-button, .primary-button.small, .row-action, .secondary-button { min-height: 44px; }
  .small-dialog .icon-button { width: 44px; height: 44px; }
  .page-footer { flex-wrap: wrap; gap: 0 12px; padding-top: 10px; }
  .page-footer > span { min-height: 26px; display: inline-flex; align-items: center; }
  .my-booking-card { padding: 14px; gap: 12px; }
  .my-booking-info p { font-size: 11px; }
  .my-seat-number { width: 49px; height: 54px; }
  .row-action { padding: 0 9px; font-size: 11px; }
  .toast { bottom: calc(14px + env(safe-area-inset-bottom)); }
}

@media (max-width: 420px) {
  .topbar { gap: 16px; padding: 0 13px; }
  .brand { gap: 6px; }
  .brand strong { font-size: 15px; }
  .brand-mark { width: 25px; height: 25px; }
  .main-nav { gap: 13px; }
  .header-actions > .icon-button { width: 36px; }
  .profile-button { min-width: 32px; padding: 0 3px; }
  .nav-count { min-width: 16px; height: 17px; padding: 0 4px; font-size: 10px; }
  main { padding: 19px 13px 0; }
  .page-heading { gap: 8px; }
  h1 { font-size: 20px; }
  .date-actions { gap: 0; }
  .month-group > strong { font-size: 12px; }
  .date-jump > span:nth-child(2) { display: none; }
  .date-jump { width: 36px; justify-content: center; padding: 0; }
  .date-jump .icon { width: 16px; height: 16px; }
  .week-arrows { padding-left: 0; border-left: 0; }
  .week-arrows .icon-button { width: 32px; }
  #offscreen-selection { max-width: 76px; font-size: 11px; }
  .week-strip { gap: 4px; }
  .date-tile { height: 76px; }
  .day-number { font-size: 21px; }
  .date-caption { font-size: 11px; max-width: 100%; line-height: 1.15; }
  .weekday { letter-spacing: -.6px; }
  .filter-bar { padding: 6px 8px; gap: 6px; }
  .period-switch { padding: 2px; gap: 1px; }
  .period-switch button { padding: 0 7px; }
  .view-switch { gap: 1px; padding: 2px; }
  .view-switch button { padding: 0 7px; }
  .floor-heading { padding: 12px 12px 8px; }
  .legend { width: 100%; justify-content: flex-start; gap: 13px; }
  .floor-plan { padding: 7px 12px 11px; }
  .plan-line { margin-bottom: 13px; }
  .zones { gap: 18px; }
  .zone-label { font-size: 11px; gap: 4px; }
  .zone-label > span { width: 17px; height: 17px; font-size: 10px; }
  .desk-grid { gap: 8px; }
  .desk { height: 74px; }
  .desk-status .icon { width: 11px; height: 11px; }
  .desk-number { font-size: 22px; }
  .tea-label { gap: 5px; }
  .temporary-desk { height: 53px; gap: 8px; }
  .desk.mine .desk-status .icon { display: none; }
  .plan-caption { font-size: 11px; margin-top: 14px; }
  .floor-bottom { padding: 7px 12px; font-size: 11px; }
  .floor-bottom > span { gap: 5px; }
  .record-row { grid-template-columns: minmax(78px, 1fr) 76px auto; padding: 10px 12px; gap: 6px; font-size: 11px; }
  .record-avatar { width: 22px; height: 22px; }
  .record-person strong { max-width: 69px; }
  .my-booking-card { flex-wrap: wrap; gap: 10px; }
  .my-booking-info { min-width: calc(100% - 70px); }
  .my-booking-card .row-action { margin-left: 59px; min-height: 36px; }
  .my-booking-info h3 { gap: 5px; }
  .page-footer { font-size: 10px; }
  .small-dialog { padding: 20px; }
  .toast { padding: 11px 12px; gap: 7px; }
  .toast-action { margin-left: 1px; padding: 0 5px; }
  .toast-text small { max-width: 180px; }
}

@media (max-width: 350px) {
  .topbar { gap: 12px; padding: 0 10px; }
  .brand { gap: 5px; }
  .brand strong { font-size: 14px; }
  .main-nav { gap: 10px; }
  .nav-item { font-size: 11px; }
  .header-actions > .icon-button { width: 30px; }
  .profile-button { min-width: 29px; }
  .profile-button .avatar { width: 24px; height: 24px; font-size: 10px; }
  main { padding-left: 10px; padding-right: 10px; }
  .availability { gap: 3px; }
  .date-toolbar { gap: 2px; }
  .date-actions .text-button { padding: 0 5px; }
  .week-arrows .icon-button { width: 30px; }
  .week-strip { gap: 3px; }
  .date-caption { letter-spacing: -.5px; }
  .period-switch button { padding: 0 6px; }
  .view-switch button { padding: 0 6px; }
  .zones { gap: 12px; }
  .desk-grid { gap: 7px; }
  .desk-status { font-size: 11px; gap: 2px; }
  .desk-status .icon { width: 10px; height: 10px; }
  .legend { gap: 11px; }
  .floor-bottom > span { align-items: flex-start; }
  .floor-bottom > span > [data-icon] { margin-top: 3px; }
  .record-row { grid-template-columns: minmax(69px, 1fr) 67px auto; }
  .record-person { gap: 4px; }
  .record-person strong { max-width: 57px; }
  .record-time { font-size: 10px; }
}

@media (hover: none) {
  .desk:hover { transform: none; }
  .desk-tooltip { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Keep the active time range visible even when compact preset labels hide their times. */
.floor-heading{flex-wrap:wrap;row-gap:10px}
#current-time-range{font-variant-numeric:tabular-nums;white-space:nowrap}
