/* 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;
}

: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-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;
}

.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; }

.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; }

.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);
}

.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)); }
}

/* ---------- 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;
}

/* ---------- 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; }

/* ---------- 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 {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 14px;
    background: var(--surface-2);
    font-weight: 700;
}
.routine-progress li.complete { background: var(--success-soft); }
.routine-progress 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-progress .grow { flex: 1 0 auto; max-width: 55%; }
.routine-progress .mini-icons { flex: 1 1 auto; min-width: 0; justify-content: flex-end; }
.routine-progress .count { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--muted); }
.routine-progress .complete .count { color: var(--success); }
@media (max-width: 560px) { .routine-progress .mini-icons { display: none; } }

/* Extra missions for a single day ("Hent mormors hund") */
.routine-progress .add-extra { width: 34px; height: 34px; margin: -4px -4px -4px 0; font-size: 24px; font-weight: 700; color: var(--primary-dark); }
.routine-progress .add-extra:hover { background: var(--primary-soft); }
.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; }
.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; }

/* ---------- 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; }

.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-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: devices */
.device-card { margin-bottom: 14px; border-top: 6px solid var(--child, var(--primary)); }
.device-card h2 { display: flex; align-items: center; gap: 10px; }
