@font-face {
    font-family: Geist;
    src: url('fonts/geist-latin-wght-normal.woff2') format('woff2');
    font-weight: 100 900;
    font-display: swap;
}

:root {
    /* KinderOne wordmark and emblem */
    --navy: #051238;
    --blue: #062ddd;
    --blue-rgb: 6, 45, 221;
    --blue-hover: #0525b7;
    --blue-active: #051e97;
    --teal: #08d0ad;
    --teal-ink: #006354;
    --teal-chart: #008371;
    --teal-soft: #e1f8f2;
    --blue-soft: #e9eeff;
    --blue-wash: #f3f6ff;
    --blue-edge: #c7d3f8;
    --nav-ink: #dde7ff;
    --nav-muted: #bcccf3;
    --nav-hover: #14244c;
    --nav-active: #173289;
    --nav-edge: #304277;
    --focus-blue: #3157dd;
    --focus-halo: rgba(var(--blue-rgb), .16);
    --ink: var(--navy);
    --muted: #495b79;
    --paper: #f4f7fc;
    --stroke: #dbe4f2;
    --bs-body-font-family: Geist, system-ui, sans-serif;
    --bs-body-color: var(--ink);
    --bs-primary: var(--blue);
    --bs-primary-rgb: var(--blue-rgb);
    --bs-primary-text-emphasis: var(--blue-active);
    --bs-primary-bg-subtle: var(--blue-soft);
    --bs-primary-border-subtle: var(--blue-edge);
    --bs-link-color: var(--blue);
    --bs-link-color-rgb: var(--blue-rgb);
    --bs-link-hover-color: var(--blue-hover);
    --bs-link-hover-color-rgb: 5, 37, 183;
    --bs-focus-ring-color: var(--focus-halo);
}

body { min-height: 100vh; }
[hidden] { display: none !important; }
h1, h2, strong { font-weight: 660; }
h1 { letter-spacing: -.045em; }
.muted { color: var(--muted); }
.min-width-zero { min-width: 0; }
.btn { border-radius: .65rem; font-weight: 600; }
.btn-primary {
    --bs-btn-bg: var(--blue);
    --bs-btn-border-color: var(--blue);
    --bs-btn-hover-bg: var(--blue-hover);
    --bs-btn-hover-border-color: var(--blue-hover);
    --bs-btn-active-bg: var(--blue-active);
    --bs-btn-active-border-color: var(--blue-active);
    --bs-btn-focus-shadow-rgb: var(--blue-rgb);
}
.btn-outline-secondary {
    --bs-btn-color: var(--blue);
    --bs-btn-border-color: var(--blue-edge);
    --bs-btn-hover-bg: var(--blue-soft);
    --bs-btn-hover-color: var(--navy);
    --bs-btn-hover-border-color: var(--blue-edge);
}
.form-check-input:checked { background-color: var(--blue); border-color: var(--blue); }
.form-check-input:focus { border-color: var(--focus-blue); box-shadow: 0 0 0 .2rem var(--focus-halo); }
.dropdown-menu { --bs-dropdown-link-active-bg: var(--blue); }
.pagination {
    --bs-pagination-active-bg: var(--blue);
    --bs-pagination-active-border-color: var(--blue);
    --bs-pagination-focus-box-shadow: 0 0 0 .2rem var(--focus-halo);
}
.form-label { font-size: .875rem; font-weight: 650; }
.form-control, .form-select { border-color: var(--stroke); border-radius: .65rem; min-height: 43px; }
.form-control:focus, .form-select:focus { border-color: var(--focus-blue); box-shadow: 0 0 0 .2rem var(--focus-halo); }

