/* ========================================
   EstudioGrado - Study Planner
   Design System & Styles
   ======================================== */

/* --- Design tokens (Phase 1 redesign · editorial-academic) --- */
:root {
    /* Typography families */
    --font-display: "Instrument Serif", "Newsreader", Georgia, serif;
    --font-sans:    "Instrument Sans", "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    --font-mono:    "JetBrains Mono", "IBM Plex Mono", ui-monospace, monospace;

    /* Surface + ink (warm off-white system, light default) */
    --bg:        #faf8f4;
    --bg-elev:   #ffffff;
    --bg-sunken: #f2efe8;
    --bg-deep:   #ebe5d8;
    --ink:       #1a1714;
    --ink-soft:  #5a544c;
    --ink-mute:  #8f867a;
    --line:      #e7e2d8;
    --line-soft: #efeae0;

    /* Brand */
    --primary:        oklch(0.42 0.13 25);
    --primary-soft:   oklch(0.42 0.13 25 / 0.08);
    --primary-strong: oklch(0.36 0.13 25);
    --primary-ink:    #ffffff;

    /* Accents */
    --gold:     oklch(0.72 0.09 75);
    --sage:     oklch(0.60 0.06 150);
    --ink-blue: oklch(0.45 0.08 245);

    /* Semantic */
    --ok:   oklch(0.55 0.11 145);
    --warn: oklch(0.62 0.14 60);
    --crit: oklch(0.55 0.18 25);

    /* Radii */
    --r-sm: 6px;
    --r:    10px;
    --r-lg: 14px;
    --r-xl: 20px;

    /* Density (regular) */
    --pad: 18px;
    --gap: 16px;
    --row: 56px;

    /* Type scale */
    --t-xs:      11px;
    --t-sm:      13px;
    --t-base:    14.5px;
    --t-md:      16px;
    --t-lg:      19px;
    --t-xl:      24px;
    --t-2xl:     34px;
    --t-3xl:     48px;
    --t-display: 72px;

    /* Elevation */
    --shadow-sm: 0 1px 0 rgba(26,23,20,.04), 0 1px 2px rgba(26,23,20,.04);
    --shadow:    0 1px 0 rgba(26,23,20,.04), 0 8px 24px -12px rgba(26,23,20,.10);
    --shadow-lg: 0 24px 60px -16px rgba(26,23,20,.18);

    /* === Backwards-compat aliases (old token names → new system) === */
    --bg-primary:   var(--bg);
    --bg-secondary: var(--bg-elev);
    --bg-tertiary:  var(--bg-sunken);
    --bg-card:      var(--bg-elev);
    --bg-hover:     var(--line-soft);
    --bg-input:     var(--bg);

    --text-primary:   var(--ink);
    --text-secondary: var(--ink-soft);
    --text-tertiary:  var(--ink-mute);
    --text-inverse:   var(--primary-ink);

    --border:       var(--line);
    --border-light: var(--line);

    --accent:       var(--primary);
    --accent-hover: var(--primary-strong);
    --accent-soft:  var(--primary-soft);

    --success:      var(--ok);
    --success-soft: oklch(0.55 0.11 145 / 0.12);
    --warning:      var(--warn);
    --warning-soft: oklch(0.62 0.14 60 / 0.12);
    --danger:       var(--crit);
    --danger-soft:  oklch(0.55 0.18 25 / 0.12);

    /* Subject colors (kept functional) */
    --color-civil: #3b82f6;
    --color-penal: #ef4444;
    --color-constitucional: #f59e0b;
    --color-procesal: #8b5cf6;
    --color-comercial: #22c55e;
    --color-laboral: #ec4899;
    --color-administrativo: #06b6d4;
    --color-tributario: #f97316;
    --color-internacional: #6366f1;
    --color-custom: #94a3b8;

    --sidebar-width: 260px;
    --mobile-header-height: 56px;
    --radius:    var(--r);
    --radius-lg: var(--r-lg);
    --transition: 140ms ease;
}

/* --- Dark Theme --- */
[data-theme="dark"] {
    --bg:        #14120f;
    --bg-elev:   #1c1a16;
    --bg-sunken: #0e0d0b;
    --ink:       #f0ece4;
    --ink-soft:  #b0a89b;
    --ink-mute:  #7a7264;
    --line:      #2a2620;
    --line-soft: #221f1a;

    --primary:        oklch(0.62 0.13 25);
    --primary-soft:   oklch(0.62 0.13 25 / 0.14);
    --primary-strong: oklch(0.70 0.13 25);
    --primary-ink:    #14120f;

    --shadow-sm: 0 1px 0 rgba(0,0,0,.4);
    --shadow:    0 12px 30px -16px rgba(0,0,0,.6);
    --shadow-lg: 0 24px 60px -16px rgba(0,0,0,.7);
}

[data-theme="dark"] .landing {
    background: linear-gradient(160deg, #14120f 0%, #1c1a16 50%, #14120f 100%);
}
[data-theme="dark"] .landing-feature {
    background: rgba(28,26,22,.7);
}

/* --- Coming Soon --- */
.coming-soon {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: var(--bg, #faf8f4);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    overflow-y: auto;
}
.coming-soon-card {
    max-width: 520px;
    width: 100%;
    text-align: center;
    padding: 48px 32px;
}
.coming-soon-logo {
    display: inline-block;
    font-family: var(--font-display, Georgia, serif);
    font-style: italic;
    font-size: 48px;
    font-weight: 700;
    color: var(--ink, #3b2e1a);
    letter-spacing: -0.02em;
}
.coming-soon-title {
    font-family: var(--font-display, Georgia, serif);
    font-style: italic;
    font-size: clamp(32px, 6vw, 48px);
    font-weight: 400;
    color: var(--ink, #3b2e1a);
    margin: 8px 0 12px;
    letter-spacing: -0.01em;
}
.coming-soon-tagline {
    font-size: 15px;
    color: var(--ink-soft, #5c5142);
    line-height: 1.5;
    max-width: 380px;
    margin: 0 auto;
}
.coming-soon-divider {
    height: 1px;
    background: var(--line, #e5e0d6);
    margin: 28px 0;
}
.coming-soon-features {
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.coming-soon-feature {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}
.coming-soon-icon {
    flex: none;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--primary, #6b5b3f) 10%, transparent);
    color: var(--primary, #6b5b3f);
    display: grid;
    place-items: center;
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
}
.coming-soon-feature strong {
    display: block;
    font-size: 14px;
    color: var(--ink, #3b2e1a);
    margin-bottom: 3px;
}
.coming-soon-feature p {
    font-size: 13px;
    color: var(--ink-soft, #5c5142);
    line-height: 1.45;
    margin: 0;
}
.coming-soon-badge {
    display: inline-block;
    padding: 6px 20px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--primary, #6b5b3f) 12%, transparent);
    color: var(--primary, #6b5b3f);
    font-family: var(--font-mono, monospace);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 14px;
}
.coming-soon-sub {
    font-size: 14px;
    color: var(--ink-soft, #5c5142);
    line-height: 1.5;
    margin: 0 0 20px;
}
.coming-soon-contact {
    font-size: 12px;
    color: var(--ink-mute, #8a7d68);
    margin: 0;
}
.coming-soon-email {
    color: var(--primary, #6b5b3f);
    font-weight: 500;
}
.coming-soon.hidden { display: none; }

@media (max-width: 480px) {
    .coming-soon-card { padding: 32px 16px; }
    .coming-soon-logo { font-size: 40px; }
}

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--ink);
    font-size: var(--t-base);
    line-height: 1.5;
    display: flex;
    height: 100vh;
    overflow: hidden;
    text-rendering: optimizeLegibility;
}

/* --- Scrollbar (scoped to .main only) --- */
.main::-webkit-scrollbar {
    width: 10px;
}
.main::-webkit-scrollbar-track {
    background: transparent;
}
.main::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--ink) 12%, transparent);
    border-radius: 999px;
    border: 3px solid var(--bg);
}
.main::-webkit-scrollbar-thumb:hover {
    background: color-mix(in srgb, var(--ink) 20%, transparent);
}

/* --- Typography --- */
h1, h2 {
    font-family: var(--font-display);
    font-weight: 400;
    letter-spacing: -0.01em;
    line-height: 1.1;
    color: var(--ink);
}
h1 {
    font-size: var(--t-3xl);
}
h2 {
    font-size: var(--t-2xl);
}
h3 {
    font-family: var(--font-sans);
    font-size: var(--t-xl);
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.serif { font-family: var(--font-display); font-style: italic; }
.mono, .num { font-family: var(--font-mono); font-feature-settings: "tnum"; letter-spacing: -0.01em; }
.num { font-style: normal; }

.eyebrow {
    font-family: var(--font-mono);
    font-size: 10.5px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-mute);
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 6px;
}

/* --- Buttons (pill, editorial) --- */
.btn {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 8px 14px;
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    transition: background var(--transition), color var(--transition), border-color var(--transition), transform 0.12s ease;
}
.btn:hover { background: var(--line-soft); }
.btn:active { transform: scale(0.98); }

.btn-primary {
    background: var(--primary);
    color: var(--primary-ink);
    border-color: var(--primary);
}
.btn-primary:hover {
    background: var(--primary);
    filter: brightness(1.07);
}

.btn-outline {
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--line);
}
.btn-outline:hover {
    background: var(--line-soft);
    color: var(--ink);
    border-color: var(--line);
}

.btn-danger {
    background: var(--crit);
    color: var(--primary-ink);
    border-color: var(--crit);
}
.btn-danger:hover { background: var(--crit); filter: brightness(1.08); }

.btn-success {
    background: var(--ok);
    color: var(--primary-ink);
    border-color: var(--ok);
}
.btn-success:hover { background: var(--ok); filter: brightness(1.08); }

.btn-sm { padding: 5px 10px; font-size: 12px; min-height: 0; }
.btn-lg { padding: 12px 24px; font-size: var(--t-md); }
.btn-icon {
    padding: 0;
    width: 36px;
    height: 36px;
    border-radius: var(--r);
    background: transparent;
    color: var(--ink-soft);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: background var(--transition), color var(--transition);
}
.btn-icon:hover {
    background: var(--line-soft);
    color: var(--ink);
}

/* --- Sidebar (editorial redesign · Phase 2) --- */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background: var(--bg-sunken);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    padding: calc(18px + env(safe-area-inset-top, 0px)) 12px 12px;
    z-index: 100;
    transition: transform 0.3s ease;
    will-change: transform;
    contain: layout paint;
    overflow: hidden;
}
.nav::-webkit-scrollbar,
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: transparent; border-radius: 999px; }
.sidebar:hover::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--ink) 10%, transparent); }

/* Brand */
.brand {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 4px 10px 18px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 14px;
}
.brand-mark {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 28px;
    line-height: 1;
    color: var(--primary);
}
.brand-name {
    font-weight: 600;
    font-size: 15px;
    letter-spacing: -0.01em;
    color: var(--ink);
}
.brand-ver {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--ink-mute);
    margin-left: auto;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--ink-mute);
    cursor: pointer;
    padding: 4px;
    margin-left: 6px;
}
.sidebar-toggle:hover { color: var(--ink); }

/* Sidebar search */
.sidebar-search {
    position: relative;
    margin-bottom: 14px;
    padding: 0 4px;
}
.sidebar-search input {
    width: 100%;
    background: var(--bg-elev);
    border: 1px solid var(--line);
    border-radius: var(--r);
    font: inherit;
    color: var(--ink);
    font-size: 12.5px;
    padding: 7px 36px 7px 10px;
    outline: none;
    cursor: pointer;
    transition: border-color var(--transition);
}
.sidebar-search input::placeholder { color: var(--ink-mute); }
.sidebar-search input:hover { border-color: color-mix(in srgb, var(--ink) 18%, var(--line)); }
.sidebar-search input:focus { border-color: var(--primary); }
.sidebar-search .kbd-hint {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--ink-mute);
    pointer-events: none;
}

/* Nav */
.nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: var(--r);
    color: var(--ink-soft);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    background: transparent;
    border: none;
    text-align: left;
    transition: background var(--transition), color var(--transition);
}
.nav-item:hover {
    background: var(--line-soft);
    color: var(--ink);
}
.nav-item.active {
    background: var(--bg-elev);
    color: var(--ink);
    box-shadow: var(--shadow-sm);
}
.nav-icon {
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    color: var(--ink-mute);
    flex-shrink: 0;
}
.nav-item.active .nav-icon { color: var(--primary); }
.nav-label { flex: 1; }
.nav-kbd {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--ink-mute);
}

/* Sidebar countdown */
.sidebar-countdown {
    margin-top: 14px;
    padding: 14px 10px;
    border-top: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.sidebar-countdown-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
}
.sidebar-countdown-n {
    font-size: 30px;
    font-style: italic;
    color: var(--primary);
    line-height: 1;
}
.sidebar-countdown-l {
    font-size: 11px;
    color: var(--ink-mute);
}
.sidebar-countdown-pct {
    font-size: 10.5px;
    color: var(--ink-mute);
}

/* Sidebar footer (avatar row) */
.sidebar-foot {
    margin-top: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 4px;
    padding-right: 4px;
}
.avatar {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: var(--primary);
    color: var(--primary-ink);
    display: grid;
    place-items: center;
    font-family: var(--font-display);
    font-style: italic;
    font-size: 16px;
    flex-shrink: 0;
}
.sidebar-foot-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}
.sidebar-foot-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
}
.sidebar-foot-sub {
    font-size: 10.5px;
    color: var(--ink-mute);
}

/* Legacy footer alias (kept for safety) */
.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* --- Mobile Header --- */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: calc(var(--mobile-header-height) + env(safe-area-inset-top, 0px));
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 0.5px solid var(--line);
    align-items: center;
    justify-content: space-between;
    padding: env(safe-area-inset-top, 0px) 16px 0;
    z-index: 90;
}
.hamburger {
    background: none;
    border: none;
    color: var(--ink);
    cursor: pointer;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.tab-bar {
    display: none;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    padding: 8px 0 max(env(safe-area-inset-bottom, 0px), 12px);
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 0.5px solid var(--line);
    justify-content: space-around;
    z-index: 90;
}
.tab-btn {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    background: none; border: none; padding: 6px 8px;
    color: var(--ink-mute); cursor: pointer; font-size: 10px; font-weight: 400;
}
.tab-btn.active { color: var(--primary); font-weight: 600; }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

/* --- Main Content (anti-jank scroll container) --- */
.main {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-width: 0;
    height: 100vh;
    padding: 2rem;
    overflow-y: auto;
    overflow-x: hidden;
    contain: layout style;
    overscroll-behavior: contain;
    will-change: scroll-position;
}

.view.hidden { display: none; }

/* Page-level micro entrance (transform/opacity only — anti-jank) */
.view:not(.hidden) {
    animation: pageIn 0.32s cubic-bezier(0.2, 0.7, 0.2, 1);
}
@keyframes pageIn {
    from { opacity: 0; transform: translate3d(0, 6px, 0); }
    to   { opacity: 1; transform: translate3d(0, 0, 0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

/* --- Cards (lifted, anti-jank: layout/style containment only) --- */
.card {
    background: var(--bg-elev);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-lg);
    padding: var(--pad);
    margin-bottom: var(--gap);
    max-width: 100%;
    box-shadow: var(--shadow);
    contain: layout style;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

/* --- Countdown Card --- */
.countdown-card {
    background: linear-gradient(135deg, var(--accent) 0%, #6366f1 100%);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    margin-bottom: 1.5rem;
    color: white;
}
.countdown-label {
    font-size: 0.9rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}
.countdown-number {
    font-size: 4.5rem;
    font-weight: 800;
    line-height: 1.1;
    margin: 0.25rem 0;
}
.countdown-date {
    font-size: 0.9rem;
    opacity: 0.85;
}

/* --- Stats Grid --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    text-align: center;
}
.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
}
.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* --- Today's blocks --- */
.today-blocks {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.block-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-primary);
    border-radius: var(--radius);
    border-left: 3px solid var(--accent);
}
.block-item .block-color {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.block-item .block-info {
    flex: 1;
    min-width: 0;
}
.block-item .block-subject {
    font-weight: 600;
    font-size: 0.9rem;
}
.block-item .block-topic {
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.block-item .block-time {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    flex-shrink: 0;
}
.block-item .block-check {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-light);
    border-radius: 4px;
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
    transition: opacity var(--transition), background var(--transition);
}
.block-item .block-check:checked {
    background: var(--success);
    border-color: var(--success);
}
.block-item .block-check:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
}
.block-actions {
    display: flex;
    gap: 0.25rem;
}

/* --- Activity List --- */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.activity-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.activity-text { flex: 1; color: var(--text-secondary); }
.activity-time { color: var(--text-tertiary); font-size: 0.8rem; flex-shrink: 0; }

/* --- Empty State --- */
.empty-state {
    text-align: center;
    color: var(--text-tertiary);
    padding: 2rem 1rem;
    font-size: 0.9rem;
}

/* --- Subjects Grid --- */
.subjects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
    gap: 1rem;
}
.subject-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color var(--transition);
}
.subject-card:hover {
    border-color: var(--border-light);
}
.subject-card-header {
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}
.subject-card-header .subject-name {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 600;
    font-size: 1rem;
}
.subject-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}
.subject-card-header .subject-actions {
    display: flex;
    gap: 0.25rem;
}
.subject-progress-bar {
    height: 3px;
    background: var(--bg-primary);
}
.subject-progress-fill {
    height: 100%;
    transition: width 0.5s ease;
    border-radius: 0 3px 3px 0;
}
.subject-topics {
    padding: 0.5rem 0;
    max-height: 300px;
    overflow-y: auto;
}
.topic-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 1.25rem;
    font-size: 0.875rem;
    transition: background var(--transition);
}
.topic-item:hover {
    background: var(--bg-hover);
}
.topic-status {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--border-light);
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    transition: background var(--transition), color var(--transition);
}
.topic-status.in-progress {
    border-color: var(--warning);
    background: var(--warning-soft);
    color: var(--warning);
}
.topic-status.done {
    border-color: var(--success);
    background: var(--success);
    color: white;
}
.topic-content {
    flex: 1;
    min-width: 0;
}
.topic-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.topic-name.is-done {
    text-decoration: line-through;
    color: var(--text-tertiary);
}
.topic-actions {
    display: flex;
    gap: 0.15rem;
    opacity: 0;
    transition: opacity var(--transition);
}
.topic-item:hover .topic-actions {
    opacity: 1;
}
.subject-card-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.subject-stats {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}
.btn-add-topic {
    font-size: 0.8rem;
    color: var(--accent);
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: color var(--transition);
}
.btn-add-topic:hover { color: var(--accent-hover); }

/* --- Planner Grid --- */
.planner-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.week-label {
    font-weight: 600;
    font-size: 0.95rem;
    min-width: 200px;
    text-align: center;
}
.planner-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    grid-template-rows: 1fr;
    gap: 0.5rem;
    height: 520px;
}
.planner-day {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    max-height: 100%;
}
.planner-day.is-today {
    border-color: var(--accent);
}
.planner-day-header {
    padding: 0.75rem;
    text-align: center;
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
}
.planner-day-header .day-name {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
}
.planner-day-header .day-number {
    font-size: 1.3rem;
    font-weight: 700;
    margin-top: 0.15rem;
}
.planner-day.is-today .day-number {
    color: var(--accent);
}
.planner-day-blocks {
    flex: 1;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    overflow-y: auto;
}
.planner-block {
    padding: 0.4rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    border-left: 3px solid var(--accent);
    background: var(--bg-primary);
    cursor: pointer;
    transition: background var(--transition);
    position: relative;
    overflow: hidden;
    min-width: 0;
}
.planner-block:hover {
    background: var(--bg-hover);
}
.planner-block .pb-subject {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.planner-block .pb-topic {
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.planner-block .pb-time {
    color: var(--text-tertiary);
    font-size: 0.7rem;
}
.planner-block.completed {
    opacity: 0.5;
}
.planner-block .pb-delete {
    position: absolute;
    top: 2px;
    right: 4px;
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity var(--transition);
    padding: 2px;
}
.planner-block:hover .pb-delete {
    opacity: 1;
}
.planner-day-add {
    padding: 0.35rem;
    text-align: center;
}
.planner-day-add button {
    width: 100%;
    padding: 0.3rem;
    background: none;
    border: 1px dashed var(--border);
    border-radius: 6px;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 0.75rem;
    transition: background var(--transition), color var(--transition);
}
.planner-day-add button:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

/* --- Timer --- */
.timer-container {
    max-width: 500px;
    margin: 0 auto;
    text-align: center;
}
.timer-display {
    margin: 2rem 0;
}
.timer-circle {
    width: 250px;
    height: 250px;
    border-radius: 50%;
    border: 4px solid var(--border);
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    background: var(--bg-card);
    transition: border-color 0.5s ease;
}
.timer-circle.running {
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.15);
}
.timer-circle.break-time {
    border-color: var(--success);
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.15);
}
.timer-time {
    font-size: 3.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.timer-phase {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}
.timer-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
}
.timer-config {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
    text-align: left;
}
.timer-select label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}
.timer-select select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.875rem;
}
.timer-settings {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    text-align: left;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.timer-setting label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}
.timer-setting input {
    width: 100%;
    padding: 0.4rem 0.6rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.875rem;
}

