:root {
  --bg: #f3f5f8;
  --bg-elevated: #f8f9fb;
  --surface: #ffffff;
  --surface-subtle: #f5f7fa;
  --surface-strong: #e9edf3;
  --text: #172033;
  --text-soft: #344054;
  --muted: #6b7280;
  --line: #e2e7ee;
  --line-strong: #d3dae5;
  --navy: #07385f;
  --navy-deep: #052a49;
  --primary: #156ea8;
  --primary-hover: #0d5d92;
  --primary-soft: #e8f4fb;
  --green: #3f8f50;
  --amber: #f6ac18;
  --danger: #c93d54;
  --success: #16825d;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 12px rgba(16, 24, 40, .04);
  --shadow: 0 12px 36px rgba(16, 34, 55, .08);
  --shadow-lg: 0 24px 70px rgba(2, 26, 47, .18);
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 24px;
  --nav-height: 72px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
  font-family: "Aptos", "Segoe UI Variable", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html[data-theme="dark"] {
  --bg: #09131d;
  --bg-elevated: #0e1a26;
  --surface: #122231;
  --surface-subtle: #172a3a;
  --surface-strong: #203648;
  --text: #f4f7fb;
  --text-soft: #d1d9e4;
  --muted: #94a3b5;
  --line: #253b4e;
  --line-strong: #345068;
  --primary: #54b8ee;
  --primary-hover: #79caf4;
  --primary-soft: #153951;
  --shadow-sm: 0 4px 15px rgba(0, 0, 0, .16);
  --shadow: 0 18px 45px rgba(0, 0, 0, .22);
  --shadow-lg: 0 28px 80px rgba(0, 0, 0, .4);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  html[data-theme="system"] {
    --bg: #09131d;
    --bg-elevated: #0e1a26;
    --surface: #122231;
    --surface-subtle: #172a3a;
    --surface-strong: #203648;
    --text: #f4f7fb;
    --text-soft: #d1d9e4;
    --muted: #94a3b5;
    --line: #253b4e;
    --line-strong: #345068;
    --primary: #54b8ee;
    --primary-hover: #79caf4;
    --primary-soft: #153951;
    --shadow-sm: 0 4px 15px rgba(0, 0, 0, .16);
    --shadow: 0 18px 45px rgba(0, 0, 0, .22);
    --shadow-lg: 0 28px 80px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; background: var(--bg); scroll-behavior: smooth; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; overflow-wrap: anywhere; overscroll-behavior-y: none; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -1; background: radial-gradient(circle at 8% 0%, rgba(21, 110, 168, .055), transparent 34%), radial-gradient(circle at 95% 100%, rgba(63, 143, 80, .04), transparent 28%); }
button, input, select, textarea { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { touch-action: manipulation; }
a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3, .wordmark { font-family: "Aptos Display", "Segoe UI Variable Display", "Segoe UI", sans-serif; }
h1 { margin-bottom: .2rem; font-size: clamp(1.7rem, 2.3vw, 2.35rem); font-weight: 800; letter-spacing: -.045em; line-height: 1.15; }
h2 { font-size: 1.08rem; font-weight: 750; letter-spacing: -.025em; }
.muted { color: var(--muted); }
.skip-link { position: fixed; top: -100px; left: 1rem; z-index: 200; padding: .8rem 1rem; border-radius: var(--radius-sm); background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.skip-link:focus { top: 1rem; }
*:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 52%, transparent); outline-offset: 2px; }

/* Navigation */
.topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 2rem; height: var(--nav-height); padding: 0 clamp(1rem, 3vw, 2.5rem); border-bottom: 1px solid color-mix(in srgb, var(--line) 82%, transparent); background: color-mix(in srgb, var(--surface) 90%, transparent); box-shadow: 0 1px 0 rgba(255,255,255,.06); backdrop-filter: blur(20px) saturate(140%); transition: transform .45s var(--ease), opacity .35s ease; }
.wordmark { display: flex; align-items: center; gap: .75rem; min-width: 210px; color: var(--text); font-size: .98rem; letter-spacing: -.02em; }
.brand-mark { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: url('../images/icon-192.png') center/cover no-repeat; color: transparent; font-size: 0; flex: 0 0 auto; }
.brand-mark.small { width: 40px; height: 40px; }
.desktop-nav { display: flex; align-items: center; gap: .25rem; height: 100%; }
.desktop-nav a { display: grid; place-items: center; min-height: 42px; padding: .55rem .9rem; border-radius: 11px; color: var(--muted); font-size: .88rem; font-weight: 650; transition: background .18s ease, color .18s ease; }
.desktop-nav a:hover { color: var(--text); background: var(--surface-subtle); }
.desktop-nav a.active { color: var(--primary); background: var(--primary-soft); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: .55rem; }
.user-menu { position: relative; }
.user-chip { display: flex; align-items: center; gap: .55rem; min-height: 44px; padding: .3rem .55rem .3rem .35rem; border: 1px solid transparent; border-radius: 999px; background: transparent; color: var(--text); font: inherit; cursor: pointer; transition: border-color .18s ease, background .18s ease; }
.user-chip:hover { border-color: var(--line); background: var(--surface-subtle); }
.user-chip span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(145deg, #f8c66b, #ec9658); color: #3f2914; font-weight: 800; }
.user-chip b { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .86rem; }
.user-chip i { color: var(--muted); font-size: .72rem; font-style: normal; transition: transform .18s ease; }
.user-chip[aria-expanded="true"] { border-color: var(--line); background: var(--surface-subtle); }
.user-chip[aria-expanded="true"] i { transform: rotate(180deg); }
.user-menu-panel { position: absolute; top: calc(100% + .55rem); right: 0; z-index: 70; width: 235px; overflow: hidden; padding: .45rem; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: var(--shadow-lg); animation: fade-up .16s var(--ease); }
.user-menu-summary { display: grid; gap: .08rem; padding: .65rem .7rem .75rem; border-bottom: 1px solid var(--line); margin-bottom: .35rem; }
.user-menu-summary strong, .user-menu-summary small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-summary strong { font-size: .88rem; }
.user-menu-summary small { color: var(--muted); font-size: .72rem; }
.user-menu-panel a, .user-menu-panel button { display: flex; align-items: center; gap: .65rem; width: 100%; min-height: 42px; padding: .55rem .7rem; border: 0; border-radius: 10px; background: transparent; color: var(--text-soft); font: inherit; font-size: .83rem; font-weight: 700; text-align: left; cursor: pointer; }
.user-menu-panel a:hover, .user-menu-panel button:hover { background: var(--surface-subtle); color: var(--primary); }
.user-menu-panel a span, .user-menu-panel button span { width: 18px; color: var(--muted); font-size: 1rem; text-align: center; }
.user-menu-panel form { margin: 0; }
.user-menu-panel form button:hover { color: var(--danger); }
.bottom-nav { display: none; }
.nav-reveal-zone { display: none; }

/* Main layout */
.page-shell { width: min(100%, 1700px); margin: 0 auto; padding: clamp(1.15rem, 2.5vw, 2.25rem); padding-bottom: 4rem; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.page-heading > div:first-child { min-width: 0; }
.page-heading h1 { margin: 0; }
.eyebrow { display: flex; align-items: center; gap: .5rem; margin: 0 0 .25rem; color: var(--primary); font-size: .7rem; font-weight: 800; letter-spacing: .025em; }
.header-time { color: var(--muted); font-variant-numeric: tabular-nums; }
.header-time::before { content: "\00b7"; margin-right: .5rem; color: var(--line-strong); }
#page-actions { display: flex; align-items: center; justify-content: flex-end; gap: .55rem; flex-wrap: wrap; }
.live-indicator { display: inline-flex; align-items: center; gap: .45rem; padding: .45rem .7rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: .72rem; font-weight: 700; white-space: nowrap; box-shadow: var(--shadow-sm); }
.live-indicator::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #3ecb83; box-shadow: 0 0 0 4px rgba(62,203,131,.12); }
.live-indicator.refreshing::before { animation: pulse 1s infinite; background: var(--amber); }

/* Controls */
.button { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 42px; padding: .62rem .9rem; border: 1px solid var(--line-strong); border-radius: 11px; background: var(--surface); color: var(--text-soft); box-shadow: 0 1px 2px rgba(16,24,40,.03); font-size: .84rem; font-weight: 700; line-height: 1.15; cursor: pointer; transition: transform .16s ease, border-color .16s ease, background .16s ease, color .16s ease, box-shadow .16s ease; }
.button:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--primary) 50%, var(--line)); color: var(--primary); box-shadow: var(--shadow-sm); }
.button:active { transform: translateY(0); }
.button.primary { border-color: var(--primary); background: linear-gradient(145deg, var(--primary), var(--primary-hover)); color: #fff; box-shadow: 0 8px 20px rgba(21,110,168,.2); }
.button.primary:hover { color: #fff; box-shadow: 0 10px 25px rgba(21,110,168,.28); }
.button.danger { color: var(--danger); }
.button.danger:hover { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); background: color-mix(in srgb, var(--danger) 8%, var(--surface)); }
.button.ghost { border-color: transparent; background: transparent; box-shadow: none; }
.button.full { width: 100%; }
.button:disabled, .icon-button:disabled { opacity: .45; pointer-events: none; }
.icon-button { display: grid; place-items: center; width: 40px; height: 40px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--text-soft); font-size: 1.18rem; line-height: 1; cursor: pointer; transition: background .16s ease, color .16s ease, border-color .16s ease, transform .16s ease; }
.icon-button:hover { border-color: var(--line-strong); background: var(--surface-subtle); color: var(--primary); transform: translateY(-1px); }
.badge { display: inline-flex; align-items: center; padding: .25rem .5rem; border-radius: 999px; background: var(--surface-subtle); color: var(--muted); font-size: .68rem; font-weight: 750; white-space: nowrap; }
.switch-row { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 58px; padding: .65rem .75rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-subtle); cursor: pointer; }
.switch-row > span:first-child { display: grid; gap: .08rem; }
.switch-row strong { color: var(--text); font-size: .86rem; }
.switch-row small { color: var(--muted); font-size: .72rem; font-weight: 500; }
.switch-input { position: absolute; width: 1px; height: 1px; min-height: 1px; margin: 0; padding: 0; opacity: 0; pointer-events: none; }
.switch-track { position: relative; width: 46px; height: 26px; flex: 0 0 auto; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface-strong); box-shadow: inset 0 1px 2px rgba(16,24,40,.09); transition: background .18s ease, border-color .18s ease; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(16,24,40,.24); transition: transform .2s var(--ease); }
.switch-input:checked + .switch-track { border-color: var(--primary); background: var(--primary); }
.switch-input:checked + .switch-track::after { transform: translateX(20px); }
.switch-row:focus-within { outline: 3px solid color-mix(in srgb, var(--primary) 52%, transparent); outline-offset: 2px; }
.counter-badge, .counter-inline { display: inline-flex; align-items: center; margin-left: .35rem; border-radius: 999px; background: color-mix(in srgb, var(--amber) 22%, var(--surface)); color: color-mix(in srgb, #8b5700 82%, var(--text)); font-style: normal; font-weight: 800; white-space: nowrap; }
.counter-badge { padding: .08rem .32rem; font-size: .62rem; }
.counter-inline { padding: .14rem .42rem; font-size: .67rem; vertical-align: middle; }
html[data-theme="dark"] .counter-badge, html[data-theme="dark"] .counter-inline { color: #ffd98a; }
@media (prefers-color-scheme: dark) { html[data-theme="system"] .counter-badge, html[data-theme="system"] .counter-inline { color: #ffd98a; } }

/* Surfaces */
.card { padding: 1.15rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: .9rem; }
.card-header h2, .card-header p { margin: 0; }
.loading-surface { display: grid; place-items: center; min-height: 420px; padding: 4rem 1rem; color: var(--muted); text-align: center; }
.skeleton { width: min(100%, 430px); height: 95px; margin: .5rem auto; border-radius: 14px; background: linear-gradient(90deg, var(--surface-subtle), var(--surface-strong), var(--surface-subtle)); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
.skeleton.wide { width: min(100%, 740px); height: 210px; }
.empty-state { grid-column: 1 / -1; padding: 4rem 1.5rem; color: var(--muted); text-align: center; }
.empty-state h2 { margin-bottom: .35rem; color: var(--text); }

/* Dashboard + calendar */
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 1rem; align-items: start; }
.calendar-card { min-width: 0; padding: 1rem; }
.calendar-toolbar { display: flex; align-items: center; gap: .45rem; min-height: 46px; margin-bottom: .9rem; }
.calendar-toolbar h2 { min-width: 190px; margin: 0 .5rem; font-size: 1.12rem; }
.segmented { display: flex; gap: 2px; margin-left: auto; padding: 3px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-subtle); }
.segmented button { min-height: 32px; padding: .35rem .65rem; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: .74rem; font-weight: 700; cursor: pointer; }
.segmented button.active { background: var(--surface); color: var(--primary); box-shadow: 0 1px 5px rgba(16,24,40,.08); }
.calendar-add-event { flex: 0 0 auto; margin-left: .15rem; white-space: nowrap; }
.upcoming-open { padding: 0; border: 0; background: transparent; color: var(--primary); font-size: .7rem; font-weight: 750; cursor: pointer; }
.upcoming-open.has-more { background: transparent; color: var(--primary); }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.weekday { padding: .58rem .4rem; border-bottom: 1px solid var(--line); background: var(--surface-subtle); color: var(--muted); font-size: .65rem; font-weight: 800; letter-spacing: .07em; text-align: center; text-transform: uppercase; }
.day-cell { position: relative; min-height: 102px; padding: .38rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); overflow: hidden; transition: background .16s ease; }
.day-cell:nth-child(7n) { border-right: 0; }
.day-cell:hover { background: color-mix(in srgb, var(--primary-soft) 45%, var(--surface)); }
.day-cell.outside { background: var(--surface-subtle); color: var(--muted); }
.day-cell.today { background: color-mix(in srgb, var(--primary-soft) 58%, var(--surface)); }
.day-cell-navigable { cursor: pointer; }
.day-cell-navigable .day-number[role="button"] { cursor: pointer; }
.day-cell-navigable .day-number[role="button"]:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 45%, transparent); outline-offset: 2px; }
.day-number { display: grid; place-items: center; width: 27px; height: 27px; margin-bottom: .15rem; border-radius: 50%; font-size: .76rem; font-weight: 750; }
.day-cell.today .day-number { background: var(--navy); color: #fff; box-shadow: 0 5px 12px rgba(7,56,95,.22); }
.event-pill { display: block; width: 100%; margin-top: .22rem; padding: .28rem .38rem; overflow: hidden; border: 0; border-left: 3px solid var(--event-color, var(--primary)); border-radius: 5px; background: color-mix(in srgb, var(--event-color, var(--primary)) 12%, var(--surface)); color: var(--text); font-size: .7rem; line-height: 1.25; text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.event-pill:hover { filter: brightness(.98); }
.event-pill b { font-weight: 800; }
.week-schedule { display: grid; grid-template-columns: repeat(7, minmax(110px, 1fr)); height: 100%; min-height: 430px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.week-day { min-width: 0; padding: .45rem; border-right: 1px solid var(--line); background: var(--surface); transition: background .16s ease, box-shadow .16s ease; }
.week-day:last-child { border-right: 0; }
.week-day.today { background: color-mix(in srgb, var(--primary-soft) 48%, var(--surface)); }
.week-day.drop-target, .day-time-slot.drop-target { background: color-mix(in srgb, var(--primary-soft) 78%, var(--surface)); box-shadow: inset 0 0 0 2px var(--primary); }
.week-day header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; padding: .15rem .15rem .45rem; border-bottom: 1px solid var(--line); }
.week-day header span { color: var(--muted); font-size: .65rem; font-weight: 750; text-transform: uppercase; }
.week-day header strong { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 50%; font-size: .76rem; }
.week-day.today header strong { background: var(--navy); color: #fff; }
.week-day-events { display: grid; align-content: start; gap: .35rem; min-height: calc(100% - 42px); }
.week-empty { padding: 1.4rem .2rem; color: var(--muted); font-size: .62rem; text-align: center; }
.schedule-event { display: grid; gap: .12rem; width: 100%; padding: .48rem .52rem; overflow: hidden; border: 0; border-left: 4px solid var(--event-color, var(--primary)); border-radius: 8px; background: color-mix(in srgb, var(--event-color, var(--primary)) 12%, var(--surface)); color: var(--text); text-align: left; cursor: grab; }
.schedule-event:active { cursor: grabbing; }
.schedule-event strong, .schedule-event small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.schedule-event strong { font-size: .72rem; }
.schedule-event small { font-size: .62rem; }
.schedule-event.dragging { opacity: .4; }
.day-schedule { height: 100%; min-height: 430px; overflow-y: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.day-all-day { position: sticky; top: 0; z-index: 3; display: grid; grid-template-columns: 76px minmax(0, 1fr); min-height: 52px; border-bottom: 1px solid var(--line-strong); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(10px); }
.day-all-day > span, .day-time-slot > time { padding: .65rem .55rem; border-right: 1px solid var(--line); color: var(--muted); font-size: .65rem; font-weight: 700; text-align: right; }
.day-all-day > div { display: flex; align-items: center; gap: .4rem; padding: .35rem .5rem; }
.day-all-day .schedule-event { width: auto; max-width: 260px; }
.day-time-slot { display: grid; grid-template-columns: 76px minmax(0, 1fr); min-height: 54px; border-bottom: 1px solid var(--line); transition: background .16s ease, box-shadow .16s ease; }
.day-time-slot:last-child { border-bottom: 0; }
.day-time-slot > div { display: flex; align-items: flex-start; gap: .4rem; min-width: 0; padding: .28rem .5rem; }
.day-time-slot .schedule-event { width: min(360px, 100%); }
.side-stack { display: grid; gap: 1rem; }
.side-stack > .card { overflow: hidden; }
.dashboard-recent-card { padding: .9rem; }
.dashboard-recent-card .card-header { margin-bottom: .55rem; }
.dashboard-recent-card .text-link { font-size: .7rem; font-weight: 750; }
.dashboard-recent-list { display: grid; gap: .35rem; }
.dashboard-recent-item { display: grid; grid-template-columns: 32px minmax(0, 1fr); align-items: center; gap: .6rem; min-height: 45px; padding: .42rem .5rem; border-radius: 10px; color: var(--text); transition: background .16s ease; }
.dashboard-recent-item:hover { background: var(--surface-subtle); }
.dashboard-recent-item > span:last-child { min-width: 0; }
.dashboard-recent-item strong, .dashboard-recent-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-recent-item strong { font-size: .78rem; }
.dashboard-recent-item small { margin-top: .08rem; color: var(--muted); font-size: .65rem; }
.recent-marker { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; font-size: .68rem; font-weight: 850; }
.note-marker { background: color-mix(in srgb, var(--amber) 18%, var(--surface)); color: #9a6412; }
.list-marker { background: color-mix(in srgb, var(--green) 16%, var(--surface)); color: var(--green); }
.dashboard-empty-link { padding: .7rem; border: 1px dashed var(--line-strong); border-radius: 10px; color: var(--muted); font-size: .75rem; text-align: center; }

/* Weather */
#weather-card { position: relative; overflow: hidden; border: 0; background: linear-gradient(145deg, #07385f, #0b527b); color: #fff; box-shadow: 0 18px 40px rgba(7,56,95,.24); }
#weather-card::after { content: ""; position: absolute; right: -55px; bottom: -80px; width: 190px; height: 190px; border-radius: 50%; background: rgba(255,255,255,.055); }
#weather-card .muted, #weather-card small { color: rgba(255,255,255,.67); }
#weather-card .badge { background: rgba(255,255,255,.1); color: rgba(255,255,255,.78); }
#weather-card .weather-page-link { position: relative; z-index: 2; display: inline-flex; padding: .28rem .45rem; border-radius: 7px; background: rgba(255,255,255,.1); color: rgba(255,255,255,.88); font-size: .64rem; font-weight: 750; white-space: nowrap; }
#weather-card .weather-page-link:hover { background: rgba(255,255,255,.18); color: #fff; }
.weather-current { position: relative; z-index: 1; display: flex; align-items: center; gap: .9rem; }
.weather-icon { font-size: 3.2rem; line-height: 1; filter: drop-shadow(0 5px 10px rgba(0,0,0,.12)); }
.temperature { font-family: "Aptos Display", "Segoe UI Variable Display", sans-serif; font-size: 2.75rem; font-weight: 750; letter-spacing: -.07em; line-height: 1; }
.forecast-row { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(5, minmax(52px, 1fr)); gap: .35rem; margin-top: 1rem; }
.forecast-day { padding: .55rem .18rem; border: 1px solid rgba(255,255,255,.08); border-radius: 10px; background: rgba(255,255,255,.07); color: rgba(255,255,255,.76); font-size: .65rem; text-align: center; }
.forecast-day span { display: block; margin: .16rem 0; font-size: 1.15rem; }
.forecast-day b { color: #fff; }
.page-calendar #weather-card { min-height: 0; padding: .72rem .85rem; }
.page-calendar #weather-card .card-header { margin-bottom: .25rem; }
.page-calendar #weather-card .card-header h2 { font-size: .88rem; }
.page-calendar #weather-card .weather-current { gap: .65rem; }
.page-calendar #weather-card .weather-icon { font-size: 2.25rem; }
.page-calendar #weather-card .temperature { font-size: 2.05rem; }
.page-calendar #weather-card .weather-current strong { font-size: .78rem; }
.page-calendar #weather-card .weather-current .muted { font-size: .66rem; }
.page-calendar #weather-card .forecast-row { display: none; }
.weather-page-content { max-width: 1500px; margin: 0 auto; }
.weather-page-layout { display: grid; grid-template-columns: minmax(300px, 360px) minmax(0, 1fr); gap: 1rem; align-items: stretch; }
.weather-hero { position: relative; min-height: 360px; padding: 1.35rem; overflow: hidden; border-radius: var(--radius-lg); background: linear-gradient(150deg, #07385f 0%, #0b527b 58%, #14749c 100%); color: #fff; box-shadow: 0 22px 50px rgba(7,56,95,.24); }
.weather-hero::after { content: ""; position: absolute; right: -75px; bottom: -105px; width: 260px; height: 260px; border-radius: 50%; background: rgba(255,255,255,.06); }
.weather-hero .eyebrow, .weather-hero p, .weather-hero span { color: rgba(255,255,255,.7); }
.weather-hero-heading { position: relative; z-index: 1; display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.weather-hero-heading h2 { margin: .15rem 0; color: #fff; font-size: 1.45rem; }
.weather-hero-heading p { margin: 0; font-size: .72rem; }
.weather-hero-icon { font-size: 4.2rem; line-height: 1; filter: drop-shadow(0 8px 16px rgba(0,0,0,.16)); }
.weather-hero-current { position: relative; z-index: 1; display: flex; align-items: center; gap: 1rem; margin: 2.2rem 0; }
.weather-hero-current > div:last-child { display: grid; gap: .18rem; }
.weather-hero-current strong { font-size: 1rem; }
.weather-hero-temp { font-family: "Aptos Display", "Segoe UI Variable Display", sans-serif; font-size: 4.8rem; font-weight: 760; letter-spacing: -.08em; line-height: .9; }
.weather-metrics { position: relative; z-index: 1; display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.weather-metrics > div { padding: .7rem; border: 1px solid rgba(255,255,255,.1); border-radius: 11px; background: rgba(255,255,255,.075); }
.weather-metrics span, .weather-metrics strong { display: block; }
.weather-metrics span { margin-bottom: .2rem; font-size: .65rem; }
.weather-metrics strong { font-size: .85rem; }
.weather-week { min-width: 0; padding: 1.2rem; }
.weather-week .card-header { margin-bottom: .9rem; }
.weather-week .eyebrow { margin-bottom: .18rem; }
.weather-week-grid { display: grid; grid-template-columns: repeat(7, minmax(105px, 1fr)); gap: .55rem; }
.weather-day-card { display: flex; min-width: 0; min-height: 260px; padding: .85rem .7rem; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-subtle); flex-direction: column; align-items: center; text-align: center; }
.weather-day-card > div:first-child strong, .weather-day-card > div:first-child span { display: block; }
.weather-day-card > div:first-child strong { font-size: .78rem; }
.weather-day-card > div:first-child span { margin-top: .08rem; color: var(--muted); font-size: .64rem; }
.weather-day-icon { margin: .8rem 0 .45rem; font-size: 2.25rem; line-height: 1; }
.weather-day-card p { min-height: 2.2em; margin: 0; color: var(--text-soft); font-size: .7rem; }
.weather-day-temps { display: flex; align-items: baseline; gap: .4rem; margin: auto 0 .5rem; }
.weather-day-temps strong { font-size: 1.35rem; }
.weather-day-temps span { color: var(--muted); font-size: .95rem; }
.weather-day-card small { font-size: .64rem; }

/* Upcoming + shared list patterns */
.upcoming-list, .simple-list { display: grid; gap: .5rem; }
.upcoming-item { display: grid; grid-template-columns: 4px minmax(0, 1fr) auto; align-items: center; gap: .7rem; width: 100%; min-height: 58px; padding: .65rem .7rem; border: 1px solid transparent; border-radius: 11px; background: var(--surface-subtle); color: var(--text); transition: border-color .16s ease, background .16s ease, transform .16s ease; }
button.upcoming-item { cursor: pointer; }
.upcoming-item:hover { border-color: var(--line-strong); background: var(--surface); transform: translateY(-1px); }
.upcoming-item.today { background: var(--primary-soft); }
.upcoming-item .color-bar { align-self: stretch; min-height: 32px; border-radius: 99px; background: var(--event-color, var(--primary)); }
.upcoming-item p { margin: 0; overflow: hidden; font-size: .85rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.upcoming-item small { display: block; overflow: hidden; margin-top: .1rem; color: var(--muted); font-size: .7rem; text-overflow: ellipsis; white-space: nowrap; }
.upcoming-item > .button { min-height: 34px; padding: .4rem .7rem; border-color: var(--line); background: var(--surface); font-size: .72rem; box-shadow: none; }
.upcoming-dialog-list { display: grid; gap: .45rem; max-height: min(64vh, 620px); padding-right: .25rem; overflow-y: auto; }

/* Notes */
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.note-card { position: relative; display: flex; flex-direction: column; min-height: 190px; cursor: pointer; transition: transform .2s var(--ease), box-shadow .2s ease, border-color .2s ease; }
.note-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--primary) 26%, var(--line)); box-shadow: var(--shadow); }
.note-card.pinned::before { content: ""; position: absolute; top: 0; left: 1rem; right: 1rem; height: 3px; border-radius: 0 0 4px 4px; background: var(--amber); }
.note-card .note-body { display: -webkit-box; overflow: hidden; color: var(--text-soft); white-space: pre-wrap; -webkit-box-orient: vertical; -webkit-line-clamp: 5; }
.note-card footer { margin-top: auto; padding-top: 1rem; color: var(--muted); font-size: .72rem; }
.reorderable { cursor: grab !important; }
.reorderable:active { cursor: grabbing !important; }
.reorderable.dragging { opacity: .4; }
.reorderable.drag-over { outline: 2px solid var(--primary); outline-offset: 2px; }
.note-card.reorderable::after { content: "⋮⋮"; position: absolute; top: .65rem; right: .7rem; color: var(--muted); font-size: .9rem; letter-spacing: -4px; opacity: .65; }
.note-card.reorderable .card-header { padding-right: 1.4rem; }
.list-picker button.reorderable::before { content: "⋮⋮"; color: var(--muted); font-size: .8rem; letter-spacing: -4px; opacity: .65; }

/* Lists */
.lists-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 1rem; }
.list-picker { align-self: start; padding: .55rem; }
.list-picker button { display: flex; align-items: center; gap: .5rem; width: 100%; min-height: 46px; padding: .65rem .75rem; border: 0; border-radius: 10px; background: transparent; color: var(--text-soft); font-weight: 650; text-align: left; cursor: pointer; }
.list-picker button:hover { background: var(--surface-subtle); }
.list-picker button.active { background: var(--primary-soft); color: var(--primary); }
.quick-add { display: flex; gap: .5rem; margin: 1rem 0; }
.quick-add input { flex: 1; margin: 0; }
.list-items { display: grid; gap: .45rem; }
.list-item { display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: center; gap: .6rem; min-height: 0; padding: .7rem; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-subtle); }
.list-item input[type="checkbox"] { width: 24px; height: 24px; margin: 0; accent-color: var(--green); }
.list-item .item-text { min-width: 0; overflow-wrap: anywhere; font-size: .96rem; }
.list-item.completed .item-text { color: var(--muted); text-decoration: line-through; }
.list-item-actions { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(44px, 1fr)); gap: .35rem; padding-top: .55rem; border-top: 1px solid var(--line); }
.list-item .icon-button { display: flex; align-items: center; justify-content: center; width: 100%; height: 44px; min-width: 44px; border-color: var(--line); background: var(--surface); font-size: 0; }
.list-item-actions .icon-button::after { font-size: .7rem; font-weight: 800; }
.list-item-actions .item-up::after { content: "\2191  Up"; }
.list-item-actions .item-down::after { content: "\2193  Down"; }
.list-item-actions .edit-item::after { content: "Edit"; }
.list-item-actions .delete-item::after { content: "Delete"; color: var(--danger); }

/* Calendar sharing */
.calendar-feed-panel { display: grid; gap: .85rem; margin: 1rem 0; padding: 1rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-subtle); }
.calendar-feed-panel h3 { margin: .1rem 0 .2rem; }
.calendar-feed-panel p { margin: 0; }
.calendar-feed-url { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .5rem; }
.calendar-feed-url input { min-width: 0; margin: 0; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .75rem; }
.calendar-feed-notice { padding: .7rem .8rem; border-radius: 10px; background: color-mix(in srgb, var(--primary-soft) 55%, var(--surface)); color: var(--text-soft); font-size: .8rem; }
.calendar-feed-actions, .calendar-admin-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.calendar-share-fieldset { display: grid; gap: .7rem; margin: .15rem 0 0; padding: .85rem; border: 1px solid var(--line); border-radius: 12px; }
.calendar-share-fieldset legend { padding: 0 .35rem; font-size: .78rem; font-weight: 800; }
.calendar-share-users { display: grid; gap: .35rem; max-height: 220px; overflow-y: auto; }
.calendar-share-user { display: flex; align-items: center; gap: .65rem; margin: 0; padding: .5rem .6rem; border-radius: 9px; cursor: pointer; }
.calendar-share-user:hover { background: var(--surface); }
.calendar-share-user input { width: 20px; height: 20px; margin: 0; accent-color: var(--primary); }
.calendar-share-user span { display: grid; min-width: 0; }
.calendar-share-user small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; }

/* Photos */
.upload-zone { margin-bottom: 1rem; padding: 1.6rem; border: 1.5px dashed var(--line-strong); border-radius: var(--radius); background: color-mix(in srgb, var(--primary-soft) 35%, var(--surface)); text-align: center; }
.upload-zone h2 { margin-bottom: .2rem; }
.upload-zone > label { max-width: 520px; margin: .75rem auto; text-align: left; }
.upload-zone input[type="file"] { max-width: 520px; }
.upload-zone.dragging { border-color: var(--primary); background: var(--primary-soft); }
.gallery { columns: 4 230px; column-gap: 1rem; }
.photo-card { position: relative; padding: 0; overflow: hidden; break-inside: avoid; margin-bottom: 1rem; border-color: transparent; background: #061521; cursor: pointer; transition: transform .2s var(--ease), box-shadow .2s ease; }
.photo-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.photo-card img { display: block; width: 100%; height: auto; background: var(--surface-subtle); }
.photo-meta { position: absolute; right: 0; bottom: 0; left: 0; padding: 2.8rem .85rem .75rem; background: linear-gradient(transparent, rgba(2,13,22,.86)); color: #fff; opacity: 0; transform: translateY(8px); transition: opacity .18s ease, transform .18s ease; }
.photo-card:hover .photo-meta, .photo-card:focus-within .photo-meta { opacity: 1; transform: none; }
.photo-meta p { margin: 0; font-size: .84rem; font-weight: 700; }
.photo-meta small { color: rgba(255,255,255,.74); font-size: .68rem; }

/* Forms */
label { display: block; margin-bottom: .9rem; color: var(--text-soft); font-size: .78rem; font-weight: 700; }
input, textarea, select { width: 100%; min-height: 43px; margin-top: .32rem; padding: .65rem .75rem; border: 1px solid var(--line-strong); border-radius: 10px; outline: 0; background: var(--surface); color: var(--text); transition: border-color .16s ease, box-shadow .16s ease, background .16s ease; }
input:hover, textarea:hover, select:hover { border-color: color-mix(in srgb, var(--primary) 35%, var(--line-strong)); }
input:focus, textarea:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent); }
textarea { min-height: 120px; resize: vertical; }
.form-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .85rem; }
small { color: var(--muted); }
.check-row { display: flex; align-items: center; gap: .65rem; min-height: 38px; }
.check-row input { width: 19px; min-height: 19px; margin: 0; accent-color: var(--primary); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.form-grid h2, .span-2 { grid-column: 1 / -1; }
.optional { color: var(--muted); font-size: .68rem; font-weight: 500; }

/* Settings */
.settings-layout { display: grid; grid-template-columns: 220px minmax(0, 920px); gap: 1rem; align-items: start; }
.settings-nav { position: sticky; top: calc(var(--nav-height) + 1rem); padding: .5rem; }
.settings-nav button { display: flex; align-items: center; width: 100%; min-height: 42px; padding: .58rem .75rem; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: .8rem; font-weight: 650; text-align: left; cursor: pointer; }
.settings-nav button:hover { background: var(--surface-subtle); color: var(--text); }
.settings-nav button.active { background: var(--primary-soft); color: var(--primary); }
.settings-section { display: none; min-height: 360px; padding: 1.35rem; }
.settings-section.active { display: block; animation: fade-up .22s ease-out; }
.settings-section > h2, .settings-form > h2 { margin-bottom: 1.2rem; padding-bottom: .8rem; border-bottom: 1px solid var(--line); }
#section-smtp .settings-form > .button { margin-top: .9rem; }
#section-smtp .settings-form > .button + .button { margin-left: .7rem; }
.calendar-visibility-panel { margin-bottom: 1.35rem; padding-bottom: 1.35rem; border-bottom: 1px solid var(--line); }
.calendar-visibility-panel .card-header { align-items: flex-start; margin-bottom: .85rem; }
.calendar-visibility-panel .card-header p { margin-top: .2rem; }
.calendar-visibility-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
.calendar-visibility-item { display: grid; grid-template-columns: 20px 10px minmax(0, 1fr); align-items: center; gap: .6rem; min-height: 58px; margin: 0; padding: .62rem .7rem; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-subtle); cursor: pointer; }
.calendar-visibility-item input { width: 18px; min-height: 18px; margin: 0; accent-color: var(--primary); }
.calendar-color { width: 9px; height: 32px; border-radius: 99px; background: var(--calendar-color); }
.calendar-visibility-item strong, .calendar-visibility-item small { display: block; }
.calendar-visibility-item strong { color: var(--text); font-size: .78rem; }
.calendar-visibility-item small { margin-top: .1rem; font-size: .65rem; font-weight: 500; }
.caldav-lockout-panel { display: flex; align-items: center; justify-content: space-between; gap: 1.25rem; margin-top: 1.35rem; padding: 1rem; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-subtle); }
.caldav-lockout-panel h3 { margin: .14rem 0 .24rem; font-size: .95rem; }
.caldav-lockout-panel p { max-width: 660px; margin: 0; color: var(--text-soft); font-size: .72rem; line-height: 1.5; }
.caldav-lockout-panel .button { flex: 0 0 auto; }
.screensaver-options { transition: opacity .18s ease; }
.screensaver-options.disabled { pointer-events: none; opacity: .45; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: .65rem .7rem; border-bottom: 1px solid var(--line-strong); color: var(--muted); font-size: .64rem; letter-spacing: .07em; text-align: left; text-transform: uppercase; }
.data-table td { padding: .75rem .7rem; border-bottom: 1px solid var(--line); font-size: .8rem; vertical-align: middle; }
.data-table tbody tr { transition: background .15s ease; }
.data-table tbody tr:hover { background: var(--surface-subtle); }
[data-user] { cursor: pointer; }

/* CalDAV account setup */
.caldav-setup-card { max-width: 700px; margin-top: 1rem; }
.caldav-setup-card > p { color: var(--text-soft); }
.caldav-credentials { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; margin-top: 1.15rem; }
.caldav-credentials > label:first-child { grid-column: 1 / -1; }
.copy-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .5rem; }
.copy-field input { min-width: 0; margin: .32rem 0 0; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .75rem; }
.copy-field .button { margin-top: .32rem; }
.caldav-help { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: .55rem 1rem; margin: .85rem 0; padding: .85rem; border-radius: 12px; background: var(--surface-subtle); color: var(--text-soft); font-size: .76rem; line-height: 1.5; }
.caldav-help strong { color: var(--text); }
.caldav-security-note { margin-bottom: 0; padding-top: .8rem; border-top: 1px solid var(--line); font-size: .72rem; }

/* Search */
.search-page-content { width: 100%; }
.search-card { width: 100%; margin-inline: auto; }
.search-card .quick-add { display: block; margin: 0; }
.search-card .quick-add input { width: 100%; }
.search-results { display: grid; gap: .55rem; margin-top: 1rem; }
.search-results-header { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: 0 .15rem .35rem; color: var(--text); }
.search-results-header span, .search-loading, .search-prompt { color: var(--muted); font-size: .75rem; }
.search-loading, .search-prompt { padding: 1rem .2rem; }
.search-result-item { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; align-items: center; gap: .85rem; min-height: 68px; padding: .72rem .85rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-subtle); color: var(--text); transition: border-color .16s ease, background .16s ease, transform .16s ease; }
.search-result-item:hover, .search-result-item:focus-visible { border-color: color-mix(in srgb, var(--primary) 55%, var(--line)); background: var(--primary-soft); transform: translateY(-1px); }
.search-result-type { color: var(--primary); font-size: .66rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.search-result-copy { display: grid; min-width: 0; gap: .15rem; }
.search-result-copy strong, .search-result-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-result-copy small { color: var(--muted); font-size: .72rem; }
.search-result-score { padding: .28rem .48rem; border-radius: 999px; background: var(--surface); color: var(--text-soft); font-size: .66rem; font-weight: 750; white-space: nowrap; }

/* Modal, toasts, states */
dialog { width: min(620px, calc(100% - 2rem)); max-height: 90vh; padding: 0; border: 0; background: transparent; color: var(--text); }
dialog::backdrop { background: rgba(2, 17, 30, .68); backdrop-filter: blur(5px); }
.dialog-card { position: relative; max-height: 90vh; overflow: auto; padding: 1.4rem; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-lg); }
.dialog-card h2 { padding-right: 3rem; }
.dialog-close { position: absolute; top: .8rem; right: .8rem; }
.photo-dialog-actions { position: sticky; bottom: -1.4rem; display: flex; justify-content: space-between; gap: .75rem; margin: 1rem -1.4rem -1.4rem; padding: .9rem 1.4rem 1.25rem; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(14px); }
dialog.photo-editor-open { width: min(1060px, calc(100% - 2rem)); max-height: calc(100dvh - 2rem); }
.photo-dialog-shell { height: auto; max-height: calc(100dvh - 2rem); padding: 0; overflow: hidden; }
.photo-dialog-shell .dialog-close { position: absolute; top: .75rem; right: .75rem; z-index: 4; border-color: rgba(255,255,255,.28); background: rgba(3,18,29,.72); color: #fff; backdrop-filter: blur(12px); }
.photo-editor-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, .55fr); min-height: 0; }
.photo-editor-preview { position: relative; min-width: 0; min-height: 0; overflow: hidden; border-right: 1px solid var(--line); background: var(--surface); }
.photo-editor-preview img { position: absolute; inset: 1rem; display: block; width: calc(100% - 2rem); height: calc(100% - 2rem); max-width: none; max-height: none; border-radius: 10px; object-fit: contain; }
.photo-editor-form { display: flex; min-width: 0; min-height: 0; padding: 1.35rem; overflow: hidden; flex-direction: column; }
.photo-editor-heading { min-width: 0; margin-bottom: .7rem; }
.photo-editor-heading .eyebrow { margin-bottom: .15rem; }
.photo-editor-heading h2 { margin: 0; overflow: hidden; font-size: 1.25rem; text-overflow: ellipsis; white-space: nowrap; }
.photo-editor-form label { margin-bottom: .65rem; }
.photo-editor-form textarea { min-height: 78px; max-height: 15vh; }
.photo-editor-form .photo-dialog-actions { position: static; flex: 0 0 auto; margin: .15rem 0 0; padding: .75rem 0 0; background: transparent; backdrop-filter: none; }
.toast-region { position: fixed; top: max(1rem, env(safe-area-inset-top)); right: auto; bottom: auto; left: 50%; z-index: 2147483647; display: grid; grid-auto-rows: max-content; align-content: start; width: min(520px, calc(100vw - 2rem)); height: max-content; max-height: calc(100dvh - 2rem - env(safe-area-inset-top)); margin: 0; padding: 0; overflow: visible; border: 0; gap: .5rem; transform: translateX(-50%); background: transparent; pointer-events: none; }
.toast { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 42px; padding: .62rem .9rem; border: 1px solid rgba(255,255,255,.13); border-radius: 12px; background: color-mix(in srgb, #102b3f 94%, transparent); color: #fff; box-sizing: border-box; box-shadow: var(--shadow-lg); line-height: 1.3; text-align: center; cursor: pointer; pointer-events: auto; backdrop-filter: blur(16px); animation: toast-in .25s var(--ease); }
.offline-banner { position: fixed; bottom: 1rem; left: 50%; z-index: 110; transform: translateX(-50%); padding: .65rem 1rem; border-radius: 10px; background: #7a4319; color: #fff; box-shadow: var(--shadow); }
.alert { margin-bottom: 1rem; padding: .72rem .8rem; border-radius: 10px; font-size: .82rem; }
.alert.error { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--danger); }
.alert.success { background: color-mix(in srgb, var(--success) 12%, var(--surface)); color: var(--success); }

/* Login + installer: intentionally dark */
.auth-page { position: relative; display: grid; place-items: center; min-height: 100vh; padding: 2rem 1.25rem; overflow-x: hidden; background: #041d32; color: #f8fbff; color-scheme: dark; }
.auth-page::before, .auth-page::after { content: ""; position: fixed; pointer-events: none; border-radius: 50%; filter: blur(4px); }
.auth-page::before { top: -28vw; left: -12vw; width: 68vw; height: 68vw; background: radial-gradient(circle, rgba(22,112,168,.42), transparent 66%); }
.auth-page::after { right: -16vw; bottom: -35vw; width: 70vw; height: 70vw; background: radial-gradient(circle, rgba(63,143,80,.24), transparent 65%); }
.auth-card, .install-card { position: relative; z-index: 1; width: min(430px, 100%); padding: 1.6rem; border: 1px solid rgba(255,255,255,.11); border-radius: 26px; background: linear-gradient(155deg, rgba(13,49,74,.94), rgba(7,34,55,.97)); box-shadow: 0 35px 90px rgba(0,0,0,.42); }
.install-card { width: min(740px, 100%); }
.auth-card > .brand-mark, .install-card > .brand-mark { width: 190px; height: 190px; max-width: 65vw; margin: 0 auto .65rem; border-radius: 20px; background-image: url('../images/brand-logo.png'); background-size: contain; background-color: #fff; background-repeat: no-repeat; box-shadow: 0 14px 34px rgba(0,0,0,.2); }
.auth-card h1, .install-card h1 { margin-bottom: .3rem; color: #fff; text-align: center; }
.auth-card > p, .install-card > p { text-align: center; }
.auth-page .muted, .auth-page small { color: #9db0bf; }
.auth-page label { color: #dbe7ef; }
.auth-page input, .auth-page select, .auth-page textarea { border-color: rgba(255,255,255,.14); background: rgba(255,255,255,.075); color: #fff; }
.auth-page input::placeholder { color: #7890a1; }
.auth-page .text-link { display: block; margin-top: 1rem; color: #83cef6; text-align: center; }
.auth-page .button.primary { background: linear-gradient(145deg, #2188c5, #156ea8); }

/* Slideshow + wall display */
.slideshow-stage { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; overflow: hidden; background: #02080d; color: #fff; }
.slideshow-stage img { display: block; width: 100%; height: 100%; max-width: 100vw; max-height: 100vh; padding: clamp(.5rem, 2vw, 2rem); object-fit: contain; }
.slide-controls { position: absolute; bottom: max(1.25rem, env(safe-area-inset-bottom)); left: 50%; display: flex; gap: .5rem; transform: translateX(-50%); padding: .45rem; border: 1px solid rgba(255,255,255,.12); border-radius: 15px; background: rgba(3,18,29,.72); opacity: 1; backdrop-filter: blur(15px); transition: opacity .28s ease, transform .28s ease; }
.slideshow-stage.controls-hidden { cursor: none; }
.slideshow-stage.controls-hidden .slide-controls { pointer-events: none; opacity: 0; transform: translate(-50%, 14px); }
.slide-caption { position: absolute; bottom: 1.5rem; left: 1.5rem; max-width: 45%; font-size: 1.1rem; text-shadow: 0 2px 8px #000; }
.display-grid { display: grid; grid-template-columns: 1.18fr .82fr; gap: 1.25rem; }
.display-clock { font-family: "Aptos Display", "Segoe UI Variable Display", sans-serif; font-size: clamp(3.5rem, 8vw, 7.5rem); font-weight: 750; letter-spacing: -.08em; line-height: .95; }
.page-display { max-width: 1800px; }
.page-display #display-weather { border: 0; background: linear-gradient(145deg, #07385f, #0b527b); color: #fff; }
.page-display img { object-fit: contain !important; background: #02080d; }

/* Profile notification settings */
.notification-profile-card { max-width: 920px; margin-top: 1rem; }
.notification-profile-card > p { max-width: 720px; margin-top: -.2rem; color: var(--muted); }
.push-device-setup { display: grid; grid-template-columns: minmax(220px, 1fr) auto; align-items: end; gap: .75rem; margin: 1.2rem 0; padding: 1rem; border: 1px solid var(--line); border-radius: 14px; background: color-mix(in srgb, var(--surface-2) 72%, transparent); }
.push-device-setup label { margin: 0; }
.push-device-list { display: grid; gap: .55rem; }
.push-device-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: .7rem; min-height: 62px; padding: .65rem .75rem; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.push-device-row strong, .push-device-row small { display: block; }
.push-device-row small { margin-top: .16rem; color: var(--muted); font-size: .75rem; }
.push-device-icon { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 10px; background: var(--primary-soft); color: var(--primary); }
.push-device-actions { display: flex; align-items: center; gap: .4rem; }
.push-device-actions .button { min-height: 38px; padding: .45rem .65rem; }
.notification-rule-list { display: grid; gap: .6rem; margin-top: 1.15rem; }
.notification-rule-row { display: grid; grid-template-columns: minmax(115px,.65fr) minmax(145px,.8fr) auto minmax(170px,1fr) 42px; align-items: end; gap: .65rem; padding: .8rem; border: 1px solid var(--line); border-radius: 13px; background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.notification-rule-row label { margin: 0; }
.notification-rule-row label > span { display: block; margin-bottom: .3rem; color: var(--muted); font-size: .68rem; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; }
.notification-rule-row input, .notification-rule-row select { min-height: 42px; }
.rule-before { align-self: center; padding-top: 1.1rem; color: var(--muted); white-space: nowrap; }
.rule-remove { align-self: end; width: 42px; height: 42px; }
.notification-rule-footer { display: flex; justify-content: flex-end; gap: .65rem; margin-top: .85rem; }
.notification-email-note { margin: .75rem 0 0; font-size: .8rem; }
.empty-state.compact { min-height: 0; padding: 1rem; }

/* TV mode */
body.tv-mode { overflow-x: hidden; }
body.tv-mode .topbar { position: fixed; top: 0; right: 0; left: 0; border: 1px solid color-mix(in srgb, var(--line) 75%, transparent); border-top: 0; border-radius: 0 0 18px 18px; box-shadow: 0 12px 35px rgba(10,32,48,.12); }
body.tv-mode.nav-hidden .topbar { transform: translateY(calc(-100% - 8px)); opacity: 0; }
body.tv-mode .nav-reveal-zone { position: fixed; top: 0; right: 0; left: 0; z-index: 35; display: block; height: 12px; }
body.tv-mode .page-shell { width: 100%; max-width: 1900px; padding: calc(var(--nav-height) + .75rem) 1rem .75rem; transition: padding-top .45s var(--ease); }
body.tv-mode.nav-hidden .page-shell { padding-top: .75rem; }
body.tv-mode .page-calendar { display: flex; height: 100vh; overflow: hidden; flex-direction: column; }
body.tv-mode .page-calendar #app-content { flex: 1 1 auto; min-height: 0; }
body.tv-mode .dashboard-grid { grid-template-columns: minmax(0, 1fr) clamp(340px, 24vw, 410px); height: 100%; min-height: 0; }
body.tv-mode .side-stack { min-height: 0; overflow-y: auto; scrollbar-width: none; }
body.tv-mode .side-stack::-webkit-scrollbar { display: none; }
body.tv-mode .calendar-card { display: flex; min-height: 0; height: 100%; flex-direction: column; }
body.tv-mode .calendar-card #calendar { flex: 1 1 auto; min-height: 0; overflow: hidden; }
body.tv-mode .calendar-grid { height: 100%; min-height: 0; grid-template-rows: auto repeat(6, minmax(0, 1fr)); }
body.tv-mode .day-cell { min-height: 0; }
body.tv-mode .side-stack { grid-template-rows: auto auto auto auto; align-content: start; gap: .55rem; max-height: 100%; overflow: hidden; }
body.tv-mode .side-stack > .card { padding: .68rem .75rem; }
body.tv-mode .side-stack .card-header { margin-bottom: .35rem; }
body.tv-mode .upcoming-item { min-height: 42px; padding: .38rem .48rem; }
body.tv-mode .upcoming-list { gap: .3rem; }
body.tv-mode .dashboard-recent-card { padding: .62rem .7rem; }
body.tv-mode .dashboard-recent-list { gap: .2rem; }
body.tv-mode .dashboard-recent-item { min-height: 38px; padding: .25rem .35rem; }
body.tv-mode .dashboard-recent-item:nth-child(n+4) { display: none; }
body.tv-mode .recent-marker { width: 29px; height: 29px; }
body.tv-mode .page-heading { margin-bottom: .8rem; }

/* Motion */
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes fade-up { from { opacity: 0; transform: translateY(5px); } }
@keyframes pulse { 50% { opacity: .35; transform: scale(.8); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

/* Tablet */
@media (max-width: 1050px) {
  .wordmark { min-width: auto; }
  .desktop-nav { margin-left: .5rem; }
  .dashboard-grid { grid-template-columns: minmax(0, 1fr) 310px; }
  .weather-page-layout { grid-template-columns: 1fr; }
  .weather-hero { min-height: 0; }
  .weather-week-grid { grid-template-columns: repeat(4, minmax(120px, 1fr)); }
  .settings-layout { grid-template-columns: 190px minmax(0, 1fr); }
  .user-chip b { display: none; }
}

@media (max-width: 860px) {
  .desktop-nav { display: none; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .side-stack { grid-template-columns: 1fr 1fr; }
  .side-stack > :first-child { grid-column: 1 / -1; }
  .lists-layout { grid-template-columns: 250px minmax(0, 1fr); }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; display: flex; gap: .25rem; overflow-x: auto; }
  .settings-nav button { flex: 0 0 auto; width: auto; white-space: nowrap; }
  .gallery { columns: 3 190px; }
}

/* Mobile control app */
@media (max-width: 640px) {
  :root { --nav-height: 58px; }
  body { font-size: 14px; }
  input, textarea, select { font-size: 16px; }
  .topbar { height: calc(var(--nav-height) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) max(.85rem, env(safe-area-inset-right)) 0 max(.85rem, env(safe-area-inset-left)); gap: .5rem; }
  .wordmark { gap: .55rem; font-size: .9rem; }
  .brand-mark.small { width: 35px; height: 35px; }
  .top-actions { gap: .25rem; }
  .top-actions .icon-button { width: 36px; height: 36px; }
  .user-chip { padding: 0; }
  .user-chip span { width: 34px; height: 34px; }
  .user-chip b, .user-chip i { display: none; }
  .user-menu-panel { position: fixed; top: calc(var(--nav-height) + env(safe-area-inset-top) - 3px); right: max(.65rem, env(safe-area-inset-right)); left: auto; width: min(260px, calc(100vw - 1.3rem - env(safe-area-inset-left) - env(safe-area-inset-right))); }
  .page-shell { padding-top: .9rem; padding-right: max(.75rem, env(safe-area-inset-right)); padding-bottom: calc(82px + env(safe-area-inset-bottom)); padding-left: max(.75rem, env(safe-area-inset-left)); }
  .page-heading { align-items: stretch; flex-direction: column; gap: .65rem; margin-bottom: .8rem; }
  .page-heading > div:first-child { width: 100%; }
  .page-heading h1 { font-size: 1.4rem; }
  .eyebrow { display: flex; font-size: .6rem; }
  #page-actions { width: 100%; justify-content: flex-start; gap: .45rem; }
  #page-actions:empty { display: none; }
  #page-actions .button { min-height: 44px; }
  .page-photos #page-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-photos #page-actions .button { width: 100%; }
  #page-actions .live-indicator { display: none; }
  .bottom-nav { position: fixed; right: 0; bottom: 0; left: 0; z-index: 50; display: grid; grid-template-columns: repeat(5, 1fr); padding: .3rem max(.3rem, env(safe-area-inset-right)) calc(.3rem + env(safe-area-inset-bottom)) max(.3rem, env(safe-area-inset-left)); border-top: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 94%, transparent); box-shadow: 0 -8px 30px rgba(15,31,48,.08); backdrop-filter: blur(18px) saturate(150%); }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .05rem; min-height: 50px; border-radius: 10px; color: var(--muted); font-size: .61rem; font-weight: 750; touch-action: manipulation; }
  .bottom-nav a span { font-size: 1.16rem; line-height: 1; }
  .bottom-nav a.active { background: var(--primary-soft); color: var(--primary); }
  .card { padding: .85rem; border-radius: 14px; }
  .dashboard-grid { gap: .7rem; }
  .calendar-card { padding: .55rem; }
  .calendar-toolbar { margin-bottom: .55rem; }
  .calendar-toolbar h2 { order: -1; width: 100%; min-width: 0; margin: 0 .25rem .2rem; font-size: 1.02rem; }
  .calendar-toolbar { flex-wrap: wrap; }
  .calendar-toolbar .button { min-height: 38px; padding: .45rem .65rem; }
  .calendar-toolbar .icon-button { width: 38px; height: 38px; }
  .segmented { margin-left: auto; }
  .segmented button { display: none; }
  .segmented button.active { display: block; }
  .week-schedule { grid-template-columns: repeat(7, minmax(135px, 1fr)); min-height: 520px; overflow-x: auto; }
  .day-schedule { min-height: 520px; }
  .day-all-day, .day-time-slot { grid-template-columns: 60px minmax(0, 1fr); }
  .day-all-day > span, .day-time-slot > time { padding-right: .4rem; padding-left: .25rem; }
  .weekday { padding: .38rem 0; font-size: .55rem; }
  .day-cell { min-height: 66px; padding: .18rem; }
  .day-number { width: 23px; height: 23px; font-size: .67rem; }
  .event-pill { display: inline-block; width: 7px; height: 7px; margin: 2px; padding: 0; border: 0; border-radius: 50%; background: var(--event-color, var(--primary)); font-size: 0; }
  .side-stack { grid-template-columns: 1fr; gap: .7rem; }
  .side-stack > :first-child { grid-column: auto; }
  .forecast-row { overflow-x: auto; }
  .forecast-day { min-width: 54px; }
  .temperature { font-size: 2.35rem; }
  .weather-week { padding: .85rem; }
  .weather-week-grid { display: flex; gap: .55rem; overflow-x: auto; scroll-snap-type: x proximity; }
  .weather-day-card { flex: 0 0 145px; min-height: 225px; scroll-snap-align: start; }
  .weather-hero { padding: 1rem; }
  .weather-hero-icon { font-size: 3.2rem; }
  .weather-hero-current { margin: 1.35rem 0; }
  .weather-hero-temp { font-size: 4rem; }
  .module-grid { grid-template-columns: minmax(0, 1fr); gap: .65rem; }
  .note-card { min-height: 0; padding: 1rem; touch-action: manipulation; }
  .note-card:hover { transform: none; }
  .note-card .card-header { margin-bottom: .55rem; }
  .note-card .card-header h2 { min-width: 0; overflow: hidden; font-size: 1rem; text-overflow: ellipsis; white-space: nowrap; }
  .note-card .note-body { font-size: .94rem; line-height: 1.48; -webkit-line-clamp: 4; }
  .note-card footer { padding-top: .75rem; }
  .page-notes .page-heading, .page-lists .page-heading { align-items: stretch; gap: .65rem; }
  .page-notes #page-actions .button, .page-lists #page-actions .button { min-height: 44px; padding-inline: .75rem; white-space: nowrap; }
  .lists-layout { grid-template-columns: 1fr; gap: .7rem; }
  .list-picker { display: flex; gap: .3rem; margin-right: -.75rem; margin-left: -.75rem; padding: .4rem max(.75rem, env(safe-area-inset-right)) .4rem max(.75rem, env(safe-area-inset-left)); overflow-x: auto; border-right: 0; border-left: 0; border-radius: 0; scroll-padding-inline: .75rem; scroll-snap-type: x proximity; scrollbar-width: none; }
  .list-picker::-webkit-scrollbar { display: none; }
  .list-picker button { flex: 0 0 auto; width: auto; min-height: 46px; padding: .65rem .8rem; white-space: nowrap; scroll-snap-align: start; }
  #active-list { min-width: 0; }
  #active-list > .card-header { align-items: flex-start; }
  #active-list > .card-header > div { min-width: 0; }
  #active-list > .card-header h2, #active-list > .card-header p { overflow: hidden; text-overflow: ellipsis; }
  #active-list > .card-header h2 { white-space: nowrap; }
  .quick-add { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .45rem; }
  .quick-add input { min-width: 0; }
  .quick-add .button { min-width: 58px; min-height: 46px; }
  .list-items { gap: .55rem; }
  #clear-completed { width: 100%; margin-top: .75rem; min-height: 44px; }
  .gallery { columns: 2 140px; column-gap: .6rem; }
  .photo-card { margin-bottom: .6rem; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid h2, .span-2 { grid-column: auto; }
  .calendar-visibility-grid { grid-template-columns: 1fr; }
  .calendar-visibility-panel .card-header { align-items: stretch; flex-direction: column; }
  .calendar-visibility-panel .card-header .button { width: 100%; }
  .caldav-lockout-panel { align-items: stretch; flex-direction: column; }
  .caldav-lockout-panel .button { width: 100%; }
  .settings-section { padding: 1rem; }
  .settings-nav { margin: 0 -.75rem; border-right: 0; border-left: 0; border-radius: 0; }
  #section-smtp .settings-form > .button { width: 100%; }
  #section-smtp .settings-form > .button + .button { margin-top: .55rem; margin-left: 0; }
  .search-card .quick-add { align-items: stretch; flex-direction: column; }
  .search-result-item { grid-template-columns: 58px minmax(0, 1fr); gap: .65rem; }
  .search-result-score { grid-column: 2; justify-self: start; }
  .caldav-credentials { grid-template-columns: 1fr; }
  .caldav-credentials > label:first-child { grid-column: auto; }
  .caldav-help { grid-template-columns: 1fr; gap: .2rem; }
  .notification-profile-card { margin-top: .7rem; }
  .push-device-setup { grid-template-columns: 1fr; padding: .8rem; }
  .push-device-setup .button { width: 100%; min-height: 46px; }
  .push-device-row { grid-template-columns: 30px minmax(0, 1fr); align-items: start; padding: .75rem; }
  .push-device-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr 44px; width: 100%; }
  .push-device-actions .button, .push-device-actions .icon-button { min-height: 44px; }
  .notification-rule-row { grid-template-columns: minmax(78px,.65fr) minmax(112px,1fr) 44px; gap: .5rem; }
  .notification-rule-row label:nth-of-type(3) { grid-column: 1 / 3; }
  .notification-rule-row .rule-remove { grid-column: 3; grid-row: 1; }
  .rule-before { display: none; }
  .notification-rule-footer { display: grid; grid-template-columns: 1fr 1fr; }
  .notification-rule-footer .button { min-height: 46px; padding-inline: .55rem; }
  dialog { width: 100%; max-height: calc(100dvh - env(safe-area-inset-top)); margin: auto 0 0; }
  dialog.event-editor-open { right: 0; left: 0; width: 100%; max-width: none; }
  dialog.event-editor-open .dialog-card, dialog.event-editor-open #event-form { width: 100%; max-width: none; box-sizing: border-box; }
  dialog.event-editor-open #event-form > * { min-width: 0; }
  dialog[open] { display: block; }
  .dialog-card { max-height: calc(100dvh - env(safe-area-inset-top)); padding: 1.05rem; padding-bottom: calc(1.05rem + env(safe-area-inset-bottom)); border-radius: 20px 20px 0 0; }
  #note-form textarea { min-height: min(38dvh, 320px); }
  .form-actions { position: sticky; bottom: calc(-1.05rem - env(safe-area-inset-bottom)); z-index: 2; margin: 1rem -1.05rem calc(-1.05rem - env(safe-area-inset-bottom)); padding: .8rem 1.05rem calc(.8rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 96%, transparent); backdrop-filter: blur(14px); }
  .form-actions .button { min-height: 46px; }
  .photo-dialog-actions { bottom: calc(-1.05rem - env(safe-area-inset-bottom)); margin: 1rem -1.05rem calc(-1.05rem - env(safe-area-inset-bottom)); padding: .8rem 1.05rem calc(.8rem + env(safe-area-inset-bottom)); }
  dialog.photo-editor-open { width: 100%; max-height: calc(100dvh - .5rem); }
  .photo-dialog-shell { height: auto; max-height: calc(100dvh - .5rem); padding: 0; border-radius: 20px 20px 0 0; }
  .photo-editor-layout { grid-template-columns: 1fr; grid-template-rows: minmax(150px, 31vh) auto; }
  .photo-editor-preview { border-right: 0; border-bottom: 1px solid var(--line); }
  .photo-editor-preview img { inset: .65rem; width: calc(100% - 1.3rem); height: calc(100% - 1.3rem); }
  .photo-editor-form { padding: .9rem 1rem calc(.8rem + env(safe-area-inset-bottom)); }
  .photo-editor-heading { margin-bottom: .35rem; }
  .photo-editor-heading h2 { padding-right: 2.5rem; font-size: 1.05rem; }
  .photo-editor-form label { margin-bottom: .4rem; }
  .photo-editor-form input { min-height: 38px; padding: .5rem .65rem; }
  .photo-editor-form textarea { min-height: 56px; max-height: 10vh; padding: .5rem .65rem; }
  .photo-editor-form .photo-dialog-actions { margin: .1rem 0 0; padding: .45rem 0 0; }
  .toast-region { top: max(.55rem, env(safe-area-inset-top)); width: calc(100vw - 1.25rem); height: max-content; max-height: min(34dvh, 220px); gap: .35rem; }
  .toast { min-height: 38px; max-height: 96px; padding: .48rem .7rem; overflow-y: auto; border-radius: 10px; font-size: .78rem; line-height: 1.22; }
  .offline-banner { bottom: 78px; width: calc(100% - 1.5rem); text-align: center; }
  .display-grid { grid-template-columns: 1fr; }
  .slide-controls { width: auto; max-width: calc(100% - 1rem); gap: .25rem; padding: .3rem; overflow: visible; border-radius: 12px; white-space: nowrap; }
  .slide-controls .button { min-height: 38px; padding: .42rem .55rem; border-radius: 9px; font-size: .7rem; }
  .slide-controls #slide-back, .slide-controls #slide-next { width: 38px; min-width: 38px; padding: 0; font-size: 1rem; }
  .slide-caption { right: 1rem; bottom: 4.8rem; left: 1rem; max-width: none; }
  .auth-page { padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left)); }
  .auth-card, .install-card { padding: 1.2rem; border-radius: 21px; }
  .auth-card > .brand-mark, .install-card > .brand-mark { width: 150px; height: 150px; }
}

/* Small iPhones, including 320-375px layouts */
@media (max-width: 380px) {
  .topbar { padding-right: max(.65rem, env(safe-area-inset-right)); padding-left: max(.65rem, env(safe-area-inset-left)); }
  .wordmark strong { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .page-shell { padding-right: max(.6rem, env(safe-area-inset-right)); padding-left: max(.6rem, env(safe-area-inset-left)); }
  .page-heading h1 { font-size: 1.24rem; }
  .page-notes .page-heading, .page-lists .page-heading { gap: .4rem; }
  .page-notes #page-actions .button, .page-lists #page-actions .button { padding-inline: .6rem; font-size: .78rem; }
  .card { padding: .75rem; }
  .note-card { padding: .9rem; }
  .list-picker { margin-right: -.6rem; margin-left: -.6rem; padding-right: max(.6rem, env(safe-area-inset-right)); padding-left: max(.6rem, env(safe-area-inset-left)); }
  .list-item { padding: .65rem; }
  .bottom-nav { padding-right: max(.15rem, env(safe-area-inset-right)); padding-left: max(.15rem, env(safe-area-inset-left)); }
  .bottom-nav a { font-size: .56rem; }
  .form-actions .button { flex: 1 1 0; }
}

@media (min-width: 1600px) {
  body.tv-mode .page-shell { padding-right: 1.5rem; padding-left: 1.5rem; }
  body.tv-mode .calendar-toolbar h2 { font-size: 1.25rem; }
  body.tv-mode .day-number { font-size: .84rem; }
  body.tv-mode .event-pill { padding: .34rem .42rem; font-size: .75rem; }
  body.tv-mode .side-stack { gap: 1rem; }
  body.tv-mode .temperature { font-size: 3.2rem; }
}