.input-with-icon .input-group-text, .input-with-icon .password-toggle { background: #fff; border: 1px solid var(--stroke); color: var(--muted); }
.input-with-icon .input-group-text { border-right: 0; border-radius: .7rem 0 0 .7rem; padding-left: .85rem; }
.input-with-icon .form-control { border-left: 0; padding-left: .25rem; min-height: 48px; }
.input-with-icon .password-toggle { border-radius: 0 .7rem .7rem 0; min-width: 47px; }
.input-with-icon .password-toggle:hover { background: var(--blue-soft); }

/* Application shell */
.app-body { --sidebar-width: 216px; background: var(--paper); font-size: .875rem; }
.sidebar {
    --bs-offcanvas-width: min(270px, 85vw);
    --bs-offcanvas-bg: var(--navy);
    --bs-offcanvas-color: var(--nav-ink);
    background: var(--navy);
    color: var(--nav-ink);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}
.sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    min-height: 58px;
    padding: .6rem .95rem;
    border-bottom: 1px solid var(--nav-edge);
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    color: white;
    font-size: 1.12rem;
    font-weight: 700;
    text-decoration: none;
}
.sidebar-brand img { border-radius: 8px; background: #fff; }
.sidebar-brand:hover { color: var(--teal); }
.sidebar-nav { padding: .3rem .65rem 1rem; }
.side-link {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .48rem .6rem;
    min-height: 38px;
    margin-bottom: .12rem;
    border-radius: 7px;
    color: var(--nav-ink);
    text-decoration: none;
    font-size: .83rem;
}
.side-link i { width: 1.2rem; text-align: center; font-size: .97rem; }
.side-link:hover { background: var(--nav-hover); color: #fff; }
.side-link.selected { background: var(--nav-active); color: #fff; font-weight: 650; box-shadow: inset 3px 0 var(--teal); }
.topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    min-height: 57px;
    background: #fff;
    border-bottom: 1px solid var(--stroke);
    padding: .35rem clamp(.85rem, 2.3vw, 1.65rem);
}
.topbar-page { font-weight: 650; }
.icon-btn { padding: .15rem .4rem; font-size: 1.27rem; }
.account-button { display: flex; align-items: center; gap: .5rem; border: 0; border-radius: 8px; padding: .17rem .35rem; background: #fff; color: var(--ink); text-align: left; }
.account-button:hover { background: var(--blue-wash); }
.account-name { line-height: 1.2; max-width: 185px; }
.account-name strong, .account-name small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-name strong { font-size: .79rem; }
.account-name small { font-size: .69rem; margin-top: .12rem; color: var(--muted); }
.avatar { display: inline-grid; place-items: center; width: 33px; height: 33px; background: var(--blue-soft); color: var(--blue); border-radius: 8px; flex: none; }
.content { max-width: 1500px; margin: 0 auto; padding: clamp(.9rem, 2.3vw, 1.65rem); }

/* Shared controls and surfaces */
.app-body .btn { --bs-btn-font-size: .82rem; --bs-btn-padding-y: .43rem; border-radius: 7px; }
.app-body .btn-sm { --bs-btn-font-size: .77rem; --bs-btn-padding-y: .28rem; }
.app-body .form-label { font-size: .8rem; margin-bottom: .3rem; }
.app-body .form-control, .app-body .form-select {
    min-height: 36px;
    border-radius: 7px;
    font-size: .84rem;
    padding-top: .4rem;
    padding-bottom: .4rem;
}
.app-body textarea.form-control { resize: vertical; }
.app-body .form-text { font-size: .75rem; color: var(--muted); }
.app-body :is(.form-control, .form-select, .guardian-step-title, .form-error-summary) { scroll-margin-block: 5rem 1rem; }
.app-body .form-control:focus, .app-body .form-select:focus { border-color: var(--focus-blue); box-shadow: 0 0 0 .17rem var(--focus-halo); }
.app-body .form-control[type="file"] { background: var(--blue-wash); }
.app-body .form-control::file-selector-button { background: var(--blue-soft); color: var(--blue-active); font-weight: 620; }
.app-body .dropdown-item { font-size: .83rem; }
.surface { background: #fff; border: 1px solid var(--stroke); border-radius: 11px; box-shadow: 0 2px 4px #16213b08; }
.dashboard-panel { padding: clamp(.85rem, 2vw, 1.2rem); }
.section-heading, .page-heading { display: flex; justify-content: space-between; align-items: center; gap: .85rem; margin-bottom: .85rem; }
.section-heading h2 { font-size: 1rem; margin: 0; }
.section-heading a { font-size: .79rem; font-weight: 620; white-space: nowrap; text-decoration: none; }
.section-heading a:hover { text-decoration: underline; }
.page-heading h1 { font-size: clamp(1.55rem, 3vw, 2rem); line-height: 1.1; margin-bottom: .3rem; overflow-wrap: anywhere; }
.page-heading p { margin: 0; color: var(--muted); }
.page-heading .btn { flex: none; }
.metric-icon, .action-icon, .activity-icon { display: inline-grid; place-items: center; border-radius: 9px; width: 35px; height: 35px; flex: none; }
.metric-icon { font-size: 1.03rem; }
.teal-tint { color: var(--teal-ink); background: var(--teal-soft); }
.cobalt-tint { color: var(--blue); background: var(--blue-soft); }
.amber-tint { color: #855319; background: #fff0dc; }
.metric-label { color: var(--muted); font-size: .8rem; }
.metric-number { font-size: 1.55rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.activity-row, .action-row { display: flex; align-items: center; gap: .65rem; padding: .55rem 0; font-size: .84rem; }
.activity-row + .activity-row { border-top: 1px solid var(--stroke); }
.activity-icon { background: var(--blue-wash); color: var(--muted); }
.activity-row small, .action-row small, .directory-table small { display: block; margin-top: .1rem; color: var(--muted); }
.activity-row strong, .directory-table strong { overflow-wrap: anywhere; }
.activity-row time { margin-left: auto; color: var(--muted); font-size: .74rem; text-align: right; min-width: 86px; }
.action-row { color: var(--ink); text-decoration: none; border-radius: 8px; padding: .45rem; margin: 0 -.25rem; }
.action-row:hover { background: var(--blue-wash); }
.directory-filters { display: flex; flex-wrap: wrap; gap: .65rem; align-items: flex-end; padding: .8rem 1rem; }
.filter-search { flex: 1 1 200px; }
.directory-filters > .btn { min-height: 36px; }
.directory-table { min-width: 630px; }
.directory-table thead th { background: var(--blue-wash); color: var(--muted); font-size: .74rem; font-weight: 670; white-space: nowrap; }
.directory-table th, .directory-table td { padding: .6rem .95rem; }
.directory-table td { font-size: .82rem; color: var(--ink); }
.directory-table tbody tr:hover td { background: var(--blue-wash); }
.directory-footer { padding: .7rem 1rem; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .6rem; color: var(--muted); font-size: .8rem; }
.status-pill { display: inline-flex; align-items: center; gap: .35rem; border-radius: 3rem; font-size: .72rem; font-weight: 650; padding: .23rem .52rem; color: #4b5668; background: #edf1f7; }
.status-pill::before { content: ''; width: .38rem; height: .38rem; background: currentColor; border-radius: 50%; }
.active-pill { color: var(--teal-ink); background: var(--teal-soft); }
.modal-content { border-radius: 12px; }
.password-panel { max-width: 510px; }

.app-toasts {
    position: fixed;
    inset: 4.2rem .9rem auto auto;
    max-width: calc(100vw - 1.8rem);
    z-index: 1090;
}
.app-toast { --toast-accent: var(--teal-ink); background: #fff; color: var(--ink); border-inline-start: 4px solid var(--toast-accent); box-shadow: 0 10px 30px #132c5029; }
.app-toast[data-level="danger"] { --toast-accent: #aa263b; }
.app-toast .toast-body { display: flex; gap: .65rem; align-items: flex-start; }
.app-toast .toast-body i { color: var(--toast-accent); }
.app-toast .btn-close { margin: .15rem 0 0 auto; flex: none; }
.form-error-summary { font-size: .83rem; padding: .65rem .8rem; overflow-wrap: anywhere; }
.file-preview {
    display: flex;
    align-items: center;
    gap: .65rem;
    margin-top: .45rem;
    padding: .45rem;
    background: var(--blue-wash);
    border: 1px solid var(--stroke);
    border-radius: 8px;
}
.file-preview img, .file-preview-icon { flex: 0 0 46px; width: 46px; height: 46px; border-radius: 6px; }
.file-preview img { object-fit: contain; background: var(--blue-soft); }
.file-preview-icon { display: grid; place-items: center; color: var(--blue); background: var(--blue-soft); font-size: 1.2rem; }
.file-preview-details { flex: 1; min-width: 0; }
.file-preview-details strong { display: block; overflow-wrap: anywhere; font-size: .78rem; }
.file-preview-details small { display: block; color: var(--muted); }
.file-preview-error .file-preview-details small { color: #9d2435; }

@media (min-width: 992px) {
    .app-body .sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-width); background: var(--navy) !important; }
    .app-main { margin-left: var(--sidebar-width); }
}
@media (max-width: 991.98px) {
    .sidebar .side-link { min-height: 42px; }
}
@media (max-width: 767.98px) {
    .app-body .form-control, .app-body .form-select { min-height: 40px; }
}
@media (max-width: 420px) {
    .page-heading { align-items: flex-start; flex-direction: column; }
    .directory-filters > div { flex: 1 1 125px; }
    .directory-filters .filter-search { flex-basis: 100%; }
}
