/* ================================================================== fonts */

/* Variable fonts: one file covers every weight. Served by us, not Google. */
@font-face {
    font-family: 'Geist';
    src: url("../fonts/Geist-Variable-JPmcLdE.woff2") format('woff2');
    font-weight: 100 900;
    font-display: swap;
}

@font-face {
    font-family: 'Geist Mono';
    src: url("../fonts/GeistMono-Variable-3oANg-g.woff2") format('woff2');
    font-weight: 100 900;
    font-display: swap;
}

/* ================================================================= tokens */

:root {
    --font: 'Geist', ui-sans-serif, system-ui, sans-serif;
    --font-mono: 'Geist Mono', ui-monospace, monospace;
    --radius: 10px;
    --radius-card: 16px;
    --header-height: 64px;

    /* Light: warm, neutral greys; the accent is the only blue. */
    --bg: #f6f5f2;
    --surface: #ffffff;
    --surface-2: #efeee9;
    --border: #e6e4df;
    --text: #14161a;
    --muted: #5f6166;
    --accent: #3157e0;
    --accent-hover: #2442b8;
    --accent-soft: #eaeffe;
    --accent-text: #2442b8;
    --on-accent: #ffffff;
    --shadow: 0 10px 30px rgb(20 22 26 / 0.12);

    /* Device states: each also has its own shape, never colour alone */
    --online: #3157e0;
    --online-soft: #eaeffe;
    --sleeping: #6b6d72;
    --sleeping-soft: #eeede9;
    --offline: #b4460f;
    --offline-soft: #fbe9dd;
    --missed: #c27803;
    --missed-soft: #fdf1d6;
    --missed-text: #8a4b00;
}

/* Dark: from the operating system, unless the page says otherwise. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme='light']) {
        --bg: #0b0f14;
        --surface: #12171e;
        --surface-2: #19202a;
        --border: #252d3a;
        --text: #e7eaf0;
        --muted: #9aa4b4;
        --accent: #7b93ff;
        --accent-hover: #a3b4ff;
        --accent-soft: #1b2546;
        --accent-text: #b3c1ff;
        --on-accent: #0b0f14;
        --shadow: 0 10px 30px rgb(0 0 0 / 0.45);

        --online: #7b93ff;
        --online-soft: #1b2546;
        --sleeping: #9aa4b4;
        --sleeping-soft: #1c222b;
        --offline: #f08a4b;
        --offline-soft: #33200f;
        --missed: #fbbf24;
        --missed-soft: #2e2410;
        --missed-text: #fcd34d;
    }
}

/* The same dark values, chosen explicitly with the header's button. */
:root[data-theme='dark'] {
    --bg: #0b0f14;
    --surface: #12171e;
    --surface-2: #19202a;
    --border: #252d3a;
    --text: #e7eaf0;
    --muted: #9aa4b4;
    --accent: #7b93ff;
    --accent-hover: #a3b4ff;
    --accent-soft: #1b2546;
    --accent-text: #b3c1ff;
    --on-accent: #0b0f14;
    --shadow: 0 10px 30px rgb(0 0 0 / 0.45);

    --online: #7b93ff;
    --online-soft: #1b2546;
    --sleeping: #9aa4b4;
    --sleeping-soft: #1c222b;
    --offline: #f08a4b;
    --offline-soft: #33200f;
    --missed: #fbbf24;
    --missed-soft: #2e2410;
    --missed-text: #fcd34d;
}

/* =================================================================== base */

html,
body {
    margin: 0;
    height: 100%;
    font-family: var(--font);
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

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

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

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

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

.mono,
.device-id {
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ================================================================= layout */

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

.app-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 28px;
    min-height: var(--header-height);
    padding: 0 28px;
    flex-shrink: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.01em;
    text-decoration: none;
}

.brand svg {
    color: var(--accent);
}

.brand:hover {
    color: var(--text);
}

.app-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.app-nav a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 0 14px;
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
}

.app-nav a:hover {
    background: var(--surface-2);
}

.app-nav a[aria-current='page'] {
    background: var(--accent-soft);
    color: var(--accent-text);
    font-weight: 600;
}

.app-user {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: auto;
    color: var(--muted);
}

.app-user .button {
    min-height: 40px;
}

.app-main {
    flex: 1;
    min-height: 0; /* lets the main area shrink, so pages scroll inside it */
    overflow: auto;
    padding: 32px 28px 48px;
}

/* Pages that fill the whole area, like the map */
.app-main--full {
    padding: 0;
    overflow: hidden;
}

/* ================================================================ buttons */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.button:hover {
    background: var(--surface-2);
    color: var(--text);
}

.button--primary {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--on-accent);
}

