@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/Inter-Regular.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('../fonts/Inter-SemiBold.woff2') format('woff2');
}

/* ============================================================
   1. DESIGN TOKENS
   ============================================================ */

:root {
    color-scheme: light dark;

    --brand: #0056ab;
    --brand-strong: #004589;
    --brand-soft: #e5f0f8;
    --brand-contrast: #ffffff;

    --girl: #e70041;
    --girl-soft: #fefefe;
    --boy: #0056ab;
    --boy-soft: #fefefe;

    --ok: #0f9d6e;
    --ok-soft: #e6f7f1;
    --danger: #e0343f;
    --danger-soft: #fdecec;
    --warn: #d97706;

    --bg: #f4f5f9;
    --surface: #ffffff;
    --surface-2: #f8f9fc;
    --line: #e7e8f0;
    --line-strong: #d6d8e4;

    --ink: #131829;
    --ink-2: #3f465c;
    --ink-3: #6c7389;
    --ink-4: #9aa0b4;

    --shadow-sm: 0 1px 2px rgba(19, 24, 41, .06), 0 1px 3px rgba(19, 24, 41, .04);
    --shadow-md: 0 4px 14px -4px rgba(19, 24, 41, .12), 0 2px 4px rgba(19, 24, 41, .04);
    --shadow-lg: 0 18px 40px -12px rgba(19, 24, 41, .28);

    --r-sm: 8px;
    --r: 12px;
    --r-lg: 15px;
    --r-xl: 26px;

    --sat: env(safe-area-inset-top, 0px);
    --sab: env(safe-area-inset-bottom, 0px);
    --appbar-h: 54px;
    --tabbar-h: 58px;
    /* Extra room reserved by the native shell (e.g. an overlaying ad banner).
       The native side can change it at runtime: window.setBottomInset(px). */
    --extra-bottom: 0px;

    --chart-line: #cfd3e2;
    --chart-line-strong: #8b93a7;
    --chart-band: #f0f1f7;
    --chart-grid: #ebecf3;
    --chart-text: #6c7389;
    --chart-bg: #ffffff;
}

@media (prefers-color-scheme: dark) {
    :root {
        --brand: #4aa3e6;
        --brand-strong: #6bb6ee;
        --brand-soft: #0d2a40;
        --brand-contrast: #061018;

        --girl: #f472b6;
        --girl-soft: #3a1a2c;
        --boy: #60a5fa;
        --boy-soft: #16263f;

        --ok: #34d3a0;
        --ok-soft: #10291f;
        --danger: #ff6b6b;
        --danger-soft: #2e1618;

        --bg: #0a0d18;
        --surface: #141826;
        --surface-2: #1a1f30;
        --line: #262c3e;
        --line-strong: #333a50;

        --ink: #f2f3f8;
        --ink-2: #c8cbd8;
        --ink-3: #98a0b4;
        --ink-4: #757d94;

        --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
        --shadow-md: 0 6px 18px -6px rgba(0, 0, 0, .6);
        --shadow-lg: 0 20px 44px -14px rgba(0, 0, 0, .75);

        --chart-line: #38405a;
        --chart-line-strong: #9aa3c4;
        --chart-band: #1b2032;
        --chart-grid: #232941;
        --chart-text: #98a0b4;
        --chart-bg: #141826;
    }
}

/* ============================================================
   2. BASE
   ============================================================ */

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

html, body { margin: 0; padding: 0; }

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: none;
}

