/* Pictogram – parent area */

@font-face {
    font-family: "Nunito";
    src: url("/fonts/nunito-latin-wght-normal.woff2") format("woff2");
    font-weight: 200 1000;
    font-display: swap;
}

@font-face {
    font-family: "Fredoka";
    src: url("/fonts/fredoka-latin-wght-normal.woff2") format("woff2");
    font-weight: 300 700;
    font-display: swap;
}

/* The children's other fonts, for their printed day plans. Only downloaded when a sheet uses them. */
@font-face {
    font-family: "Lexend";
    src: url("/fonts/lexend-latin-wght-normal.woff2") format("woff2");
    font-weight: 100 900;
    font-display: swap;
}

@font-face {
    font-family: "Space Grotesk";
    src: url("/fonts/space-grotesk-latin-wght-normal.woff2") format("woff2");
    font-weight: 300 700;
    font-display: swap;
}

@font-face {
    font-family: "Atkinson Hyperlegible";
    src: url("/fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2");
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: "Atkinson Hyperlegible";
    src: url("/fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2");
    font-weight: 500 700;
    font-display: swap;
}

:root {
    --bg: #f5f4fb;
    --surface: #ffffff;
    --surface-2: #f0eefa;
    --text: #1d1b3a;
    --muted: #6b6889;
    --line: #e4e1f2;
    --primary: #6d5ce8;
    --primary-dark: #5443cf;
    --primary-soft: #ece9ff;
    --accent: #ffb938;
    --success: #22a861;
    --success-soft: #e3f7ec;
    --danger: #d9304f;
    --danger-soft: #fde8ec;
    --radius: 18px;
    --radius-sm: 12px;
    --shadow: 0 1px 2px rgba(29, 27, 58, .06), 0 6px 20px rgba(29, 27, 58, .06);
    --shadow-lg: 0 20px 60px rgba(29, 27, 58, .22);
    --sidebar: 260px;
    color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.45;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

h1, h2, h3 {
    font-family: "Fredoka", "Nunito", system-ui, sans-serif;
    font-weight: 600;
    line-height: 1.15;
    margin: 0 0 .4em;
}
h1 { font-size: clamp(26px, 4vw, 34px); }
h2 { font-size: 21px; }
h3 { font-size: 17px; }
h1:focus { outline: none; }

a { color: var(--primary-dark); }
a.plain { color: inherit; text-decoration: none; }
p { margin: 0 0 .6em; }
code, .mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 13px; }

.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.icon { flex: none; display: inline-block; vertical-align: middle; }
.picture.photo { object-fit: cover; border-radius: 10px; flex: none; }

/* ---------- Shell ---------- */

.shell { min-height: 100vh; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    width: var(--sidebar);
    display: flex;
    flex-direction: column;
    padding: 22px 16px 18px;
    background: var(--surface);
    border-right: 1px solid var(--line);
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    padding: 0 10px 18px;
    text-decoration: none;
}
.brand-logo { display: block; }

.nav { display: grid; gap: 4px; }
.nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 14px;
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
}
.nav a:hover { background: var(--surface-2); }
.nav a.active { background: var(--primary-soft); color: var(--primary-dark); }

/* For a parent in several families (FamilySwitcher). */
.family-switcher {
    margin: 0 0 14px;
    border: 2px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
}
.family-switcher[open] { border-color: var(--primary-soft); box-shadow: var(--shadow); }
.family-switcher summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 14px;
    cursor: pointer;
    list-style: none;
}
.family-switcher summary::-webkit-details-marker { display: none; }
.family-switcher summary:hover { background: var(--surface-2); }
.family-switcher summary .grow,
.family-switcher button .grow { display: grid; line-height: 1.25; }
.family-switcher summary small { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.family-switcher strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.family-switcher .chevron { flex: none; color: var(--muted); transition: transform .2s ease; }
.family-switcher[open] .chevron { transform: rotate(180deg); }
.family-switcher form { display: grid; gap: 2px; padding: 4px 6px 6px; border-top: 1px solid var(--line); }
.family-switcher button {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 8px 10px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.family-switcher button:hover { background: var(--surface-2); }
.family-switcher button.current { color: var(--primary-dark); cursor: default; }
.family-switcher button.current:hover { background: transparent; }
.family-switcher button small { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sidebar-foot {
    margin-top: auto;
    padding: 14px 10px 0;
    border-top: 1px solid var(--line);
    display: grid;
    gap: 8px;
    font-size: 14px;
}

.main { margin-left: var(--sidebar); min-height: 100vh; }
.topbar { display: none; }
.scrim { display: none; }

.content {
    max-width: 1180px;
    margin: 0 auto;
    padding: 32px clamp(16px, 4vw, 40px) 120px;
}

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-102%);
        transition: transform .25s ease;
        box-shadow: var(--shadow-lg);
    }
    .menu-open .sidebar { transform: none; }
    .menu-open .scrim {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 25;
        background: rgba(29, 27, 58, .35);
    }
    .main { margin-left: 0; }
    .topbar {
        position: sticky;
        top: 0;
        z-index: 20;
        display: flex;
        align-items: center;
        gap: 6px;
        padding: calc(env(safe-area-inset-top) + 8px) 12px 8px;
        background: rgba(245, 244, 251, .92);
        -webkit-backdrop-filter: blur(10px);
        backdrop-filter: blur(10px);
        border-bottom: 1px solid var(--line);
    }
    .topbar .brand { padding: 0; font-size: 20px; }
    .topbar-family {
        margin-left: auto;
        max-width: 45vw;
        min-height: 36px;
        padding: 0 12px;
        border: 0;
        border-radius: 999px;
        background: var(--primary-soft);
        color: var(--primary-dark);
        font: inherit;
        font-size: 14px;
        font-weight: 800;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        cursor: pointer;
    }
    .content { padding-top: 20px; }
}

/* ---------- Buttons & inputs ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 18px;
    border: 0;
    border-radius: 999px;
    font: inherit;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s, transform .1s, box-shadow .15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.disabled { opacity: .5; pointer-events: none; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 3px 0 var(--primary-dark); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--primary-soft); color: var(--primary-dark); }
.btn-secondary:hover { background: #dfdaff; }
.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger-ghost { background: transparent; color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-soft); }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn-lg { min-height: 54px; padding: 0 28px; font-size: 18px; }
.btn-block { width: 100%; }
.btn-group { display: flex; flex-wrap: wrap; gap: 8px; }

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text);
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    flex: none;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.danger { color: var(--muted); }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-soft); }

.input {
    width: 100%;
    min-height: 46px;
    padding: 10px 14px;
    border: 2px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.input-sm { min-height: 38px; padding: 6px 10px; font-size: 15px; width: auto; }
textarea.input { resize: vertical; }
select.input { cursor: pointer; }
input[type="time"].input { width: auto; }

.form { display: grid; gap: 16px; }
.form-row { display: flex; flex-wrap: wrap; gap: 14px; }
.field { display: grid; gap: 6px; font-weight: 700; }
.field > span small { font-weight: 500; }
.field-help { color: var(--muted); font-size: 14px; font-weight: 500; }
.field-error { color: var(--danger); font-size: 14px; }
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: var(--danger-soft);
    color: var(--danger);
    font-weight: 700;
}
/* An editor has got unsaved changes back from a draft (DraftNotice). The button goes below the text on a narrow screen. */
.draft-notice {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
    padding: 10px 10px 10px 16px;
    border-radius: var(--radius-sm);
    background: #fff4d6;
    color: #7a5a00;
}
.draft-notice .grow { flex-basis: 260px; }
.draft-notice .btn { color: inherit; }
.wizard-body .draft-notice { margin-bottom: 20px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 4px 14px;
    border: 2px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}
.chip:hover { border-color: #cfc9ee; }
.chip.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); }

.tag {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 10px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    vertical-align: middle;
}
.tag-primary { background: var(--primary); color: #fff; }
.tag-warn { background: #fff4d6; color: #7a5a00; }

.switch-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    border-top: 1px solid var(--line);
    cursor: pointer;
}
.switch-row:first-of-type { border-top: 0; }
.switch-row span { display: grid; }
.switch-row small { color: var(--muted); }
.switch-row input {
    appearance: none;
    flex: none;
    position: relative;
    width: 52px;
    height: 30px;
    margin: 0;
    border-radius: 999px;
    background: #d6d3e6;
    cursor: pointer;
    transition: background .2s;
}
.switch-row input::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, .2);
    transition: transform .2s;
}
.switch-row input:checked { background: var(--success); }
.switch-row input:checked::after { transform: translateX(22px); }