.button--primary:hover {
    border-color: var(--accent-hover);
    background: var(--accent-hover);
    color: var(--on-accent);
}

/* Text-coloured: the sign-in page's main button */
.button--ink {
    border-color: var(--text);
    background: var(--text);
    color: var(--bg);
}

.button--ink:hover {
    border-color: var(--text);
    background: var(--text);
    color: var(--bg);
    opacity: 0.88;
}

.icon-button {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}

.icon-button:hover {
    background: var(--surface-2);
}

/* Moon in light mode (switch to dark), sun in dark mode (switch to light). */
.theme-icon--sun {
    display: none;
}

:root[data-theme='dark'] .theme-icon--sun {
    display: block;
}

:root[data-theme='dark'] .theme-icon--moon {
    display: none;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme='light']) .theme-icon--sun {
        display: block;
    }

    :root:not([data-theme='light']) .theme-icon--moon {
        display: none;
    }
}

/* ================================================================== pages */

.page {
    display: grid;
    gap: 22px;
    max-width: 1280px;
    margin: 0 auto;
}

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
}

.page-header h1 {
    margin: 0;
    font-size: 30px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.page-header-link {
    margin-left: auto;
}

.card {
    display: grid;
    align-content: start;
    gap: 14px;
    min-width: 0;
    padding: 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
}

.card h2 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
}

.card-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-note {
    margin: 0;
}

/* ========================================================= states: shapes */

/* Online ●, sleeping ○, offline ■, missed check-in ▲, no recent data ◌ */
.dot {
    display: inline-block;
    flex: none;
    width: 10px;
    height: 10px;
    margin-right: 8px;
    box-sizing: border-box;
    border-radius: 50%;
    background: var(--sleeping);
    vertical-align: middle;
}

.dot--online {
    background: var(--online);
}

.dot--sleeping {
    background: transparent;
    border: 2px solid var(--sleeping);
}

.dot--offline {
    border-radius: 2px;
    background: var(--offline);
}

.dot--missed {
    width: 0;
    height: 0;
    border-radius: 0;
    background: none;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 10px solid var(--missed);
}

.dot--stale {
    background: transparent;
    border: 2px dashed var(--sleeping);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--sleeping-soft);
    color: var(--sleeping);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.badge--online {
    background: var(--online-soft);
    color: var(--online);
}

.badge--offline {
    background: var(--offline-soft);
    color: var(--offline);
}

.badge--missed {
    background: var(--missed-soft);
    color: var(--missed-text);
}

/* ========================================================== facts, tables */

/* Label–value pairs, e.g. Health and Identity */
.facts {
    display: grid;
    gap: 12px;
    margin: 0;
}

.facts div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.facts dt {
    color: var(--muted);
}

.facts dd {
    margin: 0;
    font-weight: 500;
    text-align: right;
    overflow-wrap: anywhere;
}

.table-scroll {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
}

.table th {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    white-space: nowrap;
}

.table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table tbody tr:hover {
    background: var(--surface-2);
}

/* ============================================================ device page */

.device-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    gap: 22px;
    align-items: start;
}

@media (max-width: 900px) {
    .device-grid {
        grid-template-columns: 1fr;
    }
}

.device-side {
    display: grid;
    gap: 22px;
}

.day-picker {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
}

.day-picker input {
    min-height: 40px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
}

/* Sized with height, not positioning: MapLibre sets position: relative on it. */
.track-map {
    height: 440px;
    border-radius: 12px;
    overflow: hidden;
}

/* =============================================================== live map */

.live-layout {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
    height: 100%;
}

@media (max-width: 800px) {
    .live-layout {
        grid-template-columns: 1fr;
        grid-template-rows: 40% 60%;
    }
}

.live-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
}