body.is-locked { overflow: hidden; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.015em; color: var(--ink); }
h1 { font-size: 26px; line-height: 1.25; }
h2 { font-size: 20px; line-height: 1.3; }
h3 { font-size: 17px; line-height: 1.35; }
h4 { font-size: 15px; line-height: 1.4; }
p { margin: 0 0 10px; color: var(--ink-2); }
p:last-child { margin-bottom: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

a {
    color: var(--brand);
    text-decoration: none;
    font-weight: 500;
}
a:active { opacity: .7; }

img { max-width: 100%; }

.ico {
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
    display: inline-block;
    vertical-align: -.22em;
}
.ico--sm { width: 18px; height: 18px; }
.ico--lg { width: 26px; height: 26px; }

.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.center { text-align: center; }
.strong { font-weight: 600; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.stack > * + * { margin-top: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ============================================================
   3. APP BAR
   ============================================================ */

.app-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 40;
    padding-top: var(--sat);
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    backdrop-filter: saturate(160%) blur(14px);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    border-bottom: 1px solid var(--line);
}

@supports not (background: color-mix(in srgb, red 50%, blue)) {
    .app-bar { background: var(--surface); }
}

.app-bar__inner {
    height: var(--appbar-h);
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 8px;
    max-width: 620px;
    margin: 0 auto;
}

.app-bar__slot {
    width: 40px;
    flex: 0 0 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.app-bar__slot--end {
    width: auto;
    flex: 0 0 auto;
    gap: 0;
}

.app-bar__title {
    flex: 1 1 auto;
    min-width: 0;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-bar__brand {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: none;
    border-radius: 0;
}
.app-bar__brand img { width: 32px; height: 32px; object-fit: contain; display: block; }
.app-bar__brand { cursor: pointer; padding: 0; border: 0; }

/* back button only in drill-down views */
#app-back { display: none; }
body.is-detail #app-back { display: inline-flex; }
body.is-detail .app-bar__brand { display: none; }

.icon-btn {
    -webkit-appearance: none;
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--ink-2);
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color .15s ease, transform .15s ease, color .15s ease;
}
.icon-btn:active { background: var(--surface-2); transform: scale(.94); }
.icon-btn--brand { color: var(--brand); }
.icon-btn .fa-solid { font-size: 16px; line-height: 1; }
.icon-btn--danger,
.icon-btn--danger .fa-solid { color: var(--danger); }

/* ============================================================
   4. SCREENS & TAB BAR
   ============================================================ */

.screen { display: none; }
.screen.is-active { display: block; }

.screen__body {
    max-width: 620px;
    margin: 0 auto;
    padding: calc(var(--appbar-h) + var(--sat) + 14px) 16px calc(var(--sab) + var(--extra-bottom) + 28px);
}

.screen--plain .screen__body {
    padding-top: calc(var(--sat) + 18px);
    padding-bottom: calc(var(--sab) + var(--extra-bottom) + 32px);
}

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin: 4px 0 16px;
}
.page-head__title { font-size: 25px; letter-spacing: -.02em; }
.page-head__sub { margin-top: 2px; font-size: 13px; color: var(--ink-3); }

.tab-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    padding-bottom: calc(var(--sab) + var(--extra-bottom));
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: saturate(160%) blur(14px);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    border-top: 1px solid var(--line);
}

@supports not (background: color-mix(in srgb, red 50%, blue)) {
    .tab-bar { background: var(--surface); }
}

body.no-tabbar .tab-bar { display: none; }

.tab-bar__inner {
    height: var(--tabbar-h);
    max-width: 620px;
    margin: 0 auto;
    display: flex;
    align-items: stretch;
}

.tab {
    -webkit-appearance: none;
    appearance: none;
    border: 0;
    background: none;
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 2px 4px;
    color: var(--ink-3);
    font-family: inherit;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: -.01em;
    cursor: pointer;
    transition: color .18s ease;
}
.tab .ico { width: 23px; height: 23px; }
.tab span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tab.is-active { color: var(--brand); }
.tab:active { opacity: .6; }

/* ============================================================
   5. CARDS & LISTS
   ============================================================ */

.card {
    background: var(--surface);
    /*border: 1px solid var(--line);*/
    border-radius: var(--r-sm);
    box-shadow: var(--shadow-sm);
    padding: 16px;
}
.card + .card { margin-top: 14px; }
.card--flush { padding: 0; overflow: hidden; }
.card--danger { border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }

.card__head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}
.card__head .ico,
.card__head .fa-solid { color: var(--brand); }
.card__head h3 { flex: 1 1 auto; }
.card__note { font-size: 13px; color: var(--ink-3); margin-top: 10px; }

.section-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ink-4);
    margin: 22px 4px 10px;
}

.list { display: block; }
.list__row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--line);
}
.list__row:last-child { border-bottom: 0; }
.list__row .ico { color: var(--ink-3); }
.list__main { flex: 1 1 auto; min-width: 0; }
.list__value { font-variant-numeric: tabular-nums; font-weight: 600; }
.list__date { font-size: 13px; color: var(--ink-3); }

/* ---- child cards ---- */

#percentile-child-list { display: block; }

