/* =============================================
   LA TARASCA — PORTAL FAMILIAS
   Mobile-First Design System
   ============================================= */

/* ===== 1. DESIGN TOKENS ===== */
:root {
    /* --- App Palette --- */
    --taupe:       #b9b4a1;
    --taupe-light: #d1cdc0;
    --taupe-pale:  #eae8e2;
    --gray:        #6d7170;
    --gray-light:  #8f9290;
    --gray-dark:   #4a4d4c;
    --teal:        #4e97b7;
    --teal-light:  #7bb8cc;
    --teal-dark:   #3a7a99;
    --teal-pale:   #e4f0f5;
    --amber:       #dc9953;
    --amber-light: #e8b474;
    --amber-pale:  #faf0e0;
    --white:       #ffffff;
    --off-white:   #f7f6f3;
    --surface:     #ffffff;

    /* --- Domain Colors (FEDC pastels) --- */
    --domain-regulacion:       #ea9999;
    --domain-regulacion-dark:  #d46b6b;
    --domain-interaccion:      #b6d7a8;
    --domain-interaccion-dark: #7ab56a;
    --domain-comunicacion:     #a4c2f4;
    --domain-comunicacion-dark:#6a9de0;
    --domain-juego:            #ffe599;
    --domain-juego-dark:       #dbb94d;
    --domain-pensamiento:      #f9cb9c;
    --domain-pensamiento-dark: #e0a060;

    /* --- Semantic --- */
    --error:       #d9534f;
    --error-bg:    #fdf2f2;
    --success:     #4e97b7;
    --success-bg:  #e4f0f5;
    --info:        #6d7170;
    --info-bg:     #f0f0ef;

    /* --- Typography --- */
    --font-display: 'Poppins', system-ui, sans-serif;
    --font-body:    'Nunito', system-ui, sans-serif;

    /* --- Spacing --- */
    --space-xs:  0.25rem;
    --space-sm:  0.5rem;
    --space-md:  1rem;
    --space-lg:  1.5rem;
    --space-xl:  2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;

    /* --- Shadows (neutral) --- */
    --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.10);

    /* --- Radii (rounder) --- */
    --radius-sm:   8px;
    --radius-md:   12px;
    --radius-lg:   20px;
    --radius-xl:   28px;
    --radius-full: 9999px;

    /* --- Transitions --- */
    --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --duration-fast: 150ms;
    --duration-base: 250ms;
    --duration-slow: 400ms;

    /* --- Layout --- */
    --top-nav-height: 56px;
    --bottom-nav-height: 64px;
}

/* ===== 2. PICO OVERRIDES ===== */
:root {
    --pico-font-family: var(--font-body);
    --pico-font-size: 100%;
    --pico-line-height: 1.6;
    --pico-primary: var(--teal);
    --pico-primary-hover: var(--teal-dark);
    --pico-primary-focus: rgba(78, 151, 183, 0.15);
    --pico-primary-inverse: var(--white);
    --pico-background-color: var(--off-white);
    --pico-color: var(--gray-dark);
    --pico-border-radius: var(--radius-md);
    --pico-card-background-color: var(--white);
    --pico-card-border-color: transparent;
    --pico-card-box-shadow: var(--shadow-sm);
    --pico-form-element-border-color: var(--taupe-light);
    --pico-form-element-focus-color: var(--teal);
    --pico-muted-color: var(--gray-light);
    --pico-muted-border-color: var(--taupe-light);
    --pico-secondary: var(--amber);
    --pico-secondary-hover: var(--amber-light);
    --pico-del-color: var(--error);
    --pico-ins-color: var(--success);
}

/* ===== 3. BASE ELEMENTS ===== */
html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background-color: var(--off-white);
    color: var(--gray-dark);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body::before {
    content: '';
    display: block;
    height: 3px;
    background: linear-gradient(90deg, var(--teal) 0%, var(--amber) 50%, var(--teal) 100%);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--gray-dark);
    letter-spacing: -0.01em;
}

h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--teal);
    margin-bottom: var(--space-sm);
}

h2 {
    font-size: 1.2rem;
    color: var(--gray-dark);
    border-bottom: 2px solid var(--amber);
    padding-bottom: var(--space-sm);
    margin-top: var(--space-2xl);
    margin-bottom: var(--space-lg);
}

h3 {
    font-size: 1.15rem;
    color: var(--teal);
}

