/* LifeHub shell. Colours come from the active Radzen theme's variables, so light, dark and system modes all
   follow the theme without separate rules. Layout follows docs/web-ux.md: a large horizontal primary bar,
   a left secondary rail, and a roomy main column. Phase 1b refines the visual design. */

html[data-theme="light"] { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }
html[data-theme="system"] { color-scheme: light dark; }

:root {
    /* The operating system's own UI font (Segoe UI, SF Pro, Roboto): modern, already installed, no external
       font requests. Overrides Radzen's Roboto, which it names but does not ship, so Radzen components match. */
    --rz-text-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --lh-surface: var(--rz-base-background-color, Canvas);
    --lh-raised: var(--rz-panel-background-color, var(--rz-base-background-color, Canvas));
    --lh-text: var(--rz-text-color, CanvasText);
    --lh-muted: var(--rz-text-secondary-color, GrayText);
    --lh-border: var(--rz-base-300, color-mix(in srgb, CanvasText 15%, transparent));
    --lh-accent: var(--rz-primary, #3f51b5);
    --lh-accent-soft: color-mix(in srgb, var(--lh-accent) 14%, transparent);
    --lh-radius: 0.75rem;
    --lh-touch: 2.75rem;
    --lh-rail-width: 15rem;
    --lh-danger-text: color-mix(in srgb, var(--rz-danger, #d32f2f) 60%, var(--lh-text));
    --lh-success-text: color-mix(in srgb, var(--rz-success, #2e7d32) 60%, var(--lh-text));
    /* Orange is the one tone too light to read at 55% on a light page (3.4:1 on its tint, measured 2026-11-09), so
       light pages mix in less of it (4.8:1). light-dark() follows the page's colour scheme, System mode included. */
    --lh-warning-text: light-dark(
        color-mix(in srgb, var(--rz-warning, #ed6c02) 35%, var(--lh-text)),
        color-mix(in srgb, var(--rz-warning, #ed6c02) 55%, var(--lh-text)));

    /* Spacing and type scales. Components use these instead of raw sizes. */
    --lh-space-1: 0.25rem;
    --lh-space-2: 0.5rem;
    --lh-space-3: 0.75rem;
    --lh-space-4: 1rem;
    --lh-space-5: 1.5rem;
    --lh-space-6: 2rem;
    --lh-space-7: 3rem;
    --lh-text-xs: 0.75rem;
    --lh-text-sm: 0.875rem;
    --lh-text-md: 1rem;
    --lh-text-lg: 1.125rem;
    --lh-text-xl: 1.375rem;
    --lh-text-2xl: 1.75rem;
    --lh-text-3xl: 2.25rem;
}

/* Tones: text and background pairs that stay readable in light and dark. Colour is never the only signal. */
/* The text colour mixes the tone with the page's own text colour, so it is darker on light pages and lighter
   on dark ones. Radzen's "-lighter" variants are translucent tints, unreadable as text in dark mode. */
.lh-tone-neutral { --lh-tone-fg: var(--lh-muted); --lh-tone-bg: color-mix(in srgb, var(--lh-text) 6%, transparent); --lh-tone-line: var(--lh-border); }
.lh-tone-info { --lh-tone-fg: color-mix(in srgb, var(--rz-info, #0288d1) 55%, var(--lh-text)); --lh-tone-bg: color-mix(in srgb, var(--rz-info, #0288d1) 14%, transparent); --lh-tone-line: color-mix(in srgb, var(--rz-info, #0288d1) 45%, transparent); }
.lh-tone-success { --lh-tone-fg: color-mix(in srgb, var(--rz-success, #2e7d32) 55%, var(--lh-text)); --lh-tone-bg: color-mix(in srgb, var(--rz-success, #2e7d32) 14%, transparent); --lh-tone-line: color-mix(in srgb, var(--rz-success, #2e7d32) 45%, transparent); }
.lh-tone-warning { --lh-tone-fg: var(--lh-warning-text); --lh-tone-bg: color-mix(in srgb, var(--rz-warning, #ed6c02) 16%, transparent); --lh-tone-line: color-mix(in srgb, var(--rz-warning, #ed6c02) 50%, transparent); }
.lh-tone-danger { --lh-tone-fg: color-mix(in srgb, var(--rz-danger, #d32f2f) 55%, var(--lh-text)); --lh-tone-bg: color-mix(in srgb, var(--rz-danger, #d32f2f) 14%, transparent); --lh-tone-line: color-mix(in srgb, var(--rz-danger, #d32f2f) 50%, transparent); }

body {
    margin: 0;
    background: var(--lh-surface);
    color: var(--lh-text);
    font-family: var(--rz-text-font-family);
    font-size: 1rem;
    line-height: 1.5;
}

button, input, select, textarea { font-family: inherit; }

h1:focus, .lh-main:focus { outline: none; }

a { color: var(--lh-accent); }

.lh-skip {
    position: absolute;
    left: -999px;
    top: 0.5rem;
    z-index: 10;
    padding: 0.5rem 1rem;
    background: var(--lh-raised);
    border-radius: var(--lh-radius);
}

.lh-skip:focus { left: 0.5rem; }

/* ---------- Shell ---------- */

.lh-shell {
    display: grid;
    /* minmax(0, 1fr): the column never grows past the window, whatever its content's minimum width. */
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    min-height: 100vh;
}

.lh-topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 1.25rem;
    background: var(--lh-raised);
    border-bottom: 1px solid var(--lh-border);
}

.lh-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--lh-text);
    text-decoration: none;
    white-space: nowrap;
}

/* The app icon (also on Pushover notifications and as the browser tab icon). */
/* Its navy parts nearly vanish on dark surfaces (about 1.5:1), so dark pages sit it on a light tile, like an app icon. */
.lh-logo {
    width: 1.75rem;
    height: 1.75rem;
    flex: none;
    display: block;
    box-sizing: border-box;
    border-radius: 0.375rem;
    background-color: light-dark(transparent, #eef1f5);
}

.lh-primary {
    display: flex;
    gap: 0.25rem;
    flex: 1;
    /* Lets the bar shrink and scroll sideways instead of widening the whole page. */
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.lh-brand, .lh-topbar-end { flex: none; }

.lh-primary-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: var(--lh-touch);
    padding: 0.5rem 1rem;
    border-radius: var(--lh-radius);
    color: var(--lh-text);
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    white-space: nowrap;
}

.lh-primary-link:hover { background: color-mix(in srgb, var(--lh-text) 6%, transparent); }

.lh-primary-link.active {
    background: var(--lh-accent-soft);
    color: var(--lh-accent);
}

.lh-primary-link:focus-visible,
.lh-secondary-link:focus-visible,
.lh-theme-option:focus-visible {
    outline: 2px solid var(--lh-accent);
    outline-offset: 2px;
}

.lh-topbar-end {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.lh-body {
    display: grid;
    grid-template-columns: var(--lh-rail-width) minmax(0, 1fr);
}

.lh-body-no-rail { grid-template-columns: minmax(0, 1fr); }

.lh-secondary {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    padding: 1.25rem 0.75rem;
    border-right: 1px solid var(--lh-border);
}

.lh-secondary-title {
    margin: 0 0 0.5rem 0.75rem;
    color: var(--lh-muted);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.lh-secondary-group {
    margin: 1rem 0 0.25rem 0.75rem;
    color: var(--lh-muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.lh-secondary-title + .lh-secondary-group { margin-top: 0; }

.lh-icon-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    color: var(--lh-muted);
    text-decoration: none;
}

.lh-icon-link:hover { background: color-mix(in srgb, var(--lh-text) 6%, transparent); }
.lh-icon-link.active { background: var(--lh-accent-soft); color: var(--lh-accent); }
.lh-icon-link:focus-visible { outline: 2px solid var(--lh-accent); outline-offset: 2px; }

.lh-secondary-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: var(--lh-touch);
    padding: 0.5rem 0.75rem;
    border-radius: var(--lh-radius);
    color: var(--lh-text);
    text-decoration: none;
}

.lh-secondary-link .rzi { color: var(--lh-muted); }
.lh-secondary-link:hover { background: color-mix(in srgb, var(--lh-text) 6%, transparent); }
.lh-secondary-link.active { background: var(--lh-accent-soft); color: var(--lh-accent); font-weight: 600; }
.lh-secondary-link.active .rzi { color: var(--lh-accent); }

.lh-main {
    padding: 2rem 2.5rem 3rem;
    max-width: 72rem;
    width: 100%;
    box-sizing: border-box;
}

/* ---------- Account menu and theme switcher ---------- */

.lh-account-menu { position: relative; }

.lh-account-menu summary {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: var(--lh-touch);
    padding: 0 0.75rem;
    border-radius: var(--lh-radius);
    cursor: pointer;
    list-style: none;
}

.lh-account-menu summary::-webkit-details-marker { display: none; }
.lh-account-menu summary:hover { background: color-mix(in srgb, var(--lh-text) 6%, transparent); }

.lh-account-menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 0.25rem);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 15rem;
    padding: 0.5rem;
    background: var(--lh-raised);
    border: 1px solid var(--lh-border);
    border-radius: var(--lh-radius);
    box-shadow: var(--rz-shadow-3, 0 4px 16px rgb(0 0 0 / 0.15));
}

.lh-account-menu-panel a,
.lh-account-menu-panel .lh-link-button {
    display: block;
    width: 100%;
    padding: 0.6rem 0.75rem;
    border-radius: 0.5rem;
    text-align: left;
    color: var(--lh-text);
    text-decoration: none;
}

.lh-account-menu-panel a:hover,
.lh-account-menu-panel .lh-link-button:hover { background: color-mix(in srgb, var(--lh-text) 6%, transparent); }

.lh-link-button {
    border: 0;
    background: none;
    font: inherit;
    color: var(--lh-accent);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
}

/* A round "mark done" button in task lists (To-Do, Phase 6). */
.lh-icon-button {
    display: inline-grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--lh-muted);
    cursor: pointer;
}

.lh-icon-button:hover,
.lh-icon-button:focus-visible { color: var(--lh-accent); background: color-mix(in srgb, var(--lh-accent) 10%, transparent); }

/* An add form on one row: fields side by side, the button at their foot (Shopping, Phase 6). */
.lh-inline-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--lh-space-3);
    margin-bottom: var(--lh-space-4);
}

.lh-inline-form .lh-account-field { flex: 1 1 12rem; margin: 0; }

/* A shopping list: one item per row, checked items struck through and dimmed. */
.lh-checklist { list-style: none; margin: 0; padding: 0; }
.lh-checklist li { display: flex; align-items: center; gap: var(--lh-space-2); padding: 0.25rem 0; border-bottom: 1px solid var(--lh-border); }
.lh-checklist li:last-child { border-bottom: 0; }
.lh-checklist-text { flex: 1; }
.lh-checklist li.lh-checked .lh-checklist-text { text-decoration: line-through; color: var(--lh-muted); }

/* Settings → Notifications and the bell's tiers (Phase 8). */
.lh-button-row { display: flex; flex-wrap: wrap; gap: var(--lh-space-2); }
.lh-fieldset { border: 0; padding: 0; margin: 0 0 var(--lh-space-4); }
.lh-fieldset legend { font-weight: 600; margin-bottom: var(--lh-space-1); }
.lh-bell-group { margin: var(--lh-space-3) 0 var(--lh-space-1); font-size: 0.8rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--lh-muted); }
.lh-bell-hold { margin: 0 0 var(--lh-space-2); font-size: 0.875rem; }

/* Assistant → Chat (Phase 8): conversations beside the thread. */
.lh-assistant { display: grid; grid-template-columns: minmax(10rem, 16rem) 1fr; gap: var(--lh-space-5); }
.lh-assistant-history ul { list-style: none; margin: var(--lh-space-3) 0 0; padding: 0; }
.lh-assistant-history li.active .lh-link-button { font-weight: 600; }
.lh-chat-message { padding: var(--lh-space-3) var(--lh-space-4); border: 1px solid var(--lh-border); border-radius: 0.75rem; margin-bottom: var(--lh-space-3); }
.lh-chat-user { background: color-mix(in srgb, var(--lh-accent) 6%, transparent); }
@media (max-width: 48rem) { .lh-assistant { grid-template-columns: 1fr; } }
.lh-suggestion { margin-top: var(--lh-space-3); padding: var(--lh-space-3); border: 1px dashed var(--lh-border); border-radius: 0.5rem; }
.lh-suggestion h4 { margin: 0 0 var(--lh-space-2); font-size: 0.95rem; }

.lh-theme { margin: 0; }
.lh-theme-options { display: inline-flex; gap: 0.125rem; }

.lh-theme-option {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--lh-muted);
    cursor: pointer;
}

.lh-theme-option:hover { background: color-mix(in srgb, var(--lh-text) 6%, transparent); }
.lh-theme-option[aria-pressed="true"] { background: var(--lh-accent-soft); color: var(--lh-accent); }

/* ---------- Page content ---------- */

.lh-page-header { margin-bottom: 1.5rem; }
.lh-page-header h1 { margin: 0; font-size: 2rem; font-weight: 700; }
.lh-page-lede { margin: 0.25rem 0 0; color: var(--lh-muted); font-size: 1.05rem; }

.lh-breadcrumb {
    margin: 0 0 0.25rem;
    color: var(--lh-muted);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.lh-card,
.lh-empty,
.lh-not-built {
    padding: 1.25rem 1.5rem;
    background: var(--lh-raised);
    border: 1px solid var(--lh-border);
    border-radius: var(--lh-radius);
}

.lh-card h2 { margin: 0 0 0.5rem; font-size: 1.15rem; }

.lh-empty,
.lh-not-built {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    max-width: 40rem;
}

.lh-empty > .rzi { color: var(--lh-success-text); font-size: 2rem; }
.lh-not-built-icon { color: var(--lh-muted); font-size: 2rem; }

.lh-empty p,
.lh-not-built p { margin: 0.15rem 0; }

.lh-empty-title,
.lh-not-built-title { font-weight: 700; font-size: 1.05rem; }

.lh-muted { color: var(--lh-muted); }

.lh-manage {
    display: grid;
    gap: 1.25rem;
    max-width: 42rem;
}

.lh-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.lh-list li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.4rem 0; border-bottom: 1px solid var(--lh-border); }

/* ---------- Component kit (Components/Kit) ---------- */

.lh-page-header { display: flex; align-items: flex-end; gap: var(--lh-space-4); flex-wrap: wrap; }
.lh-page-header-text { flex: 1; min-width: 16rem; }
.lh-page-actions { display: flex; gap: var(--lh-space-2); }

.lh-card { display: flex; flex-direction: column; gap: var(--lh-space-3); }
.lh-card-header { display: flex; align-items: center; gap: var(--lh-space-2); }
.lh-card-icon { color: var(--lh-muted); }
.lh-card-title { margin: 0; font-size: var(--lh-text-lg); font-weight: 650; }
.lh-card-actions { margin-left: auto; display: flex; gap: var(--lh-space-2); }
.lh-card-footer { padding-top: var(--lh-space-3); border-top: 1px solid var(--lh-border); color: var(--lh-muted); font-size: var(--lh-text-sm); }

.lh-grid-2, .lh-grid-3, .lh-stat-grid { display: grid; gap: var(--lh-space-4); }
/* min(100%, …) lets a column shrink below its minimum on a phone instead of widening the page. */
.lh-grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); }
.lh-grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); }
.lh-grid-2 > *, .lh-grid-3 > *, .lh-stack > *, .lh-stat-grid > * { min-width: 0; }
.lh-stat-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); margin-bottom: var(--lh-space-5); }
.lh-account-menu-theme { display: flex; align-items: center; justify-content: space-between; padding: 0.25rem 0.25rem 0.5rem 0.75rem; border-bottom: 1px solid var(--lh-border); margin-bottom: 0.25rem; color: var(--lh-muted); font-size: var(--lh-text-sm); }
.lh-stack { display: grid; gap: var(--lh-space-5); }

.lh-stat {
    padding: var(--lh-space-4) var(--lh-space-5);
    background: var(--lh-raised);
    border: 1px solid var(--lh-border);
    border-left: 4px solid var(--lh-tone-line, var(--lh-border));
    border-radius: var(--lh-radius);
}

.lh-stat-label { display: flex; align-items: center; gap: var(--lh-space-2); margin: 0; color: var(--lh-muted); font-size: var(--lh-text-sm); font-weight: 600; }
.lh-stat-label .rzi { font-size: 1.15rem; }
.lh-stat-value { margin: var(--lh-space-1) 0 0; font-size: var(--lh-text-2xl); font-weight: 700; font-variant-numeric: tabular-nums; }
.lh-stat-hint { margin: var(--lh-space-1) 0 0; color: var(--lh-muted); font-size: var(--lh-text-sm); }
.lh-stat.lh-tone-warning .lh-stat-value, .lh-stat.lh-tone-danger .lh-stat-value { color: var(--lh-tone-fg); }

.lh-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.6rem;
    border-radius: 999px;
    background: var(--lh-tone-bg);
    color: var(--lh-tone-fg);
    font-size: var(--lh-text-xs);
    font-weight: 650;
    white-space: nowrap;
}

.lh-banner {
    display: flex;
    gap: var(--lh-space-2);
    align-items: flex-start;
    margin: 0 0 var(--lh-space-3);
    padding: var(--lh-space-3) var(--lh-space-4);
    border: 1px solid var(--lh-tone-line);
    border-radius: var(--lh-radius);
    background: var(--lh-tone-bg);
    color: var(--lh-tone-fg);
}

.lh-empty-state { display: flex; gap: var(--lh-space-3); align-items: flex-start; padding: var(--lh-space-4); color: var(--lh-muted); }
.lh-empty-state > .rzi { font-size: 1.75rem; }
.lh-empty-state p { margin: 0.1rem 0; }
.lh-empty-state .lh-empty-title { color: var(--lh-text); font-weight: 650; }
.lh-data-asof { margin: var(--lh-space-2) 0 0; color: var(--lh-muted); font-size: var(--lh-text-xs); }
.lh-link { color: var(--lh-accent); font-weight: 600; }

.lh-home-list { margin: 0; padding-left: 1.1rem; }
.lh-home-grid { display: grid; gap: var(--lh-space-4); grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); max-width: 64rem; }

.lh-home-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--lh-space-3);
    padding: var(--lh-space-4) var(--lh-space-5);
    background: var(--lh-raised);
    border: 1px solid var(--lh-border);
    border-top: 4px solid var(--lh-tone-line, var(--lh-border));
    border-radius: var(--lh-radius);
}

.lh-home-card:hover { border-color: var(--lh-tone-line, var(--lh-border)); }
.lh-home-card:focus-within { outline: 2px solid var(--lh-accent); outline-offset: 2px; }
.lh-home-card-header { display: flex; align-items: center; gap: var(--lh-space-2); }
.lh-home-card-icon { color: var(--lh-tone-fg, var(--lh-muted)); }
.lh-home-card-title { margin: 0; font-size: var(--lh-text-lg); font-weight: 650; }
.lh-home-card-title a { color: inherit; text-decoration: none; }
.lh-home-card-title a:focus { outline: none; }
.lh-home-card-pin { margin-left: auto; color: var(--lh-muted); font-size: 1.1rem; }
.lh-home-card-body p { margin: 0.15rem 0; }
.lh-home-card-why { display: flex; align-items: center; gap: var(--lh-space-1); margin: auto 0 0; color: var(--lh-muted); font-size: var(--lh-text-xs); }
.lh-home-card-why .rzi { font-size: 0.95rem; }
.lh-stretched-link::after { content: ""; position: absolute; inset: 0; }

/* Status cards: section overviews. Calm by default; only Warning and Danger colour the top edge. */
/* At most two columns, so cards stay wide enough for their facts to read on one line. */
.lh-status-grid { display: grid; gap: var(--lh-space-4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); max-width: 60rem; }

.lh-status-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--lh-space-3);
    padding: var(--lh-space-4) var(--lh-space-5);
    background: var(--lh-raised);
    border: 1px solid var(--lh-border);
    border-top: 4px solid var(--lh-border);
    border-radius: var(--lh-radius);
}

.lh-status-card.lh-tone-warning, .lh-status-card.lh-tone-danger { border-top-color: var(--lh-tone-line); }
.lh-status-card:hover { border-color: color-mix(in srgb, var(--lh-accent) 45%, var(--lh-border)); }
.lh-status-card.lh-tone-warning:hover, .lh-status-card.lh-tone-danger:hover { border-top-color: var(--lh-tone-line); }
.lh-status-card:focus-within { outline: 2px solid var(--lh-accent); outline-offset: 2px; }
.lh-status-card-header { display: flex; align-items: center; gap: var(--lh-space-2); }
.lh-status-card-icon { color: var(--lh-muted); }
.lh-status-card-title { margin: 0; flex: 1; font-size: var(--lh-text-lg); font-weight: 650; }
.lh-status-card-title a { color: inherit; text-decoration: none; }
.lh-status-card-title a:focus { outline: none; }
.lh-status-card-footer { display: flex; align-items: center; gap: var(--lh-space-2); margin: auto 0 0; padding-top: var(--lh-space-3); border-top: 1px solid var(--lh-border); color: var(--lh-muted); font-size: var(--lh-text-xs); }
.lh-status-card-more { display: inline-flex; align-items: center; margin-left: auto; color: var(--lh-accent); font-weight: 600; }
.lh-status-card-more .rzi { font-size: 1.1rem; }

/* Facts: label and value pairs in two columns. */
.lh-facts { display: grid; grid-template-columns: minmax(6rem, max-content) 1fr; gap: var(--lh-space-1) var(--lh-space-4); align-content: start; align-items: baseline; margin: 0; font-size: var(--lh-text-sm); }
.lh-fact { display: contents; }
.lh-fact dt { color: var(--lh-muted); }
.lh-fact dd { margin: 0; font-variant-numeric: tabular-nums; }

/* Meters: one ratio against a limit, always with its figure written beside it. */
.lh-meter { --lh-meter-fill: var(--lh-accent); display: grid; gap: var(--lh-space-1); }
.lh-meter.lh-tone-success { --lh-meter-fill: var(--rz-success, #2e7d32); }
.lh-meter.lh-tone-info { --lh-meter-fill: var(--rz-info, #0288d1); }
.lh-meter.lh-tone-warning { --lh-meter-fill: var(--rz-warning, #ed6c02); }
.lh-meter.lh-tone-danger { --lh-meter-fill: var(--rz-danger, #d32f2f); }
.lh-meter-text { display: flex; justify-content: space-between; gap: var(--lh-space-3); font-size: var(--lh-text-sm); color: var(--lh-muted); }
.lh-meter-figure { color: var(--lh-text); font-weight: 600; font-variant-numeric: tabular-nums; }
.lh-meter-track { height: 0.5rem; border-radius: 999px; background: color-mix(in srgb, var(--lh-meter-fill) 18%, transparent); overflow: hidden; }
.lh-meter-fill { display: block; height: 100%; border-radius: 999px; background: var(--lh-meter-fill); }
.lh-meters { display: grid; gap: var(--lh-space-3); }
.lh-card-body > :is(.lh-meters, .lh-facts, .lh-chips, form, .lh-banner, .lh-table, .lh-empty-state):not(:first-child) { margin-top: var(--lh-space-4); }
.lh-card-body > .lh-banner { margin-bottom: 0; }
.lh-card-lede { margin: 0; color: var(--lh-muted); font-size: var(--lh-text-sm); }
.lh-chips { display: flex; flex-wrap: wrap; gap: var(--lh-space-2); margin: 0; }
.lh-transactions-filters { display: flex; flex-wrap: wrap; gap: var(--lh-space-4); margin-bottom: var(--lh-space-4); }
.lh-transactions-filters .lh-account-field { min-width: 14rem; }
.lh-category-select { min-width: 10rem; padding-block: 0.15rem; }
.lh-bill-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); column-gap: var(--lh-space-4); }
.lh-bill-form .lh-account-field { margin-bottom: var(--lh-space-3); }
.lh-bill-form small { font-size: var(--lh-text-sm); }
.lh-bill-repeat { display: flex; gap: var(--lh-space-2); }
.lh-bill-repeat input { max-width: 5rem; }
.lh-small { font-size: var(--lh-text-sm); }
.lh-row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--lh-space-1); }
[data-schedule-table="paychecks"] { margin-top: var(--lh-space-4); }
.lh-card-body > [data-planned-list] { margin-top: var(--lh-space-3); }

/* Forecast: the running totals stand out, and a balance below zero reads in the warning colour (with its minus sign). */
.lh-forecast-total td { font-weight: 650; border-top: 1px solid var(--lh-border); }
.lh-negative { color: var(--lh-warning-text); }

/* Dialog editors (Kit/EditorDialog): the page forms' fields in a grid that drops to one column, actions at the end. */
.lh-dialog-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); column-gap: var(--lh-space-4); }
.lh-dialog-fields .lh-account-field { margin-bottom: var(--lh-space-3); }
.lh-dialog-fields .lh-dialog-wide { grid-column: 1 / -1; }
.lh-dialog-fields small { font-size: var(--lh-text-sm); }
.lh-dialog-fields .rz-textbox:disabled { opacity: 0.7; cursor: not-allowed; }
.lh-dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--lh-space-2); margin-top: var(--lh-space-2); }

.lh-record-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0.6rem;
    border: 1px solid var(--lh-border);
    border-radius: 999px;
    color: var(--lh-text);
    font-size: var(--lh-text-sm);
    text-decoration: none;
}

.lh-record-link .rzi { font-size: 1rem; color: var(--lh-muted); }
.lh-record-link:hover { border-color: var(--lh-accent); }

.lh-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.lh-table th { text-align: left; color: var(--lh-muted); font-size: var(--lh-text-sm); font-weight: 600; padding: var(--lh-space-2) var(--lh-space-3); border-bottom: 1px solid var(--lh-border); }
.lh-table td { padding: var(--lh-space-2) var(--lh-space-3); border-bottom: 1px solid var(--lh-border); }
.lh-table .lh-num { text-align: right; }
.lh-table tr:last-child td { border-bottom: 0; }

.lh-log {
    margin: 0;
    padding: var(--lh-space-3) var(--lh-space-4);
    background: color-mix(in srgb, var(--lh-text) 5%, transparent);
    border-radius: 0.5rem;
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
    font-size: var(--lh-text-sm);
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-x: auto;
}

.lh-sample-banner { margin-bottom: var(--lh-space-5); }
.lh-gallery-label { margin: 0 0 var(--lh-space-2); color: var(--lh-muted); font-size: var(--lh-text-xs); font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; }
.lh-table th[scope="row"] { width: 9rem; border-bottom: 1px solid var(--lh-border); }

/* ---------- Top-bar popovers and search ---------- */

.lh-popover { position: relative; }

.lh-popover > summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    color: var(--lh-muted);
    cursor: pointer;
    list-style: none;
}

.lh-popover > summary::-webkit-details-marker { display: none; }
.lh-popover > summary:hover { background: color-mix(in srgb, var(--lh-text) 6%, transparent); }
.lh-popover[open] > summary { background: var(--lh-accent-soft); color: var(--lh-accent); }
.lh-popover > summary:focus-visible { outline: 2px solid var(--lh-accent); outline-offset: 2px; }

.lh-popover-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 0.25rem);
    z-index: 7;
    width: min(22rem, 90vw);
    padding: var(--lh-space-3);
    background: var(--lh-raised);
    border: 1px solid var(--lh-border);
    border-radius: var(--lh-radius);
    box-shadow: var(--rz-shadow-3, 0 4px 16px rgb(0 0 0 / 0.15));
}

