:root {
    /* Premium 2024 Color Palette - Streamlined accent */
    --brand-primary: #6366f1;
    --brand-primary-light: #818cf8;
    --brand-primary-dark: #4f46e5;
    --brand-secondary: #10b981;
    --brand-secondary-soft: rgba(16, 185, 129, 0.1);
    --brand-accent: #f43f5e;
    --brand-accent-soft: rgba(244, 63, 94, 0.1);
    --brand-warning: #f59e0b;
    --brand-warning-soft: rgba(245, 158, 11, 0.1);

    /* Neutrals - Zinc/Slate based for a modern deep aesthetic */
    --bg-base: #09090b; /* Zinc 950 */
    --bg-surface: #121216; /* Custom deep surface */
    --bg-card: #18181b; /* Zinc 900 */
    --bg-elevated: #27272a; /* Zinc 800 */

    /* Borders & Dividers - Ultra subtle for that "borderless" feel */
    --border-subtle: rgba(255, 255, 255, 0.03);
    --border-default: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.15);

    /* Text Colors - High contrast for WCAG compliance */
    --text-primary: #fafafa; /* Zinc 50 */
    --text-secondary: #a1a1aa; /* Zinc 400 */
    --text-tertiary: #71717a; /* Zinc 500 */
    --text-inverse: #09090b;

    /* Typography Scales */
    --font-sans: "Geist", system-ui, -apple-system, sans-serif;
    --font-display: "Geist", sans-serif;
    --font-mono: "Geist Mono", monospace;

    /* Spacing - Balanced 4px-based grid */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Premium Elevation - Tinted shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.15), 0 2px 4px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.25), 0 4px 6px -2px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.35), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
    --shadow-premium: 0 0 0 1px var(--border-default), 0 20px 40px -10px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 0 1px var(--border-default), 0 0 30px -5px rgba(99, 102, 241, 0.15);

    /* Animations */
    --transition-spring-timing: cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --transition-spring: 0.5s var(--transition-spring-timing);
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: 0.15s ease;

    /* Z-index scale */
    --z-base: 0;
    --z-dropdown: 10;
    --z-sticky: 20;
    --z-overlay: 30;
    --z-modal: 40;
    --z-toast: 50;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    outline-color: var(--brand-primary);
}
html,
body {
    height: 100%;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    background-image:
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.03) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.03) 0px, transparent 50%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
    z-index: 9999;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.15;
    color: var(--text-primary);
    letter-spacing: -0.025em;
}

h1 {
    font-weight: 800;
    letter-spacing: -0.04em;
}
h2 {
    font-weight: 700;
    letter-spacing: -0.03em;
}
h3 {
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* Interactive Elements & Micro-interactions */
a,
button {
    cursor: pointer;
    transition: var(--transition-smooth);
}
a:hover {
    color: var(--brand-primary-light);
}
button:active {
    transform: scale(0.97);
}

/* Accessibility - Visible focus rings */
:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 3px;
    border-radius: var(--radius-sm);
}

:focus:not(:focus-visible) {
    outline: none;
}

/* Premium Glassmorphism */
.glass {
    background: rgba(18, 18, 22, 0.7);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid var(--border-default);
}

.container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 var(--space-3);
}
.hidden {
    display: none !important;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
    border: 2px solid var(--bg-base);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}
::-webkit-scrollbar-corner {
    background: transparent;
}

/* ===== AUTH ===== */
.auth-screen {
    display: none;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: var(--space-6);
    background:
        radial-gradient(circle at top left, rgba(99, 102, 241, 0.08), transparent),
        radial-gradient(circle at bottom right, rgba(16, 185, 129, 0.08), transparent);
}
.auth-screen.active {
    display: flex;
}
.auth-card {
    width: 100%;
    max-width: 420px;
    padding: var(--space-8);
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-default);
    box-shadow: var(--shadow-premium);
    animation: authEnter 0.6s var(--transition-spring-timing) both;
}
@keyframes authEnter {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
.auth-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-8);
}
.auth-logo-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-light));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 24px;
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.4);
}
.auth-logo-text {
    font-size: 28px;
    font-weight: 800;
    font-family: var(--font-display);
    letter-spacing: -0.04em;
}
.auth-title {
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    margin-bottom: var(--space-2);
}
.auth-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    text-align: center;
    margin-bottom: var(--space-8);
}

.field-group {
    display: grid;
    gap: var(--space-4);
    margin-bottom: var(--space-8);
}
.field label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
    letter-spacing: 0.01em;
}
.field input {
    width: 100%;
    background: var(--bg-base);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    color: var(--text-primary);
    font-size: 16px;
    font-family: var(--font-sans);
    outline: none;
    transition: var(--transition-smooth);
}
.field input:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
    background: var(--bg-surface);
}
.field input:invalid:not(:placeholder-shown) {
    border-color: var(--brand-accent);
}
.field input::placeholder {
    color: var(--text-tertiary);
}

.btn-primary {
    width: 100%;
    padding: var(--space-4);
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-dark));
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.4);
}
.btn-primary:active {
    transform: translateY(0) scale(0.98);
}

.auth-switch {
    text-align: center;
    margin-top: var(--space-6);
    font-size: 15px;
    color: var(--text-secondary);
}
.auth-switch a {
    font-weight: 600;
    color: var(--brand-primary);
    cursor: pointer;
}
.auth-switch a:hover {
    color: var(--brand-primary-light);
    text-decoration: underline;
}

.error-msg {
    display: none;
    margin-bottom: 20px;
    padding: 12px 16px;
    background: rgba(244, 63, 94, 0.1);
    color: var(--brand-accent);
    border: 1px solid rgba(244, 63, 94, 0.2);
    border-radius: var(--radius-md);
    font-size: 14px;
    text-align: center;
}
.error-msg.show {
    display: block;
    animation: shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}
@keyframes shake {
    10%,
    90% {
        transform: translate3d(-1px, 0, 0);
    }
    20%,
    80% {
        transform: translate3d(2px, 0, 0);
    }
    30%,
    50%,
    70% {
        transform: translate3d(-4px, 0, 0);
    }
    40%,
    60% {
        transform: translate3d(4px, 0, 0);
    }
}

/* ===== DASHBOARD ===== */
.dashboard {
    display: none;
}
.dashboard.active {
    display: block;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    background: rgba(9, 9, 11, 0.8);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-default);
    padding: 0 var(--space-6);
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.topbar-logo {
    font-size: 20px;
    font-weight: 800;
    font-family: var(--font-display);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text-primary);
    letter-spacing: -0.03em;
}
.logo-shape {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-light));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 16px;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}
.topbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}
.topbar-right > * {
    display: flex;
}

.main-content {
    padding: var(--space-8) var(--space-8);
    max-width: 1600px;
    margin: 0 auto;
}