/* --- Progress View --- */
.progress-overview {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}
.progress-bars {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.progress-bar-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.progress-bar-label {
    width: 160px;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}
.progress-bar-track {
    flex: 1;
    height: 24px;
    background: var(--bg-primary);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}
.progress-bar-fill {
    height: 100%;
    border-radius: 12px;
    transition: width 0.8s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: white;
    min-width: fit-content;
}
.progress-bar-percent {
    font-size: 0.8rem;
    color: var(--text-secondary);
    width: 45px;
    text-align: right;
    flex-shrink: 0;
}

/* Progress chart (bar chart) */
.progress-chart {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.chart-bar-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.chart-bar-label {
    width: 160px;
    font-size: 0.85rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.chart-bar-track {
    flex: 1;
    height: 20px;
    background: var(--bg-primary);
    border-radius: 10px;
    overflow: hidden;
}
.chart-bar-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.8s ease;
}
.chart-bar-value {
    font-size: 0.8rem;
    color: var(--text-secondary);
    width: 50px;
    text-align: right;
    flex-shrink: 0;
}

/* Heatmap */
.heatmap {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    padding: 0.5rem 0;
}
.heatmap-cell {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    background: var(--bg-primary);
    position: relative;
    cursor: default;
}
.heatmap-cell.level-1 { background: rgba(59, 130, 246, 0.2); }
.heatmap-cell.level-2 { background: rgba(59, 130, 246, 0.4); }
.heatmap-cell.level-3 { background: rgba(59, 130, 246, 0.6); }
.heatmap-cell.level-4 { background: rgba(59, 130, 246, 0.85); }
.heatmap-cell[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    white-space: nowrap;
    z-index: 10;
    margin-bottom: 4px;
}

/* --- Settings --- */
.settings-col { max-width: 820px; width: 100%; display: flex; flex-direction: column; gap: 22px; }
.cfg-field { display: flex; flex-direction: column; gap: 6px; }
.cfg-field label { font-size: 12.5px; color: var(--ink-soft); font-weight: 500; }
.cfg-hint { font-size: 10.5px; color: var(--ink-mute); }
.plan-hours-warning { display: block; font-size: 11px; color: var(--warn, #c8704c); margin-top: 4px; }
.input {
    width: 100%; padding: 0.6rem 0.75rem; background: var(--bg-elev);
    border: 1px solid var(--line); border-radius: 6px; color: var(--ink);
    font-size: 1rem; font-family: inherit; transition: border-color .2s;
    box-sizing: border-box;
}
.input:focus { outline: none; border-color: var(--primary); }
.switch-btn {
    width: 46px; height: 26px; border-radius: 999px; border: 0; padding: 0;
    background: var(--line); position: relative; cursor: pointer; transition: background .2s; flex-shrink: 0;
}
.switch-btn[aria-checked="true"] { background: var(--primary); }
.switch-thumb {
    position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
    border-radius: 999px; background: #fff; transition: left .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch-btn[aria-checked="true"] .switch-thumb { left: 23px; }
.form-group {
    margin-bottom: 1.25rem;
}
.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}
.form-group input:not([type="checkbox"]):not([type="radio"]),
.form-group select,
.form-group textarea {
    width: 100%;
    max-width: 100%;
    padding: 0.6rem 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color var(--transition);
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}
.time-input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    max-width: 100%;
}
.form-actions .btn {
    white-space: normal;
}

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 1rem;
}
.modal-overlay.hidden { display: none; }
.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem;
}
.modal-close:hover { color: var(--text-primary); }
.modal-body {
    padding: 1.25rem;
}
.modal-body .form-group:last-child { margin-bottom: 0; }
.modal-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* --- Eve mode (exam countdown) --- */
.eve {
    background: radial-gradient(ellipse at top, #1a1815 0%, #0c0b09 70%);
    color: #f0ece4; padding: 48px 56px;
    display: flex; flex-direction: column; gap: 28px;
    min-height: 80vh; border-radius: 16px;
}
.eve-top { display: flex; justify-content: space-between; align-items: center; }
.eve-brand { font-style: italic; font-size: 28px; color: #c8704c; }
.eve-mode-label { font-size: 11px; letter-spacing: 0.18em; color: #7a7264; text-transform: uppercase; }
.eve-date { font-size: 11px; letter-spacing: 0.14em; color: #7a7264; }
.eve-hero { text-align: center; margin-top: 16px; }
.eve-label { font-size: 11px; letter-spacing: 0.2em; color: #7a7264; text-transform: uppercase; margin-bottom: 14px; }
.eve-countdown { display: flex; justify-content: center; align-items: baseline; gap: 16px; }
.eve-hours { font-style: italic; font-size: 168px; line-height: 0.9; color: #c8704c; letter-spacing: -0.02em; }
.eve-mins { font-style: italic; font-size: 100px; line-height: 0.9; color: #a89f8e; }
.eve-unit { font-size: 0.42em; color: #7a7264; }
.eve-message { margin-top: 14px; font-style: italic; font-size: 24px; color: #d8ccb8; max-width: 600px; margin-inline: auto; line-height: 1.35; }
.eve-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 12px; }
.eve-card {
    background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.08);
    border-radius: 16px; padding: 22px; min-height: 200px;
    display: flex; flex-direction: column;
}
.eve-card-num { font-size: 10px; letter-spacing: 0.2em; color: #7a7264; text-transform: uppercase; }
.eve-card-title { font-style: italic; font-size: 32px; margin-top: 12px; line-height: 1.1; font-weight: 400; }
.eve-breathe {
    width: 50px; height: 50px; border-radius: 999px;
    background: radial-gradient(circle, #c8704c 0%, rgba(200,112,76,.3) 60%, transparent 100%);
    animation: breathe 4s ease-in-out infinite;
}
@keyframes breathe { 0%, 100% { transform: scale(1); opacity: .7; } 50% { transform: scale(1.4); opacity: 1; } }
.eve-btn-outline {
    margin-top: 14px; padding: 10px 16px; border-radius: 999px;
    background: transparent; border: 1px solid rgba(255,255,255,.2);
    color: #d8ccb8; cursor: pointer; font-size: 13px;
}
.eve-sleep-box {
    margin-top: 14px; padding: 12px;
    background: rgba(200,112,76,.08); border-radius: 10px;
    border: 1px dashed rgba(200,112,76,.3);
}
.eve-footer { text-align: center; margin-top: 8px; font-style: italic; font-size: 18px; color: #7a7264; max-width: 600px; margin-inline: auto; line-height: 1.5; }
.eve-section-row {
    display: flex; justify-content: space-between;
    font-family: var(--font-mono); font-size: 11.5px; color: #d8ccb8;
    padding: 4px 0; border-bottom: 1px dashed rgba(255,255,255,.06);
}
.eve-section-row span:last-child { color: #7a7264; }
@media (max-width: 768px) {
    .eve { padding: 24px 20px; }
    .eve-hours { font-size: 80px; }
    .eve-mins { font-size: 56px; }
    .eve-grid { grid-template-columns: 1fr; }
    .eve-card-title { font-size: 24px; }
}

/* --- Focus overlays --- */
.focus-overlay {
    position: fixed; inset: 0; z-index: 9000;
    display: flex; flex-direction: column;
    padding: 40px 56px 32px;
    background: #f7f3ea; color: #1a1714;
    font-family: var(--font-sans);
}
.focus-dark {
    background: radial-gradient(ellipse at center, #1f1c17 0%, #0f0d0a 100%);
    color: #f0ece4;
}
body.focus-active .sidebar, body.focus-active .main,
body.focus-active .modal-overlay, body.focus-active .toast-container { display: none; }
.focus-top { display: flex; justify-content: space-between; align-items: center; }
.focus-brand { font-style: italic; font-size: 28px; color: #7d2b2b; }
.focus-brand-warm { color: #c8704c; }
.focus-mode-label { font-size: 11px; letter-spacing: 0.16em; color: #8a8275; text-transform: uppercase; }
.focus-exit {
    background: transparent; border: 1px solid #d9d2c4; border-radius: 999px;
    padding: 6px 14px; font-family: var(--font-mono); font-size: 11px; color: #6a6358; cursor: pointer;
}
.focus-exit-dark { border-color: rgba(255,255,255,.15); color: #a89f8e; }
.focus-center {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 22px;
}
.focus-meta { font-size: 11px; letter-spacing: 0.2em; color: #a89f8e; text-transform: uppercase; }
.focus-task { font-style: italic; font-size: 44px; line-height: 1.05; max-width: 700px; text-align: center; font-weight: 400; }
.focus-ring { position: relative; width: 380px; height: 380px; }
.focus-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.focus-ring .track { stroke: #e5dfd1; }
.focus-ring .fill { stroke: #7d2b2b; stroke-linecap: round; }
.focus-ring-time {
    position: absolute; inset: 0; display: grid; place-items: center;
    font-size: 88px; letter-spacing: -0.03em; font-weight: 400; white-space: nowrap;
}
.focus-controls { display: flex; gap: 14px; align-items: center; }
.focus-btn {
    width: 56px; height: 56px; border-radius: 999px;
    border: 1px solid #d9d2c4; background: #fff; cursor: pointer; font-size: 20px;
    display: grid; place-items: center;
}
.focus-btn-main {
    width: 72px; height: 72px; border: 0;
    background: #7d2b2b; color: #fff;
    font-family: var(--font-display); font-style: italic; font-size: 24px;
}
.focus-hints {
    display: flex; justify-content: center; gap: 22px;
    font-size: 11px; color: #a89f8e;
}
.focus-hints b { color: #7d6f5f; }

/* Focus flashcard mode */
.focus-fc-progress { font-size: 13px; color: #a89f8e; }
.focus-fc-bar { width: 120px; height: 2px; background: rgba(255,255,255,.1); border-radius: 999px; overflow: hidden; }
.focus-fc-bar-fill { height: 100%; background: #c8704c; transition: width .3s; }
.focus-fc-section { font-size: 11px; letter-spacing: 0.2em; color: #7d7565; text-transform: uppercase; text-align: center; }
.focus-fc-question {
    font-style: italic; font-size: 52px; line-height: 1.12; font-weight: 400;
    text-align: center; text-wrap: balance; max-width: 820px;
}
.focus-fc-answer {
    font-size: 18px; line-height: 1.6; max-width: 700px; text-align: center;
    color: #d0c9b8; margin-top: 12px; font-style: normal;
}
.focus-fc-rate { display: flex; justify-content: center; gap: 14px; }
.focus-fc-rate-btn {
    background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.1);
    border-radius: 12px; padding: 16px 22px; cursor: pointer;
    display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 140px;
    color: #f0ece4; font-size: 14px;
}
.focus-fc-rate-btn:hover { background: rgba(255,255,255,.07); }
.focus-fc-rate-key { font-size: 10.5px; }

@media (max-width: 600px) {
    .focus-overlay { padding: 20px 24px 16px; }
    .focus-task { font-size: 28px; }
    .focus-ring { width: 260px; height: 260px; }
    .focus-ring-time { font-size: 56px; }
    .focus-fc-question { font-size: 32px; }
    .focus-fc-rate-btn { min-width: 80px; padding: 12px 14px; }
}

/* --- Toast --- */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 360px;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--accent); }

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* --- Flashcards --- */
.fc-header-actions {
    display: flex;
    gap: 0.5rem;
}
.fc-filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.fc-filter {
    padding: 0.4rem 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.85rem;
    max-width: 200px;
}
.fc-cards-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.fc-card-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-primary);
    border-radius: var(--radius);
    border-left: 3px solid var(--accent);
    transition: background var(--transition);
}
.fc-card-item:hover {
    background: var(--bg-hover);
}
.fc-card-front {
    flex: 1;
    min-width: 0;
    font-size: 0.9rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.fc-card-meta {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    flex-shrink: 0;
}
.fc-card-actions {
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity var(--transition);
}
.fc-card-item:hover .fc-card-actions {
    opacity: 1;
}

/* Study mode overlay */
.fc-study-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    z-index: 250;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.fc-study-overlay.hidden { display: none; }
.fc-study-header {
    width: 100%;
    max-width: 600px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.fc-study-card-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0 1.5rem;
}
.fc-study-card {
    width: 100%;
    max-width: 540px;
    min-height: 220px;
    cursor: pointer;
}
.fc-study-card-inner {
    position: relative;
    width: 100%;
    min-height: 220px;
    transition: transform 0.5s ease;
    transform-style: preserve-3d;
}
.fc-study-card-inner.flipped .fc-study-front { display: none; }
.fc-study-card-inner.flipped .fc-study-back { display: flex; }
.fc-study-front,
.fc-study-back {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    text-align: left;
    min-height: 220px;
    max-height: 70vh;
    overflow-y: auto;
}
.fc-study-back {
    display: none;
}
.fc-study-subject {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    align-self: flex-start;
}
.fc-study-content {
    font-size: 1rem;
    line-height: 1.65;
    word-break: break-word;
    width: 100%;
}
.fc-study-content p { margin: 0 0 0.5em; }
.fc-study-content p:last-child { margin-bottom: 0; }
.fc-study-content strong { color: var(--accent); }
.fc-study-hint {
    position: absolute;
    bottom: 1rem;
    font-size: 0.75rem;
    color: var(--text-tertiary);
}
.fc-study-actions {
    width: 100%;
    max-width: 500px;
    display: flex;
    gap: 0.5rem;
    padding: 1.5rem;
}
.fc-study-actions.hidden { display: none; }
.fc-study-actions .btn {
    flex: 1;
    padding: 0.75rem 0.5rem;
    font-size: 0.85rem;
    line-height: 1.3;
    border: none;
}
.fc-btn-sub {
    font-size: 0.7rem;
    font-weight: 400;
    opacity: 0.8;
}
.fc-btn-again { background: var(--danger); color: white; }
.fc-btn-hard { background: var(--warning); color: var(--text-inverse); }
.fc-btn-good { background: var(--success); color: white; }
.fc-btn-easy { background: var(--accent); color: white; }
.fc-btn-again:hover { background: #dc2626; }
.fc-btn-hard:hover { background: #d97706; }
.fc-btn-good:hover { background: #16a34a; }
.fc-btn-easy:hover { background: #2563eb; }

/* --- Weekly Goals --- */
.goals-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    text-align: center;
}
.goal-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
}
.goal-ring {
    position: relative;
    width: 80px;
    height: 80px;
}
.goal-ring-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}
.goal-ring-bg {
    fill: none;
    stroke: var(--border);
    stroke-width: 3;
}
.goal-ring-fill {
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dasharray 0.8s ease;
}
.goal-ring-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
}
.goal-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}
.goal-detail {
    font-size: 0.7rem;
    color: var(--text-tertiary);
}

@media (max-width: 480px) {
    .goal-ring { width: 64px; height: 64px; }
    .goal-ring-text { font-size: 0.75rem; }
}

/* --- Weakness Analysis --- */
.weakness-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.weakness-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    background: var(--bg-primary);
    border-radius: var(--radius);
    border-left: 3px solid var(--border);
}
.weakness-rank {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-tertiary);
    min-width: 1.5rem;
    text-align: center;
}
.weakness-info {
    flex: 1;
    min-width: 0;
}
.weakness-name {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
}
.weakness-detail {
    font-size: 0.7rem;
    color: var(--text-tertiary);
}
.weakness-bar-track {
    width: 80px;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    flex-shrink: 0;
}
.weakness-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}
.weakness-score-badge {
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 2.5rem;
    text-align: center;
    flex-shrink: 0;
}
.weakness-item.severity-high { border-left-color: var(--danger); }
.weakness-item.severity-mid { border-left-color: var(--warning); }
.weakness-item.severity-low { border-left-color: var(--success); }
.weakness-recommendation {
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
    background: var(--accent-soft);
    border-radius: var(--radius);
    color: var(--accent);
    margin-top: 0.5rem;
}

/* --- Quick Review Bar --- */
.quick-review-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--success-soft);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: var(--radius-lg);
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    gap: 1rem;
}
.quick-review-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.quick-review-count {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--success);
}
.quick-review-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* --- Streak Enhancement --- */
.stat-card-streak {
    position: relative;
    overflow: hidden;
    transition: border-color 0.3s ease, background 0.3s ease;
}
.streak-message {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    font-weight: 500;
    min-height: 1.1em;
}
.stat-card-streak.streak-warm {
    border-color: var(--warning);
}
.stat-card-streak.streak-warm .stat-value {
    color: var(--warning);
}
.stat-card-streak.streak-hot {
    border-color: #f97316;
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.1) 0%, rgba(239, 68, 68, 0.1) 100%);
}
.stat-card-streak.streak-hot .stat-value {
    color: #f97316;
}

/* --- Topic Notes --- */
.topic-notes-preview {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: 0.1rem;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .planner-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: min(86vw, 360px);
        max-width: calc(100vw - 24px);
        height: 100dvh;
        padding: max(16px, env(safe-area-inset-top, 0px)) 12px max(16px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
        transform: translateX(-100%);
        box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-toggle {
        display: block;
    }
    .sidebar-overlay.visible {
        display: block;
    }
    .mobile-header {
        display: flex;
    }
    .tab-bar {
        display: flex;
    }
    .main {
        margin-left: 0;
        padding: 1rem;
        padding-top: calc(var(--mobile-header-height) + env(safe-area-inset-top, 0px) + 1rem);
        padding-bottom: 80px;
    }
    .page-head { padding-bottom: 16px; }
    .page-head h1 { font-size: 1.6rem; }
    .page-head .subtitle { font-size: 13px; }
    .page-head-actions { gap: 6px; flex-wrap: wrap; }
    .planner-grid {
        grid-template-columns: 1fr;
        height: auto;
    }
    .planner-day {
        min-height: auto;
        max-height: 350px;
    }
    .subjects-grid {
        grid-template-columns: 1fr;
    }
    .pomo { grid-template-columns: 1fr; }
    .pomo-ring { width: 260px; height: 260px; }
    .pomo-ring-time { font-size: 56px; }
    .deck-wrap { grid-template-columns: 1fr; }
    .deck-list { max-height: 200px; overflow-y: auto; }
    .flashcard { min-height: 260px; }
    .fc-rate { gap: 6px; }
    .fc-rate-btn { min-width: 0; flex: 1; padding: 10px 8px; }
    .fc-stats-grid.grid.g-3 { grid-template-columns: 1fr 1fr; }
    .grid.g-4 { grid-template-columns: repeat(2, 1fr); }
    .tutor { grid-template-columns: 1fr; }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .hero { gap: 16px; padding: 20px; }
    .hero-days { font-size: 72px; }
    .hero-progress { flex-direction: column; gap: 8px; }
    .progress-bar-label,
    .chart-bar-label {
        width: 100px;
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .main {
        padding: 0.5rem;
        padding-top: calc(var(--mobile-header-height) + env(safe-area-inset-top, 0px) + 1rem);
        padding-bottom: 80px;
    }
    .card { padding: 14px; }
    .page-head h1 { font-size: 1.35rem; }
    .hero-days { font-size: 56px; }
    .pomo-ring { width: 220px; height: 220px; }
    .pomo-ring-time { font-size: 48px; }
    .flashcard { min-height: 220px; }
    .grid.g-2 { grid-template-columns: 1fr; }
    .grid.g-3 { grid-template-columns: 1fr; }
    .grid.g-4 { grid-template-columns: 1fr; }
    .planner-grid { gap: 0.35rem; }
    .progress-bar-label,
    .chart-bar-label {
        width: 80px;
        font-size: 0.7rem;
    }
    #sim-count-btns { flex-wrap: wrap; }
    #sim-materias { grid-template-columns: 1fr; }
}

/* --- Study Plan --- */
.view-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 1rem;
    flex-wrap: wrap;
}

.plan-summary {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.plan-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}
.plan-summary-row:last-child { border-bottom: none; }

.plan-warning {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: rgba(234, 179, 8, 0.15);
    border: 1px solid rgba(234, 179, 8, 0.3);
    border-radius: var(--radius);
    color: #eab308;
    font-size: 0.85rem;
}
.plan-info {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: var(--radius);
    color: #60a5fa;
    font-size: 0.85rem;
}
.plan-warning-soft {
    margin-top: 0.5rem;
    padding: 0.6rem 0.75rem;
    background: color-mix(in srgb, var(--primary) 8%, transparent);
    border-left: 3px solid var(--primary);
    border-radius: 0 var(--r-sm, 4px) var(--r-sm, 4px) 0;
    font-size: 0.82rem;
    color: var(--ink-mute, #6b5b3f);
    line-height: 1.45;
}
.plan-summary-row strong { text-align: right; max-width: 60%; }
.plan-summary-library { opacity: 0.6; font-size: 0.85rem; }
.scope-status-ok { color: var(--success, #16a34a); }
.scope-status-warn { color: var(--warning, #d97706); }
.scope-coverage {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-size: 0.82rem;
    line-height: 1.45;
}
.scope-tier { display: flex; align-items: baseline; gap: 0.5rem; }
.scope-dot {
    flex: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    position: relative;
    top: -1px;
}
.scope-dot-included { background: var(--success, #16a34a); }
.scope-dot-reference { background: var(--ink-mute, #a89b8c); }
.scope-dot-out { background: var(--line, #d5cec4);
}

/* --- Setup modal (initial plan configuration) --- */

.modal-setup { max-width: 560px; }

.tpl-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 1rem;
}

.tpl-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
    text-align: left;
    font-family: inherit;
    color: var(--ink, var(--text-primary));
}

.tpl-card:hover {
    border-color: var(--accent);
}

.tpl-card.active {
    border-color: var(--accent);
    background: var(--accent-bg, rgba(124,131,237,0.06));
}

.tpl-card-label {
    font-weight: 700;
    font-size: 0.95rem;
}

.tpl-card-duration {
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: 600;
}

.tpl-card-hours,
.tpl-card-rec {
    font-size: 0.75rem;
    color: var(--ink-soft, var(--text-secondary));
}

.tpl-card-focus {
    font-size: 0.75rem;
    color: var(--ink-mute, var(--text-tertiary));
    margin-top: 2px;
}

.tpl-card-coverage {
    font-size: 0.7rem;
    color: var(--ink-mute, var(--text-tertiary));
    font-style: italic;
}

.setup-config {
    border-top: 1px solid var(--border);
    padding-top: 1rem;
    margin-top: 0.5rem;
}

.setup-field {
    margin-bottom: 1rem;
}

.setup-field label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
    color: var(--ink, var(--text-primary));
}

.setup-range-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.setup-range-row input[type="range"] {
    flex: 1;
    accent-color: var(--accent);
}

.setup-range-row span {
    min-width: 36px;
    font-weight: 600;
    font-size: 0.9rem;
    text-align: right;
}

.setup-hint {
    font-size: 0.78rem;
    color: var(--crit, var(--error));
    margin-top: 4px;
}

.setup-summary {
    font-size: 0.85rem;
    color: var(--ink-soft, var(--text-secondary));
    padding: 8px 12px;
    background: var(--bg-sunken, var(--bg-primary));
    border-radius: var(--r-sm, var(--radius));
    margin-top: 0.5rem;
}

@media (max-width: 480px) {
    .tpl-grid { grid-template-columns: 1fr; }
    .modal-setup { max-width: 100%; }
}

.block-type-badge {
    display: inline-block;
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 8px;
    vertical-align: middle;
    margin-left: 4px;
    font-weight: 600;
    text-transform: uppercase;
}
.block-type-badge.review {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}
.block-type-badge.flashcard {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}
.block-type-badge.simulacro {
    background: rgba(249, 115, 22, 0.2);
    color: #f97316;
}
.block-type-badge.preexam {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}
.block-type-badge.agent {
    background: color-mix(in srgb, var(--accent) 20%, transparent);
    color: var(--accent);
}
.block-type-badge.error-review {
    background: color-mix(in srgb, var(--crit) 18%, transparent);
    color: var(--crit);
}
.block-adapted-badge {
    font-size: 0.55rem;
    color: var(--accent);
    margin-left: 4px;
}
.block-item-actionable {
    cursor: pointer;
}
.block-item-actionable:hover {
    background: rgba(255, 255, 255, 0.05);
}
.pb-action {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 2px 6px;
    border-radius: 4px;
    opacity: 0.7;
}
.pb-action:hover {
    opacity: 1;
    background: rgba(59, 130, 246, 0.15);
}

.adaptive-sections-list {
    margin: 12px 0;
}
.adaptive-section-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 0.9rem;
}
.adaptive-section-item small {
    color: var(--text-secondary);
}
.adaptive-score-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--warning);
    flex-shrink: 0;
}

.block-pdf-ref {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.pb-pdf {
    font-size: 0.65rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.planner-block.auto-generated {
    border-right: 2px solid rgba(34, 197, 94, 0.4);
}

.block-item-auto {
    background: rgba(34, 197, 94, 0.05);
}

/* --- Weight Editor --- */
.weight-editor { display: flex; flex-direction: column; gap: 0; }
.weight-row {
    display: flex; align-items: center; gap: 16px;
    padding: 10px 0; border-bottom: 1px dashed var(--line-soft);
}
.weight-row:last-child { border-bottom: 0; }
.weight-info { flex: 1; }
.weight-info-name { font-size: 13.5px; }
.weight-info-meta { font-size: 11px; color: var(--ink-mute); margin-top: 2px; font-family: var(--font-mono); }
.weight-controls { display: flex; align-items: center; gap: 8px; }
.weight-val {
    width: 44px; text-align: center; font-size: 14px; padding: 5px 0;
    border: 1px solid var(--line); border-radius: 6px; background: var(--bg-elev);
    font-family: var(--font-mono);
}
.weight-val.hi { color: var(--primary); font-weight: 600; }
@media (max-width: 600px) {
    .settings-col .grid.g-2 { grid-template-columns: 1fr; }
    .settings-col .row.between { flex-direction: column; align-items: stretch; gap: 12px; }
}

/* --- Landing Page --- */
.landing {
    position: fixed;
    inset: 0;
    background: linear-gradient(160deg, var(--bg) 0%, var(--bg-sunken) 50%, var(--bg) 100%);
    z-index: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    overflow-y: auto;
}

.landing-content {
    width: 100%;
    max-width: 560px;
    text-align: center;
}

.landing-hero {
    margin-bottom: 2.5rem;
}

.landing-logo {
    font-size: 4rem;
    display: block;
    margin-bottom: 0.75rem;
    line-height: 1;
    color: var(--primary);
}

.landing-title {
    font-family: var(--font-display);
    font-size: var(--t-3xl);
    font-weight: 400;
    font-style: italic;
    color: var(--ink);
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;
}

.landing-tagline {
    font-family: var(--font-sans);
    font-size: var(--t-md);
    color: var(--ink-soft);
    line-height: 1.5;
}

.landing-features {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
    text-align: left;
}

.landing-feature {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-elev);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    align-items: flex-start;
    box-shadow: var(--shadow-sm);
}

.landing-feature-num {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--primary-ink);
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 0.1rem;
}

.landing-feature strong {
    font-family: var(--font-sans);
    color: var(--ink);
    font-size: var(--t-sm);
    font-weight: 600;
    display: block;
    margin-bottom: 0.2rem;
}

.landing-feature p {
    font-family: var(--font-sans);
    color: var(--ink-soft);
    font-size: 0.8rem;
    line-height: 1.4;
    margin: 0;
}

.landing-cta {
    padding: 0.9rem 2.5rem;
    font-family: var(--font-sans);
    font-size: var(--t-md);
    font-weight: 600;
    border-radius: var(--r-xl);
    margin-bottom: 0.75rem;
}

.landing-note {
    font-family: var(--font-sans);
    font-size: var(--t-xs);
    color: var(--ink-mute);
}

@media (max-width: 600px) {
    .landing-title { font-size: var(--t-2xl); }
    .landing-tagline { font-size: var(--t-base); }
    .landing-logo { font-size: 3rem; }
}

/* --- Onboarding --- */
.onboarding-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.3s ease;
}
.onboarding-overlay.hidden { display: none; }

.onboarding-card {
    width: 100%;
    max-width: 520px;
    text-align: center;
    overflow: hidden;
}

.onboarding-step {
    animation: fadeIn 0.3s ease;
}
.onboarding-step.hidden { display: none; }

.ob-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    line-height: 1;
}

.ob-title {
    font-family: var(--font-display);
    font-size: var(--t-xl);
    font-weight: 400;
    font-style: italic;
    color: var(--ink);
    margin-bottom: 0.5rem;
}

.ob-subtitle {
    font-family: var(--font-sans);
    color: var(--ink-soft);
    font-size: var(--t-base);
    margin-bottom: 2rem;
    line-height: 1.5;
}

.ob-features {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
    text-align: left;
}

.ob-feature {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.ob-feature-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.ob-feature div {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.ob-feature strong {
    color: var(--text-primary);
    font-size: 0.9rem;
}

.ob-feature span {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.ob-form {
    text-align: left;
    margin-bottom: 2rem;
}

.ob-form .form-group {
    margin-bottom: 1.25rem;
}

.ob-form .form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.ob-form .form-group input {
    width: 100%;
    max-width: 100%;
    padding: 0.6rem 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

.ob-form .form-group input:focus {
    outline: none;
    border-color: var(--accent);
}

.ob-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.ob-btn {
    min-width: 160px;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
}

.ob-tips {
    text-align: left;
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.ob-tip {
    padding: 0.6rem 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.ob-tip strong {
    color: var(--accent);
    margin-right: 0.25rem;
}

.ob-tip em {
    color: var(--text-primary);
    font-style: normal;
    font-weight: 500;
}

.ob-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.ob-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    transition: background 0.2s ease;
}

.ob-dot.active {
    background: var(--accent);
}

.ob-date-toggle,
.cfg-mode-toggle {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.ob-date-opt,
.cfg-mode-opt {
    flex: 1;
    min-width: 0;
    font-size: 0.8rem;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--ink-soft);
    cursor: pointer;
    transition: all 0.15s ease;
}

.ob-date-opt.active,
.cfg-mode-opt.active {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-bg, rgba(124,131,237,0.08));
    font-weight: 600;
}

.ob-template-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ob-tpl-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.ob-tpl-card:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-bg, rgba(124,131,237,0.06));
}

.ob-tpl-card input[type="radio"] {
    width: auto;
    margin: 0;
    accent-color: var(--accent);
}

.ob-tpl-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--ink);
    white-space: nowrap;
}

.ob-tpl-desc {
    font-size: 0.78rem;
    color: var(--ink-soft);
}

.day-picker {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.day-chip {
    flex: 1;
    min-width: 38px;
    padding: 0.5rem 0.3rem;
    font-size: 0.8rem;
    font-weight: 500;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    color: var(--ink-soft);
    cursor: pointer;
    transition: all 0.15s ease;
}

.day-chip.active {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-bg, rgba(124,131,237,0.1));
    font-weight: 600;
}

@media (max-width: 600px) {
    .ob-title { font-size: 1.4rem; }
    .ob-btn { min-width: 120px; }
    .ob-tpl-card { flex-wrap: wrap; }
}

/* --- Auth overlay --- */

.auth-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    z-index: 510;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.3s ease;
}
.auth-overlay.hidden { display: none; }

.auth-card {
    width: 100%;
    max-width: 420px;
    text-align: center;
}

.auth-error {
    background: color-mix(in srgb, var(--crit) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--crit) 30%, transparent);
    color: var(--crit);
    font-size: 0.85rem;
    padding: 0.6rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    text-align: left;
}
.auth-error.hidden { display: none; }

.auth-beta-notice {
    background: color-mix(in srgb, var(--warn, #b88a2b) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--warn, #b88a2b) 25%, transparent);
    color: var(--warn, #8a6320);
    font-size: 0.85rem;
    line-height: 1.4;
    padding: 0.7rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    text-align: left;
}
.auth-beta-notice.hidden { display: none; }

/* Terms checkbox in register form */
.legal-checkbox label {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    font-size: 0.85rem;
    line-height: 1.4;
    cursor: pointer;
    text-align: left;
    -webkit-tap-highlight-color: transparent;
}
.legal-checkbox input[type="checkbox"] {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    margin-top: 0.1rem;
    cursor: pointer;
    accent-color: var(--accent, #6b5b3f);
    -webkit-appearance: checkbox;
    appearance: checkbox;
}
.legal-checkbox a {
    color: var(--accent, #6b5b3f);
    text-decoration: underline;
}
.legal-checkbox a:hover { opacity: 0.8; }

.turnstile-box {
    display: flex;
    justify-content: center;
    margin: 12px 0 4px;
    min-height: 0;
}
.turnstile-box:empty { display: none; }

/* Terms/Privacy modals */
.legal-modal {
    position: fixed;
    inset: 0;
    z-index: 520;
    background: color-mix(in srgb, #000 50%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow-y: auto;
}
.legal-modal.hidden { display: none; }
.legal-modal-card {
    background: var(--bg, #faf8f4);
    color: var(--ink, #2a241c);
    max-width: 620px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: var(--radius, 12px);
    padding: 2rem 1.75rem 1.75rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    position: relative;
}
.legal-modal-card h2 {
    margin: 0 0 0.25rem;
    font-size: 1.4rem;
}
.legal-modal-card h3 {
    margin-top: 1.25rem;
    margin-bottom: 0.4rem;
    font-size: 0.95rem;
    font-weight: 600;
}
.legal-modal-card p, .legal-modal-card li {
    font-size: 0.9rem;
    line-height: 1.55;
    margin: 0.4rem 0;
}
.legal-modal-card ul { padding-left: 1.2rem; margin: 0.4rem 0; }
.legal-meta {
    font-size: 0.75rem;
    opacity: 0.6;
    margin-bottom: 0.5rem !important;
}
.legal-modal-close {
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    background: transparent;
    border: none;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    padding: 0.25rem 0.5rem;
}
.legal-modal-close:hover { opacity: 1; }

/* Beta welcome modal */
.beta-welcome-card {
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.beta-welcome-card h2 {
    font-size: 1.25rem;
    line-height: 1.3;
    margin-bottom: 0.75rem;
}
.beta-welcome-body ol,
.beta-welcome-body ul {
    padding-left: 1.4rem;
    margin: 0.5rem 0;
}
.beta-welcome-body li {
    margin-bottom: 0.25rem;
}
.beta-welcome-warning {
    background: color-mix(in srgb, var(--warn, #b88a2b) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--warn, #b88a2b) 25%, transparent);
    border-radius: var(--radius, 8px);
    padding: 0.6rem 0.85rem;
    margin: 0.75rem 0;
}
.beta-welcome-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1.25rem;
}
.beta-welcome-actions .btn-primary {
    width: 100%;
    padding: 0.7rem 1rem;
    font-size: 1rem;
}
.beta-welcome-actions .btn-link {
    background: none;
    border: none;
    color: var(--accent, #6b5b3f);
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: underline;
    padding: 0.4rem;
}
.beta-welcome-actions .btn-link:hover {
    opacity: 0.8;
}
@media (max-width: 480px) {
    .beta-welcome-card {
        padding: 1.25rem 1rem 1rem;
    }
    .beta-welcome-card h2 {
        font-size: 1.1rem;
    }
}

/* Admin dashboard */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}
.admin-grid.hidden { display: none; }
.admin-card {
    background: var(--bg-card, #fff);
    border: 1px solid var(--border, #e5e0d6);
    border-radius: var(--radius, 12px);
    padding: 1rem 1.1rem;
}
.admin-card-title {
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-mute, #8a7d68);
    margin-bottom: 0.6rem;
}
.admin-totals-list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.4rem 1rem;
    margin: 0;
}
.admin-totals-list dt {
    font-size: 0.85rem;
    color: var(--ink-soft, #6b5b3f);
}
.admin-totals-list dd {
    margin: 0;
    font-family: var(--mono, monospace);
    text-align: right;
}
.admin-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.admin-table th,
.admin-table td {
    text-align: left;
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid var(--border, #e5e0d6);
    white-space: nowrap;
}
.admin-table th {
    font-weight: 600;
    color: var(--ink-mute, #8a7d68);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.admin-table td:not(:first-child) {
    font-family: var(--mono, monospace);
    text-align: right;
}
.admin-empty {
    padding: 1.5rem;
    text-align: center;
    color: var(--ink-mute, #8a7d68);
}
.admin-empty.hidden { display: none; }
.admin-empty-msg {
    color: var(--ink-mute, #8a7d68);
    margin: 0;
}

.auth-switch {
    font-size: 0.85rem;
    color: var(--ink-soft);
    margin-top: 1.25rem;
}

.auth-switch a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}
.auth-switch a:hover {
    text-decoration: underline;
}

.auth-forgot {
    font-size: 0.8rem;
    margin-top: 0.6rem;
}
.auth-forgot a {
    color: var(--ink-mute, #8a7d68);
    text-decoration: none;
}
.auth-forgot a:hover {
    color: var(--primary);
    text-decoration: underline;
}

.auth-success {
    background: color-mix(in srgb, var(--ok, #2a7) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--ok, #2a7) 30%, transparent);
    color: var(--ok, #2a7);
    font-size: 0.85rem;
    padding: 0.6rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    text-align: left;
}
.auth-success.hidden { display: none; }

/* --- Toggle Label --- */

.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

/* --- Session Notes --- */

.activity-note-icon {
    color: var(--accent);
    font-size: 0.8rem;
    margin-left: 0.3rem;
    cursor: default;
}

.activity-note-preview {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 2px;
    line-height: 1.3;
}

.activity-item.clickable {
    cursor: pointer;
}

.activity-item.clickable:hover {
    background: var(--hover);
    border-radius: 6px;
}

.activity-content {
    flex: 1;
    min-width: 0;
}

.session-notes-textarea {
    width: 100%;
    min-height: 80px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font-size: 0.85rem;
    resize: vertical;
    font-family: inherit;
}

.session-notes-textarea:focus {
    outline: none;
    border-color: var(--accent);
}

/* --- Planner View Toggle & Monthly Grid --- */

.planner-view-toggle {
    display: flex;
    gap: 2px;
    margin-left: auto;
    background: var(--bg);
    border-radius: 8px;
    padding: 2px;
}

.planner-view-toggle .btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.3rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.planner-view-toggle .btn.active {
    background: var(--accent);
    color: #fff;
}

.planner-month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-top: 1rem;
}

.month-header-cell {
    text-align: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    padding: 0.5rem 0.25rem;
}

.month-cell {
    background: var(--card);
    border-radius: 8px;
    padding: 0.4rem;
    min-height: 70px;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    position: relative;
}

.month-cell:hover {
    background: var(--hover);
    transform: translateY(-1px);
}

.month-cell.other-month {
    opacity: 0.35;
}

.month-cell.is-today {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.month-cell-number {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.month-cell.is-today .month-cell-number {
    color: var(--accent);
}

.month-cell-dots {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
}

.month-cell-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.month-cell-count {
    position: absolute;
    top: 0.3rem;
    right: 0.4rem;
    font-size: 0.6rem;
    color: var(--text-secondary);
}

@media (max-width: 600px) {
    .month-cell {
        min-height: 50px;
        padding: 0.3rem;
    }
    .month-cell-dot {
        width: 6px;
        height: 6px;
    }
}

/* --- Simulacro --- */

.sim-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--bg);
    overflow-y: auto;
}

.sim-materia-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 10px 16px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    transition: background 0.15s;
}
.sim-materia-label.active { background: var(--primary-soft); }
.sim-materia-label input[type="checkbox"] { accent-color: var(--primary); }

@media (max-width: 640px) {
    #sim-config-grid { grid-template-columns: 1fr !important; }
    #sim-result-grid { grid-template-columns: 1fr !important; }
}

/* --- Global Search --- */

.sidebar-search {
    padding: 0 1rem 0.5rem;
}

.sidebar-search input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
}

.sidebar-search input::placeholder {
    color: var(--text-secondary);
}

.sidebar-search input:focus {
    border-color: var(--accent);
}

.search-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: color-mix(in srgb, var(--bg) 70%, transparent);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 100px;
    animation: fadeIn 0.18s ease;
}

.search-panel {
    width: min(640px, 92vw);
    background: var(--bg-elev);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 70vh;
    animation: dropIn 0.22s cubic-bezier(0.2, 0.7, 0.2, 1);
}
@keyframes dropIn {
    from { opacity: 0; transform: translate3d(0, -12px, 0); }
    to   { opacity: 1; transform: translate3d(0, 0, 0); }
}

.search-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
}
.search-input-icon { color: var(--ink-mute); flex-shrink: 0; }

.search-input-wrap input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--ink);
    font: inherit;
    font-size: 16px;
    padding: 4px 0;
    outline: none;
}
.search-input-wrap input::placeholder { color: var(--ink-mute); }

.search-results {
    overflow-y: auto;
    padding: 8px;
}
.search-results::-webkit-scrollbar { width: 6px; }
.search-results::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--ink) 14%, transparent); border-radius: 999px; }

.search-group-title,
.search-section-label {
    font-family: var(--font-mono);
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--ink-mute);
    padding: 12px 12px 6px;
}

.search-result-item,
.search-result {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 10px 12px;
    border-radius: var(--r);
    cursor: pointer;
    transition: background var(--transition);
}
.search-result-item:hover,
.search-result:hover,
.search-result-item.is-active,
.search-result[data-active="true"] {
    background: var(--line-soft);
}

.search-result-icon,
.search-result .k {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--bg-sunken);
    color: var(--ink-mute);
    display: grid;
    place-items: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}
.search-result-icon.type-card    { background: var(--primary-soft); color: var(--primary); }
.search-result-icon.type-topic   { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.search-result-icon.type-subject { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }
.search-result-icon.type-nav     { background: var(--primary-soft); color: var(--primary); }
.search-result-icon.type-action  { background: color-mix(in srgb, var(--gold) 14%, transparent); color: var(--ink); }

.search-result-info,
.search-result .info {
    flex: 1;
    min-width: 0;
}
.search-result-title,
.search-result .t {
    font-size: 14px;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.search-result-title mark {
    background: var(--primary-soft);
    color: inherit;
    border-radius: 2px;
    padding: 0 2px;
}
.search-result-meta,
.search-result .s {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--ink-mute);
    margin-top: 1px;
}

.search-empty {
    text-align: center;
    padding: 40px;
    color: var(--ink-mute);
}
.search-empty .empty-title {
    font-family: var(--font-display);
    font-size: 22px;
    font-style: italic;
    color: var(--ink-soft);
}
.search-empty .empty-hint {
    font-family: var(--font-mono);
    font-size: 11.5px;
    margin-top: 6px;
}

/* --- Utility --- */
.hidden { display: none !important; }
.text-muted { color: var(--text-secondary); }
.text-sm { font-size: 0.8rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.flex-center { display: flex; align-items: center; justify-content: center; }

/* ========================================
   Agent IA Module Styles
   ======================================== */

/* --- Agent / Tutor --- */

.tutor { display: grid; grid-template-columns: 1fr 320px; gap: 24px; align-items: flex-start; }

/* --- Chat UI --- */
.chat {
    border: 1px solid var(--line);
    border-radius: var(--r-xl);
    background: var(--bg-elev);
    display: flex;
    flex-direction: column;
    min-height: 600px;
    max-height: 80vh;
    overflow: hidden;
}
.chat-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 22px;
    border-bottom: 1px solid var(--line);
}
.chat-head .av {
    width: 38px; height: 38px;
    border-radius: 999px;
    background: linear-gradient(140deg, var(--primary), color-mix(in srgb, var(--primary) 50%, var(--gold)));
    color: var(--primary-ink);
    display: grid; place-items: center;
    font-family: var(--font-display);
    font-style: italic;
    font-size: 18px;
}
.chat-head .who { display: flex; flex-direction: column; }
.chat-head .who .n { font-weight: 600; font-size: 14px; }
.chat-head .who .s { font-family: var(--font-mono); font-size: 11px; color: var(--ink-mute); }
.chat-head .liv { margin-left: auto; }

.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    contain: layout style;
    scroll-behavior: smooth;
}
.chat-body::-webkit-scrollbar { width: 6px; }
.chat-body::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--ink) 14%, transparent); border-radius: 999px; }

.msg { display: flex; gap: 12px; max-width: 88%; animation: msgIn .3s cubic-bezier(.2,.7,.2,1); }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.msg .av {
    flex: none;
    width: 28px; height: 28px;
    border-radius: 999px;
    background: var(--line);
    display: grid; place-items: center;
    font-family: var(--font-display); font-style: italic; font-size: 13px;
    color: var(--ink-soft);
}
.msg.tutor .av { background: var(--primary); color: var(--primary-ink); }
.msg .b {
    background: var(--bg-sunken);
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.55;
    border: 1px solid var(--line-soft);
    overflow-wrap: anywhere;
    word-break: break-word;
}
.msg.user .b { background: var(--primary); color: var(--primary-ink); border-color: transparent; }
.msg.tutor .b .cite {
    display: inline-block;
    margin-top: 8px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--ink-mute);
    padding-top: 8px;
    border-top: 1px dashed var(--line);
    width: 100%;
}

.chat-input {
    border-top: 1px solid var(--line);
    padding: 14px 18px;
    display: flex;
    gap: 10px;
    align-items: center;
    background: var(--bg-elev);
}
.chat-input textarea {
    flex: 1;
    resize: none;
    border: 0;
    background: transparent;
    font: inherit;
    color: inherit;
    outline: none;
    height: 38px;
    padding: 8px 0;
}
.chat-input textarea:focus { border-color: transparent; box-shadow: none; }

.mic-btn {
    width: 44px; height: 44px;
    border-radius: 999px;
    border: 0;
    background: var(--line-soft);
    color: var(--ink-soft);
    cursor: pointer;
    display: grid; place-items: center;
    transition: transform .15s, background .15s;
}
.mic-btn:hover { transform: scale(1.05); background: var(--line); }
.mic-btn.live { background: var(--primary); color: var(--primary-ink); animation: mic-pulse 1.4s infinite; }
@keyframes mic-pulse {
    0%,100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 60%, transparent); }
    50%     { box-shadow: 0 0 0 12px color-mix(in srgb, var(--primary) 0%, transparent); }
}

.typing {
    display: inline-flex; gap: 4px; padding: 6px 0;
}
.typing i {
    width: 6px; height: 6px; border-radius: 999px;
    background: var(--ink-mute);
    animation: typing-blink 1.2s infinite;
}
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typing-blink {
    0%, 80%, 100% { opacity: .3; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-2px); }
}

.agent-sidebar .card + .card { margin-top: 0; }

.agent-loading {
    display: flex; align-items: center; gap: 10px;
    padding: 14px; color: var(--primary); font-weight: 500;
}
.agent-spinner {
    width: 18px; height: 18px;
    border: 2px solid var(--line);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: agent-spin 0.7s linear infinite;
}
@keyframes agent-spin { to { transform: rotate(360deg); } }

.agent-label {
    font-size: 11.5px; color: var(--ink-soft);
}
.agent-select {
    width: 100%; padding: 8px 10px;
    border: 1px solid var(--line); border-radius: var(--r);
    background: var(--bg-elev); color: var(--ink);
    font: inherit; font-size: 16px; outline: none;
}
.agent-select:focus { border-color: var(--primary); }

.agent-grade-badge {
    font-family: var(--font-display); font-size: 28px;
    font-style: italic; font-weight: 400; min-width: 36px; text-align: center;
}
.agent-grade-badge.grade-good { color: var(--ok); }
.agent-grade-badge.grade-ok { color: var(--warn); }
.agent-grade-badge.grade-bad { color: var(--crit); }

.feedback-section { padding: 12px; border-radius: var(--r); background: var(--bg-sunken); }
.feedback-section h4 {
    margin: 0 0 6px; font-size: 11px; text-transform: uppercase;
    letter-spacing: 0.06em; color: var(--ink-mute); font-family: var(--font-mono);
}
.feedback-section p { margin: 0; font-size: 13px; line-height: 1.6; white-space: pre-wrap; }
.feedback-error { border-left: 3px solid var(--crit); }
.feedback-model { border-left: 3px solid var(--primary); }
.feedback-form { border-left: 3px solid var(--warn); }

.agent-recording-indicator {
    display: flex; align-items: center; gap: 6px;
    color: var(--crit); font-weight: 500; font-size: 12px;
}
.recording-dot {
    width: 8px; height: 8px; background: var(--crit); border-radius: 50%;
    animation: recording-pulse 1s ease-in-out infinite;
}
@keyframes recording-pulse { 0%,100% { opacity:1; } 50% { opacity:0.3; } }
.btn.recording { background: var(--crit); color: #fff; border-color: var(--crit); }

.agent-form-preview {
    padding: 12px; margin-bottom: 10px;
    background: var(--bg-sunken); border: 1px solid var(--line-soft); border-radius: var(--r);
}
.form-preview-grid { display: flex; gap: 1.5rem; justify-content: space-around; }
.form-stat { display: flex; flex-direction: column; align-items: center; }
.form-stat-label { font-size: 11px; color: var(--ink-mute); font-family: var(--font-mono); }
.form-stat-value { font-size: 18px; font-weight: 700; color: var(--primary); font-family: var(--font-display); font-style: italic; }
.form-preview-detail { margin: 6px 0 0; font-size: 11px; color: var(--ink-mute); text-align: center; }

.agent-toggle-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px; border-radius: 999px; cursor: pointer;
    border: 1px solid var(--line); background: var(--bg-sunken);
    font-size: 12px; color: var(--ink-soft); transition: all .15s;
}
.agent-toggle-chip input { display: none; }
.agent-toggle-chip:has(input:checked) {
    background: var(--primary); color: var(--primary-ink); border-color: var(--primary);
}

.agent-exam-timer-warn { color: var(--crit) !important; border-color: var(--crit) !important; }

.deck-priority-badge {
    display: inline-block; padding: 1px 6px; border-radius: 999px;
    font-size: 10px; font-family: var(--font-mono); background: color-mix(in srgb, var(--crit) 14%, transparent);
    color: var(--crit);
}

.oral-stats-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 12px 0;
}
.oral-stat {
    text-align: center; padding: 12px; background: var(--bg-sunken); border-radius: var(--r);
}
.oral-stat .val {
    font-family: var(--font-display); font-size: 28px; font-style: italic; color: var(--primary);
}
.oral-stat .lbl {
    font-family: var(--font-mono); font-size: 10px; color: var(--ink-mute); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 2px;
}

.session-clickable { cursor: pointer; transition: background 0.15s; border-radius: var(--r); }
.session-clickable:hover { background: var(--bg-sunken); }

.session-detail-item {
    padding: 14px; margin-bottom: 12px;
    background: var(--bg-sunken); border: 1px solid var(--line-soft); border-radius: var(--r);
}
.session-detail-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 8px;
}
.session-detail-question {
    font-style: italic; margin-bottom: 8px; font-size: 13.5px;
    padding: 10px; background: var(--bg-elev); border-radius: var(--r-sm);
}
.session-detail-answer { font-size: 13px; margin-bottom: 8px; color: var(--ink-soft); }
.session-detail-recommendation {
    margin-top: 8px; padding: 8px 12px; font-size: 13px;
    border-left: 3px solid var(--warn); background: var(--bg-sunken); border-radius: 0 var(--r-sm) var(--r-sm) 0;
}
.session-detail-model {
    margin-top: 8px; padding: 8px 12px; font-size: 13px;
    border-left: 3px solid var(--ok); background: var(--bg-sunken); border-radius: 0 var(--r-sm) var(--r-sm) 0;
}

/* ─────────────────────────────────────────────
   New primitives (Phase 1 redesign)
   ───────────────────────────────────────────── */

/* Chips */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 9px;
    border-radius: 999px;
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 500;
    letter-spacing: 0.02em;
    background: var(--line-soft);
    color: var(--ink-soft);
    border: 1px solid var(--line);
    white-space: nowrap;
}
.chip.dot::before {
    content: "";
    width: 6px; height: 6px;
    border-radius: 999px;
    background: var(--ink-mute);
}
.chip.primary { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.chip.primary.dot::before { background: var(--primary); }
.chip.ok   { color: var(--ok); }
.chip.ok.dot::before { background: var(--ok); }
.chip.warn { color: var(--warn); }
.chip.warn.dot::before { background: var(--warn); }
.chip.crit { color: var(--crit); }
.chip.crit.dot::before { background: var(--crit); }

/* Progress bar — transform-based for perf */
.bar {
    width: 100%;
    height: 4px;
    border-radius: 999px;
    background: var(--line-soft);
    overflow: hidden;
}
.bar > i {
    display: block;
    height: 100%;
    width: 100%;
    background: var(--primary);
    border-radius: inherit;
    transform-origin: left center;
    transform: scaleX(0);
    transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* Stat block */
.stat .v {
    font-family: var(--font-display);
    font-size: 44px;
    line-height: 1;
    font-style: italic;
    color: var(--ink);
}
.stat .v.num {
    font-family: var(--font-mono);
    font-style: normal;
    letter-spacing: -0.02em;
}
.stat .l {
    color: var(--ink-mute);
    font-size: 12px;
    margin-top: 6px;
}

/* Keyboard key */
.kbd-key {
    font-family: var(--font-mono);
    font-size: 10.5px;
    padding: 2px 6px;
    border: 1px solid var(--line);
    border-bottom-width: 2px;
    border-radius: 4px;
    color: var(--ink-soft);
    background: var(--bg-elev);
}

/* Layout helpers */
.grid { display: grid; gap: var(--gap); }
.grid.g-2 { grid-template-columns: repeat(2, 1fr); }
.grid.g-3 { grid-template-columns: repeat(3, 1fr); }
.grid.g-4 { grid-template-columns: repeat(4, 1fr); }

.row { display: flex; align-items: center; gap: var(--gap); }
.row.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: var(--gap); }

.stack-xs { display: flex; flex-direction: column; gap: 4px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }

.divider { height: 1px; background: var(--line); margin: 18px 0; }
.divider.dotted {
    background: repeating-linear-gradient(to right, var(--line) 0 4px, transparent 4px 8px);
    height: 1px;
}

/* Reveal on scroll (IntersectionObserver-driven; safe default visible) */
.reveal {
    opacity: 0;
    transform: translate3d(0, 14px, 0);
    transition: opacity 0.55s cubic-bezier(0.2, 0.7, 0.2, 1), transform 0.55s cubic-bezier(0.2, 0.7, 0.2, 1);
    will-change: transform, opacity;
}
.reveal.in {
    opacity: 1;
    transform: translate3d(0, 0, 0);
}
@media (prefers-reduced-motion: reduce) {
    .reveal { opacity: 1; transform: none; transition: none; }
}

/* ─────────────────────────────────────────────
   Dashboard redesign (Phase 3)
   ───────────────────────────────────────────── */

/* Page head (used across redesigned views) */
.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}
.page-head-title { min-width: 0; }
.page-head-title .eyebrow { margin-bottom: 6px; }
.page-head-title h1 {
    font-size: clamp(40px, 5vw, 56px);
    color: var(--ink);
}
.page-head-subtitle {
    color: var(--ink-soft);
    margin-top: 10px;
    font-size: 15px;
    max-width: 560px;
    line-height: 1.5;
}
.page-head-meta {
    font-size: 11.5px;
    color: var(--ink-mute);
    align-self: flex-start;
}
.page-head-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

/* Card subtitle */
.card-subtitle {
    font-size: 12px;
    color: var(--ink-mute);
    margin-top: 4px;
}
.mono.card-subtitle { font-size: 11px; }

/* Hero countdown */
.hero {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 28px;
    padding: 32px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 4%, var(--bg-elev)), var(--bg-elev));
    border: 1px solid var(--line);
    border-radius: var(--r-xl);
    position: relative;
    overflow: hidden;
    margin-bottom: 28px;
}
.hero-stamp {
    position: absolute;
    top: 18px;
    right: 24px;
}
.hero-eyebrow { margin-bottom: 14px; }
.hero-countdown {
    display: flex;
    align-items: baseline;
    gap: 14px;
}
.hero-countdown-n {
    font-size: clamp(72px, 9vw, 120px);
    line-height: 0.85;
    font-style: italic;
    letter-spacing: -0.02em;
    color: var(--ink);
}
.hero-countdown-l {
    display: flex;
    flex-direction: column;
}
.hero-countdown-u {
    font-size: 11px;
    color: var(--ink-mute);
    text-transform: uppercase;
    letter-spacing: 0.14em;
}
.hero-countdown-d {
    font-size: 14px;
    color: var(--ink-soft);
}
.hero-paragraph {
    margin-top: 20px;
    color: var(--ink-soft);
    max-width: 420px;
    font-size: 14px;
    line-height: 1.5;
}
.hero-paragraph strong {
    color: var(--ink);
    font-weight: 600;
}
.hero-actions {
    display: flex;
    gap: 8px;
    margin-top: 18px;
}
.hero-right { display: flex; align-items: flex-start; }
.hero-next {
    background: transparent;
    border: 1px dashed var(--line);
    border-radius: var(--r-lg);
    padding: 18px;
    width: 100%;
}
.hero-next .eyebrow { margin-bottom: 12px; }
.hero-next-body { font-size: 13px; color: var(--ink-soft); }
.hero-next-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}
.hero-next-title {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 22px;
    color: var(--ink);
}
.hero-next-meta {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--ink-mute);
    margin-top: 4px;
}
.hero-next-detail {
    font-size: 12px;
    color: var(--ink-soft);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--line);
}
.empty-inline {
    font-size: 13px;
    color: var(--ink-mute);
    font-style: italic;
}

/* Stat cards (dashboard) */
.dash-stats { margin-bottom: 28px; }
.dash-stats .stat .eyebrow { margin-bottom: 14px; }
.dash-stats .stat .v {
    font-size: 38px;
    line-height: 1;
    margin: 4px 0 6px;
}

/* Section progress (materia rows) */
.dash-mid-grid {
    grid-template-columns: 1.4fr 1fr;
    margin-bottom: 28px;
}
.materia-row {
    display: grid;
    grid-template-columns: 28px 1fr 90px 56px;
    align-items: center;
    gap: 14px;
    padding: 11px 4px;
    border-bottom: 1px solid var(--line-soft);
}
.materia-row:last-child { border-bottom: none; }
.materia-row .idx {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--ink-mute);
}
.materia-row .name { min-width: 0; }
.materia-row .name-t {
    font-size: 14px;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.materia-row .name-s {
    font-family: var(--font-mono);
    color: var(--ink-mute);
    font-size: 11px;
    margin-top: 2px;
}
.materia-row .pct {
    font-family: var(--font-mono);
    font-size: 12.5px;
    text-align: right;
    color: var(--ink-soft);
}

/* Heatmap (14 weeks) */
.heat {
    display: grid;
    grid-template-columns: repeat(14, 1fr);
    gap: 4px;
}
.heat i {
    display: block;
    aspect-ratio: 1;
    border-radius: 3px;
    background: var(--line-soft);
}
.heat i[data-h="1"] { background: color-mix(in srgb, var(--primary) 20%, var(--bg-sunken)); }
.heat i[data-h="2"] { background: color-mix(in srgb, var(--primary) 40%, var(--bg-sunken)); }
.heat i[data-h="3"] { background: color-mix(in srgb, var(--primary) 70%, var(--bg-sunken)); }
.heat i[data-h="4"] { background: var(--primary); }

.heat-legend {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 14px;
    font-size: 11.5px;
    color: var(--ink-mute);
    font-family: var(--font-mono);
}
.heat-legend-cells {
    display: flex;
    gap: 3px;
}
.heat-legend-cells i {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    background: var(--line-soft);
    display: block;
}
.heat-legend-cells i[data-h="1"] { background: color-mix(in srgb, var(--primary) 25%, var(--bg-sunken)); }
.heat-legend-cells i[data-h="2"] { background: color-mix(in srgb, var(--primary) 50%, var(--bg-sunken)); }
.heat-legend-cells i[data-h="3"] { background: color-mix(in srgb, var(--primary) 75%, var(--bg-sunken)); }
.heat-legend-cells i[data-h="4"] { background: var(--primary); }

/* Due decks (Para revisar hoy) */
.due-deck {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line-soft);
}
.due-deck:last-child { border-bottom: none; }
.due-deck-info { min-width: 0; flex: 1; }
.due-deck-name {
    font-size: 13.5px;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.due-deck-meta {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--ink-mute);
    margin-top: 2px;
}

/* Quick review bar */
.quick-review-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    margin-bottom: 28px;
    background: color-mix(in srgb, var(--warn) 8%, var(--bg-elev));
    border: 1px solid color-mix(in srgb, var(--warn) 20%, var(--line));
    border-radius: var(--r-lg);
}
.quick-review-info {
    display: flex;
    align-items: baseline;
    gap: 8px;
}
.quick-review-count {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 28px;
    color: var(--warn);
    line-height: 1;
}
.quick-review-label {
    font-size: 13.5px;
    color: var(--ink-soft);
}

/* Weekly goals (bottom grid) */
.dash-bottom-grid {
    grid-template-columns: 1fr 1.2fr;
}
.goals-list { display: flex; flex-direction: column; gap: 12px; }
.goal-row .goal-row-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
}
.goal-row .goal-label {
    font-size: 13.5px;
    color: var(--ink);
}
.goal-row .goal-value {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--ink-soft);
}
.goal-row .goal-value.complete { color: var(--ok); }
.goal-row .goal-value .goal-target {
    color: var(--ink-mute);
}