.lh-popover-panel h2 { margin: 0 0 var(--lh-space-2); font-size: var(--lh-text-md); }

/* The bell: a count on the icon (its colour is the worst item's, and the summary's label says the number too), then
   each item with its page link, "Got it" and "Snooze a day". */
.lh-bell > summary { position: relative; }
.lh-bell-count {
    position: absolute;
    top: 0.1rem;
    right: 0.05rem;
    min-width: 1.15rem;
    height: 1.15rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    background: var(--lh-tone-fg);
    color: var(--lh-raised);
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.15rem;
    text-align: center;
}
.lh-bell-panel { width: min(26rem, calc(100vw - 2rem)); max-height: min(70vh, 36rem); overflow-y: auto; }
.lh-bell-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--lh-space-2); }
.lh-bell-item {
    display: flex;
    gap: var(--lh-space-2);
    align-items: flex-start;
    padding: var(--lh-space-2) var(--lh-space-3);
    border: 1px solid var(--lh-tone-line);
    border-radius: var(--lh-radius);
    background: var(--lh-tone-bg);
}
.lh-bell-item p { margin: 0; font-size: var(--lh-text-sm); }
.lh-bell-icon { color: var(--lh-tone-fg); font-size: 1.2rem; }
.lh-bell-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--lh-space-3); margin-top: var(--lh-space-1); font-size: var(--lh-text-sm); }
.lh-bell-acknowledged { margin-top: var(--lh-space-3); }
.lh-bell-acknowledged > summary { cursor: pointer; color: var(--lh-muted); font-size: var(--lh-text-sm); }
.lh-bell-acknowledged > .lh-bell-list { margin-top: var(--lh-space-2); }
.lh-bell-foot { margin: var(--lh-space-3) 0 0; color: var(--lh-muted); font-size: var(--lh-text-xs); }
.lh-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.lh-search-button {
    display: inline-flex;
    align-items: center;
    gap: var(--lh-space-2);
    min-height: 2.5rem;
    padding: 0 var(--lh-space-3);
    border: 1px solid var(--lh-border);
    border-radius: 999px;
    background: none;
    color: var(--lh-muted);
    font-size: var(--lh-text-sm);
    cursor: pointer;
}

