:root {
  color-scheme: light;
  --page: #f2f3ee;
  --surface: #fbfcf8;
  --ink: #242e28;
  --muted: #54625a;
  --line: #dbe0d7;
  --accent: #28594b;
  --accent-hover: #18483c;
  --on-accent: #fff;
  --available: #b9e0cd;
  --preferred: #bcbef0;
  --some: #dcebd2;
  --all: #83c0a1;
  --tab-track: #e6eae3;
  --half-line: #e5e9e155;
  --clock-gap: #eef0e9;
  --neutral-chip: #eceee6;
  --available-chip: #deeee2;
  --preferred-mark: #4d4c91;
  --shadow: 0 12px 36px #263a2c09;
  font: 16px/1.5 "Inter", "Segoe UI", system-ui, sans-serif;
}
:root[data-theme=dark] {
  color-scheme: dark;
  --page: #161b19;
  --surface: #202823;
  --ink: #edf3ee;
  --muted: #b2c1b8;
  --line: #394941;
  --accent: #acd3be;
  --accent-hover: #c4e3d1;
  --on-accent: #16291f;
  --available: #376954;
  --preferred: #565287;
  --some: #475d3f;
  --all: #498064;
  --tab-track: #29362e;
  --half-line: #3a4b4466;
  --clock-gap: #2a372e;
  --neutral-chip: #303d34;
  --available-chip: #304938;
  --preferred-mark: #c8c5ff;
  --shadow: 0 12px 36px #0003;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100svh; background: var(--page); color: var(--ink); }
button, select, summary, a.button {
  font: inherit; font-size: .9rem; min-height: 2.5rem; border: 1px solid var(--line); border-radius: 8px;
  color: inherit; background: var(--surface); padding: .45rem .75rem;
}
button, select, summary, a.button { cursor: pointer; }
button:hover:not(:disabled), a.button:hover { border-color: var(--accent); }
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 650; }
.primary:hover:not(:disabled) { background: var(--accent-hover); }
.quiet { background: transparent; }
a { color: var(--accent); text-underline-offset: .2em; }
.button { display: inline-block; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.8rem, 4.5vw, 3.2rem); letter-spacing: -.055em; line-height: 1.12; font-weight: 650; }
h2 { font-size: 1.13rem; letter-spacing: -.025em; }
h3 { font-size: .95rem; }
.muted { color: var(--muted); }
.topbar { display: flex; justify-content: space-between; align-items: center; min-height: 4rem;
  padding: .5rem clamp(1rem, 4vw, 4.5rem); border-bottom: 1px solid var(--line); background: var(--surface); }