/* Activity list (redesigned) */
.activity-list { display: flex; flex-direction: column; }
.activity-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line-soft);
}
.activity-row:last-child { border-bottom: none; }
.activity-icon {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.activity-info { flex: 1; min-width: 0; }
.activity-title {
    font-size: 13.5px;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.activity-meta {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--ink-mute);
    margin-top: 2px;
}

/* Empty state (Dashboard) */
.empty-hero {
    background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 4%, var(--bg-elev)), var(--bg-elev));
    border: 1px solid var(--line);
    border-radius: var(--r-xl);
    padding: 56px 32px;
    text-align: center;
    max-width: 720px;
    margin: 0 auto 32px;
}
.empty-hero-mark {
    width: 72px;
    height: 72px;
    margin: 0 auto 22px;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
    display: grid;
    place-items: center;
    font-family: var(--font-display);
    font-style: italic;
    font-size: 36px;
}
.empty-hero h2 {
    font-size: 42px;
    margin: 0;
}
.empty-hero p {
    margin-top: 14px;
    font-size: 15px;
    color: var(--ink-soft);
    max-width: 480px;
    margin-inline: auto;
    line-height: 1.55;
}
.empty-hero-actions {
    margin-top: 28px;
    display: flex;
    gap: 10px;
    justify-content: center;
}
.empty-teaser { opacity: 0.6; }
.empty-teaser .teaser-title {
    font-size: 22px;
    margin-top: 8px;
    color: var(--ink);
    font-style: italic;
    font-family: var(--font-display);
}
.empty-teaser .teaser-desc {
    margin-top: 8px;
    font-size: 13px;
    color: var(--ink-soft);
}
.empty-teaser .bar {
    margin-top: 14px;
}