.lh-search-button:hover { border-color: var(--lh-accent); }
.lh-search-button kbd { padding: 0 0.35rem; border: 1px solid var(--lh-border); border-radius: 0.3rem; font-size: var(--lh-text-xs); font-family: inherit; }

.lh-search {
    width: min(36rem, 92vw);
    margin-top: 12vh;
    padding: 0;
    border: 1px solid var(--lh-border);
    border-radius: var(--lh-radius);
    background: var(--lh-raised);
    color: var(--lh-text);
    box-shadow: var(--rz-shadow-4, 0 12px 40px rgb(0 0 0 / 0.3));
}

.lh-search::backdrop { background: rgb(0 0 0 / 0.35); }
.lh-search-input { display: flex; align-items: center; gap: var(--lh-space-2); padding: var(--lh-space-3) var(--lh-space-4); border-bottom: 1px solid var(--lh-border); }
.lh-search-input input { flex: 1; border: 0; background: none; color: var(--lh-text); font-size: var(--lh-text-lg); outline: none; }
.lh-search-body { max-height: 60vh; overflow-y: auto; }
.lh-search-results { list-style: none; margin: 0; padding: var(--lh-space-2); }
.lh-search-results:empty { display: none; }
.lh-search-group { margin: 0; padding: var(--lh-space-2) var(--lh-space-4) 0; color: var(--lh-muted); font-size: var(--lh-text-xs); font-weight: 650; text-transform: uppercase; letter-spacing: 0.04em; }
.lh-search-records { border-top: 1px solid var(--lh-border); }
.lh-search-record { display: flex; flex-direction: column; min-width: 0; }
.lh-search-record > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lh-search-detail { color: var(--lh-muted); font-size: var(--lh-text-xs); }
.lh-search-status { margin: 0; padding: 0 var(--lh-space-4) var(--lh-space-2); color: var(--lh-muted); font-size: var(--lh-text-sm); }
.lh-search-status:empty { display: none; }
.lh-search-results a { display: flex; align-items: center; gap: var(--lh-space-3); padding: var(--lh-space-2) var(--lh-space-3); border-radius: 0.5rem; color: var(--lh-text); text-decoration: none; }
.lh-search-results a:hover, .lh-search-results a:focus { background: var(--lh-accent-soft); outline: none; }
.lh-search-results .lh-search-where { margin-left: auto; color: var(--lh-muted); font-size: var(--lh-text-xs); }
.lh-search-hint { margin: 0; padding: var(--lh-space-2) var(--lh-space-4) var(--lh-space-3); color: var(--lh-muted); font-size: var(--lh-text-xs); }