.kid {
    display: flex;
    align-items: center;
    gap: 13px;
    width: 100%;
    padding: 12px;
    margin-bottom: 12px;
    background: var(--surface);
    /*border: 1px solid var(--line);*/
    border-radius: var(--r-sm);
    box-shadow: var(--shadow-sm);
    transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease;
}
.kid.is-dragging {
    box-shadow: var(--shadow-lg);
    transform: scale(1.02);
    position: relative;
    z-index: 5;
    opacity: .97;
}
.kid.is-shifted { transform: translateY(0); }

.kid__open {
    -webkit-appearance: none;
    appearance: none;
    border: 0;
    background: none;
    padding: 0;
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 13px;
    text-align: left;
    font-family: inherit;
    color: inherit;
    cursor: pointer;
}
.kid__open:active { opacity: .6; }

.kid__avatar {
    width: 50px;
    height: 50px;
    flex: 0 0 50px;
    border-radius: 17px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--boy-soft);
    color: var(--boy);
}
.kid__avatar .ico { width: 28px; height: 28px; }
.kid__avatar .ico-male,
.kid__avatar .ico-female { width: 22px; height: 40px; }
.hero-kid__avatar .ico-male,
.hero-kid__avatar .ico-female { width: 24px; height: 44px; }
.kid--f .kid__avatar,
.genderF .kid__avatar { background: var(--girl-soft); color: var(--girl); }
.genderM .kid__avatar { background: var(--boy-soft); color: var(--boy); }
.genderM .ico-female,
.genderF .ico-male,
.kid--m .ico-female,
.kid--f .ico-male { display: none; }

.kid__text {
    flex: 1 1 auto;
    min-width: 0;
}

.kid__name {
    display: block;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.kid__meta {
    display: block;
    font-size: 12.5px;
    color: var(--ink-3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.kid__actions { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }
.kid__grip { color: var(--ink-4); touch-action: none; cursor: grab; }
.kid.is-dragging .kid__grip,
.kid__grip.is-dragging { color: var(--ok); }
body.is-reordering { cursor: grabbing; }

/* ---- empty state ---- */

.empty {
    text-align: center;
    padding: 30px 20px;
    background: var(--surface);
    border: 1px dashed var(--line-strong);
    border-radius: var(--r-lg);
}
.empty__art {
    width: 62px;
    height: 62px;
    margin: 0 auto 14px;
    border-radius: 22px;
    background: var(--brand-soft);
    color: var(--brand);
    display: flex;
    align-items: center;
    justify-content: center;
}
.empty__art .ico { width: 32px; height: 32px; }
.empty h3 { margin-bottom: 6px; }
.empty p { color: var(--ink-3); font-size: 14px; margin-bottom: 16px; }

/* ============================================================
   6. BUTTONS
   ============================================================ */

.btn {
    -webkit-appearance: none;
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: var(--r);
    background: var(--surface-2);
    color: var(--ink);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -.01em;
    line-height: 1;
    text-align: center;
    cursor: pointer;
    transition: transform .14s ease, filter .14s ease, background-color .14s ease, opacity .14s ease;
}
.btn:active { transform: scale(.975); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn .ico { width: 19px; height: 19px; }
.btn .fa-solid { font-size: 1em; line-height: 1; }

.btn--primary {
    background: var(--brand);
    color: var(--brand-contrast);
    box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--brand) 70%, transparent);
}
.btn--primary:active { background: var(--brand-strong); }

.btn--ghost {
    background: transparent;
    border-color: var(--line-strong);
    color: var(--ink);
}
.btn--soft { background: var(--brand-soft); color: var(--brand); }
.btn--ok {
    background: var(--ok);
    color: #fff;
    box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--ok) 70%, transparent);
}
.btn--ok:active { background: color-mix(in srgb, var(--ok) 88%, #000); }
.btn--ok .fa-solid { color: #fff; }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger-soft { background: var(--danger-soft); color: var(--danger); }
.btn--danger-soft .fa-solid,
.btn--link .fa-solid { color: inherit; }
.btn--block { display: flex; width: 100%; }
.btn--sm { min-height: 38px; padding: 0 14px; font-size: 13.5px; border-radius: var(--r-sm); }
.btn--lg { min-height: 52px; font-size: 16px; }
.btn--link {
    background: none;
    min-height: 0;
    padding: 6px 2px;
    color: var(--brand);
    font-weight: 500;
}

.btn-row { display: flex; gap: 10px; }
.btn-row > .btn { flex: 1 1 0; }

/* ============================================================
   7. FORMS
   ============================================================ */

form { margin: 0; }

.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field__label {
    display: block;
    margin: 0 2px 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-2);
}
.field__hint { margin: 6px 2px 0; font-size: 12.5px; color: var(--ink-3); }

.input, .select, textarea.input {
    -webkit-appearance: none;
    appearance: none;
    display: block;
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r);
    background: var(--surface);
    color: var(--ink);
    font-family: inherit;
    font-size: 16px; /* keeps iOS from zooming on focus */
    line-height: 1.4;
    transition: border-color .16s ease, box-shadow .16s ease;
}
.input::placeholder, textarea.input::placeholder { color: var(--ink-4); }
.input:focus, .select:focus, textarea.input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--brand) 18%, transparent);
}
textarea.input { min-height: 128px; resize: vertical; }