.identity-group {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.sync-status-badge {
    font-size: 12px;
    font-weight: 600;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    border: 1px solid var(--border-default);
    background: var(--bg-surface);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}
.sync-status-badge.live {
    color: var(--brand-secondary);
    border-color: var(--brand-secondary-soft);
    background: rgba(16, 185, 129, 0.05);
}

.student-pill {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    background: var(--bg-surface);
    padding: var(--space-1) var(--space-3) var(--space-1) var(--space-1);
    border-radius: var(--radius-full);
    border: 1px solid var(--border-default);
    transition: var(--transition-smooth);
    position: relative;
}
.student-pill:hover {
    border-color: var(--border-strong);
    background: var(--bg-elevated);
    transform: translateY(-1px);
}

.pill-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}
.pill-role {
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    color: var(--text-tertiary);
    letter-spacing: 0.08em;
}

.student-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-light));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 13px;
}
.student-avatar.parent {
    background: linear-gradient(135deg, #6366f1, #a5b4fc);
}
.student-avatar.child {
    background: linear-gradient(135deg, #10b981, #6ee7b7);
}
.student-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.control-btn {
    padding: var(--space-1) var(--space-3);
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}
.control-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-strong);
    background: var(--bg-elevated);
}

.btn-logout {
    padding: var(--space-1) var(--space-3);
    background: transparent;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition-smooth);
}
.btn-logout:hover {
    color: var(--brand-accent);
    border-color: var(--brand-accent);
    background: var(--brand-accent-soft);
}

.btn-remove-child {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    transition: var(--transition-smooth);
    border: 1px solid var(--border-default);
    background: var(--bg-elevated);
    color: var(--text-tertiary);
    cursor: pointer;
}
.btn-remove-child:hover {
    color: var(--brand-accent);
    border-color: var(--brand-accent);
    background: var(--brand-accent-soft);
}
.child-selector-group {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}
.child-selector {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: var(--space-2) var(--space-3);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    min-width: 140px;
}
.child-selector:hover {
    border-color: var(--border-strong);
    background: var(--bg-elevated);
}
.child-selector:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.btn-add-child {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-2) var(--space-3);
    background: var(--brand-primary);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}
.btn-add-child:hover {
    background: var(--brand-primary-dark);
    transform: translateY(-1px);
}
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: var(--space-4);
    margin-bottom: var(--space-8);
    padding-bottom: var(--space-6);
    border-bottom: 1px solid var(--border-subtle);
}
.page-title {
    font-size: 42px;
    font-weight: 800;
    letter-spacing: -0.05em;
    text-wrap: balance;
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Tabs */
.tabs-header {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-8);
    overflow-x: auto;
    padding-bottom: var(--space-1);
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.tabs-header::-webkit-scrollbar {
    display: none;
}
.tab-btn {
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    white-space: nowrap;
    transition: var(--transition-smooth);
}
.tab-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-strong);
    background: var(--bg-elevated);
    transform: translateY(-1px);
}
.tab-btn.active {
    color: white;
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.3);
}

.tab-pane {
    display: none;
}
.tab-pane.active {
    display: block;
}

/* Staggered Entry for Sections - Only animate children to avoid double-entry jitters */
.section,
.stat-card,
.live-stat-card,
.timeline-item {
    animation: sectionEnter 0.6s var(--transition-spring-timing) both;
}
.section:nth-child(1) {
    animation-delay: 0.1s;
}
.section:nth-child(2) {
    animation-delay: 0.2s;
}
.stat-card:nth-child(1) {
    animation-delay: 0.15s;
}
.stat-card:nth-child(2) {
    animation-delay: 0.25s;
}
.stat-card:nth-child(3) {
    animation-delay: 0.35s;
}

@keyframes sectionEnter {
    from {
        opacity: 0;
        transform: scale(0.98) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Spinner */
.spinner-inline {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 10px;
}
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Live Hero Section */
.section {
    background: linear-gradient(135deg, var(--bg-surface) 0%, rgba(18, 18, 22, 0.4) 100%);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    margin-bottom: var(--space-8);
    box-shadow: var(--shadow-premium);
    position: relative;
    overflow: hidden;
}
.section::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.05), transparent);
    pointer-events: none;
}
.section::before {
    content: "";
    position: absolute;
    top: 0;
    left: var(--space-8);
    right: var(--space-8);
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.1), transparent);
}
.live-hero {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(16, 185, 129, 0.04) 100%);
    position: relative;
    overflow: hidden;
    border-color: rgba(99, 102, 241, 0.2);
}
.live-hero::before {
    content: "";
    position: absolute;
    top: -50%;
    right: -20%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.12) 0%, transparent 70%);
    pointer-events: none;
    animation: drift 20s ease-in-out infinite;
}
@keyframes drift {
    0%,
    100% {
        transform: translateY(0px) translateX(0px);
    }
    50% {
        transform: translateY(-20px) translateX(20px);
    }
}
.eyebrow {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--brand-primary-light);
    margin-bottom: var(--space-4);
    font-family: var(--font-sans);
}
.hero-title {
    font-size: 36px;
    font-weight: 800;
    letter-spacing: -0.035em;
    margin-bottom: var(--space-3);
    color: var(--text-primary);
}
.hero-subtitle {
    color: var(--text-secondary);
    font-size: 16px;
    max-width: 65ch;
    line-height: 1.7;
    font-weight: 500;
}

.pill-row,
.signal-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-top: var(--space-6);
}
.state-pill,
.signal-pill {
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-full);
    border: 1px solid var(--border-default);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    transition: var(--transition-smooth);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}
.state-pill.live {
    color: var(--brand-secondary);
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.08);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.15);
}
.signal-pill.good {
    color: var(--brand-secondary);
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.08);
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.2);
}
.signal-pill.warn {
    color: var(--brand-warning);
    border-color: rgba(245, 158, 11, 0.3);
    background: rgba(245, 158, 11, 0.08);
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.15);
}
.signal-pill.danger {
    color: var(--brand-accent);
    border-color: rgba(244, 63, 94, 0.3);
    background: rgba(244, 63, 94, 0.08);
    box-shadow: 0 0 12px rgba(244, 63, 94, 0.2);
}

/* Live Stats */
.live-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-8);
    margin-bottom: var(--space-8);
}
.live-stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    transition: var(--transition-smooth);
    box-shadow: var(--shadow-premium);
    position: relative;
    overflow: hidden;
}
.live-stat-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--brand-primary), transparent);
}
.live-stat-card:hover {
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateY(-6px);
    box-shadow: var(--shadow-glow);
}
.live-stat-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: var(--space-4);
    font-family: var(--font-sans);
}
.live-stat-value {
    font-size: 42px;
    font-weight: 800;
    font-family: var(--font-display);
    margin-bottom: var(--space-2);
    letter-spacing: -0.02em;
}
.live-stat-meta {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Breakdown & Charts */
.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-8);
    margin-bottom: var(--space-8);
}
.grid-3col {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-8);
    margin-bottom: var(--space-8);
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    min-width: 0;
    box-shadow: var(--shadow-premium);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--brand-primary), transparent);
}
.stat-card:hover {
    border-color: rgba(99, 102, 241, 0.25);
    transform: translateY(-4px);
    box-shadow: var(--shadow-glow);
}
.stat-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: var(--space-3);
    font-family: var(--font-sans);
}
.stat-value {
    font-size: 40px;
    font-weight: 800;
    font-family: var(--font-display);
    letter-spacing: -0.02em;
}
.stat-value.success {
    color: var(--brand-secondary);
}
.stat-value.danger {
    color: var(--brand-accent);
}
.stat-value.accent {
    color: var(--brand-primary);
}