/* ---------- Account pages (sign-in, setup) ---------- */

.lh-account {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 1.5rem;
    box-sizing: border-box;
}

.lh-account-card {
    width: min(100%, 28rem);
    padding: 2rem;
    background: var(--lh-raised);
    border: 1px solid var(--lh-border);
    border-radius: 1rem;
    box-shadow: var(--rz-shadow-2, 0 2px 12px rgb(0 0 0 / 0.08));
}

.lh-account-card h1 { margin: 0.5rem 0 1rem; font-size: 1.6rem; }

.lh-account-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.15rem;
}

.lh-account-brand .lh-theme { margin-left: auto; }

.lh-account-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 1rem;
}

.lh-account-field span { font-weight: 600; font-size: 0.95rem; }
.lh-account-field .rz-textbox { width: 100%; min-height: var(--lh-touch); box-sizing: border-box; font-size: 1rem; }

.lh-account-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    min-height: 3rem;
    margin-bottom: 0.5rem;
    text-decoration: none;
}

.lh-account-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.25rem 0;
    color: var(--lh-muted);
    font-size: 0.85rem;
}

.lh-account-divider::before,
.lh-account-divider::after {
    content: "";
    flex: 1;
    border-top: 1px solid var(--lh-border);
}

.lh-account-note { color: var(--lh-muted); font-size: 0.95rem; }
.lh-account-error { color: var(--lh-danger-text); }
.lh-account-error:empty { display: none; }
.lh-account-ok { color: var(--lh-success-text); font-weight: 600; }

