/* ------------------------------------------------------------------ */
/* Theme                                                               */
/* ------------------------------------------------------------------ */
:root {
    color-scheme: light dark;

    --bg: #f4f5f7;
    --surface: #ffffff;
    --surface-2: #eef0f3;
    --text: #1c2027;
    --text-muted: #5f6672;
    --line: #dde0e5;
    --line-strong: #c4c9d1;
    --accent: #2563eb;
    --now: #e5484d;
    --now-bg: #fff4e5;
    --film: #7c3aed;
    --film-bg: #f1eafe;
    --sport: #15803d;
    --sport-bg: #e4f6ea;
    --doc: #b45309;
    --doc-bg: #fdf1e3;
    --star: #f59e0b;
    --star-off: #d4d7dd;
    --age-adult: #dc2626;

    /* Board scaling: everything inside the board is sized in em, so changing --zoom scales it all. */
    --base-font: 14px;
    --col-w: 17em;
    --aside-w: 3.5em;
    --ppm: 0.27em; /* timeline: height of one minute (set from render.js) */
    --axis-w: 3.4em; /* time axis on the left */
    --head-h: 3.4em; /* channel header height */

    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #111317;
        --surface: #1a1d23;
        --surface-2: #22262e;
        --text: #e7e9ee;
        --text-muted: #9aa1ad;
        --line: #2c313a;
        --line-strong: #3a404b;
        --accent: #6ea0ff;
        --now: #ff6b6f;
        --now-bg: #2c2418;
        --film: #8b5cf6;
        --film-bg: #2a2140;
        --sport: #16a34a;
        --sport-bg: #16301f;
        --doc: #c2620a;
        --doc-bg: #33261a;
        --star: #fbbf24;
        --star-off: #464c57;
        --age-adult: #ef4444;
    }
}

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

html, body {
    height: 100%;
    margin: 0;
    overflow: hidden; /* only the board scrolls */
    background: var(--bg);
    color: var(--text);
}

button { font: inherit; color: inherit; cursor: pointer; }

/* ------------------------------------------------------------------ */
/* Layout                                                              */
/* ------------------------------------------------------------------ */
.app {
    display: flex;
    flex-direction: column;
    height: 100dvh;
}

.topbar {
    flex: none;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1.25rem;
    padding: 0.5rem 0.75rem;
    padding-top: max(0.5rem, env(safe-area-inset-top));
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    z-index: 20;
}

.day-nav { display: flex; align-items: center; gap: 0.5rem; }

.day-label {
    display: flex;
    flex-direction: column;
    min-width: 11.5rem;
    text-align: center;
    line-height: 1.2;
}
.day-label__weekday { font-weight: 700; font-size: 1.05rem; }
.day-label__weekday::first-letter { text-transform: uppercase; }
.day-label__date { font-size: 0.85rem; color: var(--text-muted); }

.icon-btn {
    width: 2.25rem;
    height: 2.25rem;
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    background: var(--surface-2);
    font-size: 1.3rem;
    line-height: 1;
}
.icon-btn:disabled { opacity: 0.35; cursor: default; }

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    flex: 1;
}