.live-panel-head {
    display: grid;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.search {
    width: 100%;
    box-sizing: border-box;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
}

.filters {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.filter {
    flex: none;
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.filter[aria-pressed='true'] {
    background: var(--text);
    border-color: var(--text);
    color: var(--bg);
}

.filter-count {
    opacity: 0.7;
    font-variant-numeric: tabular-nums;
}

.device-list {
    flex: 1;
    min-height: 0;
    margin: 0;
    padding: 6px 0;
    overflow-y: auto;
    list-style: none;
}

.device-row {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    width: 100%;
    padding: 12px 16px;
    border: 0;
    border-left: 3px solid transparent;
    background: none;
    color: var(--text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.device-row:hover,
.device-row:focus-visible {
    background: var(--surface-2);
}

/* The selected row */
.device-row[aria-pressed='true'] {
    background: var(--accent-soft);
    border-left-color: var(--accent);
}

.device-row-meta {
    grid-column: 2;
    color: var(--muted);
    font-size: 13px;
}

.device-list-empty {
    padding: 16px;
    color: var(--muted);
}

.live-stage {
    position: relative;
    min-width: 0;
    min-height: 0;
}

/* Sized with width/height rather than absolute positioning: MapLibre adds
   position: relative to the map element, which would cancel an inset-based layout. */
.live-map {
    width: 100%;
    height: 100%;
}

.live-status {
    position: absolute;
    top: 16px;
    left: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 13px;
    font-weight: 500;
}

.live-status::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--muted);
}

.live-status[data-state='live']::before {
    background: #0f9f6e;
}

.live-status[data-state='reconnecting'] {
    background: var(--offline-soft);
    color: var(--offline);
}

.live-status[data-state='reconnecting']::before {
    background: var(--offline);
}

.tracking-banner {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 8px 8px 16px;
    border-radius: 999px;
    background: var(--text);
    color: var(--bg);
    box-shadow: var(--shadow);
    white-space: nowrap;
}

.tracking-banner[hidden] {
    display: none;
}

.tracking-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
}

.tracking-banner button {
    min-height: 36px;
    padding: 0 14px;
    border: 0;
    border-radius: 999px;
    background: var(--bg);
    color: var(--text);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.map-legend {
    position: absolute;
    right: 16px;
    bottom: 36px;
    display: grid;
    gap: 6px;
    margin: 0;
    padding: 12px 14px;
    list-style: none;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--muted);
    font-size: 13px;
}

.map-legend li {
    display: flex;
    align-items: center;
}

.selection-card {
    position: absolute;
    left: 16px;
    bottom: 16px;
    width: 320px;
    max-width: calc(100% - 32px);
    display: grid;
    gap: 14px;
    padding: 18px;
    border-radius: var(--radius-card);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.selection-card[hidden] {
    display: none;
}

.selection-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.selection-head strong {
    font-size: 17px;
    font-weight: 600;
}

.selection-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 0;
}

.selection-facts dt {
    color: var(--muted);
    font-size: 12px;
}

.selection-facts dd {
    margin: 2px 0 0;
    font-weight: 500;
}

.selection-actions {
    display: flex;
    gap: 10px;
}

.selection-actions .button {
    flex: 1;
}

.selection-actions .button[aria-pressed='true'] {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent-text);
}

/* MapLibre's own controls, in the theme's colours */
.maplibregl-ctrl-group {
    background: var(--surface) !important;
    border: 1px solid var(--border);
    box-shadow: none !important;
}

.maplibregl-ctrl-group button + button {
    border-top-color: var(--border) !important;
}

:root[data-theme='dark'] .maplibregl-ctrl-icon {
    filter: invert(1);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme='light']) .maplibregl-ctrl-icon {
        filter: invert(1);
    }
}

/* ================================================================ sign-in */

.signin {
    min-height: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 36px;
    padding: 40px 20px;
}

/* The logo mark, pinging like a radar, with a dot orbiting it */
.signin-mark {
    position: relative;
    width: 96px;
    height: 96px;
    color: var(--accent);
}

.signin-mark svg {
    position: absolute;
    inset: 0;
}

.signin-ping {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--accent);
    animation: signin-ping 2.6s ease-out infinite;
}

.signin-orbit {
    position: absolute;
    inset: 0;
    animation: signin-orbit 6s linear infinite;
}

.signin-orbit::after {
    content: '';
    position: absolute;
    left: 50%;
    top: -5px;
    width: 10px;
    height: 10px;
    margin-left: -5px;
    border-radius: 50%;
    background: var(--text);
    border: 2px solid var(--bg);
}

.signin-main {
    width: min(360px, 100%);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.signin-heading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
}

.signin-heading h1 {
    margin: 0;
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.signin-heading p {
    margin: 0;
}

.signin-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-weight: 500;
}

.field input {
    min-height: 48px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-weight: 400;
}

.signin-submit {
    min-height: 50px;
    margin-top: 6px;
    border-radius: 12px;
}

.signin-footer {
    margin: 0;
    font-size: 13px;
}

.login-error {
    margin: 0;
    padding: 10px 12px;
    border-radius: var(--radius);
    background: var(--offline-soft);
    color: var(--offline);
    font-weight: 500;
}

@keyframes signin-ping {
    from { transform: scale(0.6); opacity: 0.7; }
    to { transform: scale(1.6); opacity: 0; }
}

@keyframes signin-orbit {
    to { transform: rotate(360deg); }
}

/* People who asked their system for less motion get a still picture. */
@media (prefers-reduced-motion: reduce) {
    .signin-ping,
    .signin-orbit {
        animation: none;
    }
}

/* ============================================== device history, calendar */

