/* PLANNER theme.
   Layout and type modeled on theluxloop.com: condensed all-caps display type, calm body text, neutral
   surfaces, structure from 1px borders (not shadows). Color comes from the app logo: a red circle with a
   bright-to-deep gradient (#ed1212 -> #8c1212). Red is used sparingly, for what matters: primary actions,
   labels, the current stop and today. Light is always the default; dark keeps the same reds on charcoal. */

:root {
    color-scheme: light;

    --bg: #faf9f7;
    --surface: #ffffff;
    --muted: #f1efeb;
    --secondary: #ebe8e3;
    --band: #f4f2ee;

    --fg: #1f1e1d;
    --body: #45423e;
    --muted-fg: #6f6b65;

    --border: #dedad3;
    --border-strong: #c9c4bb;

    /* Logo reds */
    --accent: #d91414;          /* fills (white text on it passes AA) */
    --accent-deep: #8c1212;     /* hover fills, gradient end */
    --accent-ink: #b01212;      /* red as text on light surfaces */
    --on-accent: #ffffff;
    --accent-gradient: linear-gradient(135deg, #ed1212 0%, #b81414 55%, #8c1212 100%);
    --ring: #b01212;            /* focus outline */
    --ok: #15803d;              /* "synced" status */

    --track: rgb(217 20 20 / 0.28);
    --stop: #c9c4bb;
    --hover: rgb(31 30 29 / 0.04);
    --accent-soft: rgb(217 20 20 / 0.45);
    --flash: rgb(237 18 18 / 0.14);
    --panel-shadow: 0 18px 44px -24px rgb(0 0 0 / 0.18);

    --font-display: "Bebas Neue", "Arial Narrow", sans-serif;
    --font-support: "Barlow Condensed", "Arial Narrow", sans-serif;
    --font-body: "Open Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

    --radius: 8px;
    --radius-sm: 6px;
    --gutter: 16px;
    --container: 64rem;
    --header-h: 64px;
    --tabbar-h: 68px;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark is opt-in from the header toggle; the OS preference is not followed. */
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #232121;
    --surface: #2c2a2a;
    --muted: #312f2f;
    --secondary: #363333;
    --band: rgb(44 42 42 / 0.5);
    --fg: #e2dfdf;
    --body: #c2bebd;
    --muted-fg: #a39e9d;
    --border: #4d4949;
    --border-strong: #666161;
    --accent: #e01818;
    --accent-ink: #ff6b6b;
    --ring: #ff6b6b;
    --ok: #4ade80;
    --track: rgb(237 18 18 / 0.35);
    --stop: #666161;
    --hover: rgb(226 223 223 / 0.05);
    --accent-soft: rgb(237 18 18 / 0.55);
    --flash: rgb(237 18 18 / 0.2);
    --panel-shadow: 0 18px 44px -24px rgb(0 0 0 / 0.7);
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--body);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { color: var(--fg); margin: 0; }

a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

/* ---------- Type ---------- */

.display {
    font-family: var(--font-display);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.008em;
    line-height: 1;
}

.support {
    font-family: var(--font-support);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    line-height: 1.25;
}

.eyebrow {
    display: inline-block;
    color: var(--accent-ink);
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    line-height: 1;
}

.meta { color: var(--muted-fg); font-size: 0.75rem; line-height: 1.45; }
.dense { font-size: 0.875rem; line-height: 1.5; }

/* ---------- App shell ---------- */

.app {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding-top: env(safe-area-inset-top);
}

.app-header__bar {
    max-width: var(--container);
    margin: 0 auto;
    min-height: var(--header-h);
    padding: 0 var(--gutter);
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--fg);
    margin-right: auto;
}
.brand:hover { text-decoration: none; }
.brand__name { font-size: 1.75rem; padding-top: 3px; }
.brand__name span { color: var(--accent-ink); }
.brand__logo { display: block; width: 32px; height: 32px; }