.score-wrap {
    display: flex;
    align-items: center;
    gap: var(--space-8);
}
.score-ring {
    position: relative;
    width: 130px;
    height: 130px;
}
.score-ring svg {
    transform: rotate(-90deg);
    width: 130px;
    height: 130px;
    filter: drop-shadow(0 0 20px rgba(99, 102, 241, 0.1));
}
.ring-bg {
    fill: none;
    stroke: var(--bg-elevated);
    stroke-width: 12;
}
.ring-fill {
    fill: none;
    stroke: url(#scoreGradient);
    stroke-width: 12;
    stroke-linecap: round;
    stroke-dasharray: 314.16;
    stroke-dashoffset: 314.16;
    transition:
        stroke-dashoffset 1.8s var(--transition-smooth),
        filter 0.5s ease;
    filter: drop-shadow(0 0 12px rgba(16, 185, 129, 0.3));
}
.score-num {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.score-num span:first-child {
    font-family: var(--font-display);
    font-size: 42px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.02em;
}
.score-num span:last-child {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    margin-top: var(--space-2);
    letter-spacing: 0.12em;
}

.breakdown-bar {
    height: 16px;
    background: var(--bg-base);
    border-radius: var(--radius-full);
    overflow: hidden;
    display: flex;
    margin-bottom: var(--space-6);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}
.bar-segment {
    height: 100%;
    transition: width 1s var(--transition-smooth);
    position: relative;
}
.bar-segment.focused {
    background: linear-gradient(135deg, var(--brand-secondary), #06d6a0);
    box-shadow:
        0 0 20px rgba(16, 185, 129, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.bar-segment.neutral {
    background: linear-gradient(135deg, var(--brand-primary), #818cf8);
    box-shadow:
        0 0 20px rgba(99, 102, 241, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.bar-segment.distracted {
    background: linear-gradient(135deg, var(--brand-accent), #fb7185);
    box-shadow:
        0 0 20px rgba(244, 63, 94, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.bar-segment.idle {
    background: var(--bg-elevated);
}

.legend-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
}
.legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    transition: var(--transition-smooth);
}
.legend-item:hover {
    background: var(--bg-elevated);
    transform: translateX(2px);
}
.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    box-shadow: 0 0 12px currentColor;
    opacity: 0.8;
}
.legend-dot.focused {
    background: var(--brand-secondary);
    color: var(--brand-secondary);
}
.legend-dot.neutral {
    background: var(--brand-primary);
    color: var(--brand-primary);
}
.legend-dot.distracted {
    background: var(--brand-accent);
    color: var(--brand-accent);
}
.legend-dot.idle {
    background: var(--text-tertiary);
    color: var(--text-tertiary);
}
.legend-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}
.legend-value {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 700;
    margin-left: auto;
    color: var(--text-primary);
}

/* Timeline Section */
.timeline-item {
    display: grid;
    grid-template-columns: 1fr 180px 100px;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-5) var(--space-6);
    background: linear-gradient(135deg, var(--bg-surface) 0%, rgba(18, 18, 22, 0.5) 100%);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    margin-bottom: var(--space-3);
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}
.timeline-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, transparent, var(--brand-primary), transparent);
}
.timeline-item::after {
    content: "";
    position: absolute;
    top: -50%;
    right: -20%;
    width: 150px;
    height: 200%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.05), transparent 70%);
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition-smooth);
}
.timeline-item:hover {
    border-color: var(--border-strong);
    transform: translateX(6px);
    box-shadow: var(--shadow-lg);
}
.timeline-item:hover::after {
    opacity: 1;
}
.timeline-item.active-class {
    border-color: var(--brand-primary);
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.1), rgba(99, 102, 241, 0.02));
    box-shadow: 0 0 50px rgba(99, 102, 241, 0.15);
}
.ti-class {
    font-weight: 700;
    font-size: 18px;
    color: var(--text-primary);
}
.ti-badge {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-full);
    letter-spacing: 0.05em;
}
.ti-badge.now {
    background: rgba(99, 102, 241, 0.15);
    color: var(--brand-primary-light);
}
.ti-badge.done {
    background: var(--brand-secondary-soft);
    color: var(--brand-secondary);
}
.ti-badge.upcoming {
    background: var(--bg-elevated);
    color: var(--text-tertiary);
}

.ti-bar {
    height: 10px;
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
    overflow: hidden;
    display: flex;
    width: 100%;
}
.ti-score {
    text-align: right;
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 800;
}
.ti-score.great {
    color: var(--brand-secondary);
}
.ti-score.ok {
    color: var(--brand-warning);
}
.ti-score.poor {
    color: var(--brand-accent);
}
.ti-score.none {
    color: var(--text-tertiary);
}

/* Live Activity & Charts */
.live-activity-card {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-6);
}
.live-activity-main {
    flex: 1;
    min-width: 0;
}
.live-activity-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: var(--space-2);
    color: var(--text-primary);
    letter-spacing: -0.01em;
}
.live-activity-domain {
    font-size: 14px;
    font-weight: 600;
    color: var(--brand-primary-light);
    margin-bottom: var(--space-2);
}
.live-activity-url {
    font-size: 13px;
    color: var(--text-tertiary);
    word-break: break-all;
    line-height: 1.4;
}

.live-label-stack {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    min-width: 180px;
}
.mini-kv {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.06), transparent);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}
.mini-kv::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--brand-primary);
    opacity: 0;
    transition: opacity var(--transition-smooth);
}
.mini-kv:hover {
    border-color: var(--border-default);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), transparent);
    transform: translateY(-2px);
}
.mini-kv:hover::before {
    opacity: 1;
}
.mini-kv-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-tertiary);
    margin-bottom: var(--space-2);
    font-family: var(--font-sans);
    letter-spacing: 0.1em;
}
.mini-kv-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
    padding: var(--space-6);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.03), rgba(16, 185, 129, 0.02));
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

/* ===== RESPONSIVE BREAKPOINTS ===== */

/* Mobile hamburger menu - hidden by default on desktop */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: var(--transition-smooth);
}
.mobile-menu-toggle:hover {
    background: var(--bg-surface);
}
.mobile-menu-toggle svg {
    width: 24px;
    height: 24px;
    stroke-width: 2;
}

