/* ---------- type ---------- */
@font-face {
    font-family: "Geist";
    src: url("fonts/geist-latin-wght-normal.woff2") format("woff2-variations");
    font-weight: 100 900;
    font-display: swap;
}
@font-face {
    font-family: "Geist Mono";
    src: url("fonts/geist-mono-latin-wght-normal.woff2") format("woff2-variations");
    font-weight: 100 900;
    font-display: swap;
}

/* ---------- tokens ---------- */
:root {
    color-scheme: light;
    --page: #f1f0ec;
    --surface: #fbfbf9;                       /* opaque stand-in for the glass, used where colours are mixed */
    --glass: rgba(255, 255, 255, 0.66);
    --glass-strong: rgba(255, 255, 255, 0.86);
    --tile: rgba(255, 255, 255, 0.58);
    --raised: rgba(11, 11, 11, 0.05);
    --ink: #0b0b0d;
    --ink-2: #4a4946;
    --muted: #6f6d68;
    --hairline: rgba(11, 11, 11, 0.09);
    --border: rgba(11, 11, 11, 0.09);
    --edge: rgba(255, 255, 255, 0.9);         /* lit top edge of glass */
    --accent: #2a78d6;                        /* data marks: validated chart blue */
    --accent-ink: #1c5cab;
    --accent-wash: rgba(42, 120, 214, 0.10);
    --accent-wash-2: rgba(42, 120, 214, 0.16);
    --grad: linear-gradient(135deg, #2a78d6 0%, #6250d6 55%, #b04fd0 100%);
    --grad-glow: rgba(98, 80, 214, 0.35);
    --mine-a: #0ca30c;                        /* personal agenda: green to teal */
    --mine-b: #0f9f8f;
    --mine-glow: rgba(12, 163, 12, 0.35);
    --on-accent: #ffffff;
    --good: #0ca30c;
    --warning: #fab219;
    --critical: #d03b3b;
    --critical-ink: #b02a2a;
    --shadow: 0 1px 1px rgba(11, 11, 11, 0.03), 0 18px 40px -24px rgba(30, 30, 60, 0.28);
    --aurora-opacity: 0.42;
    --sans: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --mono: "Geist Mono", ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
    --radius: 20px;
    /* aurora colours follow the time of day (data-phase on <html>) */
    --a1: #38bdf8;
    --a2: #6366f1;
    --a3: #34d399;
}

:root[data-phase="dawn"] { --a1: #fb923c; --a2: #f472b6; --a3: #60a5fa; }
:root[data-phase="dusk"] { --a1: #f472b6; --a2: #8b5cf6; --a3: #fb7185; }
:root[data-phase="night"] { --a1: #2563eb; --a2: #7c3aed; --a3: #0d9488; }

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --page: #07070a;
        --surface: #16161a;
        --glass: rgba(22, 22, 27, 0.58);
        --glass-strong: rgba(22, 22, 27, 0.88);
        --tile: rgba(255, 255, 255, 0.035);
        --raised: rgba(255, 255, 255, 0.07);
        --ink: #f4f3f0;
        --ink-2: #c6c5bd;
        --muted: #8d8b86;
        --hairline: rgba(255, 255, 255, 0.08);
        --border: rgba(255, 255, 255, 0.09);
        --edge: rgba(255, 255, 255, 0.07);
        --accent: #3987e5;
        --accent-ink: #9cc3f5;
        --accent-wash: rgba(57, 135, 229, 0.14);
        --accent-wash-2: rgba(57, 135, 229, 0.24);
        --grad: linear-gradient(135deg, #4f9bff 0%, #8b6cff 55%, #d16bff 100%);
        --grad-glow: rgba(139, 108, 255, 0.45);
        --mine-a: #3ddc6a;
        --mine-b: #2dd4bf;
        --mine-glow: rgba(45, 212, 140, 0.4);
        --critical-ink: #f08080;
        --shadow: 0 30px 60px -40px rgba(0, 0, 0, 0.9);
        --aurora-opacity: 0.55;
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --page: #07070a;
    --surface: #16161a;
    --glass: rgba(22, 22, 27, 0.58);
    --glass-strong: rgba(22, 22, 27, 0.88);
    --tile: rgba(255, 255, 255, 0.035);
    --raised: rgba(255, 255, 255, 0.07);
    --ink: #f4f3f0;
    --ink-2: #c6c5bd;
    --muted: #8d8b86;
    --hairline: rgba(255, 255, 255, 0.08);
    --border: rgba(255, 255, 255, 0.09);
    --edge: rgba(255, 255, 255, 0.07);
    --accent: #3987e5;
    --accent-ink: #9cc3f5;
    --accent-wash: rgba(57, 135, 229, 0.14);
    --accent-wash-2: rgba(57, 135, 229, 0.24);
    --grad: linear-gradient(135deg, #4f9bff 0%, #8b6cff 55%, #d16bff 100%);
    --grad-glow: rgba(139, 108, 255, 0.45);
    --mine-a: #3ddc6a;
    --mine-b: #2dd4bf;
    --mine-glow: rgba(45, 212, 140, 0.4);
    --critical-ink: #f08080;
    --shadow: 0 30px 60px -40px rgba(0, 0, 0, 0.9);
    --aurora-opacity: 0.55;
}

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

html { -webkit-text-size-adjust: 100%; background: var(--page); }

body {
    margin: 0;
    min-height: 100dvh;
    color: var(--ink);
    font: 14px/1.45 var(--sans);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, p, ul { margin: 0; padding: 0; }
ul { list-style: none; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
::selection { background: var(--accent-wash-2); }

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

.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

.eyebrow {
    font: 500 11px/1 var(--mono);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

/* ---------- aurora backdrop ---------- */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; background: var(--page); }
.aurora i {
    position: absolute;
    width: 62vmax;
    height: 62vmax;
    border-radius: 50%;
    filter: blur(90px);
    opacity: var(--aurora-opacity);
    will-change: transform;
}
.aurora i:nth-child(1) { background: radial-gradient(circle, var(--a1), transparent 62%); top: -30vmax; left: -14vmax; animation: drift-a 26s ease-in-out infinite alternate; }
.aurora i:nth-child(2) { background: radial-gradient(circle, var(--a2), transparent 62%); top: -24vmax; right: -20vmax; animation: drift-b 32s ease-in-out infinite alternate; }
.aurora i:nth-child(3) { background: radial-gradient(circle, var(--a3), transparent 62%); bottom: -42vmax; left: 22vw; opacity: calc(var(--aurora-opacity) * 0.6); animation: drift-c 38s ease-in-out infinite alternate; }
/* a fine grain of dots keeps large blurred areas from looking flat */
.aurora::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(var(--hairline) 1px, transparent 1px); background-size: 22px 22px; mask-image: linear-gradient(180deg, #000, transparent 70%); }

@keyframes drift-a { to { transform: translate(22vw, 16vh) scale(1.2); } }
@keyframes drift-b { to { transform: translate(-24vw, 20vh) scale(0.85); } }
@keyframes drift-c { to { transform: translate(-20vw, -18vh) scale(1.25); } }

/* ---------- buttons & fields ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 36px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--tile);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.2s, translate 0.15s;
}
.btn:hover { background: var(--raised); }
.btn:active { translate: 0 1px; }
.btn.icon-only { width: 36px; padding: 0; }
.btn.primary { background: var(--grad); border-color: transparent; color: var(--on-accent); font-weight: 600; box-shadow: 0 8px 24px -10px var(--grad-glow), inset 0 1px 0 rgba(255, 255, 255, 0.25); }
.btn.primary:hover { box-shadow: 0 10px 30px -8px var(--grad-glow), inset 0 1px 0 rgba(255, 255, 255, 0.25); filter: brightness(1.06); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--raised); color: var(--ink); }
.btn.danger { color: var(--critical-ink); }
.btn[aria-pressed="true"] { background: var(--grad); border-color: transparent; color: var(--on-accent); box-shadow: 0 8px 24px -10px var(--grad-glow); }

.field { display: grid; gap: 6px; }
.field > span { font-size: 12px; color: var(--ink-2); }
.field input, .field select, .field textarea, .input {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--raised);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.field textarea { height: auto; padding: 10px 12px; }
.field input:focus, .field select:focus, .input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-wash); }
.check { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.form-error { color: var(--critical-ink); font-size: 13px; }
.form-note { color: var(--muted); font-size: 12px; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; padding-top: 12px; }
.page {
    max-width: 1480px;
    margin: 0 auto;
    padding-inline: clamp(16px, 3vw, 40px);
}
.topbar-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    height: 58px;
    width: calc(100% - 2 * clamp(16px, 3vw, 40px));
    max-width: calc(1480px - 2 * clamp(16px, 3vw, 40px));
    margin-inline: auto;
    padding-inline: 14px 10px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--glass);
    backdrop-filter: blur(22px) saturate(1.5);
    box-shadow: inset 0 1px 0 var(--edge), var(--shadow);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -0.015em; white-space: nowrap; }
.brand img { width: 28px; height: 28px; border-radius: 8px; box-shadow: 0 6px 16px -6px var(--grad-glow); }

.search { position: relative; flex: 1; max-width: 460px; margin-inline: auto; }
.search .icon { position: absolute; left: 12px; top: 50%; translate: 0 -50%; color: var(--muted); pointer-events: none; }
.search input {
    width: 100%;
    height: 38px;
    padding: 0 44px 0 38px;
    border: 1px solid transparent;
    border-radius: 11px;
    background: var(--raised);
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-wash); }
.search kbd {
    position: absolute; right: 10px; top: 50%; translate: 0 -50%;
    font: 11px var(--mono); color: var(--muted);
    border: 1px solid var(--border); border-radius: 6px; padding: 2px 6px;
}
.search input:focus + kbd { display: none; }
.search-hint { position: absolute; left: 0; right: 0; top: 46px; padding: 9px 12px; font-size: 12px; color: var(--ink-2); background: var(--glass-strong); backdrop-filter: blur(20px); border: 1px solid var(--border); border-radius: 11px; box-shadow: var(--shadow); }

.actions { display: flex; align-items: center; gap: 2px; }

/* ---------- layout ---------- */
.page { padding-block: clamp(24px, 4vw, 48px) 72px; display: grid; gap: 22px; }
/* "backwards", not "both": an animation that stays applied turns the element into a backdrop root,
   and the glass panels inside it would stop blurring what is behind the page. */
.page > * { animation: rise 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) backwards; }
.page > :nth-child(2) { animation-delay: 0.08s; }
.page > :nth-child(3) { animation-delay: 0.16s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

.hero { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 24px 40px; padding-block: 6px 10px; }
.greeting { font-size: 16px; color: var(--ink-2); }
.clock {
    width: fit-content;
    font-size: clamp(64px, 11vw, 132px);
    font-weight: 600;
    line-height: 0.95;
    letter-spacing: -0.055em;
    margin-block: 6px 14px;
    font-variant-numeric: tabular-nums;
    background: linear-gradient(180deg, var(--ink) 35%, color-mix(in srgb, var(--ink) 45%, transparent) 110%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.clock small { font-size: 0.26em; font-weight: 500; letter-spacing: 0; margin-left: 0.3em; color: var(--muted); -webkit-text-fill-color: var(--muted); }
/* the minute, filling up */
.minute { width: min(100%, 300px); height: 3px; border-radius: 3px; background: var(--raised); overflow: hidden; margin-bottom: 14px; }
.minute i { display: block; height: 100%; width: calc(var(--v, 0) * 1%); background: var(--grad); border-radius: 3px; transition: width 1s linear; box-shadow: 0 0 12px var(--grad-glow); }
.today { font-size: 15px; color: var(--ink-2); }
.today b { color: var(--ink); font-weight: 600; }
.next-up { display: flex; align-items: center; flex-wrap: wrap; gap: 0 4px; margin-top: 8px; font-size: 15px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.next-up[hidden] { display: none; }
.next-up b { color: var(--ink); font-weight: 600; }
.next-later { color: var(--muted); }
.next-dot { width: 8px; height: 8px; margin-right: 4px; border-radius: 50%; background: var(--grad); }
.next-dot.mine { background: linear-gradient(135deg, var(--mine-a), var(--mine-b)); }

.weather {
    display: flex;
    align-items: stretch;
    gap: 22px;
    padding: 16px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--glass);
    backdrop-filter: blur(22px) saturate(1.4);
    box-shadow: inset 0 1px 0 var(--edge), var(--shadow);
}
.weather-now { display: flex; align-items: center; gap: 14px; }
.weather-now .icon { width: 44px; height: 44px; stroke-width: 1.3; color: var(--ink); }
.weather-temp { font-size: 38px; font-weight: 600; letter-spacing: -0.04em; line-height: 1; }
.weather-desc { font-size: 13px; color: var(--ink-2); margin-top: 5px; max-width: 250px; }
.weather-sun { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.weather-sun .uv { padding: 0 7px; border-radius: 999px; background: var(--raised); color: var(--ink-2); }
.weather-sun .uv-hoog, .weather-sun .uv-zeer-hoog, .weather-sun .uv-extreem { background: color-mix(in srgb, var(--critical) 16%, transparent); color: var(--ink); }
.weather-days { display: grid; gap: 6px; padding-left: 22px; border-left: 1px solid var(--hairline); align-content: center; }
.weather-day { display: grid; grid-template-columns: 22px 18px 76px auto; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.weather-day .icon { width: 16px; height: 16px; color: var(--muted); }
.weather-day b { color: var(--ink); font-weight: 500; }
.weather-day span:last-child { color: var(--muted); }

.columns { display: grid; gap: 22px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1080px) {
    .columns { grid-template-columns: minmax(0, 1fr) 390px; }
}
.side { display: grid; gap: 22px; }

.card {
    position: relative;
    background: var(--glass);
    backdrop-filter: blur(26px) saturate(1.4);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: inset 0 1px 0 var(--edge), var(--shadow);
    padding: 20px 22px 22px;
    min-width: 0;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 28px; margin-bottom: 16px; }
.card-head .aside { font-size: 12px; color: var(--muted); }

/* ---------- agenda timeline ---------- */
.day-tabs { display: flex; gap: 2px; overflow-x: auto; padding: 3px; border-radius: 12px; background: var(--raised); }
.day-tab { height: 28px; padding: 0 11px; border: 0; border-radius: 9px; background: transparent; color: var(--ink-2); font-size: 13px; cursor: pointer; white-space: nowrap; transition: background 0.15s, color 0.15s; }
.day-tab:hover { color: var(--ink); }
.day-tab[aria-selected="true"] { background: var(--glass-strong); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18), inset 0 1px 0 var(--edge); }
.day-tab .count { margin-left: 6px; font: 11px var(--mono); color: var(--muted); }

.agenda-now { font-size: 15px; color: var(--ink-2); margin-bottom: 18px; }
.agenda-now b { color: var(--ink); font-weight: 600; }

.timeline { position: relative; padding-top: 24px; }
.tl-hours { position: absolute; inset: 0; pointer-events: none; }
.tl-hour { position: absolute; top: 0; bottom: 0; left: calc(var(--x) * 1%); border-left: 1px solid var(--hairline); }
.tl-hour span { position: absolute; top: 0; left: 6px; font: 11px/1 var(--mono); color: var(--muted); }
.tl-track { position: relative; height: calc(var(--lanes) * 64px - 6px); min-height: 58px; }
.tl-nowline { position: absolute; top: 20px; bottom: 0; left: calc(var(--x) * 1%); width: 2px; margin-left: -1px; background: var(--critical); border-radius: 2px; pointer-events: none; z-index: 2; box-shadow: 0 0 12px var(--critical); }
.tl-nowline::before { content: ""; position: absolute; top: -4px; left: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--critical); box-shadow: 0 0 0 4px color-mix(in srgb, var(--critical) 25%, transparent); }

.ev {
    position: absolute;
    left: calc(var(--l) * 1%);
    width: calc(var(--w) * 1% - 4px);
    top: calc(var(--lane) * 64px);
    height: 58px;
    padding: 9px 12px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--accent) 16%, var(--surface));
    box-shadow: inset 3px 0 0 var(--accent), inset 0 1px 0 var(--edge);
    overflow: hidden;
    cursor: default;
    transition: background 0.15s, translate 0.15s;
}
.ev:hover, .ev:focus-visible { background: color-mix(in srgb, var(--accent) 28%, var(--surface)); translate: 0 -1px; }
.ev.is-now { background: var(--grad); color: var(--on-accent); box-shadow: 0 12px 30px -12px var(--grad-glow), inset 0 1px 0 rgba(255, 255, 255, 0.3); }
.ev.is-now:hover, .ev.is-now:focus-visible { background: var(--grad); filter: brightness(1.06); }
.ev.is-now .ev-meta { color: inherit; opacity: 0.88; }
.ev.is-past { opacity: 0.45; }
/* Personal events: a green-to-teal gradient, soft by default and full while they are on. */
.ev.mine {
    --accent: var(--mine-a);
    background: linear-gradient(135deg, color-mix(in srgb, var(--mine-a) 24%, var(--surface)), color-mix(in srgb, var(--mine-b) 16%, var(--surface)));
}
.ev.mine:hover, .ev.mine:focus-visible { background: linear-gradient(135deg, color-mix(in srgb, var(--mine-a) 36%, var(--surface)), color-mix(in srgb, var(--mine-b) 26%, var(--surface))); }
.ev.mine.is-now, .ev.mine.is-now:hover, .ev.mine.is-now:focus-visible {
    background: linear-gradient(135deg, var(--mine-a), var(--mine-b));
    box-shadow: 0 12px 30px -12px var(--mine-glow), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
/* With both agendas shown, the room's events step back so the personal ones lead. */
.has-mine .ev:not(.mine) { background: color-mix(in srgb, var(--accent) 8%, var(--surface)); box-shadow: inset 3px 0 0 color-mix(in srgb, var(--accent) 50%, transparent), inset 0 1px 0 var(--edge); }
.has-mine .ev:not(.mine) .ev-title { color: var(--ink-2); }
.has-mine .ev:not(.mine):hover, .has-mine .ev:not(.mine):focus-visible { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); }
.has-mine .ev.is-now:not(.mine), .has-mine .ev.is-now:not(.mine):hover {
    background: linear-gradient(color-mix(in srgb, var(--surface) 45%, transparent), color-mix(in srgb, var(--surface) 45%, transparent)), var(--grad);
    box-shadow: 0 10px 24px -14px var(--grad-glow), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    color: var(--ink);
}
.has-mine .ev.is-now:not(.mine) .ev-title { color: inherit; }
.has-mine .ev.is-now:not(.mine) .ev-meta { color: var(--ink-2); opacity: 1; }
.has-mine .allday span:not(.mine) { background: color-mix(in srgb, var(--accent) 6%, transparent); color: var(--ink-2); }
.agenda-legend { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); margin-right: auto; }
.agenda-legend[hidden] { display: none; }
.agenda-legend i { width: 9px; height: 9px; border-radius: 3px; background: var(--accent); }
.agenda-legend i.mine { background: linear-gradient(135deg, var(--mine-a), var(--mine-b)); margin-left: 8px; }
.ev-title { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-meta { font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; margin-top: 2px; }
.allday { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.allday span { padding: 4px 10px; border-radius: 999px; background: var(--accent-wash); font-size: 12px; }
.allday span.mine { background: linear-gradient(135deg, color-mix(in srgb, var(--mine-a) 18%, transparent), color-mix(in srgb, var(--mine-b) 14%, transparent)); }
.empty { color: var(--muted); font-size: 13px; padding: 8px 0; }

@media (max-width: 760px) {
    .timeline { padding-top: 0; }
    .tl-hours, .tl-nowline { display: none; }
    .tl-track { height: auto; display: grid; gap: 6px; }
    .ev { position: static; width: auto; height: auto; }
}

/* ---------- links ---------- */
.group + .group { margin-top: 24px; }
.group-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; min-height: 30px; }
.group-head .eyebrow { flex: 1; display: flex; align-items: center; gap: 12px; }
.group-head .eyebrow::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--hairline), transparent); }
.group-name { flex: 1; max-width: 280px; height: 30px; padding: 0 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--raised); font-weight: 600; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }

.tile {
    --mx: 50%;
    --my: 50%;
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 64px;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: var(--tile);
    box-shadow: inset 0 1px 0 var(--edge);
    overflow: hidden;
    transition: border-color 0.2s, translate 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.2s;
}
/* a soft light in the tile's own colour that follows the pointer */
.tile::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(220px circle at var(--mx) var(--my), hsl(var(--hue, 220) 85% 62% / 0.20), transparent 65%);
    opacity: 0;
    transition: opacity 0.25s;
    pointer-events: none;
}
.tile:hover { translate: 0 -2px; border-color: hsl(var(--hue, 220) 60% 60% / 0.45); box-shadow: inset 0 1px 0 var(--edge), 0 16px 30px -18px hsl(var(--hue, 220) 70% 45% / 0.55); }
.tile:hover::before { opacity: 1; }
.tile > * { position: relative; }
.tile.is-first { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-wash); }
.tile.is-dragging { opacity: 0.35; }
.tile-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex: none;
    border-radius: 12px;
    background: linear-gradient(145deg, hsl(var(--hue) 70% 58% / 0.30), hsl(calc(var(--hue) + 40) 70% 50% / 0.14));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
    color: hsl(var(--hue) 45% 36%);
    font-weight: 700;
    font-size: 15px;
}
:root[data-theme="dark"] .tile-icon { color: hsl(var(--hue) 80% 82%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tile-icon { color: hsl(var(--hue) 80% 82%); } }
.tile-icon img { position: absolute; inset: 9px; width: 22px; height: 22px; border-radius: 5px; }
.tile-icon.has-img { background: var(--raised); color: transparent; }
.tile-body { min-width: 0; flex: 1; }
.tile-title, .tile-sub { display: block; }
.tile-title { font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }

/* A tile that carries live figures from its app takes two columns. */
.tile.wide { grid-column: span 2; flex-wrap: wrap; padding-right: 30px; }
.tile.wide > .dot, .tile.wide > .chip { position: absolute; top: 50%; right: 12px; translate: 0 -50%; }
.tile.wide .tile-body { min-width: 96px; }
.tile-stats { display: flex; gap: 14px; flex: none; }
.tile-stat { display: grid; gap: 1px; }
.tile-stat b { font-size: 18px; font-weight: 600; line-height: 1.15; letter-spacing: -0.02em; }
.tile-stat span { font-size: 11px; color: var(--muted); white-space: nowrap; }
.tile-stat.is-zero b { color: var(--muted); font-weight: 500; }
.tile-stat.is-action b::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 5px; border-radius: 50%; background: var(--accent); vertical-align: 0.5em; box-shadow: 0 0 8px var(--accent); }
@media (max-width: 380px) { .tile.wide { grid-column: auto; } }

.dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--hairline); }
.dot.up { background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 18%, transparent), 0 0 10px color-mix(in srgb, var(--good) 60%, transparent); }
.chip { display: inline-flex; align-items: center; gap: 4px; flex: none; height: 22px; padding: 0 8px 0 6px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.chip .icon { width: 12px; height: 12px; stroke-width: 2.4; }
.chip.icon-chip { width: 22px; padding: 0; justify-content: center; }
.tile-sub.bad { color: var(--critical-ink); font-weight: 600; }
.chip.down { background: color-mix(in srgb, var(--critical) 20%, transparent); color: var(--critical-ink); }
.chip.tls { background: color-mix(in srgb, var(--warning) 26%, transparent); color: var(--ink); }

.tile-add { justify-content: center; border-style: dashed; background: transparent; box-shadow: none; color: var(--muted); cursor: pointer; font: inherit; }
.tile-add:hover { color: var(--ink); translate: none; box-shadow: none; border-color: var(--muted); }
.tile-add::before { display: none; }
.editing .tile:not(.tile-add) { cursor: grab; }
.editing .tile .dot, .editing .tile .chip { display: none; }
.tile-edit { color: var(--muted); }
.group-add { margin-top: 18px; }

/* ---------- tasks ---------- */
.task-form { display: flex; gap: 8px; margin-bottom: 12px; }
.task-form .input { flex: 1; min-width: 0; }
.task-form input[type="date"] { width: 144px; flex: none; color: var(--ink-2); }
.task { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-top: 1px solid var(--hairline); }
.task:first-child { border-top: 0; }
.task input[type="checkbox"] {
    appearance: none;
    width: 18px;
    height: 18px;
    margin: 1px 0 0;
    flex: none;
    border: 1.5px solid var(--muted);
    border-radius: 6px;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background 0.15s, border-color 0.15s, scale 0.15s;
}
.task input[type="checkbox"]:hover { border-color: var(--accent); scale: 1.08; }
.task input[type="checkbox"]:checked { background: var(--grad); border-color: transparent; }
.task input[type="checkbox"]:checked::after { content: ""; width: 9px; height: 5px; border: solid var(--on-accent); border-width: 0 0 2px 2px; rotate: -45deg; translate: 0 -1px; }
.task-title { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.task.done .task-title { color: var(--muted); text-decoration: line-through; }
.due { flex: none; font-size: 12px; color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; margin-top: 2px; }
.due.today { color: var(--ink); font-weight: 600; }
.due.late { color: var(--critical-ink); font-weight: 600; }
.due .icon { width: 13px; height: 13px; stroke-width: 2.2; }
.task-del { flex: none; width: 24px; height: 24px; margin: -1px -4px 0 0; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; opacity: 0; display: grid; place-items: center; }
.task:hover .task-del, .task-del:focus-visible { opacity: 1; }
.task-del:hover { background: var(--raised); color: var(--ink); }
.task-del .icon { width: 14px; height: 14px; }
@media (hover: none) { .task-del { opacity: 1; } }
.done-block { margin-top: 10px; border-top: 1px solid var(--hairline); padding-top: 10px; }
.done-block summary { cursor: pointer; font-size: 12px; color: var(--muted); display: flex; align-items: center; justify-content: space-between; list-style: none; }
.done-block summary::-webkit-details-marker { display: none; }
.linkish { border: 0; background: none; padding: 0; color: var(--accent-ink); cursor: pointer; font-size: 12px; }
.linkish:hover { text-decoration: underline; }

/* ---------- server ---------- */
.stat-label { font-size: 12px; color: var(--ink-2); }
.stat-value { font-size: 34px; font-weight: 600; letter-spacing: -0.04em; line-height: 1.1; }
.stat-value small { font-size: 13px; font-weight: 400; letter-spacing: 0; color: var(--muted); margin-left: 6px; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.load-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.load-row .stat-sub { text-align: right; font-variant-numeric: tabular-nums; }

/* The unfilled track is a lighter step of the fill's own hue, so the state reads across the whole bar. */
.meter { --tone: var(--accent); height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--tone) 20%, var(--surface)); margin-top: 10px; }
.meter i { display: block; height: 100%; width: calc(var(--v) * 1%); background: var(--tone); border-radius: 3px; transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1); box-shadow: 0 0 12px color-mix(in srgb, var(--tone) 70%, transparent); }
.meter.warn { --tone: var(--warning); }
.meter.crit { --tone: var(--critical); }