.app-main {
    flex: 1;
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 24px var(--gutter) calc(var(--tabbar-h) + 32px + env(safe-area-inset-bottom));
}

@media (min-width: 768px) {
    :root { --gutter: 24px; }
    .app-main { padding-bottom: 56px; }
}

/* ---------- Transit-line nav ----------
   Each item is a "stop": a 2px track above it and a ring dot on the track.
   Desktop: second header row. Mobile: fixed bottom tab bar for one-handed use. */

.transit {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
}

.transit__stop {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 14px 4px 10px;
    color: var(--muted-fg);
    font-family: var(--font-support);
    font-weight: 500;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1;
    transition: color 150ms var(--ease), background-color 150ms var(--ease);
}
.transit__stop:hover { color: var(--fg); background: var(--hover); text-decoration: none; }

/* the track */
.transit__stop::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--track);
}
.transit li:first-child .transit__stop::before { left: 50%; border-radius: 2px 0 0 2px; }
.transit li:last-child .transit__stop::before { right: 50%; border-radius: 0 2px 2px 0; }

/* the stop dot */
.transit__dot {
    position: absolute;
    top: -4px;
    width: 10px;
    height: 10px;
    border-radius: 999px;
    border: 2px solid var(--stop);
    background: var(--bg);
    transition: border-color 150ms var(--ease), background-color 150ms var(--ease), transform 150ms var(--ease);
}
.transit__stop:hover .transit__dot { border-color: var(--accent-soft); }

.transit__stop.active { color: var(--fg); }
.transit__stop.active .transit__dot {
    border-color: var(--accent);
    background: var(--accent-gradient);
    transform: scale(1.2);
}

.app-nav { display: none; }

.tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    background: var(--bg);
    border-top: 1px solid var(--border);
    padding: 6px 8px env(safe-area-inset-bottom);
}
.tabbar .transit__stop { min-height: calc(var(--tabbar-h) - 6px); justify-content: center; font-size: 0.9rem; }
.tabbar .transit__stop::before { top: 6px; }
.tabbar .transit__dot { top: 2px; }

@media (min-width: 768px) {
    .app-nav {
        display: block;
        border-top: 1px solid var(--border);
    }
    .app-nav .transit { max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); }
    .tabbar { display: none; }
}

/* ---------- Header controls ---------- */

.header-tools { display: flex; align-items: center; gap: 8px; }

.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted-fg);
    font-size: 0.75rem;
    white-space: nowrap;
}
.status__dot { width: 8px; height: 8px; border-radius: 999px; background: var(--border-strong); }
.status--ok .status__dot { background: var(--ok); }
.status--down .status__dot { background: var(--accent); }
.status--checking .status__dot { animation: pulse 1.4s ease-in-out infinite; }

@media (max-width: 479px) {
    .status__label { display: none; }
}

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 36px;
    padding: 0 16px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font: 500 0.875rem/1 var(--font-body);
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 150ms var(--ease), color 150ms var(--ease), border-color 150ms var(--ease);
}
.btn:hover { text-decoration: none; }
.btn--lg { height: 44px; padding: 0 28px; }

.btn--primary { background: var(--accent-gradient); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent-deep); }

.btn--outline { background: var(--surface); color: var(--fg); border-color: var(--border); }
.btn--outline:hover { background: var(--hover); color: var(--accent-ink); border-color: var(--accent-soft); }

.btn--ghost { background: transparent; color: var(--muted-fg); }
.btn--ghost:hover { background: var(--hover); color: var(--fg); }

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--fg);
    cursor: pointer;
    transition: background-color 150ms var(--ease), border-color 150ms var(--ease);
}
.icon-btn:hover { background: var(--hover); border-color: var(--border-strong); }

/* ---------- Page heading ---------- */

.page-heading { padding: 16px 0 28px; }
.page-heading__title { font-size: 3rem; margin-top: 10px; }
.page-heading__accent { display: block; color: var(--accent-ink); }
.page-heading__lead { max-width: 36rem; margin: 14px 0 0; font-size: 1.0625rem; }