.segmented {
    display: inline-flex;
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    overflow: hidden;
    background: var(--surface-2);
}
.segmented button {
    border: 0;
    background: transparent;
    padding: 0.4rem 0.75rem;
    font-size: 0.9rem;
}
.segmented button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.segmented a {
    padding: 0.4rem 0.75rem;
    font-size: 0.9rem;
    color: inherit;
    text-decoration: none;
}
.segmented a[aria-current="page"] { background: var(--accent); color: #fff; }

.zoom { display: inline-flex; align-items: center; gap: 0.25rem; }
.zoom__value {
    min-width: 3.5rem;
    border: 0;
    background: none;
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
}

.now-btn {
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    background: var(--surface-2);
    padding: 0.4rem 0.75rem;
    font-size: 0.9rem;
}

.filters:empty { display: none; }

/* ------------------------------------------------------------------ */
/* Board (scrollable, zoomable)                                        */
/* ------------------------------------------------------------------ */
.board {
    --zoom: 1;
    position: relative;
    flex: 1;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    touch-action: pan-x pan-y; /* pinch is handled by the app */
    font-size: calc(var(--base-font) * var(--zoom));
    outline: none;
    /* The board is panned by dragging: no text selection, a "hand" cursor, pointer over clickable items. */
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}
.board.is-dragging,
.board.is-dragging * { cursor: grabbing !important; }

.board__status {
    position: sticky;
    left: 0;
    padding: 2rem 1rem;
    font-size: 1rem;
    color: var(--text-muted);
    text-align: center;
}
.board__status[hidden] { display: none; }

.grid {
    display: grid;
    grid-template-columns: var(--axis-w) repeat(var(--cols), var(--col-w));
    width: max-content;
    min-height: 100%;
    background: var(--surface);
}

/* Channel headers (sticky) ------------------------------------------ */
.ch-head {
    grid-row: 1;
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 0.6em;
    height: var(--head-h);
    padding: 0 0.7em;
    background: var(--surface);
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line-strong);
    box-shadow: 0 2px 4px rgb(0 0 0 / 0.06);
}
.ch-head__logo {
    flex: none;
    display: grid;
    place-items: center;
    width: 3.6em;
    height: 2.4em;
    padding: 0.25em 0.35em;
    border-radius: 0.4em;
    background: #fff;
    border: 1px solid var(--line);
}
.ch-head__logo--dark { background: #2a2e36; border-color: #2a2e36; } /* for white logos */
.ch-head__logo img { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.ch-head__name {
    font-weight: 700;
    font-size: 1em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Time axis (sticky on the left) ------------------------------------ */
.axis-head {
    grid-row: 1;
    grid-column: 1;
    position: sticky;
    top: 0;
    left: 0;
    z-index: 12;
    background: var(--surface);
    border-right: 1px solid var(--line-strong);
    border-bottom: 1px solid var(--line-strong);
}
.axis {
    grid-column: 1;
    position: sticky;
    left: 0;
    z-index: 8;
    background: var(--surface-2);
    border-right: 1px solid var(--line-strong);
    box-shadow: 2px 0 4px rgb(0 0 0 / 0.05);
}
.axis__hour {
    position: absolute;
    left: 0;
    right: 0;
    margin-top: -1px;
    padding: 0.2em 0 0;
    border-top: 1px solid var(--line-strong);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: center;
    color: var(--text-muted);
}
.axis__hour:first-child { border-top: 0; }
.axis__hour span { font-size: 0.8em; }
.axis__range {
    position: sticky;
    top: calc(var(--head-h) + 0.3em);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.35em 0;
    font-variant-numeric: tabular-nums;
}
.axis__from { font-size: 0.85em; font-weight: 800; color: var(--accent); }
.axis__to { font-size: 0.68em; color: var(--text-muted); }

/* Programme --------------------------------------------------------- */
.prog {
    --aside-bg: var(--surface-2);
    display: grid;
    grid-template-columns: var(--aside-w) 1fr;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
    cursor: pointer;
    overflow: hidden;
}
.prog:hover .prog__title { color: var(--accent); }
.prog.tag-film { --aside-bg: var(--film-bg); }
.prog.tag-sport { --aside-bg: var(--sport-bg); }
.prog.tag-doc { --aside-bg: var(--doc-bg); }

.prog__aside {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3em;
    padding: 0.45em 0.2em;
    background: var(--aside-bg);
    border-right: 1px solid var(--line);
}
.prog__time {
    font-weight: 700;
    font-size: 0.92em;
    font-variant-numeric: tabular-nums;
}

.badge {
    display: inline-block;
    padding: 0.2em 0.45em;
    border-radius: 0.35em;
    font-size: 0.64em;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1.15;
    color: #fff;
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.25);
}
.badge--film { background: var(--film); }
.badge--sport { background: var(--sport); }
.badge--doc { background: var(--doc); letter-spacing: 0; font-size: 0.5em; padding-inline: 0.3em; }

/* Rating: 5 small stars, the gold part clipped to --stars (0-5, halves). */
.stars {
    position: relative;
    display: inline-block;
    font-size: 0.6em;
    line-height: 1;
    letter-spacing: 0.02em;
    white-space: nowrap;
    color: var(--star-off);
}
.stars::before { content: "★★★★★"; }
.stars::after {
    content: "★★★★★";
    position: absolute;
    inset: 0;
    width: calc(var(--stars) / 5 * 100%);
    overflow: hidden;
    color: var(--star);
}

/* Age limit: discreet for 7+/12+, red for 16+/18+. */
.age {
    display: inline-block;
    min-width: 2.3em;
    padding: 0.1em 0.25em;
    border: 1px solid currentColor;
    border-radius: 0.3em;
    font-size: 0.58em;
    font-weight: 700;
    line-height: 1.1;
    text-align: center;
    color: var(--text-muted);
}
.age--adult { color: var(--age-adult); font-weight: 800; }

.prog__main { padding: 0.4em 0.6em 0.5em; min-width: 0; }
.prog__title {
    margin: 0;
    font-size: 1em;
    font-weight: 650;
    line-height: 1.25;
}
.prog__meta {
    margin: 0.15em 0 0;
    font-size: 0.8em;
    color: var(--text-muted);
}
.prog__desc {
    margin: 0.25em 0 0;
    font-size: 0.82em;
    line-height: 1.35;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
}

.prog.is-past { opacity: 0.55; }
.prog.is-now { background: var(--now-bg); }
.prog.is-now .prog__aside { box-shadow: inset 0.22em 0 0 var(--now); }
.prog.is-now .prog__time { color: var(--now); }

/* Timeline view ----------------------------------------------------- */
.col {
    grid-row: 2;
    position: relative;
    border-right: 1px solid var(--line);
}
/* top/height are set inline by render.js */
.view-timeline .prog {
    position: absolute;
    left: 0;
    right: 0;
    border-bottom: 1px solid var(--line-strong);
}
.view-timeline .prog.is-short .prog__aside { padding-top: 0.15em; gap: 0.2em; }
.view-timeline .prog.is-short .prog__main { padding-top: 0.1em; }
.view-timeline .prog.is-short .prog__title { line-height: 1.15; }

/* Delicate dashed line at every full hour, drawn over all channels. */
.hour-lines {
    grid-column: 2 / -1;
    position: relative;
    z-index: 2;
    pointer-events: none;
}
.hour-lines__line {
    position: absolute;
    left: 0;
    right: 0;
    /* -1px: overlap the bottom border of the programme that ends at this hour */
    margin-top: -1px;
    border-top: 1px dashed color-mix(in srgb, var(--text) 11%, transparent);
}
.view-timeline .prog__desc { -webkit-line-clamp: 4; line-clamp: 4; }

/* In long blocks keep the time and title visible below the channel headers while scrolling. */
.view-timeline .prog {
    overflow: clip;
    background: linear-gradient(to right, var(--aside-bg) calc(var(--aside-w) - 1px), var(--line) 0 var(--aside-w), var(--surface) 0);
}
.view-timeline .prog.is-now {
    background: linear-gradient(to right, var(--now) 0.22em, var(--aside-bg) 0 calc(var(--aside-w) - 1px), var(--line) 0 var(--aside-w), var(--now-bg) 0);
}
.view-timeline .prog__aside,
.view-timeline .prog.is-now .prog__aside {
    position: sticky;
    top: var(--head-h);
    align-self: start;
    background: none;
    border-right: 0;
    box-shadow: none;
}
.view-timeline .prog__main {
    position: sticky;
    top: var(--head-h);
    align-self: start;
}

.now-line {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(var(--now-min) * var(--ppm));
    height: 2px;
    background: var(--now);
    z-index: 5;
    pointer-events: none;
}
.now-line::before {
    content: "";
    position: absolute;
    left: -1px;
    top: -3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--now);
}

/* List view --------------------------------------------------------- */
.cell {
    border-right: 1px solid var(--line);
    padding-bottom: 0.6em;
}
.anchor {
    grid-column: 1 / -1;
    height: 0.35em;
    border-top: 2px solid var(--accent);
    background: var(--surface-2);
}

/* Channel panel ----------------------------------------------------- */
html:has(body.page-scroll),
body.page-scroll { height: auto; overflow: auto; }

.tool-link {
    display: inline-block;
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    background: var(--surface-2);
    padding: 0.4rem 0.75rem;
    font-size: 0.9rem;
    color: inherit;
    text-decoration: none;
}
.toolbar .tool-link { margin-left: auto; }

.primary-btn {
    border: 0;
    border-radius: 0.5rem;
    background: var(--accent);
    color: #fff;
    padding: 0.45rem 1.1rem;
    font-weight: 600;
}
.primary-btn.is-dirty { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.primary-btn:disabled { opacity: 0.6; }

.channels__bar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 0.75rem;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}
.channels__title { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.channels__title h1 { margin: 0; font-size: 1.25rem; }
.channels__count { color: var(--text-muted); font-size: 0.9rem; }
.channels__tools { display: flex; align-items: center; gap: 0.5rem 0.75rem; flex-wrap: wrap; }
.channels__search {
    flex: 1 1 14rem;
    max-width: 24rem;
    padding: 0.45rem 0.7rem;
    border: 1px solid var(--line-strong);
    border-radius: 0.5rem;
    background: var(--surface);
    color: inherit;
    font: inherit;
}
.channels__toggle { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.9rem; color: var(--text-muted); }
.channels__tools .primary-btn { margin-left: auto; }
.channels__notice { margin: 0; color: var(--sport); font-weight: 600; font-size: 0.9rem; }
.channels__empty { padding: 2rem; text-align: center; color: var(--text-muted); }
.channels__nav { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.channels__hint { flex: 1 1 16rem; font-size: 0.85rem; color: var(--text-muted); }

/* Order list */
.order-list {
    max-width: 44rem;
    margin: 0 auto;
    padding: 0.75rem;
    list-style: none;
    font-size: 14px;
}
.order-row {
    display: flex;
    align-items: center;
    gap: 0.6em;
    margin-bottom: 0.35rem;
    padding: 0.35em 0.5em 0.35em 0;
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    background: var(--surface);
    user-select: none;
    -webkit-user-select: none;
}
.order-row__handle {
    align-self: stretch;
    display: grid;
    place-items: center;
    width: 2.2em;
    font-size: 1.3em;
    color: var(--text-muted);
    cursor: grab;
    touch-action: none; /* dragging the handle must not scroll the page on touch screens */
}
.order-row__pos {
    min-width: 1.8em;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    color: var(--text-muted);
    text-align: right;
}
.order-row__name { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.order-row__actions { display: flex; gap: 0.25rem; }
.order-row__actions .icon-btn { width: 2em; height: 2em; font-size: 1em; }
.order-row__remove:hover { color: var(--now); }
.order-row.is-dragging {
    position: relative;
    z-index: 5;
    border-color: var(--accent);
    box-shadow: 0 8px 24px rgb(0 0 0 / 0.18);
}
.order-list.is-sorting,
.order-list.is-sorting * { cursor: grabbing !important; }
.order-row.is-moved { animation: moved 0.8s ease-out; }
@keyframes moved {
    from { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); }
}

@media (max-width: 600px) {
    .order-row__actions [data-move="top"],
    .order-row__actions [data-move="bottom"] { display: none; }
}

.channels__list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
    gap: 0.4rem;
    margin: 0;
    padding: 0.75rem;
    list-style: none;
    font-size: 14px;
}
.ch-row[hidden] { display: none; }
.ch-row label {
    display: flex;
    align-items: center;
    gap: 0.6em;
    padding: 0.45em 0.6em;
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    background: var(--surface);
    cursor: pointer;
}
.ch-row.is-checked label { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.ch-row.is-empty .ch-row__text { opacity: 0.55; }
.ch-row input { width: 1.1em; height: 1.1em; accent-color: var(--accent); flex: none; }
.ch-row__text { display: flex; flex-direction: column; min-width: 0; }
.ch-row__name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-row__meta { font-size: 0.78em; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Profiles ------------------------------------------------------------ */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.profile-switch select {
    max-width: 12rem;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    background: var(--surface-2);
    color: inherit;
    font: inherit;
    font-size: 0.9rem;
}
.toolbar .profile-switch { margin-left: auto; }
.toolbar .profile-switch + .tool-link { margin-left: 0; }

.channels__profile { font-size: 0.9rem; color: var(--text-muted); }
.channels__profile a { color: inherit; }

.flash { margin: 0; padding: 0.5rem 0.75rem; border-radius: 0.5rem; font-size: 0.9rem; }
.flash--success { background: var(--sport-bg); color: var(--sport); font-weight: 600; }
.flash--warning { background: var(--doc-bg); color: var(--doc); }
.flash--error { background: color-mix(in srgb, var(--now) 12%, var(--surface)); color: var(--now); font-weight: 600; }

.profiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr));
    gap: 1rem;
    align-items: start;
    max-width: 64rem;
    margin: 0 auto;
    padding: 1rem 0.75rem;
}
.card {
    padding: 1rem 1.1rem 1.2rem;
    border: 1px solid var(--line);
    border-radius: 0.75rem;
    background: var(--surface);
}
.card h2 { margin: 0 0 0.4rem; font-size: 1.1rem; }
.card__hint { margin: 0 0 0.9rem; font-size: 0.88rem; color: var(--text-muted); line-height: 1.45; }

.profile-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.5rem; }
.profile-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--line);
    border-radius: 0.6rem;
}
.profile-row.is-active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.profile-row__main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.5rem; min-width: 0; }
.profile-row__name { font-size: 1rem; }
.profile-row__meta { flex-basis: 100%; font-size: 0.8rem; color: var(--text-muted); }
.profile-row__actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0.4rem; }
.profile-row__actions form { margin: 0; }
.profile-row__more { position: relative; }
.profile-row__more summary { list-style: none; cursor: pointer; }
.profile-row__more summary::-webkit-details-marker { display: none; }
.profile-row__menu {
    position: absolute;
    right: 0;
    top: calc(100% + 0.3rem);
    z-index: 5;
    display: grid;
    gap: 0.5rem;
    width: 18rem;
    padding: 0.75rem;
    border: 1px solid var(--line);
    border-radius: 0.6rem;
    background: var(--surface);
    box-shadow: 0 8px 24px rgb(0 0 0 / 0.15);
}
.inline-form { display: flex; gap: 0.4rem; }
.inline-form input { flex: 1; min-width: 0; }
.pill {
    padding: 0.1rem 0.45rem;
    border-radius: 1rem;
    background: var(--accent);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
}
.danger-btn {
    width: 100%;
    border: 1px solid var(--now);
    border-radius: 0.5rem;
    background: none;
    color: var(--now);
    padding: 0.4rem 0.75rem;
    font-size: 0.9rem;
}