.topbar nav { display: flex; align-items: center; gap: 1rem; }
.theme-toggle { display: grid; place-items: center; width: 2.5rem; padding: 0; }
.theme-toggle svg { width: 1.2rem; height: 1.2rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .moon, [data-theme=dark] .theme-toggle .sun { display: none; }
[data-theme=dark] .theme-toggle .moon { display: block; }
.brand { font-size: .95rem; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; color: var(--ink); text-decoration: none; }
.brand span { color: var(--accent); }
main { width: min(90rem, calc(100% - clamp(1.5rem, 7vw, 8rem))); margin: clamp(1rem, 3vw, 2.75rem) auto; }
main > #startup { margin: 3rem auto; max-width: 32rem; }
.signin { max-width: 34rem; margin: 10svh auto; padding: clamp(1.5rem, 5vw, 3rem); border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.signin p { margin: .9rem 0 1.4rem; color: var(--muted); }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.tabs { display: flex; gap: .3rem; background: var(--tab-track); border-radius: 10px; padding: .24rem; }
.tabs button { border-color: transparent; background: transparent; padding-inline: .75rem; }
.tabs button[aria-pressed=true] { border-color: var(--line); background: var(--surface); color: var(--accent); font-weight: 700; }
.workspace-layout { display: grid; align-items: start; grid-template-columns: minmax(0, 1fr) minmax(14rem, 18rem); gap: 1rem; }
.calendar-card, .side-card { min-width: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.calendar-card { overflow: clip; }
.calendar-toolbar { position: relative; display: flex; align-items: start; justify-content: space-between; gap: .7rem; flex-wrap: wrap; padding: 1rem 1rem .55rem; }
.zone-control { display: flex; gap: .55rem; align-items: center; margin-top: .35rem; font-size: .88rem; color: var(--muted); }
.zone-control select { min-width: 0; max-width: min(19rem, 50vw); min-height: 2rem; padding-block: .2rem; }
.week-controls, .month-controls { display: flex; gap: .35rem; align-items: center; }
.calendar-arrow { width: 2.5rem; padding: 0; font-size: 1.25rem; line-height: 1; }
.week-picker { position: absolute; top: 100%; right: .65rem; z-index: 5; width: min(17.5rem, calc(100vw - 3.5rem)); padding: .7rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 10px 24px #0003; }
.month-controls { justify-content: space-between; margin-bottom: .4rem; }
.month-controls strong { font-size: .9rem; }
.month-controls .calendar-arrow { min-height: 2rem; width: 2rem; }
.picker-days, .picker-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); text-align: center; }
.picker-days { padding: 0 .25rem; font-size: .78rem; color: var(--muted); }
.picker-weeks { display: grid; gap: .15rem; margin-block: .3rem .5rem; }
.picker-week { min-height: 2rem; align-items: center; padding: .15rem .25rem; border-color: transparent; }
.picker-week[aria-pressed=true] { border-color: var(--accent); background: var(--available-chip); }
.picker-week [data-outside] { color: var(--muted); }
.picker-week [data-today] { font-weight: 750; text-decoration: underline; text-underline-offset: .17em; }
#go-current-week { width: 100%; min-height: 2rem; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; padding: .35rem 1rem .7rem; }
.legend button, .team-legend span { display: inline-flex; gap: .45rem; align-items: center; }
.legend button[aria-pressed=true] { border-color: var(--accent); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.team-legend { gap: .85rem; min-height: 3rem; color: var(--muted); font-size: .9rem; }
.swatch { width: .8rem; height: .8rem; border: 1px solid #263a2c29; border-radius: 3px; }
.available { background: var(--available); }
.preferred { background: var(--preferred); }
.unavailable { background: var(--surface); }
.all { background: var(--all); }
.some { background: var(--some); }
.manual { margin: 0 1rem .7rem; }
.manual summary { min-height: 0; width: fit-content; padding: .25rem .55rem; color: var(--muted); }
.range-form { display: flex; align-items: end; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }
.range-form label { display: grid; font-size: .9rem; gap: .15rem; }
.calendar-scroll { overflow: auto; height: clamp(370px, 61vh, 680px); border-top: 1px solid var(--line); }
.calendar { display: grid; min-width: 525px; grid-template-columns: 4.5rem repeat(7, minmax(0, 1fr)); grid-template-rows: 3.5rem repeat(48, 21px); user-select: none; }
.corner, .day-heading { position: sticky; top: 0; z-index: 2; background: var(--surface); border-bottom: 1px solid var(--line); }
.corner { left: 0; z-index: 3; }
.day-heading { display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: .88rem; color: var(--muted); }
.day-heading strong { font-size: 1.1rem; font-variant-numeric: tabular-nums; line-height: 1.2; }
.day-heading.today strong { display: grid; place-items: center; width: 1.55rem; height: 1.55rem; border-radius: 50%; background: var(--accent); color: var(--on-accent); }
.hour-label { position: sticky; left: 0; z-index: 1; padding: 0 .35rem; background: var(--surface); color: var(--muted); font-size: .75rem; text-align: right; white-space: nowrap; }
button.slot { position: relative; min-height: 0; padding: 0; border: 0; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); border-radius: 0; }
button.slot[data-half="0"] { border-bottom-color: var(--half-line); }
button.slot:focus-visible { outline-offset: -2px; z-index: 1; }
button.slot:hover:not(:disabled) { box-shadow: inset 0 0 0 1px var(--accent); }
button.slot[aria-disabled=true] { cursor: default; }
button.slot:disabled { opacity: 1; background: repeating-linear-gradient(135deg, var(--clock-gap) 0 4px, var(--surface) 4px 8px); }
.slot[data-level="1"] { background: var(--available); }
.slot[data-level="2"] { background: var(--preferred); }
.slot[data-overlap="all"] { background: var(--all); }
.slot[data-overlap="some"] { background: var(--some); }
.slot[data-preferred]::after { content: ""; position: absolute; inset: 4px 5px 4px auto; width: 3px; border-radius: 2px; background: var(--preferred-mark); }
.slot[data-selected] { box-shadow: inset 0 0 0 2px var(--accent); }
.sidebar { display: grid; gap: .75rem; min-width: 0; }
.side-card { padding: .95rem; }
.side-card h2 { margin-bottom: .5rem; }
.side-card p, #notice { font-size: .9rem; }
.status-chip { width: fit-content; margin-bottom: .4rem; padding: .12rem .45rem; border-radius: 6px; background: var(--neutral-chip); color: var(--muted); }
.status-chip[data-state=available] { background: var(--available-chip); color: var(--accent); }
.stack { display: grid; gap: .4rem; margin-top: .65rem; }
.status-list { margin: .3rem 0 0; padding: 0; list-style: none; }
.status-list li { display: flex; align-items: baseline; justify-content: space-between; gap: .4rem; border-bottom: 1px solid var(--line); padding: .55rem 0; font-size: .9rem; overflow-wrap: anywhere; }
.status-list li:last-child { border-bottom: 0; }
.small-status { color: var(--muted); text-align: right; }
#notice { color: var(--accent); padding-inline: .25rem; }
#notice:empty { display: none; }
@media (max-width: 820px) {
  .workspace-layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); }
}
@media (max-width: 450px) {
  .topbar nav { gap: .5rem; }
  .calendar-toolbar, .legend { padding-inline: .65rem; }
  .manual { margin-inline: .65rem; }
  .legend button { padding-inline: .45rem; }
  .calendar-scroll { height: 50vh; }
}