/* ---------- Page structure ---------- */

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}
.page-head p { max-width: 640px; }
.back { display: inline-block; margin-bottom: 6px; color: var(--muted); font-weight: 700; text-decoration: none; }
.back:hover { color: var(--primary-dark); }

.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
}

.toolbar { display: grid; gap: 12px; margin-bottom: 20px; }
.toolbar .search { max-width: 420px; }

.loading {
    width: 44px;
    height: 44px;
    margin: 60px auto;
    border-radius: 50%;
    border: 5px solid var(--primary-soft);
    border-top-color: var(--primary);
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
    display: grid;
    justify-items: center;
    gap: 8px;
    max-width: 520px;
    margin: 30px auto;
    padding: 36px 24px;
    text-align: center;
    background: var(--surface);
    border-radius: 28px;
    box-shadow: var(--shadow);
}
.empty-inline {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    border: 2px dashed var(--line);
    border-radius: var(--radius);
    color: var(--muted);
}
.empty-inline p { margin: 0; }
/* With a button: it goes below the text on a narrow screen. */
.empty-inline:has(> .btn) { flex-wrap: wrap; }
.empty-inline:has(> .btn) p { flex: 1 1 160px; }

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}
.section-head h2 { margin: 0; }

.editor { display: grid; gap: 18px; }
.editor.two-col { grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); align-items: start; }
.editor .col { display: grid; gap: 18px; }
.icon-row { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }

/* ---------- Save bar ---------- */

.save-bar {
    position: fixed;
    left: var(--sidebar);
    right: 0;
    bottom: 0;
    z-index: 15;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px clamp(16px, 4vw, 40px) calc(12px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .96);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
    box-shadow: 0 -8px 24px rgba(29, 27, 58, .06);
    transform: translateY(0);
}
.save-bar:not(.visible) .muted { visibility: hidden; }
@media (max-width: 900px) { .save-bar { left: 0; } }
@media (max-width: 520px) { .save-bar .muted { display: none; } }

/* ---------- Icon picker ---------- */

.icon-picker-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px;
    border: 2px dashed #cfc9ee;
    border-radius: 20px;
    background: var(--surface);
    color: var(--primary-dark);
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}
.icon-picker-btn:hover { border-color: var(--primary); background: var(--primary-soft); }
.icon-placeholder {
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 26px;
}

.picker-tools {
    position: sticky;
    top: -20px;
    z-index: 2;
    display: grid;
    gap: 10px;
    margin: -20px -20px 14px;
    padding: 16px 20px 12px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}
.picker-filters { display: grid; gap: 10px; }

.icon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
    gap: 8px;
}
.icon-cell {
    display: grid;
    justify-items: center;
    align-content: start;
    gap: 4px;
    min-height: 96px;
    padding: 10px 4px 8px;
    border: 2px solid transparent;
    border-radius: 16px;
    background: none;
    color: var(--text);
    font: inherit;
    font-size: 12px;
    line-height: 1.15;
    cursor: pointer;
    text-align: center;
}
.icon-cell span { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.icon-cell:hover { background: var(--surface-2); }
.icon-cell.selected { border-color: var(--primary); background: var(--primary-soft); }

/* ---------- Modal ---------- */

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(29, 27, 58, .45);
    animation: fade .15s ease-out;
}
.modal {
    display: flex;
    flex-direction: column;
    width: min(560px, 100%);
    max-height: min(88vh, 900px);
    background: var(--surface);
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    animation: rise .2s ease-out;
}
.modal-wide { width: min(960px, 100%); }
.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 16px 14px 12px 22px;
    border-bottom: 1px solid var(--line);
}
.modal-head h2 { margin: 0; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid var(--line);
}
.modal-foot .muted { flex: 1; }

@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(16px); opacity: 0; } }

@media (max-width: 600px) {
    .modal-backdrop { padding: 0; place-items: end stretch; }
    .modal, .modal-wide { width: 100%; max-height: 92vh; border-radius: 24px 24px 0 0; }
    .modal-foot { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }

    /* A picker on a phone, where the keyboard takes half the screen: only the search field stays in place, and each row of
       filters is one line that scrolls sideways – and away with the results. */
    .picker-tools { display: contents; }
    .picker-search {
        position: sticky;
        top: -20px;
        z-index: 2;
        margin: -20px -20px 0;
        padding: 12px 20px 10px;
        background: var(--surface);
    }
    .picker-filters { gap: 8px; margin: 0 -20px 12px; }
    .picker-filters .chips { flex-wrap: nowrap; overflow-x: auto; padding: 0 20px; scrollbar-width: none; }
    .picker-filters .chips::-webkit-scrollbar { display: none; }
    .picker-filters .chip { flex: none; white-space: nowrap; }
    /* The sheet keeps its height while the results change, so the search field stays put, and it stays above the keyboard
       (--visible-top and --visible-height are set in parent.js while the keyboard is up). */
    .modal-backdrop:has(> .modal > .modal-body > .picker-tools) { top: var(--visible-top, 0); bottom: auto; height: var(--visible-height, 100%); }
    .modal:has(> .modal-body > .picker-tools) { height: min(92vh, var(--visible-height, 100vh)); max-height: none; }
}

/* ---------- Toasts ---------- */

.toasts {
    position: fixed;
    right: 20px;
    bottom: 90px;
    z-index: 60;
    display: grid;
    gap: 8px;
    pointer-events: none;
}
.toast-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px 12px 14px;
    border-radius: 16px;
    background: #1d1b3a;
    color: #fff;
    font-weight: 700;
    box-shadow: var(--shadow-lg);
    animation: rise .25s ease-out;
}
.toast-item.error { background: var(--danger); }
@media (max-width: 600px) { .toasts { left: 12px; right: 12px; } }

/* ---------- Mission tiles ---------- */

.mission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
    gap: 10px;
}
.mission-grid.large { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
.mission-tile {
    position: relative;
    display: grid;
    justify-items: center;
    align-content: start;
    gap: 6px;
    padding: 14px 8px 12px;
    border: 2px solid transparent;
    border-radius: 20px;
    background: var(--surface);
    box-shadow: var(--shadow);
    color: var(--text);
    font: inherit;
    font-weight: 700;
    font-size: 14px;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    transition: transform .12s, border-color .12s;
}
.mission-tile:hover { border-color: var(--primary-soft); transform: translateY(-2px); }
.mission-tile small { font-weight: 600; font-size: 12px; }
.mission-tile.added { border-color: var(--success); background: var(--success-soft); }
.mission-tile .badge {
    position: absolute;
    top: 6px;
    right: 6px;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--success);
    color: #fff;
    font-size: 12px;
}
.modal .mission-tile { box-shadow: none; background: var(--surface-2); }

.quick-create {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding: 10px;
    border-radius: 18px;
    background: var(--surface-2);
}
.quick-create .icon-picker-btn { padding: 4px; }

/* ---------- Lists ---------- */

.list-cards { display: grid; gap: 12px; }
.list-card {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--text);
    text-decoration: none;
    border: 2px solid transparent;
    transition: border-color .15s, transform .12s;
}
a.list-card:hover, button.list-card:hover { border-color: var(--primary-soft); }
button.list-card { width: 100%; font: inherit; text-align: left; cursor: pointer; }
.list-card h3 { margin: 0 0 4px; font-size: 19px; }
.list-card p { margin: 4px 0 0; }
.list-cards.compact .list-card { padding: 12px 14px; box-shadow: none; background: var(--surface-2); }
.list-card-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 560px) {
    .list-card:has(> .list-card-actions) { flex-wrap: wrap; }
    .list-card-actions { flex-basis: 100%; }
}
.chevron { font-size: 30px; color: var(--muted); }