.select {
    padding-right: 38px;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236c7389' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9.5 12 15.5 18 9.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px 18px;
}

.field--invalid .input, .field--invalid .select { border-color: var(--danger); }
.field__error {
    display: none;
    margin: 6px 2px 0;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--danger);
}
.field--invalid .field__error { display: block; }

.field-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.field-grid--date { grid-template-columns: 22% 1fr 27%; }
.field-grid--3 { grid-template-columns: repeat(3, 1fr); }
.field-grid--2 { grid-template-columns: 1fr 1fr; }
body:not(.units-imperial) .unit-imperial { display: none !important; }
body.units-imperial .unit-metric { display: none !important; }

.setting-row__labels {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 14px;
    font-weight: 600;
}
.switch {
    -webkit-appearance: none;
    appearance: none;
    position: relative;
    width: 48px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: var(--surface-2);
    box-shadow: inset 0 0 0 1px var(--line-strong);
    cursor: pointer;
    flex: 0 0 auto;
}
.switch[aria-checked="true"] { background: var(--ok); box-shadow: none; }
.switch__knob {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.18);
    transition: transform .18s ease;
}
.switch[aria-checked="true"] .switch__knob { transform: translateX(20px); }
.field__label .fa-solid { margin-right: 4px; color: var(--ink-3); }

.check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    color: var(--ink-2);
    line-height: 1.45;
    cursor: pointer;
}
.check input {
    -webkit-appearance: none;
    appearance: none;
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    margin: 0;
    border: 1.5px solid var(--line-strong);
    border-radius: 7px;
    background: var(--surface);
    position: relative;
    transition: background-color .14s ease, border-color .14s ease;
}
.check input:checked {
    background: var(--brand);
    border-color: var(--brand);
}
.check input:checked::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 3px;
    width: 6px;
    height: 11px;
    border: solid var(--brand-contrast);
    border-width: 0 2px 2px 0;
    transform: rotate(42deg);
}

.choice { display: flex; gap: 10px; }
.choice label {
    position: relative;
    flex: 1 1 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    border: 1.5px solid var(--line-strong);
    border-radius: var(--r);
    background: var(--surface);
    font-size: 14.5px;
    font-weight: 500;
    color: var(--ink-2);
    cursor: pointer;
    transition: border-color .16s ease, background-color .16s ease, color .16s ease;
}
.choice input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}
.choice label .ico { width: 14px; height: 22px; color: var(--ink-4); pointer-events: none; }
.choice label span { pointer-events: none; }
.choice input:checked + .ico { color: var(--brand); }
.choice label:has(input:checked),
.choice label.is-checked {
    border-color: var(--brand);
    background: var(--brand-soft);
    color: var(--brand);
}
.choice label:has(input:checked) .ico,
.choice label.is-checked .ico { color: var(--brand); }

.choice label:has(input[value="M"]:checked),
.choice.is-boy label.is-checked {
    border-color: var(--boy);
    background: color-mix(in srgb, var(--boy) 14%, var(--surface));
    color: var(--boy);
}
.choice label:has(input[value="M"]:checked) .ico,
.choice.is-boy label.is-checked .ico,
.choice input[value="M"]:checked + .ico { color: var(--boy); }

.choice label:has(input[value="F"]:checked),
.choice.is-girl label.is-checked {
    border-color: var(--girl);
    background: color-mix(in srgb, var(--girl) 14%, var(--surface));
    color: var(--girl);
}
.choice label:has(input[value="F"]:checked) .ico,
.choice.is-girl label.is-checked .ico,
.choice input[value="F"]:checked + .ico { color: var(--girl); }

