/* =========================================================
   Sousei Genesis design system
   1. Tokens  2. Base  3. Shell  4. Components  5. Dashboards  6. Mobile portals  7. Auth
   8. Calendar  9. Responsive  10. Motion and print
   ========================================================= */

/* ---------- 1. Tokens ---------- */
@font-face {
    font-family: "Inter";
    src: url("lib/inter/inter-latin-wght-normal.woff2") format("woff2");
    font-weight: 100 900;
    font-display: swap;
}

:root {
    --sg-primary: #2563EB;
    --sg-primary-hover: color-mix(in srgb, var(--sg-primary) 82%, black);
    --sg-primary-soft: color-mix(in srgb, var(--sg-primary) 9%, white);
    --sg-primary-ring: color-mix(in srgb, var(--sg-primary) 22%, transparent);
    --sg-sidebar: #111827;
    --sg-sidebar-hover: #1C2536;
    --sg-sidebar-line: #1F2937;
    --sg-bg: #F8FAFC;
    --sg-surface: #FFFFFF;
    --sg-text: #0F172A;
    --sg-text-muted: #64748B;
    --sg-border: #E2E8F0;
    --sg-border-strong: #CBD5E1;
    --sg-success: #16A34A;
    --sg-warning: #F59E0B;
    --sg-danger: #DC2626;
    --sg-info: #0EA5E9;

    --sg-radius: 16px;
    --sg-radius-sm: 10px;
    --sg-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .03);
    --sg-shadow-hover: 0 6px 18px rgba(15, 23, 42, .08);
    --sg-shadow-lg: 0 16px 40px rgba(15, 23, 42, .18);
    --sg-sidebar-w: 264px;
    --sg-header-h: 64px;
    --sg-bottom-nav-h: 64px;
    --sg-font: "Inter", system-ui, -apple-system, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
    --sg-safe-bottom: env(safe-area-inset-bottom, 0px);

    /* Chart series */
    --c-scheduled: #3B82F6;
    --c-completed: #16A34A;
    --c-cancelled: #EF4444;
    --c-noshow: #94A3B8;
    --c-s1: #2563EB; --c-s2: #06B6D4; --c-s3: #16A34A; --c-s4: #F59E0B; --c-s5: #8B5CF6; --c-s6: #EC4899;
}