a {
    color: var(--teal);
    text-decoration-color: var(--amber);
    text-underline-offset: 3px;
    transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
    color: var(--amber);
}

hgroup {
    margin-bottom: var(--space-lg);
}

hgroup h1 {
    margin-bottom: 0;
}

hgroup p {
    color: var(--gray-light);
    font-size: 0.95rem;
}

figure {
    margin: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table, .data-value {
    font-feature-settings: 'tnum' 1;
}

/* ===== 4. LAYOUT ===== */
main.page-content {
    padding-top: var(--space-lg);
    padding-bottom: calc(var(--space-3xl) + var(--bottom-nav-height));
    animation: fadeInUp var(--duration-slow) var(--ease-out);
}

/* ===== 5. TOP NAVIGATION ===== */
nav.app-nav {
    background: var(--teal);
    padding: 0.5rem 1rem;
    margin-bottom: 0;
    position: sticky;
    top: 3px;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(78, 151, 183, 0.25);
}

nav.app-nav ul {
    margin: 0;
    padding: 0;
    align-items: center;
    gap: 0.35rem;
}

nav.app-nav a,
nav.app-nav .nav-brand {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
}

nav.app-nav a {
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.35rem 0.6rem;
    border-radius: var(--radius-sm);
    transition: all var(--duration-fast) var(--ease-out);
    white-space: nowrap;
}

nav.app-nav a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
}

nav.app-nav .nav-brand {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    padding: 0;
}

nav.app-nav .nav-subtitle {
    display: none;
    font-family: var(--font-body);
    font-style: normal;
    font-size: 0.68rem;
    font-weight: 400;
    color: var(--amber-light);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    line-height: 1;
    margin-top: -1px;
}

nav.app-nav .nav-username {
    color: #fff;
    font-weight: 600;
    opacity: 0.85;
}

nav.app-nav a[role="button"] {
    color: #fff;
    border: 1.5px solid rgba(255, 255, 255, 0.4);
    padding: 0.4rem 1.1rem;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    letter-spacing: 0.03em;
    margin-left: 0.25rem;
}

nav.app-nav a[role="button"]:hover {
    border-color: #fff;
    background: rgba(255, 255, 255, 0.15);
}

nav.app-nav button.outline {
    --pico-color: #fff;
    --pico-border-color: rgba(255, 255, 255, 0.4);
    --pico-background-color: transparent;
    padding: 0.4rem 1.1rem;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    letter-spacing: 0.03em;
}

nav.app-nav button.outline:hover {
    --pico-color: #fff;
    --pico-border-color: #fff;
    --pico-background-color: rgba(255, 255, 255, 0.15);
}

/* Hide top nav for parent on mobile */
@media (max-width: 767px) {
    .is-parent nav.app-nav {
        display: none;
    }
    .is-parent main.page-content {
        padding-top: var(--space-md);
    }
}

/* ===== 5B. BOTTOM NAVIGATION (Parent Mobile) ===== */
.bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--white);
    border-top: 1px solid var(--taupe-pale);
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.06);
    height: var(--bottom-nav-height);
    padding: 0 var(--space-md);
    padding-bottom: max(0px, env(safe-area-inset-bottom, 0px));
}

.bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--gray-light);
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 500;
    padding: var(--space-sm) 0;
    transition: color var(--duration-fast) var(--ease-out);
    min-height: 44px;
    min-width: 44px;
}

.bottom-nav a svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.5;
}

.bottom-nav a[aria-current="page"],
.bottom-nav a.active {
    color: var(--teal);
    font-weight: 600;
}

.bottom-nav a:hover {
    color: var(--teal);
}

/* ===== 6. CARDS ===== */
article {
    background: var(--white);
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--duration-base) var(--ease-out),
                transform var(--duration-base) var(--ease-out);
    overflow: hidden;
}

article:hover {
    box-shadow: var(--shadow-md);
}

article > header {
    background: var(--taupe-pale);
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

article > header strong {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--teal);
}

article > header small {
    color: var(--gray-light);
    font-size: 0.8rem;
    margin-left: var(--space-sm);
}

/* ===== 7. BUTTONS ===== */
[role="button"],
button,
input[type="submit"] {
    font-family: var(--font-body);
    font-weight: 600;
    border-radius: var(--radius-lg);
    transition: all var(--duration-fast) var(--ease-out);
    letter-spacing: 0.01em;
    min-height: 44px;
}