.lh-codes {
    padding: 0.75rem 1rem;
    background: color-mix(in srgb, var(--lh-text) 5%, transparent);
    border-radius: 0.5rem;
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
    letter-spacing: 0.05em;
}

ul.lh-codes { list-style: none; columns: 2; }

/* ---------- Forms and Blazor defaults ---------- */

.valid.modified:not([type=checkbox]) { outline: 1px solid var(--rz-success); }
.invalid { outline: 1px solid var(--rz-danger); }
.validation-message { color: var(--lh-danger-text); }

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    color: #212121;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

/* ---------- Tablet: narrower rail, smaller primary labels ---------- */

@media (max-width: 1100px) {
    :root { --lh-rail-width: 12.5rem; }
    .lh-primary-link { padding: 0.5rem 0.7rem; font-size: 0.95rem; }
    .lh-main { padding: 1.5rem 1.75rem 2.5rem; }
}

/* Narrower laptop screens: keep every section label visible by dropping decoration first. */
@media (max-width: 1280px) {
    .lh-search-label, .lh-search-button kbd { display: none; }
    .lh-search-button { width: 2.5rem; padding: 0; justify-content: center; border-color: transparent; }
    .lh-primary-link .rzi { display: none; }
    .lh-account-name { display: none; }
}

@media (max-width: 1060px) {
    .lh-brand > span { display: none; }
    .lh-primary-link { padding: 0.5rem 0.6rem; }
}