/* ---------- 2. Base ---------- */
html, body { background: var(--sg-bg); color: var(--sg-text); font-family: var(--sg-font); font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
body { overflow-x: hidden; }
h1, h2, h3, h4, h5 { font-weight: 650; letter-spacing: -.012em; color: var(--sg-text); margin: 0; }
h1 { font-size: 1.75rem; line-height: 1.2; font-weight: 700; } h2 { font-size: 1.1rem; } h3 { font-size: 1rem; }
a { color: var(--sg-primary); text-decoration: none; } a:hover { color: var(--sg-primary-hover); }
.text-muted-sg { color: var(--sg-text-muted) !important; }
.small-sg { font-size: .8125rem; }
:focus-visible { outline: 2px solid var(--sg-primary); outline-offset: 2px; border-radius: 6px; }
.visually-hidden-sg { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.blazor-error-boundary { background: #FEE2E2; color: #991B1B; padding: 1rem; border-radius: var(--sg-radius-sm); }
.blazor-error-boundary::after { content: "Something went wrong displaying this section."; }
.skip-link { position: absolute; left: .75rem; top: -48px; background: var(--sg-primary); color: #fff; padding: .5rem .9rem; border-radius: 8px; z-index: 2000; transition: top .15s; }
.skip-link:focus { top: .75rem; color: #fff; }
.only-mobile { display: none !important; }

/* ---------- 3. Shell ---------- */
.app-shell { min-height: 100vh; display: flex; }
.app-sidebar {
    width: var(--sg-sidebar-w); background: var(--sg-sidebar); color: #CBD5E1; position: fixed; inset: 0 auto 0 0;
    display: flex; flex-direction: column; z-index: 1040; transition: transform .22s ease, width .22s ease;
}
.sidebar-brand { display: flex; align-items: center; gap: .75rem; padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--sg-sidebar-line); min-height: var(--sg-header-h); }
.brand-mark { width: 36px; height: 36px; border-radius: 11px; background: var(--sg-primary); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; overflow: hidden; }
.brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.brand-name { color: #fff; font-weight: 650; font-size: .95rem; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: .75rem; scrollbar-width: thin; scrollbar-color: #374151 transparent; }
.nav-group-toggle {
    width: 100%; display: flex; align-items: center; justify-content: space-between; background: none; border: 0; color: #8795AB;
    font-size: .6875rem; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; padding: .85rem .75rem .35rem;
}
.nav-group-toggle:hover { color: #E2E8F0; }
.nav-item {
    position: relative; display: flex; align-items: center; gap: .7rem; padding: .55rem .75rem; border-radius: 10px;
    color: #CBD5E1; font-size: .875rem; font-weight: 500; margin-bottom: 2px; min-height: 40px; transition: background .15s, color .15s;
}
.nav-item i { font-size: 1.1rem; width: 1.25rem; text-align: center; opacity: .85; flex: none; }
a.nav-item:hover { background: var(--sg-sidebar-hover); color: #fff; }
a.nav-item.active { background: var(--sg-primary); color: #fff; font-weight: 600; box-shadow: 0 4px 12px color-mix(in srgb, var(--sg-primary) 40%, transparent); }
a.nav-item.active i { opacity: 1; }
.nav-item.disabled { opacity: .5; cursor: not-allowed; }
.nav-soon { margin-left: auto; white-space: nowrap; flex: none; font-size: .625rem; background: var(--sg-sidebar-line); color: #94A3B8; padding: .1rem .4rem; border-radius: 999px; }
.sidebar-footer { padding: .75rem; border-top: 1px solid var(--sg-sidebar-line); }
.sidebar-footer button { width: 100%; background: none; border: 0; text-align: left; }
.sidebar-footer button:hover { background: var(--sg-sidebar-hover); color: #fff; }
.sidebar-provider { padding: .5rem 1.25rem 1rem; font-size: .6875rem; color: #64748B; }
.sidebar-backdrop { display: none; }

/* Collapsed (icon-only) sidebar on desktop */
.app-shell.collapsed { --sg-sidebar-w: 76px; }
.app-shell.collapsed .brand-name, .app-shell.collapsed .nav-item span, .app-shell.collapsed .nav-group-toggle span,
.app-shell.collapsed .nav-group-toggle i, .app-shell.collapsed .sidebar-provider, .app-shell.collapsed .nav-soon { display: none; }
.app-shell.collapsed .sidebar-brand { justify-content: center; padding: 1.1rem .5rem; }
.app-shell.collapsed .nav-item { justify-content: center; padding: .55rem; }
.app-shell.collapsed .nav-group-toggle { height: 14px; padding: 0; margin: .4rem .5rem; border-top: 1px solid var(--sg-sidebar-line); border-radius: 0; pointer-events: none; }

.app-main { margin-left: var(--sg-sidebar-w); flex: 1; min-width: 0; display: flex; flex-direction: column; transition: margin-left .22s ease; }
.app-header {
    height: var(--sg-header-h); background: rgba(255, 255, 255, .88); backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--sg-border); display: flex; align-items: center; gap: .75rem; padding: 0 1.5rem; position: sticky; top: 0; z-index: 1030;
}
.header-menu-btn, .header-collapse-btn { display: none; }
.crumbs { display: flex; align-items: center; gap: .4rem; font-size: .8125rem; color: var(--sg-text-muted); min-width: 0; white-space: nowrap; overflow: hidden; }
.crumbs a { color: var(--sg-text-muted); } .crumbs a:hover { color: var(--sg-primary); }
.crumbs .current { color: var(--sg-text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.header-spacer { flex: 1; }
.icon-btn {
    position: relative; width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 11px; border: 1px solid transparent;
    background: transparent; color: var(--sg-text-muted); font-size: 1.15rem; transition: background .15s, color .15s;
}
.icon-btn:hover { background: #EEF2F7; color: var(--sg-text); }
.icon-btn .dot { position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 4px; background: var(--sg-danger); color: #fff; font-size: .6875rem; font-weight: 600; border-radius: 999px; display: grid; place-items: center; border: 2px solid #fff; box-sizing: content-box; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--sg-primary-soft); color: var(--sg-primary); display: grid; place-items: center; font-weight: 650; font-size: .8125rem; flex: none; }
.avatar.lg { width: 48px; height: 48px; font-size: 1rem; }
.avatar.tone-0 { background: #DBEAFE; color: #1D4ED8; } .avatar.tone-1 { background: #EDE9FE; color: #6D28D9; } .avatar.tone-2 { background: #CFFAFE; color: #0E7490; }
.avatar.tone-3 { background: #DCFCE7; color: #15803D; } .avatar.tone-4 { background: #FEF3C7; color: #B45309; } .avatar.tone-5 { background: #FFE4E6; color: #BE123C; }
.user-btn { display: flex; align-items: center; gap: .6rem; background: none; border: 0; padding: .25rem .5rem; border-radius: 11px; }
.user-btn:hover { background: #EEF2F7; }
.user-meta { text-align: left; line-height: 1.2; } .user-meta .name { font-weight: 600; font-size: .8125rem; } .user-meta .role { font-size: .75rem; color: var(--sg-text-muted); }
.menu-wrap { position: relative; }
.menu-backdrop { position: fixed; inset: 0; z-index: 1049; }
.menu-panel {
    position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: var(--sg-surface); border: 1px solid var(--sg-border);
    border-radius: 14px; box-shadow: var(--sg-shadow-lg); padding: .4rem; z-index: 1050;
}
.menu-panel .menu-head { padding: .6rem .75rem; border-bottom: 1px solid var(--sg-border); margin-bottom: .3rem; font-size: .8125rem; }
.menu-item { display: flex; align-items: center; gap: .6rem; width: 100%; padding: .6rem .75rem; border: 0; background: none; border-radius: 9px; color: var(--sg-text); font-size: .875rem; text-align: left; }
.menu-item:hover { background: var(--sg-bg); color: var(--sg-text); }
.app-content { padding: 1.75rem 1.75rem 2rem; max-width: 1480px; width: 100%; margin: 0 auto; flex: 1; }
.app-footer { padding: 1rem 1.5rem; font-size: .75rem; color: var(--sg-text-muted); text-align: center; }

/* ---------- 4. Components ---------- */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-header .subtitle { color: var(--sg-text-muted); margin: .3rem 0 0; font-size: .9rem; }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

.sg-card { background: var(--sg-surface); border: 1px solid var(--sg-border); border-radius: var(--sg-radius); box-shadow: var(--sg-shadow); }
.sg-card.tint-blue { background: linear-gradient(180deg, #F5F9FF, #fff 70%); }
a.sg-card, .sg-card.interactive { transition: box-shadow .18s, border-color .18s, transform .18s; }
a.sg-card:hover, .sg-card.interactive:hover { box-shadow: var(--sg-shadow-hover); border-color: var(--sg-border-strong); }
.sg-card-header { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--sg-border); }
.sg-card-body { padding: 1.4rem; }
.sg-card-header h2 { font-size: 1.05rem; }
.sg-card > .table-wrap:first-child, .sg-card > .sg-card-header + .table-wrap { border-radius: 0 0 var(--sg-radius) var(--sg-radius); }

/* Buttons */
.btn-sg { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 40px; padding: .5rem 1.05rem; border-radius: 11px; border: 1px solid var(--sg-border); background: var(--sg-surface); color: var(--sg-text); font-weight: 560; font-size: .875rem; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s, color .15s; box-shadow: 0 1px 1px rgba(15, 23, 42, .03); line-height: 1.2; }
.btn-sg i { font-size: 1rem; line-height: 1; }
.btn-sg:hover { background: #F1F5F9; color: var(--sg-text); border-color: var(--sg-border-strong); }
.btn-sg:active { transform: translateY(.5px); }
.btn-sg.primary { background: var(--sg-primary); border-color: var(--sg-primary); color: #fff; box-shadow: 0 1px 2px color-mix(in srgb, var(--sg-primary) 35%, transparent); }
.btn-sg.primary:hover { background: var(--sg-primary-hover); border-color: var(--sg-primary-hover); color: #fff; }
.btn-sg.success { background: #16A34A; border-color: #16A34A; color: #fff; } .btn-sg.success:hover { background: #15803D; border-color: #15803D; color: #fff; }
.btn-sg.danger { background: var(--sg-danger); border-color: var(--sg-danger); color: #fff; } .btn-sg.danger:hover { background: #B91C1C; border-color: #B91C1C; color: #fff; }
.btn-sg.danger-soft { background: #FEE2E2; border-color: #FECACA; color: #B91C1C; } .btn-sg.danger-soft:hover { background: #FECACA; color: #991B1B; }
.btn-sg.warning { background: #FEF3C7; border-color: #FDE68A; color: #92400E; } .btn-sg.warning:hover { background: #FDE68A; color: #78350F; }
.btn-sg.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--sg-text-muted); } .btn-sg.ghost:hover { background: #EEF2F7; color: var(--sg-text); }
.btn-sg.sm { min-height: 34px; padding: .3rem .75rem; font-size: .8125rem; border-radius: 9px; }
.btn-sg.lg { min-height: 48px; padding: .65rem 1.4rem; font-size: .95rem; border-radius: 13px; }
.btn-sg.block { width: 100%; }
.btn-sg:disabled, .btn-sg[aria-disabled="true"] { opacity: .55; cursor: not-allowed; box-shadow: none; transform: none; }
.btn-sg.loading { position: relative; color: transparent !important; pointer-events: none; }
.btn-sg.loading::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,.45); border-top-color: #fff; animation: spin .7s linear infinite; }
.btn-sg:not(.primary):not(.success):not(.danger).loading::after { border-color: #CBD5E1; border-top-color: var(--sg-primary); }
.btn-link-sg { background: none; border: 0; padding: 0; color: var(--sg-primary); font-weight: 550; font-size: .8125rem; }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { display: inline-block; width: 16px; height: 16px; border-radius: 50%; border: 2px solid #CBD5E1; border-top-color: var(--sg-primary); animation: spin .7s linear infinite; vertical-align: -3px; }

/* KPI cards: each carries a tinted accent */
.stat-card { display: block; padding: 1.2rem 1.3rem; color: inherit; position: relative; height: 100%; background: linear-gradient(160deg, var(--accent-tint, #fff) 0%, #fff 62%); }
a.stat-card:hover { color: inherit; border-color: color-mix(in srgb, var(--accent, var(--sg-primary)) 40%, var(--sg-border)); }
.stat-card .icon { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; font-size: 1.25rem; background: var(--accent-soft, var(--sg-primary-soft)); color: var(--accent, var(--sg-primary)); }
.stat-card .label { color: var(--sg-text-muted); font-size: .8125rem; font-weight: 560; margin-top: .9rem; }
.stat-card .value { font-size: 2.05rem; font-weight: 700; letter-spacing: -.025em; line-height: 1.15; color: var(--sg-text); font-variant-numeric: tabular-nums; }
.stat-card .value.sm { font-size: 1.55rem; }
.stat-card .hint { color: var(--sg-text-muted); font-size: .75rem; margin-top: .25rem; }
.stat-card .lock { position: absolute; top: 1rem; right: 1rem; color: #94A3B8; font-size: .8rem; }
.accent-blue { --accent: #2563EB; --accent-soft: #DBEAFE; --accent-tint: #F3F8FF; } .accent-cyan { --accent: #0891B2; --accent-soft: #CFFAFE; --accent-tint: #F0FCFE; }
.accent-green { --accent: #16A34A; --accent-soft: #DCFCE7; --accent-tint: #F2FDF6; } .accent-orange { --accent: #D97706; --accent-soft: #FEF3C7; --accent-tint: #FFFBEB; }
.accent-red { --accent: #E11D48; --accent-soft: #FFE4E6; --accent-tint: #FFF5F6; } .accent-purple { --accent: #7C3AED; --accent-soft: #EDE9FE; --accent-tint: #F8F5FF; }

/* Status pills */
.badge-sg { display: inline-flex; align-items: center; gap: .35rem; padding: 5px 11px; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap; line-height: 1.2; }
.badge-sg i { font-size: .8rem; line-height: 1; }
.badge-sg .dot-i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-blue { background: #DBEAFE; color: #1E40AF; } .badge-cyan { background: #CFFAFE; color: #155E75; }
.badge-orange { background: #FFEDD5; color: #9A3412; } .badge-amber { background: #FEF3C7; color: #92400E; }
.badge-green { background: #DCFCE7; color: #166534; } .badge-red { background: #FEE2E2; color: #991B1B; }
.badge-purple { background: #F3E8FF; color: #6B21A8; } .badge-gray { background: #F1F5F9; color: #475569; }

/* Tables */
.table-wrap { overflow-x: auto; }
.sg-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.sg-table th { text-align: left; padding: .7rem 1.4rem; font-size: .72rem; font-weight: 650; color: var(--sg-text-muted); text-transform: uppercase; letter-spacing: .05em; background: #F8FAFC; border-bottom: 1px solid var(--sg-border); white-space: nowrap; }
.sg-table td { padding: .9rem 1.4rem; border-bottom: 1px solid var(--sg-border); vertical-align: middle; }
.sg-table tr:last-child td { border-bottom: 0; }
.sg-table tbody tr { transition: background .12s; }
.sg-table tbody tr:hover { background: #F8FAFC; }
.sg-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-person { display: flex; align-items: center; gap: .7rem; }
.cell-person .name { font-weight: 600; line-height: 1.25; } .cell-person .sub { font-size: .75rem; color: var(--sg-text-muted); }

/* Empty + loading */
.empty-state { text-align: center; padding: 2.5rem 1.25rem; color: var(--sg-text-muted); }
.empty-state .icon { width: 56px; height: 56px; margin: 0 auto .85rem; border-radius: 18px; background: var(--sg-primary-soft); display: grid; place-items: center; font-size: 1.5rem; color: var(--sg-primary); }
.empty-state .title { font-weight: 650; color: var(--sg-text); }
.empty-state p { margin: .3rem auto 0; max-width: 360px; font-size: .875rem; }
.empty-state .empty-actions { margin-top: 1rem; display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; }

.skeleton { background: linear-gradient(90deg, #EEF2F6 25%, #F8FAFC 37%, #EEF2F6 63%); background-size: 400% 100%; animation: sk 1.4s ease infinite; border-radius: 8px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.sk-line { height: 14px; margin: .6rem 0; } .sk-block { height: 220px; } .sk-stat { height: 138px; border-radius: var(--sg-radius); }

/* Forms */
.form-label-sg { font-weight: 560; font-size: .8125rem; margin-bottom: .35rem; display: block; color: #1E293B; }
.form-label-sg .req { color: var(--sg-danger); margin-left: 2px; }
.input-sg, .select-sg { width: 100%; min-height: 44px; padding: .5rem .9rem; border: 1px solid var(--sg-border-strong); border-radius: 12px; background: #fff; font-size: .9rem; color: var(--sg-text); font-family: inherit; transition: border-color .15s, box-shadow .15s; }
.input-sg::placeholder { color: #94A3B8; }
textarea.input-sg { min-height: 88px; resize: vertical; }
.input-sg:hover, .select-sg:hover { border-color: #94A3B8; }
.input-sg:focus, .select-sg:focus { border-color: var(--sg-primary); outline: 0; box-shadow: 0 0 0 4px var(--sg-primary-ring); }
.input-sg.invalid, .select-sg.invalid { border-color: var(--sg-danger); }
.input-sg.invalid:focus, .select-sg.invalid:focus { box-shadow: 0 0 0 4px rgba(220, 38, 38, .15); }
.field-hint { color: var(--sg-text-muted); font-size: .75rem; margin-top: .3rem; }
.validation-message { color: var(--sg-danger); font-size: .8125rem; margin-top: .3rem; }
.form-section { padding: 1.25rem 0; border-bottom: 1px solid var(--sg-border); } .form-section:last-child { border-bottom: 0; }
.form-section:first-child { padding-top: 0; }
.form-section-head { display: flex; align-items: center; gap: .75rem; }
.form-section-head .sec-icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 1.1rem; background: var(--accent-soft, var(--sg-primary-soft)); color: var(--accent, var(--sg-primary)); flex: none; }
.form-section-head p { margin: 0; }
.consent-item { display: flex; gap: .85rem; align-items: flex-start; padding: .9rem 1rem; border: 1px solid var(--sg-border); border-radius: 13px; margin-bottom: .6rem; background: #fff; cursor: pointer; transition: border-color .15s, background .15s; }
.consent-item:hover { border-color: var(--sg-border-strong); }
.consent-item:has(input:checked) { border-color: color-mix(in srgb, var(--sg-success) 55%, white); background: #F4FDF7; }
.consent-item input { width: 1.35rem; height: 1.35rem; margin-top: .1rem; flex: none; accent-color: var(--sg-primary); cursor: pointer; }
.consent-item .t { font-size: .875rem; line-height: 1.45; }
.consent-item .tag { display: inline-block; font-size: .6875rem; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--sg-text-muted); margin-bottom: .1rem; }

.alert-sg { padding: .85rem 1rem; border-radius: 12px; font-size: .875rem; margin-bottom: 1rem; border: 1px solid transparent; }
.alert-sg.error { background: #FEF2F2; color: #991B1B; border-color: #FECACA; } .alert-sg.success { background: #F0FDF4; color: #166534; border-color: #BBF7D0; }
.alert-sg.info { background: #F0F9FF; color: #075985; border-color: #BAE6FD; } .alert-sg.warning { background: #FFFBEB; color: #92400E; border-color: #FDE68A; }
.callout { display: flex; gap: .85rem; padding: 1rem 1.1rem; border-radius: 14px; border: 1px solid; margin-bottom: 1rem; }
.callout .ci { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: none; font-size: 1.1rem; }
.callout .ct { font-weight: 650; font-size: .8rem; letter-spacing: .05em; text-transform: uppercase; }
.callout p { margin: .15rem 0 0; font-size: .875rem; }
.callout.conflict { background: #FFF7ED; border-color: #FED7AA; color: #7C2D12; } .callout.conflict .ci { background: #FFEDD5; color: #C2410C; }
.callout.danger { background: #FEF2F2; border-color: #FECACA; color: #7F1D1D; } .callout.danger .ci { background: #FEE2E2; color: #B91C1C; }

/* Modals */
.modal-backdrop-sg { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); backdrop-filter: blur(2px); display: grid; place-items: center; z-index: 1100; padding: 1rem; animation: fade .15s ease; }
.modal-sg { background: #fff; border-radius: 20px; width: 100%; max-width: 520px; max-height: calc(100dvh - 2rem); display: flex; flex-direction: column; box-shadow: var(--sg-shadow-lg); animation: pop .18s ease; outline: 0; }
.modal-sg.wide { max-width: 720px; }
.modal-sg header, .modal-sg footer { padding: 1rem 1.4rem; display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex: none; }
.modal-sg header { border-bottom: 1px solid var(--sg-border); } .modal-sg footer { border-top: 1px solid var(--sg-border); justify-content: flex-end; flex-wrap: wrap; }
.modal-sg .body { padding: 1.25rem 1.4rem; overflow-y: auto; flex: 1; -webkit-overflow-scrolling: touch; }
.modal-title { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.modal-title h2 { font-size: 1.05rem; }
.modal-icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 1.15rem; flex: none; }
.modal-icon.info { background: #DBEAFE; color: #1D4ED8; } .modal-icon.success { background: #DCFCE7; color: #15803D; }
.modal-icon.warning { background: #FEF3C7; color: #B45309; } .modal-icon.error { background: #FEE2E2; color: #B91C1C; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes sheet { from { transform: translateY(100%); } to { transform: none; } }

/* Toasts */
.toast-host { position: fixed; right: 1.25rem; bottom: 1.25rem; display: flex; flex-direction: column; gap: .6rem; z-index: 1200; width: min(380px, calc(100vw - 2rem)); pointer-events: none; }
.toast-sg { pointer-events: auto; display: flex; align-items: flex-start; gap: .75rem; background: #fff; color: var(--sg-text); padding: .8rem .9rem; border-radius: 14px; box-shadow: var(--sg-shadow-lg); border: 1px solid var(--sg-border); font-size: .875rem; animation: toast-in .22s ease; }
.toast-sg .ti { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; flex: none; font-size: 1rem; background: #DCFCE7; color: #15803D; }
.toast-sg.error .ti { background: #FEE2E2; color: #B91C1C; } .toast-sg.warning .ti { background: #FEF3C7; color: #B45309; } .toast-sg.info .ti { background: #DBEAFE; color: #1D4ED8; }
.toast-sg .tm { flex: 1; padding-top: .3rem; line-height: 1.4; }
.toast-sg button { background: none; border: 0; color: #94A3B8; width: 28px; height: 28px; border-radius: 8px; flex: none; } .toast-sg button:hover { background: #F1F5F9; color: var(--sg-text); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.segmented { display: inline-flex; padding: 3px; background: #EEF2F7; border-radius: 11px; gap: 2px; }
.segmented button { border: 0; background: none; padding: .3rem .85rem; border-radius: 9px; font-size: .8125rem; font-weight: 560; color: var(--sg-text-muted); min-height: 34px; transition: background .15s, color .15s; }
.segmented button:hover { color: var(--sg-text); }
.segmented button.on { background: #fff; color: var(--sg-text); box-shadow: 0 1px 3px rgba(15, 23, 42, .1); }
.date-inputs { display: inline-flex; align-items: center; gap: .4rem; } .date-inputs .input-sg { min-height: 36px; width: 150px; padding: .2rem .55rem; font-size: .8125rem; border-radius: 10px; }

.filter-bar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; padding: 1rem 1.4rem; border-bottom: 1px solid var(--sg-border); }
.filter-bar > div { min-width: 140px; }
.filter-bar label { font-size: .75rem; font-weight: 600; color: var(--sg-text-muted); display: block; margin-bottom: .2rem; }
.toolbar-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; width: 100%; }
.toolbar-row .grow { flex: 1; min-width: 200px; }

/* Charts */
.chart-wrap { width: 100%; } .chart-wrap svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-axis text { fill: #64748B; font-size: 11px; } .chart-grid line { stroke: #E8EDF3; stroke-dasharray: 3 4; }
.chart-legend { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; margin-top: .85rem; font-size: .8125rem; color: var(--sg-text-muted); }
.legend-item { display: inline-flex; align-items: center; gap: .45rem; background: none; border: 0; padding: 0; color: inherit; }
button.legend-item:hover { color: var(--sg-text); }
.legend-dot { width: 10px; height: 10px; border-radius: 4px; }
.chart-bar { cursor: pointer; transition: opacity .15s, filter .15s; } .chart-bar:hover { opacity: .85; filter: brightness(1.04); }
.donut-layout { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; justify-content: center; }
.donut-layout svg { width: 180px; height: 180px; flex: none; }
.donut-center { text-anchor: middle; } .donut-center .n { font-size: 26px; font-weight: 700; fill: #0F172A; } .donut-center .l { font-size: 11px; fill: #64748B; }
.legend-col { display: flex; flex-direction: column; gap: .5rem; font-size: .8125rem; min-width: 150px; }
.legend-col .row-l { display: flex; align-items: center; gap: .5rem; justify-content: space-between; }

/* ---------- 5. Dashboards ---------- */
.dash-grid { display: grid; gap: 1rem; }
.kpi-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); margin-bottom: 1.25rem; }
.two-col { display: grid; gap: 1rem; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); margin-bottom: 1rem; }
.even-col { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 1rem; }
.three-col { display: grid; gap: 1rem; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 1rem; }
.chart-row { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 1rem; }
.chart-row > :nth-child(3) { grid-column: 1 / -1; }
.quick-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.25rem; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { padding: .8rem 1.4rem; border-bottom: 1px solid var(--sg-border); display: flex; gap: .75rem; justify-content: space-between; align-items: center; font-size: .875rem; }
.list-plain li:last-child { border-bottom: 0; }

.action-list { list-style: none; margin: 0; padding: .4rem; }
.action-item { display: flex; align-items: center; gap: .85rem; padding: .7rem .8rem; border-radius: 12px; color: var(--sg-text); transition: background .15s; }
a.action-item:hover { background: #F1F5F9; color: var(--sg-text); }
.action-item .ai { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: none; font-size: 1.05rem; background: var(--accent-soft); color: var(--accent); }
.action-item .at { flex: 1; font-size: .875rem; font-weight: 520; line-height: 1.3; }
.action-item .go { color: #94A3B8; }
.action-item.done { opacity: .75; }

.timeline { list-style: none; margin: 0; padding: 1rem 1.25rem; }
.timeline li { display: grid; grid-template-columns: 78px 14px 1fr; gap: .75rem; padding-bottom: 1.1rem; position: relative; }
.timeline .t { font-weight: 650; font-size: .875rem; text-align: right; padding-top: 2px; }
.timeline .rail { position: relative; } .timeline .rail::before { content: ""; position: absolute; left: 6px; top: 8px; bottom: -1.1rem; width: 2px; background: var(--sg-border); }
.timeline li:last-child .rail::before { display: none; }
.timeline .rail i { position: absolute; top: 6px; left: 1px; width: 12px; height: 12px; border-radius: 50%; background: var(--sg-primary); border: 3px solid var(--sg-primary-soft); box-sizing: content-box; }
.timeline .card-t { background: var(--sg-bg); border: 1px solid var(--sg-border); border-radius: 14px; padding: .85rem 1rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

.welcome { background: linear-gradient(135deg, var(--sg-primary) 0%, color-mix(in srgb, var(--sg-primary) 62%, #06B6D4) 100%); color: #fff; border-radius: 20px; padding: 1.75rem; margin-bottom: 1.25rem; box-shadow: 0 10px 28px color-mix(in srgb, var(--sg-primary) 28%, transparent); }
.welcome h1 { color: #fff; font-size: 1.6rem; } .welcome p { margin: .35rem 0 0; opacity: .92; }
.child-tabs { display: flex; gap: .75rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.child-card { display: flex; align-items: center; gap: .85rem; text-align: left; background: #fff; border: 2px solid var(--sg-border); border-radius: 16px; padding: .85rem 1.1rem; min-width: 250px; transition: border-color .15s, background .15s; }
.child-card.on { border-color: var(--sg-primary); background: var(--sg-primary-soft); }
.child-card .avatar { width: 46px; height: 46px; font-size: 1rem; background: var(--sg-primary); color: #fff; }

/* Hero "next appointment" card, used by therapist and parent mobile dashboards */
.hero-card { position: relative; overflow: hidden; background: linear-gradient(135deg, var(--sg-primary), color-mix(in srgb, var(--sg-primary) 55%, #7C3AED)); color: #fff; border-radius: 20px; padding: 1.25rem 1.3rem; box-shadow: 0 12px 30px color-mix(in srgb, var(--sg-primary) 30%, transparent); margin-bottom: 1.25rem; }
.hero-card::after { content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: rgba(255, 255, 255, .1); }
.hero-card .eyebrow { font-size: .72rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; opacity: .85; }
.hero-card .big { font-size: 2rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; margin: .3rem 0 .1rem; }
.hero-card .sub { opacity: .92; font-size: .9rem; }
.hero-card .meta { display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin-top: .75rem; font-size: .85rem; opacity: .95; }
.hero-card .btn-sg { background: #fff; color: var(--sg-primary); border-color: #fff; margin-top: 1rem; position: relative; z-index: 1; }
.hero-card .btn-sg:hover { background: #EFF6FF; color: var(--sg-primary-hover); }
.hero-card.empty { background: linear-gradient(135deg, #64748B, #475569); box-shadow: none; }

.greeting { margin-bottom: 1.25rem; } .greeting h1 { font-size: 1.6rem; } .greeting p { margin: .2rem 0 0; color: var(--sg-text-muted); }
.quick-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.quick-tile { display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: .9rem .4rem; background: #fff; border: 1px solid var(--sg-border); border-radius: 16px; color: var(--sg-text); font-size: .75rem; font-weight: 600; text-align: center; box-shadow: var(--sg-shadow); transition: box-shadow .15s; }
.quick-tile:hover { box-shadow: var(--sg-shadow-hover); color: var(--sg-text); }
.quick-tile .qi { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; font-size: 1.2rem; background: var(--accent-soft); color: var(--accent); }

/* Mobile record cards (used where a custom card reads better than a stacked table row) */
.record-list { display: grid; gap: .75rem; padding: .85rem; }
.record-card { background: #fff; border: 1px solid var(--sg-border); border-radius: 16px; padding: 1rem; box-shadow: var(--sg-shadow); display: block; color: inherit; }
.record-card .rc-top { display: flex; justify-content: space-between; gap: .75rem; align-items: flex-start; }
.record-card .rc-title { font-weight: 650; font-size: 1rem; line-height: 1.25; }
.record-card .rc-sub { color: var(--sg-text-muted); font-size: .8125rem; }
.record-card dl { display: grid; grid-template-columns: auto 1fr; gap: .25rem .9rem; margin: .75rem 0 0; font-size: .85rem; }
.record-card dt { color: var(--sg-text-muted); font-weight: 500; } .record-card dd { margin: 0; text-align: right; }
.record-card .rc-actions { display: flex; gap: .5rem; margin-top: .85rem; } .record-card .rc-actions .btn-sg { flex: 1; }

/* Summary side panel */
.summary-panel { position: sticky; top: calc(var(--sg-header-h) + 1rem); }
.summary-panel dl { margin: 0; display: grid; gap: .85rem; }
.summary-panel dt { font-size: .7rem; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--sg-text-muted); }
.summary-panel dd { margin: .1rem 0 0; font-weight: 560; }
.summary-panel dd.empty { color: #94A3B8; font-weight: 400; }
.form-layout { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }

/* Stepper (mobile registration) */
.stepper { display: none; align-items: center; gap: .4rem; margin-bottom: 1rem; }
.stepper .st { flex: 1; text-align: center; font-size: .7rem; font-weight: 600; color: var(--sg-text-muted); }
.stepper .st .n { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; margin: 0 auto .25rem; background: #E2E8F0; color: #475569; font-size: .8rem; font-weight: 700; }
.stepper .st.active { color: var(--sg-primary); } .stepper .st.active .n { background: var(--sg-primary); color: #fff; box-shadow: 0 0 0 4px var(--sg-primary-ring); }
.stepper .st.done .n { background: #16A34A; color: #fff; }
.stepper .bar { flex: 0 0 18px; height: 2px; background: #E2E8F0; margin-bottom: 1.1rem; } .stepper .bar.done { background: #16A34A; }
.step-nav { display: none; gap: .6rem; margin-top: 1rem; } .step-nav .btn-sg { flex: 1; }

/* ---------- 6. Mobile portals ---------- */
.bottom-nav {
    display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1020; background: rgba(255, 255, 255, .94); backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-top: 1px solid var(--sg-border); padding: .35rem .25rem calc(.35rem + var(--sg-safe-bottom)); grid-auto-flow: column; grid-auto-columns: 1fr; gap: .15rem;
}
.bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px; border-radius: 12px; color: var(--sg-text-muted); font-size: .6875rem; font-weight: 600; }
.bottom-nav a i { font-size: 1.35rem; line-height: 1; }
.bottom-nav a.active { color: var(--sg-primary); background: var(--sg-primary-soft); }
.bottom-nav a:hover { color: var(--sg-primary); }
.bottom-nav .badge-count { position: absolute; }

/* ---------- 7. Auth ---------- */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: radial-gradient(1200px 500px at 50% -10%, var(--sg-primary-soft), transparent), var(--sg-bg); }
.auth-card { width: 100%; max-width: 440px; background: #fff; border: 1px solid var(--sg-border); border-radius: 24px; padding: 2rem; box-shadow: var(--sg-shadow-lg); }
.auth-brand { text-align: center; margin-bottom: 1.5rem; } .auth-brand .brand-mark { margin: 0 auto .75rem; width: 56px; height: 56px; border-radius: 17px; font-size: 1.4rem; }
.auth-brand h1 { font-size: 1.25rem; } .auth-brand p { color: var(--sg-text-muted); margin: .25rem 0 0; font-size: .875rem; }
.auth-foot { text-align: center; margin-top: 1.25rem; font-size: .8125rem; color: var(--sg-text-muted); }
.auth-powered { text-align: center; margin-top: 1rem; font-size: .75rem; color: #94A3B8; }

/* ---------- 8. Calendar ---------- */
/* Status colours, still used for status badges and the phone agenda text. Appointment CARDS are coloured by therapy service (see ServiceColors.cs). */
:root {
    --st-scheduled: #2563EB; --st-confirmed: #0891B2; --st-inprogress: #D97706;
    --st-completed: #16A34A; --st-cancelled: #DC2626; --st-noshow: #475569;
    --cal-hour-h: 64px;
}
.st-scheduled { --st: var(--st-scheduled); } .st-confirmed { --st: var(--st-confirmed); } .st-inprogress { --st: var(--st-inprogress); }
.st-completed { --st: var(--st-completed); } .st-cancelled { --st: var(--st-cancelled); } .st-noshow { --st: var(--st-noshow); }
.svc-dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; background: var(--svc, #64748B); margin-right: 6px; flex: none; }

/* The calendar lives in one white card: toolbar, legend, grid */
.cal-card { background: #fff; border: 1px solid #E2E8F0; border-radius: 16px; box-shadow: 0 4px 20px rgba(15, 23, 42, .04); overflow: hidden; }
.cal-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid #E2E8F0; }
.cal-tb-left, .cal-tb-right { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-width: 0; }
.cal-nav { display: flex; gap: 6px; }
.cal-title { font-size: 1.15rem; font-weight: 750; letter-spacing: .01em; color: #0F172A; margin: 0 0 0 4px; }
.cal-toolbar .btn-sg, .cal-toolbar .select-sg, .cal-toolbar .segmented { height: 38px; min-height: 38px; }
.cal-toolbar .select-sg { width: auto; padding-top: 0; padding-bottom: 0; font-size: .8125rem; border-radius: 10px; }
.cal-toolbar .segmented { padding: 3px; align-items: stretch; }
.cal-toolbar .segmented button { min-height: 0; padding: 0 .95rem; font-weight: 600; }
.cal-toolbar .segmented button.on { background: var(--sg-primary); color: #fff; box-shadow: 0 2px 6px color-mix(in srgb, var(--sg-primary) 35%, transparent); }
.cal-legend2 { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding: 10px 16px; border-bottom: 1px solid #E2E8F0; background: #FCFDFE; font-size: .75rem; color: #334155; }
.cal-legend2 > span { display: inline-flex; align-items: center; gap: 6px; font-weight: 560; }
.cal-legend2 > span > i:first-child:not(.bi) { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.cal-legend2 .cal-legend-key { margin-left: auto; font-weight: 450; gap: 8px; }
.cal-legend2 .cal-legend-key i { font-size: .75rem; margin-left: 4px; }

.cal-wrap { overflow-x: auto; background: #fff; }
.cal { min-width: 780px; user-select: none; -webkit-user-select: none; }
.cal.cal-day { min-width: 420px; }
.cal-head, .cal-body { display: grid; grid-template-columns: 68px repeat(var(--cols, 7), minmax(0, 1fr)); }
.cal-head { border-bottom: 1px solid #E8EEF5; position: sticky; top: 0; background: #F8FAFC; z-index: 4; }
.cal-head .cal-time-col { background: #F8FAFC; }
.cal-day-head { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 0 9px; border-left: 1px solid #E8EEF5; color: #334155; }
.cal-day-head .dow { font-size: .6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: #64748B; }
.cal-day-head strong { display: grid; place-items: center; min-width: 34px; height: 34px; padding: 0 .35rem; border-radius: 999px; font-size: 1.125rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.cal-day-head.weekend { background: #F5F7FC; }
.cal-day-head.today { background: #EFF6FF; } .cal-day-head.today .dow { color: #2563EB; }
.cal-day-head.today strong { background: #2563EB; color: #fff; box-shadow: 0 4px 10px rgba(37, 99, 235, .35); }

.cal-time-col { font-size: .75rem; color: #64748B; background: #F8FAFC; border-right: 1px solid #E8EEF5; }
.cal-hour { position: relative; height: var(--cal-hour-h); }
.cal-hour span { position: absolute; right: 10px; top: -.5em; line-height: 1; font-variant-numeric: tabular-nums; }
.cal-hour:first-child span { top: 4px; }
.cal-col { position: relative; border-left: 1px solid #E8EEF5; }
.cal-col.weekend { background: #FAFBFF; }
.cal-col.today { background: #EFF6FF; }
.cal-cell { height: var(--cal-hour-h); border-top: 1px solid #E8EEF5; background: #fff; }
.cal-cell.h-even { background: #F8FBFF; }
.cal-col.today .cal-cell { background: rgba(239, 246, 255, .75); } .cal-col.today .cal-cell.h-even { background: rgba(228, 239, 255, .8); }
.cal-col.weekend .cal-cell { background: transparent; } .cal-col.weekend .cal-cell.h-even { background: rgba(240, 245, 255, .6); }

/* Current time */
.cal-now { position: absolute; left: 0; right: 0; height: 0; border-top: 2px solid #EF4444; z-index: 6; pointer-events: none; }
.cal-now::before { content: ""; position: absolute; left: -5px; top: -6px; width: 10px; height: 10px; border-radius: 50%; background: #EF4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, .2); }

/* Appointment cards: coloured by therapy service, white text */
.cal-event {
    position: absolute; display: flex; flex-direction: column; gap: 1px; overflow: hidden; border: 0; border-radius: 8px; padding: 8px 22px 8px 9px; text-align: left;
    background: var(--svc, #475569); color: #fff; font-size: .775rem; line-height: 1.25; cursor: pointer; z-index: 2;
    box-shadow: 0 0 0 1.5px #fff, 0 1px 3px rgba(15, 23, 42, .2);
    transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.cal-event:hover, .cal-event:focus-visible { transform: translateY(-1px); background: color-mix(in srgb, var(--svc) 88%, black); box-shadow: 0 0 0 1.5px #fff, 0 4px 12px rgba(15, 23, 42, .25); z-index: 5; }
.cal-event:focus-visible { outline: 2px solid #0F172A; outline-offset: 1px; }
.cal-event > span:not(.cal-tip) { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-event .ev-l1 { font-weight: 700; } .cal-event .ev-l1 b { font-weight: 700; opacity: .95; }
.cal-event .ev-l2 { font-weight: 600; } .cal-event .ev-l3 { font-weight: 400; opacity: .92; }
.cal-event.lines-1 { padding-top: 3px; padding-bottom: 3px; justify-content: center; }
.cal-event.narrow { padding: 6px 18px 6px 6px; }
.cal-event.st-cancelled { opacity: .62; background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, .2) 0 6px, transparent 6px 12px); }
.ev-status { position: absolute; top: 6px; right: 6px; font-size: .72rem; line-height: 1; color: rgba(255, 255, 255, .92); }
.ev-status.plain { position: static; color: inherit; margin-right: 4px; }
.ev-status.pulse { width: 8px; height: 8px; border-radius: 50%; background: #fff; top: 8px; right: 8px; animation: pulse 1.8s ease-in-out infinite; }
.ev-status.pulse.plain { display: inline-block; background: #0891B2; vertical-align: middle; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .6); } 50% { box-shadow: 0 0 0 5px rgba(255, 255, 255, 0); } }

/* Tooltip: plain white card, positioned by app.js so it never leaves the viewport */
.cal-tip { display: none !important; position: fixed; z-index: 1300; width: 250px; padding: 12px 14px; border-radius: 12px; background: #fff; color: #0F172A; box-shadow: 0 12px 32px rgba(15, 23, 42, .22), 0 0 0 1px #E2E8F0; white-space: normal !important; pointer-events: none; font-size: .8125rem; line-height: 1.4; overflow: visible !important; text-overflow: clip !important; font-weight: 400 !important; opacity: 1 !important; }
.cal-tip.show { display: block !important; }
.cal-tip .tp-name { font-weight: 700; font-size: .9rem; }
.cal-tip .tp-sub { color: #475569; }
.cal-tip .tp-when { margin-top: 8px; font-weight: 600; }
.cal-tip .tp-room { color: #475569; }
.cal-tip .tp-status { margin-top: 8px; font-weight: 600; }

/* Solid status pills (kept for places that still show them) */
.st-pill { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 999px; background: var(--st); color: #fff; font-size: .6875rem; font-weight: 600; line-height: 1.1; white-space: nowrap; }

/* Month view */
.month-wrap { background: #fff; }
.month-head { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: #F8FAFC; border-bottom: 1px solid #E8EEF5; }
.month-head > div { padding: 10px 8px; font-size: .6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: #64748B; text-align: center; }
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.month-cell { min-height: 118px; padding: 6px; border-right: 1px solid #E8EEF5; border-bottom: 1px solid #E8EEF5; background: #fff; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.month-cell:nth-child(7n) { border-right: 0; }
.month-cell.weekend { background: #FAFBFF; }
.month-cell.other { background: #F8FAFC; } .month-cell.other .month-num { color: #94A3B8; }
.month-cell.today { background: #EFF6FF; }
.month-num { align-self: flex-start; min-width: 28px; height: 28px; border: 0; border-radius: 999px; background: transparent; font-size: .8125rem; font-weight: 650; color: #334155; padding: 0 6px; }
.month-num:hover { background: #E2E8F0; }
.month-cell.today .month-num { background: #2563EB; color: #fff; }
.month-chips { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.month-chip { display: block; width: 100%; text-align: left; border: 0; border-radius: 6px; padding: 3px 7px; background: var(--svc, #475569); color: #fff; font-size: .72rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: transform .15s, box-shadow .15s; }
.month-chip:hover { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(15, 23, 42, .2); }
.month-chip.st-cancelled { opacity: .6; text-decoration: line-through; }
.month-more { border: 0; background: none; color: #2563EB; font-size: .72rem; font-weight: 650; text-align: left; padding: 1px 4px; }
.month-dots { display: none; gap: 3px; } .month-dots i { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
@media (max-width: 767.98px) {
    .month-cell { min-height: 54px; padding: 4px 2px; align-items: center; }
    .month-chips { display: none; }
    .month-dots { display: flex; }
    .month-num { align-self: center; }
}
.cal-mobile { display: none; }
.day-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .3rem; margin-bottom: 1rem; }
.day-chip { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: .5rem 0; border: 1px solid var(--sg-border); background: #fff; border-radius: 14px; font-size: .7rem; color: var(--sg-text-muted); min-height: 58px; position: relative; }
.day-chip strong { font-size: 1.05rem; color: var(--sg-text); line-height: 1.1; }
.day-chip.today strong { color: var(--sg-primary); }
.day-chip.on { background: var(--sg-primary); border-color: var(--sg-primary); color: rgba(255, 255, 255, .85); box-shadow: 0 6px 14px color-mix(in srgb, var(--sg-primary) 32%, transparent); }
.day-chip.on strong { color: #fff; }
.day-chip .has { width: 5px; height: 5px; border-radius: 50%; background: var(--sg-primary); position: absolute; bottom: 5px; } .day-chip.on .has { background: #fff; }
.agenda { display: grid; gap: .75rem; }
.agenda-card { display: block; width: 100%; text-align: left; background: #fff; border: 1px solid var(--sg-border); border-left: 4px solid var(--ev, #2563EB); border-radius: 16px; padding: .95rem 1rem; box-shadow: var(--sg-shadow); }
.agenda-card .ag-time { font-size: .8rem; font-weight: 650; color: var(--sg-text-muted); }
.agenda-card .ag-title { font-weight: 650; font-size: 1.02rem; margin: .15rem 0; }
.agenda-card .ag-row { display: flex; justify-content: space-between; gap: .75rem; align-items: center; flex-wrap: wrap; margin-top: .5rem; }

/* ---------- 9. Responsive ---------- */
@media (max-width: 1199.98px) {
    .three-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .two-col { grid-template-columns: minmax(0, 1fr); }
    .form-layout { grid-template-columns: minmax(0, 1fr); }
    .summary-panel { position: static; }
}
@media (min-width: 992px) {
    .header-collapse-btn { display: inline-grid; }
}
@media (max-width: 991.98px) {
    .header-collapse-btn { display: none; }
    .app-sidebar { transform: translateX(-100%); width: min(300px, 84vw); }
    .app-sidebar.open { transform: none; box-shadow: var(--sg-shadow-lg); }
    .app-shell.collapsed { --sg-sidebar-w: 0px; }
    .app-shell.collapsed .brand-name, .app-shell.collapsed .nav-item span, .app-shell.collapsed .nav-group-toggle span,
    .app-shell.collapsed .nav-group-toggle i, .app-shell.collapsed .sidebar-provider { display: revert; }
    .app-shell.collapsed .nav-item { justify-content: flex-start; padding: .55rem .75rem; }
    .app-shell.collapsed .sidebar-brand { justify-content: flex-start; padding: 1.1rem 1.25rem; }
    .app-shell.collapsed .nav-group-toggle { height: auto; padding: .85rem .75rem .35rem; margin: 0; border: 0; pointer-events: auto; }
    .sidebar-backdrop.open { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .5); z-index: 1035; animation: fade .15s ease; }
    .app-main { margin-left: 0; }
    .header-menu-btn { display: inline-grid; }
    .app-content { padding: 1.25rem 1rem 1.5rem; }
    .app-header { padding: 0 1rem; }
    .even-col, .three-col, .chart-row { grid-template-columns: minmax(0, 1fr); }
    .user-meta { display: none; }
}

/* Phones and small tablets */
@media (max-width: 767.98px) {
    .only-mobile { display: revert !important; } .only-desktop { display: none !important; }
    h1 { font-size: 1.5rem; }
    .page-header { margin-bottom: 1.1rem; align-items: flex-start; }
    .sg-card-header { padding: .95rem 1rem; } .sg-card-body { padding: 1rem; }
    .list-plain li { padding: .75rem 1rem; }
    .btn-sg { min-height: 44px; } .btn-sg.sm { min-height: 38px; }
    .input-sg, .select-sg { font-size: 16px; min-height: 48px; }
    .filter-bar { padding: .85rem 1rem; }
    .toolbar-row .grow, .toolbar-row .select-sg, .toolbar-row > div { flex: 1 1 100%; width: 100%; max-width: none !important; }
    .modal-sg header, .modal-sg footer { padding: .9rem 1rem; } .modal-sg .body { padding: 1rem; }

    /* Tables become stacked cards: each row is a card, each cell a label/value line (labels filled in by app.js). */
    .sg-table:not(.no-stack), .sg-table:not(.no-stack) tbody, .sg-table:not(.no-stack) tr, .sg-table:not(.no-stack) td { display: block; }
    .sg-table:not(.no-stack) thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .sg-table:not(.no-stack) tbody { padding: .6rem; display: grid; gap: .65rem; }
    .sg-table:not(.no-stack) tr { border: 1px solid var(--sg-border); border-radius: 14px; padding: .55rem .95rem; background: #fff; box-shadow: var(--sg-shadow); }
    .sg-table:not(.no-stack) tbody tr:hover { background: #fff; }
    .sg-table:not(.no-stack) td { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .4rem 0; border: 0; text-align: right; min-height: 32px; }
    .sg-table:not(.no-stack) td::before { content: attr(data-label); flex: none; color: var(--sg-text-muted); font-size: .75rem; font-weight: 600; text-align: left; }
    .sg-table:not(.no-stack) td.stack-title { display: block; text-align: left; font-size: 1.02rem; font-weight: 650; padding: .35rem 0 .15rem; }
    .sg-table:not(.no-stack) td.stack-title::before { display: none; }
    .sg-table:not(.no-stack) td[data-label=""]::before, .sg-table:not(.no-stack) td[data-label="Actions"]::before, .sg-table:not(.no-stack) td[data-label="Action"]::before { display: none; }
    .sg-table:not(.no-stack) td[data-label="Actions"], .sg-table:not(.no-stack) td[data-label="Action"] { justify-content: stretch; padding-top: .6rem; margin-top: .3rem; border-top: 1px solid var(--sg-border); }
    .sg-table:not(.no-stack) td[data-label="Actions"] > *, .sg-table:not(.no-stack) td[data-label="Action"] > * { flex: 1; }
    .sg-table:not(.no-stack) td.num { text-align: right; }

    /* Calendar: day strip + agenda instead of a seven-column grid */
    .cal-desktop { display: none; } .cal-mobile { display: block; }

    /* Portals */
    .stepper { display: flex; } .step-nav { display: flex; }
    .wizard .step-pane:not(.active) { display: none; }
    .wizard .wizard-submit { display: none; } .wizard.last .wizard-submit { display: flex; }
    .toast-host { right: .75rem; left: .75rem; bottom: auto; top: calc(.75rem + env(safe-area-inset-top, 0px)); width: auto; }
    .has-bottom-nav .bottom-nav { display: grid; }
    .has-bottom-nav .app-content { padding-bottom: calc(var(--sg-bottom-nav-h) + var(--sg-safe-bottom) + 1.25rem); }
    .has-bottom-nav .app-footer { display: none; }
    .has-bottom-nav .crumbs a, .has-bottom-nav .crumbs i { display: none; }
    .kpi-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    /* Dialogs: simple ones become bottom sheets */
    .modal-backdrop-sg { place-items: end center; padding: 0; }
    .modal-sg { max-width: 100%; border-radius: 22px 22px 0 0; max-height: 92dvh; animation: sheet .24s ease; padding-bottom: var(--sg-safe-bottom); }
    .modal-sg.fullscreen-sm { max-height: 100dvh; height: 100dvh; border-radius: 0; }
    .modal-sg footer { flex-wrap: wrap; } .modal-sg footer .btn-sg { flex: 1 1 130px; }
}
@media (max-width: 575.98px) {
    .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
    .stat-card { padding: .95rem; } .stat-card .value { font-size: 1.55rem; } .stat-card .icon { width: 38px; height: 38px; font-size: 1.1rem; }
    .stat-card .label { margin-top: .7rem; }
    .stat-card .value.sm { font-size: 1.2rem; }
    .crumbs .hide-xs { display: none; }
    .timeline li { grid-template-columns: 62px 12px 1fr; gap: .5rem; }
    .child-card { min-width: 100%; }
    .page-actions { width: 100%; } .page-actions .btn-sg { flex: 1; }
    .donut-layout { gap: 1rem; } .donut-layout svg { width: 160px; height: 160px; }
    .legend-col { min-width: 100%; }
    .date-inputs { width: 100%; } .date-inputs .input-sg { flex: 1; width: auto; min-height: 44px; }
    .welcome { padding: 1.25rem; border-radius: 18px; }
    .auth-card { padding: 1.5rem 1.25rem; border-radius: 20px; }
    .quick-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; }
    .quick-tile { padding: .7rem .2rem; font-size: .68rem; border-radius: 14px; }
    .day-chip { min-height: 54px; border-radius: 12px; }
}
@media (pointer: coarse) {
    .icon-btn { width: 44px; height: 44px; }
    .menu-item { min-height: 44px; }
}

/* ---------- 10. Motion and print ---------- */
.print-only { display: none; }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
@media print {
    .app-sidebar, .app-header, .app-footer, .toast-host, .no-print, .page-header .page-actions, .sidebar-backdrop, .bottom-nav { display: none !important; }
    .btn-sg, .icon-btn, .pager, .segmented, .quick-actions, .search-box { display: none !important; }
    .print-only { display: block !important; }
    .print-letterhead { text-align: center; margin-bottom: .75rem; }
    .table-wrap { overflow: visible !important; }
    tr, .list-plain li { break-inside: avoid; }
    a { color: inherit !important; text-decoration: none !important; }
    .app-main { margin-left: 0 !important; }
    .app-content { padding: 0 !important; max-width: none !important; }
    body, html { background: #fff !important; }
    .sg-card { box-shadow: none !important; border: 0 !important; }
}

/* Read-only charts keep the default cursor */
.chart-bar.static { cursor: default; } .chart-bar.static:hover { opacity: 1; filter: none; }

/* Registration layout: child on the left, guardian and consent stacked on the right; one step at a time on phones */
.reg-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; align-items: start; }
.reg-grid .reg-child { grid-row: span 2; }
.reg-grid .reg-submit { grid-column: 1 / -1; }
.sg-card .form-section-head h3 { font-size: 1.02rem; }
@media (max-width: 767.98px) {
    .reg-grid { display: block; }
    .reg-grid .reg-submit { margin-top: 1rem; } .reg-grid .reg-submit .btn-sg { width: 100%; }
}

@media (max-width: 767.98px) {
    .filter-bar > div { flex: 1 1 100%; min-width: 0; }
    .filter-bar .d-flex { flex-wrap: wrap; }
}

/* Reports */
.report-item { padding: 0 !important; }
.report-item > a { padding: .8rem 1.4rem; color: var(--sg-text); }
.report-item.on { background: var(--sg-primary-soft); box-shadow: inset 3px 0 0 var(--sg-primary); }
.report-item > a:hover { background: #F8FAFC; }
.report-item.on > a:hover { background: transparent; }
@media (max-width: 767.98px) {
    .report-catalog .list-plain { display: flex; overflow-x: auto; gap: .5rem; padding: .75rem; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
    .report-catalog .list-plain li { flex: 0 0 auto; border: 1px solid var(--sg-border); border-radius: 12px; scroll-snap-align: start; max-width: 230px; }
    .report-item.on { box-shadow: none; border-color: var(--sg-primary) !important; }
    .report-item > a { padding: .6rem .85rem; } .report-item .small-sg { display: none; }
    .sg-table:not(.no-stack) tfoot, .sg-table:not(.no-stack) tfoot tr, .sg-table:not(.no-stack) tfoot td { display: block; }
    .sg-table:not(.no-stack) tfoot tr { margin: 0 .6rem .6rem; border: 1px solid var(--sg-border); border-radius: 14px; padding: .55rem .95rem; background: #F8FAFC; }
    .sg-table:not(.no-stack) tfoot td { display: flex; justify-content: space-between; border: 0; padding: .4rem 0; }
    .sg-table:not(.no-stack) tfoot td::before { content: attr(data-label); color: var(--sg-text-muted); font-size: .75rem; font-weight: 600; }
}

/* Uploaded logos replace the square initials mark. Wide logos are shown whole (contain), never cropped. */
.brand-mark.has-logo { width: auto; max-width: 190px; height: 40px; background: transparent; border-radius: 0; overflow: visible; }
.brand-mark.has-logo img { width: auto; max-width: 190px; height: 40px; object-fit: contain; object-position: left center; }
.sidebar-brand:has(.has-logo) .brand-name { display: none; }
.app-shell.collapsed .brand-mark.has-logo { max-width: 44px; } .app-shell.collapsed .brand-mark.has-logo img { max-width: 44px; object-position: center; }
.auth-brand .brand-mark.has-logo { width: auto; max-width: 260px; height: 64px; margin: 0 auto .75rem; border-radius: 0; }
.auth-brand .brand-mark.has-logo img { height: 64px; max-width: 260px; object-position: center; }
@media (max-width: 991.98px) { .app-shell.collapsed .brand-mark.has-logo { max-width: 190px; } .app-shell.collapsed .brand-mark.has-logo img { max-width: 190px; object-position: left center; } }

/* Settings: logo upload cards */
.logo-card .logo-preview { height: 104px; display: grid; place-items: center; border-radius: 14px; border: 1px dashed var(--sg-border-strong); background: #fff; margin-bottom: .6rem; padding: .75rem; }
.logo-card .logo-preview.dark { background: var(--sg-sidebar); border-color: #374151; }
.logo-card .logo-preview img { max-height: 76px; max-width: 100%; object-fit: contain; }
.logo-card .logo-empty { color: #94A3B8; font-size: .8125rem; }

/* =========================================================
   Admin dashboard: compact, content-sized layout
   ========================================================= */
.app-content { max-width: 1440px; padding: 1.5rem 1.5rem 1.75rem; }
.dash { display: grid; gap: 16px; }
.dash .page-header { margin-bottom: 0; align-items: center; }
.dash .page-header h1 { font-size: 1.65rem; }
.dash .page-header .subtitle { margin-top: 2px; font-size: .85rem; }

/* KPI strip: white cards, small tinted icon, number is the focus */
.kpi-grid.dense { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin: 0; }
.kpi-grid.dense .stat-card { display: grid; grid-template-columns: 30px minmax(0, 1fr); grid-template-areas: "i l" "v v" "h h"; align-items: center; column-gap: 9px; row-gap: 0; padding: 14px 16px; background: #fff; border-radius: 14px; box-shadow: 0 1px 2px rgba(15, 23, 42, .03); }
.kpi-grid.dense .stat-card .icon { grid-area: i; width: 30px; height: 30px; border-radius: 9px; font-size: .95rem; }
.kpi-grid.dense .stat-card .label { grid-area: l; margin: 0; font-size: .75rem; line-height: 1.2; }
.kpi-grid.dense .stat-card .value { grid-area: v; font-size: 1.75rem; line-height: 1.15; margin-top: 8px; white-space: nowrap; }
.kpi-grid.dense .stat-card .value.sm { font-size: 1.45rem; }
.kpi-grid.dense .stat-card .hint { grid-area: h; margin-top: 2px; font-size: .6875rem; line-height: 1.3; }
.kpi-grid.dense .stat-card .lock { top: 12px; right: 12px; }

.dash-main { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.dash-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.dash-pair > .sg-card { display: flex; flex-direction: column; }
.dash .sg-card-header { padding: 12px 16px; min-height: 0; }
.dash .sg-card-header h2 { font-size: .9375rem; }
.dash .sg-card-body { padding: 14px 16px; }
.dash .sg-card-header .sub { font-size: .75rem; color: var(--sg-text-muted); margin-top: 1px; }
.dash .segmented button { min-height: 28px; padding: .15rem .7rem; font-size: .75rem; }
.dash .segmented { border-radius: 9px; }
.dash .date-inputs .input-sg { min-height: 30px; font-size: .75rem; }
.dash .chart-legend { margin-top: 6px; font-size: .75rem; gap: .3rem .9rem; }

/* Compact donut: donut on the left, legend on the right, vertically centred */
.donut-layout.compact { flex-wrap: nowrap; justify-content: flex-start; gap: 20px; }
.donut-layout.compact svg { width: 144px; height: 144px; }
.donut-layout.compact .legend-col { flex: 1; min-width: 0; gap: 6px; max-height: 150px; overflow-y: auto; }
.dash-pair .sg-card-body { flex: 1; display: grid; align-items: center; }

/* Priorities */
.prio-list { list-style: none; margin: 0; padding: 6px; }
.prio-list .action-item { padding: 0 10px; min-height: 48px; border-radius: 10px; gap: 12px; }
.prio-list .action-item .ai { width: 30px; height: 30px; border-radius: 9px; font-size: .95rem; }
.prio-list .action-item .at { font-size: .8125rem; }
.prio-clear { display: flex; align-items: center; gap: 10px; padding: 14px 16px; color: var(--sg-text-muted); font-size: .8125rem; }
.prio-clear i { color: var(--sg-success); font-size: 1.1rem; }

/* Compact tables */
.sg-table.compact th { padding: 9px 16px; font-size: .6875rem; }
.sg-table.compact td { padding: 10px 16px; font-size: .8125rem; height: 52px; }
.sg-table.compact .pname { font-weight: 600; }
.sg-table.compact .btn-sg.sm { min-height: 30px; padding: .2rem .65rem; }

/* Compact lists: upcoming and activity */
.row-list { list-style: none; margin: 0; padding: 0; }
.row-list li { display: flex; align-items: center; gap: 12px; padding: 0 16px; min-height: 56px; border-bottom: 1px solid var(--sg-border); }
.row-list li:last-child { border-bottom: 0; }
.row-list .main { flex: 1; min-width: 0; line-height: 1.3; }
.row-list .main .t { font-weight: 600; font-size: .8125rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-list .main .s { font-size: .75rem; color: var(--sg-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-list .when { text-align: right; font-size: .75rem; color: var(--sg-text-muted); line-height: 1.3; white-space: nowrap; }
.row-list .when strong { display: block; color: var(--sg-text); font-weight: 600; }
.row-list.activity li { min-height: 52px; }
.act-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; font-size: .95rem; background: var(--accent-soft); color: var(--accent); }
.card-link { font-size: .8125rem; font-weight: 560; white-space: nowrap; }
.card-foot { padding: 10px 16px; border-top: 1px solid var(--sg-border); font-size: .8125rem; font-weight: 560; }

@media (max-width: 1399.98px) { .kpi-grid.dense { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1199.98px) { .dash-main { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 991.98px) { .app-content { padding: 1.25rem 1rem 1.5rem; } }
@media (max-width: 767.98px) {
    .dash { gap: 12px; }
    .kpi-grid.dense { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .kpi-grid.dense .stat-card { padding: 12px; } .kpi-grid.dense .stat-card .value { font-size: 1.5rem; } .kpi-grid.dense .stat-card .value.sm { font-size: 1.15rem; }
    .dash-pair { grid-template-columns: minmax(0, 1fr); gap: 12px; }
    .donut-layout.compact svg { width: 120px; height: 120px; } .donut-layout.compact { gap: 14px; }
    .sg-table.compact td { height: auto; }
    .dash .page-header .page-actions { width: auto; } .dash .page-header .page-actions .btn-sg { flex: 0 1 auto; }
}

/* The overview chart is drawn at the size that fits its card, so text stays readable at every width */
.chart-switch { container-type: inline-size; }
.chart-switch .cs-l, .chart-switch .cs-m, .chart-switch .cs-s { display: none; }
@container (min-width: 880px) { .cs-l { display: block !important; } }
@container (min-width: 560px) and (max-width: 879.98px) { .cs-m { display: block !important; } }
@container (max-width: 559.98px) { .cs-s { display: block !important; } }

/* Availability overview */
.avail-chip { display: inline-block; background: #ECFDF5; color: #166534; border-radius: 8px; padding: 2px 8px; font-size: .75rem; font-weight: 560; white-space: nowrap; margin: 1px 0; }
.sg-table tr.row-on { background: var(--sg-primary-soft); }
@media (max-width: 767.98px) { .sg-table:not(.no-stack) td .avail-chip { margin-left: .25rem; } }

/* Phone agenda: white cards with a solid status accent and pill */
.agenda-card { border-left: 5px solid var(--svc, #2563EB); }
.agenda-card.cal-now { box-shadow: 0 0 0 2px var(--sg-primary-ring), var(--sg-shadow); }
.cal-toolbar .btn-sg, .cal-page .page-actions .btn-sg { min-height: 36px; padding: .35rem .85rem; border-radius: 10px; }
.cal-toolbar .select-sg { min-height: 36px; padding-top: .25rem; padding-bottom: .25rem; border-radius: 10px; font-size: .8125rem; }
.cal-toolbar .nav-sq { width: 36px; padding: 0; }
.cal-toolbar .range { font-weight: 650; font-size: .95rem; color: #0F172A; }
@media (max-width: 767.98px) { .cal-toolbar .btn-sg, .cal-page .page-actions .btn-sg { min-height: 44px; } .cal-toolbar .select-sg { min-height: 44px; } .cal-toolbar .nav-sq { width: 44px; } }

/* ---------- Payments, receipts and session reports ---------- */
.channel-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.channel-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.channel-card .ch-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.channel-card .ch-name { font-weight: 650; font-size: 1.02rem; line-height: 1.2; }
.channel-card .ch-acct { font-size: .875rem; line-height: 1.4; }
.channel-card .ch-num { font-weight: 650; font-size: 1.05rem; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.qr-box { display: grid; place-items: center; width: 160px; height: 160px; border: 1px dashed var(--sg-border-strong); border-radius: 14px; background: #fff; overflow: hidden; margin: 0 auto; }
.qr-box img { width: 100%; height: 100%; object-fit: contain; }
.qr-box .qr-empty { color: #94A3B8; font-size: .75rem; text-align: center; padding: 8px; }
.pay-brand { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-weight: 700; font-size: .8rem; color: #fff; flex: none; background: var(--brand, #2563EB); }
.brand-gcash { --brand: #0070E0; } .brand-maya { --brand: #00A86B; } .brand-gotyme { --brand: #0B8F8B; } .brand-bdo { --brand: #0B3D91; }
.brand-unionbank { --brand: #F58220; } .brand-bpi { --brand: #B3282D; } .brand-chinabank { --brand: #6A1B1B; }

.stage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 10px; }
.stage-item { position: relative; border: 1px solid var(--sg-border); border-radius: 12px; overflow: hidden; background: #F8FAFC; }
.stage-item img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.stage-item .stage-meta { padding: 6px 8px; font-size: .6875rem; color: var(--sg-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-item .stage-x { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(15, 23, 42, .75); color: #fff; display: grid; place-items: center; }
.file-input::file-selector-button { margin-right: .75rem; border: 0; border-radius: 8px; padding: .4rem .8rem; background: var(--sg-primary-soft); color: var(--sg-primary); font-weight: 600; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.photo-grid .position-relative > button:not(.stage-x) { border: 0; width: 100%; padding: 0; border-radius: 10px; overflow: hidden; background: #E2E8F0; aspect-ratio: 1; }
.photo-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-viewer { text-align: center; } .photo-viewer img { max-width: 100%; max-height: 70dvh; border-radius: 10px; }

.receipt-view { background: #0F172A; border-radius: 12px; overflow: auto; max-height: 70dvh; text-align: center; }
.receipt-view img { max-width: 100%; display: block; margin: 0 auto; cursor: zoom-in; }
.receipt-view.zoom img { max-width: none; width: 160%; cursor: zoom-out; }
.verify-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: .875rem; margin: 0; }
.kv dt { color: var(--sg-text-muted); font-weight: 500; } .kv dd { margin: 0; text-align: right; font-weight: 560; }
.report-text h3 { font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--sg-text-muted); margin: 14px 0 3px; }
.report-text p { margin: 0; white-space: pre-wrap; }
.report-grid { display: grid; gap: 12px; }
@media (max-width: 767.98px) {
    .verify-layout { grid-template-columns: minmax(0, 1fr); }
    .channel-grid { grid-template-columns: minmax(0, 1fr); }
    .qr-box { width: 200px; height: 200px; }
}
.quick-grid.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 575.98px) { .quick-grid.five { gap: .35rem; } .quick-grid.five .quick-tile { padding: .6rem .1rem; font-size: .62rem; } }

/* Small fixed tables (invoice lines) stay inside the screen on phones */
@media (max-width: 575.98px) {
    .sg-table.no-stack th, .sg-table.no-stack td { padding: .55rem .5rem; font-size: .8rem; }
    .sg-table.no-stack td:first-child, .sg-table.no-stack th:first-child { padding-left: .85rem; }
    .sg-table.no-stack td:last-child, .sg-table.no-stack th:last-child { padding-right: .85rem; }
}
.kpi-grid.dense.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 991.98px) { .kpi-grid.dense.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi-grid.dense.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* =========================================================
   Shared data table design (.sg-table, also available as .sg-data-table)
   Light blue zebra rows, a distinct header, roomy rows, consistent actions.
   Row colours follow the visible row position, so they stay correct after sorting, filtering and paging.
   ========================================================= */
.sg-table th, .sg-data-table th { background: #F1F5F9; color: #475569; font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; padding: 12px 16px; border-bottom: 1px solid #CBD5E1; white-space: nowrap; }
.sg-table td, .sg-data-table td { padding: 14px 16px; border-bottom: 1px solid #E8EEF5; vertical-align: middle; font-size: .875rem; line-height: 1.4; }
.sg-table tbody tr:nth-child(odd), .sg-data-table tbody tr:nth-child(odd) { background-color: #FFFFFF; }
.sg-table tbody tr:nth-child(even), .sg-data-table tbody tr:nth-child(even) { background-color: #F2F7FF; }
.sg-table tbody tr, .sg-data-table tbody tr { transition: background-color 150ms ease; }
.sg-table tbody tr:hover, .sg-data-table tbody tr:hover { background-color: #EAF2FF; }
.sg-table tbody tr.row-on, .sg-table tbody tr[aria-selected="true"] { background-color: #DBEAFE; }
.sg-table tbody tr:last-child td { border-bottom: 0; }
.sg-table td .small-sg, .sg-table td .sub { font-size: .75rem; color: #64748B; }
.sg-table.compact th { padding: 10px 16px; } .sg-table.compact td { padding: 10px 16px; }
.sg-table td .btn-sg:not(.primary):not(.success):not(.danger):not(.danger-soft):not(.warning):not(.ghost) { background: #fff; border-color: #E2E8F0; color: #1E293B; font-weight: 560; }
.sg-table td .btn-sg:not(.primary):not(.success):not(.danger):not(.danger-soft):not(.warning):not(.ghost):hover { background: #EFF6FF; border-color: #93C5FD; color: #1D4ED8; }
.sg-table td.text-end { white-space: nowrap; }
.sg-table td .btn-sg { white-space: nowrap; }
.sg-card:has(> .table-wrap, > .sg-table) { overflow: hidden; }

/* Status pills: one size, one set of colours */
.badge-sg { font-size: 11px; padding: 5px 11px; min-height: 24px; }
.badge-blue { background: #DBEAFE; color: #1D4ED8; }

/* Filter panel on list pages */
.filter-bar { gap: 12px 14px; padding: 14px 16px; background: #FCFDFE; align-items: flex-end; }
.filter-bar .input-sg, .filter-bar .select-sg { min-height: 40px; height: 40px; padding-top: 0; padding-bottom: 0; }
.filter-bar .filter-title { flex: 0 0 100%; display: flex; align-items: center; gap: 8px; font-size: .8125rem; font-weight: 650; color: #334155; margin-bottom: -2px; }
.filter-bar .filter-title i { color: var(--sg-primary); }
.filter-bar .form-check { min-height: 40px; display: flex; align-items: center; gap: 6px; margin: 0; padding-left: 0; }
.filter-bar .form-check input { margin: 0; }
@media (max-width: 767.98px) { .sg-table:not(.no-stack) tbody tr:nth-child(even) { background-color: #fff; } .filter-bar .input-sg, .filter-bar .select-sg { height: 48px; } }

/* ---------- Dashboards: trend, aging bars, grouped attention lists, day progress ---------- */
.stat-card .trend { font-size: .72rem; font-weight: 600; margin-top: .3rem; display: flex; align-items: center; gap: .25rem; color: var(--sg-text-muted); }
.stat-card .trend.good { color: var(--sg-success); }
.stat-card .trend.bad { color: #DC2626; }
.dash-section { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--sg-text-muted); font-weight: 700; margin: 1.4rem 0 .6rem; }
.dash-section:first-of-type { margin-top: .4rem; }
.kpi-grid.five { grid-template-columns: repeat(5, minmax(0, 1fr)); margin-bottom: 1rem; }
.attn-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.attn-grid .sg-card-header h2 { display: flex; align-items: center; gap: .5rem; }
.attn-grid .sg-card-header h2 .badge-sg { font-size: .7rem; }
.aging-row { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr) auto; align-items: center; gap: .75rem; padding: .45rem 0; font-size: .8125rem; }
.aging-row .bar { height: 10px; border-radius: 6px; background: var(--sg-border); overflow: hidden; }
.aging-row .bar > span { display: block; height: 100%; border-radius: 6px; background: #94A3B8; }
.aging-row.late1 .bar > span { background: #F59E0B; } .aging-row.late2 .bar > span { background: #EA580C; } .aging-row.late3 .bar > span { background: #DC2626; } .aging-row.ok .bar > span { background: #16A34A; }
.aging-row .amt { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; min-width: 7rem; }
.aging-row .amt small { display: block; font-weight: 500; color: var(--sg-text-muted); font-size: .7rem; }
.day-progress { display: flex; height: 14px; border-radius: 8px; overflow: hidden; background: var(--sg-border); }
.day-progress > span { display: block; height: 100%; }
.day-legend { display: flex; flex-wrap: wrap; gap: .35rem 1.1rem; margin-top: .6rem; font-size: .78rem; color: var(--sg-text-muted); }
.day-legend i.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: .35rem; }
.week-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .4rem; }
.week-strip .wd { text-align: center; padding: .55rem .2rem; border: 1px solid var(--sg-border); border-radius: 12px; background: #fff; }
.week-strip .wd.today { border-color: var(--sg-primary); background: var(--sg-primary-soft); }
.week-strip .wd .d { font-size: .7rem; color: var(--sg-text-muted); font-weight: 600; text-transform: uppercase; }
.week-strip .wd .n { font-size: 1.25rem; font-weight: 700; line-height: 1.2; }
.week-strip .wd.off .n { color: #CBD5E1; }
.alert-stack { display: grid; gap: .6rem; margin-bottom: 1.1rem; }
.alert-card { display: flex; align-items: center; gap: .85rem; padding: .85rem 1rem; border-radius: 14px; border: 1px solid var(--sg-border); background: #fff; border-left-width: 5px; }
.alert-card .ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-size: 1.15rem; flex: none; }
.alert-card .tx { flex: 1; min-width: 0; }
.alert-card .tx .t { font-weight: 650; }
.alert-card .tx .s { font-size: .8rem; color: var(--sg-text-muted); }
.alert-card.danger { border-left-color: #DC2626; } .alert-card.danger .ic { background: #FEE2E2; color: #B91C1C; }
.alert-card.warning { border-left-color: #F59E0B; } .alert-card.warning .ic { background: #FEF3C7; color: #B45309; }
.alert-card.info { border-left-color: #2563EB; } .alert-card.info .ic { background: #DBEAFE; color: #1D4ED8; }
.snapshot-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .75rem; margin-bottom: 1.1rem; }
.snapshot { padding: .9rem 1rem; border: 1px solid var(--sg-border); border-radius: 14px; background: #fff; }
.snapshot .k { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--sg-text-muted); font-weight: 700; }
.snapshot .v { font-size: 1.3rem; font-weight: 700; line-height: 1.25; margin-top: .15rem; }
.snapshot .h { font-size: .78rem; color: var(--sg-text-muted); }
@media (max-width: 1199.98px) { .kpi-grid.five { grid-template-columns: repeat(3, minmax(0, 1fr)); } .attn-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 767.98px) {
    .kpi-grid.five { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .attn-grid { grid-template-columns: minmax(0, 1fr); }
    .aging-row { grid-template-columns: minmax(0, 1fr) auto; } .aging-row .bar { grid-column: 1 / -1; order: 3; }
    .week-strip { gap: .25rem; } .week-strip .wd .n { font-size: 1.05rem; }
}

/* ---------- Day board: one column per therapist ---------- */
.board-wrap { overflow: auto; border: 1px solid var(--sg-border); border-radius: 14px; background: #fff; max-height: 78vh; }
.board { display: grid; position: relative; min-width: max-content; }
.board-head { position: sticky; top: 0; z-index: 4; background: #fff; border-bottom: 1px solid var(--sg-border); border-left: 1px solid var(--sg-border); padding: .55rem .6rem; min-height: 56px; }
.board-head.time { left: 0; z-index: 6; border-left: 0; }
.board-head.none { background: #FEF2F2; }
.board-time { position: sticky; left: 0; z-index: 3; background: #fff; }
.board-time .hr { font-size: .68rem; color: var(--sg-text-muted); text-align: right; padding: .15rem .35rem 0 0; border-bottom: 1px solid var(--sg-border); }
.board-col { position: relative; border-left: 1px solid var(--sg-border); }
.board-col .cell { position: absolute; left: 0; right: 0; border-bottom: 1px solid var(--sg-border); display: block; }
.board-col .cell.open { background: #ECFDF5; }
.board-col .cell.open:hover { background: #D1FAE5; }
.board-col .cell.off { background: #F1F5F9; }
.board-col .blk { position: absolute; left: 3px; right: 3px; z-index: 2; display: flex; flex-direction: column; gap: 1px; overflow: hidden; padding: .22rem .4rem; border-radius: 8px; border-left: 4px solid var(--ev, #2563EB);
    background: color-mix(in srgb, var(--ev, #2563EB) 13%, #fff); color: var(--sg-text); text-decoration: none; font-size: .72rem; line-height: 1.25; box-shadow: 0 1px 2px rgba(15, 23, 42, .08); }
.board-col .blk:hover { box-shadow: 0 3px 10px rgba(15, 23, 42, .18); z-index: 3; }
.board-col .blk .t { font-weight: 700; } .board-col .blk .n { font-weight: 650; } .board-col .blk .s { color: var(--sg-text-muted); }
.board-col .blk.st-completed { background: color-mix(in srgb, #16A34A 14%, #fff); }
.board-col .blk.st-inprogress { outline: 2px solid var(--ev, #2563EB); }
.board-col .blk.st-cancelled, .board-col .blk.st-noshow { opacity: .55; background: #F8FAFC; border-left-color: #94A3B8; }
.board-col .blk.match { outline: 2px solid #F59E0B; }
@media print { .board-wrap { max-height: none; overflow: visible; } }

/* Free weekly times offered when booking a slot */
.slot-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .5rem; margin: .4rem 0; }
.slot-opt { display: flex; flex-direction: column; text-align: left; gap: .05rem; padding: .5rem .65rem; border: 1px solid var(--sg-border); border-radius: 12px; background: #fff; cursor: pointer; }
.slot-opt:hover { border-color: var(--sg-primary); }
.slot-opt.on { border-color: var(--sg-primary); background: var(--sg-primary-soft); box-shadow: 0 0 0 2px color-mix(in srgb, var(--sg-primary) 25%, transparent); }
.slot-opt .d { font-weight: 700; } .slot-opt .w { font-size: .8rem; } .slot-opt .f { font-size: .72rem; color: #15803D; }
.slot-opt.partial .f { color: #B45309; }

/* Service cards in the family portal */
.svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.svc-card { border-top: 4px solid var(--ev, #2563EB); }

/* =========================================================
   Family portal: dashboard and Services (pp-*)
   ========================================================= */
.pp { --pp-text: #172033; --pp-muted: #64748B; --pp-border: #E2E8F0; --pp-radius: 20px; --pp-shadow: 0 1px 2px rgba(23, 32, 51, .04), 0 8px 24px rgba(37, 99, 235, .06); color: var(--pp-text); }
.pp h1, .pp h2, .pp h3 { color: var(--pp-text); letter-spacing: -.01em; }
.pp-rise { animation: pp-rise .45s ease both; }
.pp-rise:nth-child(2) { animation-delay: .05s; } .pp-rise:nth-child(3) { animation-delay: .1s; } .pp-rise:nth-child(4) { animation-delay: .15s; }
@keyframes pp-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Pictures: a fixed shape with a built-in illustration when nothing was uploaded, so replacing a picture never moves the page */
.pp-img { position: relative; overflow: hidden; background: var(--pp-soft, #EEF4FF); width: 100%; }
.pp-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s ease; }
.pp-img-fallback { position: absolute; inset: 0; display: grid; place-items: center; }
.pp-img-fallback .pp-art { width: 100%; height: 100%; }
.pp-ratio-16-10 { aspect-ratio: 16 / 10; } .pp-ratio-4-3 { aspect-ratio: 4 / 3; } .pp-ratio-3-2 { aspect-ratio: 3 / 2; } .pp-ratio-1 { aspect-ratio: 1 / 1; }
.pp-round { border-radius: 50%; aspect-ratio: 1 / 1; }
.pp-art { display: block; }

/* Welcome and page headers */
.pp-hero {
    position: relative; overflow: hidden; border-radius: 28px; padding: 1.9rem 2rem; margin-bottom: 1.25rem;
    display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr); align-items: center; gap: 1rem;
    background: linear-gradient(120deg, #DBEAFE 0%, #E0E7FF 38%, #EDE9FE 62%, #FDE8F3 100%);
    box-shadow: var(--pp-shadow);
}
.pp-hero::before { content: ""; position: absolute; left: -60px; bottom: -90px; width: 260px; height: 260px; border-radius: 50%; background: rgba(255, 255, 255, .45); }
.pp-hero::after { content: ""; position: absolute; right: 26%; top: -50px; width: 150px; height: 150px; border-radius: 42% 58% 55% 45%; background: rgba(253, 186, 116, .28); }
.pp-hero > * { position: relative; z-index: 1; }
.pp-hero h1 { font-size: clamp(1.55rem, 3.2vw, 2.35rem); font-weight: 800; line-height: 1.15; margin: .55rem 0 .5rem; }
.pp-hero p { color: #3B4A66; font-size: 1.02rem; max-width: 34rem; margin: 0; }
.pp-hero .pp-hero-art { max-width: 380px; width: 100%; justify-self: end; border-radius: 24px; --pp-soft: transparent; }
.pp-eyebrow { display: inline-flex; align-items: center; gap: .4rem; background: rgba(255, 255, 255, .8); color: #1D4ED8; font-weight: 700; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; padding: .32rem .75rem; border-radius: 999px; }
.pp-star { position: absolute; z-index: 0; color: #FCD34D; font-size: 1.4rem; opacity: .9; animation: pp-float 6s ease-in-out infinite; }
.pp-star.s1 { top: 18%; right: 44%; } .pp-star.s2 { bottom: 14%; right: 6%; font-size: 1rem; animation-delay: 1.5s; } .pp-star.s3 { top: 12%; left: 52%; font-size: 1rem; color: #F9A8D4; animation-delay: .8s; }
@keyframes pp-float { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-8px) rotate(8deg); } }

/* Section headings */
.pp-h { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: .5rem; margin: 1.6rem 0 .8rem; }
.pp-h h2 { font-size: 1.25rem; font-weight: 750; margin: 0; }
.pp-h p { color: var(--pp-muted); margin: .15rem 0 0; font-size: .9rem; }
.pp-link { color: #2563EB; font-weight: 650; font-size: .875rem; text-decoration: none; }
.pp-link:hover { text-decoration: underline; }

/* Buttons */
.pp-btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; border: 0; border-radius: 999px; padding: .6rem 1.15rem; font-weight: 700; font-size: .9rem; background: var(--c, #2563EB); color: #fff; text-decoration: none; cursor: pointer;
    transition: background .2s, transform .2s, box-shadow .2s; box-shadow: 0 6px 16px color-mix(in srgb, var(--c, #2563EB) 28%, transparent); }
.pp-btn:hover { color: #fff; background: color-mix(in srgb, var(--c, #2563EB) 84%, black); transform: translateY(-1px); }
.pp-btn i { transition: transform .2s; } .pp-btn:hover i.bi-arrow-right { transform: translateX(3px); }
.pp-btn.ghost { background: #fff; color: var(--c, #2563EB); box-shadow: none; border: 1px solid color-mix(in srgb, var(--c, #2563EB) 35%, #E2E8F0); }
.pp-btn.ghost:hover { background: color-mix(in srgb, var(--c, #2563EB) 8%, #fff); color: var(--c, #2563EB); }
.pp-btn.sm { padding: .42rem .85rem; font-size: .8rem; }

/* Cards */
.pp-card { background: #fff; border: 1px solid var(--pp-border); border-radius: var(--pp-radius); box-shadow: var(--pp-shadow); }
.pp-badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .7rem; font-weight: 700; letter-spacing: .02em; padding: .22rem .6rem; border-radius: 999px; background: color-mix(in srgb, var(--c, #2563EB) 13%, #fff); color: color-mix(in srgb, var(--c, #2563EB) 78%, #172033); }

/* ---------- Services ---------- */
.pp-toolbar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-bottom: 1rem; }
.pp-search { position: relative; flex: 1 1 280px; max-width: 460px; }
.pp-search i { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--pp-muted); }
.pp-search input { width: 100%; padding: .72rem 1rem .72rem 2.6rem; border-radius: 999px; border: 1px solid var(--pp-border); background: #fff; font-size: .95rem; box-shadow: var(--pp-shadow); }
.pp-search input:focus { outline: 2px solid #93C5FD; border-color: #60A5FA; }
.pp-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.pp-chip { border: 1px solid var(--pp-border); background: #fff; color: #334155; border-radius: 999px; padding: .42rem .9rem; font-size: .84rem; font-weight: 600; cursor: pointer; transition: all .15s; }
.pp-chip:hover { border-color: #93C5FD; color: #1D4ED8; }
.pp-chip.on { background: #2563EB; border-color: #2563EB; color: #fff; }

.pp-svc-grid { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); }
.pp-svc { display: flex; flex-direction: column; overflow: hidden; transition: transform .25s ease, box-shadow .25s ease; --pp-soft: color-mix(in srgb, var(--c) 14%, #fff); }
.pp-svc:hover { transform: translateY(-4px); box-shadow: 0 2px 4px rgba(23, 32, 51, .05), 0 18px 36px rgba(37, 99, 235, .12); }
.pp-svc:hover .pp-img img { transform: scale(1.05); }
.pp-svc .pp-img { border-radius: 0; }
.pp-svc-icon { width: 34%; max-width: 92px; aspect-ratio: 1; border-radius: 28%; display: grid; place-items: center; background: #fff; color: var(--c); font-size: 2.1rem; box-shadow: 0 8px 20px color-mix(in srgb, var(--c) 22%, transparent); }
.pp-svc-fb { position: absolute; inset: 0; display: grid; place-items: center; background: linear-gradient(135deg, color-mix(in srgb, var(--c) 16%, #fff), color-mix(in srgb, var(--c) 30%, #fff)); }
.pp-svc-fb::before, .pp-svc-fb::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .45); }
.pp-svc-fb::before { width: 90px; height: 90px; right: -22px; top: -26px; } .pp-svc-fb::after { width: 56px; height: 56px; left: 14px; bottom: -18px; }
.pp-svc-fb > * { position: relative; z-index: 1; }
.pp-svc-body { display: flex; flex-direction: column; gap: .55rem; padding: 1rem 1.1rem 1.15rem; flex: 1; }
.pp-svc-body h3 { font-size: 1.1rem; font-weight: 700; margin: 0; }
.pp-clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; color: var(--pp-muted); font-size: .9rem; line-height: 1.45; margin: 0; min-height: calc(1.45em * 3); }
.pp-meta { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .82rem; color: #334155; margin-top: auto; padding-top: .2rem; }
.pp-meta span { display: inline-flex; align-items: center; gap: .35rem; } .pp-meta i { color: var(--c); }
.pp-svc .pp-btn { margin-top: .35rem; width: 100%; }
.pp-noresult { text-align: center; padding: 2.5rem 1rem; color: var(--pp-muted); }

/* Details dialog */
.pp-detail .pp-img { border-radius: 18px; margin-bottom: 1rem; --pp-soft: color-mix(in srgb, var(--c) 14%, #fff); }
.pp-detail h3 { font-size: 1.35rem; font-weight: 800; margin: .4rem 0; }
.pp-facts { display: flex; flex-wrap: wrap; gap: .6rem; margin: .8rem 0; }
.pp-fact { display: flex; align-items: center; gap: .55rem; background: color-mix(in srgb, var(--c) 9%, #fff); border-radius: 14px; padding: .55rem .85rem; }
.pp-fact i { color: var(--c); font-size: 1.15rem; } .pp-fact .k { font-size: .7rem; color: var(--pp-muted); text-transform: uppercase; letter-spacing: .05em; } .pp-fact .v { font-weight: 700; line-height: 1.2; }
.pp-helps { list-style: none; padding: 0; margin: .4rem 0 0; display: grid; gap: .45rem; }
.pp-helps li { display: flex; gap: .6rem; align-items: flex-start; } .pp-helps li i { color: var(--c); margin-top: .15rem; }
.pp-note { background: #F1F5F9; border-radius: 14px; padding: .75rem .9rem; font-size: .84rem; color: #475569; margin-top: 1rem; }

/* Requests */
.pp-req-grid { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.pp-req { padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .5rem; border-left: 5px solid var(--c); }
.pp-req .top { display: flex; justify-content: space-between; gap: .5rem; align-items: flex-start; }
.pp-req h3 { font-size: 1rem; font-weight: 700; margin: 0; }
.pp-status { display: inline-flex; align-items: center; gap: .3rem; font-size: .74rem; font-weight: 700; padding: .25rem .65rem; border-radius: 999px; white-space: nowrap; }
.pp-status.pending { background: #FEF3C7; color: #92400E; } .pp-status.approved { background: #DCFCE7; color: #166534; }
.pp-status.declined { background: #FEE2E2; color: #991B1B; } .pp-status.cancelled { background: #F1F5F9; color: #475569; }
.pp-reply { background: #F8FAFC; border-radius: 12px; padding: .6rem .8rem; font-size: .86rem; }
.pp-empty { text-align: center; padding: 2rem 1rem; display: grid; justify-items: center; gap: .35rem; }
.pp-empty .pp-img { max-width: 190px; border-radius: 50%; --pp-soft: transparent; margin-bottom: .4rem; }
.pp-empty h3 { font-size: 1.15rem; font-weight: 750; margin: 0; } .pp-empty p { color: var(--pp-muted); max-width: 26rem; margin: 0 0 .6rem; }

/* ---------- Dashboard ---------- */
.pp-date-badge { display: inline-flex; align-items: center; gap: .4rem; background: rgba(255, 255, 255, .85); color: #334155; font-size: .8rem; font-weight: 600; padding: .3rem .75rem; border-radius: 999px; }
.pp-top { display: grid; gap: 1rem; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); margin-bottom: 1rem; align-items: stretch; }
.pp-child { padding: 1.1rem 1.2rem; display: flex; flex-direction: column; gap: .8rem; }
.pp-child .who { display: flex; gap: .95rem; align-items: center; }
.pp-avatar { width: 76px; flex: none; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 6px 16px rgba(37, 99, 235, .22); --pp-soft: #DBEAFE; font-weight: 800; }
.pp-avatar .ini { position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.5rem; color: #1D4ED8; background: linear-gradient(135deg, #DBEAFE, #EDE9FE); }
.pp-child h2 { font-size: 1.2rem; font-weight: 800; margin: 0; } .pp-child .age { color: var(--pp-muted); font-size: .85rem; }
.pp-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; color: var(--pp-muted); font-weight: 700; margin-bottom: .3rem; }
.pp-progs { display: flex; flex-wrap: wrap; gap: .35rem; }
.pp-kids { display: flex; flex-wrap: wrap; gap: .5rem; }
.pp-kid { display: inline-flex; align-items: center; gap: .5rem; border: 1px solid var(--pp-border); background: #fff; border-radius: 999px; padding: .3rem .85rem .3rem .35rem; font-weight: 650; font-size: .86rem; cursor: pointer; transition: all .15s; }
.pp-kid .dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: #DBEAFE; color: #1D4ED8; font-size: .72rem; font-weight: 800; }
.pp-kid.on { border-color: #2563EB; background: #EFF6FF; box-shadow: 0 0 0 2px rgba(37, 99, 235, .15); }

.pp-appt { padding: 1.1rem 1.2rem; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 1rem; align-items: center; position: relative; overflow: hidden;
    background: linear-gradient(135deg, color-mix(in srgb, var(--c, #2563EB) 11%, #fff), #fff 70%); }
.pp-date { width: 78px; text-align: center; background: #fff; border-radius: 18px; padding: .5rem .3rem; box-shadow: 0 6px 16px color-mix(in srgb, var(--c, #2563EB) 20%, transparent); border-top: 5px solid var(--c, #2563EB); }
.pp-date .d1 { font-size: .72rem; font-weight: 800; letter-spacing: .1em; color: var(--c, #2563EB); } .pp-date .d2 { font-size: 2rem; font-weight: 800; line-height: 1.05; } .pp-date .d3 { font-size: .72rem; font-weight: 700; color: var(--pp-muted); letter-spacing: .08em; }
.pp-appt .when { font-size: 1.35rem; font-weight: 800; line-height: 1.2; }
.pp-appt .what { font-weight: 700; color: var(--c, #2563EB); }
.pp-appt .more { color: #475569; font-size: .88rem; display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin-top: .25rem; } .pp-appt .more i { color: var(--c, #2563EB); margin-right: .25rem; }
.pp-appt .art { width: 64px; height: 64px; border-radius: 22px; display: grid; place-items: center; font-size: 1.9rem; color: var(--c, #2563EB); background: #fff; box-shadow: 0 6px 16px color-mix(in srgb, var(--c, #2563EB) 18%, transparent); }
.pp-appt .btns { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .5rem; }
.pp-appt.empty { --c: #94A3B8; grid-template-columns: minmax(0, 1fr); text-align: center; justify-items: center; }

.pp-alerts { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); margin-bottom: 1rem; }
.pp-alert { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .8rem; align-items: center; padding: .9rem 1rem; border-radius: 18px; border: 1px solid transparent; }
.pp-alert .ic { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 1.3rem; background: #fff; }
.pp-alert .t { font-size: .72rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.pp-alert .amt { font-size: 1.1rem; font-weight: 800; line-height: 1.25; } .pp-alert .s { font-size: .82rem; color: #475569; }
.pp-alert .btn-row { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
.pp-alert.danger { background: #FFF1EE; border-color: #FFD5CC; } .pp-alert.danger .ic { color: #DC2626; } .pp-alert.danger .t { color: #B91C1C; }
.pp-alert.warning { background: #FFF8E6; border-color: #FDE7A8; } .pp-alert.warning .ic { color: #D97706; } .pp-alert.warning .t { color: #B45309; }
.pp-alert.info { background: #EFF6FF; border-color: #CFE0FF; } .pp-alert.info .ic { color: #2563EB; } .pp-alert.info .t { color: #1D4ED8; }

.pp-stats { display: grid; gap: .85rem; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 1rem; }
.pp-stat { display: flex; flex-direction: column; gap: .15rem; padding: 1rem 1.1rem; border-radius: 20px; background: color-mix(in srgb, var(--c) 10%, #fff); border: 1px solid color-mix(in srgb, var(--c) 18%, #fff); text-decoration: none; color: inherit; transition: transform .2s, box-shadow .2s; }
a.pp-stat:hover { transform: translateY(-3px); box-shadow: 0 12px 26px color-mix(in srgb, var(--c) 20%, transparent); color: inherit; }
.pp-stat .ic { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; background: #fff; color: var(--c); font-size: 1.25rem; margin-bottom: .45rem; box-shadow: 0 4px 12px color-mix(in srgb, var(--c) 18%, transparent); }
.pp-stat .k { font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: #475569; font-weight: 700; }
.pp-stat .v { font-size: 1.45rem; font-weight: 800; line-height: 1.2; } .pp-stat .v.sm { font-size: 1.05rem; line-height: 1.3; }
.pp-stat .h { font-size: .8rem; color: var(--pp-muted); }

.pp-actions { display: grid; gap: .75rem; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.pp-act { display: flex; flex-direction: column; align-items: center; gap: .55rem; padding: 1rem .5rem; border-radius: 20px; text-align: center; background: color-mix(in srgb, var(--c) 14%, #fff); color: #172033; font-weight: 700; font-size: .86rem; text-decoration: none; transition: transform .2s, box-shadow .2s; }
.pp-act:hover { transform: translateY(-3px); box-shadow: 0 12px 24px color-mix(in srgb, var(--c) 28%, transparent); color: #172033; }
.pp-act .ic { width: 52px; height: 52px; border-radius: 18px; display: grid; place-items: center; background: #fff; color: color-mix(in srgb, var(--c) 85%, #172033); font-size: 1.5rem; box-shadow: 0 6px 14px color-mix(in srgb, var(--c) 24%, transparent); }

.pp-two { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.pp-prog { padding: 1.1rem 1.2rem; display: grid; gap: .8rem; }
.pp-update { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .8rem; padding: .85rem; background: #F0FDF4; border-radius: 16px; }
.pp-update .ic { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; background: #fff; color: #16A34A; font-size: 1.25rem; }
.pp-update .t { font-weight: 750; } .pp-update .s { font-size: .86rem; color: #475569; margin-top: .15rem; }
.pp-programrow { display: flex; align-items: center; gap: .75rem; padding: .55rem .2rem; border-bottom: 1px dashed var(--pp-border); }
.pp-programrow:last-child { border-bottom: 0; }
.pp-programrow .ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 14%, #fff); color: var(--c); font-size: 1.1rem; flex: none; }
.pp-programrow .n { font-weight: 700; } .pp-programrow .m { font-size: .8rem; color: var(--pp-muted); }

.pp-rows { display: grid; gap: .6rem; padding: .9rem; }
.pp-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .8rem; align-items: center; padding: .65rem .75rem; border-radius: 16px; background: #F8FAFF; border: 1px solid #EDF2FB; transition: background .15s, transform .15s; }
.pp-row:hover { background: #EFF5FF; transform: translateX(2px); }
.pp-row .dt { width: 52px; text-align: center; border-radius: 14px; padding: .3rem 0; background: color-mix(in srgb, var(--c) 14%, #fff); color: color-mix(in srgb, var(--c) 80%, #172033); }
.pp-row .dt b { display: block; font-size: 1.15rem; line-height: 1.1; } .pp-row .dt span { font-size: .62rem; font-weight: 800; letter-spacing: .08em; }
.pp-row .n { font-weight: 700; font-size: .92rem; } .pp-row .m { font-size: .8rem; color: var(--pp-muted); }
.pp-row .st { font-size: .72rem; font-weight: 700; padding: .2rem .6rem; border-radius: 999px; white-space: nowrap; }
.st-green { background: #DCFCE7; color: #166534; } .st-blue { background: #DBEAFE; color: #1E40AF; } .st-red { background: #FEE2E2; color: #991B1B; } .st-amber { background: #FEF3C7; color: #92400E; } .st-gray { background: #F1F5F9; color: #475569; }
.pp-timeline { position: relative; display: grid; gap: .6rem; padding: .9rem .9rem .9rem 2.3rem; }
.pp-timeline::before { content: ""; position: absolute; left: 1.45rem; top: 1.4rem; bottom: 1.4rem; width: 2px; background: linear-gradient(#BFDBFE, #DDD6FE); }
.pp-timeline .pp-row::before { content: ""; position: absolute; left: -1.28rem; top: 50%; width: 12px; height: 12px; margin-top: -6px; border-radius: 50%; background: var(--c); border: 3px solid #fff; box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 40%, #fff); }
.pp-timeline .pp-row { position: relative; }
.pp-soft-empty { text-align: center; padding: 1.4rem 1rem; color: var(--pp-muted); display: grid; justify-items: center; gap: .3rem; }
.pp-soft-empty .pp-img { max-width: 120px; border-radius: 50%; --pp-soft: transparent; }

/* ---------- Responsive ---------- */
@media (max-width: 1199.98px) { .pp-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); } .pp-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 991.98px) { .pp-top, .pp-two { grid-template-columns: minmax(0, 1fr); } .pp-hero { grid-template-columns: minmax(0, 1fr) minmax(0, .6fr); } }
@media (max-width: 767.98px) {
    .pp-hero { grid-template-columns: minmax(0, 1fr); padding: 1.35rem 1.2rem; border-radius: 22px; }
    .pp-hero .pp-hero-art { max-width: 240px; justify-self: center; order: 2; }
    .pp-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pp-appt { grid-template-columns: auto minmax(0, 1fr); } .pp-appt .art { display: none; }
    .pp-svc-grid, .pp-req-grid { grid-template-columns: minmax(0, 1fr); }
    .pp-stats { gap: .6rem; } .pp-stat { padding: .8rem; } .pp-stat .v { font-size: 1.2rem; }
}
@media (max-width: 419.98px) { .pp-date { width: 66px; } .pp-date .d2 { font-size: 1.7rem; } .pp-appt .when { font-size: 1.15rem; } .pp-search { flex-basis: 100%; max-width: none; } }
@media (prefers-reduced-motion: reduce) { .pp-rise, .pp-star { animation: none !important; } .pp-svc, .pp-svc:hover, .pp-act:hover, a.pp-stat:hover, .pp-btn:hover { transform: none !important; } .pp-svc:hover .pp-img img { transform: none !important; } }

/* ---------- Portal pictures admin ---------- */
.pi-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.pi-card { overflow: hidden; }
.pi-preview { aspect-ratio: 16 / 10; background: #F1F5F9; display: grid; place-items: center; overflow: hidden; }
.pi-preview img { width: 100%; height: 100%; object-fit: cover; }
.pi-none { display: grid; justify-items: center; gap: .3rem; color: #94A3B8; } .pi-none i { font-size: 2rem; }

/* ---------- Sidebar and header refresh (shared by every role) ---------- */
.sidebar-nav { padding: .6rem .7rem 1rem; }
.nav-group-toggle { padding: 1rem .8rem .4rem; letter-spacing: .1em; }
.nav-item { border-radius: 12px; min-height: 42px; margin-bottom: 3px; padding: .55rem .8rem; transition: background .18s, color .18s, transform .18s; }
.nav-item i { width: 1.35rem; font-size: 1.12rem; opacity: .8; transition: opacity .18s, transform .18s; }
a.nav-item:hover { background: #1B2740; transform: translateX(2px); }
a.nav-item:hover i { opacity: 1; }
a.nav-item.active { background: linear-gradient(90deg, color-mix(in srgb, var(--sg-primary) 92%, white), color-mix(in srgb, var(--sg-primary) 70%, #7C3AED)); box-shadow: 0 8px 18px color-mix(in srgb, var(--sg-primary) 32%, transparent); transform: none; }
a.nav-item.active::before { content: ""; position: absolute; left: -.7rem; top: 22%; bottom: 22%; width: 4px; border-radius: 0 4px 4px 0; background: #93C5FD; }
.app-shell.collapsed a.nav-item.active::before { left: -.45rem; }
.sidebar-footer { padding: .7rem; }
.sidebar-footer button { border-radius: 12px; }
.app-header { backdrop-filter: saturate(1.4) blur(8px); }
@media (prefers-reduced-motion: reduce) { a.nav-item:hover { transform: none; } }
.icon-btn .dot { background: linear-gradient(135deg, #F43F5E, #E11D48); box-shadow: 0 2px 6px rgba(225, 29, 72, .4); }
.user-btn { border-radius: 999px; transition: background .15s; } .user-btn:hover { background: #EEF2FF; }
.user-btn .avatar { background: linear-gradient(135deg, #DBEAFE, #EDE9FE); color: #1D4ED8; }
.menu-panel { border-radius: 16px; animation: pp-rise .18s ease both; }
.menu-item { border-radius: 10px; transition: background .12s; }
.pp-appt { align-content: center; }

/* =========================================================
   Design system, second generation: the look of the approved family dashboard and Services pages,
   applied through the shared tokens and components so every page of every role inherits it.
   Page markup is untouched; roles are tuned with [data-role] on the shell.
   ========================================================= */
:root {
    --sg-bg: #F7FAFF;
    --sg-text: #172033;
    --sg-text-muted: #64748B;
    --sg-border: #E2E8F0;
    --sg-border-strong: #D3DCEA;
    --sg-radius: 20px;
    --sg-radius-sm: 12px;
    --sg-shadow: 0 1px 2px rgba(23, 32, 51, .04), 0 8px 24px rgba(37, 99, 235, .05);
    --sg-shadow-hover: 0 2px 4px rgba(23, 32, 51, .05), 0 16px 34px rgba(37, 99, 235, .11);
    --sg-shadow-lg: 0 24px 60px rgba(23, 32, 51, .22);
    --sg-primary-ring: color-mix(in srgb, var(--sg-primary) 24%, transparent);
    /* Pastel palette shared by headers, tiles and illustrations */
    --pa-sky: #38BDF8; --pa-lav: #A78BFA; --pa-pink: #F9A8D4; --pa-mint: #6EE7B7; --pa-peach: #FDBA74; --pa-sun: #FDE68A;
}
html, body { background: radial-gradient(900px 420px at 92% -120px, rgba(191, 219, 254, .55), transparent), radial-gradient(760px 340px at -8% 8%, rgba(233, 213, 255, .35), transparent), var(--sg-bg); background-attachment: fixed; color: var(--sg-text); }
h1, h2, h3 { color: var(--sg-text); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--sg-primary) 45%, white); outline-offset: 2px; border-radius: 8px; }

/* ----- Page header: a soft coloured band with the page's menu icon ----- */
.page-header { position: relative; overflow: hidden; align-items: center; padding: 1.15rem 1.4rem; margin-bottom: 1.4rem; border-radius: 24px; border: 1px solid rgba(255, 255, 255, .7);
    background: linear-gradient(120deg, var(--ph-a, #E6EEFF) 0%, var(--ph-b, #EFEAFF) 60%, var(--ph-c, #FBEFF7) 100%); box-shadow: var(--sg-shadow); }
.page-header::before { content: ""; position: absolute; right: -40px; top: -60px; width: 190px; height: 190px; border-radius: 50%; background: rgba(255, 255, 255, .5); pointer-events: none; }
.page-header::after { content: ""; position: absolute; left: 38%; bottom: -70px; width: 120px; height: 120px; border-radius: 42% 58% 55% 45%; background: rgba(255, 255, 255, .32); pointer-events: none; }
.page-header > * { position: relative; z-index: 1; }
/* The band clips its decorative circles, which would also clip an open menu (Quick Actions): while one is open, let it spill out. */
.page-header:has(.menu-panel) { overflow: visible; }
.page-header:has(.menu-panel)::before, .page-header:has(.menu-panel)::after { display: none; }
.ph-main { display: flex; align-items: center; gap: .95rem; min-width: 0; }
.ph-icon { flex: none; width: 52px; height: 52px; border-radius: 17px; display: grid; place-items: center; font-size: 1.5rem; background: #fff; color: var(--ph-i, #2563EB); box-shadow: 0 8px 18px color-mix(in srgb, var(--ph-i, #2563EB) 22%, transparent); }
.page-header h1 { font-size: clamp(1.3rem, 2.4vw, 1.75rem); font-weight: 800; }
.page-header .subtitle { color: #475569; max-width: 52rem; }
.ph-tone-0 { --ph-a: #E3EDFF; --ph-b: #ECE9FF; --ph-c: #FAEFF8; --ph-i: #2563EB; }
.ph-tone-1 { --ph-a: #EEE8FF; --ph-b: #F5E9FF; --ph-c: #FFEAF4; --ph-i: #7C3AED; }
.ph-tone-2 { --ph-a: #DDF7EC; --ph-b: #E4F4FF; --ph-c: #EEF1FF; --ph-i: #0F9F6E; }
.ph-tone-3 { --ph-a: #FFEBDD; --ph-b: #FFF1DC; --ph-c: #FFEAF1; --ph-i: #EA7B1F; }
.ph-tone-4 { --ph-a: #FFE6F1; --ph-b: #F6E8FF; --ph-c: #E7EEFF; --ph-i: #DB2777; }
.ph-tone-5 { --ph-a: #DDF3FF; --ph-b: #E1F1FF; --ph-c: #FFF6D8; --ph-i: #0891B2; }
[data-role="admin"] .page-header, [data-role="accounting"] .page-header, [data-role="systemadministrator"] .page-header { padding: .95rem 1.25rem; border-radius: 20px; }
[data-role="admin"] .ph-icon, [data-role="accounting"] .ph-icon { width: 46px; height: 46px; border-radius: 15px; font-size: 1.3rem; }
[data-role="parent"] .page-header { padding: 1.4rem 1.6rem; border-radius: 28px; }
[data-role="parent"] .page-header::before { width: 230px; height: 230px; right: -50px; top: -80px; background: rgba(253, 186, 116, .22); }
@media (max-width: 767.98px) { .page-header { padding: 1rem; border-radius: 20px; } .ph-icon { width: 42px; height: 42px; font-size: 1.2rem; border-radius: 14px; } [data-role="parent"] .page-header { padding: 1.1rem; border-radius: 22px; } }
@media print { .page-header { background: none !important; box-shadow: none !important; border: 0 !important; padding: 0 !important; } .page-header::before, .page-header::after, .ph-icon { display: none !important; } }

/* ----- Cards, tiles and lists ----- */
.sg-card { border-color: #E6ECF6; }
a.sg-card:hover, .sg-card.interactive:hover { transform: translateY(-2px); border-color: #CFE0FF; }
.sg-card-header { border-bottom-color: #EDF1F8; background: linear-gradient(180deg, #FCFDFF, #fff); border-radius: var(--sg-radius) var(--sg-radius) 0 0; }
.sg-card-header h2 { font-weight: 750; }
.stat-card { border-radius: var(--sg-radius); background: linear-gradient(155deg, var(--accent-tint, #fff) 0%, #fff 72%); }
.stat-card .icon { width: 46px; height: 46px; border-radius: 16px; background: #fff; box-shadow: 0 6px 14px color-mix(in srgb, var(--accent, #2563EB) 20%, transparent); }
.stat-card .value { font-weight: 800; }
a.stat-card { transition: transform .2s, box-shadow .2s, border-color .2s; } a.stat-card:hover { transform: translateY(-3px); box-shadow: var(--sg-shadow-hover); }
.list-plain li:hover { background: #F7FAFF; }
.row-list li:hover { background: #F7FAFF; }
.kpi-grid.dense .stat-card { border-radius: 16px; }

/* ----- Buttons ----- */
.btn-sg { border-radius: 999px; font-weight: 650; padding-left: 1.05rem; padding-right: 1.05rem; border-color: #D8E0EE; transition: background .18s, color .18s, border-color .18s, transform .18s, box-shadow .18s; }
.btn-sg:hover { background: #F1F6FF; border-color: #BFD3F7; color: #1D4ED8; transform: translateY(-1px); }
.btn-sg.primary { background: linear-gradient(135deg, var(--sg-primary), color-mix(in srgb, var(--sg-primary) 72%, #7C3AED)); border-color: transparent; box-shadow: 0 8px 18px color-mix(in srgb, var(--sg-primary) 28%, transparent); }
.btn-sg.primary:hover { background: linear-gradient(135deg, var(--sg-primary-hover), color-mix(in srgb, var(--sg-primary-hover) 72%, #7C3AED)); color: #fff; transform: translateY(-1px); }
.btn-sg.success { box-shadow: 0 8px 18px rgba(22, 163, 74, .22); } .btn-sg.danger { box-shadow: 0 8px 18px rgba(220, 38, 38, .2); }
.btn-sg.sm { border-radius: 999px; } .btn-sg.lg { border-radius: 999px; }
.btn-sg.ghost:hover { background: #EEF4FF; }
.icon-btn { border-radius: 14px; } .icon-btn:hover { background: #EAF1FF; color: #1D4ED8; }
.btn-link-sg { font-weight: 650; }

/* ----- Forms ----- */
.input-sg, .select-sg { border-radius: 14px; border-color: var(--sg-border-strong); background: #fff; transition: border-color .15s, box-shadow .15s, background .15s; }
.input-sg:hover, .select-sg:hover { border-color: #A8B8D2; background: #FCFDFF; }
.input-sg:focus, .select-sg:focus { box-shadow: 0 0 0 4px var(--sg-primary-ring); }
.form-label-sg { color: #243049; font-weight: 650; }
.form-check-input { border-radius: 6px; } .form-check-input[type=radio] { border-radius: 50%; }
.form-section, .fs-card { border-radius: var(--sg-radius); }

/* ----- Tables ----- */
.sg-table th { background: #F2F7FF; color: #51617D; border-bottom: 1px solid #E2EAF7; }
.sg-table td { border-bottom-color: #EEF2F9; }
.sg-table tbody tr:hover { background: #F6FAFF; }
.table-wrap { scrollbar-width: thin; }
.cell-person .avatar { box-shadow: 0 0 0 2px #fff, 0 2px 6px rgba(37, 99, 235, .18); }

/* ----- Badges, alerts, segmented ----- */
.badge-sg { font-weight: 700; padding: 5px 12px; }
.alert-sg { border-radius: 16px; }
.segmented { background: #E9F0FC; border-radius: 999px; } .segmented button { border-radius: 999px; } .segmented button.on { color: #1D4ED8; box-shadow: 0 2px 6px rgba(37, 99, 235, .18); }
.avatar { background: linear-gradient(135deg, #DBEAFE, #EDE9FE); color: #1D4ED8; }

/* ----- Dialogs ----- */
.modal-backdrop-sg { background: rgba(23, 32, 51, .48); backdrop-filter: blur(4px); }
.modal-sg { border-radius: 26px; box-shadow: var(--sg-shadow-lg); animation: pp-rise .2s ease both; }
.modal-sg header { background: linear-gradient(120deg, #EEF4FF, #F5F0FF 60%, #FFF0F7); border-bottom-color: #E6ECF8; border-radius: 26px 26px 0 0; }
.modal-sg header h2 { font-weight: 800; } .modal-sg footer { background: #FBFCFF; border-radius: 0 0 26px 26px; }
@media (max-width: 767.98px) { .modal-sg { border-radius: 22px; } }

/* ----- Empty and loading states ----- */
.empty-state { padding: 2.6rem 1.25rem; }
.empty-state .icon { width: 76px; height: 76px; border-radius: 50%; font-size: 1.9rem; margin-bottom: 1rem; position: relative; background: radial-gradient(circle at 30% 25%, #fff, #E4EEFF 70%); color: var(--sg-primary); box-shadow: 0 10px 24px rgba(37, 99, 235, .14); }
.empty-state .icon::before { content: ""; position: absolute; top: -4px; right: -2px; width: 14px; height: 14px; border-radius: 50%; background: var(--pa-sun); }
.empty-state .icon::after { content: ""; position: absolute; bottom: 2px; left: -8px; width: 10px; height: 10px; border-radius: 50%; background: var(--pa-pink); }
.empty-state .title { font-size: 1.05rem; font-weight: 750; }
.skeleton { background: linear-gradient(90deg, #EAF0FB 25%, #F6F9FF 37%, #EAF0FB 63%); background-size: 400% 100%; border-radius: 12px; }
.sk-stat { border-radius: var(--sg-radius); }

/* ----- Calendar, agenda and schedule blocks ----- */
.agenda-card { border-radius: 20px; box-shadow: var(--sg-shadow); }
.board-wrap { border-radius: 20px; box-shadow: var(--sg-shadow); }
.board-col .blk { border-radius: 10px; }

/* ----- Sign-in and account pages ----- */
.auth-page { position: relative; overflow: hidden; background: radial-gradient(900px 420px at 15% -10%, #DBEAFE, transparent), radial-gradient(800px 420px at 95% 100%, #FDE8F3, transparent), radial-gradient(600px 300px at 90% 0%, #EDE9FE, transparent), var(--sg-bg); }
.auth-page::before, .auth-page::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none; }
.auth-page::before { width: 340px; height: 340px; left: -90px; bottom: -120px; background: rgba(110, 231, 183, .28); }
.auth-page::after { width: 220px; height: 220px; right: -60px; top: 12%; background: rgba(253, 186, 116, .28); }
.auth-card { position: relative; z-index: 1; border-radius: 28px; border-color: rgba(255, 255, 255, .8); box-shadow: 0 24px 60px rgba(37, 99, 235, .16); overflow: hidden; }
.auth-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 6px; background: linear-gradient(90deg, var(--pa-sky), var(--pa-lav), var(--pa-pink), var(--pa-peach)); }
.auth-art { width: 100%; max-width: 360px; margin: 0 auto 1rem; position: relative; z-index: 1; }
.auth-art svg { width: 100%; height: auto; display: block; }
.auth-brand h1 { font-weight: 800; }
.auth-powered { position: relative; z-index: 1; }

/* ----- Role tuning ----- */
[data-role="parent"] .sg-card { border-radius: 22px; }
[data-role="parent"] .app-content { max-width: 1320px; }
[data-role="admin"] .app-content, [data-role="accounting"] .app-content { max-width: 1560px; }

@media (prefers-reduced-motion: reduce) { a.sg-card:hover, a.stat-card:hover, .btn-sg:hover { transform: none; } .modal-sg { animation: none; } html, body { background-attachment: scroll; } }
.pp-actions.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1199.98px) { .pp-actions.five { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 767.98px) { .pp-actions.five { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Sign-in page: children's crayon scene as the background (wwwroot/img/login-bg.jpg) */
.auth-page { background: #A9E4F5 url("/img/login-bg.jpg") center bottom / cover no-repeat; min-height: 100dvh; }
.auth-page::before, .auth-page::after { display: none; }
.auth-card { background: rgba(255, 255, 255, .94); backdrop-filter: blur(4px); }
.auth-powered { color: #1E3A5F; text-shadow: 0 1px 0 rgba(255, 255, 255, .7); }
@media (max-aspect-ratio: 1/1) { .auth-page { background-size: 100% auto; background-position: center bottom; padding-bottom: 22vw; } }

/* Announcement board and Word of the Day: the very top of the family and therapist home pages */
.ab { display: grid; gap: .85rem; margin-bottom: 1.1rem; }
.ab-board { background: linear-gradient(135deg, #FFF7E0, #FDE8F3 55%, #E6F0FF); border: 1px solid rgba(255, 255, 255, .9); border-radius: 22px; padding: 1rem 1.15rem; box-shadow: 0 10px 30px rgba(37, 99, 235, .1); }
.ab-head { font-size: .95rem; font-weight: 800; margin: 0 0 .6rem; color: #7C3AED; display: flex; align-items: center; gap: .45rem; }
.ab-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.ab-item { display: flex; gap: .75rem; align-items: flex-start; background: rgba(255, 255, 255, .78); border-radius: 16px; padding: .7rem .85rem; }
.ab-item strong { display: block; color: var(--sg-text); }
.ab-item p { margin: .15rem 0 0; color: var(--sg-text-muted); font-size: .9rem; overflow-wrap: anywhere; }
.ab-icon { flex: none; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 1.15rem; background: #E0E7FF; color: #4F46E5; }
.ab-greeting .ab-icon { background: #FEF3C7; color: #D97706; }
.ab-birthday .ab-icon { background: #FCE7F3; color: #DB2777; }
.ab-event .ab-icon { background: #DCFCE7; color: #16A34A; }
.ab-reminder .ab-icon { background: #FFEDD5; color: #EA580C; }
.ab-word { margin: 0; background: linear-gradient(135deg, #E0F2FE, #EDE9FE); border-radius: 22px; padding: 1rem 1.25rem; text-align: center; border: 1px solid rgba(255, 255, 255, .9); box-shadow: 0 10px 30px rgba(124, 58, 237, .1); }
.ab-word-label { font-size: .75rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #6D28D9; }
.ab-word blockquote { margin: .35rem auto 0; max-width: 46rem; font-size: 1.15rem; font-weight: 700; line-height: 1.45; color: var(--sg-text); overflow-wrap: anywhere; }
.ab-word cite { display: block; margin-top: .35rem; font-size: .85rem; color: var(--sg-text-muted); font-style: normal; }
.ab-word cite::before { content: "- "; }

/* Weekly time picker (parent services) */
.wt-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .6rem; }
.wt-col { background: #F8FAFF; border: 1px solid var(--sg-border); border-radius: 16px; padding: .5rem; display: flex; flex-direction: column; gap: .4rem; min-width: 0; }
.wt-day { font-weight: 800; font-size: .8rem; text-align: center; color: #4338CA; }
.wt-none { font-size: .75rem; color: var(--sg-text-muted); text-align: center; padding: .4rem 0; }
.wt-slot { text-align: left; border: 1px solid var(--sg-border); background: #fff; border-radius: 12px; padding: .4rem .55rem; display: grid; gap: .1rem; cursor: pointer; min-height: 44px; }
.wt-slot:hover:not(:disabled) { border-color: #6366F1; }
.wt-slot.on { background: linear-gradient(135deg, #6366F1, #8B5CF6); color: #fff; border-color: transparent; }
.wt-slot:disabled { opacity: .45; cursor: not-allowed; }
.wt-slot .t { font-weight: 800; font-size: .85rem; }
.wt-slot .n { font-size: .75rem; display: flex; align-items: center; gap: .3rem; overflow-wrap: anywhere; }
.wt-slot .f { font-size: .68rem; opacity: .8; }
.wt-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; }
.wt-picked { margin-top: .75rem; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.wt-chip { background: #EEF2FF; color: #3730A3; border-radius: 999px; padding: .25rem .4rem .25rem .75rem; font-size: .8rem; font-weight: 700; display: inline-flex; align-items: center; gap: .25rem; }
.wt-chip button { border: 0; background: transparent; color: inherit; border-radius: 50%; width: 24px; height: 24px; display: grid; place-items: center; cursor: pointer; }
.pp-picks { list-style: none; margin: .4rem 0 0; padding: 0; display: grid; gap: .25rem; font-size: .85rem; }
.pp-picks .approved { color: #15803D; } .pp-picks .declined { color: #B91C1C; } .pp-picks .pending { color: #B45309; }
@media (max-width: 1100px) { .wt-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .wt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* DepEd developmental assessment form pictures */
.df-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .85rem; margin-bottom: 1rem; }
.df-item { margin: 0; border: 1px solid var(--sg-border); border-radius: 16px; overflow: hidden; background: #fff; display: flex; flex-direction: column; }
.df-item img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; background: #F1F5F9; }
.df-item figcaption { padding: .6rem .75rem; display: grid; gap: .15rem; font-size: .85rem; }
.df-upload { border-top: 1px dashed var(--sg-border); padding-top: .85rem; }