.spark { position: relative; margin-top: 18px; }
.spark svg { display: block; width: 100%; height: 72px; overflow: visible; cursor: crosshair; }
.spark svg:focus-visible { outline-offset: 4px; }
.spark-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; filter: drop-shadow(0 4px 8px color-mix(in srgb, var(--accent) 55%, transparent)); }
.spark-area { fill: url(#spark-fade); }
.spark-stop-a { stop-color: var(--accent); stop-opacity: 0.28; }
.spark-stop-b { stop-color: var(--accent); stop-opacity: 0; }
.spark-grid { stroke: var(--hairline); stroke-width: 1; }
.spark-cross { stroke: var(--muted); stroke-width: 1; }
.spark-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.spark-axis { display: flex; justify-content: space-between; font: 11px var(--mono); color: var(--muted); margin-top: 6px; }
.spark-max { position: absolute; top: -7px; right: 0; font: 11px var(--mono); color: var(--muted); }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 20px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--hairline); }
.stats .stat-value { font-size: 23px; letter-spacing: -0.03em; }
.problems { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--hairline); display: grid; gap: 8px; }
.problem { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; }
.problem span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- notifications and backups ---------- */
.alerts-card { margin-top: 24px; scroll-margin-top: 92px; }
.unread-banner { background: #b42323; color: #fff; }
.unread-banner a { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px 12px; padding: 12px 16px; font-weight: 600; text-align: center; }
.unread-banner a:hover { background: rgba(0, 0, 0, 0.12); }
.unread-banner a:focus-visible { outline: 2px solid #fff; outline-offset: -4px; }
.unread-banner-action { font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
#alerts-count { color: var(--critical-ink); }
#alerts-history { margin-top: 12px; font-size: 13px; }
#alerts-history summary { cursor: pointer; color: var(--ink-2); }
.alert-list { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 10px; }
.alert-item { display: block; padding: 10px 12px; border-radius: 10px; background: var(--raised); font-size: 13px; overflow-wrap: anywhere; }
.alert-item p { margin: 4px 0 0; color: var(--ink-2); }
.alert-item small { display: block; margin-top: 4px; color: var(--muted); }
.alert-item.unread { border-left: 3px solid var(--accent); }
.alert-item.problem strong { color: var(--critical-ink); }
#alerts-active { display: grid; gap: 8px; margin-top: 10px; }
.backup-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn:disabled { opacity: 0.5; cursor: default; }

/* ---------- notes ---------- */
.notes { display: block; width: 100%; min-height: 150px; resize: vertical; border: 0; background: transparent; padding: 0; line-height: 1.6; outline: none; }
.notes::placeholder { color: var(--muted); }

/* ---------- tooltip, toast, dialog ---------- */
.tip { position: fixed; z-index: 50; pointer-events: none; max-width: 280px; padding: 9px 11px; border-radius: 11px; background: var(--ink); color: var(--page); font-size: 12px; line-height: 1.4; box-shadow: 0 12px 30px -8px rgba(0, 0, 0, 0.5); }
.tip b { display: block; font-size: 13px; }
.tip span { display: block; opacity: 0.75; }

.toast { position: fixed; left: 50%; bottom: 24px; translate: -50% 0; z-index: 60; padding: 10px 16px; border-radius: 12px; background: var(--ink); color: var(--page); font-size: 13px; box-shadow: 0 12px 30px -8px rgba(0, 0, 0, 0.5); animation: rise 0.3s both; }
.toast.error { background: var(--critical); color: #fff; }

dialog { width: min(480px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid var(--border); border-radius: 22px; background: var(--glass-strong); backdrop-filter: blur(30px) saturate(1.5); color: var(--ink); box-shadow: inset 0 1px 0 var(--edge), 0 40px 80px -20px rgba(0, 0, 0, 0.6); }
dialog[open] { animation: rise 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
dialog::backdrop { background: rgba(4, 4, 8, 0.55); backdrop-filter: blur(6px); }
.dialog-form { display: grid; gap: 14px; padding: 24px; }
.dialog-form h2 { font-size: 19px; letter-spacing: -0.02em; }
.dialog-form h3 { font-size: 13px; margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--hairline); }
.dialog-foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }
.dialog-foot .spacer { flex: 1; }
.inline { display: flex; gap: 8px; }
.inline .input { flex: 1; min-width: 0; }
.geo-results { display: grid; gap: 4px; }
.geo-results button { text-align: left; height: auto; padding: 8px 12px; justify-content: flex-start; white-space: normal; }
.geo-results small { color: var(--muted); margin-left: 6px; }

/* ---------- login ---------- */
.login-page { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); display: grid; gap: 18px; padding: 32px; background: var(--glass); backdrop-filter: blur(30px) saturate(1.5); border: 1px solid var(--border); border-radius: 26px; box-shadow: inset 0 1px 0 var(--edge), var(--shadow); animation: rise 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.login-card h1 { font-size: 24px; letter-spacing: -0.03em; }
.login-card .brand-mark { width: 48px; height: 48px; border-radius: 14px; box-shadow: 0 14px 30px -10px var(--grad-glow); }
.login-card .btn { height: 42px; }
.login-card .field input { height: 42px; }

/* ---------- small screens ---------- */
@media (max-width: 720px) {
    .brand span, .search kbd, .btn .label { display: none; }
    .topbar-inner { gap: 8px; padding-inline: 10px 6px; }
    .weather { flex-direction: column; gap: 12px; width: 100%; }
    .weather-days { border-left: 0; padding-left: 0; border-top: 1px solid var(--hairline); padding-top: 12px; }
    .tiles { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
    .card { padding-inline: 14px; }
    .task-form { flex-wrap: wrap; }
}

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