.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: var(--z-modal);
    background: rgba(9, 9, 11, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-default);
    padding: var(--space-2) var(--space-3);
    padding-bottom: calc(var(--space-2) + env(safe-area-inset-bottom, 0px));
    max-height: 65vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.mobile-nav.open {
    transform: translateY(0);
}
.mobile-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: var(--space-2);
    margin-bottom: var(--space-2);
    border-bottom: 1px solid var(--border-subtle);
}
.mobile-nav-user {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}
.mobile-user-avatar {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--brand-primary), #a5b4fc);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 11px;
}
.mobile-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}
.mobile-nav-actions {
    display: flex;
    gap: var(--space-1);
}
.mobile-action-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-smooth);
}
.mobile-action-btn svg {
    width: 16px;
    height: 16px;
    stroke-width: 1.5;
}
.mobile-action-btn:hover {
    border-color: var(--border-strong);
    color: var(--text-primary);
}
.mobile-logout-btn:hover {
    color: var(--brand-accent);
    border-color: var(--brand-accent);
    background: var(--brand-accent-soft);
}

/* Desktop: hide mobile nav elements */
.mobile-nav-header,
.mobile-nav-actions {
    display: none;
}

.mobile-nav-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
}
.mobile-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: var(--space-2) var(--space-1);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-tertiary);
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    -webkit-tap-highlight-color: transparent;
}
.mobile-nav-btn svg {
    width: 22px;
    height: 22px;
    stroke-width: 1.5;
}
.mobile-nav-btn:active {
    background: var(--bg-surface);
}
.mobile-nav-btn.active {
    color: var(--brand-primary);
}

/* === BASE (desktop first) === */
.section {
    padding: var(--space-8);
    margin-bottom: var(--space-8);
}
.main-content {
    padding: var(--space-8);
    max-width: 1600px;
    margin: 0 auto;
}
.live-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-8);
    margin-bottom: var(--space-8);
}
.live-stat-value {
    font-size: 42px;
}
.live-stat-label {
    font-size: 12px;
}
.stat-value {
    font-size: 40px;
}
.stat-label {
    font-size: 12px;
}
.page-title {
    font-size: 42px;
}
.section-title {
    font-size: 24px;
}
.hero-title {
    font-size: 36px;
}
.hero-subtitle {
    font-size: 16px;
}
.eyebrow {
    font-size: 12px;
}
.live-activity-title {
    font-size: 20px;
}
.score-ring {
    width: 130px;
    height: 130px;
}
.score-ring svg {
    width: 130px;
    height: 130px;
}
.score-num span:first-child {
    font-size: 42px;
}
.topbar {
    height: 64px;
    padding: 0 var(--space-6);
}
.topbar-logo {
    font-size: 20px;
}
.logo-shape {
    width: 32px;
    height: 32px;
    font-size: 16px;
}
.tabs-header {
    margin-bottom: var(--space-8);
}
.tab-btn {
    font-size: 15px;
}
.subject-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}
.subject-card {
    padding: var(--space-6);
}
.sc-score {
    font-size: 36px;
}
.chart-container {
    height: 300px;
}
.live-label-stack {
    min-width: 180px;
}
.legend-grid {
    grid-template-columns: repeat(2, 1fr);
}
.breakdown-bar {
    height: 16px;
}
.live-stat-card {
    padding: var(--space-6);
}
.stat-card {
    padding: var(--space-6);
}
.schedule-header {
    grid-template-columns: 1fr 100px 100px 40px;
}
.schedule-row {
    grid-template-columns: 1fr 100px 100px 40px;
}
.session-row {
    padding: var(--space-5) var(--space-6);
}
.session-date {
    font-size: 17px;
}
.session-score-badge {
    font-size: 24px;
}
.empty-state {
    padding: var(--space-12) var(--space-8);
    min-height: 280px;
}
.ti-class {
    font-size: 18px;
}
.ti-score {
    font-size: 20px;
}
.live-activity-card {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-6);
}
.mini-kv-value {
    font-size: 15px;
}
.child-selector {
    min-width: 140px;
    font-size: 14px;
}
.btn-add-child {
    font-size: 13px;
    padding: var(--space-2) var(--space-3);
}
.btn-remove-child {
    width: 32px;
    height: 32px;
}
.sync-status-badge {
    font-size: 12px;
}
.page-header {
    padding-bottom: var(--space-6);
    margin-bottom: var(--space-8);
}

/* === 1440px === */
@media (max-width: 1440px) {
    .container {
        max-width: 1280px;
    }
    .section {
        padding: var(--space-6);
    }
    .page-title {
        font-size: 36px;
    }
}

/* === 1024px === */
@media (max-width: 1024px) {
    .grid-2col {
        grid-template-columns: 1fr;
    }
    .grid-3col {
        grid-template-columns: repeat(2, 1fr);
    }
    .main-content {
        padding: var(--space-6);
    }
    .hero-title {
        font-size: 28px;
    }
    .live-stat-value {
        font-size: 36px;
    }
    .stat-value {
        font-size: 32px;
    }
    .page-title {
        font-size: 28px;
    }
    .live-stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    .live-label-stack {
        min-width: 140px;
    }
}

/* === 768px === */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }

    /* Ensure full-width on mobile */
    .container {
        max-width: 100%;
        padding: 0 var(--space-3);
    }

    /* Topbar: compact, hide desktop-only elements */
    .topbar {
        height: 56px;
        padding: 0 var(--space-3);
    }
    .topbar-logo {
        font-size: 16px;
        gap: var(--space-1);
    }
    .logo-shape {
        width: 28px;
        height: 28px;
        font-size: 13px;
    }
    .topbar-right > :not(.child-selector-group):not(.mobile-menu-toggle):not(#sync-status-badge) {
        display: none;
    }
    .child-selector-group {
        gap: var(--space-1);
    }
    .child-selector {
        min-width: 90px;
        font-size: 12px;
        padding: 6px var(--space-2);
    }
    .btn-add-child {
        font-size: 11px;
        padding: 6px var(--space-2);
    }
    .btn-add-child svg {
        width: 12px;
        height: 12px;
    }
    .btn-remove-child {
        width: 28px;
        height: 28px;
    }
    .btn-remove-child svg {
        width: 12px;
        height: 12px;
    }
    .sync-status-badge {
        font-size: 10px;
        padding: 3px var(--space-2);
    }

    /* Mobile nav visible */
    .mobile-menu-toggle {
        display: flex;
    }
    .mobile-nav-header,
    .mobile-nav-actions {
        display: flex;
    }
    .mobile-nav {
        display: block;
    }

    /* Main content - full width on mobile */
    .main-content {
        padding: var(--space-3);
        padding-bottom: 90px;
        max-width: 100%;
    }

    /* Page header */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-2);
        padding-bottom: var(--space-4);
        margin-bottom: var(--space-4);
        border-bottom: 1px solid var(--border-subtle);
    }
    .page-title {
        font-size: 24px;
    }
    .section-title {
        font-size: 20px;
        margin-bottom: var(--space-4);
    }

    /* Grids - single column on mobile */
    .grid-2col,
    .grid-3col {
        grid-template-columns: 1fr;
        gap: var(--space-3);
    }
    .live-stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-3);
    }
    .subject-grid {
        grid-template-columns: 1fr 1fr;
    }

    /* Sections - reduce padding */
    .section {
        padding: var(--space-4);
        margin-bottom: var(--space-4);
    }
    .live-hero {
        padding: var(--space-4);
    }
    .hero-title {
        font-size: 24px;
    }
    .hero-subtitle {
        font-size: 14px;
    }

    /* Score ring */
    .score-ring {
        width: 100px;
        height: 100px;
    }
    .score-ring svg {
        width: 100px;
        height: 100px;
    }
    .score-num span:first-child {
        font-size: 32px;
    }

    /* Live label stack - stack on mobile */
    .live-label-stack {
        min-width: auto;
    }

    /* Charts */
    .chart-container {
        height: 200px;
        padding: var(--space-3);
    }

    /* Timeline items */
    .timeline-item {
        grid-template-columns: 1fr;
        padding: var(--space-3);
        gap: var(--space-2);
    }
    .ti-score {
        text-align: left;
        font-size: 16px;
    }
    .ti-bar {
        display: none;
    }

    /* Auth screen */
    .auth-screen {
        padding: var(--space-4);
    }
    .auth-card {
        max-width: 100%;
        padding: var(--space-5);
    }
}