/* ---------- Phone: usable fallback only (the web app is desktop-first; phones use LifeHub Mobile).
   Primary destinations move to the bottom and the rail becomes a strip. Not refined further. ---------- */

@media (max-width: 720px) {
    .lh-topbar { padding: 0.5rem 0.75rem; }

    .lh-primary {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 6;
        display: grid;
        grid-template-columns: repeat(7, minmax(0, 1fr));
        gap: 0;
        padding: 0.25rem 0.25rem calc(0.25rem + env(safe-area-inset-bottom));
        background: var(--lh-raised);
        border-top: 1px solid var(--lh-border);
    }

    .lh-primary-link {
        flex-direction: column;
        gap: 0.1rem;
        min-height: 3.25rem;
        padding: 0.25rem 0.1rem;
        font-size: 0.68rem;
        font-weight: 600;
    }

    .lh-primary-link .rzi { display: inline-block; font-size: 1.4rem; }
    .lh-primary-label { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

    .lh-body { grid-template-columns: minmax(0, 1fr); }

    .lh-secondary {
        flex-direction: row;
        overflow-x: auto;
        gap: 0.25rem;
        padding: 0.5rem 0.75rem;
        border-right: 0;
        border-bottom: 1px solid var(--lh-border);
        scrollbar-width: none;
    }

    .lh-secondary-title, .lh-secondary-group { display: none; }
    .lh-secondary-link { flex: none; min-height: 2.5rem; padding: 0.35rem 0.85rem; border: 1px solid var(--lh-border); border-radius: 999px; }
    .lh-secondary-link .rzi { display: none; }

    .lh-main { padding: 1.25rem 1rem calc(5rem + env(safe-area-inset-bottom)); }
    .lh-page-header h1 { font-size: 1.6rem; }
    ul.lh-codes { columns: 1; }

    /* A table wider than the phone scrolls sideways inside its card, so the page itself never does
       (checked at 375 px, 2026-11-09: Bills and Transactions had made the page 705 and 657 px wide). */
    .lh-card-body { overflow-x: auto; }
}

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

/* ---------- Homelab (Phase 3 slice 3) ---------- */

.lh-section-gap { margin-top: var(--lh-space-5); }
.lh-nowrap { white-space: nowrap; }

/* Homelab editors (dialogs): pickers fill their field, Markdown is edited in a monospace box. */
.lh-dialog-fields .lh-fill { width: 100%; }
.lh-editor-markdown { width: 100%; box-sizing: border-box; height: auto; min-height: 9rem; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: var(--lh-text-sm); line-height: 1.5; resize: vertical; }
.lh-editor-check { flex-direction: row; align-items: flex-start; gap: var(--lh-space-2); }
.lh-editor-check span { font-weight: 400; }
.lh-page-actions { flex-wrap: wrap; align-items: center; }

/* VMs & containers: a heading per hypervisor, then its guests as cards. */
.lh-group-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--lh-space-2) var(--lh-space-3); margin-bottom: var(--lh-space-3); }
.lh-group-head .lh-card-icon { align-self: center; }
.lh-group-title { margin: 0; font-size: var(--lh-text-lg); font-weight: 650; }
.lh-group-action { margin-left: auto; }
.lh-guest-card .lh-card-title { font-size: 1rem; overflow-wrap: anywhere; }
.lh-guest-card .lh-card-body > .lh-guest-none { margin: var(--lh-space-3) 0 0; font-size: var(--lh-text-sm); }
.lh-inline-list + .lh-inline-list::before { content: ", "; color: var(--lh-text); font-weight: 400; }