@supports not (background: color-mix(in srgb, red 50%, blue)) {
    .choice label:has(input[value="M"]:checked),
    .choice.is-boy label.is-checked { background: var(--brand-soft); }
    .choice label:has(input[value="F"]:checked),
    .choice.is-girl label.is-checked { background: #fde8ef; }
}

/* ============================================================
   8. SEGMENTED CONTROL & TABS
   ============================================================ */

.segmented {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r);
    margin-bottom: 16px;
}
.segmented__btn {
    -webkit-appearance: none;
    appearance: none;
    border: 0;
    background: none;
    flex: 1 1 0;
    min-width: 0;
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 8px;
    border-radius: 10px;
    color: var(--ink-3);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: -.01em;
    cursor: pointer;
    transition: background-color .18s ease, color .18s ease, box-shadow .18s ease;
}
.segmented__btn .ico { width: 18px; height: 18px; }
.segmented__btn .fa-solid { font-size: 14px; }
.segmented__btn .ico-head-f,
.field__label .ico-head-f { display: none; }
.is-girl .segmented__btn .ico-head-m,
.is-girl .ico-head-m { display: none; }
.is-girl .segmented__btn .ico-head-f,
.is-girl .field__label .ico-head-f,
.is-girl .ico-head-f { display: inline-block; }
.segmented__btn span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.segmented__btn.is-active {
    background: var(--surface);
    color: var(--brand);
    box-shadow: var(--shadow-sm);
}

.tabpanel { display: none; }
.tabpanel.is-active { display: block; animation: fade-in .22s ease both; }

@keyframes fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: none; }
}

/* ============================================================
   9. ALERTS, CHIPS, STATS
   ============================================================ */

.alert {
    display: none;
    align-items: flex-start;
    gap: 9px;
    padding: 11px 13px;
    margin-bottom: 12px;
    border-radius: var(--r);
    font-size: 13.5px;
    line-height: 1.45;
}
.alert .ico { width: 19px; height: 19px; margin-top: 1px; }
.alert.is-shown { display: flex; }
.successContent { background: var(--ok-soft); color: var(--ok); }
.errorContent, .errorGeneralContent { background: var(--danger-soft); color: var(--danger); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 11px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    font-size: 12.5px;
    font-weight: 500;
    color: var(--ink-2);
}
.chip .ico { width: 15px; height: 15px; color: var(--ink-3); }
.chip .fa-solid { color: var(--ink-3); font-size: 13px; }

.chip--btn {
    -webkit-appearance: none;
    appearance: none;
    font-family: inherit;
    cursor: pointer;
    transition: background-color .16s ease, color .16s ease, border-color .16s ease;
}
.chip--btn:active { transform: scale(.97); }
.chip--active {
    background: var(--brand-soft);
    border-color: transparent;
    color: var(--brand);
}
.chip--active .ico { color: var(--brand); }

.hero-kid {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 6px;
}
.hero-kid__avatar {
    width: 58px;
    height: 58px;
    flex: 0 0 58px;
    border-radius: 19px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--boy-soft);
    color: var(--boy);
}
.hero-kid__avatar .ico { width: 32px; height: 32px; }
.hero-kid--f .hero-kid__avatar { background: var(--girl-soft); color: var(--girl); }
.hero-kid .ico-female { display: none; }
.hero-kid--f .ico-male { display: none; }
.hero-kid--f .ico-female { display: block; }
.hero-kid h2 { letter-spacing: -.02em; }

.chart-box {
    height: 500px;
    margin: 0 -6px;
}
.chart-card { padding: 12px 10px 12px; }
.chart-card .card__head { margin: 4px 6px 8px; }
.chart-source { margin: 0 6px 12px; }
.chart-focus-toggle {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin: -6px 2px 12px;
}
.chart-focus-toggle__label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink-2);
}
.chart-focus-toggle__label .fa-solid { color: var(--ink-3); }

/* ============================================================
   10. SHEETS (modal / action sheet)
   ============================================================ */

.sheet {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: none;
}
.sheet.is-open { display: block; }

.sheet__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(9, 12, 22, .48);
    opacity: 0;
    transition: opacity .22s ease;
}
.sheet.is-visible .sheet__backdrop { opacity: 1; }