/* ─────────────────────────────────────────────
   Subjects redesign (Phase 4)
   ───────────────────────────────────────────── */

.subjects-summary { margin-bottom: 28px; }

.subject-summary-card {
    padding: 24px;
}
.subject-summary-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}
.subject-summary-eyebrow { color: var(--ink-mute); }
.subject-summary-title {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 38px;
    font-weight: 400;
    line-height: 1.05;
    color: var(--ink);
    margin: 6px 0;
}
.subject-summary-stats {
    display: flex;
    gap: 24px;
    margin-top: 16px;
}
.subject-summary-stats .ss-item .l {
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: var(--ink-mute);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.subject-summary-stats .ss-item .v {
    font-family: var(--font-mono);
    font-size: 16px;
    margin-top: 2px;
    color: var(--ink);
}

/* Toolbar (filter pills) */
.subjects-toolbar {
    margin-bottom: 14px;
}
.subjects-toolbar-title {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 26px;
    font-weight: 400;
    color: var(--ink);
}

/* Pill toggle group */
.pills {
    display: inline-flex;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 3px;
    gap: 0;
    background: var(--bg-elev);
}
.pill {
    appearance: none;
    background: transparent;
    border: 0;
    padding: 5px 14px;
    border-radius: 999px;
    font-family: var(--font-sans);
    font-size: 12.5px;
    font-weight: 500;
    color: var(--ink-mute);
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}
.pill:hover { color: var(--ink); }
.pill.active {
    background: var(--bg-elev);
    color: var(--ink);
    box-shadow: var(--shadow-sm);
}
[data-theme="dark"] .pill.active { background: var(--bg-sunken); }

/* Sections accordion */
.card.flush {
    padding: 0;
    overflow: hidden;
}
.sections-accordion .section-row {
    border-bottom: 1px solid var(--line-soft);
}
.sections-accordion .section-row:last-child { border-bottom: none; }

.section-row-head {
    width: 100%;
    background: transparent;
    border: 0;
    padding: 18px 22px;
    display: grid;
    grid-template-columns: 32px 1fr 200px 110px 24px;
    align-items: center;
    gap: 18px;
    text-align: left;
    cursor: pointer;
    color: var(--ink);
    font-family: inherit;
    transition: background var(--transition);
}
.section-row-head:hover { background: var(--bg-sunken); }
.section-row.open .section-row-head { background: var(--bg-sunken); }
.section-row-head .sr-idx {
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--ink-mute);
}
.section-row-head .sr-name {
    font-size: 15.5px;
    font-weight: 500;
    color: var(--ink);
}
.section-row-head .sr-sub {
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--ink-mute);
    margin-top: 3px;
}
.section-row-head .sr-weight {
    display: flex;
    align-items: center;
    gap: 10px;
}
.section-row-head .sr-weight-label {
    font-size: 11.5px;
    color: var(--ink-mute);
}
.section-row-head .sr-progress {
    display: flex;
    align-items: center;
    gap: 8px;
}
.section-row-head .sr-progress .bar { width: 60px; }
.section-row-head .sr-progress .sr-pct {
    font-family: var(--font-mono);
    font-size: 12px;
    width: 32px;
    text-align: right;
    color: var(--ink-soft);
}
.section-row-head .sr-caret {
    color: var(--ink-mute);
    display: grid;
    place-items: center;
}