.new-profile { display: grid; gap: 1rem; }
.field { display: grid; gap: 0.35rem; margin: 0; padding: 0; border: 0; }
.field > span, .field legend { font-weight: 600; font-size: 0.9rem; margin-bottom: 0.2rem; }
.new-profile input[type="text"], .inline-form input, .choice select {
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--line-strong);
    border-radius: 0.5rem;
    background: var(--surface);
    color: inherit;
    font: inherit;
}
.choice {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.55rem 0.7rem;
    margin-bottom: 0.4rem;
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    cursor: pointer;
}
.choice:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.choice input { margin-top: 0.2rem; accent-color: var(--accent); }
.choice > span { display: grid; gap: 0.2rem; }
.choice small { color: var(--text-muted); font-size: 0.8rem; line-height: 1.35; }
.choice select { justify-self: start; margin-top: 0.15rem; }

/* Users ----------------------------------------------------------------- */
.user-nav { display: inline-flex; align-items: center; gap: 0.75rem; font-size: 0.85rem; }
.user-nav a { color: var(--text-muted); text-decoration: none; white-space: nowrap; }
.user-nav a:hover { color: var(--accent); }
.user-nav__name { font-weight: 600; color: var(--text) !important; }
.channels__nav .user-nav { margin-left: auto; }