.sheet__panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: calc(100% - var(--sat) - 24px);
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    box-shadow: var(--shadow-lg);
    transform: translateY(101%);
    transition: transform .28s cubic-bezier(.22, .8, .28, 1);
    /*padding-bottom: calc(var(--sab) + var(--extra-bottom)); */
    padding-bottom: 105px;
}
.sheet.is-visible .sheet__panel { transform: none; }

.sheet__grip {
    width: 40px;
    height: 4px;
    border-radius: 99px;
    background: var(--line-strong);
    margin: 9px auto 0;
    flex: 0 0 auto;
}

.sheet__head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 10px 8px 18px;
    flex: 0 0 auto;
}
.sheet__head h3 { flex: 1 1 auto; }

.sheet__body {
    padding: 4px 18px 18px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1 1 auto;
}
.sheet__body > h1:first-child,
.sheet__body > h2:first-child { margin-bottom: 8px; }
.sheet__body h1 { font-size: 20px; }
.sheet__body h2 { font-size: 17px; margin: 18px 0 6px; }
.sheet__body ul { padding-left: 20px; color: var(--ink-2); }
.sheet__body li { margin-bottom: 6px; }

.sheet__foot {
    display: flex;
    gap: 10px;
    padding: 12px 18px calc(12px + var(--sab));
    border-top: 1px solid var(--line);
    flex: 0 0 auto;
}
.sheet__foot .btn { flex: 1 1 0; }

.menu-list { padding: 6px 10px 14px; }
.menu-item {
    -webkit-appearance: none;
    appearance: none;
    border: 0;
    background: none;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 10px;
    border-radius: var(--r);
    color: var(--ink);
    font-family: inherit;
    font-size: 15.5px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
}
.menu-item:active { background: var(--surface-2); }
.menu-item .ico,
.menu-item .fa-solid { color: var(--ink-3); }
.menu-item .fa-solid {
    width: 1.25em;
    font-size: 1.15em;
    text-align: center;
    line-height: 1;
}
.menu-item--danger { color: var(--danger); }
.menu-item--danger .ico,
.menu-item--danger .fa-solid { color: var(--danger); }

/* ============================================================
   11. TOAST & LOADER
   ============================================================ */

.toast-wrap {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(var(--sab) + var(--extra-bottom) + 16px);
    z-index: 95;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    pointer-events: none;
}
.toast {
    max-width: 100%;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 11px 16px;
    border-radius: 999px;
    background: rgba(19, 24, 41, .94);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity .2s ease, transform .2s ease;
}
.toast.is-shown { opacity: 1; transform: none; }
.toast .ico { width: 18px; height: 18px; }
.toast--ok .ico { color: #6ee7b7; }
.toast--err .ico { color: #fca5a5; }

.skeleton {
    height: 74px;
    border-radius: var(--r-lg);
    margin-bottom: 12px;
    background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%);
    background-size: 220% 100%;
    animation: shimmer 1.2s linear infinite;
    border: 1px solid var(--line);
}
@keyframes shimmer {
    from { background-position: 120% 0; }
    to { background-position: -120% 0; }
}

/* ============================================================
   12. AUTH SCREEN
   ============================================================ */

.auth {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.auth__brand {
    text-align: center;
    margin-bottom: 22px;
}
.auth__logo {
    margin: 0 auto 14px;
    background: none;
    border: 0;
    box-shadow: none;
    width: auto;
    height: auto;
}
.auth__logo img { width: 88px; height: auto; object-fit: contain; display: block; margin: 0 auto; }
.auth__logo .ico--auth {
    width: 72px;
    height: 72px;
    color: var(--brand);
    display: block;
    margin: 0 auto;
}
.forgot-link { margin-top: 28px; display: block; }
.auth__brand h1 { font-size: 23px; }
.auth__brand p { margin-top: 6px; font-size: 14px; color: var(--ink-3); }
.auth__foot { margin-top: 18px; text-align: center; }
.auth__foot .btn--link { display: inline-flex; gap: 6px; }

body.kb-open .tab-bar { display: none; }
body.no-reorder .kid__grip { display: none; }

/* ============================================================
   13. HIGHCHARTS TWEAKS
   ============================================================ */

.highcharts-container, .highcharts-container * { font-family: 'Inter', -apple-system, sans-serif !important; }
.highcharts-background { fill: transparent; }

@media (min-width: 700px) {
    .chart-box { height: 500px; }
}

main{
    padding-bottom:60px;
}