@media (max-width: 768px) {
    /* Sections */
    .section {
        padding: var(--space-4);
        margin-bottom: var(--space-4);
        border-radius: var(--radius-lg);
    }
    .section::after {
        display: none;
    }

    /* Hero */
    .hero-title {
        font-size: 22px;
    }
    .hero-subtitle {
        font-size: 13px;
    }
    .eyebrow {
        font-size: 10px;
        margin-bottom: var(--space-2);
    }
    .live-hero::before {
        width: 300px;
        height: 300px;
    }

    /* Stats */
    .live-stat-card {
        padding: var(--space-4);
    }
    .live-stat-value {
        font-size: 32px;
    }
    .live-stat-label {
        font-size: 11px;
    }
    .stat-card {
        padding: var(--space-4);
    }
    .stat-value {
        font-size: 28px;
    }
    .stat-label {
        font-size: 11px;
    }

    /* Score ring */
    .score-wrap {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-4);
    }
    .score-ring {
        width: 100px;
        height: 100px;
    }
    .score-ring svg {
        width: 100px;
        height: 100px;
    }
    .score-num span:first-child {
        font-size: 32px;
    }
    .score-num span:last-child {
        font-size: 10px;
    }

    /* Live activity */
    .live-activity-card {
        flex-direction: column;
        gap: var(--space-3);
    }
    .live-activity-title {
        font-size: 16px;
    }
    .live-label-stack {
        width: 100%;
        min-width: auto;
        flex-direction: row;
        flex-wrap: wrap;
        gap: var(--space-2);
    }
    .mini-kv {
        flex: 1;
        min-width: 120px;
    }
    .mini-kv-value {
        font-size: 14px;
    }

    /* Tabs */
    .tabs-header {
        display: flex;
        gap: var(--space-1);
        margin-bottom: var(--space-4);
        overflow-x: auto;
        padding-bottom: var(--space-1);
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    .tabs-header::-webkit-scrollbar {
        display: none;
    }
    .tab-btn {
        padding: var(--space-2) var(--space-3);
        font-size: 12px;
        white-space: nowrap;
    }

    /* Timeline */
    .timeline-item {
        grid-template-columns: 1fr auto;
        gap: var(--space-3);
        padding: var(--space-3) var(--space-4);
    }
    .ti-class {
        font-size: 14px;
    }
    .ti-bar {
        order: 3;
        grid-column: 1 / -1;
    }
    .ti-score {
        text-align: left;
        font-size: 16px;
    }

    /* History */
    .history-item {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-2);
        padding: var(--space-3);
    }
    .history-time {
        min-width: auto;
        font-size: 11px;
    }
    .history-title {
        font-size: 13px;
    }
    .history-tag {
        font-size: 10px;
    }

    /* Session rows */
    .session-row {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-2);
        padding: var(--space-3) var(--space-4);
    }
    .session-date {
        font-size: 15px;
    }
    .session-meta {
        font-size: 12px;
    }
    .session-score-badge {
        font-size: 20px;
        padding: var(--space-1) var(--space-3);
    }

    /* Subject grid */
    .subject-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-3);
    }
    .subject-card {
        padding: var(--space-4);
    }
    .sc-name {
        font-size: 10px;
    }
    .sc-score {
        font-size: 28px;
    }
    .sc-meta {
        font-size: 12px;
    }

    /* Distractions */
    .distraction-domain {
        font-size: 14px;
    }
    .distraction-time {
        font-size: 13px;
    }

    /* Charts */
    .chart-container {
        height: 200px;
        padding: var(--space-3);
    }

    /* Schedule editor */
    .schedule-header {
        grid-template-columns: 1fr 80px 80px 32px;
        gap: var(--space-1);
        padding: var(--space-1) var(--space-3);
        font-size: 9px;
    }
    .schedule-row {
        grid-template-columns: 1fr 80px 80px 32px;
        gap: var(--space-1);
    }
    .schedule-row input {
        font-size: 13px;
        padding: var(--space-1) var(--space-2);
    }
    .btn-ghost,
    .btn-accent {
        font-size: 12px;
        padding: var(--space-1) var(--space-3);
    }

    /* Empty state */
    .empty-state {
        padding: var(--space-8) var(--space-4);
        min-height: 160px;
    }
    .es-icon {
        width: 48px;
        height: 48px;
    }
    .es-title {
        font-size: 16px;
    }
    .es-text {
        font-size: 13px;
    }

    /* Legend */
    .legend-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-2);
    }
    .legend-item {
        padding: var(--space-1) var(--space-2);
    }
    .legend-text {
        font-size: 12px;
    }
    .legend-value {
        font-size: 12px;
    }

    /* Alerts */
    .alert-banner {
        font-size: 13px;
        padding: var(--space-2) var(--space-3);
    }

    /* Pills */
    .pill-row,
    .signal-grid {
        gap: var(--space-2);
        margin-top: var(--space-4);
    }
    .state-pill,
    .signal-pill {
        font-size: 12px;
        padding: var(--space-1) var(--space-3);
    }

    /* Breakdown bar */
    .breakdown-bar {
        height: 14px;
    }

    /* Auth */
    .auth-card {
        max-width: 100%;
    }
    .auth-logo-icon {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }
    .auth-logo-text {
        font-size: 24px;
    }
    .auth-title {
        font-size: 22px;
    }
}

/* === 640px === */
@media (max-width: 640px) {
    .subject-grid {
        grid-template-columns: 1fr 1fr;
    }
    .mobile-nav-grid {
        grid-template-columns: repeat(5, 1fr);
    }
    .live-stat-value {
        font-size: 28px;
    }
    .live-stat-label {
        font-size: 10px;
    }
    .stat-value {
        font-size: 24px;
    }
    .stat-label {
        font-size: 10px;
    }
    .child-selector {
        min-width: 80px;
        font-size: 11px;
    }
    .hero-title {
        font-size: 20px;
    }
    .page-title {
        font-size: 22px;
    }
    .live-label-stack {
        flex-direction: column;
    }
    .mini-kv {
        min-width: auto;
        flex: auto;
    }
    .score-ring {
        width: 90px;
        height: 90px;
    }
    .score-ring svg {
        width: 90px;
        height: 90px;
    }
    .score-num span:first-child {
        font-size: 28px;
    }
    .tabs-header {
        gap: var(--space-1);
    }
    .tab-btn {
        font-size: 11px;
        padding: var(--space-1) var(--space-2);
    }
}