.section-row-body {
    padding: 4px 22px 22px 72px;
    background: var(--bg-sunken);
}
.section-row.collapsed .section-row-body { display: none; }

.topic-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px dashed var(--line-soft);
}
.topic-row:last-child { border-bottom: none; }
.topic-row-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}
.topic-row-check {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1.5px solid var(--line);
    background: transparent;
    display: grid;
    place-items: center;
    color: var(--primary-ink);
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
    flex-shrink: 0;
}
.topic-row-check.done {
    background: var(--primary);
    border-color: var(--primary);
}
.topic-row-check.in-progress {
    background: var(--primary-soft);
    border-color: var(--primary);
}
.topic-row-check.in-progress::after {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
}
.topic-row-name {
    font-size: 13.5px;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.topic-row-name.done {
    color: var(--ink-mute);
    text-decoration: line-through;
    text-decoration-color: var(--ink-mute);
}
.topic-row-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.topic-row-meta {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--ink-mute);
}
.topic-row-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity var(--transition);
}
.topic-row:hover .topic-row-actions { opacity: 1; }

/* Responsive subjects */
@media (max-width: 960px) {
    .grid.g-2.subjects-summary { grid-template-columns: 1fr; }
    .section-row-head {
        grid-template-columns: 28px 1fr 24px;
        gap: 12px;
    }
    .section-row-head .sr-weight,
    .section-row-head .sr-progress { display: none; }
    .section-row-body { padding: 4px 18px 18px 48px; }
}

/* ─────────────────────────────────────────────
   Planner redesign (Phase 5)
   ───────────────────────────────────────────── */

.planner-h1-soft {
    font-style: italic;
    color: var(--ink-mute);
}

.planner-week-stats { margin-bottom: 16px; }
.planner-week-stats .card {
    padding: 16px;
    margin: 0;
}
.planner-stat-eyebrow { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-mute); letter-spacing: 0.14em; text-transform: uppercase; }
.planner-stat-value {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 26px;
    color: var(--ink);
    margin-top: 6px;
    display: inline-block;
}
.planner-stat-sub {
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--ink-mute);
    margin-left: 8px;
}

.planner-nav-row {
    margin-bottom: 12px;
}
.planner-week-label {
    font-size: 12px;
    color: var(--ink-soft);
}

/* Calendar (hour × day grid) */
.calendar {
    --row-h: 60px;
    --hour-col-w: 56px;
    display: grid;
    grid-template-columns: var(--hour-col-w) repeat(7, 1fr);
    gap: 1px;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    overflow: hidden;
    margin-bottom: 28px;
}
.calendar .cell {
    background: var(--bg-elev);
    min-height: var(--row-h);
    padding: 0;
    font-size: 12px;
    position: relative;
}
.calendar .cell.h { background: var(--bg-sunken); }
.calendar .cell.hour {
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    font-family: var(--font-mono);
    color: var(--ink-mute);
    font-size: 10.5px;
    padding: 6px 8px;
}
.calendar .cell.day-h {
    text-align: center;
    padding: 10px 8px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--ink-soft);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.calendar .cell.day-h .d {
    font-family: var(--font-display);
    font-size: 22px;
    font-style: italic;
    color: var(--ink);
    display: block;
    margin-top: 2px;
}
.calendar .cell.day-h.today .d { color: var(--primary); }
.calendar .cell.day-h.today::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -1px;
    width: 24px;
    height: 2px;
    background: var(--primary);
    transform: translateX(-50%);
}
.calendar .cell.add-cell {
    cursor: pointer;
    transition: background var(--transition);
}
.calendar .cell.add-cell:hover {
    background: var(--bg-sunken);
}
.calendar .cell.add-cell::after {
    content: "+";
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: var(--ink-mute);
    font-size: 14px;
    opacity: 0;
    transition: opacity var(--transition);
    pointer-events: none;
}
.calendar .cell.add-cell:hover::after { opacity: 0.5; }

/* Block (positioned absolutely inside a cell) */
.calendar .block {
    position: absolute;
    left: 4px;
    right: 4px;
    top: 4px;
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 11.5px;
    background: var(--primary-soft);
    border-left: 2px solid var(--primary);
    color: var(--ink);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.14s ease, box-shadow 0.14s ease;
    z-index: 1;
}
.calendar .block:hover {
    transform: translateX(1px);
    box-shadow: var(--shadow-sm);
    z-index: 2;
}
.calendar .block.completed {
    opacity: 0.5;
    text-decoration: line-through;
    text-decoration-color: var(--ink-mute);
}
.calendar .block .t {
    font-weight: 500;
    font-size: 12px;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.calendar .block .s {
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: var(--ink-mute);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.calendar .block.var-1 {
    background: var(--primary-soft);
    border-left-color: var(--primary);
}
.calendar .block.var-2 {
    background: color-mix(in srgb, var(--gold) 16%, var(--bg-elev));
    border-left-color: var(--gold);
}
.calendar .block.var-3 {
    background: color-mix(in srgb, var(--sage) 15%, var(--bg-elev));
    border-left-color: var(--sage);
}
.calendar .block.var-4 {
    background: color-mix(in srgb, var(--ink-blue) 12%, var(--bg-elev));
    border-left-color: var(--ink-blue);
}
.calendar .block.var-5 {
    background: color-mix(in srgb, var(--accent) 14%, var(--bg-elev));
    border-left-color: var(--accent);
}
.calendar .block.var-6 {
    background: color-mix(in srgb, var(--crit) 12%, var(--bg-elev));
    border-left-color: var(--crit);
}
.calendar .block.break {
    background: var(--line-soft);
    border-left-color: var(--ink-mute);
    color: var(--ink-mute);
}

/* Today detail */
.planner-detail-grid {
    grid-template-columns: 1.4fr 1fr;
    margin-top: 28px;
}
.planner-detail-list .pd-row {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line-soft);
}
.planner-detail-list .pd-row:last-child { border-bottom: none; }
.planner-detail-list .pd-time {
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--ink-mute);
    width: 110px;
    flex-shrink: 0;
}
.planner-detail-list .pd-time .sep { opacity: 0.5; }
.planner-detail-list .pd-info { flex: 1; min-width: 0; }
.planner-detail-list .pd-title { font-size: 14px; font-weight: 500; color: var(--ink); }
.planner-detail-list .pd-sub { font-size: 12px; color: var(--ink-mute); margin-top: 2px; }
.planner-detail-list .pd-empty { color: var(--ink-mute); font-style: italic; padding: 16px 0; }

/* Empty planner */
.planner-empty-card {
    background: var(--bg-elev);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 0;
    position: relative;
    overflow: hidden;
}
.planner-empty-skeleton {
    display: flex;
    flex-direction: column;
}
.planner-empty-header {
    display: grid;
    grid-template-columns: 60px repeat(7, 1fr);
    border-bottom: 1px solid var(--line);
}
.planner-empty-corner {
    background: var(--bg-sunken);
}
.planner-empty-day-cell {
    padding: 14px 12px;
    border-left: 1px solid var(--line-soft);
    background: var(--bg-sunken);
    display: flex;
    flex-direction: column;
}
.planner-empty-day-cell .mono {
    font-size: 10.5px;
    color: var(--ink-mute);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.planner-empty-day-num {
    font-size: 22px;
    font-style: italic;
    color: var(--ink-mute);
    margin-top: 2px;
}
.planner-empty-body {
    display: grid;
    grid-template-columns: 60px 1fr;
    min-height: 320px;
}
.planner-empty-hours {
    padding: 14px 8px;
    background: var(--bg-sunken);
    display: flex;
    flex-direction: column;
    gap: 38px;
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: var(--ink-mute);
}
.planner-empty-cols {
    background:
        repeating-linear-gradient(to right,
            transparent 0,
            transparent calc((100% - 6px) / 7),
            var(--line-soft) calc((100% - 6px) / 7),
            var(--line-soft) calc((100% - 6px) / 7 + 1px));
}
.planner-empty-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 0%, color-mix(in srgb, var(--bg-elev) 85%, transparent) 60%);
    display: grid;
    place-items: center;
}
.planner-empty-cta {
    text-align: center;
    max-width: 480px;
    padding: 0 24px;
}
.planner-empty-cta h2 {
    font-size: 42px;
    margin: 0;
    color: var(--ink);
}
.planner-empty-cta p {
    margin-top: 12px;
    font-size: 14px;
    color: var(--ink-soft);
}
.planner-empty-cta .btn {
    margin-top: 22px;
}
.planner-empty-note {
    margin-top: 12px;
    font-size: 11px;
    color: var(--ink-mute);
}

/* Month grid (kept, just restyle) */
.planner-month-grid {
    background: var(--bg-elev);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 4px;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 28px;
}
.planner-month-grid .month-header-cell {
    padding: 10px 8px;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--ink-mute);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    background: var(--bg-sunken);
    border-radius: var(--r-sm);
}
.planner-month-grid .month-cell {
    aspect-ratio: 1;
    background: var(--bg-elev);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-sm);
    padding: 8px;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
    position: relative;
    overflow: hidden;
}
.planner-month-grid .month-cell:hover {
    background: var(--bg-sunken);
    border-color: var(--line);
}
.planner-month-grid .month-cell.other-month {
    opacity: 0.4;
}
.planner-month-grid .month-cell.is-today {
    border-color: var(--primary);
    background: var(--primary-soft);
}
.planner-month-grid .month-cell.is-today .month-cell-number {
    color: var(--primary);
    font-weight: 600;
}
.planner-month-grid .month-cell-number {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 20px;
    color: var(--ink);
}
.planner-month-grid .month-cell-count {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--ink-mute);
    position: absolute;
    top: 6px;
    right: 8px;
}
.planner-month-grid .month-cell-dots {
    display: flex;
    gap: 3px;
    margin-top: 6px;
    flex-wrap: wrap;
}
.planner-month-grid .month-cell-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

/* Responsive planner */
@media (max-width: 960px) {
    .calendar { --row-h: 52px; --hour-col-w: 44px; }
    .calendar .cell.day-h { padding: 8px 4px; }
    .calendar .cell.day-h .d { font-size: 18px; }
    .planner-detail-grid { grid-template-columns: 1fr; }
    .planner-week-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .calendar { font-size: 10px; }
    .calendar .block .t { font-size: 10.5px; }
    .calendar .block .s { font-size: 9.5px; }
}

/* ─────────────────────────────────────────────
   Pomodoro / Timer redesign (Phase 6)
   ───────────────────────────────────────────── */

.pomo {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 28px;
    align-items: flex-start;
}

.pomo-clock {
    background: var(--bg-elev);
    border: 1px solid var(--line);
    border-radius: var(--r-xl);
    padding: 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    min-height: 540px;
    box-shadow: var(--shadow);
}

.pomo-phase {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--ink-mute);
    letter-spacing: 0.16em;
    text-transform: uppercase;
}
.pomo-task {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 28px;
    margin-top: 6px;
    text-align: center;
    color: var(--ink);
    line-height: 1.2;
    max-width: 480px;
}
.pomo-linked-block {
    margin-top: 10px;
    font-size: 11.5px;
    color: var(--accent);
    background: var(--accent-bg, rgba(124,131,237,0.1));
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px 12px;
    text-align: center;
    max-width: 90%;
}

.pomo-ring {
    position: relative;
    width: 340px;
    height: 340px;
    margin: 28px auto;
}
.pomo-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}
.pomo-ring .track {
    fill: none;
    stroke: var(--line);
    stroke-width: 6;
}
.pomo-ring .fill {
    fill: none;
    stroke: var(--primary);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 1056;
    stroke-dashoffset: 1056;
    transition: stroke-dashoffset 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.pomo-ring.is-break .fill {
    stroke: var(--gold);
}
.pomo-ring-time {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-family: var(--font-mono);
    font-size: 84px;
    font-weight: 500;
    letter-spacing: -0.04em;
    color: var(--ink);
    line-height: 1;
}

.pomo-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 8px;
    flex-wrap: wrap;
    justify-content: center;
}
.pomo-controls .btn-lg {
    padding: 12px 28px;
    font-size: 14px;
}

.pomo-cycles {
    display: flex;
    gap: 14px;
    margin-top: 32px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}
.pomo-cycle-dots {
    display: flex;
    gap: 6px;
}
.pomo-cycle-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--line);
}
.pomo-cycle-dot.filled { background: var(--primary); }
.pomo-cycle-text {
    font-size: 11.5px;
    color: var(--ink-mute);
}

.pomo-side .card { margin-bottom: var(--gap); }
.pomo-side .card:last-child { margin-bottom: 0; }

.pomo-task-picker .form-group {
    margin-bottom: 12px;
}
.pomo-task-picker .form-group:last-child { margin-bottom: 0; }
.pomo-task-picker label {
    display: block;
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: var(--ink-mute);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 6px;
}

.pomo-stats {
    gap: 16px;
}
.pomo-stat-v {
    font-size: 28px;
    font-style: italic;
    color: var(--ink);
}

/* Session list (for today's sessions) */
.session-list .session-item {
    display: grid;
    grid-template-columns: 8px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line-soft);
}
.session-list .session-item:last-child { border-bottom: none; }
.session-list .session-item .dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
}
.session-list .session-item .t {
    font-size: 13.5px;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.session-list .session-item .s {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--ink-mute);
    margin-top: 2px;
}
.session-list .session-item .meta {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--ink-mute);
}

/* Responsive pomo */
@media (max-width: 960px) {
    .pomo { grid-template-columns: 1fr; }
    .pomo-clock { padding: 32px; min-height: auto; }
    .pomo-ring { width: 280px; height: 280px; }
    .pomo-ring-time { font-size: 68px; }
}

/* ─────────────────────────────────────────────
   Flashcards redesign (Phase 7)
   ───────────────────────────────────────────── */

.deck-wrap {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 28px;
    align-items: flex-start;
}

.deck-list-head {
    padding: 16px 18px 8px;
}
.deck-list {
    padding: 4px 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.deck-list .deck-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 14px;
    border-radius: var(--r);
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    text-align: left;
    transition: background var(--transition), border-color var(--transition);
}
.deck-list .deck-item:hover {
    background: var(--line-soft);
}
.deck-list .deck-item.active {
    background: var(--bg-elev);
    border-color: var(--line);
    box-shadow: var(--shadow-sm);
}
.deck-list .deck-t {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--ink);
    line-height: 1.3;
}
.deck-list .deck-m {
    display: flex;
    gap: 8px;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--ink-mute);
}
.deck-list .deck-m .chip {
    padding: 2px 7px;
    font-size: 10.5px;
}