.mini-icons { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.mini { display: inline-grid; place-items: center; padding: 2px; border-radius: 8px; }
.mini.done { background: var(--success-soft); }
.mini.done .icon, .mini.done .picture { opacity: .45; }

.timeline { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; }
.timeline-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 12px 3px 6px;
    border-radius: 999px;
    background: var(--surface-2);
    font-size: 14px;
    font-weight: 700;
}
/* A routine without missions: the child never sees it. */
.timeline-item.empty { background: #fff4d6; color: #7a5a00; }

/* ---------- Sortable rows ---------- */

.rows { display: grid; gap: 8px; margin-top: 12px; }
.row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 16px;
    background: var(--surface-2);
}
.row-wrap { flex-wrap: wrap; }
.row-main { display: grid; gap: 2px; }
/* Room for the name and icons: the controls move to their own line instead of squeezing them to nothing. */
.row-wrap .row-main { flex: 1 1 220px; }
.row-wrap .row-controls { margin-left: auto; }
.row-title { font-weight: 800; }
.row-index {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--surface);
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    flex: none;
}
.row-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.drag-handle {
    padding: 6px 4px;
    color: #a9a5c4;
    font-size: 18px;
    letter-spacing: -3px;
    cursor: grab;
    touch-action: none;
    user-select: none;
}
.drag-ghost { opacity: .4; }
.drag-chosen .row { box-shadow: var(--shadow-lg); background: var(--surface); }

.time-field { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; color: var(--muted); }

@media (max-width: 700px) {
    .row { flex-wrap: wrap; }
    .row .weekdays { order: 10; width: 100%; padding-left: 40px; }
    .row-wrap .row-controls { width: 100%; padding-left: 40px; }
}

/* ---------- Weekday picker ---------- */

.weekdays { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.weekday {
    width: 32px;
    height: 32px;
    border: 2px solid var(--line);
    border-radius: 50%;
    background: var(--surface);
    color: var(--muted);
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    padding: 0;
}
.weekday.on { border-color: var(--primary); background: var(--primary); color: #fff; }
.weekday-summary { margin-left: 6px; font-size: 13px; font-weight: 700; color: var(--muted); min-width: 64px; }

/* ---------- Child picker ("kun for") ---------- */

.row-when { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.child-picker { display: inline-flex; align-items: center; gap: 4px; }
.child-toggle {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 2px solid var(--line);
    border-radius: 50%;
    background: var(--surface);
    cursor: pointer;
    overflow: hidden;
}
.child-toggle > * { filter: grayscale(1); opacity: .35; }
.child-toggle .picture.photo { width: 100%; height: 100%; object-fit: cover; }
.child-toggle.on { border-color: var(--child, var(--primary)); background: var(--child-soft, var(--primary-soft)); }
.child-toggle.on > * { filter: none; opacity: 1; }

/* Weekdays and children need more room than the name – when the list is narrow, they get a line of their own. */
.rows:has(.child-picker) { container: rows / inline-size; }
@container rows (max-width: 820px) {
    .row:has(> .row-when) { flex-wrap: wrap; }
    .row .row-when { order: 10; width: 100%; padding-left: 40px; }
}
@media (max-width: 700px) {
    .row .row-when { order: 10; width: 100%; padding-left: 40px; }
    .row .row-when .weekdays { order: 0; width: auto; padding-left: 0; }
    /* With the children as well, the days stay on one line: the chips already show the days, so the summary makes room. */
    .row .row-when:has(.child-picker) { padding-left: 0; }
    .row-when:has(.child-picker) .weekday-summary { display: none; }
    .row-controls .child-picker { order: 11; padding-left: 40px; }
}

/* ---------- Følgeopgave ---------- */

.mission-name { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.mission-name:hover { color: var(--primary-dark); text-decoration: underline; text-underline-offset: 3px; }
.follow-up-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 6px;
    padding: 1px 10px 1px 3px;
    border: 0;
    border-radius: 6px 999px 999px 999px;
    background: #fff4dc;
    color: #7a5200;
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    vertical-align: middle;
    cursor: pointer;
}
.follow-up-chip:hover { box-shadow: 0 0 0 2px var(--accent); }

/* The speech bubble the child sees (wwwroot/b/app.css .ask), in small. */
.follow-up-preview {
    display: grid;
    justify-items: center;
    gap: 2px;
    width: min(100%, 300px);
    margin: 8px auto 0;
    padding: 12px 14px 14px;
    border-radius: 24px;
    background: var(--surface);
    box-shadow: 0 0 0 3px var(--accent), var(--shadow);
    text-align: center;
}
.follow-up-preview small { color: var(--muted); font-weight: 700; }
.follow-up-preview strong { font-size: 19px; line-height: 1.2; }
.follow-up-preview > span { font-weight: 600; }
.follow-up-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; margin-top: 8px; }
.follow-up-buttons span { display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 7px 6px; border-radius: 12px; background: var(--surface-2); font-size: 13px; font-weight: 800; }
.follow-up-buttons .yes { background: var(--success); color: #fff; }

.mission-tile .tile-follow-up {
    position: absolute;
    top: 8px;
    right: 8px;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 6px 50% 50% 50%;
    background: var(--surface);
    box-shadow: 0 0 0 2px var(--accent);
}

/* ---------- Image upload ---------- */

.image-upload { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-weight: 500; }
.image-preview { width: 96px; height: 96px; object-fit: cover; border-radius: 16px; box-shadow: var(--shadow); }
.image-actions { display: flex; gap: 8px; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---------- Dashboard ---------- */

.child-cards { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr)); }
.child-card { display: grid; gap: 14px; border-top: 6px solid var(--child, var(--primary)); }
.child-card-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.child-card-head h2 { margin: 0; font-size: 26px; }
.child-card-head p { margin: 0; }
.avatar-lg {
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--child-soft, var(--primary-soft));
    flex: none;
}
.day-summary { display: flex; align-items: center; gap: 12px; }
.day-summary .progress { flex: 1; }
.progress { height: 14px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width .4s; }

.routine-progress { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.routine-progress > li { border-radius: 14px; background: var(--surface-2); font-weight: 700; }
.routine-progress > li.complete { background: var(--success-soft); }
/* The whole row folds the routine out: each mission's name and whether it is done. */
.routine-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: 14px;
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.routine-toggle:hover { background: rgba(29, 27, 58, .04); }
.routine-toggle small { margin-left: 4px; white-space: nowrap; }
/* The name keeps its width; the icon strip gives way and wraps instead of sliding over the name. */
.routine-toggle .grow { flex: 1 0 auto; max-width: 55%; }
.routine-toggle .mini-icons { flex: 1 1 auto; min-width: 0; justify-content: flex-end; }
.routine-toggle .count { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--muted); }
.routine-progress .complete .count { color: var(--success); }
.routine-toggle .chevron { flex: none; color: var(--muted); transition: transform .15s; }
.routine-progress .open .chevron { transform: rotate(180deg); }
@media (max-width: 560px) { .routine-toggle .mini-icons { display: none; } }

.routine-detail { display: grid; gap: 8px; margin: 0 6px; padding: 4px 10px 10px; border-radius: 12px; background: var(--surface); }
.routine-progress .open { padding-bottom: 6px; }
.routine-detail p { margin: 0; font-weight: 400; }
.mission-status { list-style: none; margin: 0; padding: 0; }
.mission-status li { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.mission-status .state { display: inline-flex; align-items: center; gap: 6px; flex: none; color: var(--muted); font-size: 14px; }
.mission-status .done .state { color: var(--success); }
.mission-status .done .picture, .mission-status .done .icon { opacity: .45; }
.routine-actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* Extra missions for a single day ("Hent mormors hund") */
.mini.today { box-shadow: inset 0 0 0 2px #b9aef5; background: var(--primary-soft); }
.extra-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.add-extra-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-self: start;
    min-height: 40px;
    padding: 6px 16px 6px 10px;
    border: 2px dashed #c9c1f5;
    border-radius: 999px;
    background: none;
    color: var(--primary-dark);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}
.add-extra-btn:hover { border-style: solid; border-color: var(--primary); background: var(--primary-soft); }
.extra-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 4px 3px 6px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-size: 14px;
    font-weight: 700;
}
.extra-chip.done { background: var(--success-soft); color: var(--text); }
.extra-chip.done .picture { opacity: .5; }
.extra-remove {
    display: inline-grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}
.extra-remove:hover { background: var(--danger-soft); color: var(--danger); }
.extra-note { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--muted); font-size: 14px; font-weight: 700; }