/* Notes written in LanMan, rendered from Markdown (raw HTML off). */
.lh-prose { line-height: 1.6; overflow-wrap: anywhere; }
.lh-prose > :first-child { margin-top: 0; }
.lh-prose > :last-child { margin-bottom: 0; }
.lh-prose h1, .lh-prose h2, .lh-prose h3, .lh-prose h4 { margin: var(--lh-space-4) 0 var(--lh-space-2); font-size: 1.05rem; line-height: 1.3; }
.lh-prose h1 { font-size: 1.2rem; }
.lh-prose p, .lh-prose ul, .lh-prose ol, .lh-prose table, .lh-prose blockquote { margin: 0 0 var(--lh-space-3); }
.lh-prose ul, .lh-prose ol { padding-left: 1.4rem; }
.lh-prose a { color: var(--lh-accent); }
.lh-prose code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 0.9em; padding: 0.05rem 0.3rem; border-radius: 0.3rem; background: color-mix(in srgb, var(--lh-text) 7%, transparent); }
.lh-prose pre { margin: 0 0 var(--lh-space-3); padding: var(--lh-space-3) var(--lh-space-4); border-radius: 0.5rem; background: color-mix(in srgb, var(--lh-text) 5%, transparent); overflow-x: auto; }
.lh-prose pre code { padding: 0; background: none; font-size: var(--lh-text-sm); }
.lh-prose blockquote { padding-left: var(--lh-space-3); border-left: 3px solid var(--lh-border); color: var(--lh-muted); }
.lh-prose table { border-collapse: collapse; display: block; overflow-x: auto; }
.lh-prose th, .lh-prose td { padding: var(--lh-space-1) var(--lh-space-3); border: 1px solid var(--lh-border); text-align: left; }
.lh-entry-meta { display: flex; flex-wrap: wrap; gap: var(--lh-space-2); align-items: center; }