[role="button"].contrast,
button.contrast,
input[type="submit"].contrast {
    background: var(--teal);
    border-color: var(--teal);
    color: #fff;
}

[role="button"].contrast:hover,
button.contrast:hover,
input[type="submit"].contrast:hover {
    background: var(--teal-dark);
    border-color: var(--teal-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

[role="button"].secondary,
button.secondary {
    background: var(--amber);
    border-color: var(--amber);
    color: #fff;
}

[role="button"].secondary:hover,
button.secondary:hover {
    background: var(--amber-light);
    border-color: var(--amber-light);
    transform: translateY(-1px);
}

[role="button"].outline,
button.outline {
    color: var(--teal);
    border: 2px solid var(--taupe-light);
    background: transparent;
}

[role="button"].outline:hover,
button.outline:hover {
    border-color: var(--teal);
    background: var(--teal-pale);
    color: var(--teal);
}

[role="button"].outline.secondary,
button.outline.secondary {
    color: var(--gray);
    border-color: var(--taupe-light);
}

[role="button"].outline.secondary:hover,
button.outline.secondary:hover {
    border-color: var(--gray);
    background: var(--taupe-pale);
    color: var(--gray);
}

/* ===== 8. FORMS ===== */
label {
    font-weight: 500;
    color: var(--gray);
    font-size: 0.9rem;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]),
select,
textarea {
    border: 1.5px solid var(--taupe-light);
    border-radius: var(--radius-md) !important;
    background: #fff;
    transition: border-color var(--duration-fast) var(--ease-out),
                box-shadow var(--duration-fast) var(--ease-out);
    font-family: var(--font-body);
    min-height: 44px;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):focus,
select:focus,
textarea:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(78, 151, 183, 0.1);
    outline: none;
}

input::placeholder,
textarea::placeholder {
    color: var(--gray-light);
}

fieldset {
    border: none;
    padding: var(--space-sm) 0;
    margin: 0;
}

fieldset legend {
    font-size: 0.92rem;
    color: var(--gray);
    margin-bottom: var(--space-xs);
    line-height: 1.4;
}

/* ===== 9. TABLES ===== */
table {
    border-collapse: separate;
    border-spacing: 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-xs);
}

thead {
    background: var(--teal);
}

thead th {
    color: #fff;
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.85rem 1rem;
    border: none;
    border-color: var(--teal-dark);
}

tbody td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    font-size: 0.92rem;
    vertical-align: middle;
}

tbody tr {
    transition: background var(--duration-fast) var(--ease-out);
}

tbody tr:hover {
    background: rgba(220, 153, 83, 0.05);
}

tbody tr:last-child td {
    border-bottom: none;
}

td form { display: inline; }
td button { padding: 0.3rem 0.65rem; font-size: 0.8rem; }
td details { display: inline-block; }
td summary { font-size: 0.8rem; color: var(--gray); font-weight: 500; cursor: pointer; }

td details[open] {
    padding: var(--space-sm);
    background: var(--teal-pale);
    border-radius: var(--radius-sm);
    margin-top: var(--space-xs);
}

/* ===== 10. SCORE SYSTEM ===== */
.score-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin: 0.5rem 0;
    flex-wrap: wrap;
}

.score-option,
.score-label {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.score-option input[type="radio"],
.score-label input[type="radio"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.score-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--taupe-light);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--gray);
    background: #fff;
    transition: all var(--duration-fast) var(--ease-out);
    user-select: none;
}

.score-circle:hover {
    border-color: var(--amber);
    color: var(--amber);
    transform: scale(1.08);
}

.score-option input[type="radio"]:checked + .score-circle,
.score-label input[type="radio"]:checked + .score-circle {
    background: var(--amber);
    color: #fff;
    border-color: var(--amber);
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(220, 153, 83, 0.3);
    animation: scoreSelect var(--duration-slow) var(--ease-spring);
}

.score-option input[type="radio"]:focus-visible + .score-circle,
.score-label input[type="radio"]:focus-visible + .score-circle {
    outline: 2px solid var(--teal);
    outline-offset: 3px;
}

/* ===== 11. FLASH MESSAGES ===== */
.flash {
    padding: 0.85rem 1.25rem;
    margin-bottom: var(--space-lg);
    border-radius: var(--radius-md);
    font-size: 0.92rem;
    font-weight: 500;
    animation: fadeInDown var(--duration-base) var(--ease-out);
}