.pill--danger { background: var(--now); }
.pill--muted { background: var(--surface-2); color: var(--text-muted); }
.profile-row.is-disabled .profile-row__name { text-decoration: line-through; color: var(--text-muted); }
.tool-link.wide { width: 100%; text-align: left; cursor: pointer; }
.field small { font-weight: 400; color: var(--text-muted); }
.new-profile input[type="password"] {
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--line-strong);
    border-radius: 0.5rem;
    background: var(--surface);
    color: inherit;
    font: inherit;
}

.login {
    display: grid;
    place-items: center;
    min-height: 100dvh;
    padding: 1rem;
}
.login__card { display: grid; gap: 0.9rem; width: min(22rem, 100%); }
.login__card h1 { margin: 0 0 0.3rem; font-size: 1.4rem; text-align: center; }
.login__card input[type="text"], .login__card input[type="password"] {
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--line-strong);
    border-radius: 0.5rem;
    background: var(--surface);
    color: inherit;
    font: inherit;
}
.login__card .primary-btn { padding: 0.6rem; font-size: 1rem; }

@media (max-width: 600px) {
    .toolbar .user-nav { flex-basis: 100%; justify-content: flex-end; }
}

/* Details dialog ---------------------------------------------------- */
.details {
    width: min(36rem, calc(100vw - 2rem));
    max-height: calc(100dvh - 2rem);
    padding: 1.25rem 1.25rem 1.5rem;
    border: 1px solid var(--line);
    border-radius: 0.75rem;
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 10px 40px rgb(0 0 0 / 0.25);
}
.details::backdrop { background: rgb(0 0 0 / 0.45); }
.details__close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 50%;
    background: var(--surface-2);
    font-size: 1.3rem;
    line-height: 1;
}
.details__channel { margin: 0; font-size: 0.85rem; color: var(--text-muted); }
.details__title { margin: 0.25rem 2rem 0.25rem 0; font-size: 1.35rem; }
.details__meta { margin: 0 0 0.75rem; color: var(--text-muted); font-size: 0.9rem; }
.details__meta .badge,
.details__meta .age { font-size: 0.7rem; margin-right: 0.35rem; vertical-align: 0.1em; }
.details__rating { margin: -0.4rem 0 0.75rem; font-size: 0.9rem; color: var(--text-muted); }
.details__rating .stars { font-size: 1.1rem; vertical-align: -0.1em; }
.details__img { display: block; max-width: 100%; max-height: 14rem; border-radius: 0.5rem; margin-bottom: 0.75rem; }
.details__desc { margin: 0; line-height: 1.5; }

@media (max-width: 600px) {
    .topbar { gap: 0.4rem 0.75rem; }
    .day-label { min-width: 9.5rem; }
    .toolbar { flex-basis: 100%; }
}