.reminder-list { display: flex; flex-wrap: wrap; gap: 6px; }
.reminder-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px 4px 6px;
    border-radius: 999px;
    background: #fff5cc;
    color: #5a4600;
    font-weight: 700;
    font-size: 14px;
}

.child-card-foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 14px; font-weight: 700; }
.stat-inline { display: inline-flex; align-items: center; gap: 6px; }
.stats-row { display: flex; flex-wrap: wrap; gap: 18px; margin-bottom: 12px; }

.recent-medals { display: flex; gap: 6px; flex-wrap: wrap; }
.recent-medal {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, var(--c1, #bfe9ff), var(--c2, #3a8dde));
    box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .5);
    flex: none;
}
.recent-medal.tier-bronze { --c1: #ffd0a1; --c2: #b8692a; }
.recent-medal.tier-silver { --c1: #ffffff; --c2: #9aa6b5; }
.recent-medal.tier-gold { --c1: #fff6b0; --c2: #e3a200; }
.recent-medal.tier-diamond { --c1: #eafdff; --c2: #45b8e0; }
.recent-medal.tier-legend { background: conic-gradient(#ff6b6b, #ffd93d, #6bcb77, #4d96ff, #b06bff, #ff6b6b); }

.medal-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.medal-list li { display: flex; align-items: center; gap: 10px; }

.quick-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 22px; }
.quick-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    color: var(--text);
    text-decoration: none;
}
.quick-link:hover { outline: 2px solid var(--primary-soft); }
.quick-link span { display: grid; }
.quick-link small { color: var(--muted); }

/* Theme accents used on child cards */
.theme-hav { --child: #1E88E5; --child-soft: #E3F6FF; }
.theme-skov { --child: #2E9D5B; --child-soft: #EFFBEF; }
.theme-solnedgang { --child: #F4511E; --child-soft: #FFF1E6; }
.theme-lilla { --child: #8E44DB; --child-soft: #F6EEFF; }
.theme-slik { --child: #E84393; --child-soft: #FFF0F7; }
.theme-sol { --child: #F59E0B; --child-soft: #FFFBEA; }
.theme-rummet { --child: #5A60E0; --child-soft: #E8EAFF; }
.theme-regnbue { --child: #FF6B6B; --child-soft: #FFE9EF; }
.theme-grafit { --child: #0F8F82; --child-soft: #E6F6F4; }
.theme-neon { --child: #A21CAF; --child-soft: #FAE8FD; }
.theme-volt { --child: #65A30D; --child-soft: #F2FBE3; }
.theme-minimal { --child: #2563EB; --child-soft: #E8EEFD; }
.theme-salvie { --child: #6B8F71; --child-soft: #E9F2EA; }
/* "egen" (custom colour) sets --child and --child-soft inline – see ChildListItem.ColorStyle. */
.list-card[class*="theme-"] { border-left: 6px solid var(--child); }

/* ---------- Child editor ---------- */

.week-plan { display: grid; gap: 8px; }
.week-plan-row { display: grid; grid-template-columns: 110px 1fr; align-items: center; gap: 10px; font-weight: 800; }
.week-plan-row.weekend .day-name { color: var(--primary-dark); }

.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin-bottom: 18px; }
.theme-swatch {
    display: grid;
    gap: 6px;
    padding: 6px 6px 8px;
    border: 3px solid transparent;
    border-radius: 18px;
    background: var(--surface-2);
    font: inherit;
    font-weight: 800;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
}
.theme-swatch.on { border-color: var(--primary); background: var(--primary-soft); }
.swatch-preview {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 5px;
    height: 58px;
    padding: 8px;
    border-radius: 12px;
    background: linear-gradient(180deg, var(--top), var(--bottom));
}
.swatch-preview i { width: 18px; height: 22px; border-radius: 6px; background: #fff; box-shadow: 0 2px 0 rgba(0, 0, 0, .1); }
.swatch-preview i:nth-child(2) { background: var(--primary); height: 30px; }
.swatch-preview i:nth-child(3) { background: var(--accent); }

.link-card .steps { margin: 0 0 14px; padding-left: 22px; display: grid; gap: 4px; }
.link-box { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.link-box .grow { display: grid; gap: 10px; min-width: 220px; }
.qr { width: 150px; height: 150px; flex: none; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.qr svg { width: 100%; height: 100%; display: block; }
.share-icon { display: inline-grid; place-items: center; width: 24px; height: 24px; vertical-align: -6px; border-radius: 6px; background: var(--surface-2); color: #1a73e8; }

/* ---------- The parent area on the parent's home screen (InstallGuide) ---------- */

.install-guide {
    max-width: 640px;
    margin: 0 0 22px;
    padding: 18px 20px;
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow), 0 0 0 2px var(--primary-soft);
    text-align: left;
}
.wizard .install-guide { margin-inline: auto; }
.install-guide header { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.install-guide header img { flex: none; border-radius: 22%; }
.install-guide h2 { margin: 0; font-size: 21px; line-height: 1.2; }
.install-guide p { margin: 0 0 10px; }
.install-guide ol { margin: 0 0 12px; padding-left: 22px; display: grid; gap: 6px; }
.install-guide .hint { margin: 0; }
.install-guide .btn-group { margin-top: 2px; }
.install-guide .btn-primary + .hint { margin-top: 12px; }

/* ---------- Calendar ---------- */

.calendar-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.segmented { display: inline-flex; padding: 4px; gap: 4px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); }
.segmented button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    padding: 0 16px 0 10px;
    border: 0;
    border-radius: 999px;
    background: none;
    color: var(--text);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}
.segmented button.on { background: var(--primary); color: #fff; }
.week-nav { display: flex; align-items: center; gap: 6px; }
.week-label { display: grid; text-align: center; min-width: 150px; line-height: 1.2; }

.days { display: grid; gap: 12px; }
.day-card { display: grid; gap: 12px; padding: 16px 18px; border-left: 6px solid transparent; }
.day-card.today { border-left-color: var(--primary); }
.day-card.past { opacity: .7; }
.day-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.day-date { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.day-date .dow { font-family: "Fredoka", sans-serif; font-size: 22px; font-weight: 600; text-transform: capitalize; }
.day-date .dom { color: var(--muted); font-weight: 700; }
.plan-select { max-width: 280px; }
.plan-select.override { border-color: var(--accent); background: #fff8e8; }
.day-body { display: grid; gap: 10px; }
.day-reminders { display: grid; gap: 6px; }
.reminder-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 14px;
    background: #fff8d6;
}
.reminder-row .grow { display: grid; }
.extra-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 14px;
    background: var(--primary-soft);
}
.extra-row.done { background: var(--success-soft); }
.extra-row .grow { display: grid; }
.day-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.add-reminder {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-self: start;
    padding: 6px 14px 6px 8px;
    border: 2px dashed #e6d48a;
    border-radius: 999px;
    background: none;
    color: #7a6100;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}
.add-reminder:hover { background: #fff8d6; }
.day-preview summary {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    cursor: pointer;
    list-style: none;
}
.day-preview summary::-webkit-details-marker { display: none; }
.preview-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 12px 3px 6px;
    border-radius: 999px;
    background: var(--surface-2);
    font-size: 14px;
    font-weight: 700;
}
.preview-chip .ok { color: var(--success); font-weight: 800; }
.preview-routine { display: grid; gap: 4px; padding: 10px 4px 0; }
.suggestions { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Settings ---------- */

.parent-list { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 8px; }
.parent-list li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); }
.parent-list .grow { display: grid; }

/* ---------- Login ---------- */

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
    background: radial-gradient(circle at 20% 10%, #e9e4ff, transparent 50%), radial-gradient(circle at 90% 90%, #ffeccc, transparent 45%), var(--bg);
}
.login-card {
    width: min(420px, 100%);
    padding: 32px 28px;
    background: var(--surface);
    border-radius: 30px;
    box-shadow: var(--shadow-lg);
}
.login-card h1 { margin-top: 8px; }
.login-card.center { display: grid; justify-items: center; gap: 8px; }
.login-hero { position: relative; display: grid; place-items: center; height: 110px; }
.login-hero .float-a { position: absolute; left: calc(50% - 124px); top: 8px; transform: rotate(-14deg); animation: bob 3s ease-in-out infinite alternate; }
.login-hero .float-b { position: absolute; right: calc(50% - 122px); bottom: 0; transform: rotate(12deg); animation: bob 3.4s ease-in-out infinite alternate-reverse; }
@keyframes bob { to { translate: 0 -8px; } }
.login-card .form { margin-top: 20px; }
.credits { margin: 0 0 8px; padding-left: 18px; font-size: 14px; display: grid; gap: 2px; }
.chips.libraries .chip { background: var(--surface-2); }
.chips.libraries .chip.on { background: var(--primary-soft); }
.login-switch { margin: 18px 0 0; text-align: center; color: var(--muted); font-weight: 700; }
.signup-terms { margin: 0; font-size: 14px; text-align: center; }
.honeypot { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
/* The one-time code: big, spaced digits like in the e-mail. */
.input-code {
    min-height: 64px;
    font-family: "Fredoka", "Nunito", system-ui, sans-serif;
    font-size: 32px;
    font-weight: 600;
    letter-spacing: .35em;
    text-align: center;
    padding-left: .35em;
    font-variant-numeric: tabular-nums;
}
.sent-to { color: var(--text); overflow-wrap: anywhere; }
.login-card .form .hint { margin: 0; }
.code-help { margin: 16px 0 0; text-align: center; }
.code-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin-top: 8px; }
.code-actions .btn { color: var(--primary-dark); }
.login-note { margin: 16px 0 0; overflow-wrap: anywhere; }
/* The Turnstile widget fills the form but is at least 300px wide – on narrow phones it spills evenly into the card's padding. */
.turnstile { display: flex; justify-content: center; min-width: 0; }
.turnstile > div { flex: 1; }

/* ---------- Blazor ---------- */

#blazor-error-ui {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    padding: 12px 20px;
    background: #fff4d6;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, .15);
}
#blazor-error-ui .dismiss { position: absolute; right: 16px; top: 10px; cursor: pointer; }

/* PageError: a page that failed (see the layouts' ErrorBoundary). */
.page-error { display: grid; justify-items: center; gap: 10px; max-width: 520px; margin: 40px auto; text-align: center; }
.page-error h2 { margin: 0; }
.page-error p { margin: 0; }
.bare-error { padding: 40px 16px; }

.validation-message { color: var(--danger); }

/* ---------- Child editor: appearance ---------- */

@font-face {
    font-family: "Space Grotesk";
    src: url("/fonts/space-grotesk-latin-wght-normal.woff2") format("woff2");
    font-weight: 300 700;
    font-display: swap;
}

@font-face {
    font-family: "Lexend";
    src: url("/fonts/lexend-latin-wght-normal.woff2") format("woff2");
    font-weight: 100 900;
    font-display: swap;
}

@font-face {
    font-family: "Atkinson Hyperlegible";
    src: url("/fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2");
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: "Atkinson Hyperlegible";
    src: url("/fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2");
    font-weight: 500 700;
    font-display: swap;
}

.child-editor { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.child-settings { display: grid; gap: 18px; min-width: 0; }
.child-preview-panel {
    position: sticky;
    top: 20px;
    display: grid;
    justify-items: center;
    gap: 10px;
    padding: 18px;
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    text-align: center;
}
.child-preview-panel h2 { justify-self: start; margin: 0; }
@media (max-width: 1100px) {
    .child-editor { grid-template-columns: minmax(0, 1fr); }
    .child-preview-panel { position: static; order: -1; }
}
/* A phone is narrower than the 340px device: shrink it (and the scaled page inside) so the page does not scroll sideways. */
@media (max-width: 480px) {
    .child-preview-panel { padding: 14px; }
    .device { width: 300px; height: 423px; }
    .device iframe { transform: scale(.3415); }
}
.device {
    position: relative;
    width: 340px;
    height: 481px;
    border: 10px solid #1d1b3a;
    border-radius: 30px;
    overflow: hidden;
    background: #1d1b3a;
    box-shadow: var(--shadow-lg);
}
.device iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 820px;
    height: 1180px;
    border: 0;
    transform: scale(.3902);
    transform-origin: 0 0;
    background: #fff;
}
.preview-placeholder {
    display: grid;
    justify-items: center;
    gap: 8px;
    width: 100%;
    padding: 40px 20px;
    border: 2px dashed var(--line);
    border-radius: 20px;
    color: var(--muted);
}

.avatar-editor { display: flex; align-items: flex-start; gap: 18px; flex-wrap: wrap; }
.avatar-editor .grow { display: grid; gap: 8px; font-weight: 500; }
.avatar-editor .grow p { margin: 0; }
.avatar-xl {
    display: grid;
    place-items: center;
    width: 112px;
    height: 112px;
    border-radius: 50%;
    background: var(--surface-2);
    overflow: hidden;
    flex: none;
    box-shadow: inset 0 0 0 4px #fff, 0 4px 14px rgba(29, 27, 58, .12);
}
.avatar-xl .picture.photo, .avatar-lg .picture.photo, .avatar-sm .picture.photo { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.segmented .picture.photo, .chip .picture.photo { border-radius: 50%; }
.segmented.small { box-shadow: none; background: var(--surface-2); justify-self: start; }
.segmented.small button { min-height: 36px; font-size: 14px; }
.image-preview.round { border-radius: 50%; }

.style-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 10px; }
.style-option, .option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    border: 2px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.style-option:hover, .option:hover { border-color: #cfc9ee; }
.style-option.on, .option.on { border-color: var(--primary); background: var(--primary-soft); }
.style-option > span, .option-text { display: grid; gap: 2px; }
.style-option .style-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.style-option strong, .option strong { font-size: 17px; }
.style-option small, .option small { color: var(--muted); font-size: 13px; line-height: 1.3; }
.style-option .audience { padding: 1px 8px; border-radius: 999px; background: var(--surface-2); font-weight: 800; }
.style-option.on .audience { background: #fff; }

/* Medals: a choice per child, with why (MedalChoice, MedalInfo) */
.medal-choice { margin: 12px 0; }
.medal-info > p:first-child { margin-top: 0; }
.medal-info > p:last-child { margin-bottom: 0; }
.pros-cons { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 12px; }
.pros-cons > div { padding: 12px 16px; border-radius: var(--radius-sm); }
.pros-cons .pros { background: var(--success-soft); }
.pros-cons .cons { background: #fff4d6; }
.pros-cons h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; }
.pros-cons ul { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.medal-details { margin-bottom: 12px; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--surface-2); }
.medal-details summary { font-weight: 800; cursor: pointer; }
.medal-details[open] summary { margin-bottom: 10px; }

.option-picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 8px; }
.option-picker.compact { display: flex; flex-wrap: wrap; }
.option-picker.compact .option { align-items: center; padding: 8px 14px 8px 10px; border-radius: 999px; }
.option-picker.compact .option strong { font-size: 15px; }
.speech-options { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.speech-hint { display: block; margin-top: 8px; }
.font-sample {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--surface-2);
    font-size: 24px;
    flex: none;
}
.option.on .font-sample { background: #fff; }

.theme-swatch.custom-color { position: relative; }
.theme-swatch.custom-color input[type="color"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}
.theme-swatch.custom-color .swatch-preview::after {
    content: "+";
    display: grid;
    place-items: center;
    position: absolute;
    right: 10px;
    top: 10px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    color: var(--text);
    font-weight: 900;
}
.theme-swatch .swatch-preview { position: relative; }

/* ---------- Shared bits used by the guide ---------- */

.btn-danger { background: var(--danger); color: #fff; box-shadow: 0 3px 0 #a81f3a; }
.btn-danger:hover { background: #bf2542; }
.input-lg { min-height: 54px; font-size: 20px; font-weight: 700; }
.hint { margin: 14px 0 0; color: var(--muted); font-size: 14px; }
.hint.warn { padding: 8px 12px; border-radius: 12px; background: #fff4d6; color: #7a5a00; }
.section-title { margin: 30px 0 14px; }
.danger-zone { border: 2px solid var(--danger-soft); }
.danger-zone h2 { color: var(--danger); }
.avatar-sm {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--child-soft, var(--primary-soft));
    flex: none;
    vertical-align: middle;
}

/* Concept diagram: missions -> routines -> day plans -> the child's app */
.concepts {
    display: grid;
    grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
    align-items: stretch;
    gap: 8px;
    margin: 12px 0;
}
.concept {
    display: grid;
    justify-items: center;
    align-content: start;
    gap: 6px;
    padding: 18px 12px;
    border-radius: 20px;
    background: var(--surface);
    box-shadow: var(--shadow);
    text-align: center;
}
.card .concept { background: var(--surface-2); box-shadow: none; }
.concept.highlight { background: linear-gradient(180deg, #e9e4ff, #fff); box-shadow: 0 0 0 2px var(--primary-soft); }
.concept strong { font-family: "Fredoka", sans-serif; font-size: 19px; }
.concept span:last-child { color: var(--muted); font-size: 14px; line-height: 1.3; }
.concept-icon {
    display: grid;
    place-items: center;
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: var(--surface);
    box-shadow: 0 4px 12px rgba(29, 27, 58, .08);
}
.concept-arrow { align-self: center; font-size: 34px; font-weight: 800; color: var(--primary); }
@media (max-width: 760px) {
    .concepts { grid-template-columns: 1fr; }
    .concept { grid-template-columns: auto 1fr; justify-items: start; text-align: left; column-gap: 14px; padding: 12px 14px; }
    .concept-icon { grid-row: span 2; width: 60px; height: 60px; }
    .concept-icon .icon { width: 40px; height: 40px; }
    .concept-arrow { justify-self: center; transform: rotate(90deg); font-size: 26px; line-height: .6; }
}

/* Feature tour */
.features { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 12px; }
.feature {
    display: flex;
    gap: 14px;
    padding: 16px;
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}
.feature h3 { margin: 2px 0 4px; }
.feature p { margin: 0 0 6px; color: var(--muted); font-size: 15px; }
.feature a { font-weight: 800; text-decoration: none; }
.feature-icon {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    border-radius: 16px;
    background: var(--surface-2);
    flex: none;
}

/* Guide page */
.guide-section { margin-bottom: 16px; }
.guide-steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: 10px; }
.guide-steps li {
    counter-increment: step;
    position: relative;
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 14px 14px 14px 52px;
    border-radius: 16px;
    background: var(--surface-2);
}
.guide-steps li::before {
    content: counter(step);
    position: absolute;
    left: 14px;
    top: 16px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--primary);
    color: #fff;
    font-weight: 800;
    font-size: 14px;
}
.guide-steps p { margin: 2px 0 4px; color: var(--muted); }
.guide-steps a { font-weight: 800; text-decoration: none; }
.faq { display: grid; gap: 8px; }
.faq details { padding: 14px 18px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.faq summary { font-weight: 800; cursor: pointer; }
.faq p { margin: 8px 0 0; color: var(--muted); }

/* ---------- Intro guide (wizard) ---------- */

.wizard {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: radial-gradient(circle at 10% 0%, #ece7ff, transparent 40%), radial-gradient(circle at 100% 30%, #fff1d9, transparent 35%), var(--bg);
}
.wizard-top {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: calc(env(safe-area-inset-top) + 10px) clamp(16px, 3vw, 32px) 10px;
    background: rgba(255, 255, 255, .9);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}
.wizard-top .brand { padding: 0; font-size: 20px; }
.wizard-steps {
    flex: 1;
    display: flex;
    justify-content: center;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.wizard-steps li { display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 999px; color: var(--muted); font-size: 13px; font-weight: 800; }
.wizard-steps .dot {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--surface-2);
    font-size: 12px;
}
.wizard-steps li.done .dot { background: var(--success); color: #fff; }
.wizard-steps li.current { background: var(--primary-soft); color: var(--primary-dark); }
.wizard-steps li.current .dot { background: var(--primary); color: #fff; }
@media (max-width: 1100px) { .wizard-steps li:not(.current) .label { display: none; } }
@media (max-width: 640px) { .wizard-steps { display: none; } .wizard-top { justify-content: space-between; } }

.wizard-progress { height: 4px; background: var(--line); }
.wizard-progress div { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width .4s ease; }

.wizard-body {
    flex: 1;
    width: 100%;
    max-width: 920px;
    margin: 0 auto;
    padding: 28px clamp(16px, 4vw, 32px) 130px;
    animation: step-in .35s ease-out;
}
@keyframes step-in { from { opacity: 0; transform: translateY(12px); } }

.wizard-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px clamp(16px, 4vw, 40px) calc(12px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .95);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
}
@media (max-width: 520px) { .wizard-nav .step-count { display: none; } }

.wizard-hero { display: grid; justify-items: center; text-align: center; margin-bottom: 18px; }
.wizard-hero h1 { font-size: clamp(30px, 5vw, 44px); }
.hero-icons { position: relative; display: flex; align-items: flex-end; gap: 10px; margin-bottom: 8px; }
.hero-icons .hero-a { transform: rotate(-14deg); animation: bob 3s ease-in-out infinite alternate; }
.hero-icons .hero-b { transform: rotate(12deg); animation: bob 3.4s ease-in-out infinite alternate-reverse; }
.lead { font-size: 18px; color: var(--muted); max-width: 680px; margin-left: auto; margin-right: auto; }
.step-head { text-align: center; margin-bottom: 22px; }
.step-head h1 { font-size: clamp(26px, 4vw, 36px); }

.wizard-note {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-top: 20px;
    padding: 16px 18px;
    border-radius: 18px;
    background: #fff8d6;
    color: #4f3f00;
}
.wizard-note p { margin: 0; }

.add-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    margin-top: 14px;
    padding: 14px;
    border: 2px dashed #cfc9ee;
    border-radius: 18px;
    background: rgba(255, 255, 255, .6);
    color: var(--primary-dark);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}
.add-row:hover { background: var(--primary-soft); border-color: var(--primary); }

/* Step: children */
.child-setup-list { display: grid; gap: 16px; }
.child-setup { display: grid; grid-template-columns: 230px 1fr; gap: 22px; position: relative; }
@media (max-width: 700px) { .child-setup { grid-template-columns: 1fr; } }
.child-preview {
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 10px;
    min-height: 220px;
    padding: 18px 12px;
    border-radius: 22px;
    background: linear-gradient(180deg, var(--top), var(--bottom));
    color: var(--text);
    text-align: center;
    font-family: "Fredoka", sans-serif;
    font-size: 20px;
    transition: background .3s;
}
.preview-avatar {
    display: grid;
    place-items: center;
    width: 92px;
    height: 92px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .12);
}
.preview-cards { display: flex; gap: 6px; }
.preview-cards i {
    display: grid;
    place-items: center;
    width: 46px;
    height: 50px;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 3px 0 rgba(0, 0, 0, .08);
}
.preview-cards i:first-child { box-shadow: 0 0 0 3px var(--primary); }
.child-setup-form { display: grid; gap: 14px; align-content: start; }
.remove-child { position: absolute; top: 12px; right: 12px; }
.speech-setup { border-top: 1px solid var(--line); }
.avatar-choices { display: flex; flex-wrap: wrap; gap: 6px; }
.avatar-choice {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border: 3px solid transparent;
    border-radius: 16px;
    background: var(--surface-2);
    cursor: pointer;
    padding: 0;
}
.avatar-choice:hover { background: var(--primary-soft); }
.avatar-choice.on { border-color: var(--primary); background: var(--primary-soft); }
.avatar-choices .icon-picker-btn { min-width: 52px; height: 52px; padding: 2px 6px; flex-direction: row; font-size: 12px; }
.theme-dots { display: flex; flex-wrap: wrap; gap: 8px; }
.theme-dot {
    width: 40px;
    height: 40px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--top) 0 50%, var(--primary) 50%);
    box-shadow: 0 0 0 2px var(--line);
    cursor: pointer;
    padding: 0;
}
.theme-dot.on { box-shadow: 0 0 0 3px var(--primary); transform: scale(1.1); }

/* Step: routines */
.routine-choices { display: grid; gap: 12px; }
.routine-choice {
    border: 2px solid transparent;
    border-radius: 20px;
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: border-color .15s;
}
.routine-choice.on { border-color: var(--primary); }
.routine-choice-head {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 18px;
    border: 0;
    background: none;
    color: var(--text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.routine-choice:not(.on) .routine-choice-head { opacity: .75; }
.routine-choice-head.custom { cursor: default; }
.routine-choice-head .icon-picker-btn { padding: 4px; }
.routine-choice-head strong { display: block; font-family: "Fredoka", sans-serif; font-size: 20px; }
.routine-choice-head small { color: var(--muted); }
.check-toggle {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 3px solid var(--line);
    border-radius: 50%;
    color: #fff;
    font-weight: 900;
    flex: none;
}
.routine-choice.on .check-toggle { border-color: var(--primary); background: var(--primary); }
.routine-choice-body { padding: 0 18px 16px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sortable.chip-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.mission-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px 4px 4px;
    border-radius: 999px;
    background: var(--surface-2);
    font-weight: 700;
    font-size: 14px;
    cursor: grab;
    letter-spacing: normal;
    color: var(--text);
    touch-action: none;
}
.mission-chip .n {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--surface);
    color: var(--muted);
    font-size: 12px;
}
.mission-chip .x {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--muted);
    font-size: 18px;
    cursor: pointer;
    padding: 0;
}
.mission-chip .x:hover { background: var(--danger-soft); color: var(--danger); }
.add-chip { border-style: dashed; color: var(--primary-dark); }

/* Step: week */
.week-grid { display: grid; gap: 8px; }
.week-grid-head, .week-grid-row { display: grid; grid-template-columns: minmax(180px, 1.2fr) 1fr 1fr; gap: 10px; align-items: center; }
.week-grid-head span { display: flex; align-items: center; gap: 6px; font-weight: 800; }
.week-grid-head small { color: var(--muted); font-weight: 600; }
.week-grid-row { padding: 10px 12px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.week-routine { display: flex; align-items: center; gap: 10px; }
.week-routine span { display: grid; }
.week-routine small { color: var(--muted); }
.week-slot {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 52px;
    padding: 6px 10px;
    border-radius: 14px;
    background: var(--surface-2);
}
.week-slot.on { background: var(--primary-soft); }
.slot-toggle { display: flex; align-items: center; gap: 8px; font-weight: 800; cursor: pointer; }
.slot-toggle input { width: 22px; height: 22px; accent-color: var(--primary); }
.slot-times { display: inline-flex; align-items: center; gap: 4px; }
.slot-times .input { padding: 4px 6px; min-height: 36px; }
.only-mobile { display: none; }
@media (max-width: 700px) {
    .week-grid-head { display: none; }
    .week-grid-row { grid-template-columns: 1fr; }
    .only-mobile { display: inline; }
    .only-desktop { display: none; }
}
.week-preview { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-top: 18px; }
.plan-preview { padding: 16px; border-radius: 18px; background: rgba(255, 255, 255, .7); border: 2px dashed var(--line); }
.plan-preview h3 { display: flex; align-items: center; gap: 8px; }
.timeline-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.timeline-list li { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.timeline-list .time { width: 46px; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 14px; }

/* Step: activities */
.activity-list { display: grid; gap: 8px; }
.activity-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--shadow);
}
.activity-row.on { box-shadow: 0 0 0 2px var(--primary), var(--shadow); }
.activity-name { min-width: 150px; flex: 1; }
.activity-routine { display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--muted); }
.activity-routine.disabled { opacity: .45; }

/* Step: review */
.review-card { margin-bottom: 14px; }
.review-card h2 { display: flex; align-items: center; gap: 8px; }
.review-card h2 small { font-family: "Nunito", sans-serif; font-size: 14px; font-weight: 700; }
.review-children { display: flex; flex-wrap: wrap; gap: 10px; }
.review-child { display: inline-flex; align-items: center; gap: 8px; padding: 4px 16px 4px 4px; border-radius: 999px; background: var(--child-soft, var(--surface-2)); font-weight: 800; font-size: 17px; }
.review-child small { color: var(--muted); font-size: 13px; }
.review-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 14px; }
.review-plans .review-card { margin: 0; }
.review-routine { padding: 10px 0; border-top: 1px solid var(--line); }
.review-routine:first-of-type { border-top: 0; }
.review-routine-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.time-pill { padding: 2px 10px; border-radius: 999px; background: var(--surface-2); font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums; }
.mini.extra { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 2px; background: #fff4d6; border-radius: 999px; }
.mini.extra small { font-weight: 800; color: #7a5a00; }

/* Step: medals */
.medal-setup-list { display: grid; gap: 14px; margin-top: 14px; }
.medal-setup { border-top: 6px solid var(--child, var(--primary)); }
.medal-setup h2 { display: flex; align-items: center; gap: 10px; }
.medal-setup .medal-choice { margin-bottom: 0; }

/* Step: devices */
.device-card { margin-bottom: 14px; border-top: 6px solid var(--child, var(--primary)); }
.device-card h2 { display: flex; align-items: center; gap: 10px; }

/* ---------- Printed day plans (PrintPage, PaperSheet) ---------- */

.print-options { display: grid; gap: 14px; margin-bottom: 28px; }
.print-option { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.print-option-label { width: 76px; font-weight: 800; }
.print-options .hint { margin: 0; }
.print-when strong { text-transform: capitalize; }
.print-alternative { display: flex; align-items: center; gap: 12px; margin: 14px 0 0; padding: 10px 14px; border-radius: 14px; background: var(--surface-2); font-size: 14px; }
@media (max-width: 600px) { .print-option-label { width: 100%; } }

.print-sheets { display: grid; justify-items: center; gap: 28px; }

/* A sheet of A4 paper. The sheet inside is sized in em from the paper's width, so it is the printed page in miniature. */
.sheet-slot {
    width: 100%;
    max-width: 800px;
    aspect-ratio: 210 / 297;
    container-type: inline-size;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(29, 27, 58, .12), 0 14px 40px rgba(29, 27, 58, .12);
}

/* Computed where they are set, so a mission's pictogram and tick box keep their size inside elements with a smaller font. */
@property --paper-pic { syntax: "<length>"; inherits: true; initial-value: 0px; }
@property --paper-box { syntax: "<length>"; inherits: true; initial-value: 0px; }

.sheet {
    --ink: #1d1b3a;
    --ink-soft: #5d5a7a;
    --paper-line: #d9d6e8;
    --edge: color-mix(in srgb, var(--child, #6d5ce8) 72%, #1d1b3a);
    --cols: 4;
    --gap: .8em;
    --paper-pic: 5.6em;
    --paper-box: 1.8em;
    --label: 1.1em;
    display: grid;
    align-content: start;
    gap: 1.1em;
    padding: 5.714cqw; /* 12 mm of 210 */
    font-family: var(--paper-font, "Fredoka", sans-serif);
    font-size: 2.016cqw; /* 12 pt of 210 mm */
    line-height: 1.25;
    color: var(--ink);
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}
/* Steps down until the day fits on one page (pictogram.fitSheets). */
.sheet[data-fit="1"] { --cols: 5; --gap: .7em; --paper-pic: 4.4em; --paper-box: 1.5em; --label: 1em; }
.sheet[data-fit="2"] { --cols: 6; --gap: .6em; --paper-pic: 3.6em; --paper-box: 1.3em; --label: .92em; }
.sheet[data-fit="3"] { --cols: 6; --gap: .55em; --paper-pic: 3.1em; --paper-box: 1.2em; --label: .88em; gap: .9em; }
.sheet[data-fit="4"] { --cols: 7; --gap: .5em; --paper-pic: 2.7em; --paper-box: 1.1em; --label: .82em; gap: .8em; }

.sheet h2, .sheet h3 { margin: 0; font-family: inherit; }
.sheet .pic { display: block; flex: none; object-fit: contain; }
.sheet .photo { object-fit: cover; border-radius: .5em; }

.sheet-head {
    display: flex;
    align-items: center;
    gap: 1em;
    padding: .9em 1.3em .9em .9em;
    border-radius: 1.4em;
    background: var(--child-soft, var(--primary-soft));
}
.sheet-avatar {
    display: grid;
    place-items: center;
    flex: none;
    width: 4.6em;
    height: 4.6em;
    border: .22em solid var(--child, var(--primary));
    border-radius: 50%;
    background: #fff;
    overflow: hidden;
}
.sheet-avatar img { width: 3.2em; height: 3.2em; }
.sheet-avatar img.photo { width: 100%; height: 100%; border-radius: 0; }
.sheet-head h2 { font-size: 2.3em; font-weight: 700; line-height: 1.05; overflow-wrap: anywhere; }
.sheet-date { margin: .2em 0 0; font-size: 1.2em; font-weight: 600; color: var(--ink-soft); }
.sheet-date::first-letter { text-transform: uppercase; }
.sheet-plan {
    display: inline-flex;
    align-items: center;
    gap: .4em;
    flex: none;
    max-width: 40%;
    padding: .35em .9em .35em .4em;
    border-radius: 999px;
    background: #fff;
    font-weight: 700;
}
.sheet-plan .pic { width: 1.7em; height: 1.7em; }

.sheet-reminders {
    display: grid;
    gap: .45em;
    padding: .75em 1em;
    border: .13em dashed #e0bf4f;
    border-radius: 1.1em;
    background: #fffbea;
}
.sheet-reminders h3 { font-size: .85em; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #7a5a00; }
.paper-notes { display: flex; flex-wrap: wrap; gap: .4em 1.4em; margin: 0; padding: 0; list-style: none; }
.paper-notes li { display: flex; align-items: center; gap: .45em; font-weight: 700; }
.paper-notes .pic { width: 1.9em; height: 1.9em; }
.paper-notes small { font-size: .85em; font-weight: 600; color: var(--ink-soft); white-space: nowrap; }
.paper-routine > .paper-notes { gap: .4em; }
.paper-routine > .paper-notes li { padding: .2em .9em .2em .3em; border: .1em dashed #e0bf4f; border-radius: 999px; background: #fffbea; }
.paper-routine > .paper-notes .pic { width: 1.5em; height: 1.5em; }

.paper-routine { display: grid; gap: .6em; break-inside: avoid; }
.paper-routine-head {
    display: flex;
    align-items: center;
    gap: .6em;
    padding-bottom: .4em;
    border-bottom: .16em solid var(--child, var(--primary));
}
.paper-routine-head .pic { width: 2.4em; height: 2.4em; }
.paper-routine-head h3 { min-width: 0; font-size: 1.6em; font-weight: 700; line-height: 1.1; }
.paper-time {
    padding: .15em .7em;
    border-radius: 999px;
    background: var(--child-soft, var(--primary-soft));
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.paper-star { flex: none; width: 2.3em; height: 2.3em; margin-left: auto; fill: none; stroke: var(--edge); stroke-width: 1.3; stroke-linejoin: round; }

.paper-missions {
    display: grid;
    grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
    gap: var(--gap);
    margin: 0;
    padding: 0;
    list-style: none;
}
.paper-mission { position: relative; container-type: inline-size; break-inside: avoid; border: .12em solid var(--paper-line); border-radius: 1em; }
.paper-pic .pic { width: var(--paper-pic); height: var(--paper-pic); }
/* --word is the longest word's length: rather smaller text (up to .6em per bold letter) than a word broken in two – within reason.
   No hyphenation: whole words are easier to read for a child learning to. */
.paper-label { font-size: max(.6em, min(var(--label), 100cqi / (var(--word, 1) * .6))); font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.no-labels .paper-label { display: none; }
.paper-box {
    flex: none;
    width: var(--paper-box);
    height: var(--paper-box);
    border: .15em solid var(--edge);
    border-radius: .35em;
    background: #fff;
}
.paper-step {
    display: grid;
    place-items: center;
    width: var(--paper-box);
    height: var(--paper-box);
    border-radius: 50%;
    background: var(--child-soft, var(--primary-soft));
    color: var(--edge);
    font-size: .85em;
    font-weight: 800;
}
/* A follow-up ("Husk også …") gets a small tick box of its own. */
.paper-follow {
    display: flex;
    align-items: center;
    gap: .35em;
    padding-top: .4em;
    border-top: .1em dashed var(--paper-line);
    font-size: .8em;
    font-weight: 700;
    line-height: 1.1;
    text-align: left;
}
.paper-follow .pic { width: 1.8em; height: 1.8em; }
/* Like .paper-label, next to the pictogram and tick box (about 3.7em). */
.paper-follow-text { flex: 1; min-width: 0; font-size: max(.6em, min(1em, (100cqi - 3.7em) / (var(--word, 1) * .6))); overflow-wrap: anywhere; }
.paper-follow .paper-box { width: calc(var(--paper-box) * .8); height: calc(var(--paper-box) * .8); }

/* Pictogram cards: the tick box in the corner, the number in the other. */
.paper-kort .paper-mission {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .4em;
    padding: .7em .45em .6em;
    text-align: center;
}
.paper-kort .paper-mission > .paper-box { position: absolute; top: .45em; right: .45em; }
.paper-kort .paper-step { position: absolute; top: .45em; left: .45em; }
/* The follow-up at the bottom: pictogram and tick box side by side and the text under them in the card's full width, so it also
   reads in a narrow card. */
.paper-kort .paper-follow { flex-wrap: wrap; justify-content: center; gap: .25em .45em; align-self: stretch; margin-top: auto; text-align: center; }
.paper-kort .paper-follow-text { order: 1; flex: 1 0 100%; font-size: max(.6em, min(1em, 100cqi / (var(--word, 1) * .6))); }

/* Checklist: number, pictogram, text and the tick box at the end – like the app's list. Two columns when the day is long. */
.paper-liste { --cols: 1; --gap: .45em; --paper-pic: 2.8em; --paper-box: 1.8em; --label: 1.15em; }
.paper-liste[data-fit="1"] { --cols: 1; --gap: .3em; --paper-pic: 2.2em; --paper-box: 1.5em; --label: 1.05em; }
.paper-liste[data-fit="2"] { --gap: .35em; --paper-pic: 2.4em; --paper-box: 1.5em; --label: 1em; }
.paper-liste[data-fit="3"] { --gap: .3em; --paper-pic: 2em; --paper-box: 1.35em; --label: .95em; }
.paper-liste[data-fit="4"] { --gap: .25em; --paper-pic: 1.7em; --paper-box: 1.25em; --label: .9em; }
/* Two columns that run down the first before the second, each mission as tall as it needs. */
.paper-liste:is([data-fit="2"], [data-fit="3"], [data-fit="4"]) .paper-missions { display: block; columns: 2; column-gap: .9em; }
.paper-liste:is([data-fit="2"], [data-fit="3"], [data-fit="4"]) .paper-mission { margin-bottom: var(--gap); }
.paper-liste:is([data-fit="3"], [data-fit="4"]) .paper-mission { padding: .3em .7em; }
.paper-liste .paper-mission {
    display: grid;
    grid-template-columns: auto var(--paper-pic) minmax(0, 1fr) auto;
    align-items: center;
    gap: .3em .75em;
    padding: .4em .8em;
}
.paper-liste.no-order .paper-mission { grid-template-columns: var(--paper-pic) minmax(0, 1fr) auto; }
/* Placed from the end, so the columns stay put without numbers or text. */
.paper-liste .paper-pic { grid-area: 1 / -4 / 2 / -3; }
.paper-liste .paper-label { grid-area: 1 / -3 / 2 / -2; }
.paper-liste .paper-mission > .paper-box { grid-area: 1 / -2 / 2 / -1; }
.paper-liste .paper-follow { grid-area: 2 / -3 / 3 / -1; font-size: .9em; }

@media print {
    html, body { background: #fff; }
    .sidebar, .topbar, .scrim, .toasts, .no-print, #cookie-consent, #blazor-error-ui, #components-reconnect-modal { display: none !important; }
    .main { margin: 0; min-height: 0; }
    .content { max-width: none; padding: 0; }
    .print-sheets { display: block; }
    .sheet-slot { max-width: none; aspect-ratio: auto; container-type: normal; border-radius: 0; box-shadow: none; }
    .sheet-slot ~ .sheet-slot { break-before: page; }
    /* The page itself has no margin (PrintPage), so a sheet that runs onto a second page gets its padding there as well. */
    .sheet { padding: 12mm; font-size: 12pt; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
}

/* The language links under the card on the login pages (LanguageLinks). The card and the links are centred as one. */
.login-page { align-content: center; gap: 16px; }
.language-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; font-size: 14px; color: var(--muted); }
.language-links a { color: inherit; }
.language-links [aria-current] { color: var(--text); font-weight: 700; }