.flash-success {
    background: var(--success-bg);
    border-left: 4px solid var(--success);
    color: var(--teal);
}

.flash-error {
    background: var(--error-bg);
    border-left: 4px solid var(--error);
    color: var(--error);
}

.flash-info {
    background: var(--info-bg);
    border-left: 4px solid var(--info);
    color: var(--gray-dark);
}

/* ===== 12. LOGIN PAGE (Mobile-First) ===== */
body.login-body {
    background: var(--off-white);
    background-image: none;
}

body.login-body::before {
    display: none;
}

.login-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.login-brand {
    background: linear-gradient(160deg, var(--teal) 0%, var(--teal-dark) 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: var(--space-2xl) var(--space-lg);
    min-height: 180px;
    position: relative;
    overflow: hidden;
}

.login-brand::before {
    content: '';
    position: absolute;
    width: 450px;
    height: 450px;
    border-radius: 50%;
    border: 1px solid rgba(220, 153, 83, 0.12);
    top: -120px;
    right: -120px;
}

.login-brand::after {
    content: '';
    position: absolute;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    border: 1px solid rgba(220, 153, 83, 0.08);
    bottom: -60px;
    left: -60px;
}

.login-brand-text {
    text-align: center;
    z-index: 1;
}

.login-brand-title {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.1;
    margin: 0;
}

.login-brand-subtitle {
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 400;
    color: var(--amber-light);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-top: var(--space-sm);
}

.login-brand-tagline {
    display: none;
    font-family: var(--font-body);
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.45);
    margin-top: var(--space-2xl);
    max-width: 280px;
    line-height: 1.6;
}

.login-form-side {
    background: var(--off-white);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: var(--space-xl) var(--space-lg);
    flex: 1;
}

.login-card {
    max-width: 380px;
    width: 100%;
    border: none;
    box-shadow: none;
    background: transparent;
}

.login-card header {
    background: transparent;
    border: none;
    text-align: center;
    padding: 0 0 var(--space-xl) 0;
}

.login-card h2 {
    font-family: var(--font-display);
    border: none;
    margin: 0;
    font-size: 1.5rem;
    color: var(--teal);
}

.login-card small {
    color: var(--gray-light);
    font-size: 0.85rem;
}

/* ===== 13. PARENT PORTAL (Mobile-First) ===== */
.parent-welcome {
    text-align: center;
    padding: var(--space-lg) 0 var(--space-xl);
}

.parent-welcome h1 {
    font-size: 1.6rem;
}

.welcome-subtitle {
    color: var(--gray-light);
    font-size: 1rem;
    margin-top: var(--space-xs);
}

.children-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-md);
    max-width: 900px;
    margin: 0 auto;
}

.child-card {
    text-align: center;
    padding: var(--space-xl) var(--space-lg) var(--space-lg);
    cursor: default;
}

.child-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.child-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-md);
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.child-card h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--gray-dark);
}

.child-group {
    color: var(--gray-light);
    font-size: 0.85rem;
    margin: var(--space-xs) 0 var(--space-lg);
}

.child-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.child-actions a {
    text-decoration: none;
    font-size: 0.88rem;
    padding: 0.65rem 1.25rem;
}

.child-session-summary {
    display: flex;
    justify-content: center;
    gap: var(--space-xl);
    margin: var(--space-md) 0;
    padding: var(--space-sm) 0;
}

.session-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--teal);
    line-height: 1.2;
}

.stat-value small {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--gray-light);
}

