:root {
  color-scheme: dark;
  --bg: #0d1114;
  --bg-elevated: rgba(20, 25, 29, .94);
  --panel: rgba(18, 23, 27, .88);
  --panel-solid: #151a1e;
  --panel-hover: #1b2227;
  --line: rgba(255,255,255,.10);
  --line-strong: rgba(255,255,255,.17);
  --text: #f3f5f6;
  --muted: #a3adb3;
  --quiet: #77838a;
  --accent: #d65b61;
  --accent-soft: rgba(214,91,97,.16);
  --success: #66ad79;
  --danger: #ee7479;
  --radius: 16px;
  --shadow: 0 18px 50px rgba(0,0,0,.32);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { min-height: 100vh; margin: 0; color: var(--text); background-color: var(--bg); }
body[data-theme="graphite"] { background-image: radial-gradient(circle at 48% -20%, rgba(113,126,134,.15), transparent 42%), linear-gradient(145deg,#0f1417,#090c0e 70%); }
body[data-theme="midnight"] { background-image: radial-gradient(circle at 48% -20%, rgba(52,91,123,.24), transparent 46%), linear-gradient(145deg,#111820,#090c11 70%); }
body[data-theme="paper"] { background-image: repeating-linear-gradient(100deg,rgba(255,255,255,.018) 0 1px,transparent 1px 5px), radial-gradient(circle at 50% 0,rgba(118,91,68,.18),transparent 45%),linear-gradient(145deg,#171512,#0e0d0c 72%); }
body[data-theme="monthly"] { background-image: radial-gradient(circle at 55% -20%, color-mix(in srgb,var(--month-tint,#626d78) 24%,transparent),transparent 48%), linear-gradient(145deg,#11161a,#090c0e 72%); }
button,input,select,textarea { font: inherit; }
button,a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible { outline: 3px solid color-mix(in srgb,var(--accent) 65%,white); outline-offset: 2px; }
svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.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; z-index: 1000; top: 8px; left: 8px; transform: translateY(-150%); padding: .7rem 1rem; color: white; background: var(--accent); border-radius: 8px; }
.skip-link:focus { transform: none; }
.muted { color: var(--muted); }
.eyebrow,.section-label { margin: 0 0 .35rem; color: var(--quiet); font-size: .68rem; font-weight: 750; letter-spacing: .16em; text-transform: uppercase; }

.auth-screen { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.auth-card { width: min(100%,390px); padding: 2rem; background: rgba(19,24,28,.96); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); }
.auth-card h1 { margin: .55rem 0 .45rem; font-size: 2rem; }
.auth-card .muted { margin: 0 0 1.5rem; line-height: 1.5; }
.brand-mark { width: 48px; height: 48px; display: grid; place-items: center; color: white; background: var(--accent); border-radius: 14px; font-weight: 850; font-size: 1.4rem; box-shadow: 0 10px 25px rgba(214,91,97,.22); }
.brand-mark.small { width: 32px; height: 32px; border-radius: 9px; font-size: 1rem; }

label { display: block; margin: 0 0 .4rem; color: #c8cfd3; font-size: .78rem; font-weight: 650; }
input,select,textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: 11px; padding: .78rem .85rem; color: var(--text); background: rgba(8,11,13,.72); transition: border-color .18s,background .18s; }
input:hover,select:hover,textarea:hover { border-color: rgba(255,255,255,.26); }
input:focus,select:focus,textarea:focus { border-color: var(--accent); background: #0c1012; }
textarea { resize: vertical; line-height: 1.45; }
.auth-card input { margin-bottom: 1rem; }
.form-error { min-height: 1.25rem; margin: .3rem 0 .7rem; color: #ff989d; font-size: .8rem; }

.primary-button,.secondary-button,.danger-button,.quiet-button,.text-button,.icon-button { border: 0; cursor: pointer; transition: transform .16s,background .16s,color .16s,border-color .16s; }
.primary-button { width: 100%; min-height: 46px; padding: .72rem 1rem; border-radius: 11px; background: var(--accent); color: white; font-size: .8rem; font-weight: 800; letter-spacing: .08em; }
.primary-button:hover { background: color-mix(in srgb,var(--accent) 88%,white); }
.primary-button:active,.icon-button:active { transform: scale(.97); }
.primary-button.compact { width: auto; min-height: 40px; display: inline-flex; align-items: center; gap: .45rem; padding: .65rem 1rem; }
.secondary-button,.danger-button,.quiet-button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: .62rem .85rem; border: 1px solid var(--line-strong); border-radius: 10px; background: rgba(255,255,255,.035); color: var(--text); text-decoration: none; font-size: .78rem; font-weight: 700; }
.secondary-button:hover,.quiet-button:hover { background: rgba(255,255,255,.075); }
.danger-button { color: #ff9ba0; border-color: rgba(238,116,121,.32); background: rgba(238,116,121,.08); }
.danger-button:hover { background: rgba(238,116,121,.16); }
.text-button { min-height: 36px; padding: .35rem .45rem; color: var(--muted); background: transparent; font-size: .77rem; font-weight: 700; }
.text-button:hover { color: var(--text); }
.icon-button { width: 42px; height: 42px; display: grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); background: rgba(255,255,255,.025); }
.icon-button:hover { color: var(--text); background: rgba(255,255,255,.075); }

.app-shell { min-height: 100vh; padding: 1.25rem; }
.topbar { max-width: 1540px; height: 68px; margin: 0 auto; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 1rem; background: var(--bg-elevated); border: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; backdrop-filter: blur(18px); }
.topbar-leading,.topbar-actions { display: flex; align-items: center; gap: .55rem; }
.topbar-actions { justify-content: flex-end; }
.brand-lockup { display: flex; align-items: center; gap: .65rem; color: #cbd1d5; font-size: .72rem; font-weight: 800; letter-spacing: .13em; }
.period-navigation { display: flex; align-items: center; gap: .75rem; }
.period-title { min-width: 210px; padding: .3rem .8rem; border: 0; background: transparent; cursor: pointer; text-align: center; }
.period-title span { display: block; font-size: 1.45rem; font-weight: 800; letter-spacing: .12em; }
.period-title strong { display: block; margin-top: .05rem; color: var(--muted); font-size: .78rem; letter-spacing: .08em; }

.search-panel { max-width: 1540px; margin: 0 auto; display: flex; align-items: center; gap: .65rem; padding: .65rem 1rem; background: var(--panel-solid); border-inline: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.search-panel > svg { color: var(--quiet); }
.search-panel input { flex: 1; border: 0; padding: .5rem; background: transparent; }

.app-body { max-width: 1540px; min-height: calc(100vh - 108px); margin: 0 auto; display: grid; grid-template-columns: 215px minmax(0,1fr); background: var(--panel); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); box-shadow: var(--shadow); backdrop-filter: blur(18px); overflow: clip; }
.sidebar { display: flex; flex-direction: column; padding: 1.25rem .85rem; border-right: 1px solid var(--line); background: rgba(11,15,18,.44); }
.sidebar-section + .sidebar-section { margin-top: 1.6rem; }
.section-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 .55rem; }
.view-nav { display: grid; gap: .22rem; }
.view-link { width: 100%; min-height: 42px; display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; border: 0; border-radius: 10px; color: var(--muted); background: transparent; cursor: pointer; text-align: left; font-size: .84rem; font-weight: 650; }
.view-link:hover { color: var(--text); background: rgba(255,255,255,.045); }
.view-link.active { color: white; background: var(--accent-soft); }
.view-link.active svg { color: var(--accent); }
.category-filters { display: grid; gap: .25rem; }
.category-filter { min-height: 38px; display: flex; align-items: center; gap: .65rem; padding: .4rem .55rem; border-radius: 9px; color: #c2c9cd; font-size: .82rem; cursor: pointer; }
.category-filter:hover { background: rgba(255,255,255,.035); }
.category-filter input { position: absolute; opacity: 0; pointer-events: none; }
.category-dot { width: 10px; height: 10px; flex: 0 0 auto; border-radius: 999px; box-shadow: 0 0 0 3px color-mix(in srgb,var(--dot) 18%,transparent); background: var(--dot); }
.category-filter input:not(:checked) + .category-dot { background: transparent; box-shadow: inset 0 0 0 1.5px var(--dot); opacity: .55; }
.sidebar-footer { margin-top: auto; padding-top: 1.5rem; }
.main-content { min-width: 0; }
.view-panel { min-height: 100%; }

.calendar-frame { min-height: calc(100vh - 110px); display: grid; grid-template-rows: 42px 1fr; }
.weekday-row { display: grid; grid-template-columns: repeat(7,1fr); align-items: center; border-bottom: 1px solid var(--line); color: var(--quiet); font-size: .67rem; font-weight: 800; letter-spacing: .12em; text-align: center; }
.weekday-row span:nth-last-child(-n+2) { color: color-mix(in srgb,var(--accent) 75%,var(--muted)); }
.calendar-grid { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); grid-template-rows: repeat(6,minmax(108px,1fr)); }
.day-cell { position: relative; min-width: 0; padding: .65rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: rgba(16,21,24,.38); cursor: pointer; overflow: hidden; transition: background .18s ease,box-shadow .18s ease; }
.day-cell:nth-child(7n) { border-right: 0; }
.day-cell:nth-last-child(-n+7) { border-bottom: 0; }
.day-cell:hover { background: rgba(255,255,255,.035); }
.day-cell.weekend { background: rgba(8,11,13,.30); }
.day-cell.outside { color: var(--quiet); opacity: .52; }
.day-cell.today { background: linear-gradient(145deg,color-mix(in srgb,var(--accent) 7%,transparent),rgba(255,255,255,.012)); box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--accent) 25%,transparent); }
.day-cell.selected { background: linear-gradient(145deg,color-mix(in srgb,var(--accent) 5%,transparent),rgba(255,255,255,.012)); box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--accent) 32%,transparent); }
.day-cell.holiday-cell,
.day-cell.holiday-cell.today,
.day-cell.holiday-cell.selected { background: rgba(16,21,24,.38); }
.day-cell.holiday-cell.weekend { background: rgba(8,11,13,.30); }
.day-cell.holiday-cell::before { content: ""; position: absolute; inset: .55rem; border-radius: 10px; background: color-mix(in srgb,var(--holiday-color) 28%,#06120b); pointer-events: none; transition: background .18s ease; }
.day-cell.holiday-cell:hover::before { background: color-mix(in srgb,var(--holiday-color) 34%,#06120b); }
.day-cell.holiday-cell > * { position: relative; z-index: 1; }
.day-cell.holiday-cell.outside { opacity: .72; }
.day-number { width: 29px; height: 29px; display: grid; place-items: center; margin-bottom: .35rem; border-radius: 999px; font-size: .88rem; font-weight: 700; }
.day-cell.weekend:not(.outside) .day-number { color: color-mix(in srgb,var(--accent) 82%,#d8dde0); }
.today .day-number { color: white; border: 1px solid rgba(255,255,255,.13); background: linear-gradient(145deg,color-mix(in srgb,var(--accent) 90%,white),color-mix(in srgb,var(--accent) 88%,#8d2930)); box-shadow: 0 4px 12px color-mix(in srgb,var(--accent) 22%,transparent); }
.day-events { display: grid; gap: 4px; }
.mobile-event-dots { display: none; }
.mobile-event-dot { width: 5px; height: 5px; border-radius: 999px; background: var(--dot-color); box-shadow: 0 0 0 2px color-mix(in srgb,var(--dot-color) 14%,transparent); }
.event-chip { min-width: 0; appearance: none; display: flex; align-items: center; gap: .28rem; padding: .3rem .44rem; border: 1px solid color-mix(in srgb,var(--event-color) 60%,rgba(255,255,255,.06)); border-radius: 6px; color: #eef1f2; background: linear-gradient(135deg,color-mix(in srgb,var(--event-color) 28%,#182025),color-mix(in srgb,var(--event-color) 15%,#11171b)); box-shadow: inset 0 1px 0 rgba(255,255,255,.045),0 1px 3px rgba(0,0,0,.14); font-size: .69rem; font-weight: 560; line-height: 1.25; cursor: pointer; transition: background .16s ease,border-color .16s ease,transform .16s ease; }
.event-chip:hover { border-color: color-mix(in srgb,var(--event-color) 85%,rgba(255,255,255,.08)); background: linear-gradient(135deg,color-mix(in srgb,var(--event-color) 35%,#182025),color-mix(in srgb,var(--event-color) 20%,#11171b)); transform: translateY(-1px); }
.event-chip time { flex: 0 0 auto; color: rgba(255,255,255,.82); font-variant-numeric: tabular-nums; }
.event-chip-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-chip.holiday { box-shadow: none; }
.day-cell.holiday-cell .event-chip.holiday,
.day-cell.holiday-cell .event-chip.vacation { padding-left: .45rem; padding-right: .45rem; border-color: transparent; background: transparent; box-shadow: none; }
.day-cell.holiday-cell .event-chip.holiday:hover,
.day-cell.holiday-cell .event-chip.vacation:hover { border-color: transparent; background: transparent; transform: none; }
.more-events { padding: .15rem .35rem; color: var(--muted); font-size: .68rem; font-weight: 700; }

.content-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 2rem 2rem 1rem; }
.content-heading h1 { margin: 0; font-size: 1.8rem; letter-spacing: -.02em; }
.agenda-list { padding: 0 2rem 2rem; }
.agenda-day { display: grid; grid-template-columns: 120px minmax(0,1fr); gap: 1.3rem; padding: 1.15rem 0; border-top: 1px solid var(--line); }
.agenda-date strong { display: block; font-size: .9rem; }
.agenda-date span { color: var(--muted); font-size: .75rem; }
.agenda-items { display: grid; gap: .5rem; }
.agenda-item { display: grid; grid-template-columns: 65px 4px minmax(0,1fr) auto; align-items: center; gap: .8rem; min-height: 58px; padding: .65rem .8rem; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.025); cursor: pointer; }
.agenda-item:hover { background: rgba(255,255,255,.05); }
.agenda-time { color: #dfe4e6; font-size: .82rem; font-variant-numeric: tabular-nums; }
.agenda-color { align-self: stretch; border-radius: 999px; background: var(--event-color); }
.agenda-copy strong { display: block; font-size: .88rem; }
.agenda-copy small { display: block; margin-top: .2rem; color: var(--muted); }
.person-badge { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 999px; color: white; background: color-mix(in srgb,var(--event-color) 42%,#232a2f); font-size: .7rem; font-weight: 800; }
.empty-state { padding: 3.5rem 1rem; color: var(--muted); text-align: center; }

.schedule-heading { align-items: flex-end; }
.schedule-heading-meta { display: flex; align-items: center; gap: .8rem; }
.schedule-subtitle { margin: 0 0 .25rem; color: var(--muted); font-size: .76rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.schedule-help { max-width: 580px; margin: .45rem 0 0; color: var(--muted); font-size: .76rem; line-height: 1.45; }
.schedule-people-form { margin: 0 2rem 1rem; display: flex; align-items: end; gap: .65rem; padding: .8rem; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.025); }
.schedule-people-form > div { width: min(190px,100%); }
.schedule-people-form label { font-size: .65rem; }
.schedule-people-form input { padding: .62rem .7rem; }
.schedule-editable-cell { position: relative; cursor: pointer; transition: background .16s ease, box-shadow .16s ease; }
.schedule-editable-cell:hover { box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--accent) 38%,white); }
.schedule-editable-cell:focus-visible { outline: 3px solid color-mix(in srgb,var(--accent) 65%,white); outline-offset: -3px; }
.schedule-editable-cell.is-empty::after { content: ""; position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); box-sizing: border-box; width: 26px; height: 26px; border-radius: 999px; border: 1px dashed color-mix(in srgb,var(--line) 78%,white); pointer-events: none; }
.schedule-editable-cell.is-empty::before { content: "+"; position: absolute; left: 50%; top: calc(50% - 2px); transform: translate(-50%,-50%); color: var(--muted); font-size: 1.05rem; font-weight: 700; line-height: 1; text-align: center; pointer-events: none; }
.schedule-people-status { margin: 0 0 .65rem; color: var(--success); font-size: .7rem; }
.schedule-people-status.error { color: var(--danger); }
.weekly-schedule-wrap { margin: 0 2rem 2rem; overflow-x: auto; border: 1px solid var(--line-strong); border-radius: 16px; background: rgba(8,11,13,.28); box-shadow: 0 14px 35px rgba(0,0,0,.18); }
.weekly-schedule-wrap:focus-visible { outline: 3px solid color-mix(in srgb,var(--accent) 65%,white); outline-offset: 3px; }
.weekly-schedule { width: 100%; min-width: 1180px; border-collapse: separate; border-spacing: 0; table-layout: fixed; color: #e7ecef; }
.schedule-col-time { width: 112px; }
.schedule-col-weekend { width: 8.75%; }
.weekly-schedule th,.weekly-schedule td { height: 78px; padding: .55rem .45rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: center; vertical-align: middle; }
.weekly-schedule tr > :last-child { border-right: 0; }
.weekly-schedule tbody tr:last-child > * { border-bottom: 0; }
.weekly-schedule thead th { height: 56px; color: #eef3f5; background: #24323a; font-size: .83rem; font-weight: 800; letter-spacing: .02em; }
.weekly-schedule thead th.schedule-weekend-head { background: #1d252c; color: #dfe6ea; }
.weekly-schedule thead th:first-child { width: 112px; }
.weekly-schedule tbody > tr > th[scope="row"] { position: sticky; z-index: 2; left: 0; color: #f1f4f5; background: #171e22; font-size: .8rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.weekly-schedule .schedule-section th { height: 38px; padding: .35rem; color: #f3df9a; background: color-mix(in srgb,#d8a93b 18%,#151b1f); font-size: .76rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.weekly-schedule .schedule-sport-heading th { color: #ffb3c1; background: color-mix(in srgb,#e95f7a 22%,#151b1f); }
.schedule-activity { display: block; font-size: .78rem; font-weight: 650; line-height: 1.15; }
.schedule-school { background: color-mix(in srgb,#4d83df 15%,#12191d); }
.schedule-home { background: color-mix(in srgb,#e2b447 16%,#12191d); }
.schedule-music { background: color-mix(in srgb,#a674df 19%,#12191d); }
.weekly-schedule td.schedule-weekend-cell { background: #11181d; }
.schedule-person { display: inline-flex; align-items: center; justify-content: center; min-width: 60px; margin-top: .45rem; padding: .18rem .6rem; border-radius: 999px; color: #11171b; font-size: .65rem; font-style: italic; font-weight: 750; }
.schedule-people { display: flex; flex-wrap: wrap; justify-content: center; gap: .3rem; }
.person-jordi { background: #78b8e8; }
.person-jana { background: #f3cf65; }
.person-custom { background: #d4dde4; color: #13202a; }
.schedule-sport-row td, .schedule-sport-cell { background: color-mix(in srgb,#25a878 8%,#12191d); }
.schedule-workout { min-height: 52px; display: grid; place-items: center; padding: .4rem; border: 1px solid #39b987; border-radius: 12px; color: #a8f0d2; background: color-mix(in srgb,#25a878 18%,#171c20); font-size: .74rem; font-weight: 800; line-height: 1.05; white-space: pre-line; }

.school-schedule-wrap { margin: 0 2rem 2rem; overflow-x: auto; border: 1px solid var(--line-strong); border-radius: 16px; background: rgba(8,11,13,.28); box-shadow: 0 14px 35px rgba(0,0,0,.18); }
.school-schedule-wrap:focus-visible { outline: 3px solid color-mix(in srgb,var(--accent) 65%,white); outline-offset: 3px; }
.school-schedule { width: 100%; min-width: 900px; border-collapse: separate; border-spacing: 0; table-layout: fixed; color: #e7ecef; }
.school-schedule th,.school-schedule td { height: 96px; padding: .7rem .55rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: center; vertical-align: middle; }
.school-schedule tr > :last-child { border-right: 0; }
.school-schedule tbody tr:last-child > * { border-bottom: 0; }
.school-schedule thead th { height: 52px; color: #f3f7f8; background: #3b8796; font-size: .8rem; font-weight: 850; letter-spacing: .04em; }
.school-schedule thead th:first-child { width: 132px; background: #1a2227; }
.school-schedule tbody > tr > th[scope="row"] { position: sticky; z-index: 2; left: 0; color: #eef3f5; background: #223039; font-size: .76rem; font-weight: 800; white-space: nowrap; }
.school-break-row th,.school-break-row td { height: 46px; padding: .35rem .55rem; background: color-mix(in srgb,#8baec4 40%,#151b1f); color: #dfe9ef; font-size: .72rem; font-weight: 850; letter-spacing: .08em; }
.school-lunch-row th,.school-lunch-row td { background: color-mix(in srgb,#8baec4 34%,#151b1f); }
.school-editable-cell { position: relative; cursor: pointer; background: color-mix(in srgb,#a9dde2 24%,#11181c); transition: background .16s ease, box-shadow .16s ease; }
.school-editable-cell:hover { box-shadow: inset 0 0 0 1px color-mix(in srgb,#7fd0d9 62%,white); }
.school-editable-cell:focus-visible { outline: 3px solid color-mix(in srgb,#7fd0d9 68%,white); outline-offset: -3px; }
.school-activity { display: block; color: inherit; font-size: .86rem; font-weight: 820; line-height: 1.25; white-space: pre-line; text-wrap: balance; }
.school-editable-cell.is-empty::after { content: ""; position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); box-sizing: border-box; width: 26px; height: 26px; border-radius: 999px; border: 1px dashed color-mix(in srgb,var(--line) 78%,white); pointer-events: none; }
.school-editable-cell.is-empty::before { content: "+"; position: absolute; left: 50%; top: calc(50% - 2px); transform: translate(-50%,-50%); color: var(--muted); font-size: 1.05rem; font-weight: 700; line-height: 1; pointer-events: none; }
.school-color-presets { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: .7rem; }
.school-color-swatch { width: 34px; height: 34px; padding: 0; border: 2px solid var(--line-strong); border-radius: 999px; background: var(--swatch); cursor: pointer; box-shadow: inset 0 0 0 2px rgba(255,255,255,.08); }
.school-color-swatch.active { border-color: white; box-shadow: 0 0 0 2px color-mix(in srgb,var(--accent) 55%,transparent), inset 0 0 0 2px rgba(255,255,255,.08); }
#schoolCellActivity { min-height: 92px; resize: vertical; }
.schedule-workout.workout-custom { box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }

.schedule-cell-dialog { width: min(92vw,560px); }
.schedule-cell-body { display: grid; gap: .75rem; }
.schedule-assignments-fieldset { margin: 0; padding: .75rem; border: 1px solid var(--line); border-radius: 12px; }
.schedule-assignments-fieldset legend { padding: 0 .35rem; color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; }
.schedule-assignments-fieldset .check-row + .check-row { margin-top: .35rem; }
.schedule-custom-help { margin: -.35rem 0 0; font-size: .72rem; }

.schedule-color-fieldset { margin: 0; padding: .75rem; border: 1px solid var(--line); border-radius: 12px; }
.schedule-color-fieldset legend { padding: 0 .35rem; color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; }
.schedule-color-row { display: flex; align-items: end; flex-wrap: wrap; gap: .65rem; }
.schedule-color-picker { display: grid; gap: .35rem; color: var(--muted); font-size: .7rem; }
.schedule-color-picker input[type="color"] { width: 64px; height: 42px; padding: 3px; border: 1px solid var(--line-strong); border-radius: 9px; background: transparent; cursor: pointer; }
.schedule-color-picker input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.schedule-color-picker input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 6px; }
.schedule-color-picker input[type="color"]::-moz-color-swatch { border: 0; border-radius: 6px; }
.schedule-color-presets { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .7rem; }
.schedule-color-swatch { width: 34px; height: 34px; padding: 0; border: 2px solid var(--line-strong); border-radius: 999px; background: var(--swatch); cursor: pointer; box-shadow: inset 0 0 0 2px rgba(255,255,255,.08); }
.schedule-color-swatch:hover { border-color: color-mix(in srgb,var(--accent) 65%,white); }
.schedule-color-swatch.active { border-color: white; box-shadow: 0 0 0 2px var(--accent), inset 0 0 0 2px rgba(255,255,255,.12); }
.schedule-color-status { margin: .55rem 0 0; color: var(--muted); font-size: .68rem; }
.schedule-color-status.none { color: var(--quiet); font-style: italic; }

.week-navigation { display: flex; align-items: center; justify-content: center; gap: 1rem; padding: 0 1rem 1.25rem; }
.week-navigation strong { min-width: 230px; text-align: center; font-size: .85rem; }
.meal-save-status { color: var(--success); font-size: .76rem; }
.meal-save-status.saving { color: var(--muted); }
.meal-save-status.error { color: var(--danger); }
.meal-heading-actions { display: flex; align-items: center; gap: .85rem; }
.meal-repeat-button { white-space: nowrap; }
.repeat-meals-dialog { width: min(560px,calc(100vw - 2rem)); }
.repeat-meals-body { display: grid; gap: 1rem; }
.repeat-meals-intro { margin: 0; line-height: 1.55; }
.repeat-meals-options { display: grid; gap: .65rem; margin: 0; padding: 0; border: 0; }
.repeat-meals-options legend { margin-bottom: .35rem; font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--quiet); }
.repeat-option, .repeat-overwrite-option { display: flex; align-items: flex-start; gap: .7rem; padding: .8rem .9rem; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.025); cursor: pointer; }
.repeat-option input[type="radio"], .repeat-overwrite-option input[type="checkbox"] { margin-top: .18rem; flex: 0 0 auto; }
.repeat-option > span:not(.repeat-years-control), .repeat-overwrite-option > span { display: grid; gap: .2rem; min-width: 0; flex: 1; }
.repeat-option small, .repeat-overwrite-option small { color: var(--muted); line-height: 1.4; }
.repeat-option-years { align-items: center; }
.repeat-years-control { display: flex; align-items: center; gap: .45rem; color: var(--muted); font-size: .78rem; }
.repeat-years-control input { width: 68px; padding: .45rem .55rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); }
.repeat-meal-summary { min-height: 1.2em; margin: 0; color: var(--muted); font-size: .74rem; }
.meal-planner { display: grid; grid-template-columns: repeat(7,minmax(155px,1fr)); gap: .75rem; padding: 0 1.4rem 2rem; overflow-x: auto; }
.meal-day { padding: .85rem; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.025); }
.meal-day h2 { margin: 0 0 .1rem; font-size: .78rem; text-align: center; text-transform: uppercase; letter-spacing: .08em; }
.meal-day > p { margin: 0 0 1rem; color: var(--quiet); font-size: .68rem; text-align: center; }
.meal-field + .meal-field { margin-top: .75rem; }
.meal-field label { color: var(--quiet); font-size: .64rem; text-transform: uppercase; letter-spacing: .08em; }
.meal-field textarea { display: block; width: 100%; min-height: 46px; height: 46px; padding: .5rem; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; font-size: .76rem; line-height: 1.4; resize: none; overflow: hidden; }

.settings-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1rem; padding: 0 2rem 2rem; }
.settings-card { padding: 1.25rem; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.025); }
.settings-card h2 { margin: 0; font-size: 1rem; }
.settings-card p { line-height: 1.5; font-size: .8rem; }
.theme-options { display: grid; grid-template-columns: repeat(4,minmax(90px,1fr)); gap: .65rem; margin-top: 1rem; }
.theme-option { position: relative; margin: 0; padding: .45rem; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.theme-option:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.theme-option input { position: absolute; opacity: 0; }
.theme-preview { height: 56px; display: block; margin-bottom: .45rem; border-radius: 7px; }
.theme-preview.graphite { background: radial-gradient(circle at 50% 0,#354047,#111619 70%); }
.theme-preview.midnight { background: radial-gradient(circle at 50% 0,#294865,#0e141b 70%); }
.theme-preview.paper { background: repeating-linear-gradient(100deg,#27231f 0 1px,#171411 1px 5px); }
.theme-preview.monthly { background: radial-gradient(circle at 50% 0,#49353c,#151619 70%); }
.theme-option strong,.theme-option small { display: block; }
.theme-option strong { font-size: .73rem; }
.theme-option small { margin-top: .15rem; color: var(--quiet); font-size: .65rem; }
.button-stack { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: 1rem; }
.category-settings-card { grid-column: 1 / -1; }
.category-settings-list { display: grid; gap: .5rem; margin-top: 1rem; }
.category-settings-row { display: grid; grid-template-columns: 44px minmax(150px,1fr) auto; align-items: center; gap: .65rem; padding: .55rem; border: 1px solid var(--line); border-radius: 11px; background: rgba(8,11,13,.25); }
.category-settings-row input { min-height: 40px; padding-block: .55rem; }
.category-color-input { width: 44px; min-width: 44px; height: 40px; padding: 3px !important; border-radius: 9px; cursor: pointer; }
.category-color-input::-webkit-color-swatch-wrapper { padding: 0; }
.category-color-input::-webkit-color-swatch { border: 0; border-radius: 6px; }
.category-color-input::-moz-color-swatch { border: 0; border-radius: 6px; }
.add-category-form { display: grid; grid-template-columns: 44px minmax(150px,1fr) auto; align-items: center; gap: .65rem; margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--line); }
.category-settings-status { min-height: 1.2rem; margin: .5rem 0 0; color: var(--muted); font-size: .72rem; }
.category-settings-status.error { color: var(--danger); }

.floating-add { position: fixed; z-index: 25; right: 2.3rem; bottom: 2.3rem; width: 56px; height: 56px; display: grid; place-items: center; border: 0; border-radius: 999px; color: white; background: var(--accent); box-shadow: 0 12px 26px color-mix(in srgb,var(--accent) 30%,transparent); cursor: pointer; }
.floating-add svg { width: 1.55rem; height: 1.55rem; }
.floating-voice { position: fixed; z-index: 25; right: 6.45rem; bottom: 2.55rem; width: 50px; height: 50px; display: grid; place-items: center; border: 1px solid color-mix(in srgb,var(--accent) 48%,var(--line)); border-radius: 999px; color: #f3c3c5; background: color-mix(in srgb,var(--accent) 12%,#151a1e); box-shadow: 0 10px 24px rgba(0,0,0,.28); cursor: pointer; transition: transform .16s ease,background .16s ease,border-color .16s ease; }
.floating-voice:hover { border-color: color-mix(in srgb,var(--accent) 72%,var(--line)); background: color-mix(in srgb,var(--accent) 20%,#151a1e); transform: translateY(-1px); }
.floating-voice svg { width: 1.35rem; height: 1.35rem; }
.bottom-nav { display: none; }

dialog { color: var(--text); background: var(--panel-solid); border: 1px solid var(--line-strong); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(0,0,0,.68); backdrop-filter: blur(4px); }
.event-dialog { width: min(92vw,590px); max-height: min(90vh,780px); padding: 0; border-radius: 20px; overflow: hidden; }
.event-dialog form { display: flex; flex-direction: column; max-height: inherit; }
.dialog-header,.dialog-footer { display: flex; align-items: center; gap: .65rem; padding: 1rem 1.2rem; }
.dialog-header { justify-content: space-between; border-bottom: 1px solid var(--line); }
.dialog-header h2 { margin: 0; font-size: 1.2rem; }
.dialog-body { padding: 1.1rem 1.2rem; overflow-y: auto; }
.dialog-body > input,.dialog-body > select,.dialog-body > textarea,.dialog-body > .form-grid,.dialog-body > .check-row { margin-bottom: 1rem; }
.dialog-footer { border-top: 1px solid var(--line); }
.dialog-footer .spacer { flex: 1; }
.day-summary-dialog { width: min(92vw,520px); }
.day-summary-list { min-height: 120px; max-height: min(58vh,540px); display: grid; align-content: start; gap: .55rem; padding: 1rem 1.2rem; overflow-y: auto; }
.day-summary-item { width: 100%; display: grid; grid-template-columns: 4px 58px minmax(0,1fr) auto; align-items: center; gap: .75rem; min-height: 62px; padding: .65rem .8rem; border: 1px solid var(--line); border-radius: 11px; color: var(--text); background: rgba(255,255,255,.025); text-align: left; }
button.day-summary-item { cursor: pointer; transition: background .16s ease,border-color .16s ease,transform .16s ease; }
button.day-summary-item:hover { border-color: color-mix(in srgb,var(--event-color) 36%,var(--line)); background: color-mix(in srgb,var(--event-color) 8%,rgba(255,255,255,.035)); transform: translateY(-1px); }
.day-summary-color { align-self: stretch; border-radius: 999px; background: var(--event-color); }
.day-summary-time { color: #dfe4e6; font-size: .8rem; font-variant-numeric: tabular-nums; }
.day-summary-copy { min-width: 0; }
.day-summary-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; font-size: .88rem; white-space: nowrap; }
.day-summary-copy small { display: block; margin-top: .22rem; overflow: hidden; color: var(--muted); font-size: .7rem; text-overflow: ellipsis; white-space: nowrap; }
.day-summary-actions { display: flex; align-items: center; gap: .4rem; }
.day-summary-action { min-height: 34px; padding: .45rem .6rem; font-size: .65rem; letter-spacing: .04em; }
.day-summary-item.holiday { background: color-mix(in srgb,var(--event-color) 9%,rgba(255,255,255,.025)); }
.day-summary-empty { margin: auto; padding: 2rem 1rem; color: var(--muted); text-align: center; }
.confirm-dialog { width: min(92vw,430px); }
.confirm-dialog .dialog-body p { margin: 0; color: #dfe4e6; line-height: 1.5; }
.voice-dialog { width: min(92vw,500px); }
.voice-dialog-body { display: grid; justify-items: center; padding: 1.5rem 1.2rem 1.25rem; text-align: center; }
.voice-listen-button { width: 76px; height: 76px; display: grid; place-items: center; border: 1px solid color-mix(in srgb,var(--accent) 62%,transparent); border-radius: 999px; color: white; background: linear-gradient(145deg,color-mix(in srgb,var(--accent) 90%,white),color-mix(in srgb,var(--accent) 84%,#8d2930)); box-shadow: 0 10px 30px color-mix(in srgb,var(--accent) 26%,transparent); cursor: pointer; }
.voice-listen-button svg { width: 1.8rem; height: 1.8rem; }
.voice-listen-button.listening { animation: voice-pulse 1.35s ease-in-out infinite; }
.voice-listen-button:disabled { cursor: default; opacity: .92; }
.voice-status { margin: 1rem 0 .35rem; font-weight: 750; }
.voice-status.error { color: var(--danger); }
.voice-transcript { min-height: 2.8rem; margin: .25rem 0 .75rem; color: #dfe4e6; font-size: .93rem; line-height: 1.45; }
.voice-transcript:empty::before { content: '…'; color: var(--quiet); }
.voice-example { max-width: 400px; margin: .35rem 0; color: var(--muted); font-size: .76rem; line-height: 1.5; }
.voice-support-note { max-width: 410px; margin: .5rem 0 0; color: var(--quiet); font-size: .68rem; line-height: 1.45; }
.voice-support-note.error { color: var(--danger); }
.voice-confirmation { margin-bottom: 1rem; padding: .8rem .9rem; border: 1px solid color-mix(in srgb,var(--accent) 28%,var(--line)); border-radius: 11px; background: color-mix(in srgb,var(--accent) 7%,rgba(255,255,255,.02)); }
.voice-confirmation strong { display: block; font-size: .8rem; }
.voice-confirmation p { margin: .35rem 0; color: #e7ebed; font-size: .78rem; font-style: italic; line-height: 1.45; }
.voice-confirmation small { color: var(--muted); font-size: .67rem; }
@keyframes voice-pulse { 0%,100% { box-shadow: 0 0 0 0 color-mix(in srgb,var(--accent) 30%,transparent),0 10px 30px color-mix(in srgb,var(--accent) 25%,transparent); } 50% { box-shadow: 0 0 0 12px transparent,0 10px 30px color-mix(in srgb,var(--accent) 34%,transparent); } }
.form-grid { display: grid; gap: .8rem; }
.form-grid.two { grid-template-columns: repeat(2,minmax(0,1fr)); }
.check-row { display: inline-flex; align-items: center; gap: .55rem; cursor: pointer; }
.check-row input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.picker-dialog { width: min(90vw,360px); padding: 1.25rem; border-radius: 16px; }
.picker-dialog h2 { margin-top: 0; }
.picker-dialog .dialog-footer { margin: 1rem -1.25rem -1.25rem; }
.toast-region { position: fixed; z-index: 1000; right: 1rem; bottom: 1rem; display: grid; gap: .5rem; }
.toast { max-width: 340px; padding: .8rem 1rem; border: 1px solid var(--line-strong); border-radius: 10px; color: white; background: #20272c; box-shadow: var(--shadow); font-size: .82rem; animation: toast-in .2s ease-out; }
.toast.error { border-color: rgba(238,116,121,.45); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.mobile-only { display: none; }
@media (max-width: 920px) {
  .app-shell { padding: 0; }
  .topbar { height: 64px; border-inline: 0; border-top: 0; border-radius: 0; }
  .app-body { min-height: calc(100vh - 64px); grid-template-columns: 1fr; border: 0; border-radius: 0; }
  .sidebar { position: fixed; z-index: 60; inset: 64px auto 0 0; width: min(82vw,280px); transform: translateX(-105%); transition: transform .2s; border-top: 1px solid var(--line); background: #11171a; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .mobile-only { display: grid; }
  .desktop-only { display: none !important; }
  .period-title { min-width: 160px; }
  .period-title span { font-size: 1.05rem; }
  .period-title strong { font-size: .67rem; }
  .calendar-grid { grid-template-rows: repeat(6,minmax(94px,1fr)); }
  .content-heading { padding-inline: 1rem; }
  .agenda-list { padding-inline: 1rem; }
  .weekly-schedule-wrap, .school-schedule-wrap { margin-inline: 1rem; }
  .schedule-people-form { margin-inline: 1rem; }
  .settings-grid { grid-template-columns: 1fr; padding-inline: 1rem; }
}

@media (max-width: 680px) {
  body { padding-bottom: 0; }
  .topbar { position: sticky; z-index: 40; top: 0; padding: 0 .65rem; }
  .topbar .icon-button { width: 38px; height: 38px; }
  .topbar-actions { gap: .2rem; }
  .period-navigation { gap: .18rem; }
  .period-title { min-width: 122px; padding-inline: .25rem; }
  .period-title span { font-size: .86rem; letter-spacing: .09em; }
  .period-title strong { font-size: .62rem; }
  .search-panel { position: sticky; z-index: 39; top: 64px; border-inline: 0; }
  .main-content { padding-bottom: calc(68px + min(env(safe-area-inset-bottom), 8px)); }
  #monthView { display: none; }
  #monthView.mobile-active { display: block; }
  .calendar-frame { min-height: auto; grid-template-rows: 34px auto; }
  .weekday-row { font-size: .55rem; }
  .calendar-grid { grid-template-rows: repeat(6,74px); }
  .day-cell { padding: .3rem; }
  .day-number { width: 24px; height: 24px; margin-bottom: .15rem; font-size: .72rem; }
  .event-chip { display: none; }
  .mobile-event-dots { min-height: 7px; display: flex; justify-content: center; gap: 3px; margin-top: 2px; }
  .agenda-day { grid-template-columns: 1fr; gap: .55rem; }
  .agenda-date { display: flex; gap: .45rem; align-items: baseline; }
  .agenda-item { grid-template-columns: 50px 4px minmax(0,1fr) auto; gap: .6rem; }
  .agenda-list { padding-bottom: 1rem; }
  .content-heading { padding-top: 1.25rem; }
  .content-heading h1 { font-size: 1.45rem; }
  .content-heading .add-event-button { display: none; }
  .schedule-heading { align-items: flex-start; }
  .schedule-heading-meta { align-items: flex-end; flex-direction: column; gap: .4rem; }
  .schedule-people-form { align-items: stretch; flex-direction: column; }
  .schedule-people-form > div { width: 100%; }
  .schedule-people-status { margin: 0; }
  .meal-planner { grid-template-columns: 1fr; padding-inline: 1rem; overflow: visible; }
  .meal-day { display: grid; grid-template-columns: 92px minmax(0,1fr); gap: .45rem .7rem; }
  .meal-day h2,.meal-day > p { grid-column: 1; text-align: left; }
  .meal-day > p { margin-bottom: .5rem; }
  .meal-field { grid-column: 2; }
  .meal-field + .meal-field { margin-top: 0; }
  .theme-options { grid-template-columns: repeat(2,1fr); }
  .category-settings-row,.add-category-form { grid-template-columns: 40px minmax(0,1fr); }
  .category-settings-row .secondary-button,.add-category-form .secondary-button { grid-column: 1 / -1; }
  .floating-add { right: 1rem; bottom: calc(70px + min(env(safe-area-inset-bottom), 8px)); width: 52px; height: 52px; }
  .floating-voice { right: 4.85rem; bottom: calc(73px + min(env(safe-area-inset-bottom), 8px)); width: 46px; height: 46px; }
  .weekly-schedule-wrap, .school-schedule-wrap { margin-bottom: 1rem; border-radius: 12px; }
  .weekly-schedule { min-width: 1100px; }
  .schedule-people-form { flex-wrap: wrap; }
  .weekly-schedule th,.weekly-schedule td { height: 70px; }
  .bottom-nav { position: fixed; z-index: 50; inset: auto 0 0; height: calc(62px + min(env(safe-area-inset-bottom), 8px)); grid-template-columns: repeat(4,1fr); padding-bottom: min(env(safe-area-inset-bottom), 8px); border-top: 1px solid var(--line); background: rgba(14,18,21,.98); backdrop-filter: blur(16px); box-shadow: 0 -8px 24px rgba(0,0,0,.28); }
  .bottom-link { display: grid; place-items: center; align-content: center; gap: .18rem; padding: .35rem 0 .22rem; border: 0; color: var(--quiet); background: transparent; font-size: .58rem; font-weight: 750; letter-spacing: .04em; }
  .bottom-link svg { width: 1.25rem; height: 1.25rem; }
  .bottom-link.active { color: var(--accent); }
  .form-grid.two { grid-template-columns: 1fr; }
  .event-dialog { width: calc(100vw - 16px); max-width: none; max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); margin: auto 8px max(8px,env(safe-area-inset-bottom)); border-radius: 20px; }
  .day-summary-item { grid-template-columns: 4px 50px minmax(0,1fr); gap: .6rem; }
  .day-summary-actions { grid-column: 2 / -1; justify-content: flex-end; }
  .dialog-footer { flex-wrap: wrap; }
  .toast-region { right: .7rem; bottom: calc(68px + min(env(safe-area-inset-bottom), 8px)); left: .7rem; }
  .toast { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  *,*::before,*::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* Mobile sidebar: keep its entire contents reachable on short screens. */
@media (max-width: 920px) {
  .sidebar {
    height: calc(100dvh - 64px);
    max-height: calc(100dvh - 64px);
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
    padding-bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
  }
  .sidebar-footer { flex-shrink: 0; }
}

/* v2.2.13: settings always visible; category list scrolls independently. */
@media (max-width: 920px) {
  .sidebar {
    top: 64px; bottom: 0; height: auto; max-height: none;
    overflow: hidden; padding: .85rem .85rem 0;
    min-height: 0; display: flex; flex-direction: column;
  }
  .sidebar > .sidebar-section:first-child { flex: 0 0 auto; }
  .sidebar > .sidebar-section:nth-child(2) {
    flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden;
    overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch;
    margin-top: .8rem; padding-bottom: 1rem;
  }
  .sidebar-footer {
    flex: 0 0 auto; margin-top: 0; padding: .65rem 0 calc(.65rem + min(env(safe-area-inset-bottom), 8px));
    border-top: 1px solid var(--line); background: #11171a;
  }
}
.agenda-toggle { display: inline-flex; align-items: center; justify-content: center; min-height: 30px; margin-top: .4rem; padding: .3rem .55rem; border: 1px solid var(--line-strong); border-radius: 8px; background: rgba(255,255,255,.045); color: var(--muted); cursor: pointer; font-size: .72rem; font-weight: 700; }
.agenda-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.agenda-day.is-collapsed .agenda-items { display: none; }
@media (max-width: 680px) { .agenda-date { flex-wrap: wrap; } .agenda-date .agenda-toggle { margin: 0 0 0 auto; } }

/* v2.2.14: one past-events drawer and collapsible category filters. */
.category-section-toggle { border: 0; padding: .5rem .2rem; color: var(--quiet); background: transparent; font-size: .7rem; font-weight: 800; letter-spacing: .13em; cursor: pointer; text-align: left; }
.category-filters[hidden], .agenda-past-days[hidden] { display: none !important; }
.agenda-past-toggle { width: 100%; min-height: 46px; padding: .65rem 1rem; border: 1px solid var(--line-strong); border-radius: 10px; color: var(--text); background: var(--accent-soft); cursor: pointer; text-align: left; font-size: .85rem; font-weight: 750; }
.agenda-past-group { padding: .6rem 0 1rem; }
.agenda-past-days { margin-top: .35rem; }

/* v2.2.15: categories control located above Settings at the bottom of the drawer.
   Only the expanded list scrolls; the two controls always remain visible. */
@media (max-width: 920px) {
  .sidebar { height: calc(100dvh - 64px); max-height: calc(100dvh - 64px); }
  .sidebar > .sidebar-section:nth-child(2) {
    display: flex; flex-direction: column; justify-content: flex-end;
    flex: 1 1 auto; min-height: 0; margin-top: 0; padding-bottom: 0;
    overflow: hidden;
  }
  .sidebar > .sidebar-section:nth-child(2) .section-heading {
    flex: 0 0 auto; min-height: 48px; border-top: 1px solid var(--line);
  }
  .category-section-toggle { min-height: 44px; flex: 1; font-size: .8rem; color: var(--text); }
  .sidebar #categoryFilters:not([hidden]) {
    flex: 0 1 auto; min-height: 0; max-height: min(44dvh, 340px);
    overflow-y: auto; overflow-x: hidden; overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch; padding-bottom: .6rem;
  }
  .sidebar-footer { flex: 0 0 auto; padding-top: .35rem; }
}

/* v2.2.16: place Categories and Settings immediately after the view buttons. */
@media (max-width: 920px) {
  .sidebar { justify-content: flex-start; overflow-y: auto; overflow-x: hidden; }
  .sidebar > .sidebar-section:nth-child(2) {
    flex: 0 0 auto; display: block; overflow: visible;
    margin-top: .7rem; padding-bottom: 0;
  }
  .sidebar > .sidebar-section:nth-child(2) .section-heading { min-height: 42px; }
  .sidebar #categoryFilters:not([hidden]) {
    max-height: min(38dvh, 300px); overflow-y: auto;
  }
  .sidebar-footer {
    flex: 0 0 auto; margin-top: .45rem; padding: .35rem 0 .65rem;
  }
}

@media (max-width: 680px) {
  .meal-heading-actions { align-items: flex-end; flex-direction: column-reverse; gap: .45rem; }
  .meal-repeat-button { font-size: .68rem; }
  .repeat-option-years { align-items: flex-start; flex-wrap: wrap; }
  .repeat-years-control { margin-left: 1.65rem; }
}

/* v2.2.18: repeat-menu dialog controls — prevent global input width from stretching radios/checkboxes. */
.repeat-option input[type="radio"],
.repeat-overwrite-option input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  padding: 0;
  margin: .12rem 0 0;
  accent-color: var(--accent);
}

@media (max-width: 680px) {
  .repeat-meals-dialog { width: calc(100vw - 24px); margin-inline: 12px; }
  .repeat-meals-body { gap: .85rem; }
  .repeat-option,
  .repeat-overwrite-option { gap: .7rem; padding: .8rem; }
  .repeat-option-years {
    display: grid;
    grid-template-columns: 18px minmax(0,1fr);
    align-items: start;
    flex-wrap: nowrap;
  }
  .repeat-option-years > input[type="radio"] { grid-column: 1; grid-row: 1; }
  .repeat-option-years > span:not(.repeat-years-control) { grid-column: 2; grid-row: 1; }
  .repeat-years-control { grid-column: 2; margin: .55rem 0 0; }
  .repeat-years-control input { width: 72px; }
  .repeat-meals-dialog .dialog-footer { flex-wrap: nowrap; gap: .55rem; }
  .repeat-meals-dialog .dialog-footer .spacer { min-width: 0; }
  .repeat-meals-dialog .dialog-footer button { white-space: nowrap; }
}

.schedule-editable-cell.schedule-color-cleared { background: transparent !important; }
