:root {
  --bg: #f4f1ea; --card: #ffffff; --ink: #1f2a2a; --soft: #5b6766; --line: #dcd6c9;
  --accent: #2f7d6d; --accent-ink: #ffffff; --warm: #f2a33a;
  --good: #9fd8b8; --ok: #f6d48b; --bad: #f2a3a0; --sel: #1f2a2a;
  --radius: 14px; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 14px rgba(0,0,0,.05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141a1a; --card: #1d2525; --ink: #e9eeec; --soft: #a3b0ad; --line: #34403e;
    --accent: #5cc0a8; --accent-ink: #0f1515; --good: #2f6b52; --ok: #7a6224; --bad: #7c3a37; --sel: #e9eeec;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--warm); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--card); padding: 8px 12px; border-radius: 8px; z-index: 10; }
.skip-link:focus { left: 8px; }

.site-header { display: flex; gap: 12px; align-items: center; max-width: 1000px; margin: 0 auto; padding: 18px 16px 10px; }
.logo { font-size: 2.2rem; color: var(--accent); line-height: 1; }
h1 { margin: 0; font-size: 1.6rem; letter-spacing: -.01em; }
.tag { margin: 0; color: var(--soft); }
h2 { margin: 0 0 8px; font-size: 1.15rem; }
h3 { margin: 16px 0 6px; font-size: 1rem; }

.layout { display: grid; gap: 14px; max-width: 1000px; margin: 0 auto; padding: 8px 16px 16px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); padding: 16px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.card-head h2 { margin: 0; }
.hint, .note { color: var(--soft); font-size: .92rem; margin: 4px 0; }
.note:empty { display: none; }
.empty { color: var(--soft); text-align: center; padding: 12px; border: 2px dashed var(--line); border-radius: 10px; }

/* search combobox */
.combo { position: relative; }
#zone-search { width: 100%; padding: 12px 14px; border: 2px solid var(--line); border-radius: 12px; background: var(--bg); font-size: 1.05rem; }
#zone-search:focus { border-color: var(--accent); outline: none; }
#zone-list { position: absolute; z-index: 5; left: 0; right: 0; top: 100%; margin: 4px 0 0; padding: 4px; list-style: none; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.15); max-height: 320px; overflow: auto; }
#zone-list li { padding: 8px 10px; border-radius: 8px; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; }
#zone-list li small { color: var(--soft); }
#zone-list li[aria-selected="true"], #zone-list li:hover { background: var(--bg); }
.field-msg { min-height: 1.2em; margin: 4px 2px 0; font-size: .9rem; color: var(--soft); }

/* people */
.people { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.person { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.person .who { min-width: 0; }
.name-input { border: 1px solid transparent; background: transparent; font-weight: 600; padding: 2px 6px; margin-left: -6px; border-radius: 6px; width: 100%; max-width: 260px; }
.name-input:hover, .name-input:focus { border-color: var(--line); background: var(--bg); outline: none; }
.zone-meta { font-size: .85rem; color: var(--soft); }
.hours { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; grid-column: 1 / -1; }
.hours > span { font-size: .85rem; color: var(--soft); }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.stepper button { border: 0; background: transparent; width: 36px; height: 36px; cursor: pointer; font-size: 1.1rem; }
.stepper button:hover { background: var(--bg); }
.stepper output { min-width: 3.2em; text-align: center; font-variant-numeric: tabular-nums; }
.del { border: 0; background: transparent; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: 1.3rem; color: var(--soft); }
.del:hover { background: var(--bad); color: var(--ink); }
.host-badge { font-size: .72rem; background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 1px 8px; margin-left: 4px; vertical-align: middle; }

/* controls */
.controls { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; }
.ctl { display: flex; align-items: center; gap: 8px; }
.ctl input[type=date] { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.chips button { border: 1px solid var(--line); background: var(--bg); padding: 6px 12px; border-radius: 999px; cursor: pointer; min-height: 36px; }
.chips button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* grid */
.legend { font-size: .82rem; color: var(--soft); display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-left: 6px; }
.good { background: var(--good); } .ok { background: var(--ok); } .bad { background: var(--bad); }
.grid-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.grid { border-collapse: separate; border-spacing: 0; font-size: .74rem; font-variant-numeric: tabular-nums; }
.grid th, .grid td { padding: 0; text-align: center; }
.grid th[scope=row] { position: sticky; left: 0; z-index: 1; background: var(--card); text-align: left; padding: 0 8px; white-space: nowrap; font-weight: 600; max-width: 110px; overflow: hidden; text-overflow: ellipsis; border-right: 1px solid var(--line); }
.grid thead th { height: 26px; color: var(--soft); font-weight: 500; }
.grid td { width: 26px; min-width: 26px; height: 32px; border-right: 1px solid rgba(0,0,0,.04); cursor: pointer; }
.grid td.half { color: transparent; }
.grid .sel { box-shadow: inset 2px 0 0 var(--sel), inset -2px 0 0 var(--sel); color: var(--ink); }
.grid thead .sel { color: var(--ink); font-weight: 700; }
.grid td.best { font-weight: 700; }
.slider-row { display: flex; gap: 10px; align-items: center; margin-top: 10px; font-size: .9rem; color: var(--soft); }
.slider-row input { flex: 1; accent-color: var(--accent); }

/* results */
.suggest { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.sugg { text-align: left; border: 1px solid var(--line); background: var(--bg); border-radius: 12px; padding: 10px 12px; cursor: pointer; }
.sugg[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.sugg strong { display: block; font-size: 1.1rem; }
.sugg small { color: var(--soft); }
.selected { margin-top: 12px; }
.times { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.times li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 10px; border-radius: 8px; }
.badge { font-size: .8rem; padding: 0 8px; border-radius: 999px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn { border: 1px solid var(--line); background: var(--bg); padding: 10px 16px; border-radius: 999px; cursor: pointer; min-height: 44px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; font-size: 1.05rem; padding: 12px 22px; }
.btn:hover { filter: brightness(1.05); }

/* switch */
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; }
.switch input { width: 44px; height: 24px; appearance: none; -webkit-appearance: none; background: var(--line); border-radius: 999px; position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .2s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { left: 23px; }

/* ledger + schedule */
.ledger { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.ledger li { display: grid; grid-template-columns: minmax(70px, 140px) 1fr auto; gap: 8px; align-items: center; font-size: .92rem; }
.ledger .bar { height: 14px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.ledger .bar i { display: block; height: 100%; background: var(--warm); border-radius: 999px; transition: width .3s; }
.ledger small { color: var(--soft); }
.table-wrap { overflow-x: auto; }
.occ { border-collapse: collapse; font-size: .88rem; width: 100%; font-variant-numeric: tabular-nums; }
.occ th, .occ td { padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.occ td span { padding: 1px 6px; border-radius: 6px; }
.occ tr.next { outline: 2px solid var(--accent); outline-offset: -2px; }

textarea { width: 100%; margin-top: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: var(--bg); font-family: ui-monospace, monospace; font-size: .8rem; }

/* ads */
.ad-slot { position: relative; display: flex; align-items: center; justify-content: center; margin: 8px auto; border: 2px dashed var(--line); border-radius: 12px; overflow: hidden; }
.ad-slot__label { position: absolute; top: 4px; left: 8px; font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--soft); }
.ad-slot--top { width: calc(100% - 32px); max-width: 728px; height: 66px; }
.ad-slot--rect { width: 300px; max-width: calc(100% - 32px); height: 250px; margin: 16px auto; }
.ad-slot--bottom { width: calc(100% - 32px); max-width: 970px; height: 100px; margin: 24px auto; }
@media (min-width: 760px) { .ad-slot--top { height: 94px; } }

.faq { max-width: 760px; margin: 24px auto; padding: 0 16px; }
.faq details { border-bottom: 1px solid var(--line); padding: 10px 0; }
.faq summary { cursor: pointer; font-weight: 600; }
footer { text-align: center; color: var(--soft); font-size: .85rem; padding: 12px 16px 32px; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%) translateY(150%); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; transition: transform .25s; z-index: 20; max-width: calc(100% - 32px); }
.toast.show { transform: translateX(-50%) translateY(0); }

.embed-link { display: none; }
body.embed .chrome, body.embed .edit-only, body.embed .ad-slot { display: none !important; }
body.embed .layout { padding: 8px; gap: 8px; }
body.embed .embed-link { display: block; text-align: center; color: var(--accent); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