.stat-positive { color: #4caf50 !important; }
.stat-negative { color: #e05252 !important; }

.stat-score-range {
    font-size: 0.78rem;
    color: var(--gray);
    font-weight: 500;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--gray-light);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.child-last-session {
    font-size: 0.82rem;
    color: var(--gray-light);
    margin: 0 0 var(--space-md);
}

.child-no-sessions {
    margin: var(--space-md) 0;
    font-style: italic;
}

/* ===== PROFILE PAGE ===== */
.profile-page {
    max-width: 480px;
    margin: 0 auto;
    padding: var(--space-md) 0 var(--space-2xl);
}

.profile-card {
    margin-bottom: var(--space-md);
    padding: var(--space-lg);
}

.profile-header {
    text-align: center;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--teal);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-md);
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.profile-header h2 {
    margin: 0;
    color: var(--gray-dark);
    font-size: 1.4rem;
    border: none;
}

.profile-email {
    color: var(--gray);
    font-size: 0.9rem;
    margin: var(--space-xs) 0 0;
}

.profile-since {
    color: var(--gray-light);
    font-size: 0.82rem;
    margin: var(--space-xs) 0 0;
}

.profile-section-header {
    background: transparent;
    color: inherit;
    margin: 0 0 var(--space-md);
    padding: 0;
}

.profile-section-header h3 {
    border: none;
    margin: 0;
    font-size: 1.1rem;
    color: var(--teal);
}

.profile-children-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.profile-child-row {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.profile-child-avatar {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
}

.profile-child-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.profile-child-info strong {
    font-size: 0.95rem;
    color: var(--gray-dark);
}

.profile-child-group {
    font-size: 0.82rem;
    color: var(--gray);
}

.profile-child-info small {
    font-size: 0.78rem;
    color: var(--gray-light);
}

.profile-empty {
    color: var(--gray-light);
    font-style: italic;
    font-size: 0.9rem;
}

.profile-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.profile-actions a {
    text-align: center;
    text-decoration: none;
}

/* Page tabs (mobile-first: full width, scrollable) */
.page-tabs {
    display: flex;
    gap: var(--space-xs);
    padding: 4px;
    background: var(--taupe-pale);
    border-radius: var(--radius-full);
    margin-bottom: var(--space-xl);
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.page-tabs a {
    padding: 0.45rem 0.9rem;
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--gray);
    text-decoration: none;
    transition: all var(--duration-fast) var(--ease-out);
    white-space: nowrap;
}

.page-tabs a:hover {
    color: var(--teal);
    background: rgba(255, 255, 255, 0.7);
}

.page-tabs a.active,
.page-tabs a[aria-current="page"] {
    background: var(--white);
    color: var(--teal);
    font-weight: 600;
    box-shadow: var(--shadow-xs);
}

/* Child selector */
.child-selector {
    display: flex;
    gap: var(--space-xs);
    margin-bottom: var(--space-md);
    flex-wrap: wrap;
}

.child-selector a {
    padding: 0.3rem 0.9rem;
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--gray-light);
    text-decoration: none;
    border: 1px solid var(--taupe-light);
    transition: all var(--duration-fast) var(--ease-out);
}

.child-selector a:hover {
    color: var(--teal);
    border-color: var(--teal);
}

.child-selector a[aria-current="page"] {
    background: var(--teal);
    color: #fff;
    border-color: var(--teal);
}

/* Chart intro */
.chart-intro {
    color: var(--gray);
    font-size: 0.95rem;
    line-height: 1.7;
    max-width: 650px;
    margin-bottom: var(--space-xl);
}

/* ===== 14. FACILITATOR (Mobile-First) ===== */
.quick-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-md);
    margin-bottom: var(--space-2xl);
}

.quick-actions a {
    text-decoration: none;
    text-align: center;
    font-size: 0.9rem;
}

/* ===== 15. PROGRESS BAR ===== */
#progress-bar {
    position: sticky;
    top: var(--top-nav-height);
    z-index: 10;
    background: var(--off-white);
    padding: var(--space-sm) 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    margin-bottom: var(--space-md);
}

progress {
    height: 6px;
    border-radius: var(--radius-full);
}

progress::-webkit-progress-bar {
    background: var(--taupe-pale);
    border-radius: var(--radius-full);
}

progress::-webkit-progress-value {
    background: linear-gradient(90deg, var(--teal) 0%, var(--amber) 100%);
    border-radius: var(--radius-full);
    transition: width var(--duration-slow) var(--ease-out);
}

progress::-moz-progress-bar {
    background: linear-gradient(90deg, var(--teal) 0%, var(--amber) 100%);
    border-radius: var(--radius-full);
}

#progress-text {
    font-size: 0.8rem;
    color: var(--gray-light);
    font-weight: 500;
}

/* ===== 16. FOOTER ===== */
footer.app-footer {
    text-align: center;
    padding: var(--space-xl) 0;
    margin-top: var(--space-3xl);
    border-top: 1px solid var(--taupe-light);
    color: var(--gray-light);
    font-size: 0.82rem;
}