/* === 480px (phones) === */
@media (max-width: 480px) {
    body {
        font-size: 13px;
    }

    /* Auth */
    .auth-card {
        padding: var(--space-5) var(--space-3);
    }
    .auth-logo-icon {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
    .auth-logo-text {
        font-size: 22px;
    }
    .auth-title {
        font-size: 20px;
    }
    .auth-subtitle {
        font-size: 12px;
    }
    .field input {
        font-size: 16px;
    }

    /* Topbar very compact */
    .topbar {
        height: 50px;
        padding: 0 var(--space-2);
    }
    .topbar-logo {
        font-size: 15px;
        gap: 6px;
    }
    .logo-shape {
        width: 24px;
        height: 24px;
        font-size: 11px;
    }
    .child-selector-group {
        gap: 2px;
    }
    .child-selector {
        min-width: 70px;
        font-size: 10px;
        padding: 4px var(--space-1);
    }
    .btn-add-child {
        font-size: 9px;
        padding: 4px var(--space-1);
    }
    .btn-add-child svg {
        width: 10px;
        height: 10px;
    }
    .btn-remove-child {
        width: 24px;
        height: 24px;
    }
    .btn-remove-child svg {
        width: 11px;
        height: 11px;
    }
    .sync-status-badge {
        font-size: 9px;
        padding: 2px 6px;
    }
    .mobile-menu-toggle {
        width: 32px;
        height: 32px;
    }
    .mobile-menu-toggle svg {
        width: 18px;
        height: 18px;
    }

    /* Main content */
    .main-content {
        padding: var(--space-3);
        padding-bottom: 85px;
    }

    /* Typography */
    .page-title {
        font-size: 20px;
    }
    .section-title {
        font-size: 18px;
        margin-bottom: var(--space-3);
    }
    .hero-title {
        font-size: 18px;
    }
    .hero-subtitle {
        font-size: 12px;
    }
    .eyebrow {
        font-size: 9px;
    }

    /* Stats */
    .live-stat-value {
        font-size: 24px;
    }
    .stat-value {
        font-size: 22px;
    }
    .live-stat-meta {
        font-size: 12px;
    }

    /* Sections */
    .section {
        padding: var(--space-3);
        margin-bottom: var(--space-3);
        border-radius: var(--radius-md);
    }

    /* Score ring */
    .score-ring {
        width: 80px;
        height: 80px;
    }
    .score-ring svg {
        width: 80px;
        height: 80px;
    }
    .score-num span:first-child {
        font-size: 24px;
    }
    .score-num span:last-child {
        font-size: 9px;
    }

    /* Live activity */
    .live-activity-title {
        font-size: 14px;
    }
    .live-activity-domain {
        font-size: 12px;
    }
    .live-activity-url {
        font-size: 11px;
    }
    .mini-kv {
        padding: var(--space-2);
    }
    .mini-kv-label {
        font-size: 10px;
    }
    .mini-kv-value {
        font-size: 13px;
    }

    /* Grids */
    .live-stats-grid {
        gap: var(--space-3);
    }
    .grid-2col,
    .grid-3col {
        gap: var(--space-3);
    }

    /* Stats cards */
    .live-stat-card {
        padding: var(--space-3);
    }
    .live-stat-card::before {
        height: 2px;
    }
    .stat-card {
        padding: var(--space-3);
    }
    .stat-card::before {
        height: 2px;
    }

    /* Tabs */
    .tabs-header {
        margin-bottom: var(--space-3);
    }
    .tab-btn {
        font-size: 10px;
        padding: var(--space-1) var(--space-2);
    }

    /* Timeline */
    .timeline-item {
        padding: var(--space-2) var(--space-3);
        margin-bottom: var(--space-1);
        border-radius: var(--radius-md);
    }
    .ti-class {
        font-size: 13px;
    }
    .ti-badge {
        font-size: 9px;
    }
    .ti-score {
        font-size: 14px;
    }

    /* History */
    .history-item {
        padding: var(--space-2) var(--space-3);
        gap: var(--space-1);
    }
    .history-time {
        font-size: 10px;
    }
    .history-title {
        font-size: 12px;
    }
    .history-url {
        font-size: 11px;
    }
    .history-tag {
        font-size: 9px;
        padding: 1px 6px;
    }

    /* Session rows */
    .session-row {
        padding: var(--space-2) var(--space-3);
    }
    .session-date {
        font-size: 14px;
    }
    .session-meta {
        font-size: 11px;
    }
    .session-score-badge {
        font-size: 16px;
        padding: 4px var(--space-2);
    }

    /* Subject grid */
    .subject-grid {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-2);
    }
    .subject-card {
        padding: var(--space-3);
        border-radius: var(--radius-lg);
    }
    .sc-name {
        font-size: 9px;
        margin-bottom: var(--space-1);
    }
    .sc-score {
        font-size: 22px;
    }
    .sc-meta {
        font-size: 11px;
    }

    /* Distractions */
    .distraction-row {
        padding: var(--space-2) 0;
    }
    .distraction-domain {
        font-size: 12px;
        gap: var(--space-2);
    }
    .dist-dot {
        width: 8px;
        height: 8px;
    }
    .distraction-time {
        font-size: 12px;
    }

    /* Charts */
    .chart-container {
        height: 180px;
        padding: var(--space-2);
    }

    /* Schedule editor */
    .schedule-header {
        grid-template-columns: 1fr 60px 60px 26px;
        gap: var(--space-1);
        padding: var(--space-1);
        font-size: 8px;
    }
    .schedule-row {
        grid-template-columns: 1fr 60px 60px 26px;
        gap: var(--space-1);
    }
    .schedule-row input {
        font-size: 11px;
        padding: 4px var(--space-1);
    }
    .btn-ghost,
    .btn-accent {
        font-size: 11px;
        padding: var(--space-1) var(--space-2);
    }
    .btn-remove {
        width: 26px;
        height: 26px;
        font-size: 14px;
    }

    /* Legend */
    .legend-grid {
        grid-template-columns: 1fr;
        gap: var(--space-1);
    }
    .legend-item {
        padding: var(--space-1);
    }
    .legend-text,
    .legend-value {
        font-size: 11px;
    }
    .legend-dot {
        width: 10px;
        height: 10px;
    }

    /* Modal */
    .modal-card {
        padding: var(--space-4);
        width: 95%;
        max-height: 80vh;
        overflow-y: auto;
    }
    .modal-title {
        font-size: 18px;
    }
    .modal-subtitle {
        font-size: 13px;
    }
    .modal-actions {
        flex-direction: column;
        gap: var(--space-2);
    }
    .modal-actions button {
        font-size: 13px;
        padding: var(--space-2) var(--space-3);
    }
    .modal-field input {
        font-size: 16px;
    }

    /* Empty state */
    .empty-state {
        padding: var(--space-5) var(--space-3);
        min-height: 120px;
    }
    .es-icon {
        width: 40px;
        height: 40px;
    }
    .es-icon svg {
        width: 20px;
        height: 20px;
    }
    .es-title {
        font-size: 14px;
    }
    .es-text {
        font-size: 12px;
    }

    /* Pills */
    .pill-row,
    .signal-grid {
        margin-top: var(--space-3);
    }
    .state-pill,
    .signal-pill {
        font-size: 11px;
        padding: 4px var(--space-2);
    }
    .signal-grid {
        flex-direction: column;
    }

    /* Breakdown bar */
    .breakdown-bar {
        height: 10px;
        margin-bottom: var(--space-4);
    }

    /* Mobile nav */
    .mobile-nav {
        padding: var(--space-1) var(--space-2);
    }
    .mobile-nav-header {
        padding-bottom: var(--space-1);
        margin-bottom: var(--space-1);
    }
    .mobile-user-name {
        font-size: 12px;
    }
    .mobile-user-avatar {
        width: 24px;
        height: 24px;
        font-size: 10px;
    }
    .mobile-action-btn {
        width: 28px;
        height: 28px;
    }
    .mobile-action-btn svg {
        width: 14px;
        height: 14px;
    }
    .mobile-nav-btn {
        font-size: 9px;
        padding: var(--space-1) 2px;
        gap: 2px;
    }
    .mobile-nav-btn svg {
        width: 18px;
        height: 18px;
    }
    .mobile-nav-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 0;
    }
}