/* Main flashcard area */
.fc-main {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.fc-active-header {
    margin-bottom: 0;
}
.fc-active-name {
    font-size: 24px;
    font-style: italic;
    color: var(--ink);
    line-height: 1.2;
}
.fc-active-stats {
    gap: 18px;
}
.fc-active-stat {
    align-items: flex-end;
}
.fc-active-streak {
    font-size: 24px;
    font-style: italic;
    color: var(--primary);
}
.fc-active-seen {
    font-size: 22px;
    color: var(--ink);
}
.fc-active-seen-total {
    color: var(--ink-mute);
    font-size: 14px;
}

/* Inline flashcard */
.flashcard {
    height: 360px;
    border-radius: var(--r-xl);
    border: 1px solid var(--line);
    background: var(--bg-elev);
    position: relative;
    perspective: 1600px;
    cursor: pointer;
    user-select: none;
    outline: none;
    box-shadow: var(--shadow);
}
.flashcard:focus-visible {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}
.flashcard .inner {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
    transition: transform 0.55s cubic-bezier(0.4, 0.1, 0.2, 1);
}
.flashcard.flipped .inner { transform: rotateY(180deg); }
.flashcard .face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    padding: 36px 44px;
    display: flex;
    flex-direction: column;
    border-radius: inherit;
}
.flashcard .face.back {
    transform: rotateY(180deg);
    background: color-mix(in srgb, var(--primary) 3%, var(--bg-elev));
}
.flashcard .fc-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--ink-mute);
    text-transform: uppercase;
    letter-spacing: 0.12em;
}
.flashcard .q {
    font-family: var(--font-display);
    font-size: clamp(22px, 3vw, 34px);
    line-height: 1.2;
    margin-top: auto;
    color: var(--ink);
    font-style: italic;
}
.flashcard .a {
    font-size: 16px;
    line-height: 1.6;
    color: var(--ink);
    margin-top: auto;
}
.flashcard .hint {
    margin-top: 16px;
    text-align: center;
    font-size: 10.5px;
    color: var(--ink-mute);
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

/* Rate buttons (4 columns) */
.fc-rate {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.fc-rate-btn {
    background: var(--bg-elev);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    cursor: pointer;
    font-family: var(--font-sans);
    color: var(--ink);
    text-align: left;
    transition: transform 0.12s ease, border-color var(--transition), background var(--transition), opacity var(--transition);
}
.fc-rate-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: var(--ink-soft);
}
.fc-rate-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.fc-rate-btn .l {
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
}
.fc-rate-btn .k {
    font-size: 11px;
    color: var(--ink-mute);
}
.fc-rate-btn[data-quality="0"]:hover:not(:disabled) { border-color: var(--crit); }
.fc-rate-btn[data-quality="1"]:hover:not(:disabled) { border-color: var(--warn); }
.fc-rate-btn[data-quality="2"]:hover:not(:disabled) { border-color: var(--ok); }
.fc-rate-btn[data-quality="3"]:hover:not(:disabled) { border-color: var(--primary); }

/* Stats grid */
.fc-stats-grid { margin-top: 12px; }
.fc-stats-grid .card { padding: 16px; margin: 0; }
.fc-stat-row {
    margin-top: 8px;
    gap: 12px;
    align-items: baseline;
}
.fc-stat-v {
    font-size: 36px;
    font-style: italic;
    color: var(--ink);
    line-height: 1;
}
.fc-stat-v-sm { font-size: 22px; }
.fc-stat-sub {
    font-size: 11.5px;
    color: var(--ink-mute);
}

/* Empty state */
.fc-empty-card {
    border: 1px dashed var(--line);
    border-radius: var(--r-xl);
    background: var(--bg-elev);
    padding: 48px 40px;
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 2fr;
    gap: 40px;
    align-items: center;
}
.fc-empty-stack {
    position: relative;
    height: 260px;
    display: grid;
    place-items: center;
}
.fc-empty-card-mock {
    position: absolute;
    width: 200px;
    height: 240px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 4px 12px -4px rgba(0,0,0,0.08);
    padding: 20px;
    transform: translate(calc((var(--i) - 1) * 14px), calc(var(--i) * -8px)) rotate(calc((var(--i) - 1) * 4deg));
    opacity: calc(0.45 + var(--i) * 0.18);
}
.fc-empty-card-mock::before,
.fc-empty-card-mock::after {
    content: "";
    display: block;
    height: 8px;
    background: var(--line-soft);
    border-radius: 4px;
    margin-bottom: 6px;
}
.fc-empty-card-mock::before {
    width: 100%;
    margin-top: 20px;
}
.fc-empty-card-mock::after {
    width: 70%;
}

.fc-empty-copy h2 {
    font-size: 38px;
    margin: 0;
    color: var(--ink);
}
.fc-empty-copy p {
    margin-top: 12px;
    font-size: 14.5px;
    color: var(--ink-soft);
    max-width: 460px;
    line-height: 1.55;
}
.fc-empty-actions {
    margin-top: 22px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.fc-empty-note {
    margin-top: 18px;
    font-size: 11px;
    color: var(--ink-mute);
}

/* Responsive flashcards */
@media (max-width: 960px) {
    .deck-wrap { grid-template-columns: 1fr; }
    .fc-empty-card { grid-template-columns: 1fr; padding: 36px 24px; }
    .fc-empty-stack { height: 220px; }
    .fc-rate { grid-template-columns: repeat(2, 1fr); }
    .fc-stats-grid { grid-template-columns: 1fr; }
}

/* ─────────────────────────────────────────────
   Progress redesign (Phase 8)
   ───────────────────────────────────────────── */

.progress-stats { margin-bottom: 28px; }
.progress-stats .stat .v { font-size: 38px; margin: 8px 0 6px; }

.progress-mid-grid {
    grid-template-columns: 1.4fr 1fr;
    margin-bottom: 28px;
}

/* Section rows (reuses .materia-row from Phase 3) */
#progress-subjects .materia-row {
    grid-template-columns: 28px 1fr 120px 48px;
}

/* Hours per subject chart */
.progress-chart {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.progress-chart .chart-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
}
.progress-chart .chart-row-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 13px;
}
.progress-chart .chart-row-head .name {
    color: var(--ink);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.progress-chart .chart-row-head .name .subject-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.progress-chart .chart-row-head .val {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--ink-soft);
}
.progress-chart .bar { height: 8px; }

/* Heatmap 30 days (5 rows × 6 cols) */
.heat-30 {
    grid-template-columns: repeat(15, 1fr);
    gap: 4px;
}
.heat-30 i {
    display: block;
    aspect-ratio: 1;
    border-radius: 3px;
    background: var(--line-soft);
}
.heat-30 i[data-h="1"] { background: color-mix(in srgb, var(--primary) 20%, var(--bg-sunken)); }
.heat-30 i[data-h="2"] { background: color-mix(in srgb, var(--primary) 40%, var(--bg-sunken)); }
.heat-30 i[data-h="3"] { background: color-mix(in srgb, var(--primary) 70%, var(--bg-sunken)); }
.heat-30 i[data-h="4"] { background: var(--primary); }

.heat-30-legend {
    margin-top: 14px;
    font-size: 11.5px;
    color: var(--ink-mute);
}

/* Weakness analysis */
.progress-weakness-card { margin-bottom: 28px; }

.weakness-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.weakness-item {
    display: grid;
    grid-template-columns: 28px 1fr;
    gap: 14px;
    padding: 14px;
    border-radius: var(--r);
    background: var(--bg-sunken);
    border: 1px solid var(--line-soft);
    align-items: flex-start;
}
.weakness-item.severity-high {
    border-color: color-mix(in srgb, var(--crit) 30%, var(--line));
    background: color-mix(in srgb, var(--crit) 4%, var(--bg-sunken));
}
.weakness-item.severity-mid {
    border-color: color-mix(in srgb, var(--warn) 30%, var(--line));
    background: color-mix(in srgb, var(--warn) 4%, var(--bg-sunken));
}
.weakness-rank {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--ink-mute);
    padding-top: 4px;
}
.weakness-body { flex: 1; min-width: 0; }
.weakness-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}
.weakness-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--ink);
}
.weakness-tip {
    font-size: 12.5px;
    color: var(--ink-soft);
    margin-bottom: 8px;
    line-height: 1.4;
}
.weakness-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.weakness-meta {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--ink-mute);
}
.weakness-recommendation {
    margin-top: 14px;
    padding: 12px 14px;
    background: var(--primary-soft);
    color: var(--ink);
    border-radius: var(--r);
    font-size: 13px;
    border-left: 3px solid var(--primary);
}

/* Session history */
.progress-history {
    display: flex;
    flex-direction: column;
}
.progress-history .history-row {
    display: grid;
    grid-template-columns: 110px 1fr 70px 110px 28px;
    align-items: center;
    gap: 18px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line-soft);
    cursor: pointer;
    transition: background var(--transition);
}
.progress-history .history-row:last-child { border-bottom: none; }
.progress-history .history-row:hover { background: var(--bg-sunken); }
.progress-history .h-date {
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--ink-mute);
}
.progress-history .h-title {
    font-size: 13.5px;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.progress-history .h-dur {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--ink-soft);
}
.progress-history .h-meta {
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--ink-mute);
    text-align: right;
}
.progress-history .h-note-icon {
    color: var(--ink-mute);
    display: grid;
    place-items: center;
}
.progress-history .has-notes .h-note-icon { color: var(--primary); }

/* Responsive progress */
@media (max-width: 960px) {
    .progress-mid-grid { grid-template-columns: 1fr; }
    .progress-stats { grid-template-columns: repeat(2, 1fr); }
    #progress-subjects .materia-row { grid-template-columns: 24px 1fr 80px 40px; gap: 10px; }
    .progress-history .history-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }
    .progress-history .h-date,
    .progress-history .h-dur,
    .progress-history .h-meta {
        text-align: left;
    }
    .progress-history .h-note-icon { display: none; }
}
@media (max-width: 560px) {
    .flashcard { height: 320px; }
    .flashcard .face { padding: 24px 28px; }
}
@media (max-width: 480px) {
    .pomo-clock { padding: 24px 16px; }
    .pomo-ring { width: 240px; height: 240px; }
    .pomo-ring-time { font-size: 56px; }
    .pomo-controls .btn-lg { padding: 10px 18px; }
}

/* Responsive: dashboard breaks down nicely on tablet */
@media (max-width: 960px) {
    .hero { grid-template-columns: 1fr; }
    .dash-mid-grid { grid-template-columns: 1fr; }
    .dash-bottom-grid { grid-template-columns: 1fr; }
    .grid.g-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
    .grid.g-4 { grid-template-columns: 1fr; }
    .grid.g-3 { grid-template-columns: 1fr; }
    .page-head-title h1 { font-size: 36px; }
    .hero { padding: 24px; }
}

/* ─────────────────────────────────────────────
   Mobile audit fixes (comprehensive)
   ───────────────────────────────────────────── */

/* iOS zoom prevention: selects below 16px trigger zoom on focus */
@media (max-width: 768px) {
    .agent-select,
    select {
        font-size: 16px !important;
    }
}

/* Agent chat: on mobile, collapse sidebar BELOW chat and make it collapsible */
@media (max-width: 768px) {
    .tutor {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }
    .agent-sidebar {
        order: 1;
    }
    .chat {
        min-height: 0;
        max-height: none;
        height: calc(100dvh - var(--mobile-header-height) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 160px);
    }
    .chat-body {
        padding: 14px;
        gap: 14px;
    }
    .chat-head {
        padding: 12px 14px;
    }
    .chat-input {
        padding: 10px 12px;
        gap: 8px;
    }
    .chat-input textarea {
        height: 44px;
        padding: 10px 0;
    }

    /* Prevent message bubbles from overflowing */
    .msg { max-width: 92%; }
    .msg .b {
        overflow-wrap: anywhere;
        word-break: break-word;
        padding: 10px 14px;
        font-size: 14px;
    }

    /* Agent sidebar: compact on mobile */
    .agent-sidebar {
        width: 100%;
        gap: 12px;
    }
    .agent-sidebar .card {
        padding: 14px;
        margin: 0;
    }
    .agent-sidebar .grid.g-2 {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .chat {
        height: calc(100dvh - var(--mobile-header-height) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 130px);
    }
    .msg .av {
        width: 24px;
        height: 24px;
        font-size: 11px;
    }
    .msg {
        gap: 8px;
    }
    .chat-input textarea {
        font-size: 16px;
    }
}

/* Agent dashboard: make mid-grid responsive */
#agent-mid-grid {
    grid-template-columns: 1fr 1fr;
}
@media (max-width: 768px) {
    #agent-mid-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
}

/* Agent dashboard: mastery table rows */
@media (max-width: 640px) {
    #agent-mastery-table .row {
        flex-wrap: wrap;
        gap: 8px !important;
        padding: 10px 0 !important;
    }
    #agent-mastery-table .bar {
        width: 100% !important;
        order: 10;
    }
    #agent-mastery-table .chip {
        min-width: 0 !important;
        font-size: 10.5px;
        padding: 2px 7px;
    }
}