@media (min-width: 640px) {
    .page-heading__title { font-size: 3.75rem; }
}

/* ---------- Panels (cards) ---------- */

.grid > * { min-width: 0; }
.grid {
    display: grid;
    gap: 16px;
    grid-template-columns: 1fr;
}
@media (min-width: 640px) { .grid { grid-template-columns: repeat(2, 1fr); gap: 20px; align-items: start; } }
@media (min-width: 1000px) { .grid--3 { grid-template-columns: repeat(3, 1fr); } }
.grid.grid--single { grid-template-columns: 1fr; }

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 18px 20px;
    transition: border-color 150ms var(--ease);
}
.panel:hover { border-color: var(--track); }
.panel--wide { grid-column: 1 / -1; }

.panel__head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.panel__title { font-size: 1.5rem; margin-top: 6px; }

.empty {
    margin: 0;
    padding: 14px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    color: var(--muted-fg);
    font-size: 0.875rem;
    line-height: 1.5;
}

.tag {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--muted-fg);
    font: 600 0.6875rem/1 var(--font-body);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

/* Full-width band, e.g. the sign-in prompt. */
.band {
    margin: 0 calc(var(--gutter) * -1) 28px;
    padding: 20px var(--gutter);
    background: var(--band);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}
.band__title { font-size: 1.375rem; }
.band p { margin: 4px 0 0; font-size: 0.9375rem; }

@media (min-width: 768px) {
    .band { margin-left: 0; margin-right: 0; border: 1px solid var(--border); border-radius: var(--radius); }
}

/* Lists stacked in one column, with a rule between them. */
.stack > * + * { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }

/* Two side-by-side lists inside a panel (NL / Home, Professional / Personal...). Stacks on narrow phones. */
.split { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 420px) { .split { grid-template-columns: 1fr 1fr; } }
.split__head { margin: 0 0 8px; color: var(--muted-fg); font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }

/* Event key swatches */
.key { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.key li { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8125rem; }
.swatch { width: 12px; height: 12px; border-radius: 3px; border: 1px solid rgb(0 0 0 / 0.12); flex: none; }

/* Day rows (My Week) */
.days { list-style: none; margin: 0; padding: 0; }
.days li {
    display: grid;
    grid-template-columns: 52px 1fr;
    gap: 12px;
    align-items: baseline;
    padding: 9px 0;
    border-top: 1px solid var(--border);
    font-size: 0.875rem;
}
.days li:first-child { border-top: 0; }
.days__name { color: var(--muted-fg); font-weight: 600; font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.04em; }
.days__note { color: var(--muted-fg); }
.days li.today .days__name { color: var(--accent-ink); }
.days li.today .days__note { color: var(--fg); }

/* ---------- Loading (pre-Blazor) ---------- */

.boot {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 18px;
    color: var(--muted-fg);
}
.boot__bar { width: 160px; height: 2px; border-radius: 2px; background: var(--track); overflow: hidden; }
.boot__bar::after {
    content: "";
    display: block;
    height: 100%;
    width: var(--blazor-load-percentage, 8%);
    background: var(--accent-gradient);
    transition: width 120ms linear;
}

@keyframes pulse { 50% { opacity: 0.35; } }

@keyframes flash { from { background-color: var(--flash); } to { background-color: transparent; } }
.flash { animation: flash 1.2s var(--ease); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ======================================================================
   Interactive controls
   ====================================================================== */

.loading { color: var(--muted-fg); font-size: 0.875rem; padding: 24px 0; }

.field {
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--fg);
    font: 400 0.9375rem/1.4 var(--font-body);
    transition: border-color 150ms var(--ease);
}
.field::placeholder { color: var(--muted-fg); opacity: 0.8; }
.field:hover { border-color: var(--border-strong); }
.field:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px rgb(217 20 20 / 0.12); }
.field--area { resize: vertical; field-sizing: content; min-height: 64px; max-height: 360px; }
select.field { appearance: auto; }