/* ===== 17. DOMAIN COLORS ===== */
.domain-regulacion      { color: var(--domain-regulacion-dark); }
.domain-interaccion     { color: var(--domain-interaccion-dark); }
.domain-comunicacion    { color: var(--domain-comunicacion-dark); }
.domain-juego_simbolico { color: var(--domain-juego-dark); }
.domain-pensamiento     { color: var(--domain-pensamiento-dark); }

/* Card headers: teal background + white text (default) */
article > header {
    background: var(--teal);
    color: var(--white);
    border-radius: var(--radius) var(--radius) 0 0;
    margin: calc(var(--pico-block-spacing-vertical) * -1) calc(var(--pico-block-spacing-horizontal) * -1) var(--pico-block-spacing-vertical);
    padding: var(--pico-block-spacing-vertical) var(--pico-block-spacing-horizontal);
}
article > header strong,
article > header h3,
article > header [class*="domain-"] { color: inherit; margin: 0; border: none; }
article > header small { color: rgba(255, 255, 255, 0.8); }

/* Domain-specific headers override teal with their own colors */
article > header.domain-header-regulacion      { background: var(--domain-regulacion-dark); }
article > header.domain-header-interaccion     { background: var(--domain-interaccion-dark); }
article > header.domain-header-comunicacion    { background: var(--domain-comunicacion-dark); }
article > header.domain-header-juego_simbolico { background: var(--domain-juego-dark); }
article > header.domain-header-pensamiento     { background: var(--domain-pensamiento-dark); }

/* ===== 18. MISC ===== */
details summary { cursor: pointer; font-weight: 500; }

.auth-card {
    max-width: 420px;
    margin: var(--space-xl) auto;
}

.auth-card header {
    text-align: center;
    background: transparent;
    color: inherit;
    margin: 0;
    padding: 0;
}
.auth-card h2 { border: none; margin: 0; color: var(--teal); }

.domain-charts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-md);
}

/* ===== 19. ANIMATIONS ===== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes scoreSelect {
    0% { transform: scale(1); }
    50% { transform: scale(1.18); }
    100% { transform: scale(1.1); }
}

.children-grid > * {
    animation: fadeInUp var(--duration-slow) var(--ease-out) backwards;
}
.children-grid > *:nth-child(1) { animation-delay: 0ms; }
.children-grid > *:nth-child(2) { animation-delay: 80ms; }
.children-grid > *:nth-child(3) { animation-delay: 160ms; }
.children-grid > *:nth-child(4) { animation-delay: 240ms; }
.children-grid > *:nth-child(5) { animation-delay: 320ms; }

/* ===== 20. FORM VALIDATION ===== */
small.error {
    color: var(--error);
    display: block;
    margin-top: var(--space-xs);
    font-size: 0.82rem;
    font-weight: 500;
}

/* ===== 21. RESPONSIVE (Mobile-First: min-width breakpoints) ===== */

/* --- Small mobile (480px+) --- */
@media (min-width: 480px) {
    .quick-actions {
        grid-template-columns: 1fr 1fr;
    }
}

/* --- Tablet / Desktop (768px+) --- */
@media (min-width: 768px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.4rem; }

    main.page-content {
        padding-top: var(--space-xl);
        padding-bottom: var(--space-3xl);
    }

    /* Top nav: expand */
    nav.app-nav {
        padding: 0.75rem 1.5rem;
    }
    nav.app-nav ul { gap: 0.5rem; }
    nav.app-nav a {
        font-size: 0.9rem;
        padding: 0.35rem 0.75rem;
    }
    nav.app-nav .nav-subtitle { display: block; }

    /* Bottom nav: hide */
    .bottom-nav { display: none; }

    /* Grids: expand */
    .grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
    .domain-charts-grid { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
    .children-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-xl); }
    .quick-actions { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

    /* Page tabs: shrink to content */
    .page-tabs { width: fit-content; }

    /* Login: two-column */
    .login-layout {
        display: grid;
        grid-template-columns: 2fr 3fr;
    }
    .login-brand {
        padding: var(--space-3xl);
    }
    .login-brand-title { font-size: 3.5rem; }
    .login-brand-tagline { display: block; }
    .login-form-side {
        align-items: center;
        padding: var(--space-3xl);
    }

    /* Parent welcome */
    .parent-welcome { padding: var(--space-xl) 0 var(--space-2xl); }
}

/* --- Desktop (1024px+) --- */
@media (min-width: 1024px) {
    .parent-welcome h1 { font-size: 2.2rem; }
}