/* Form preview grid (voice analysis stats) */
@media (max-width: 480px) {
    .form-preview-grid {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    .oral-stats-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .oral-stat .val {
        font-size: 22px;
    }
}

/* Admin tables: ensure horizontal scroll wrapper works */
@media (max-width: 640px) {
    .admin-grid {
        grid-template-columns: 1fr;
    }
    .admin-card {
        padding: 0.75rem;
    }
    .admin-table {
        font-size: 0.78rem;
    }
    .admin-table th,
    .admin-table td {
        padding: 0.35rem 0.4rem;
    }
    .admin-totals-list {
        gap: 0.3rem 0.6rem;
    }
}

/* Auth card: scrollable on short screens / keyboard open */
.auth-overlay {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
@media (max-width: 480px) {
    .auth-card {
        max-height: 90dvh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 1.5rem 1rem;
    }
}

/* Mobile drawer: compact layout + hide desktop-only affordances */
@media (max-width: 768px) {
    .sidebar-foot {
        flex-shrink: 0;
    }
    /* Compact menu: the exam countdown is already on the Dashboard, so drop it
       here to make room for all nav items + the account footer without scroll. */
    .sidebar-countdown {
        display: none;
    }
    .brand {
        padding-bottom: 12px;
        margin-bottom: 10px;
    }
    .sidebar-search {
        margin-bottom: 10px;
    }
    /* Keyboard shortcuts are meaningless on a touch device */
    .nav-kbd,
    .sidebar-search .kbd-hint {
        display: none;
    }
    /* The off-screen drawer must never create horizontal scroll */
    html,
    body {
        overflow-x: hidden;
    }
}

/* Touch targets: minimum 44px on mobile */
@media (max-width: 768px) {
    .tab-btn {
        padding: 8px 10px;
        min-height: 44px;
    }
    .nav-item {
        padding: 10px 12px;
        min-height: 44px;
    }
    .btn-sm {
        padding: 8px 12px;
        min-height: 36px;
    }

    /* Hover-only actions: always visible on touch */
    .topic-row-actions,
    .topic-actions,
    .fc-card-actions {
        opacity: 1 !important;
    }
}

/* Toast: position above tab bar on mobile */
@media (max-width: 768px) {
    .toast-container {
        bottom: calc(72px + env(safe-area-inset-bottom, 0px));
        right: 1rem;
        left: 1rem;
    }
    .toast {
        width: 100%;
    }
}

/* Main content: safe area for home indicator */
@media (max-width: 768px) {
    .main {
        contain: layout style;
        padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
    }
}

/* Planner grid: ensure day columns are readable */
@media (max-width: 640px) {
    .calendar {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Simulacro: config and result grids already have @media(640px) with !important */

/* Agent exam timer: avoid overlapping hamburger */
@media (max-width: 768px) {
    #agent-exam-timer {
        font-size: 12px !important;
    }
}

/* Page head description: improve readability on mobile */
@media (max-width: 480px) {
    .page-head > p {
        font-size: 13px;
        line-height: 1.45;
    }
}

/* iOS zoom: 16px minimum on all form inputs (prevents auto-zoom on focus) */
@media (max-width: 768px) {
    input:not([type="checkbox"]):not([type="radio"]),
    textarea {
        font-size: 16px !important;
    }
}

/* --- Dashboard: small phone refinements --- */
@media (max-width: 600px) {
    .hero-countdown-n { font-size: clamp(48px, 12vw, 72px); }
    .hero-countdown { gap: 10px; }
    .hero-paragraph { font-size: 13px; }
    .hero-actions { flex-wrap: wrap; }
    .hero-next-title { font-size: 18px; }
    .hero-next { padding: 14px; }
    .dash-stats .stat .v { font-size: 30px; }
    .empty-hero { padding: 36px 20px; }
    .empty-hero h2 { font-size: 30px; }
    .empty-hero p { font-size: 13.5px; }
    .empty-hero-actions { flex-wrap: wrap; }
}
@media (max-width: 480px) {
    .materia-row {
        grid-template-columns: 20px 1fr 56px;
        gap: 8px;
    }
    .materia-row .pct { font-size: 11px; }
    .quick-review-bar { padding: 12px 14px; gap: 10px; flex-wrap: wrap; }
    .quick-review-count { font-size: 22px; }
    .quick-review-label { font-size: 12.5px; }
    .heat { gap: 3px; }
    .heat-legend { font-size: 10.5px; }
    .due-deck-name { font-size: 12.5px; }
    .due-deck-meta { font-size: 10px; }
    .activity-row { gap: 10px; padding: 10px 0; }
    .activity-title { font-size: 12.5px; }
    .activity-meta { font-size: 10px; }
    .goal-row .goal-label { font-size: 12.5px; }
    .goal-row .goal-value { font-size: 11px; }
}

/* --- Subjects: responsive breakpoints --- */
@media (max-width: 600px) {
    .subject-summary-title {
        font-size: clamp(26px, 8vw, 38px);
    }
    .subject-summary-stats {
        flex-direction: column;
        gap: 12px;
    }
    .subject-summary-card { padding: 18px; }
    .subjects-toolbar-title { font-size: 22px; }
}
@media (max-width: 480px) {
    .section-row-head { padding: 14px 16px; gap: 10px; }
    .section-row-head .sr-name { font-size: 14px; }
    .section-row-body { padding: 4px 14px 14px 40px; }
    .topic-row { gap: 8px; padding: 8px 0; }
    .topic-row-name { font-size: 12.5px; }
    .topic-row-meta { font-size: 10px; }
    .topic-row-left { gap: 8px; }
    .pills { padding: 2px; }
    .pill { padding: 4px 10px; font-size: 11.5px; }
}

/* --- Planner / Calendar: small phone refinements --- */
@media (max-width: 480px) {
    .calendar { --row-h: 44px; --hour-col-w: 38px; }
    .calendar .cell.day-h { padding: 6px 2px; font-size: 9px; }
    .calendar .cell.day-h .d { font-size: 15px; }
    .calendar .cell.hour { font-size: 9px; padding: 4px 4px; }
    .calendar .block .t { font-size: 10px; }
    .calendar .block .s { font-size: 9px; }
    .calendar .block { padding: 4px 6px; }
    .planner-detail-list .pd-time { width: 80px; font-size: 10.5px; }
    .planner-detail-list .pd-title { font-size: 13px; }
    .planner-detail-list .pd-sub { font-size: 11px; }
    .planner-detail-list .pd-row { gap: 12px; padding: 10px 0; }
    .planner-stat-value { font-size: 22px; }
    .planner-stat-eyebrow { font-size: 10px; }
    .planner-week-stats.grid.g-2 { gap: 10px; }
    .planner-week-label { font-size: 11px; }
    .planner-empty-cta h2 { font-size: 28px; }
    .planner-empty-cta p { font-size: 13px; }
}
@media (max-width: 600px) {
    .planner-month-grid .month-cell { padding: 4px; }
    .planner-month-grid .month-cell-number { font-size: 16px; }
    .planner-month-grid .month-cell-dot { width: 5px; height: 5px; }
    .planner-month-grid .month-header-cell { font-size: 9px; padding: 8px 4px; }
}

/* --- Timer / Pomodoro: 600px gap fill --- */
@media (max-width: 600px) {
    .pomo-clock { padding: 28px 18px; min-height: auto; }
    .pomo-ring { width: 260px; height: 260px; }
    .pomo-ring-time { font-size: 60px; }
    .pomo-task { font-size: 22px; word-break: break-word; max-width: 90%; }
    .pomo-phase { font-size: 10px; }
    .pomo-controls .btn { padding: 10px 14px; font-size: 12.5px; }
    .pomo-controls .btn-lg { padding: 10px 20px; font-size: 13px; }
    .pomo-side .card { padding: 14px; }
    .pomo-stats { gap: 12px; }
    .pomo-stat-v { font-size: 22px; }
    .session-list .session-item .t { font-size: 12.5px; }
    .session-list .session-item .s { font-size: 10px; }
    .session-list .session-item .meta { font-size: 10px; }
}

/* --- Flashcards: small phone refinements --- */
@media (max-width: 560px) {
    .fc-empty-card {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 28px 18px;
    }
    .fc-empty-stack { height: 180px; }
    .fc-empty-copy h2 { font-size: 28px; }
    .fc-empty-copy p { font-size: 13.5px; }
    .fc-empty-actions { flex-direction: column; }
}
@media (max-width: 480px) {
    .flashcard .face { padding: 20px 22px; }
    .flashcard .q { font-size: clamp(18px, 5vw, 28px); }
    .flashcard .a { font-size: 14px; }
    .flashcard .hint { font-size: 9.5px; }
    .fc-rate-btn { padding: 10px 8px; }
    .fc-rate-btn .l { font-size: 12px; }
    .fc-rate-btn .k { font-size: 10px; }
    .fc-active-name { font-size: 20px; }
    .fc-active-stats { gap: 12px; }
    .fc-stat-v { font-size: 28px; }
    .deck-list { max-height: 160px; }
    .deck-list .deck-t { font-size: 12.5px; }
    .deck-list .deck-item { padding: 10px 12px; }
}

/* --- Progress: small phone refinements --- */
@media (max-width: 640px) {
    .progress-stats.grid.g-4 { grid-template-columns: repeat(2, 1fr); }
    .progress-stats .stat .v { font-size: 30px; }
}
@media (max-width: 480px) {
    .progress-stats.grid.g-4 { grid-template-columns: 1fr; }
    #progress-subjects .materia-row {
        grid-template-columns: 20px 1fr 60px 36px;
        gap: 8px;
    }
    .weakness-item { padding: 10px; gap: 10px; }
    .weakness-name { font-size: 13px; }
    .weakness-tip { font-size: 11.5px; }
    .weakness-actions { gap: 6px; }
    .progress-chart .chart-row-head { font-size: 12px; }
    .progress-chart .chart-row-head .val { font-size: 11px; }
}

/* --- Settings: small phone refinements --- */
@media (max-width: 480px) {
    .settings-col .card { padding: 16px; }
    .weight-row { gap: 10px; padding: 8px 0; }
    .weight-info-name { font-size: 12.5px; }
    .weight-info-meta { font-size: 10px; }
    .weight-val { width: 48px; font-size: 13px; }
    .weight-controls { gap: 6px; }
}

/* --- Agent: 480px sidebar grid collapse --- */
@media (max-width: 480px) {
    .agent-sidebar .grid.g-2 {
        grid-template-columns: 1fr !important;
    }
    .agent-sidebar .card { padding: 10px; }
    .msg { max-width: 96%; }
    .chat-body { padding: 10px; gap: 10px; }
    .feedback-section p { font-size: 12px; }
    .feedback-section h4 { font-size: 10px; }
    .oral-stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* --- Agent Dashboard: 480px refinements --- */
@media (max-width: 480px) {
    #agent-mid-grid { gap: 12px !important; }
    #agent-mastery-table .row { padding: 8px 0 !important; }
    .session-detail-item { padding: 10px; margin-bottom: 8px; }
    .session-detail-question { font-size: 12.5px; padding: 8px; }
    .session-detail-answer { font-size: 12px; }
}

/* --- Simulacro: 480px refinements --- */
@media (max-width: 480px) {
    .sim-materia-label { padding: 8px 12px; font-size: 13px; }
    .sim-overlay { padding: 16px; }
}

/* --- Admin: 480px refinements --- */
@media (max-width: 480px) {
    .admin-card { padding: 0.6rem; }
    .admin-table { font-size: 0.72rem; }
    .admin-table th,
    .admin-table td { padding: 0.25rem 0.3rem; }
    .admin-table-wrap {
        margin-left: -0.6rem;
        margin-right: -0.6rem;
    }
    .admin-totals-list { font-size: 0.78rem; }
}

/* --- Focus overlay: small phone refinements --- */
@media (max-width: 480px) {
    .focus-overlay { padding: 16px 18px 12px; }
    .focus-task { font-size: 24px; }
    .focus-ring { width: 220px; height: 220px; }
    .focus-ring-time { font-size: 48px; }
    .focus-fc-question { font-size: 26px; }
    .focus-fc-rate-btn { min-width: 70px; padding: 10px 12px; font-size: 13px; }
    .focus-fc-rate-btn .focus-fc-rate-key { font-size: 9.5px; }
    .focus-controls { gap: 10px; }
    .focus-btn { width: 48px; height: 48px; font-size: 18px; }
    .focus-btn-main { width: 64px; height: 64px; font-size: 20px; }
    .focus-hints { gap: 14px; font-size: 10px; }
}

/* --- Eve / evening: small phone --- */
@media (max-width: 480px) {
    .eve { padding: 20px 16px; }
    .eve-hours { font-size: 64px; }
    .eve-mins { font-size: 44px; }
    .eve-card-title { font-size: 20px; }
    .eve-footer { font-size: 15px; }
}

/* ========================================
   Public Landing Page v2 (pl-*)
   Shown to unauthenticated visitors on non-production domains
   ======================================== */
.pl { background: var(--bg); color: var(--ink); font-family: var(--font-sans); font-size:16px; line-height:1.55; text-rendering:optimizeLegibility; -webkit-font-smoothing:antialiased; -moz-osx-font-smoothing:grayscale; }
.pl[hidden] { display: none !important; }
.pl .sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.pl-wrap { width:100%; max-width:1340px; margin:0 auto; padding:0 28px; }

/* --- buttons --- */
.pl-btn { display:inline-flex; align-items:center; gap:8px; font-family:var(--font-sans); font-size:15px; font-weight:500; padding:13px 22px; border-radius:var(--r); border:1px solid transparent; cursor:pointer; transition: transform .15s ease, background .2s ease, border-color .2s ease, color .2s ease, filter .2s ease; line-height:1; text-decoration:none; }
.pl-btn-primary { background:var(--primary); color:var(--primary-ink); box-shadow: 0 1px 0 rgba(0,0,0,.04), 0 6px 16px -10px oklch(0.42 0.13 25 / .55); }
.pl-btn-primary:hover { filter:brightness(1.06); transform: translateY(-1px); }
.pl-arr { font-family:var(--font-display); font-style:italic; font-size:18px; margin-left:2px; transition: transform .2s ease; }
.pl-btn-primary:hover .pl-arr { transform: translateX(2px); }
.pl-btn-ghost { background:transparent; color:var(--ink); border-color:var(--line); }
.pl-btn-ghost:hover { background:var(--bg-elev); border-color:#d8d2c5; }

/* --- eyebrow utility --- */
.pl-eyebrow { font-family:var(--font-sans); font-size:11px; letter-spacing:.16em; text-transform:uppercase; color:var(--ink-mute); font-weight:500; }
.pl-dot { display:inline-block; width:5px; height:5px; border-radius:50%; background:var(--primary); margin-right:8px; transform:translateY(-2px); }

/* --- pre-header --- */
.pl-pre-header { background:var(--ink); color:#c9c1b1; font-size:12.5px; letter-spacing:.04em; }
.pl-pre-header .pl-wrap { display:flex; align-items:center; justify-content:space-between; height:36px; gap:16px; overflow:hidden; }
.pl-ph-left { display:flex; align-items:center; gap:10px; min-width:0; }
.pl-ph-pill { display:inline-block; padding:2.5px 8px; border:1px solid #3a342d; border-radius:99px; color:#fbf6ec; font-size:10.5px; letter-spacing:.14em; text-transform:uppercase; font-weight:500; white-space:nowrap; flex-shrink:0; }
.pl-ph-ldot { display:inline-block; width:5px; height:5px; border-radius:50%; background: oklch(0.78 0.12 35); margin-right:6px; transform:translateY(-1px); animation: pl-pulse 1.8s ease-in-out infinite; }
@keyframes pl-pulse { 0%,100%{opacity:.5} 50%{opacity:1} }
.pl-ph-msg { color:#c9c1b1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.pl-ph-right { display:flex; align-items:center; gap:18px; color:#8f867a; }
.pl-ph-right a { color:inherit; text-decoration:none; }
.pl-ph-right a:hover { color:#fbf6ec; }
@media (max-width:720px) { .pl-ph-right { display:none; } }

/* --- header / nav --- */
.pl-header { position:sticky; top:0; z-index:10; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: saturate(140%) blur(10px); -webkit-backdrop-filter: saturate(140%) blur(10px); border-bottom:1px solid var(--line-soft); }
.pl-nav { display:flex; align-items:center; justify-content:space-between; height:64px; }
.pl-brand { display:flex; align-items:baseline; gap:10px; text-decoration:none; }
.pl-mark { font-family:var(--font-display); font-style:italic; font-weight:700; font-size:30px; line-height:1; color:var(--primary); letter-spacing:-.02em; }
.pl-name { font-family:var(--font-sans); font-weight:600; font-size:16px; color:var(--ink); letter-spacing:-.005em; }
.pl-links { display:none; gap:28px; font-size:14.5px; color:var(--ink-soft); }
.pl-links a { color:inherit; text-decoration:none; }
.pl-links a:hover { color:var(--ink); }
.pl-nav-cta { display:flex; align-items:center; gap:10px; }
@media (min-width:900px) { .pl-links { display:flex; } }

/* --- HERO --- */
.pl-hero { position:relative; padding: 56px 0 64px; border-bottom:1px solid var(--line); overflow:hidden; }
.pl-hero::before { content:""; position:absolute; inset:0; pointer-events:none; background: radial-gradient(1200px 360px at 85% -10%, oklch(0.42 0.13 25 / .05), transparent 60%), radial-gradient(800px 360px at 0% 110%, oklch(0.42 0.13 25 / .03), transparent 60%); }
.pl-hero .pl-wrap { position:relative; }

/* filing card */
.pl-filing { display:flex; align-items:center; justify-content:space-between; border-top:1px solid var(--line); border-bottom:1px solid var(--line); padding: 10px 0; margin-bottom: 48px; font-size:11px; letter-spacing:.18em; text-transform:uppercase; color:var(--ink-mute); font-weight:500; gap:24px; flex-wrap:wrap; }
.pl-filing-col { display:flex; align-items:center; gap:8px; }
.pl-filing-col b { color:var(--ink-soft); font-weight:500; }
.pl-filing-num { font-family:var(--font-display); font-style:italic; font-weight:400; font-size:14px; color:var(--primary); letter-spacing:-.01em; text-transform:none; }

.pl-hero-grid { display:grid; grid-template-columns: 1fr; gap:40px; align-items:start; }
@media (min-width:980px) { .pl-hero { padding: 64px 0 80px; } .pl-hero-grid { grid-template-columns: 1.15fr .9fr; gap:64px; } }

.pl-hero h1 { font-family:var(--font-display); font-weight:400; font-size: clamp(40px, 5.6vw, 64px); line-height: 1.04; letter-spacing:-.02em; color:var(--ink); margin: 0 0 22px; text-wrap: pretty; }
.pl-hero h1 em { font-style:italic; color:var(--primary); }
.pl-fn-ref { font-family:var(--font-sans); font-style:normal; font-size:.36em; color:var(--ink-mute); font-weight:500; vertical-align: super; margin-left:2px; }
.pl-hero-sub { font-size:17.5px; line-height:1.6; color:var(--ink-soft); max-width: 56ch; margin: 0 0 24px; }
.pl-hero-sub strong { color:var(--ink); font-weight:600; }

/* waitlist form (shared hero + CTA) */
.pl-waitlist { display:flex; gap:8px; flex-wrap:wrap; background:var(--bg-elev); border:1px solid var(--line); border-radius:var(--r); padding:6px; max-width: 520px; box-shadow: 0 1px 0 rgba(26,23,20,.04); transition: border-color .2s ease, box-shadow .2s ease; }
.pl-waitlist:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.pl-waitlist input { flex:1; min-width:200px; border:0; background:transparent; padding:10px 14px; font-family:var(--font-sans); font-size:15px; color:var(--ink); outline:none; }
.pl-waitlist input::placeholder { color:var(--ink-mute); }
.pl-waitlist .pl-btn-primary { padding:11px 18px; }

.pl-form-msg { margin-top:14px; font-size:13.5px; min-height:1.2em; color:var(--ink-soft); }
.pl-form-msg.is-error { color: oklch(0.50 0.18 25); }
.pl-form-msg.is-ok { color: oklch(0.42 0.11 145); }
.pl-form-msg-light.is-ok { color: oklch(0.78 0.10 145); }
.pl-form-msg-light.is-error { color: oklch(0.78 0.16 25); }

.pl-hero-meta { margin-top:22px; font-size:13.5px; color:var(--ink-mute); display:flex; flex-wrap:wrap; gap:14px 22px; align-items:center; }
.pl-check { color: var(--ok); margin-right:6px; font-weight:600; }
.pl-dotsep { width:3px; height:3px; border-radius:50%; background:var(--line); display:inline-block; }

/* marginalia */
.pl-marginalia { margin-top:36px; border-top:1px dashed var(--line); padding-top:18px; display:grid; gap:10px; max-width: 520px; }
.pl-margin-note { font-size:13px; color:var(--ink-soft); line-height:1.5; display:grid; grid-template-columns: 28px 1fr; gap:8px; }
.pl-margin-ref { font-family:var(--font-display); font-style:italic; color:var(--primary); font-size:14px; }

/* hero mock card */
.pl-hero-card { background:var(--bg-elev); border:1px solid var(--line); border-radius:var(--r-lg); box-shadow: var(--shadow); padding:0; position:relative; overflow:hidden; }
.pl-hero-card::after { content:""; position:absolute; inset:-1px; border-radius:inherit; pointer-events:none; border:1px solid color-mix(in srgb, var(--line) 60%, transparent); transform:translate(8px,8px); z-index:-1; background:var(--bg-deep); }
.pl-hc-running { display:flex; justify-content:space-between; align-items:center; padding:10px 18px; background:var(--bg-sunken); border-bottom:1px solid var(--line); font-size:11px; letter-spacing:.16em; text-transform:uppercase; color:var(--ink-mute); }
.pl-hc-folio { font-family:var(--font-display); font-style:italic; font-size:14px; color:var(--ink-soft); letter-spacing:-.01em; text-transform:none; }
.pl-hc-body { padding:20px 22px 22px; }
.pl-hc-top { display:flex; justify-content:space-between; align-items:flex-end; padding-bottom:14px; border-bottom:1px solid var(--line-soft); margin-bottom:16px; }
.pl-hc-label { font-family:var(--font-display); font-style:italic; color:var(--ink-soft); font-size:18px; line-height:1.1; }
.pl-hc-sublabel { display:block; font-family:var(--font-sans); font-style:normal; font-size:11px; letter-spacing:.14em; text-transform:uppercase; color:var(--ink-mute); margin-top:4px; font-weight:500; }
.pl-hc-grade { text-align:right; }
.pl-hc-grade b { display:block; font-family:var(--font-display); font-style:italic; color:var(--primary); font-size:34px; font-weight:700; letter-spacing:-.02em; line-height:1; }
.pl-hc-grade span { font-size:10.5px; letter-spacing:.16em; text-transform:uppercase; color:var(--ink-mute); font-weight:500; display:inline-block; margin-top:5px; }
.pl-hc-q { font-size:15px; color:var(--ink); line-height:1.5; margin-bottom:14px; padding:14px 16px; background:var(--bg-sunken); border-radius:var(--r); border-left:2px solid var(--primary); }
.pl-hc-who { display:block; font-size:11px; letter-spacing:.16em; text-transform:uppercase; color:var(--ink-mute); margin-bottom:6px; font-weight:600; }
.pl-hc-a { font-size:14.5px; color:var(--ink-soft); line-height:1.55; padding:0 4px 14px; }
.pl-hc-mine { font-weight:600; color:var(--ink); margin-right:6px; }
.pl-cursor { display:inline-block; width:7px; height:14px; background:var(--primary); vertical-align:-2px; margin-left:2px; animation: pl-blink 1s steps(2) infinite; }
@keyframes pl-blink { 50%{opacity:0} }
.pl-hc-feedback { border-top:1px dashed var(--line); padding-top:14px; display:grid; gap:10px; }
.pl-hc-tag { display:grid; grid-template-columns: 78px 1fr; align-items:start; gap:14px; font-size:13px; color:var(--ink-soft); line-height:1.45; }
.pl-pill { display:inline-block; padding:3px 8px; border-radius:99px; background:var(--primary-soft); color:var(--primary); font-size:10.5px; font-weight:600; letter-spacing:.06em; text-transform:uppercase; text-align:center; justify-self:start; }
.pl-tag-warn .pl-pill { background: oklch(0.62 0.14 60 / .12); color: var(--warn); }
.pl-tag-ok .pl-pill { background: oklch(0.55 0.11 145 / .12); color: var(--ok); }

/* --- stat ribbon --- */
.pl-ribbon { background:var(--bg-deep); border-bottom:1px solid var(--line); padding: 32px 0; }
.pl-ribbon .pl-wrap { display:grid; grid-template-columns: repeat(2, 1fr); gap:24px 32px; }
@media (min-width:820px) { .pl-ribbon .pl-wrap { grid-template-columns: repeat(4, 1fr); gap:32px; } }
.pl-stat { display:flex; flex-direction:column; gap:6px; padding: 4px 0; border-left:1px solid var(--line); padding-left:18px; }
.pl-stat:first-child { border-left:0; padding-left:0; }
@media (max-width:819px) { .pl-stat { border-left:0; padding-left:0; border-top:1px solid var(--line); padding-top:14px; } .pl-stat:first-child, .pl-stat:nth-child(2) { border-top:0; padding-top:0; } }
.pl-stat-num { font-family:var(--font-display); font-style:italic; font-weight:400; font-size: clamp(42px, 5vw, 56px); line-height:1; color:var(--ink); letter-spacing:-.02em; }
.pl-stat-num em { color:var(--primary); }
.pl-stat-lbl { font-size:12px; letter-spacing:.14em; text-transform:uppercase; color:var(--ink-mute); font-weight:600; }
.pl-stat-desc { font-size:13.5px; color:var(--ink-soft); line-height:1.5; }

/* --- sections common --- */
.pl section { padding: 96px 0; position:relative; }
@media (max-width:720px) { .pl section { padding: 72px 0; } }

.pl-section-head { display:grid; gap:14px; margin-bottom: 56px; max-width: 780px; position:relative; }
.pl-section-head h2 { font-family:var(--font-display); font-weight:400; font-size: clamp(32px, 4.2vw, 48px); line-height:1.05; letter-spacing:-.02em; margin:0; color:var(--ink); text-wrap:balance; }
.pl-section-head h2 em { font-style:italic; color:var(--primary); }
.pl-section-head p { margin:0; color:var(--ink-soft); font-size:17px; line-height:1.6; max-width: 64ch; }

.pl-section-folio { position:absolute; top:96px; right:28px; font-family:var(--font-display); font-style:italic; color:var(--ink-mute); font-size:14px; letter-spacing:-.01em; }
@media (max-width:720px) { .pl-section-folio { top:72px; } }

.pl-marker { font-family:var(--font-display); font-style:italic; font-size:16px; color:var(--primary); letter-spacing:-.005em; display:flex; align-items:center; gap:10px; }
.pl-marker::before { content:""; display:inline-block; width:32px; height:1px; background:var(--primary); }

/* --- features --- */
.pl-features { background: var(--bg); }
.pl-feat-grid { display:grid; gap:0; grid-template-columns:1fr; border:1px solid var(--line); border-radius:var(--r-lg); background:var(--bg-elev); overflow:hidden; box-shadow: 0 1px 0 rgba(26,23,20,.04); }
@media (min-width:820px) { .pl-feat-grid { grid-template-columns: 1fr 1fr; } }
.pl-feat { position:relative; padding:36px 32px 32px; display:flex; flex-direction:column; gap:14px; border-right:1px solid var(--line); border-bottom:1px solid var(--line); transition: background .2s ease; }
.pl-feat:hover { background: color-mix(in srgb, var(--bg-sunken) 60%, transparent); }
@media (min-width:820px) { .pl-feat:nth-child(2n) { border-right:0; } .pl-feat:nth-last-child(-n+2) { border-bottom:0; } }
@media (max-width:819px) { .pl-feat { border-right:0; } .pl-feat:last-child { border-bottom:0; } }
.pl-feat-head { display:flex; align-items:baseline; justify-content:space-between; gap:18px; margin-bottom:4px; }
.pl-feat-kicker { font-size:11px; letter-spacing:.16em; text-transform:uppercase; color:var(--primary); font-weight:600; }
.pl-feat-num { font-family:var(--font-display); font-style:italic; color:var(--ink-mute); font-size:18px; letter-spacing:-.01em; }
.pl-feat h3 { font-family:var(--font-display); font-weight:400; font-size:30px; line-height:1.1; letter-spacing:-.015em; margin:0; color:var(--ink); max-width: 17ch; }
.pl-feat h3 em { font-style:italic; color:var(--primary); }
.pl-feat p { margin:0; color:var(--ink-soft); font-size:15px; line-height:1.6; max-width: 42ch; }
.pl-feat-detail { margin-top: auto; padding-top: 18px; border-top:1px solid var(--line-soft); display:flex; align-items:center; gap:12px; font-size:12.5px; color:var(--ink-mute); flex-wrap:wrap; }
.pl-chip { font-family:var(--font-mono); font-size:11px; padding:3px 8px; border:1px solid var(--line); border-radius:var(--r-sm); color:var(--ink-soft); background:var(--bg); }

/* --- how it works --- */
.pl-how { background: var(--bg-sunken); border-top:1px solid var(--line); border-bottom:1px solid var(--line); }
.pl-steps { display:grid; gap:24px; grid-template-columns:1fr; position:relative; }
@media (min-width:820px) { .pl-steps { grid-template-columns: repeat(3, 1fr); gap:0; } }
.pl-step { background:var(--bg-elev); border:1px solid var(--line); border-radius:var(--r-lg); padding:32px 28px; position:relative; transition: transform .2s ease, box-shadow .2s ease; }
@media (min-width:820px) { .pl-step { border-radius:0; border-right:0; } .pl-step:first-child { border-radius: var(--r-lg) 0 0 var(--r-lg); } .pl-step:last-child { border-radius: 0 var(--r-lg) var(--r-lg) 0; border-right:1px solid var(--line); } }
.pl-step-num { font-family:var(--font-display); font-style:italic; font-size:64px; font-weight:400; color:var(--primary); line-height:.85; margin-bottom:18px; letter-spacing:-.03em; display:flex; align-items:baseline; gap:10px; }
.pl-step-num small { font-size:14px; color:var(--ink-mute); font-style:italic; letter-spacing:0; line-height:1; }
.pl-step h3 { font-family:var(--font-display); font-weight:400; font-size:26px; line-height:1.15; margin:0 0 10px; color:var(--ink); letter-spacing:-.01em; }
.pl-step p { margin:0; color:var(--ink-soft); font-size:15px; line-height:1.55; }
.pl-step-micro { margin-top:18px; padding-top:16px; border-top:1px solid var(--line-soft); font-size:12.5px; color:var(--ink-mute); display:flex; align-items:center; gap:8px; }
.pl-step-micro b { color:var(--ink-soft); font-weight:500; }

/* --- manifiesto / founders --- */
.pl-founders { background:var(--bg); position:relative; }
.pl-founders-grid { display:grid; grid-template-columns:1fr; gap:48px; align-items:start; }
@media (min-width:900px) { .pl-founders-grid { grid-template-columns: .9fr 1.1fr; gap:80px; } }
.pl-fn-left .pl-marker { margin-bottom:14px; }
.pl-fn-left h2 { font-family:var(--font-display); font-weight:400; font-size: clamp(32px, 4vw, 44px); line-height:1.05; letter-spacing:-.02em; color:var(--ink); margin:0 0 18px; text-wrap:balance; }
.pl-fn-left h2 em { font-style:italic; color:var(--primary); }
.pl-fn-left p { color:var(--ink-soft); font-size:15.5px; line-height:1.65; margin:0 0 14px; max-width: 42ch; }
.pl-fn-right { border-left:1px solid var(--line); padding-left:32px; position:relative; }
@media (max-width:899px) { .pl-fn-right { border-left:0; padding-left:0; border-top:1px solid var(--line); padding-top:32px; } }
.pl-quote-mark { position:absolute; top:-18px; left:18px; font-family:var(--font-display); font-style:italic; font-size:80px; color:var(--primary); opacity:.2; line-height:1; user-select:none; }
@media (max-width:899px) { .pl-quote-mark { left:0; top:-32px; } }
.pl-fn-right blockquote { margin:0 0 28px; font-family:var(--font-display); font-style:italic; font-weight:400; font-size: clamp(22px, 2.4vw, 28px); line-height:1.35; color:var(--ink); letter-spacing:-.01em; text-wrap:balance; }
.pl-fn-right blockquote em { color:var(--primary); }
.pl-fn-cite { display:flex; align-items:center; gap:14px; color:var(--ink-soft); font-size:14px; }
.pl-fn-avatar { width:44px; height:44px; border-radius:50%; background: linear-gradient(135deg, oklch(0.72 0.07 50), oklch(0.55 0.10 30)); display:inline-flex; align-items:center; justify-content:center; font-family:var(--font-display); font-style:italic; color:#fff; font-size:20px; font-weight:700; box-shadow: inset 0 0 0 1px rgba(0,0,0,.04); flex-shrink:0; }
.pl-fn-cite b { color:var(--ink); font-weight:600; display:block; }
.pl-fn-cite > span > span { color:var(--ink-mute); font-size:12.5px; }
.pl-fn-sources { margin-top:24px; padding-top:20px; border-top:1px dashed var(--line); display:grid; gap:10px; }
.pl-fn-source { display:grid; grid-template-columns: auto 1fr; gap:12px; font-size:12.5px; color:var(--ink-mute); line-height:1.5; align-items:start; }
.pl-fn-source-ref { font-family:var(--font-display); font-style:italic; color:var(--primary); font-size:13.5px; }
.pl-fn-source b { color:var(--ink-soft); font-weight:500; }

/* --- FAQ --- */
.pl-faq { background:var(--bg-sunken); border-top:1px solid var(--line); }
.pl-faq-grid { display:grid; grid-template-columns:1fr; gap:48px; }
@media (min-width:900px) { .pl-faq-grid { grid-template-columns: .8fr 1.2fr; gap:64px; } }
.pl-faq h2 { font-family:var(--font-display); font-weight:400; font-size: clamp(30px, 3.6vw, 40px); line-height:1.05; letter-spacing:-.02em; margin:0 0 18px; color:var(--ink); }
.pl-faq h2 em { font-style:italic; color:var(--primary); }
.pl-faq-contact { color:var(--ink-soft); font-size:15.5px; line-height:1.6; margin:0; }
.pl-faq-contact a { color:var(--primary); border-bottom:1px solid var(--primary-soft); text-decoration:none; }
.pl-faq-list { border-top:1px solid var(--line); }
details.pl-faq-item { border-bottom:1px solid var(--line); padding: 20px 0; }
details.pl-faq-item summary { list-style:none; cursor:pointer; display:flex; align-items:flex-start; justify-content:space-between; gap:24px; font-family:var(--font-display); font-weight:400; font-size:22px; line-height:1.3; color:var(--ink); letter-spacing:-.01em; }
details.pl-faq-item summary::-webkit-details-marker { display:none; }
.pl-faq-plus { font-family:var(--font-sans); font-size:22px; color:var(--primary); line-height:1; flex-shrink:0; transition: transform .2s ease; font-weight:300; }
details.pl-faq-item[open] .pl-faq-plus { transform: rotate(45deg); }
.pl-faq-answer { margin-top:14px; color:var(--ink-soft); font-size:15px; line-height:1.6; max-width: 64ch; }
.pl-faq-answer a { color:var(--primary); border-bottom:1px solid var(--primary-soft); text-decoration:none; }

/* --- CTA final --- */
.pl-cta-wrap { padding: 0 28px 96px; }
.pl-cta { background: var(--ink); color: #f5f1e8; border-radius: var(--r-lg); padding: 72px 40px; text-align:center; margin: 0 auto; max-width: 1340px; position:relative; overflow:hidden; }
.pl-cta::before { content:""; position:absolute; inset:0; background: radial-gradient(600px 200px at 20% 0%, oklch(0.42 0.13 25 / .28), transparent 60%), radial-gradient(500px 200px at 80% 100%, oklch(0.42 0.13 25 / .18), transparent 60%); pointer-events:none; }
.pl-cta::after { content:"\00A7"; position:absolute; bottom: -40px; right: -10px; font-family:var(--font-display); font-style:italic; font-size: 320px; color: #2a251f; line-height:1; pointer-events:none; z-index:0; }
.pl-cta-inner { position:relative; z-index:1; max-width: 720px; margin:0 auto; }
.pl-cta-eyebrow { color: oklch(0.78 0.11 35) !important; margin-bottom:18px; }
.pl-cta-eyebrow .pl-dot { background: oklch(0.78 0.11 35) !important; }
.pl-cta h2 { font-family:var(--font-display); font-weight:400; font-size: clamp(34px, 4.8vw, 52px); line-height:1.05; letter-spacing:-.02em; margin:0 0 18px; color:#fbf6ec; text-wrap:balance; }
.pl-cta h2 em { font-style:italic; color: oklch(0.78 0.11 35); }
.pl-cta p { color: #c4bdae; font-size: 17px; margin: 0 0 32px; line-height:1.55; }
.pl-waitlist-dark { background:#221d18; border-color:#3a342d; margin: 0 auto; }
.pl-waitlist-dark input { color:#fbf6ec; }
.pl-waitlist-dark input::placeholder { color:#7a7166; }
.pl-waitlist-dark:focus-within { border-color: oklch(0.78 0.11 35); box-shadow: 0 0 0 4px oklch(0.78 0.11 35 / .15); }
.pl-cta-micro { margin-top:18px; font-size:13px; color:#8f867a; }
@media (max-width:720px) { .pl-cta { padding: 56px 22px; border-radius: var(--r); } .pl-cta-wrap { padding: 0 12px 64px; } }

/* --- footer --- */
.pl-footer { border-top: 1px solid var(--line); background: var(--bg); padding: 56px 0 36px; }
.pl-foot-grid { display:grid; gap:36px; grid-template-columns: 1fr; }
@media (min-width:820px) { .pl-foot-grid { grid-template-columns: 1.5fr 1fr 1fr; gap:48px; } }
.pl-foot-brand .pl-brand { margin-bottom:14px; }
.pl-foot-brand p { color:var(--ink-soft); font-size:14.5px; max-width: 32ch; margin:0 0 18px; line-height:1.55; }
.pl-foot-pill { display:inline-block; padding:4px 10px; border:1px solid var(--line); border-radius:99px; color:var(--ink-soft); font-size:11px; letter-spacing:.12em; text-transform:uppercase; font-weight:500; }
.pl-foot-ldot { display:inline-block; width:5px; height:5px; border-radius:50%; background: var(--primary); margin-right:6px; transform:translateY(-1px); }
.pl-foot-col h4 { font-family:var(--font-sans); font-size:11px; letter-spacing:.16em; text-transform:uppercase; color:var(--ink-mute); font-weight:600; margin:0 0 14px; }
.pl-foot-col ul { list-style:none; padding:0; margin:0; display:grid; gap:10px; }
.pl-foot-col a { color:var(--ink-soft); font-size:14.5px; text-decoration:none; transition:color .15s ease; }
.pl-foot-col a:hover { color:var(--ink); }
.pl-foot-bottom { margin-top:48px; padding-top:24px; border-top:1px solid var(--line-soft); display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:12px; font-size:13px; color:var(--ink-mute); }
.pl-made { font-family:var(--font-display); font-style:italic; font-size:15px; color:var(--ink-soft); }
.pl-heart { color:var(--primary); }

/* reduced motion (v3 — scoped a .pl) */
@media (prefers-reduced-motion: reduce) {
    .pl *, .pl *::before, .pl *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

/* selection */
.pl ::selection { background: var(--primary-soft); color:var(--primary); }

/* When the public landing is active, hide all app chrome and overlays */
body.public-landing-active #sidebar,
body.public-landing-active #main,
body.public-landing-active #landing,
body.public-landing-active #auth-overlay,
body.public-landing-active #coming-soon,
body.public-landing-active #mobile-header,
body.public-landing-active #tab-bar,
body.public-landing-active #sidebar-overlay { display: none !important; }
body.public-landing-active {
    display: block;
    height: auto;
    min-height: 100vh;
    overflow: auto;
    overflow-x: hidden;
}
body.public-landing-active,
html:has(body.public-landing-active) { scroll-behavior: smooth; }

/* tablet refinement */
@media (max-width: 820px) {
    .pl section { padding: 64px 0; }
}

/* mobile (≤ 600px) — iPhone target (v3 aditivo) */
@media (max-width: 600px) {
    .pl-wrap { padding: 0 18px; }

    /* pre-header */
    .pl-pre-header .pl-wrap { height: 32px; gap: 10px; }
    .pl-ph-pill { font-size: 9.5px; padding: 2px 7px; letter-spacing: .12em; }
    .pl-ph-ldot { width: 4px; height: 4px; }
    .pl-ph-msg { font-size: 11px; letter-spacing: .02em; }

    /* header */
    .pl-header .pl-nav { height: 56px; }
    .pl-mark { font-size: 26px; }
    .pl-name { font-size: 15px; }
    .pl-btn-ghost { padding: 10px 14px; font-size: 14px; }

    /* hero */
    .pl-hero { padding: 36px 0 48px; border-bottom: 1px solid var(--line-soft); }

    /* filing card → 2-col stacked */
    .pl-filing {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px 16px;
        padding: 12px 0;
        margin-bottom: 32px;
        font-size: 10px;
        letter-spacing: .14em;
    }
    .pl-filing-col { gap: 6px; min-width: 0; }
    .pl-filing-num { font-size: 13px; }

    .pl-hero-grid { gap: 32px; }

    .pl-hero h1 {
        font-size: clamp(32px, 9vw, 44px);
        line-height: 1.05;
        letter-spacing: -.018em;
        margin: 0 0 18px;
    }
    .pl-fn-ref { font-size: .32em; }

    .pl-hero-sub {
        font-size: 16px;
        line-height: 1.55;
        margin: 0 0 22px;
    }

    /* waitlist stacked */
    .pl-waitlist {
        flex-direction: column;
        gap: 6px;
        padding: 6px;
        max-width: 100%;
    }
    .pl-waitlist input {
        width: 100%;
        min-width: 0;
        padding: 12px 14px;
        font-size: 16px; /* evita zoom de iOS al focus */
    }
    .pl-waitlist .pl-btn-primary {
        width: 100%;
        justify-content: center;
        padding: 13px 18px;
        font-size: 15px;
    }

    .pl-hero-meta {
        margin-top: 18px;
        font-size: 12.5px;
        gap: 8px 14px;
    }
    .pl-dotsep { display: none; }

    .pl-marginalia { margin-top: 28px; padding-top: 16px; }
    .pl-margin-note { font-size: 12.5px; grid-template-columns: 22px 1fr; gap: 6px; }
    .pl-margin-ref { font-size: 13px; }

    /* hero card (mock) */
    .pl-hero-card::after { display: none; }
    .pl-hc-running { padding: 8px 14px; font-size: 9.5px; letter-spacing: .12em; }
    .pl-hc-folio { font-size: 12.5px; }
    .pl-hc-body { padding: 16px 16px 18px; }
    .pl-hc-top { padding-bottom: 12px; margin-bottom: 12px; }
    .pl-hc-label { font-size: 16px; }
    .pl-hc-sublabel { font-size: 10px; margin-top: 3px; }
    .pl-hc-grade b { font-size: 28px; }
    .pl-hc-grade span { font-size: 9.5px; }
    .pl-hc-q { padding: 12px 14px; font-size: 14px; margin-bottom: 12px; }
    .pl-hc-who { font-size: 10px; margin-bottom: 5px; }
    .pl-hc-a { font-size: 13.5px; padding: 0 2px 12px; }
    .pl-hc-tag { grid-template-columns: 64px 1fr; gap: 10px; font-size: 12px; }
    .pl-hc-tag .pl-pill { font-size: 9.5px; padding: 3px 6px; }

    /* stat ribbon — 2 col */
    .pl-ribbon { padding: 28px 0; }
    .pl-ribbon .pl-wrap { gap: 20px 18px; }
    .pl-stat { padding-top: 12px; }
    .pl-stat:first-child, .pl-stat:nth-child(2) { border-top: 0; padding-top: 0; }
    .pl-stat-num { font-size: 36px; }
    .pl-stat-lbl { font-size: 10.5px; letter-spacing: .12em; }
    .pl-stat-desc { font-size: 12.5px; line-height: 1.45; }

    /* section heads */
    .pl-section-folio { display: none; }
    .pl-section-head { gap: 12px; margin-bottom: 36px; }
    .pl-marker { font-size: 14px; gap: 8px; }
    .pl-marker::before { width: 22px; }
    .pl-section-head h2 {
        font-size: clamp(28px, 7.5vw, 36px);
        line-height: 1.08;
    }
    .pl-section-head p { font-size: 15.5px; line-height: 1.55; }

    /* features */
    .pl-feat { padding: 26px 22px 24px; gap: 12px; }
    .pl-feat-head { margin-bottom: 2px; }
    .pl-feat-num { font-size: 16px; }
    .pl-feat-kicker { font-size: 10.5px; }
    .pl-feat h3 { font-size: 24px; line-height: 1.15; }
    .pl-feat p { font-size: 14.5px; }
    .pl-feat-detail { padding-top: 14px; gap: 8px; flex-wrap: wrap; }
    .pl-chip { font-size: 10.5px; padding: 3px 7px; }

    /* steps */
    .pl-steps { gap: 14px; }
    .pl-step { padding: 26px 22px; }
    .pl-step-num { font-size: 52px; margin-bottom: 14px; }
    .pl-step-num small { font-size: 12.5px; }
    .pl-step h3 { font-size: 22px; }
    .pl-step p { font-size: 14.5px; }
    .pl-step-micro { margin-top: 14px; padding-top: 12px; font-size: 12px; }

    /* manifiesto */
    .pl-founders-grid { gap: 32px; }
    .pl-fn-right { padding-top: 24px; }
    .pl-quote-mark { font-size: 56px; top: -22px; }
    .pl-fn-right blockquote { font-size: 20px; line-height: 1.35; margin: 0 0 22px; }
    .pl-fn-source { font-size: 12px; gap: 10px; }
    .pl-fn-source-ref { font-size: 13px; }

    /* FAQ */
    .pl-faq-grid { gap: 32px; }
    details.pl-faq-item { padding: 16px 0; }
    details.pl-faq-item summary { font-size: 18px; gap: 16px; line-height: 1.3; }
    .pl-faq-plus { font-size: 20px; margin-top: 1px; }
    .pl-faq-answer { font-size: 14px; margin-top: 10px; }

    /* CTA final */
    .pl-cta-wrap {
        overflow-x: clip;
    }
    .pl-cta {
        padding: 44px 22px;
        border-radius: var(--r);
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
    }
    .pl-cta::after {
        font-size: 160px;
        bottom: -20px; right: -10px;
    }
    .pl-cta h2 {
        font-size: clamp(28px, 7vw, 38px);
        line-height: 1.08;
    }
    .pl-cta p { font-size: 15.5px; margin: 0 0 24px; }
    .pl-cta-wrap { padding: 0 12px 56px; }
    .pl-cta-eyebrow { font-size: 10px; }

    /* footer */
    .pl-footer { padding: 44px 0 28px; }
    .pl-foot-grid { gap: 28px; }
    .pl-foot-brand p { font-size: 14px; }
    .pl-foot-col h4 { font-size: 10.5px; margin-bottom: 12px; }
    .pl-foot-col a { font-size: 14px; }
    .pl-foot-col ul { gap: 8px; }
    .pl-foot-bottom { margin-top: 36px; font-size: 12.5px; gap: 8px; }
    .pl-made { font-size: 14px; }
}

/* iPhone SE / muy chico — ocultar el mensaje del pre-header, solo deja el pill */
@media (max-width: 380px) {
    .pl-ph-msg { display: none; }
}

/* tap targets táctiles ≥ 44px (v3) */
@media (hover: none) and (pointer: coarse) {
    .pl-btn, .pl-waitlist input, details.pl-faq-item summary, .pl-links a {
        min-height: 44px;
    }
    .pl-links a { display: inline-flex; align-items: center; }
}

/* ===== Native (Capacitor) & iOS safe-area ===== */
/* First screens (onboarding / login) are full-screen overlays outside .main,
   so they need their own top inset; top-align on mobile so the logo never
   lands under the Dynamic Island when the content is taller than the screen. */
@media (max-width: 768px) {
    .landing,
    .auth-overlay {
        align-items: flex-start;
    }
    .landing {
        padding-top: calc(1.5rem + env(safe-area-inset-top, 0px));
        padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
    }
    .auth-overlay {
        padding-top: calc(1rem + env(safe-area-inset-top, 0px));
        padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    }
}

/* Keyboard-shortcut hints make no sense on a touch device */
.is-native .focus-hints { display: none; }

/* --- Rescue Mode --- */
.rescue-intro { margin-bottom: 1rem; }
.rescue-intro p { font-size: 13.5px; line-height: 1.55; color: var(--ink-soft); margin: 0; }
.rescue-topic {
    margin-top: 0.5rem;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    letter-spacing: 0.02em;
}
.rescue-options { display: flex; flex-direction: column; gap: 0.75rem; }
.rescue-option {
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 0.875rem 1rem;
    transition: border-color var(--transition);
}
.rescue-option:hover { border-color: var(--primary); }
.rescue-option-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.35rem;
}
.rescue-option-title { font-weight: 600; font-size: 14px; }
.rescue-option-desc {
    font-size: 12.5px;
    color: var(--ink-soft);
    margin: 0 0 0.6rem;
    line-height: 1.45;
}
.rescue-checklist { display: flex; flex-direction: column; gap: 0.6rem; }
.rescue-step {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.875rem;
    border: 1px solid var(--line);
    border-radius: var(--r);
}
.rescue-step-num {
    width: 22px; height: 22px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--primary-ink);
    font-size: 11px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.rescue-step-label { flex: 1; font-size: 13.5px; font-weight: 500; }
.rescue-step-go { flex-shrink: 0; }