.label { display: block; margin: 0 0 6px; color: var(--muted-fg); font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.form { display: grid; gap: 14px; }
.form__row { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.form__row--3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 479px) { .form__row--3 { grid-template-columns: 1fr 1fr; } }
.inline-check { display: inline-flex; align-items: center; gap: 8px; font-size: 0.9375rem; color: var(--fg); cursor: pointer; }
.inline-check input { width: 18px; height: 18px; accent-color: var(--accent); }

.btn--sm { height: 32px; padding: 0 12px; font-size: 0.8125rem; }
.btn--danger { background: transparent; color: var(--accent-ink); border-color: var(--accent-soft); }
.btn--danger:hover { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn:disabled { opacity: 0.5; cursor: default; }
.icon-btn--sm { width: 28px; height: 28px; border-color: transparent; background: transparent; color: var(--muted-fg); flex: none; }
.icon-btn--sm:hover { color: var(--accent-ink); background: var(--hover); border-color: transparent; }
.link-btn { padding: 0; border: 0; background: none; color: var(--accent-ink); font: 600 0.8125rem var(--font-body); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

/* Checklist */
.checklist { list-style: none; margin: 0; padding: 0; }
.check { display: flex; align-items: center; gap: 8px; min-height: 40px; border-bottom: 1px solid var(--border); }
.check:last-child { border-bottom: 0; }
.check__box { width: 18px; height: 18px; flex: none; accent-color: var(--accent); cursor: pointer; }
.check__title {
    flex: 1; min-width: 0; padding: 6px 4px; border: 1px solid transparent; border-radius: 4px;
    background: transparent; color: var(--fg); font: 400 0.9375rem/1.3 var(--font-body);
}
.check__title:hover { border-color: var(--border); }
.check__title:focus { outline: none; border-color: var(--ring); background: var(--surface); }
.check--done .check__title { color: var(--muted-fg); text-decoration: line-through; }
.check__delete { opacity: 0; }
.check:hover .check__delete, .check:focus-within .check__delete { opacity: 1; }
@media (hover: none) { .check__delete { opacity: 1; } }
.check__move { width: auto; max-width: 9.5rem; min-height: 28px; padding: 2px 4px; font-size: 0.75rem; border-color: transparent; color: var(--muted-fg); background: transparent; }

.add { display: flex; gap: 8px; margin-top: 8px; }
.add .field { flex: 1; width: auto; min-width: 0; min-height: 36px; padding: 6px 10px; font-size: 0.875rem; }

.more { margin-top: 10px; }
.section-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }

/* Week navigation */
.week-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -12px 0 24px; }

/* My Week day rows: day label on the left, items + notes beside it. */
.day { display: grid; grid-template-columns: 100px 1fr; gap: 10px; align-items: start; padding: 6px 0; border-top: 1px solid var(--border); }
.day:first-child { border-top: 0; padding-top: 2px; }
.day__head { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 6px; padding-top: 6px; line-height: 1.25; }
.day__name { color: var(--muted-fg); font-weight: 700; font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.04em; }
.day__date { color: var(--muted-fg); font-size: 0.8125rem; white-space: nowrap; }
.day__theme { flex-basis: 100%; color: var(--muted-fg); font-size: 0.6875rem; font-style: italic; }
.day__body { min-width: 0; }
.day--today .day__name { color: var(--accent-ink); }
.day--today .day__date { color: var(--fg); font-weight: 600; }
.day .field--area { min-height: 32px; padding: 5px 8px; font-size: 0.875rem; }
.day .items { margin: 6px 0; }

.items { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 4px; }
.item { display: flex; align-items: flex-start; gap: 8px; font-size: 0.8125rem; line-height: 1.35; color: var(--body); }
.item__mark { width: 8px; height: 8px; margin-top: 4px; border-radius: 2px; flex: none; background: var(--border-strong); }
.item--meeting .item__mark { border-radius: 999px; background: transparent; border: 2px solid var(--muted-fg); }
.item--calendar .item__mark { border-radius: 999px; }
.calendar-problem { margin: 0 0 8px; }
.item--blackout .item__mark, .item--conflict .item__mark { background: var(--accent); }
.item--due { font-weight: 600; }
.item__when { color: var(--muted-fg); min-width: 52px; flex: none; font-variant-numeric: tabular-nums; }
.item__text { flex: 1; min-width: 0; }
.item button.item__text { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.item button.item__text:hover { color: var(--accent-ink); }

/* Year: months */
.months { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .months { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .months { grid-template-columns: repeat(3, 1fr); } }
.month { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 12px 8px; background: var(--surface); }
.month--current { border-color: var(--accent-soft); }
.month__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.month__name { font-size: 1.25rem; }
.month .item { padding: 3px 0; }
.month .empty { padding: 8px; font-size: 0.8125rem; }

/* Category choice (swatch radios) */
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.choice > span {
    display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px;
    border: 1px solid var(--border); border-radius: 999px; font-size: 0.8125rem; color: var(--fg);
}
.choice input:checked + span { border-color: var(--fg); box-shadow: inset 0 0 0 1px var(--fg); }
.choice input:focus-visible + span { outline: 2px solid var(--ring); outline-offset: 2px; }

/* Settings: category key editor */
.color-field {
    flex: none; width: 36px; height: 36px; padding: 2px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface); cursor: pointer;
}
.color-field::-webkit-color-swatch-wrapper { padding: 0; }
.color-field::-webkit-color-swatch { border: 0; border-radius: 4px; }
.color-field::-moz-color-swatch { border: 0; border-radius: 4px; }
.cat-chip { flex: none; padding: 3px 8px; border-radius: 4px; font: 600 0.75rem/1.25 var(--font-body); }
.row .inline-check { font-size: 0.8125rem; }
.calendar-row .calendar-row__url { flex: 3 1 240px; }
.calendar-row__error { flex-basis: 100%; font-size: 0.8125rem; }

/* Rows of small editable records (blackouts, rotation, meetings...) */
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.row:last-child { border-bottom: 0; }
.row .field { width: auto; flex: 1 1 120px; min-height: 36px; padding: 6px 8px; font-size: 0.875rem; }
.row .field--date { flex: 0 0 150px; }
.row .field--time { flex: 0 0 120px; }
.row .field--narrow { flex: 0 1 140px; }
.weeks { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 0.75rem; color: var(--muted-fg); }
.weeks label { display: inline-flex; align-items: center; gap: 3px; cursor: pointer; }
.weeks input { accent-color: var(--accent); }

/* Conflicts */
.leave { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 12px; }
.leave__head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 4px; }
.leave__head .field { width: auto; flex: 1 1 140px; min-height: 36px; padding: 6px 8px; }
.leave__head .field--date { flex: 0 0 150px; }
.leave__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.candidates { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; font-size: 0.8125rem; color: var(--muted-fg); }

/* Ideal Week grid */
.day-tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; }
.day-tab {
    flex: none; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border);
    background: var(--surface); color: var(--muted-fg); font: 600 0.8125rem var(--font-body); cursor: pointer;
}
.day-tab[aria-pressed="true"] { background: var(--fg); border-color: var(--fg); color: var(--bg); }