/* === 375px (small phones) === */
@media (max-width: 375px) {
    .page-title {
        font-size: 18px;
    }
    .section-title {
        font-size: 16px;
    }
    .hero-title {
        font-size: 16px;
    }
    .live-stat-value {
        font-size: 20px;
    }
    .stat-value {
        font-size: 20px;
    }
    .score-ring {
        width: 70px;
        height: 70px;
    }
    .score-ring svg {
        width: 70px;
        height: 70px;
    }
    .score-num span:first-child {
        font-size: 20px;
    }
    .topbar-logo {
        font-size: 13px;
    }
    .logo-shape {
        width: 22px;
        height: 22px;
        font-size: 10px;
    }
    .child-selector {
        min-width: 60px;
        font-size: 9px;
    }
    .auth-card {
        padding: var(--space-4) var(--space-2);
    }
    .auth-logo-icon {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    .auth-logo-text {
        font-size: 20px;
    }
    .auth-title {
        font-size: 18px;
    }
    .live-stats-grid {
        gap: var(--space-2);
    }
    .section {
        padding: var(--space-2);
        margin-bottom: var(--space-2);
    }
    .subject-grid {
        grid-template-columns: 1fr;
    }
    .tabs-header {
        margin-bottom: var(--space-2);
    }
    .tab-btn {
        font-size: 10px;
    }
    .page-header {
        margin-bottom: var(--space-3);
    }
    .main-content {
        padding-bottom: 80px;
    }
}

/* Prevent iOS zoom on input focus */
@supports (-webkit-touch-callout: none) {
    input,
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* Prefers reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* Prevent horizontal overflow */
*,
*::before,
*::after {
    max-width: 100%;
}
body {
    overflow-x: hidden;
}
.dashboard {
    width: 100%;
}

/* History / Sessions */
.history-item,
.session-row {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-3);
    border-bottom: 1px solid var(--border-subtle);
    transition: var(--transition-smooth);
    border-radius: var(--radius-md);
    margin: var(--space-2) 0;
    position: relative;
}
.history-item::after,
.session-row::after {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.1), transparent);
    transition: width 0.3s ease;
}
.history-item:hover,
.session-row:hover {
    background: rgba(99, 102, 241, 0.04);
    border-color: rgba(99, 102, 241, 0.15);
    transform: translateX(4px);
}
.history-item:hover::after,
.session-row:hover::after {
    width: 4px;
}
.history-item:last-child,
.session-row:last-child {
    border-bottom: none;
}

.history-time {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-tertiary);
    min-width: 70px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.mono {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}
.history-info {
    flex: 1;
    min-width: 0;
}
.history-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.history-url {
    font-size: 13px;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-tag {
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 700;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    letter-spacing: 0.08em;
}
.history-tag.focused {
    background: rgba(16, 185, 129, 0.2);
    color: var(--brand-secondary);
}
.history-tag.neutral {
    background: rgba(99, 102, 241, 0.2);
    color: var(--brand-primary-light);
}
.history-tag.distracted {
    background: rgba(244, 63, 94, 0.2);
    color: var(--brand-accent);
}
.history-tag.idle {
    background: var(--bg-elevated);
    color: var(--text-tertiary);
}

.session-row {
    justify-content: space-between;
    padding: var(--space-5) var(--space-6);
    background: linear-gradient(135deg, var(--bg-surface) 0%, rgba(99, 102, 241, 0.03) 100%);
    border: 1px solid var(--border-default);
    border-left: 3px solid var(--brand-primary);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-3);
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}
.session-row::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 120px;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.03));
    pointer-events: none;
}
.session-row:hover {
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow:
        0 0 40px rgba(99, 102, 241, 0.1),
        var(--shadow-lg);
    transform: translateY(-2px) translateX(4px);
}
.session-date {
    font-weight: 700;
    font-size: 17px;
    margin-bottom: var(--space-1);
    color: var(--text-primary);
    letter-spacing: -0.01em;
}
.session-meta {
    font-size: 14px;
    color: var(--text-secondary);
}
.session-score-badge {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 800;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    letter-spacing: -0.01em;
    position: relative;
    overflow: hidden;
}
.session-score-badge::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent);
    pointer-events: none;
}
.session-score-badge.great {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.08));
    color: var(--brand-secondary);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.2);
}
.session-score-badge.ok {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(245, 158, 11, 0.08));
    color: var(--brand-warning);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.2);
}
.session-score-badge.poor {
    background: linear-gradient(135deg, rgba(244, 63, 94, 0.2), rgba(244, 63, 94, 0.08));
    color: var(--brand-accent);
    box-shadow: 0 4px 15px rgba(244, 63, 94, 0.2);
}

/* Distractions */
.distraction-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) 0;
    border-bottom: 1px solid var(--border-subtle);
    transition: var(--transition-smooth);
    position: relative;
}
.distraction-row:last-child {
    border-bottom: none;
}
.distraction-row::before {
    content: "";
    position: absolute;
    left: -var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 0;
    background: var(--brand-accent);
    border-radius: 2px;
    transition: height 0.2s ease;
}
.distraction-row:hover {
    padding-left: var(--space-2);
}
.distraction-row:hover::before {
    height: 60%;
}
.distraction-domain {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-weight: 600;
    font-size: 16px;
    color: var(--text-primary);
}
.dist-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--brand-accent);
    box-shadow: 0 0 12px var(--brand-accent);
    animation: distPulse 2s ease-in-out infinite;
}
@keyframes distPulse {
    0%,
    100% {
        box-shadow: 0 0 12px var(--brand-accent);
    }
    50% {
        box-shadow: 0 0 20px var(--brand-accent);
    }
}
.distraction-time {
    font-family: var(--font-mono);
    font-size: 15px;
    color: var(--text-secondary);
    font-weight: 600;
}