.history {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

@media (max-width: 900px) {
    .history {
        grid-template-columns: 1fr;
    }
}

.history-main {
    display: grid;
    gap: 12px;
    min-width: 0;
}

.calendar {
    display: grid;
    gap: 10px;
}

.calendar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.calendar-head .icon-button:disabled {
    opacity: 0.4;
    cursor: default;
}

.calendar-weekdays,
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 2px;
}

.calendar-weekdays {
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.calendar-day {
    position: relative;
    height: 38px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-variant-numeric: tabular-nums;
    opacity: 0.45;
    cursor: not-allowed;
}

.calendar-day.has-data {
    color: var(--text);
    font-weight: 600;
    opacity: 1;
    cursor: pointer;
}

/* A small dot under every day with data */
.calendar-day.has-data::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 5px;
    width: 4px;
    height: 4px;
    margin-left: -2px;
    border-radius: 50%;
    background: var(--accent);
}

.calendar-day.has-data:hover {
    background: var(--surface-2);
}

.calendar-day[aria-pressed='true'] {
    background: var(--accent);
    color: var(--on-accent);
}

.calendar-day[aria-pressed='true']::after {
    background: var(--on-accent);
}

.calendar-day[aria-pressed='true']:hover {
    background: var(--accent);
}

.calendar-note {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-size: 12px;
}

.calendar-note-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent);
}

/* ================================================= slider and playback */

.player {
    display: flex;
    align-items: center;
    gap: 14px;
}

.play-button {
    flex: none;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: var(--accent);
    color: var(--on-accent);
    cursor: pointer;
}

.play-button:disabled {
    opacity: 0.4;
    cursor: default;
}

.play-button .pause-icon,
.play-button.is-playing .play-icon {
    display: none;
}

.play-button.is-playing .pause-icon {
    display: block;
}

.scrubber {
    flex: 1;
    display: flex;
}

.scrubber input {
    width: 100%;
    accent-color: var(--accent);
}

.speed-select {
    min-height: 40px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font: inherit;
}

.readout {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 28px;
    margin: 0;
    padding: 14px 16px;
    border-radius: 12px;
    background: var(--surface-2);
    font-variant-numeric: tabular-nums;
}

.readout dt {
    color: var(--muted);
    font-size: 12px;
}

.readout dd {
    margin: 2px 0 0;
    font-size: 17px;
    font-weight: 600;
}

.readout-late[hidden] {
    display: none;
}

/* MapLibre's attribution, in the theme's colours */
.maplibregl-ctrl-attrib {
    background: color-mix(in srgb, var(--surface) 85%, transparent) !important;
    color: var(--muted);
}

.maplibregl-ctrl-attrib a {
    color: var(--muted) !important;
}

.maplibregl-ctrl-attrib-button {
    background-color: transparent !important;
}

:root[data-theme='dark'] .maplibregl-ctrl-attrib-button {
    filter: invert(1);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme='light']) .maplibregl-ctrl-attrib-button {
        filter: invert(1);
    }
}

/* ================================================================ settings */

.settings {
    max-width: 760px;
}

.app-user-name {
    color: var(--muted);
    text-decoration: none;
}

.app-user-name:hover,
.app-user-name[aria-current='page'] {
    color: var(--text);
}

.notice {
    margin: 0;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-weight: 500;
}

.notice--success {
    background: var(--online-soft);
    color: var(--accent-text);
}

.notice--error {
    background: var(--offline-soft);
    color: var(--offline);
}

.field-label {
    margin-bottom: 8px;
    padding: 0;
    font-weight: 500;
}

.field select,
.field input {
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-weight: 400;
}

.field-hint {
    color: var(--muted);
    font-size: 13px;
    font-weight: 400;
}

.field-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
}

.theme-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 0;
    padding: 0;
    border: 0;
}

.theme-option {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
}

.theme-option:has(input:checked) {
    border-color: var(--accent);
}

.theme-option:has(input:focus-visible) {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Little sketches of each theme; fixed colours, whatever the current theme. */
.theme-preview {
    display: grid;
    gap: 6px;
    height: 64px;
    padding: 8px;
    box-sizing: border-box;
    border-radius: 8px;
    border: 1px solid #d6d4cf;
}

.theme-preview--light {
    background: #f6f5f2;
}

.theme-preview--dark {
    background: #0b0f14;
    border-color: #252d3a;
}

.theme-preview--system {
    background: linear-gradient(90deg, #f6f5f2 50%, #0b0f14 50%);
}

.theme-preview-bar {
    width: 60%;
    height: 8px;
    border-radius: 4px;
    background: #7b93ff;
}

.theme-preview-card {
    border-radius: 6px;
    background: rgb(127 130 140 / 0.35);
}

.filters {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