.ideal { display: grid; grid-template-columns: 64px repeat(var(--days), minmax(0, 1fr)); grid-template-rows: auto; grid-auto-rows: 14px; border-top: 1px solid var(--border); }
.ideal__time { grid-column: 1; font-size: 0.6875rem; color: var(--muted-fg); padding: 4px 8px 0 0; text-align: right; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.ideal__head { padding: 4px; border-bottom: 1px solid var(--border); text-align: center; overflow: hidden; }
.ideal__head strong { display: block; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--fg); line-height: 1.2; }
.ideal__head span { display: block; font-size: 0.6875rem; color: var(--muted-fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }
.ideal__slot { border: 0; border-bottom: 1px solid var(--border); border-left: 1px solid var(--border); background: transparent; padding: 0; cursor: pointer; }
.ideal__slot:hover { background: var(--hover); }
.ideal__block {
    z-index: 1; margin: 1px 2px; padding: 3px 6px; border-radius: 4px; overflow: hidden;
    border: 1px solid transparent; font: 600 0.75rem/1.25 var(--font-body); text-align: left; cursor: pointer;
    display: flex; flex-direction: column; justify-content: flex-start;
}
.ideal__block small { display: block; font-weight: 400; opacity: 0.8; }
/* Category colors come from Settings as --cat (one #rrggbb); the tint and ink are mixed from it so any
   color reads in both themes. */
.ideal__block, .cat-chip {
    --cat: var(--muted-fg);
    background: color-mix(in srgb, var(--cat) 18%, var(--surface));
    color: color-mix(in srgb, var(--cat) 60%, var(--fg));
}
.ideal__block:hover { border-color: currentColor; }
.ideal--desktop { display: none; }
@media (min-width: 900px) {
    .ideal--desktop { display: grid; }
    .ideal--mobile, .day-tabs { display: none; }
}

.themes { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .themes { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .themes { grid-template-columns: repeat(4, 1fr); } }

/* Horizon */
.horizon { display: grid; gap: 14px; }
.horizon__year { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }

/* Modal */
.modal {
    position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center;
    background: rgb(0 0 0 / 0.35); animation: fade 150ms var(--ease);
}
.modal__panel {
    width: 100%; max-height: 92dvh; overflow: auto; background: var(--surface); color: var(--body);
    border-radius: 14px 14px 0 0; box-shadow: var(--panel-shadow); outline: none;
    padding-bottom: env(safe-area-inset-bottom);
}
.modal__head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal__title { font-size: 1.375rem; }
.modal__body { padding: 18px; }
.modal__foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px 16px; border-top: 1px solid var(--border); }
.modal__foot .btn--danger { margin-right: auto; }
@media (min-width: 640px) {
    .modal { align-items: center; padding: 24px; }
    .modal__panel { max-width: 520px; border-radius: 12px; }
}
@keyframes fade { from { opacity: 0; } }

/* Toasts */
.toasts {
    position: fixed; left: 50%; transform: translateX(-50%); z-index: 60;
    bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom));
    display: grid; gap: 8px; width: min(440px, calc(100vw - 32px));
}
@media (min-width: 768px) { .toasts { bottom: 24px; } }
.toast {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 14px; border-radius: var(--radius-sm);
    background: var(--fg); color: var(--bg); font-size: 0.875rem; box-shadow: var(--panel-shadow); animation: fade 150ms var(--ease);
}
.toast--error { background: var(--accent-deep); color: #fff; }
.toast span { flex: 1; }
.toast__close { border: 0; background: none; color: inherit; opacity: 0.7; cursor: pointer; font-size: 0.875rem; }

/* Install banner (phones only): sits above the tab bar, below toasts. */
.install {
    position: fixed; left: 50%; transform: translateX(-50%); z-index: 55;
    bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom));
    display: flex; align-items: center; gap: 12px; width: min(440px, calc(100vw - 32px));
    padding: 10px 8px 10px 12px; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface); box-shadow: var(--panel-shadow); animation: fade 150ms var(--ease);
}
.install .brand__logo { flex: none; }
.install__text { flex: 1; min-width: 0; display: grid; gap: 2px; font-size: 0.8125rem; color: var(--body); }
.install__text strong { font-size: 1.0625rem; color: var(--fg); }
.install__text svg { vertical-align: -2px; color: var(--accent-ink); }
@media (min-width: 768px) { .install { bottom: 24px; } }

.form__error { margin: 0; color: var(--accent-ink); font-size: 0.875rem; font-weight: 600; }

@media (max-width: 479px) {
    .row .field--date, .row .field--narrow, .row .field--time, .leave__head .field--date { flex: 1 1 40%; min-width: 0; }
}