.distraction-log {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    margin-top: var(--space-2);
}
.distraction-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
}
.dist-domain {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}
.dist-count {
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--text-tertiary);
}

/* Alerts */
.alert-banner {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    font-size: 15px;
    margin-bottom: var(--space-3);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}
.alert-banner.bg-red-soft {
    background: var(--brand-accent-soft);
    color: var(--brand-accent);
    border: 1px solid rgba(244, 63, 94, 0.2);
}
.alert-banner.bg-amber-soft {
    background: var(--brand-warning-soft);
    color: var(--brand-warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

/* Subject cards */
.subject-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-5);
    margin-bottom: var(--space-6);
}
.subject-card {
    background: linear-gradient(135deg, var(--bg-surface) 0%, rgba(18, 18, 22, 0.5) 100%);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    text-align: center;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}
.subject-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), transparent);
    opacity: 0;
    transition: opacity var(--transition-smooth);
}
.subject-card::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--brand-primary), var(--brand-primary-light));
    transform: scaleX(0);
    transition: transform var(--transition-smooth);
}
.subject-card:hover {
    transform: translateY(-8px);
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: var(--shadow-glow);
}
.subject-card:hover::before {
    opacity: 1;
}
.subject-card:hover::after {
    transform: scaleX(1);
}
.sc-name {
    font-weight: 600;
    font-size: 12px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: var(--space-3);
}
.sc-score {
    font-family: var(--font-display);
    font-size: 36px;
    font-weight: 800;
    margin-bottom: var(--space-2);
    letter-spacing: -0.02em;
}
.sc-score.great {
    color: var(--brand-secondary);
    text-shadow: 0 0 30px rgba(16, 185, 129, 0.3);
}
.sc-score.ok {
    color: var(--brand-warning);
    text-shadow: 0 0 30px rgba(245, 158, 11, 0.3);
}
.sc-score.poor {
    color: var(--brand-accent);
    text-shadow: 0 0 30px rgba(244, 63, 94, 0.3);
}
.sc-meta {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Schedule editor */
.schedule-header {
    display: grid;
    grid-template-columns: 1fr 100px 100px 40px;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-4);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-tertiary);
    border-bottom: 1px solid var(--border-default);
    margin-bottom: var(--space-2);
}
.schedule-row {
    display: grid;
    grid-template-columns: 1fr 100px 100px 40px;
    gap: var(--space-3);
    align-items: center;
    padding: var(--space-1) 0;
}
.schedule-row input {
    background: var(--bg-base);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: var(--space-2) var(--space-3);
    color: var(--text-primary);
    font-size: 14px;
    width: 100%;
    transition: var(--transition-smooth);
}
.schedule-row input:focus {
    border-color: var(--brand-primary);
    background: var(--bg-surface);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}
.schedule-row input::-webkit-calendar-picker-indicator {
    filter: invert(0.7);
    cursor: pointer;
}

.btn-remove {
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-tertiary);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}
.btn-remove:hover {
    color: var(--brand-accent);
    border-color: var(--brand-accent);
    background: var(--brand-accent-soft);
}

.btn-ghost {
    padding: var(--space-2) var(--space-4);
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}
.btn-ghost:hover {
    color: var(--text-primary);
    border-color: var(--border-strong);
    background: var(--bg-elevated);
}

.btn-accent {
    padding: var(--space-2) var(--space-4);
    background: var(--brand-primary);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}
.btn-accent:hover {
    background: var(--brand-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

/* Empty states */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-12) var(--space-8);
    text-align: center;
    color: var(--text-tertiary);
    border: 1px dashed var(--border-default);
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.02), rgba(16, 185, 129, 0.02));
    min-height: 280px;
}
.es-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(99, 102, 241, 0.05));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-6);
    color: var(--text-tertiary);
    border: 1px solid var(--border-default);
}
.es-icon svg {
    width: 28px;
    height: 28px;
    stroke-width: 1.5;
}
.es-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
    letter-spacing: -0.01em;
}
.es-text {
    font-size: 14px;
    max-width: 32ch;
    line-height: 1.6;
    color: var(--text-tertiary);
}

.section-title {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    margin-bottom: var(--space-8);
    font-family: var(--font-display);
    position: relative;
    z-index: 1;
}

/* Design System Tokens
       --------------------------------------------------
       Primary:   #6366f1 (Indigo 500) - Primary Actions
       Secondary: #10b981 (Emerald 500) - Success/Focused
       Accent:    #f43f5e (Rose 500) - Danger/Distracted
       Warning:   #f59e0b (Amber 500) - Decent/Neutral

       Backgrounds: Zinc 950 base with custom deep surfaces
       Typography:  Geist (Sans/Display), Geist Mono
       Grid:        4px baseline, 8px/16px/24px/32px steps
       Elevation:   Multi-layered tinted shadows
       --------------------------------------------------
     */

/* Child Selector */
.child-selector {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: var(--space-2) var(--space-3);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    min-width: 140px;
}
.child-selector:hover {
    border-color: var(--border-strong);
    background: var(--bg-elevated);
}
.child-selector:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.child-selector option {
    background: var(--bg-surface);
    color: var(--text-primary);
}
.btn-add-child {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-2) var(--space-3);
    background: var(--brand-primary);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}
.btn-add-child:hover {
    background: var(--brand-primary-dark);
    transform: translateY(-1px);
}

/* Add Child Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);

    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-overlay.active {
    display: flex;
}
.modal-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-xl);
    animation: modalEnter 0.3s var(--transition-smooth);
}
@keyframes modalEnter {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}
.modal-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: var(--space-1);
}
.modal-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: var(--space-6);
}
.modal-field {
    margin-bottom: var(--space-4);
}
.modal-field label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}
.modal-field input {
    width: 100%;
    background: var(--bg-base);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    color: var(--text-primary);
    font-size: 16px;
    transition: var(--transition-smooth);
}
.modal-field input:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
    outline: none;
}
.modal-actions {
    display: flex;
    gap: var(--space-3);
    margin-top: var(--space-6);
}
.modal-actions button {
    flex: 1;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}
.btn-modal-cancel {
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
}
.btn-modal-cancel:hover {
    border-color: var(--border-strong);
    color: var(--text-primary);
}
.btn-modal-confirm {
    background: var(--brand-primary);
    border: none;
    color: white;
}
.btn-modal-confirm:hover {
    background: var(--brand-primary-dark);
}
.btn-modal-confirm:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.modal-error {
    display: none;
    padding: var(--space-3);
    background: var(--brand-accent-soft);
    border: 1px solid rgba(244, 63, 94, 0.2);
    border-radius: var(--radius-md);
    color: var(--brand-accent);
    font-size: 14px;
    margin-bottom: var(--space-4);
}
.modal-error.show {
    display: block;
}
