/* =========================================================
   ORBIT — Design System v5
   Warm, editorial, mobile-first. Green is identity, not decoration.
   ========================================================= */

:root {
    /* Brand */
    --orbit-green: #176B3A;
    --orbit-green-dark: #0E4D2A;
    --orbit-green-soft: #E7F1EA;
    --orbit-green-deep: #0B2A1A;

    /* Surfaces */
    --orbit-bg: #F5F2E9; /* Slightly warmer paper */
    --orbit-surface: #FFFDF8;
    --orbit-surface-2: #EFECE3;
    --orbit-surface-3: #E5E2D8;

    /* Text (WCAG AA Compliant) */
    --orbit-text: #171F1A; /* Deeper ink */
    --orbit-text-2: #5E685F; /* Better contrast */
    --orbit-text-3: #7E8880; /* Better contrast */
    --orbit-text-inv: #F3F1E8;

    /* Borders */
    --orbit-border: #DCD9CF;
    --orbit-border-strong: #C8C5BA;

    /* Semantic */
    --orbit-success: #287A4A;
    --orbit-warning: #C77A20;
    --orbit-danger: #C94A45;
    --orbit-info: #4C7FC4;

    /* Accents */
    --accent-purple: #7868B7;
    --accent-blue: #4C7FC4;
    --accent-orange: #D97324;
    --accent-yellow: #D9A441;
    --accent-pink: #C46A8E;

    /* Typography Scales */
    --font-display: 32px;
    --font-h1: 26px;
    --font-h2: 20px;
    --font-h3: 17px;
    --font-body: 15px;
    --font-small: 13px;
    --font-caption: 11.5px;

    /* Spacing */
    --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
    --sp-5: 20px; --sp-6: 24px; --sp-7: 32px; --sp-8: 40px;

    /* Radius — Slightly tighter for a more academic feel */
    --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-xl: 18px; --r-pill: 999px;

    /* Shadow */
    --shadow-sm: 0 1px 3px rgba(30, 45, 35, 0.04);
    --shadow-md: 0 4px 14px rgba(30, 45, 35, 0.06);

    /* Fonts */
    --font-ui: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-editorial: 'Newsreader', Georgia, 'Times New Roman', serif;
    --font: var(--font-ui); /* Fallback for existing refs */

    --sidebar-w: 236px;
    --content-max: 1180px;

    /* Legacy aliases */
    --bg: var(--orbit-bg);
    --surface: var(--orbit-surface);
    --surface-2: var(--orbit-surface-2);
    --surface-soft: var(--orbit-green-soft);
    --text: var(--orbit-text);
    --text-2: var(--orbit-text-2);
    --text-3: var(--orbit-text-3);
    --primary: var(--orbit-green);
    --primary-hover: var(--orbit-green-dark);
    --primary-soft: var(--orbit-green-soft);
    --danger: var(--orbit-danger);
    --danger-soft: #FBE9E7;
    --warning: var(--orbit-warning);
    --warning-soft: #FBF1DF;
    --success: var(--orbit-success);
    --success-soft: #E7F1EA;
    --info: var(--orbit-info);
    --info-soft: #E9F0F9;
    --border: var(--orbit-border);
    --border-strong: var(--orbit-border-strong);
    --divider: #E7E4D9;
    --r-xs: 4px;
    --s-1: var(--sp-1); --s-2: var(--sp-2); --s-3: var(--sp-3);
    --s-4: var(--sp-4); --s-5: var(--sp-5); --s-6: var(--sp-6); --s-7: var(--sp-7);
}

html[data-theme="dark"] {
    --orbit-bg: #0F1410;
    --orbit-surface: #161C17;
    --orbit-surface-2: #1D2420;
    --orbit-surface-3: #232A26;

    --orbit-text: #E9EDE9;
    --orbit-text-2: #9BA69C;
    --orbit-text-3: #7B857D; /* Brighter for dark mode */
    --orbit-text-inv: #F3F1E8;

    --orbit-border: #262E28;
    --orbit-border-strong: #333B35;

    --orbit-green-soft: #16261B;
    --orbit-green-deep: #0A1A10;

    --divider: #232A24;

    --bg: var(--orbit-bg);
    --surface: var(--orbit-surface);
    --surface-2: var(--orbit-surface-2);
    --text: var(--orbit-text);
    --text-2: var(--orbit-text-2);
    --text-3: var(--orbit-text-3);
    --border: var(--orbit-border);
    --border-strong: var(--orbit-border-strong);
    color-scheme: dark;
}

/* =========================================================
   BASE
   ========================================================= */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }

/* Smoother, more organic paper texture */
body {
    margin: 0;
    font-family: var(--font-ui);
    font-size: var(--font-body);
    line-height: 1.5;
    color: var(--orbit-text);
    background-color: var(--orbit-bg);
    /* Lower frequency (0.6) and fewer octaves (2) creates a softer, smoother grain */
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.3' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.025'/%3E%3C/svg%3E");
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color .2s ease, color .2s ease;
}

html[data-theme="dark"] body {
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.3' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.03'/%3E%3C/svg%3E");
}

/* Apply Editorial Serif to major headers */
.home-head-greeting,
.page-title,
.cd-title,
.cd-subtitle,
.auth-page-title,
.onboarding-title,
.setup-complete-title,
.about-hero h2,
.spiritual-welcome-title,
.modal-header h3 {
    font-family: var(--font-editorial);
    font-weight: 600;
    letter-spacing: -0.01em; /* Serif needs less tracking */
}
/* Icons */
.icon { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.75;
    stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; display: block; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }
.logo-mark { display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; flex-shrink: 0; }
.logo-mark svg { width: 100%; height: 100%; display: block; }

/* Text */
.muted { color: var(--orbit-text-2); }
.faint { color: var(--orbit-text-3); }
.small { font-size: var(--font-small); }
.tiny { font-size: var(--font-caption); }
.empty-line { font-size: var(--font-small); color: var(--orbit-text-3); padding: 2px 0; }

/* =========================================================
   APP SHELL
   ========================================================= */
.app-shell { display: flex; min-height: 100vh; background: transparent; }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.page {
    padding: 24px 32px 120px;
    max-width: var(--content-max);
    width: 100%;
    margin: 0 auto;
}

/* =========================================================
   SIDEBAR (desktop)
   ========================================================= */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--orbit-green-deep);
    color: var(--orbit-text-inv);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 22px 14px 16px;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 10px 22px;
    color: #FFFFFF;
}
.sidebar-brand .logo-mark { width: 28px; height: 28px; }
.sidebar-brand span {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.nav-scroll { flex: 1; overflow-y: auto; padding-right: 2px; }
.nav-scroll::-webkit-scrollbar { width: 0; }

.nav-group { margin-bottom: 12px; }
.nav-group-label {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(243, 241, 232, 0.42);
    padding: 14px 12px 6px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: var(--r-sm);
    font-size: 14px;
    font-weight: 500;
    color: rgba(243, 241, 232, 0.78);
    transition: background .12s ease, color .12s ease;
    margin-bottom: 2px;
    cursor: pointer;
}
.nav-item .icon { color: rgba(243, 241, 232, 0.62); transition: color .12s ease; }
.nav-item:hover { background: rgba(255, 255, 255, 0.05); color: #FFFFFF; }
.nav-item:hover .icon { color: #FFFFFF; }
.nav-item.active {
    background: rgba(255, 255, 255, 0.1);
    color: #FFFFFF;
    font-weight: 600;
}
.nav-item.active .icon { color: #FFFFFF; }

.nav-badge {
    margin-left: auto;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--orbit-green-deep);
    padding: 2px 7px;
    border-radius: 20px;
    background: #F3C94C;
}
.sidebar-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 14px 12px;
}
.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 12px;
    margin-top: 6px;
}
.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 12px;
    background: transparent;
    border: 0;
    border-radius: var(--r-sm);
    font-size: 14px;
    font-weight: 500;
    color: rgba(243, 241, 232, 0.72);
    text-align: left;
    cursor: pointer;
    transition: background .12s ease, color .12s ease;
    min-height: 42px;
}
.sidebar-logout .icon { color: rgba(243, 241, 232, 0.55); }
.sidebar-logout:hover {
    background: rgba(201, 74, 69, 0.14);
    color: #E77C76;
}
.sidebar-logout:hover .icon { color: #E77C76; }

/* Sidebar user chip */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px;
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: background .12s ease;
}
.sidebar-user:hover { background: rgba(255, 255, 255, 0.05); }
.sidebar-user .avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #FFFFFF;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 13px;
    flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-info strong {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #FFFFFF;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-info span {
    display: block;
    font-size: 11.5px;
    color: rgba(243, 241, 232, 0.55);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* =========================================================
   TOPBAR (desktop)
   ========================================================= */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 32px 8px;
    background: transparent;
    gap: 16px;
}
.topbar-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--orbit-text-3);
    letter-spacing: 0.01em;
}
.topbar-actions { display: flex; align-items: center; gap: 6px; }

/* =========================================================
   MOBILE — hidden by default
   ========================================================= */
.mobile-topbar { display: none; }
.bottom-nav { display: none; }

/* =========================================================
   DRAWER — always styled, hidden by default
   ========================================================= */
.drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(11, 42, 26, 0.4);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
}
.drawer-overlay.open { opacity: 1; pointer-events: auto; }

.drawer {
    display: none;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 84%;
    max-width: 320px;
    background: var(--orbit-bg);
    color: var(--orbit-text);
    z-index: 210;
    flex-direction: column;
    padding: 24px 16px 20px;
    transform: translateX(-100%);
    transition: transform .24s ease;
    overflow-y: auto;
    border-right: 1px solid var(--orbit-border);
}
.drawer.open { transform: translateX(0); }

.drawer-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 4px 20px;
}
.drawer-brand .logo-mark { width: 26px; height: 26px; }
.drawer-brand span {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--orbit-green);
}

.drawer-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 4px 18px;
}
.drawer-user-avatar {
    width: 52px; height: 52px;
    border-radius: 50%;
    background: var(--orbit-green-soft);
    color: var(--orbit-green);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: 18px;
    flex-shrink: 0;
}
.drawer-user-info { min-width: 0; flex: 1; }
.drawer-user-info strong {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: var(--orbit-text);
    line-height: 1.25;
    letter-spacing: -0.01em;
}
.drawer-user-info span {
    display: block;
    font-size: 12.5px;
    color: var(--orbit-text-2);
    line-height: 1.4;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.drawer-quote {
    padding: 14px 16px;
    background: var(--orbit-green-soft);
    border-radius: var(--r-md);
    margin-bottom: 20px;
}
.drawer-quote-strong {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--orbit-green-dark);
    line-height: 1.35;
}
.drawer-quote-sub {
    font-size: 12.5px;
    color: var(--orbit-green);
    margin-top: 3px;
    line-height: 1.45;
    opacity: 0.85;
}
html[data-theme="dark"] .drawer-quote-strong { color: #4FB477; }
html[data-theme="dark"] .drawer-quote-sub { color: #4FB477; opacity: .78; }

.drawer-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.drawer-nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 12px 12px;
    background: transparent;
    border: 0;
    border-radius: var(--r-sm);
    font-size: 15px;
    font-weight: 500;
    color: var(--orbit-text-2);
    text-align: left;
    cursor: pointer;
    transition: background .12s ease, color .12s ease;
    min-height: 48px;
}
.drawer-nav-item .icon { color: var(--orbit-text-2); transition: color .12s ease; }
.drawer-nav-item:hover { background: var(--orbit-surface-2); color: var(--orbit-text); }
.drawer-nav-item:hover .icon { color: var(--orbit-text); }
.drawer-nav-item.active {
    background: var(--orbit-green-soft);
    color: var(--orbit-green);
    font-weight: 600;
}
.drawer-nav-item.active .icon { color: var(--orbit-green); }

.drawer-divider {
    height: 1px;
    background: var(--divider);
    margin: 14px 4px;
}

.drawer-logout {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 12px 12px;
    margin-top: auto;
    background: transparent;
    border: 0;
    border-radius: var(--r-sm);
    font-size: 15px;
    font-weight: 600;
    color: var(--orbit-danger);
    text-align: left;
    cursor: pointer;
    transition: background .12s ease;
    min-height: 48px;
}
.drawer-logout .icon { color: var(--orbit-danger); }
.drawer-logout:hover { background: var(--danger-soft); }

/* =========================================================
   PAGE HEADER
   ========================================================= */
.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.page-header .title-row { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.page-title {
    font-size: var(--font-h1);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}
.page-sub { font-size: 14px; color: var(--orbit-text-2); margin-top: 2px; }
.back-btn { margin-left: -8px; }

/* =========================================================
   GREETING
   ========================================================= */
.greeting { margin-bottom: 24px; }
.greeting h1 {
    font-size: var(--font-h1);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}
.greeting-meta {
    font-size: 14px;
    color: var(--orbit-text-2);
    margin-top: 4px;
    line-height: 1.5;
}

/* =========================================================
   SECTIONS
   ========================================================= */
.section { margin-bottom: 28px; }
.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--orbit-border);
}
.section-head .section-title {
    font-family: var(--font-ui);
    font-size: 11.5px;
    font-weight: 600;
    color: var(--orbit-text-2);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.section-head .section-action {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 9px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--orbit-green);
    background: transparent;
    border: 0;
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: background .12s ease;
}
.section-head .section-action:hover { background: var(--orbit-green-soft); }

/* =========================================================
   BUTTONS
   ========================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: var(--r-md);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    min-height: 44px;
    transition: background .14s ease, color .14s ease, border-color .14s ease, opacity .14s ease;
    white-space: nowrap;
    cursor: pointer;
}
.btn-primary { background: var(--orbit-green); color: #FFFFFF; border: 1px solid var(--orbit-green); }
.btn-primary:hover { background: var(--orbit-green-dark); border-color: var(--orbit-green-dark); }
.btn-primary:active { transform: translateY(1px); }
.btn-secondary { background: transparent; color: var(--orbit-green); border: 1px solid var(--orbit-green); }
.btn-secondary:hover { background: var(--orbit-green-soft); }
.btn-ghost { background: transparent; color: var(--orbit-text-2); border: 1px solid var(--orbit-border); }
.btn-ghost:hover { background: var(--orbit-surface-2); color: var(--orbit-text); border-color: var(--orbit-border-strong); }
.btn-danger { background: var(--danger-soft); color: var(--orbit-danger); border: 1px solid transparent; }
.btn-danger:hover { background: var(--orbit-danger); color: #FFFFFF; }
.btn-subtle { background: var(--orbit-green-soft); color: var(--orbit-green); border: 1px solid transparent; }
.btn-sm { padding: 7px 12px; font-size: 13px; min-height: 36px; border-radius: var(--r-sm); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.icon-btn {
    width: 36px; height: 36px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--r-sm);
    color: var(--orbit-text-2);
    background: transparent;
    border: 1px solid transparent;
    transition: background .12s ease, color .12s ease, border-color .12s ease;
    flex-shrink: 0;
}
.icon-btn:hover { background: var(--orbit-surface-2); color: var(--orbit-text); }
.icon-btn.bordered { border-color: var(--orbit-border); background: var(--orbit-surface); }
.icon-btn.danger { color: var(--orbit-danger); }
.icon-btn.danger:hover { background: var(--danger-soft); }

/* =========================================================
   INPUTS
   ========================================================= */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--orbit-text-2); }
.input {
    width: 100%;
    padding: 11px 14px;
    background: var(--orbit-surface);
    color: var(--orbit-text);
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-md);
    font-size: 15px;
    min-height: 44px;
    transition: border-color .14s ease, box-shadow .14s ease;
}
.input:focus { outline: none; border-color: var(--orbit-green); box-shadow: 0 0 0 3px var(--orbit-green-soft); }
.input::placeholder { color: var(--orbit-text-3); }
.input.error { border-color: var(--orbit-danger); }
textarea.input { resize: vertical; min-height: 72px; }
select.input {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23657067' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}
.input-xs { padding: 7px 10px; font-size: 13px; min-height: 34px; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .input.has-icon { padding-left: 40px; }
.input-icon { position: absolute; left: 14px; color: var(--orbit-text-3); display: flex; pointer-events: none; }
.input-action {
    position: absolute; right: 8px;
    color: var(--orbit-text-3);
    padding: 8px; border-radius: var(--r-sm);
    display: flex;
}
.input-action:hover { color: var(--orbit-text); background: var(--orbit-surface-2); }
.field-error { font-size: 12px; color: var(--orbit-danger); margin-top: 2px; }
.checkbox-row {
    display: flex; align-items: flex-start; gap: 10px;
    font-size: 14px; color: var(--orbit-text-2); line-height: 1.5;
}
.checkbox-row input {
    margin-top: 3px;
    accent-color: var(--orbit-green);
    width: 18px; height: 18px;
    flex-shrink: 0;
}

/* =========================================================
   LIST PRIMITIVE
   ========================================================= */
.list { display: flex; flex-direction: column; }
.list-row {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 4px;
    border-bottom: 1px solid var(--divider);
    transition: background .12s ease;
}
.list-row:last-child { border-bottom: 0; }
.list-row.clickable { cursor: pointer; }
.list-row.clickable:hover { background: var(--orbit-surface-2); border-radius: var(--r-sm); }
.list-leading {
    width: 36px; height: 36px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--r-sm);
    background: var(--orbit-surface-2);
    color: var(--orbit-text-2);
    flex-shrink: 0;
}
.list-body { flex: 1; min-width: 0; }
.list-body .primary { font-size: 15px; font-weight: 600; color: var(--orbit-text); }
.list-body .secondary { font-size: 12.5px; color: var(--orbit-text-3); margin-top: 2px; }
.list-trailing { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--orbit-text-2); }

.kv {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 4px;
    border-bottom: 1px solid var(--divider);
    gap: 16px;
}
.kv:last-child { border-bottom: 0; }
.kv .k { font-size: 14px; color: var(--orbit-text-2); }
.kv .v { font-size: 14px; font-weight: 600; color: var(--orbit-text); }

/* =========================================================
   HOME — KPI grid, attention, today
   ========================================================= */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 26px;
}
.kpi-card {
    background: var(--orbit-surface);
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-lg);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
    transition: border-color .14s ease, transform .14s ease;
}
.kpi-card:hover { border-color: var(--orbit-border-strong); }
.kpi-card:active { transform: scale(0.99); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-label {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--orbit-text-2);
    letter-spacing: 0.01em;
}
.kpi-icon {
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.kpi-icon.purple { background: #EFEBFA; color: var(--accent-purple); }
.kpi-icon.orange { background: #FBEEDF; color: var(--accent-orange); }
.kpi-icon.blue   { background: #E5EEF9; color: var(--accent-blue); }
.kpi-icon.green  { background: var(--orbit-green-soft); color: var(--orbit-green); }
html[data-theme="dark"] .kpi-icon.purple { background: #2A2440; }
html[data-theme="dark"] .kpi-icon.orange { background: #3A2A18; }
html[data-theme="dark"] .kpi-icon.blue   { background: #1A2538; }
.kpi-value {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    color: var(--orbit-text);
}
.kpi-sub {
    font-size: 12.5px;
    color: var(--orbit-text-2);
    line-height: 1.4;
}

.attention-card {
    background: var(--orbit-surface);
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-lg);
    padding: 18px 20px;
    border-left: 4px solid var(--orbit-green);
}
.attention-title {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.015em;
    margin-bottom: 4px;
}
.attention-detail {
    font-size: 14px;
    color: var(--orbit-text-2);
    margin-bottom: 14px;
    line-height: 1.5;
}
.attention-actions { display: flex; gap: 10px; }

.today-list { display: flex; flex-direction: column; }
.today-item {
    display: flex; align-items: flex-start; gap: 14px;
    padding: 14px 4px;
    border-bottom: 1px solid var(--divider);
}
.today-item:last-child { border-bottom: 0; }
.today-time {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--orbit-text-3);
    font-variant-numeric: tabular-nums;
    min-width: 62px;
    flex-shrink: 0;
    padding-top: 1px;
}
.today-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--orbit-green);
    margin-top: 6px;
    flex-shrink: 0;
}
.today-dot.purple { background: var(--accent-purple); }
.today-dot.blue   { background: var(--accent-blue); }
.today-dot.orange { background: var(--accent-orange); }
.today-body { flex: 1; min-width: 0; }
.today-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--orbit-text);
    line-height: 1.35;
}
.today-meta {
    font-size: 12.5px;
    color: var(--orbit-text-3);
    margin-top: 2px;
}

/* =========================================================
   COURSE ROWS
   ========================================================= */
.course-item {
    background: var(--orbit-surface);
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-md);
    margin-bottom: 10px;
    overflow: hidden;
    transition: border-color .14s ease;
}
.course-item:last-child { margin-bottom: 0; }
.course-item.clickable { cursor: pointer; }
.course-item.clickable:hover { border-color: var(--orbit-border-strong); }
.course-item.open { border-color: var(--orbit-border-strong); }

.course-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 14px 16px;
    background: transparent;
    border: 0;
    text-align: left;
    cursor: pointer;
    gap: 14px;
    font: inherit;
    color: inherit;
}
.course-item.clickable .course-head { padding: 14px 16px; }
.course-head:hover { background: var(--orbit-surface-2); }

.course-head-main { flex: 1; min-width: 0; }
.course-code {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--orbit-text);
    line-height: 1.25;
}
.course-name {
    font-size: 13px;
    color: var(--orbit-text-2);
    margin-top: 2px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.course-head-right {
    display: flex; align-items: center; gap: 10px;
    flex-shrink: 0;
}
.course-meta {
    font-size: 12.5px;
    color: var(--orbit-text-3);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.course-chevron {
    color: var(--orbit-text-3);
    display: flex;
    transition: transform .2s ease;
}
.course-item.open .course-chevron { transform: rotate(180deg); }

.course-actions-inline {
    display: flex;
    gap: 6px;
    padding: 0 12px 12px;
    justify-content: flex-end;
}

.course-body {
    padding: 6px 16px 16px;
    border-top: 1px solid var(--divider);
    background: var(--orbit-surface-2);
}
.course-body-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--divider);
    gap: 12px;
}
.course-body-row:last-of-type { border-bottom: 0; }
.course-body-label {
    font-size: 11.5px;
    color: var(--orbit-text-3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}
.course-body-value {
    font-size: 14px;
    color: var(--orbit-text);
    font-weight: 500;
    text-align: right;
}
.course-body-actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    justify-content: flex-end;
}

/* =========================================================
   TABS
   ========================================================= */
.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--divider);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 500;
    color: var(--orbit-text-3);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
    transition: color .14s ease, border-color .14s ease;
    min-height: 44px;
    cursor: pointer;
}
.tab:hover { color: var(--orbit-text); }
.tab.active { color: var(--orbit-green); border-bottom-color: var(--orbit-green); font-weight: 600; }
.tabs-small .tab { padding: 8px 12px; font-size: 13px; min-height: 40px; }

/* =========================================================
   TASKS
   ========================================================= */
.task-section { margin-bottom: 24px; }
.task-row {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 14px 4px;
    border-bottom: 1px solid var(--divider);
    transition: background .12s ease;
}
.task-row:last-child { border-bottom: 0; }
.task-row:hover { background: var(--orbit-surface-2); border-radius: var(--r-sm); }
.task-check {
    width: 22px; height: 22px;
    border-radius: 6px;
    border: 1.5px solid var(--orbit-border-strong);
    flex-shrink: 0; margin-top: 1px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: all .15s ease;
    background: var(--orbit-surface);
    color: transparent;
}
.task-check:hover { border-color: var(--orbit-green); }
.task-check.done { background: var(--orbit-green); border-color: var(--orbit-green); color: #FFFFFF; }
.task-body { flex: 1; min-width: 0; }
.task-title { font-size: 15px; font-weight: 500; letter-spacing: -0.005em; line-height: 1.4; }
.task-title.done { color: var(--orbit-text-3); text-decoration: line-through; }
.task-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 12.5px; color: var(--orbit-text-3); }
.task-meta .priority-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.task-actions { display: flex; gap: 2px; }
@media (hover: hover) {
    .task-actions { opacity: 0; transition: opacity .12s ease; }
    .task-row:hover .task-actions, .task-row:focus-within .task-actions { opacity: 1; }
}

/* =========================================================
   CALENDAR
   ========================================================= */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-dow {
    font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--orbit-text-3); text-align: center;
    padding: 8px 0 6px;
}
.cal-cell {
    aspect-ratio: 1 / 0.95;
    border-radius: var(--r-sm);
    padding: 6px 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--orbit-text);
    display: flex; flex-direction: column; gap: 3px;
    cursor: pointer;
    transition: background .12s ease;
    position: relative;
}
.cal-cell:hover:not(.muted) { background: var(--orbit-surface-2); }
.cal-cell.muted { color: var(--orbit-text-3); opacity: .45; }
.cal-cell.today { color: var(--orbit-green); font-weight: 700; }
.cal-cell.selected { background: var(--orbit-green); color: #FFFFFF; }
.month-nav {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 14px;
}
.month-nav strong { font-size: 15px; font-weight: 600; }

/* =========================================================
   EXAMS
   ========================================================= */
.exam-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 24px;
    padding: 18px 4px;
    border-bottom: 1px solid var(--divider);
    align-items: start;
}
.exam-row:last-child { border-bottom: 0; }
.exam-row .code {
    font-size: 12px; font-weight: 600;
    color: var(--orbit-text-3);
    letter-spacing: 0.05em; text-transform: uppercase;
}
.exam-row .name {
    font-size: 16px; font-weight: 700;
    margin-top: 4px; letter-spacing: -0.01em;
}
.exam-row .date {
    font-size: 13px; color: var(--orbit-text-2); margin-top: 4px;
}
.exam-row .prep { margin-top: 12px; max-width: 280px; }
.exam-row .prep-label {
    display: flex; justify-content: space-between;
    font-size: 12.5px; color: var(--orbit-text-2); margin-bottom: 6px;
}
.exam-row .countdown {
    text-align: right;
    font-size: 13px;
    color: var(--orbit-text-2);
    white-space: nowrap;
}
.exam-row .countdown strong {
    font-size: 22px; font-weight: 700;
    color: var(--orbit-text); display: block;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
.exam-actions { display: flex; gap: 2px; justify-content: flex-end; margin-top: 8px; }

/* =========================================================
   PROGRESS TRACK
   ========================================================= */
.progress-track {
    height: 4px; border-radius: 4px;
    background: var(--orbit-surface-3);
    overflow: hidden; flex: 1;
}
.progress-fill {
    height: 100%; border-radius: 4px;
    background: var(--orbit-green);
    transition: width .5s ease;
}

/* =========================================================
   METRIC
   ========================================================= */
.metric { margin-bottom: 26px; }
.metric-label {
    font-size: 11.5px; text-transform: uppercase;
    letter-spacing: 0.08em; color: var(--orbit-text-3);
    margin-bottom: 6px; font-weight: 700;
}
.metric-value {
    font-size: 40px; font-weight: 700;
    letter-spacing: -0.03em; line-height: 1;
    color: var(--orbit-text); font-variant-numeric: tabular-nums;
}
.metric-unit {
    font-size: 15px; font-weight: 500;
    color: var(--orbit-text-3); margin-left: 6px;
}
.metric-note {
    font-size: 14px; color: var(--orbit-text-2);
    margin-top: 8px; max-width: 560px; line-height: 1.5;
}
.metric-actions { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }

/* =========================================================
   RESULT TABLE
   ========================================================= */
.result-table { width: 100%; border-collapse: collapse; }
.result-table th, .result-table td {
    text-align: left; padding: 14px 4px;
    border-bottom: 1px solid var(--divider); font-size: 14px;
}
.result-table th {
    font-size: 11.5px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--orbit-text-3); padding-bottom: 10px;
}
.result-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.result-table tr:last-child td { border-bottom: 0; }




/* =========================================================
   FLASHCARDS
   ========================================================= */
.flash-shell { display: flex; flex-direction: column; align-items: center; padding: 20px 10px; }
.flash-card {
    width: 100%; max-width: 460px; min-height: 260px;
    background: var(--orbit-surface);
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-xl);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; padding: 36px 28px;
    cursor: pointer; gap: 16px;
    transition: border-color .15s ease;
    position: relative;
}
.flash-card:hover { border-color: var(--orbit-border-strong); }
.flash-text { font-size: 17px; font-weight: 500; line-height: 1.55; }
.flash-hint {
    position: absolute; bottom: 16px;
    font-size: 11.5px; color: var(--orbit-text-3);
}
.flash-nav { display: flex; gap: 12px; margin-top: 20px; }
.flash-know-row { display: flex; gap: 10px; margin-top: 14px; width: 100%; max-width: 460px; }
.flash-know-row .btn { flex: 1; }

/* =========================================================
   ACHIEVEMENTS / ACTIVITY
   ========================================================= */
.activity-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; max-width: 260px; }
.activity-cell { aspect-ratio: 1; border-radius: 3px; background: var(--orbit-surface-2); }
.activity-cell.on { background: var(--orbit-green); }

.achievement-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 40px; }
.achievement-item {
    display: flex; align-items: flex-start; gap: 14px;
    padding: 16px 4px;
    border-bottom: 1px solid var(--divider);
}
.achievement-item .icon-wrap {
    width: 36px; height: 36px;
    border-radius: var(--r-sm);
    background: var(--orbit-surface-2);
    color: var(--orbit-text-3);
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.achievement-item.earned .icon-wrap { background: var(--orbit-green-soft); color: var(--orbit-green); }
.achievement-item.locked { opacity: .55; }
.achievement-item .body { flex: 1; min-width: 0; }
.achievement-item .body .title { font-size: 14px; font-weight: 600; }
.achievement-item .body .desc { font-size: 12.5px; color: var(--orbit-text-3); margin-top: 2px; }

/* =========================================================
   BADGES
   ========================================================= */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 11.5px; font-weight: 600;
    padding: 2px 9px; border-radius: var(--r-pill);
    letter-spacing: 0.01em;
}
.badge-primary { background: var(--orbit-green-soft); color: var(--orbit-green); }
.badge-muted { background: var(--orbit-surface-2); color: var(--orbit-text-2); }
.badge-success { background: var(--success-soft); color: var(--orbit-success); }
.badge-warning { background: var(--warning-soft); color: var(--orbit-warning); }
.badge-danger { background: var(--danger-soft); color: var(--orbit-danger); }

/* =========================================================
   EMPTY STATE
   ========================================================= */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--orbit-text-2);
}
.empty-state .icon-wrap {
    width: 40px; height: 40px;
    border-radius: var(--r-md);
    background: var(--orbit-surface-2);
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--orbit-text-3);
    margin-bottom: 14px;
}
.empty-state h3 { font-size: 15px; font-weight: 700; color: var(--orbit-text); margin-bottom: 4px; }
.empty-state p { font-size: 13.5px; max-width: 320px; margin: 0 auto 16px; color: var(--orbit-text-2); line-height: 1.55; }

/* =========================================================
   MODAL
   ========================================================= */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(15, 20, 16, 0.4);
    display: flex; align-items: center; justify-content: center;
    z-index: 200; padding: 16px;
    animation: fadeIn .15s ease;
    backdrop-filter: blur(2px);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
    width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto;
    background: var(--orbit-surface);
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-md);
    animation: modalIn .18s ease;
}
@keyframes modalIn {
    from { opacity: 0; transform: translateY(8px) scale(.99); }
    to { opacity: 1; transform: none; }
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--divider);
    position: sticky; top: 0;
    background: var(--orbit-surface);
    z-index: 1;
}
.modal-header h3 { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.modal-body { padding: 20px; }
.modal-foot {
    display: flex; gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid var(--divider);
    justify-content: flex-end;
    position: sticky; 
    bottom: 0;
    background: var(--orbit-surface);
    z-index: 10;
    flex-wrap: wrap; /* Ensures buttons wrap on tiny screens */
}

/* =========================================================
   TOASTS
   ========================================================= */
.toast-stack {
    position: fixed; bottom: 20px; right: 20px;
    display: flex; flex-direction: column; gap: 8px;
    z-index: 400;
}
.toast {
    display: flex; align-items: center; gap: 10px;
    background: var(--orbit-text);
    color: var(--orbit-bg);
    padding: 12px 16px;
    border-radius: var(--r-md);
    font-size: 13.5px; font-weight: 500;
    box-shadow: var(--shadow-md);
    animation: toastIn .2s ease;
    max-width: 340px;
}
html[data-theme="dark"] .toast {
    background: var(--orbit-surface);
    color: var(--orbit-text);
    border: 1px solid var(--orbit-border);
}
@keyframes toastIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

/* =========================================================
   AUTH
   ========================================================= */
.auth-split {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--orbit-bg);
}
.auth-brand-side {
    padding: 56px 56px 56px 64px;
    display: flex; flex-direction: column; justify-content: center;
    border-right: 1px solid var(--divider);
    background: var(--orbit-green-deep);
    color: var(--orbit-text-inv);
}
.auth-brand-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 32px; }
.auth-brand-logo .logo-mark { width: 28px; height: 28px; }
.auth-brand-logo span { font-size: 17px; font-weight: 700; color: #FFFFFF; letter-spacing: -0.015em; }
.auth-brand-side h1 {
    font-size: 34px; font-weight: 700;
    letter-spacing: -0.025em; line-height: 1.15;
    max-width: 420px; color: #FFFFFF;
}
.auth-brand-side > p {
    font-size: 15px; margin-top: 14px;
    max-width: 420px; line-height: 1.6;
    color: rgba(243, 241, 232, 0.78);
}
.auth-brand-points {
    list-style: none; padding: 0; margin: 32px 0 0;
    display: flex; flex-direction: column; gap: 12px;
}
.auth-brand-points li {
    display: flex; align-items: center; gap: 10px;
    font-size: 14px; color: rgba(243, 241, 232, 0.85);
}
.auth-brand-points li::before {
    content: '';
    width: 6px; height: 6px; border-radius: 50%;
    background: #F3C94C; flex-shrink: 0;
}
.auth-panel-side {
    display: flex; align-items: center; justify-content: center;
    padding: 40px;
}
.auth-panel { width: 100%; max-width: 360px; }
.auth-panel h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.auth-panel p { font-size: 14px; color: var(--orbit-text-2); margin-top: 6px; margin-bottom: 24px; }
.auth-panel .btn-block { margin-bottom: 10px; }
.auth-panel .auth-foot-note {
    font-size: 12.5px; color: var(--orbit-text-3);
    margin-top: 22px; text-align: center;
}
.auth-shell {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 40px 24px; background: var(--orbit-bg);
}
.auth-card { width: 100%; max-width: 400px; }
.auth-back {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 14px; color: var(--orbit-text-2);
    margin-bottom: 24px; min-height: 32px;
}
.auth-back:hover { color: var(--orbit-text); }
.auth-card h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.auth-lede { font-size: 14px; color: var(--orbit-text-2); margin-top: 4px; margin-bottom: 26px; line-height: 1.5; }
.auth-foot { text-align: center; font-size: 14px; color: var(--orbit-text-2); margin-top: 20px; }
.auth-foot a { color: var(--orbit-green); font-weight: 600; }
.auth-foot a:hover { text-decoration: underline; }

/* =========================================================
   ONBOARDING
   ========================================================= */
.onboarding-shell {
    min-height: 100vh;
    background: var(--orbit-bg);
    padding: 8vh 24px 60px;
}
.onboarding-wrap { max-width: 640px; margin: 0 auto; }
.onboarding-head { margin-bottom: 40px; }
.onboarding-brand {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 26px;
}
.onboarding-brand .logo-mark { width: 26px; height: 26px; }
.onboarding-brand span { font-size: 16px; font-weight: 700; letter-spacing: -0.015em; }
.onboarding-steps {
    list-style: none; padding: 0; margin: 0;
    display: flex; flex-wrap: wrap; gap: 6px 22px;
}
.onboarding-steps .step {
    display: inline-flex; align-items: baseline; gap: 8px;
    font-size: 12.5px; color: var(--orbit-text-3);
    transition: color .15s ease;
}
.onboarding-steps .step-num {
    font-size: 11px; font-weight: 700;
    letter-spacing: 0.06em;
    font-variant-numeric: tabular-nums;
    color: var(--orbit-text-3);
}
.onboarding-steps .step.done { color: var(--orbit-text-2); }
.onboarding-steps .step.done .step-num { color: var(--orbit-green); }
.onboarding-steps .step.current { color: var(--orbit-text); font-weight: 700; }
.onboarding-steps .step.current .step-num { color: var(--orbit-green); }
.onboarding-body h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.onboarding-lede {
    font-size: 14.5px; color: var(--orbit-text-2);
    margin-top: 8px; margin-bottom: 28px;
    line-height: 1.55; max-width: 480px;
}

/* =========================================================
   PROFILE (simple header)
   ========================================================= */
.profile-header {
    display: flex; align-items: center; gap: 16px;
    margin-bottom: 26px;
    padding: 20px;
    background: var(--orbit-surface);
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-lg);
}
.profile-header .avatar {
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--orbit-green-soft);
    color: var(--orbit-green);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 20px; flex-shrink: 0;
}
.profile-header h1 { font-size: 20px; font-weight: 700; letter-spacing: -0.015em; }
.profile-header .meta { font-size: 13.5px; color: var(--orbit-text-2); margin-top: 2px; }

/* =========================================================
   SETTINGS
   ========================================================= */
.settings-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid var(--divider);
    gap: 16px;
}
.settings-row:last-child { border-bottom: 0; }
.settings-row strong { font-size: 14px; font-weight: 500; }

.seg {
    display: inline-flex; gap: 2px;
    padding: 3px;
    background: var(--orbit-surface-2);
    border-radius: var(--r-sm);
}
.seg button {
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--orbit-text-2);
    border-radius: var(--r-xs);
    transition: background .12s ease, color .12s ease;
    text-transform: capitalize;
    min-height: 34px;
}
.seg button.active {
    background: var(--orbit-surface);
    color: var(--orbit-text);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

/* =========================================================
   UTILITIES
   ========================================================= */
.flex { display: flex; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-5 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-5 { margin-bottom: 24px; }
.text-right { text-align: right; }
.w-full { width: 100%; }
.text-primary { color: var(--orbit-green); }
.text-primary svg { stroke: var(--orbit-green); }

.reveal { animation: revealUp .22s ease; }
@keyframes revealUp {
    from { opacity: 0; transform: translateY(3px); }
    to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

.skip-link {
    position: absolute; left: -9999px; top: 8px;
    background: var(--orbit-green); color: #FFF;
    padding: 8px 14px; border-radius: var(--r-sm);
    font-size: 13px; font-weight: 600; z-index: 1000;
}
.skip-link:focus { left: 8px; outline: 2px solid var(--orbit-green); }

.offline-banner {
    position: fixed; top: 0; left: 0; right: 0;
    z-index: 500;
    background: var(--warning-soft);
    color: #6B4A0B;
    font-size: 12.5px; font-weight: 500;
    text-align: center;
    padding: 7px 12px;
    border-bottom: 1px solid #F0E1BE;
}
html[data-theme="dark"] .offline-banner {
    background: #2A2211; color: #D7A93F; border-bottom-color: #3A2E15;
}
body.offline { padding-top: 30px; }

.bell-btn { position: relative; }
.bell-badge {
    position: absolute; top: 2px; right: 2px;
    min-width: 16px; height: 16px; padding: 0 4px;
    border-radius: 8px;
    background: var(--orbit-danger); color: #FFF;
    font-size: 10px; font-weight: 700;
    line-height: 16px; text-align: center;
    pointer-events: none;
}
.list-row.unread .list-body .primary { font-weight: 700; }
.list-row.unread { cursor: pointer; }
.unread-dot {
    display: inline-block; width: 8px; height: 8px;
    border-radius: 50%; background: var(--orbit-green);
}

/* =========================================================
   FILTER CHIPS
   ========================================================= */


.chip {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--orbit-text-2);
    background: var(--orbit-surface);
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-pill);
    white-space: nowrap;
    cursor: pointer;
    transition: background .14s ease, color .14s ease, border-color .14s ease;
    min-height: 36px;
    flex-shrink: 0;
}
.chip:hover { background: var(--orbit-surface-2); border-color: var(--orbit-border-strong); }
.chip.active {
    background: var(--orbit-green);
    color: #FFFFFF;
    border-color: var(--orbit-green);
    font-weight: 600;
}

/* =========================================================
   COURSE CARDS (Courses page)
   ========================================================= */
.course-card {
    display: flex; gap: 14px;
    padding: 16px;
    background: var(--orbit-surface);
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-lg);
    margin-bottom: 12px;
    cursor: pointer;
    transition: border-color .14s ease, transform .14s ease;
}
.course-card:hover { border-color: var(--orbit-border-strong); }
.course-card:active { transform: scale(0.995); }

.course-card-icon {
    width: 48px; height: 48px;
    border-radius: var(--r-md);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: 20px; font-weight: 700;
    letter-spacing: -0.02em;
}
.course-card-icon.accent-purple { background: #EFEBFA; color: var(--accent-purple); }
.course-card-icon.accent-blue   { background: #E5EEF9; color: var(--accent-blue); }
.course-card-icon.accent-orange { background: #FBEEDF; color: var(--accent-orange); }
.course-card-icon.accent-pink   { background: #F9E9EF; color: var(--accent-pink); }
html[data-theme="dark"] .course-card-icon.accent-purple { background: #2A2440; }
html[data-theme="dark"] .course-card-icon.accent-blue   { background: #1A2538; }
html[data-theme="dark"] .course-card-icon.accent-orange { background: #3A2A18; }
html[data-theme="dark"] .course-card-icon.accent-pink   { background: #3A1F2A; }

.course-card-body { flex: 1; min-width: 0; }
.course-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px; margin-bottom: 10px;
}
.course-card-code {
    font-size: 15px; font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--orbit-text); line-height: 1.25;
}
.course-card-name {
    font-size: 12.5px; color: var(--orbit-text-2);
    margin-top: 2px; line-height: 1.4;
}
.course-card-progress {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 6px;
}
.course-card-pct {
    font-size: 12.5px; font-weight: 600;
    color: var(--orbit-text-2);
    font-variant-numeric: tabular-nums;
    min-width: 34px; text-align: right;
}
.course-card-meta { font-size: 12px; color: var(--orbit-text-3); }

/* =========================================================
   MATERIALS
   ========================================================= */
.materials-search {
    display: flex; align-items: center; gap: 10px;
    background: var(--orbit-surface);
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-md);
    padding: 6px 14px;
    margin-bottom: 16px;
    color: var(--orbit-text-3);
    min-height: 44px;
}
.materials-search .input { flex: 1; outline: none; }
.materials-search .input:focus { box-shadow: none; }

.doc-list { display: flex; flex-direction: column; }

.doc-row:last-child { border-bottom: 0; }
.doc-icon {
    width: 40px; height: 40px;
    border-radius: var(--r-sm);
    background: var(--orbit-green-soft);
    color: var(--orbit-green);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.doc-body { flex: 1; min-width: 0; }
.doc-title {
    font-size: 14.5px; font-weight: 600;
    color: var(--orbit-text); line-height: 1.35;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.doc-meta { font-size: 12.5px; color: var(--orbit-text-3); margin-top: 2px; }
.doc-actions { display: flex; gap: 2px; flex-shrink: 0; }

/* =========================================================
   PROFILE HUB
   ========================================================= */
.profile-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 8px 0 28px;
}
.profile-hero-avatar {
    position: relative;
    margin-bottom: 16px;
}
.avatar-lg {
    width: 88px; height: 88px;
    border-radius: 50%;
    background: var(--orbit-green-soft);
    color: var(--orbit-green);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 32px;
    letter-spacing: -0.02em;
    overflow: hidden;
}
.avatar-badge {
    position: absolute;
    bottom: 2px; right: 2px;
    width: 26px; height: 26px;
    border-radius: 50%;
    background: var(--orbit-green);
    color: #FFFFFF;
    display: flex; align-items: center; justify-content: center;
    border: 3px solid var(--orbit-bg);
}
.avatar-badge .icon { width: 13px; height: 13px; stroke-width: 2.5; }
.profile-hero-name {
    font-size: 22px; font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--orbit-text); line-height: 1.2;
}
.profile-hero-sub {
    font-size: 13.5px; color: var(--orbit-text-2);
    line-height: 1.5; margin-top: 3px;
}

.profile-quote {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 18px 18px;
    background: var(--orbit-green-soft);
    border-radius: var(--r-lg);
    margin-bottom: 24px;
    cursor: pointer;
    transition: transform .14s ease;
}
.profile-quote:active { transform: scale(0.995); }
.quote-mark {
    font-size: 40px; line-height: 0.9;
    font-weight: 700;
    color: var(--orbit-green);
    opacity: 0.55; flex-shrink: 0;
}
.quote-body { flex: 1; min-width: 0; }
.quote-strong {
    font-size: 14px; font-weight: 700;
    color: var(--orbit-green-dark);
    line-height: 1.35;
}
.quote-sub {
    font-size: 12.5px; color: var(--orbit-green);
    opacity: 0.85; margin-top: 3px; line-height: 1.45;
}
.quote-chev {
    color: var(--orbit-green);
    display: flex; padding-top: 2px; flex-shrink: 0;
}
html[data-theme="dark"] .quote-strong { color: #4FB477; }
html[data-theme="dark"] .quote-sub { color: #4FB477; opacity: .75; }
html[data-theme="dark"] .quote-mark { color: #4FB477; }
html[data-theme="dark"] .quote-chev { color: #4FB477; }

.profile-list {
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--divider);
}
.profile-row {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 18px 4px;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--divider);
    font-size: 15px;
    color: var(--orbit-text);
    text-align: left;
    cursor: pointer;
    transition: background .12s ease;
    min-height: 60px;
}
.profile-row:hover { background: var(--orbit-surface-2); border-radius: var(--r-sm); }
.profile-row:active { background: var(--orbit-surface-2); }
.profile-row-icon {
    width: 34px; height: 34px;
    border-radius: var(--r-sm);
    background: var(--orbit-surface-2);
    color: var(--orbit-text-2);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.profile-row-label { flex: 1; font-weight: 500; }
.profile-row-value {
    font-size: 13.5px; color: var(--orbit-text-3);
    flex-shrink: 0;
}
.profile-row-chev { color: var(--orbit-text-3); display: flex; flex-shrink: 0; }

.profile-row-danger {
    color: var(--orbit-danger);
    border-bottom: 0;
}
.profile-row-danger .profile-row-icon {
    background: var(--danger-soft);
    color: var(--orbit-danger);
}
.profile-row-danger:hover { background: var(--danger-soft); }

/* Help FAQ */
.faq-item {
    padding: 16px;
    border-bottom: 1px solid var(--divider);
}
.faq-item:last-child { border-bottom: 0; }
.faq-item strong {
    display: block;
    font-size: 14px; font-weight: 700;
    color: var(--orbit-text); margin-bottom: 4px;
}
.faq-item p {
    font-size: 13px; color: var(--orbit-text-2); line-height: 1.55;
}

/* About hero */
.about-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 12px 0 24px;
}
.about-hero .logo-mark {
    margin-bottom: 12px;
    border-radius: var(--r-md);
}
.about-hero h2 {
    font-size: 24px; font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--orbit-text);
}
.about-version {
    font-size: 13px; color: var(--orbit-text-3); margin-top: 4px;
}

/* Profile groups */
.settings-group { margin-bottom: 26px; }
.settings-group-title {
    font-size: 11.5px; font-weight: 700;
    letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--orbit-text-3); padding: 0 4px 8px;
}
.settings-list {
    background: var(--orbit-surface);
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-lg);
    overflow: hidden;
}
.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--divider);
}
.settings-item:last-child { border-bottom: 0; }
.settings-item .k { font-size: 14px; color: var(--orbit-text-2); }
.settings-item .v { font-size: 14px; font-weight: 600; color: var(--orbit-text); text-align: right; }

.settings-row-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 16px;
    font-size: 15px;
    font-weight: 500;
    color: var(--orbit-text);
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--divider);
    text-align: left;
    cursor: pointer;
    min-height: 52px;
    transition: background .12s ease;
}
.settings-row-btn:last-child { border-bottom: 0; }
.settings-row-btn:hover { background: var(--orbit-surface-2); }
.settings-row-btn.danger { color: var(--orbit-danger); }
.settings-row-btn .chev { color: var(--orbit-text-3); display: flex; }

/* =========================================================
   RESPONSIVE — tablet
   ========================================================= */
@media (max-width: 1100px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

/* =========================================================
   RESPONSIVE — mobile
   ========================================================= */
@media (max-width: 860px) {
    .sidebar { display: none; }
    .topbar { display: none; }

    .page {
        padding: 12px 16px calc(96px + env(safe-area-inset-bottom));
        max-width: 100%;
    }

    /* Show drawer on mobile */
    .drawer-overlay { display: block; }
    .drawer { display: flex; }

    /* Mobile topbar */
      .mobile-topbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: calc(12px + env(safe-area-inset-top)) 16px 10px;
        background: transparent;
        position: sticky; top: 0; z-index: 30;
    }
    .mobile-topbar .brand {
        display: flex; align-items: center; gap: 8px;
        font-size: 15px; font-weight: 700; letter-spacing: -0.015em;
    }
    .mobile-topbar .brand .logo-mark { width: 24px; height: 24px; }
    .mobile-topbar .page-label {
        font-size: 15px; font-weight: 700; letter-spacing: -0.015em;
    }

    /* Bottom nav */
    .bottom-nav {
        display: flex;
        position: fixed;
        left: 0; right: 0; bottom: 0;
        background: var(--orbit-surface);
        border-top: 1px solid var(--orbit-border);
        padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
        justify-content: space-around;
        z-index: 100;
    }
    .bn-item {
        flex: 1;
        display: flex; flex-direction: column; align-items: center;
        gap: 3px;
        padding: 8px 4px;
        font-size: 10.5px;
        font-weight: 600;
        color: var(--orbit-text-3);
        border-radius: var(--r-sm);
        transition: color .12s ease;
        cursor: pointer;
        min-height: 52px;
        justify-content: center;
    }
    .bn-item.active { color: var(--orbit-green); }
    .bn-item.active .icon { stroke-width: 2.2; }

    /* Compact page */
    .greeting h1 { font-size: 22px; }
    .page-title { font-size: 20px; }
    .metric-value { font-size: 34px; }

    /* KPI grid */
    .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 22px; }
    .kpi-card { padding: 14px; border-radius: var(--r-md); }
    .kpi-value { font-size: 22px; }
    .kpi-icon { width: 28px; height: 28px; }
    .kpi-icon .icon { width: 15px; height: 15px; }
    .kpi-label { font-size: 11.5px; }
    .kpi-sub { font-size: 11.5px; }

    /* Course rows tighter */
    .course-head { padding: 13px 14px; gap: 12px; }
    .course-code { font-size: 14.5px; }
    .course-name { font-size: 12.5px; }
    .course-meta { font-size: 12px; }
    .course-body { padding: 4px 14px 14px; }
    .course-card { padding: 14px; gap: 12px; }
    .course-card-icon { width: 44px; height: 44px; font-size: 18px; }
    .course-card-code { font-size: 14.5px; }

    /* Attention */
    .attention-card { padding: 16px; }

    /* Today items */
    .today-item { padding: 13px 2px; gap: 12px; }
    .today-time { min-width: 56px; font-size: 12px; }

    /* Exam rows */
    .exam-row { grid-template-columns: 1fr; gap: 12px; padding: 16px 4px; }
    .exam-row .countdown { text-align: left; }
    .exam-row .countdown strong { display: inline; font-size: 16px; margin-right: 4px; }
    .exam-actions { justify-content: flex-start; }

    /* Modal */
    .modal { max-width: 100%; }
    .modal-header, .modal-body, .modal-foot { padding-left: 16px; padding-right: 16px; }

    /* Toast */
    .toast-stack {
        left: 16px; right: 16px;
        bottom: calc(80px + env(safe-area-inset-bottom));
        align-items: stretch;
    }
    .toast { max-width: none; justify-content: center; }

    /* Tables */
    .result-table th, .result-table td { padding: 12px 2px; font-size: 13.5px; }
    .achievement-grid { grid-template-columns: 1fr; gap: 0; }
    .achievement-item { padding: 14px 4px; }

    /* Auth single column */
    .auth-split { grid-template-columns: 1fr; }
    .auth-brand-side {
        border-right: 0;
        border-bottom: 1px solid var(--divider);
        padding: 40px 24px 32px;
    }
    .auth-brand-side h1 { font-size: 26px; }
    .auth-brand-points { display: none; }
    .auth-panel-side { padding: 32px 24px 48px; }

    /* Onboarding */
    .onboarding-shell { padding: 6vh 20px 40px; }
    .onboarding-head { margin-bottom: 32px; }
    .onboarding-steps { gap: 4px 14px; }
    .onboarding-steps .step-name { display: none; }
    .onboarding-steps .step.current .step-name { display: inline; }

    /* What-if summary stacks */
    .whatif-summary { grid-template-columns: 1fr; gap: 12px; }
    .whatif-row { grid-template-columns: 1fr 40px 76px; gap: 8px; }
    .scenario-grid { grid-template-columns: 1fr; gap: 10px; }

    /* Path */
    .path-value { font-size: 26px; }
    .path-header { gap: 8px; }
    .path-stop { gap: 10px; padding: 9px 0; }

    /* Profile */
    .avatar-lg { width: 78px; height: 78px; font-size: 28px; }
    .profile-hero-name { font-size: 20px; }
    .profile-row { padding: 16px 4px; min-height: 56px; }
    .profile-row-icon { width: 32px; height: 32px; }
}

@media (max-width: 420px) {
    .page { padding: 10px 14px calc(92px + env(safe-area-inset-bottom)); }
    .greeting h1 { font-size: 20px; }
    .metric-value { font-size: 30px; }
    .kpi-card { padding: 12px; }
    .kpi-value { font-size: 20px; }
    .kpi-icon { width: 26px; height: 26px; }
}

/* =========================================================
   STUDY — hub page
   ========================================================= */
.study-hero {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 0 20px;
}
.study-hero-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--orbit-green-soft);
    color: var(--orbit-green);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}
.study-hero-title {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--orbit-text);
}

.study-motivation {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 24px 22px;
    background: var(--orbit-green-soft);
    border-radius: var(--r-lg);
    margin-bottom: 28px;
}
.study-motivation-text {
    flex: 1;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.25;
    color: var(--orbit-green-dark);
}
.study-motivation-btn {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: #FFFFFF;
    color: var(--orbit-green-dark);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    border: 0;
    transition: transform .14s ease;
}
.study-motivation-btn:active { transform: scale(0.94); }
html[data-theme="dark"] .study-motivation-text { color: #4FB477; }
html[data-theme="dark"] .study-motivation-btn { background: #1B2A20; color: #4FB477; }

/* Quick study */
.quick-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.quick-action {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    border: 0;
    border-radius: var(--r-lg);
    text-align: left;
    cursor: pointer;
    transition: transform .14s ease;
    width: 100%;
}
.quick-action:active { transform: scale(0.995); }
.quick-action.purple { background: #EFEBFA; color: #4A3E7A; }
.quick-action.green  { background: var(--orbit-green-soft); color: var(--orbit-green-dark); }
.quick-action.orange { background: #FBEEDF; color: #8A4A16; }
html[data-theme="dark"] .quick-action.purple { background: #221F3A; color: #B7ADE0; }
html[data-theme="dark"] .quick-action.green  { background: var(--orbit-green-soft); color: #7FC69A; }
html[data-theme="dark"] .quick-action.orange { background: #2E2317; color: #D9A441; }

.quick-action-icon {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.7);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
html[data-theme="dark"] .quick-action-icon { background: rgba(0,0,0,0.25); }

.quick-action-body { flex: 1; min-width: 0; }
.quick-action-title {
    display: block;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.005em;
}
.quick-action-sub {
    display: block;
    font-size: 12.5px;
    margin-top: 2px;
    opacity: 0.78;
}
.quick-action-chev { opacity: 0.55; display: flex; flex-shrink: 0; }

/* Weak areas */
.weak-list { display: flex; flex-direction: column; }
.weak-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--divider);
}
.weak-item:last-child { border-bottom: 0; }
.weak-icon {
    width: 36px; height: 36px;
    border-radius: var(--r-sm);
    background: var(--orbit-surface-2);
    color: var(--orbit-text-2);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.weak-body { flex: 1; min-width: 0; }
.weak-title {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--orbit-text);
    line-height: 1.35;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.weak-sub {
    font-size: 12.5px;
    color: var(--orbit-text-3);
    margin-top: 2px;
}
.weak-status {
    font-size: 11.5px;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: var(--r-pill);
    letter-spacing: 0.02em;
    flex-shrink: 0;
}
.weak-status.warn { background: #FBE3E1; color: #B03A34; }
.weak-status.info { background: #FBF1DF; color: #8A5518; }
.weak-status.stable { background: var(--orbit-green-soft); color: var(--orbit-green); }
html[data-theme="dark"] .weak-status.warn { background: #3A1E1C; color: #E77C76; }
html[data-theme="dark"] .weak-status.info { background: #2E2317; color: #D9A441; }

@media (max-width: 600px) {
    .study-hero-title { font-size: 22px; }
    .study-motivation { padding: 20px 18px; }
    .study-motivation-text { font-size: 18px; }
    .quick-action { padding: 14px 16px; gap: 12px; }
    .quick-action-icon { width: 36px; height: 36px; }
    .quick-action-title { font-size: 14.5px; }
}

/* =========================================================
   HOME — reference layout
   ========================================================= */
.home-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 6px 0 22px;
}
.home-head-greeting {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.15;
    color: var(--orbit-text);
}
.home-head-sub {
    font-size: 14.5px;
    color: var(--orbit-text-2);
    margin-top: 4px;
    line-height: 1.5;
}
.home-head-avatar {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: var(--orbit-green-soft);
    color: var(--orbit-green);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
    margin-top: 4px;
}

/* Dual metric row (CGPA + Target) */
.dual-metric {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 28px;
}
.metric-card {
    background: var(--orbit-surface);
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-lg);
    padding: 16px 18px;
}
.metric-card-label {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--orbit-text-2);
    letter-spacing: 0.01em;
    margin-bottom: 10px;
}
.metric-card-value {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    color: var(--orbit-text);
    margin-bottom: 12px;
}
.metric-card-track {
    height: 3px;
    border-radius: 3px;
    background: var(--orbit-surface-3);
    overflow: hidden;
}
.metric-card-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--orbit-green);
    transition: width .5s ease;
}

/* Attention card (rose) */
.attention-card {
    display: flex;
    gap: 14px;
    padding: 18px;
    background: #FBE3E1;
    border: 1px solid #F3C9C5;
    border-radius: var(--r-lg);
    border-left: 0;
}
html[data-theme="dark"] .attention-card {
    background: #2E1A18;
    border-color: #3E2422;
}
.attention-icon {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: #C94A45;
    color: #FFFFFF;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 1px;
}
.attention-body { flex: 1; min-width: 0; }
.attention-title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #7A2D28;
    line-height: 1.25;
}
html[data-theme="dark"] .attention-title { color: #F0A09B; }
.attention-sub {
    font-size: 14px;
    color: #7A2D28;
    opacity: 0.85;
    margin-top: 2px;
    line-height: 1.4;
}
html[data-theme="dark"] .attention-sub { color: #F0A09B; }
.attention-when {
    font-size: 13px;
    color: #B03A34;
    margin-top: 8px;
    line-height: 1.4;
}
html[data-theme="dark"] .attention-when { color: #E77C76; }
.attention-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding: 9px 16px;
    background: var(--orbit-green);
    color: #FFFFFF;
    border: 0;
    border-radius: var(--r-pill);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    min-height: 36px;
    transition: background .14s ease, transform .14s ease;
}
.attention-btn:hover { background: var(--orbit-green-dark); }
.attention-btn:active { transform: translateY(1px); }
.attention-btn-arrow { font-size: 14px; line-height: 1; }

/* Checklist */
.checklist { display: flex; flex-direction: column; }
.checklist-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--divider);
}
.checklist-row:last-child { border-bottom: 0; }
.checklist-circle {
    width: 20px; height: 20px;
    border-radius: 50%;
    border: 1.5px solid var(--orbit-border-strong);
    flex-shrink: 0;
    background: var(--orbit-surface);
    transition: border-color .14s ease;
}
.checklist-row:hover .checklist-circle { border-color: var(--orbit-green); }
.checklist-body { flex: 1; min-width: 0; }
.checklist-label {
    font-size: 14.5px;
    font-weight: 500;
    color: var(--orbit-text);
    line-height: 1.4;
}
.checklist-meta {
    font-size: 12.5px;
    color: var(--orbit-text-3);
    margin-top: 1px;
}

/* Encouragement strip */
.encourage-strip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: var(--orbit-surface-2);
    border-radius: var(--r-md);
    font-size: 13.5px;
    color: var(--orbit-text-2);
    line-height: 1.4;
    margin-top: 8px;
    margin-bottom: 20px;
}
.encourage-icon {
    color: var(--orbit-green);
    display: flex;
    flex-shrink: 0;
}

@media (max-width: 420px) {
    .home-head-greeting { font-size: 24px; }
    .home-head-avatar { width: 40px; height: 40px; font-size: 14px; }
    .metric-card-value { font-size: 24px; }
    .metric-card { padding: 14px 16px; }
}

/* =========================================================
   COURSES LIST — reference layout
   ========================================================= */
.courses-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    background: transparent;
}
.courses-tab {
    padding: 9px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--orbit-text-2);
    background: transparent;
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-pill);
    cursor: pointer;
    transition: background .14s ease, color .14s ease, border-color .14s ease;
    min-height: 40px;
}
.courses-tab:hover { background: var(--orbit-surface-2); }
.courses-tab.active {
    background: var(--orbit-green);
    color: #FFFFFF;
    border-color: var(--orbit-green);
}

.course-list { display: flex; flex-direction: column; gap: 12px; }

.course-row-v2 {
    display: flex;
    align-items: stretch;
    gap: 14px;
    width: 100%;
    padding: 16px 16px 16px 0;
    background: var(--orbit-surface);
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-lg);
    text-align: left;
    cursor: pointer;
    transition: border-color .14s ease, transform .14s ease;
}
.course-row-v2:hover { border-color: var(--orbit-border-strong); }
.course-row-v2:active { transform: scale(0.995); }

.course-accent {
    width: 4px;
    border-radius: 0 4px 4px 0;
    flex-shrink: 0;
    margin: -1px 0 -1px -1px;
}
.course-accent.acc-green { background: #287A4A; }
.course-accent.acc-blue  { background: #4C7FC4; }
.course-accent.acc-amber { background: #D9A441; }
.course-accent.acc-red   { background: #C94A45; }
.course-accent.acc-orange{ background: #D97324; }

.course-v2-body { flex: 1; min-width: 0; padding-left: 12px; display: flex; flex-direction: column; gap: 6px; }
.course-v2-top {
    display: flex;
    align-items: center;
    gap: 10px;
}
.course-v2-code {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--orbit-text);
    flex: 1;
    min-width: 0;
}
.course-v2-pct {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--orbit-text-2);
    font-variant-numeric: tabular-nums;
}
.course-v2-grade {
    font-size: 14px;
    font-weight: 700;
    color: var(--orbit-text);
    min-width: 20px;
    text-align: right;
}
.course-v2-name {
    font-size: 13px;
    color: var(--orbit-text-2);
    line-height: 1.4;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    margin-top: -2px;
}
.course-v2-bar {
    height: 3px;
    border-radius: 3px;
    background: var(--orbit-surface-3);
    overflow: hidden;
    display: block;
    margin-top: 2px;
}
.course-v2-bar-fill {
    display: block;
    height: 100%;
    background: var(--orbit-green);
    border-radius: 3px;
    transition: width .5s ease;
}
.course-v2-meta {
    font-size: 12px;
    color: var(--orbit-text-3);
    margin-top: 2px;
}
.course-v2-chev {
    color: var(--orbit-text-3);
    display: flex;
    align-items: center;
    flex-shrink: 0;
    padding-right: 4px;
}

/* =========================================================
   COURSE DETAIL
   ========================================================= */
.cd-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 12px;
}
.cd-header-meta {
    font-size: 13px;
    font-weight: 500;
    color: var(--orbit-text-3);
    letter-spacing: 0.02em;
}

.cd-titleblock { margin-bottom: 20px; }
.cd-title {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.15;
    color: var(--orbit-text);
}
.cd-subtitle {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--orbit-text);
    margin-top: 2px;
}
.cd-badge {
    display: inline-block;
    margin-top: 10px;
    padding: 5px 14px;
    font-size: 12px;
    font-weight: 700;
    background: var(--orbit-green-soft);
    color: var(--orbit-green);
    border-radius: var(--r-pill);
    letter-spacing: 0.02em;
}

.cd-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--divider);
    margin-bottom: 22px;
    overflow-x: auto;
    scrollbar-width: none;
}
.cd-tabs::-webkit-scrollbar { display: none; }
.cd-tab {
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 500;
    color: var(--orbit-text-3);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
    cursor: pointer;
    transition: color .14s ease, border-color .14s ease;
    min-height: 44px;
}
.cd-tab:hover { color: var(--orbit-text); }
.cd-tab.active {
    color: var(--orbit-text);
    border-bottom-color: var(--orbit-green);
    font-weight: 600;
}

/* Progress row with ring */
.cd-progress-row {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 4px 0 24px;
    border-bottom: 1px solid var(--divider);
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.cd-ring-wrap {
    position: relative;
    width: 140px;
    height: 140px;
    flex-shrink: 0;
}
.cd-ring {
    width: 140px;
    height: 140px;
    display: block;
}
.cd-ring-value {
    position: absolute;
    top: 48px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--orbit-text);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.cd-ring-label {
    position: absolute;
    top: 82px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 9.5px;
    color: var(--orbit-text-3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    line-height: 1;
}
.cd-progress-stats {
    flex: 1;
    min-width: 140px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.cd-stat {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--divider);
}
.cd-stat:last-child { border-bottom: 0; padding-bottom: 0; }
.cd-stat-label {
    font-size: 13px;
    color: var(--orbit-text-2);
}
.cd-stat-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--orbit-text);
    font-variant-numeric: tabular-nums;
}

/* Section */
.cd-section { margin-bottom: 24px; }
.cd-section-head {
    font-size: 15px;
    font-weight: 700;
    color: var(--orbit-text);
    letter-spacing: -0.005em;
    margin-bottom: 12px;
}

/* Next up card */
.cd-next-card {
    display: flex;
    gap: 14px;
    padding: 18px;
    background: #FBE3E1;
    border: 1px solid #F3C9C5;
    border-radius: var(--r-lg);
}
html[data-theme="dark"] .cd-next-card {
    background: #2E1A18;
    border-color: #3E2422;
}
.cd-next-icon {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: #C94A45;
    color: #FFFFFF;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px;
    font-weight: 700;
    flex-shrink: 0;
}
.cd-next-body { flex: 1; min-width: 0; }
.cd-next-title {
    font-size: 15px;
    font-weight: 700;
    color: #7A2D28;
    line-height: 1.25;
}
html[data-theme="dark"] .cd-next-title { color: #F0A09B; }
.cd-next-when {
    font-size: 13px;
    color: #B03A34;
    margin-top: 4px;
}
html[data-theme="dark"] .cd-next-when { color: #E77C76; }

/* Activity list */
.cd-activity { display: flex; flex-direction: column; }
.cd-activity-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--divider);
}
.cd-activity-row:last-child { border-bottom: 0; }
.cd-activity-icon {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--orbit-green-soft);
    color: var(--orbit-green);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.cd-activity-body { flex: 1; min-width: 0; }
.cd-activity-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--orbit-text);
    line-height: 1.4;
}
.cd-activity-when {
    font-size: 12.5px;
    color: var(--orbit-text-3);
    margin-top: 2px;
}

@media (max-width: 600px) {
    .cd-title { font-size: 22px; }
    .cd-subtitle { font-size: 16px; }
    .cd-progress-row { gap: 16px; }
    .cd-ring-wrap { width: 120px; height: 120px; }
    .cd-ring { width: 120px; height: 120px; }
    .cd-ring-value { font-size: 22px; top: 40px; }
    .cd-ring-label { font-size: 9px; top: 70px; }
}

/* =========================================================
   MATERIALS — reference layout
   ========================================================= */
.doc-list { display: flex; flex-direction: column; }

.doc-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 0;
}

.doc-icon {
    width: 44px; height: 44px;
    border-radius: var(--r-md);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.doc-icon.doc-red    { background: #FBE3E1; color: #C94A45; }
.doc-icon.doc-blue   { background: #E5EEF9; color: #4C7FC4; }
.doc-icon.doc-purple { background: #EFEBFA; color: #7868B7; }
html[data-theme="dark"] .doc-icon.doc-red    { background: #3A1E1C; color: #E77C76; }
html[data-theme="dark"] .doc-icon.doc-blue   { background: #1A2538; color: #82A8E6; }
html[data-theme="dark"] .doc-icon.doc-purple { background: #2A2440; color: #B7ADE0; }

.doc-icon-label {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.06em;
}

.doc-body { flex: 1; min-width: 0; }
.doc-title {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--orbit-text);
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.doc-meta {
    font-size: 12.5px;
    color: var(--orbit-text-3);
    margin-top: 2px;
}
.doc-actions { display: flex; gap: 2px; flex-shrink: 0; }

/* Filter chips — reference style (no borders on inactive) */
.filter-chips {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
}
.filter-chips::-webkit-scrollbar { display: none; }
.chip {
    padding: 8px 16px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--orbit-text-2);
    background: transparent;
    border: 0;
    border-radius: var(--r-pill);
    white-space: nowrap;
    cursor: pointer;
    transition: background .14s ease, color .14s ease;
    min-height: 36px;
    flex-shrink: 0;
}
.chip:hover { background: var(--orbit-surface-2); color: var(--orbit-text); }
.chip.active {
    background: var(--orbit-green);
    color: #FFFFFF;
    font-weight: 600;
}

/* Floating Add Material button */
.fab-add {
    position: fixed;
    right: 20px;
    bottom: calc(80px + env(safe-area-inset-bottom));
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 20px;
    background: var(--orbit-green);
    color: #FFFFFF;
    border: 0;
    border-radius: var(--r-pill);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(23, 107, 58, 0.28);
    transition: transform .14s ease, background .14s ease;
    z-index: 90;
}
.fab-add:hover { background: var(--orbit-green-dark); }
.fab-add:active { transform: scale(0.97); }

@media (min-width: 861px) {
    .fab-add {
        right: calc((100vw - var(--content-max)) / 2 + 40px);
        bottom: 40px;
    }
}
@media (max-width: 420px) {
    .fab-add { right: 14px; padding: 11px 18px; font-size: 13px; }
}

/* =========================================================
   ADD MATERIAL — full-screen sheet
   ========================================================= */
.add-mat-shell {
    position: fixed;
    inset: 0;
    background: var(--orbit-green-deep);
    z-index: 180;
    display: flex;
    flex-direction: column;
    padding: calc(16px + env(safe-area-inset-top)) 20px calc(20px + env(safe-area-inset-bottom));
    overflow-y: auto;
}
.add-mat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0 24px;
}
.add-mat-title {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #FFFFFF;
}
.add-mat-icon-btn {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: transparent;
    border: 0;
    color: #FFFFFF;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: background .14s ease;
}
.add-mat-icon-btn:hover { background: rgba(255,255,255,0.1); }

.add-mat-card {
    background: var(--orbit-surface);
    border-radius: var(--r-lg);
    overflow: hidden;
}
.add-mat-opt {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 16px 18px;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--divider);
    text-align: left;
    cursor: pointer;
    transition: background .12s ease;
    min-height: 68px;
}
.add-mat-opt:last-child { border-bottom: 0; }
.add-mat-opt:hover { background: var(--orbit-surface-2); }
.add-mat-opt-icon {
    width: 40px; height: 40px;
    border-radius: var(--r-sm);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.add-mat-opt-icon.pdf    { background: #FBE3E1; color: #C94A45; }
.add-mat-opt-icon.doc    { background: #E5EEF9; color: #4C7FC4; }
.add-mat-opt-icon.img    { background: #E5EEF9; color: #4C7FC4; }
.add-mat-opt-icon.link   { background: #EFEBFA; color: #7868B7; }
.add-mat-opt-icon.folder { background: var(--orbit-surface-2); color: var(--orbit-text-2); }
html[data-theme="dark"] .add-mat-opt-icon.pdf  { background: #3A1E1C; color: #E77C76; }
html[data-theme="dark"] .add-mat-opt-icon.doc  { background: #1A2538; color: #82A8E6; }
html[data-theme="dark"] .add-mat-opt-icon.img  { background: #1A2538; color: #82A8E6; }
html[data-theme="dark"] .add-mat-opt-icon.link { background: #2A2440; color: #B7ADE0; }

.add-mat-opt-body { flex: 1; min-width: 0; }
.add-mat-opt-title {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: var(--orbit-text);
    line-height: 1.3;
}
.add-mat-opt-sub {
    display: block;
    font-size: 12.5px;
    color: var(--orbit-text-3);
    margin-top: 2px;
}
.add-mat-opt-chev { color: var(--orbit-text-3); display: flex; flex-shrink: 0; }

.add-mat-footer {
    margin-top: auto;
    padding-top: 32px;
}
.add-mat-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 16px;
    background: var(--orbit-green);
    color: #FFFFFF;
    border: 0;
    border-radius: var(--r-pill);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.005em;
    cursor: pointer;
    transition: background .14s ease, transform .14s ease;
    min-height: 52px;
}
.add-mat-primary:hover { background: var(--orbit-green-dark); }
.add-mat-primary:active { transform: translateY(1px); }

/* =========================================================
   AVATAR v2 — colored circle with initials
   ========================================================= */
.avatar-v2 {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 700;
    letter-spacing: 0.02em;
    flex-shrink: 0;
    line-height: 1;
    position: relative;
    font-family: var(--font);
    user-select: none;
}
.avatar-v2-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--orbit-green);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid var(--orbit-bg);
    box-sizing: content-box;
}
.avatar-v2-badge .icon {
    width: 13px;
    height: 13px;
    stroke-width: 2.5;
}

/* Neutralize the old hardcoded avatar backgrounds — the new markup
   supplies its own inline background/color/size. */
.home-head-avatar,
.drawer-user-avatar,
.study-hero-avatar,
.sidebar-user .avatar,
.profile-hero-avatar .avatar-lg {
    background: transparent;
    color: inherit;
    width: auto;
    height: auto;
    font-size: inherit;
}

/* Drawer: prevent the parent from clipping the badge */
.drawer-user {
    overflow: visible;
}
.drawer-user-avatar {
    overflow: visible;
}

/* Profile hero: keep the wrapper non-clipping so the badge shows */
.profile-hero-avatar {
    overflow: visible;
}

/* =========================================================
   WELCOME / LOGIN LANDING — reference layout
   ========================================================= */
.welcome-v2 {
    min-height: 100dvh;
    background: var(--orbit-bg);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(40px + env(safe-area-inset-top)) 24px calc(40px + env(safe-area-inset-bottom));
}

.welcome-decor {
    position: absolute;
    pointer-events: none;
    width: 320px;
    height: 320px;
    z-index: 0;
}
.welcome-decor-tr {
    top: -100px;
    right: -120px;
}
.welcome-decor-bl {
    bottom: -100px;
    left: -120px;
}

.welcome-inner-v2 {
    max-width: 340px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    z-index: 1;
}

/* Logo */
.welcome-logo {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 44px;
}
.welcome-logo .logo-mark {
    width: 48px;
    height: 48px;
}
.welcome-logo span {
    font-size: 36px;
    font-weight: 800;
    letter-spacing: -0.035em;
    color: var(--orbit-green-dark);
    line-height: 1;
}
html[data-theme="dark"] .welcome-logo span {
    color: #4FB477;
}

/* Headline + body */
.welcome-headline {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--orbit-text);
    margin-bottom: 14px;
    line-height: 1.25;
}
.welcome-body {
    font-size: 14.5px;
    color: var(--orbit-text-2);
    line-height: 1.6;
    max-width: 300px;
}

/* Action area */
.welcome-actions-v2 {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 52px;
}

.welcome-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 54px;
    padding: 14px 20px;
    border-radius: var(--r-pill);
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.005em;
    cursor: pointer;
    transition: background .14s ease, color .14s ease, border-color .14s ease, transform .14s ease;
}
.welcome-btn:active { transform: translateY(1px); }

.welcome-btn-primary {
    background: var(--orbit-green);
    color: #FFFFFF;
    border: 1.5px solid var(--orbit-green);
}
.welcome-btn-primary:hover {
    background: var(--orbit-green-dark);
    border-color: var(--orbit-green-dark);
}

.welcome-btn-secondary {
    background: transparent;
    color: var(--orbit-green);
    border: 1.5px solid var(--orbit-green);
}
.welcome-btn-secondary:hover {
    background: var(--orbit-green-soft);
}
html[data-theme="dark"] .welcome-btn-secondary {
    color: #4FB477;
    border-color: #4FB477;
}
html[data-theme="dark"] .welcome-btn-secondary:hover {
    background: var(--orbit-green-soft);
}

.welcome-footnote {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--orbit-text-3);
    margin-top: 20px;
    line-height: 1;
}
.welcome-footnote .icon {
    color: var(--orbit-text-3);
}

/* Slightly tighter on small phones */
@media (max-width: 420px) {
    .welcome-logo { margin-bottom: 36px; gap: 10px; }
    .welcome-logo .logo-mark { width: 42px; height: 42px; }
    .welcome-logo span { font-size: 32px; }
    .welcome-headline { font-size: 22px; }
    .welcome-body { font-size: 14px; max-width: 280px; }
    .welcome-actions-v2 { margin-top: 44px; }
    .welcome-btn { min-height: 52px; font-size: 15.5px; }
}

/* Dark theme: soften the decorative shapes so they don't glare */
html[data-theme="dark"] .welcome-decor circle {
    opacity: 0.14 !important;
    fill: #4FB477;
}

/* =========================================================
   AUTH PAGE — reference layout (login / register)
   ========================================================= */
.auth-page {
    min-height: 100dvh;
    /* Removed background so the body's paper texture shows uniformly */
    padding: calc(20px + env(safe-area-inset-top)) 24px calc(20px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    max-width: 480px;
    margin: 0 auto;
    width: 100%;
}
.auth-page-back {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: transparent;
    color: var(--orbit-text);
    border: 0;
    cursor: pointer;
    margin-left: -8px;
    transition: background .14s ease;
}
.auth-page-back:hover { background: var(--orbit-surface-2); }
.auth-page-back .icon { width: 22px; height: 22px; }

.auth-page-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding-top: 20px;
    max-width: 420px;
    width: 100%;
}

.auth-page-title {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.15;
    color: var(--orbit-text);
    margin-bottom: 8px;
}
.auth-page-sub {
    font-size: 14.5px;
    color: var(--orbit-text-2);
    line-height: 1.5;
    margin-bottom: 36px;
}

.auth-page-form { display: flex; flex-direction: column; }
.auth-page-form .field { margin-bottom: 18px; }
.auth-page-form .field label {
    font-size: 13px;
    font-weight: 600;
    color: var(--orbit-text-2);
    margin-bottom: 8px;
}
.auth-page-form .input {
    padding: 15px 16px;
    font-size: 15px;
    border-radius: var(--r-md);
    min-height: 52px;
}
.auth-page-form .input-wrap .input {
    padding-right: 52px;
}
.auth-page-form .input-action {
    right: 12px;
    padding: 10px;
    color: var(--orbit-text-3);
}
.auth-page-form .input-action:hover {
    color: var(--orbit-text);
    background: var(--orbit-surface-2);
}

.auth-page-submit {
    margin-top: 12px;
    min-height: 54px;
    padding: 16px 20px;
    border-radius: var(--r-pill);
    font-size: 16px;
    font-weight: 600;
}

.auth-page-footer {
    text-align: center;
    font-size: 14px;
    color: var(--orbit-text-2);
    margin-top: 24px;
    line-height: 1.5;
}
.auth-page-footer a {
    color: var(--orbit-green);
    font-weight: 600;
    cursor: pointer;
}
.auth-page-footer a:hover { text-decoration: underline; }

.auth-page-bottom {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 20px 0 4px;
    margin: 0 auto;
    font-size: 12.5px;
    color: var(--orbit-text-3);
    background: transparent;
    border: 0;
    cursor: pointer;
    font-family: inherit;
    transition: color .14s ease;
}
.auth-page-bottom:hover { color: var(--orbit-text-2); }
.auth-page-bottom .icon {
    color: var(--orbit-text-3);
    width: 14px;
    height: 14px;
}

@media (max-width: 420px) {
    .auth-page { padding-left: 20px; padding-right: 20px; }
    .auth-page-title { font-size: 26px; }
    .auth-page-sub { font-size: 14px; margin-bottom: 30px; }
    .auth-page-form .field { margin-bottom: 16px; }
    .auth-page-form .input { padding: 14px 15px; min-height: 50px; }
    .auth-page-submit { min-height: 52px; }
}

/* =========================================================
   ONBOARDING v2 — reference layout
   ========================================================= */
.onboarding-shell {
    min-height: 100dvh;
    background: var(--orbit-bg);
    padding: calc(16px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom));
}
.onboarding-wrap {
    max-width: 480px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    min-height: calc(100dvh - 40px);
}

.onboarding-progress-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 4px 0 28px;
}
.onboarding-back {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: transparent;
    color: var(--orbit-text);
    border: 0;
    cursor: pointer;
    margin-left: -8px;
    transition: background .14s ease;
    flex-shrink: 0;
}
.onboarding-back:not(:disabled):hover { background: var(--orbit-surface-2); }
.onboarding-back:disabled { opacity: 0; pointer-events: none; }
.onboarding-back .icon { width: 20px; height: 20px; }

.onboarding-progress-bar {
    flex: 1;
    display: flex;
    gap: 4px;
}
.onboarding-progress-seg {
    height: 3px;
    flex: 1;
    border-radius: 2px;
    background: var(--orbit-surface-3);
    transition: background .25s ease;
}
.onboarding-progress-seg.active { background: var(--orbit-green); }

.onboarding-progress-count {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--orbit-text-3);
    font-variant-numeric: tabular-nums;
    min-width: 32px;
    text-align: right;
    flex-shrink: 0;
}

.onboarding-body { flex: 1; }
.onboarding-title {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.2;
    color: var(--orbit-text);
    margin-bottom: 8px;
}
.onboarding-lede {
    font-size: 14.5px;
    color: var(--orbit-text-2);
    line-height: 1.5;
    margin-bottom: 28px;
    max-width: 440px;
}

.onboarding-body .field { margin-bottom: 18px; }
.onboarding-body .field label {
    font-size: 13px;
    font-weight: 600;
    color: var(--orbit-text-2);
    margin-bottom: 8px;
    display: block;
}
.onboarding-body .input {
    padding: 15px 16px;
    min-height: 52px;
    font-size: 15px;
    border-radius: var(--r-md);
}
.onboarding-body .input:disabled {
    background: var(--orbit-surface-2);
    cursor: not-allowed;
    opacity: 0.7;
    color: var(--orbit-text-3);
}
.onboarding-body select.input:disabled {
    background-image: none;
}

.onboarding-continue {
    margin-top: 16px;
    min-height: 54px;
    padding: 16px 20px;
    border-radius: var(--r-pill);
    font-size: 16px;
    font-weight: 600;
}
.btn-arrow {
    display: inline-block;
    margin-left: 4px;
    font-weight: 700;
}

@media (max-width: 420px) {
    .onboarding-title { font-size: 24px; }
    .onboarding-body .input { padding: 14px 15px; min-height: 50px; }
    .onboarding-continue { min-height: 52px; font-size: 15.5px; }
}

/* =========================================================
   GENDER SELECTION — onboarding step 2
   ========================================================= */
.gender-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}
.gender-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 18px;
    background: var(--orbit-surface);
    border: 1.5px solid var(--orbit-border);
    border-radius: var(--r-lg);
    cursor: pointer;
    text-align: left;
    transition: border-color .14s ease, background .14s ease;
    min-height: 100px;
    font-family: inherit;
    color: inherit;
}
.gender-card:hover { border-color: var(--orbit-border-strong); }
.gender-card.selected {
    border-color: var(--orbit-green);
    background: var(--orbit-green-soft);
}

.gender-check {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--orbit-border-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: border-color .14s ease, background .14s ease;
}
.gender-card.selected .gender-check {
    border-color: var(--orbit-green);
    background: var(--orbit-green);
}
.gender-check-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #FFFFFF;
}

.gender-ill {
    width: 88px;
    height: 88px;
    flex-shrink: 0;
    border-radius: 50%;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #CFE0D2; /* pale sage to match the image bg */
}
.gender-ill-img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}
.avatar-ill {
    width: 100%;
    height: 100%;
    display: block;
}

.gender-label {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.005em;
    color: var(--orbit-text);
}

@media (max-width: 420px) {
    .gender-card { padding: 14px 16px; gap: 14px; min-height: 100px; }
    .gender-ill { width: 76px; height: 76px; }
    .gender-label { font-size: 16px; }
    .gender-check { width: 22px; height: 22px; }
    .gender-check-dot { width: 9px; height: 9px; }
}

/* =========================================================
   AVATAR GRID — onboarding step 3
   ========================================================= */
.avatar-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 28px;
}
@media (max-width: 400px) {
    .avatar-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}
.avatar-tile {
    position: relative;
    aspect-ratio: 1;
    border-radius: 50%;
    overflow: hidden;
    background: #CFE0D2;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    transition: border-color .14s ease, transform .14s ease, box-shadow .14s ease;
    font-family: inherit;
}
.avatar-tile:hover { transform: scale(1.03); }
.avatar-tile:active { transform: scale(0.99); }
.avatar-tile.selected {
    border-color: var(--orbit-green);
    border-width: 3px;
    outline: 3px solid var(--orbit-green);
    outline-offset: 3px;
    transform: scale(1.02);
}
.avatar-tile-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 50%;
}
.avatar-tile-check {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--orbit-green);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2.5px solid #FFFFFF;
    box-shadow: 0 2px 6px rgba(0,0,0,0.18);
}
.avatar-tile-check .icon { width: 13px; height: 13px; stroke-width: 2.8; }

/* Avatar with image (used everywhere the saved avatar shows) */
.avatar-v2-img {
    overflow: hidden;
    position: relative;
}
.avatar-v2-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

/* =========================================================
   CHOICE CARDS — onboarding step 4
   ========================================================= */
.choice-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 22px;
}
.choice-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    width: 100%;
    padding: 20px 18px;
    background: var(--orbit-surface);
    border: 1.5px solid var(--orbit-border);
    border-radius: var(--r-lg);
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    color: inherit;
    transition: border-color .14s ease, background .14s ease;
    min-height: 68px;
}
.choice-card:hover { border-color: var(--orbit-border-strong); }
.choice-card.selected {
    border-color: var(--orbit-green);
    background: var(--orbit-green-soft);
}

.choice-radio {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--orbit-border-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
    transition: border-color .14s ease, background .14s ease;
}
.choice-card.selected .choice-radio {
    border-color: var(--orbit-green);
    background: var(--orbit-green);
}
.choice-radio-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #FFFFFF;
}

.choice-body {
    flex: 1;
    min-width: 0;
}
.choice-title {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: var(--orbit-text);
    line-height: 1.35;
}
.choice-card.selected .choice-title {
    color: var(--orbit-green-dark);
}
html[data-theme="dark"] .choice-card.selected .choice-title {
    color: #7FC69A;
}

.choice-input-wrap {
    display: block;
    margin-top: 14px;
}
.choice-input {
    width: 100%;
    padding: 6px 0;
    background: transparent;
    border: 0;
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--orbit-green-dark);
    font-variant-numeric: tabular-nums;
    outline: none;
    font-family: inherit;
    line-height: 1.1;
}
html[data-theme="dark"] .choice-input {
    color: #7FC69A;
}
.choice-input::placeholder {
    color: var(--orbit-green);
    opacity: 0.3;
    font-weight: 600;
}
/* Hide number spinners so the big number stays clean */
.choice-input::-webkit-outer-spin-button,
.choice-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.choice-input[type=number] {
    -webkit-appearance: textfield;
    -moz-appearance: textfield;
    appearance: textfield;
}

@media (max-width: 420px) {
    .choice-card { padding: 18px 16px; gap: 12px; }
    .choice-title { font-size: 14.5px; }
    .choice-input { font-size: 26px; }
}

/* ---------- Onboarding · Step 5 (Courses) ---------- */
.onb-course-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}
.onb-course-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--orbit-surface);
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-md);
}
.onb-course-icon {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--r-sm);
}
.onb-course-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.onb-course-code {
    font-size: 15px;
    font-weight: 600;
    color: var(--orbit-text);
    line-height: 1.2;
}
.onb-course-name {
    font-size: 13px;
    color: var(--orbit-text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.onb-course-units {
    font-size: 12px;
    color: var(--orbit-text-3);
    margin-top: 2px;
}
.onb-course-remove {
    flex: 0 0 auto;
    padding: 6px 14px;
    border: 0;
    border-radius: var(--r-pill);
    background: rgba(201, 74, 69, 0.14);
    color: var(--danger);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
}
.onb-add-course {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 48px;
    padding: 12px;
    background: transparent;
    border: 1.5px dashed var(--orbit-green);
    border-radius: var(--r-md);
    color: var(--orbit-green);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    margin-bottom: 20px;
    transition: background 0.15s;
}
.onb-add-course:hover { background: var(--orbit-green-soft); }
.onb-course-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.onb-course-summary {
    font-size: 13px;
    color: var(--orbit-text-2);
}
.onb-continue-pill {
    min-height: 44px;
    padding: 0 20px;
    border-radius: var(--r-pill);
}

/* =========================================================
   ONBOARDING · Step 7 — Review
   ========================================================= */
.review-user-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--orbit-surface);
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-lg);
    margin-bottom: 16px;
}
.review-user-body { flex: 1; min-width: 0; }
.review-user-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--orbit-text);
    letter-spacing: -0.01em;
    line-height: 1.25;
}
.review-user-sub {
    font-size: 12.5px;
    color: var(--orbit-text-2);
    line-height: 1.4;
    margin-top: 1px;
}

.review-list {
    background: var(--orbit-surface);
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-lg);
    overflow: hidden;
    margin-bottom: 24px;
}
.review-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--divider);
}
.review-row:last-child { border-bottom: 0; }
.review-row-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--orbit-surface-2);
    color: var(--orbit-text-2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.review-row-icon .icon { width: 15px; height: 15px; stroke-width: 2; }
.review-row-label {
    font-size: 13px;
    color: var(--orbit-text-3);
    flex-shrink: 0;
    min-width: 84px;
}
.review-row-value {
    flex: 1;
    min-width: 0;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--orbit-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.review-row-edit {
    flex-shrink: 0;
    padding: 4px 0 4px 8px;
    background: transparent;
    border: 0;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--orbit-green);
    cursor: pointer;
    min-height: 24px;
}
.review-row-edit:hover { text-decoration: underline; }

.review-enter-btn {
    min-height: 54px;
    border-radius: var(--r-pill);
    font-size: 16px;
    font-weight: 600;
    margin-top: 4px;
}

/* =========================================================
   ONBOARDING · Setup complete (post-onboarding success)
   ========================================================= */
.setup-complete {
    min-height: 100dvh;
    background: var(--orbit-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: calc(32px + env(safe-area-inset-top)) 24px calc(32px + env(safe-area-inset-bottom));
}

.setup-complete-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 40px;
}
.setup-complete-brand .logo-mark { width: 32px; height: 32px; }
.setup-complete-brand span {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.035em;
    color: var(--orbit-green-dark);
    line-height: 1;
}
html[data-theme="dark"] .setup-complete-brand span { color: #4FB477; }

.setup-complete-avatar-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    margin-bottom: 36px;
}
.sc-blob {
    position: absolute;
    z-index: 0;
    background: #DCE9DE;
    opacity: 0.7;
}
html[data-theme="dark"] .sc-blob { background: #16311F; opacity: 0.95; }
.sc-blob-1 {
    width: 200px;
    height: 190px;
    border-radius: 70px;
    top: 0;
    left: -6px;
    transform: rotate(-12deg);
}
.sc-blob-2 {
    width: 120px;
    height: 100px;
    border-radius: 46px;
    bottom: 0;
    right: -6px;
    transform: rotate(18deg);
    background: #CFE0D2;
}
html[data-theme="dark"] .sc-blob-2 { background: #1B3D28; }
.setup-complete-avatar-wrap .avatar-v2 { position: relative; z-index: 1; }

.setup-complete-title {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.2;
    color: var(--orbit-text);
    margin-bottom: 12px;
}
.setup-complete-sub {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--orbit-text);
    margin-bottom: 8px;
}
.setup-complete-body {
    font-size: 14px;
    color: var(--orbit-text-2);
    line-height: 1.55;
    max-width: 300px;
    margin-bottom: 44px;
}
.setup-complete-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 340px;
    min-height: 54px;
    padding: 14px 20px;
    background: var(--orbit-green);
    color: #FFFFFF;
    border: 1.5px solid var(--orbit-green);
    border-radius: var(--r-pill);
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.005em;
    cursor: pointer;
    font-family: inherit;
    transition: background .14s ease, border-color .14s ease, transform .14s ease;
}
.setup-complete-btn:hover {
    background: var(--orbit-green-dark);
    border-color: var(--orbit-green-dark);
}
.setup-complete-btn:active { transform: translateY(1px); }

@media (max-width: 420px) {
    .setup-complete-brand { margin-bottom: 32px; }
    .setup-complete-avatar-wrap { margin-bottom: 28px; }
    .sc-blob-1 { width: 180px; height: 170px; }
    .sc-blob-2 { width: 110px; height: 92px; }
    .setup-complete-title { font-size: 24px; }
    .setup-complete-sub { font-size: 17px; }
    .setup-complete-body { margin-bottom: 36px; }
}

/* =========================================================
   PHASE 1 · identity (username + education type)
   ========================================================= */
.username-hint { margin-top: 4px; line-height: 1.4; }
.field-success { color: var(--orbit-success); font-size: 12px; }

.drawer-user-handle {
    color: var(--orbit-green) !important;
    font-weight: 600;
}

.profile-hero-handle {
    font-size: 14px;
    font-weight: 600;
    color: var(--orbit-green);
    margin-top: 4px;
    letter-spacing: -0.005em;
}
html[data-theme="dark"] .profile-hero-handle { color: #4FB477; }

/* =========================================================
   ONBOARDING · Student type cards (step 1)
   ========================================================= */
.onb-type-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
}
.onb-type-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 18px 16px;
    background: var(--orbit-surface);
    border: 1.5px solid var(--orbit-border);
    border-radius: var(--r-lg);
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    color: inherit;
    transition: border-color .14s ease, background .14s ease, transform .14s ease;
    min-height: 128px;
}
.onb-type-card:hover { border-color: var(--orbit-border-strong); }
.onb-type-card:active { transform: scale(0.99); }
.onb-type-card.selected {
    border-color: var(--orbit-green);
    background: var(--orbit-green-soft);
}
.onb-type-icon {
    width: 40px; height: 40px;
    border-radius: var(--r-sm);
    background: var(--orbit-surface-2);
    color: var(--orbit-text-2);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.onb-type-card.selected .onb-type-icon {
    background: #FFFFFF;
    color: var(--orbit-green);
}
.onb-type-label {
    font-size: 14.5px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--orbit-text);
}
@media (max-width: 400px) {
    .onb-type-grid { gap: 10px; }
    .onb-type-card { padding: 14px 12px; min-height: 116px; }
    .onb-type-label { font-size: 13.5px; }
}

/* =========================================================
   COMBOBOX — searchable institution / school picker
   ========================================================= */
.combo-wrap { position: relative; }
.combo-input-row { position: relative; }
.combo-input-row .input { padding-right: 42px; }
.combo-clear {
    position: absolute;
    top: 50%; right: 8px;
    transform: translateY(-50%);
    width: 28px; height: 28px;
    border-radius: 50%;
    background: transparent;
    border: 0;
    color: var(--orbit-text-3);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-family: inherit;
    transition: background .12s ease, color .12s ease;
}
.combo-clear:hover { background: var(--orbit-surface-2); color: var(--orbit-text); }

.combo-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    max-height: 260px;
    overflow-y: auto;
    background: var(--orbit-surface);
    border: 1px solid var(--orbit-border-strong);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-md);
    z-index: 40;
    -webkit-overflow-scrolling: touch;
}
.combo-item {
    display: block;
    width: 100%;
    padding: 11px 14px;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--divider);
    text-align: left;
    font-family: inherit;
    color: inherit;
    cursor: pointer;
    transition: background .12s ease;
    min-height: 48px;
}
.combo-item:last-child { border-bottom: 0; }
.combo-item:hover { background: var(--orbit-surface-2); }
.combo-item-name {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--orbit-text);
    line-height: 1.35;
}
.combo-item-sub {
    display: block;
    font-size: 12px;
    color: var(--orbit-text-3);
    margin-top: 2px;
    line-height: 1.4;
}
.combo-empty {
    padding: 14px 16px;
    font-size: 13px;
    color: var(--orbit-text-3);
    line-height: 1.5;
}
.combo-other {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 0;
    background: transparent;
    border: 0;
    color: var(--orbit-green);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
}
.combo-other:hover { text-decoration: underline; }
html[data-theme="dark"] .combo-other { color: #4FB477; }

/* Review user handle */
.review-user-handle {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--orbit-green);
    margin-top: 1px;
    letter-spacing: -0.005em;
}
html[data-theme="dark"] .review-user-handle { color: #4FB477; }

/* =========================================================
   ONBOARDING · Recovery questions (step 9)
   ========================================================= */
.recovery-item {
    padding: 16px;
    background: var(--orbit-surface);
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-md);
    margin-bottom: 14px;
}
.recovery-item-head {
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--orbit-text-3);
    margin-bottom: 10px;
}
.recovery-item .field label { font-size: 12.5px; }
.recovery-item .input { font-size: 14.5px; }

.attempts-line {
    text-align: center;
    font-weight: 600;
    color: var(--orbit-text-2);
}

/* =========================================================
   ONBOARDING · Recovery Phrase (step 9)
   ========================================================= */
.phrase-display {
    display: block;
    text-align: center;
    font-family: 'SF Mono', 'Menlo', 'Consolas', ui-monospace, monospace;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--orbit-green-dark);
    background: var(--orbit-green-soft);
    padding: 24px 16px;
    border-radius: var(--r-lg);
    border: 1.5px solid var(--orbit-green);
    margin-bottom: 16px;
    word-break: break-all;
    line-height: 1.3;
    user-select: all;
    -webkit-user-select: all;
}
html[data-theme="dark"] .phrase-display { color: #7FC69A; }

.phrase-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}
.phrase-actions .btn { flex: 1; }

.phrase-hint {
    font-size: 12.5px;
    color: var(--orbit-text-3);
    line-height: 1.5;
    margin-bottom: 20px;
}

.phrase-saved-box {
    background: var(--orbit-green-soft);
    border-radius: var(--r-md);
    padding: 16px 18px;
    margin-bottom: 20px;
}
.phrase-saved-title {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--orbit-green-dark);
    margin-bottom: 4px;
}
.phrase-saved-body {
    font-size: 13px;
    color: var(--orbit-green-dark);
    opacity: 0.85;
    line-height: 1.5;
}
html[data-theme="dark"] .phrase-saved-title,
html[data-theme="dark"] .phrase-saved-body { color: #7FC69A; }

.phrase-input {
    font-family: 'SF Mono', 'Menlo', 'Consolas', ui-monospace, monospace;
    font-size: 17px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: center;
}

.attempts-line {
    text-align: center;
    font-weight: 600;
    color: var(--orbit-text-2);
}

/* Legacy — kept so nothing else breaks */
.recovery-item, .recovery-item-head { display: none; }

/* =========================================================
   EDIT PROFILE + AVATAR VIEW
   ========================================================= */
button.profile-hero-avatar {
    background: transparent;
    border: 0;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    position: relative;
}

.edit-avatar-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 8px 0 28px;
}
.edit-avatar-btn {
    position: relative;
    background: transparent;
    border: 0;
    padding: 0;
    cursor: pointer;
    border-radius: 50%;
    display: inline-flex;
}
.edit-avatar-badge {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--orbit-green);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid var(--orbit-bg);
    pointer-events: none;
}
.edit-avatar-badge .icon { width: 14px; height: 14px; stroke-width: 2.5; }
.edit-avatar-hint {
    font-size: 12.5px;
    color: var(--orbit-text-3);
    margin: 0;
}

.avatar-picker-tabs {
    display: flex;
    gap: 6px;
    padding: 4px;
    background: var(--orbit-surface-2);
    border-radius: var(--r-md);
    margin-bottom: 16px;
}
.avatar-picker-tab {
    flex: 1;
    padding: 10px;
    border-radius: var(--r-sm);
    background: transparent;
    border: 0;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--orbit-text-2);
    cursor: pointer;
    transition: background .12s ease, color .12s ease;
    min-height: 40px;
}
.avatar-picker-tab.active {
    background: var(--orbit-surface);
    color: var(--orbit-text);
    box-shadow: var(--shadow-sm);
}

.avatar-full-modal { max-width: 340px; }
.avatar-full-body { text-align: center; padding: 24px 20px; }
.avatar-full-wrap { display: inline-flex; }
.avatar-full-name {
    margin-top: 16px;
    color: var(--orbit-text-2);
    font-size: 15px;
    font-weight: 500;
}
.avatar-full-foot { justify-content: center; }

/* =========================================================
   CGPA — history list
   ========================================================= */
.history-list {
    display: flex;
    flex-direction: column;
    background: var(--orbit-surface);
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-md);
    overflow: hidden;
}
.history-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--divider);
}
.history-row:last-child { border-bottom: 0; }
.history-body { flex: 1; min-width: 0; }
.history-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--orbit-text);
    line-height: 1.35;
}
.history-meta {
    font-size: 12.5px;
    color: var(--orbit-text-3);
    margin-top: 2px;
    font-variant-numeric: tabular-nums;
}
.history-actions {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}


/* =========================================================
   CGPA — simplified
   ========================================================= */
.academic-card {
    background: var(--orbit-surface);
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-lg);
    padding: 20px;
}
.academic-line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 2px 0;
}
.academic-line-label {
    font-size: 13px;
    color: var(--orbit-text-2);
}
.academic-line-value {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: var(--orbit-text);
    font-variant-numeric: tabular-nums;
    text-align: right;
}
.academic-line-value.is-success {
    color: var(--orbit-success);
}
.academic-line-diff {
    font-size: 15px !important;
    font-weight: 600;
}
.academic-line-diff.muted-text {
    color: var(--orbit-text-3);
    font-weight: 500;
}
.academic-line-empty {
    font-size: 15px;
    font-weight: 500;
    color: var(--orbit-text-3);
}
.academic-line-unit {
    font-size: 13px;
    font-weight: 500;
    color: var(--orbit-text-3);
    margin-left: 4px;
}
.academic-divider {
    height: 1px;
    background: var(--divider);
    margin: 12px 0;
}
.academic-actions {
    margin-top: 18px;
}

.current-sem-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--orbit-text);
    margin-bottom: 16px;
    letter-spacing: -0.005em;
}
.current-sem-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 18px;
}
.current-sem-stat-label {
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--orbit-text-3);
    margin-bottom: 4px;
}
.current-sem-stat-value {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
    color: var(--orbit-text);
    font-variant-numeric: tabular-nums;
}
.current-sem-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.history-group { margin-bottom: 18px; }
.history-group:last-child { margin-bottom: 0; }
.history-group-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--orbit-text-2);
    margin-bottom: 8px;
    padding-left: 2px;
    letter-spacing: -0.005em;
}
.history-row { cursor: pointer; }
.history-row[role="button"]:focus-visible {
    outline: 2px solid var(--orbit-green);
    outline-offset: -2px;
    border-radius: var(--r-sm);
}
.history-chev {
    color: var(--orbit-text-3);
    display: flex;
    flex-shrink: 0;
}

/* Dashboard metric buttons */
.metric-card-btn {
    display: block;
    width: 100%;
    text-align: left;
    font-family: inherit;
    color: inherit;
    cursor: pointer;
    transition: border-color .14s ease, background .14s ease, transform .14s ease;
}
.metric-card-btn:hover { border-color: var(--orbit-border-strong); }
.metric-card-btn:focus-visible {
    outline: 2px solid var(--orbit-green);
    outline-offset: 2px;
}
.metric-card-btn:active { transform: scale(0.99); }

.metric-card-sub {
    font-size: 12px;
    color: var(--orbit-text-3);
    margin-top: 6px;
    font-weight: 500;
}

.current-sem-stat-value.is-empty {
    font-size: 13px;
    font-weight: 500;
    color: var(--orbit-text-3);
    letter-spacing: 0;
}
.cd-stat-value.is-empty {
    font-size: 13px;
    font-weight: 500;
    color: var(--orbit-text-3);
}

.course-v2-units {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--orbit-text-3);
    font-variant-numeric: tabular-nums;
    margin-left: auto;
}
.course-v2-meta + .course-v2-meta { margin-top: 2px; }
.course-v2-meta.faint { color: var(--orbit-text-3); }

.history-session {
    font-size: 11.5px;
    color: var(--orbit-text-3);
    margin-top: 1px;
    letter-spacing: 0.02em;
}

/* =========================================================
   SEMESTER DETAIL
   ========================================================= */
.sem-detail-grade {
    font-size: 14px;
    font-weight: 700;
    color: var(--orbit-text);
    min-width: 24px;
    text-align: right;
}
.sem-detail-grade.is-empty {
    font-size: 13px;
    font-weight: 500;
    color: var(--orbit-text-3);
}

/* Reduce hover/press animation latency across the app.
   Targets: 100–160 ms for interactive feedback. */
.btn,
.icon-btn,
.chip,
.courses-tab,
.tab,
.profile-row,
.history-row[role="button"],
.course-row-v2,
.metric-card-btn,
.drawer-nav-item,
.nav-item {
    transition-duration: 120ms;
}
.modal-overlay { animation-duration: 120ms; }
.modal { animation-duration: 150ms; }
.toast { animation-duration: 160ms; }
.reveal { animation-duration: 160ms; }

@media (prefers-reduced-motion: reduce) {
    .btn, .icon-btn, .chip, .courses-tab, .tab, .profile-row,
    .history-row[role="button"], .course-row-v2, .metric-card-btn,
    .drawer-nav-item, .nav-item, .modal-overlay, .modal, .toast, .reveal {
        transition-duration: 0ms !important;
        animation-duration: 0ms !important;
    }
}

/* =========================================================
   MONEY
   ========================================================= */
.money-hero {
    background: var(--orbit-surface);
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-lg);
    padding: 22px;
}
.money-hero.is-ended { opacity: 0.85; }
.money-hero.is-over { border-color: var(--orbit-danger); }

.money-hero-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--orbit-text-3);
    margin-bottom: 10px;
}
.money-hero-remaining {
    font-size: 40px;
    font-weight: 700;
    letter-spacing: -0.035em;
    line-height: 1;
    color: var(--orbit-text);
    font-variant-numeric: tabular-nums;
}
.money-hero.is-over .money-hero-remaining { color: var(--orbit-danger); }
.money-hero-sub {
    font-size: 13px;
    color: var(--orbit-text-2);
    margin-top: 6px;
}
.money-hero-bar {
    height: 6px;
    border-radius: 3px;
    background: var(--orbit-surface-3);
    overflow: hidden;
    margin-top: 16px;
}
.money-hero-bar-fill {
    height: 100%;
    background: var(--orbit-green);
    border-radius: 3px;
    transition: width .3s ease;
}
.money-hero-bar-fill.is-over { background: var(--orbit-danger); }
.money-hero-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12.5px;
    color: var(--orbit-text-2);
    margin-top: 8px;
    font-variant-numeric: tabular-nums;
}
.money-hero-when {
    font-size: 12.5px;
    color: var(--orbit-text-3);
    margin-top: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--divider);
}

.money-note {
    font-size: 13px;
    color: var(--orbit-text-2);
    line-height: 1.55;
    padding: 14px 16px;
    background: var(--orbit-green-soft);
    border-radius: var(--r-md);
}
.money-note.is-warn {
    background: var(--danger-soft);
    color: var(--orbit-danger);
}

.money-breakdown {
    display: flex;
    flex-direction: column;
    background: var(--orbit-surface);
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-md);
    overflow: hidden;
}
.money-breakdown-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--divider);
    font-size: 14px;
}
.money-breakdown-row:last-child { border-bottom: 0; }
.money-breakdown-label { color: var(--orbit-text-2); }
.money-breakdown-amount {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--orbit-text);
}

.money-amount {
    font-size: 14px;
    font-weight: 700;
    color: var(--orbit-text);
    font-variant-numeric: tabular-nums;
}

/* Expense category chips */
.expense-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.expense-chip {
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--orbit-text-2);
    background: var(--orbit-surface-2);
    border: 1px solid transparent;
    border-radius: var(--r-pill);
    cursor: pointer;
    font-family: inherit;
    transition: background .12s ease, color .12s ease;
    min-height: 36px;
}
.expense-chip:hover { background: var(--orbit-surface-3); }
.expense-chip.active {
    background: var(--orbit-green);
    color: #FFFFFF;
    font-weight: 600;
}

/* Budget chips */
.budget-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 12px;
    margin-bottom: 8px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.budget-chips::-webkit-scrollbar { display: none; }

.budget-chip {
    flex-shrink: 0;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--orbit-text-2);
    background: var(--orbit-surface-2);
    border: 1px solid transparent;
    border-radius: var(--r-pill);
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    transition: background .12s ease, color .12s ease;
    min-height: 36px;
}
.budget-chip:hover { background: var(--orbit-surface-3); }
.budget-chip.active {
    background: var(--orbit-green);
    color: #FFFFFF;
    font-weight: 600;
}
.budget-chip-new {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: transparent;
    border: 1px dashed var(--orbit-border-strong);
    color: var(--orbit-text-2);
}
.budget-chip-new:hover {
    background: var(--orbit-surface-2);
    border-color: var(--orbit-border-strong);
}

/* In the expense form, the budget select is optional. */
.expense-chips + .field,
#expenseBudget {
    margin-top: 0;
}

/* =========================================================
   HOME — pillar overview
   ========================================================= */
.home-attention {
    display: flex;
    gap: 14px;
    padding: 16px 18px;
    background: var(--orbit-surface);
    border: 1px solid var(--orbit-border);
    border-left: 3px solid var(--orbit-danger); /* Accent instead of full red box */
    border-radius: var(--r-sm);
}

html[data-theme="dark"] .home-attention {
    background: #2E1A18;
    border-color: #3E2422;
}
.home-attention-icon {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: #C94A45;
    color: #FFFFFF;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 1px;
}
.home-attention-body { flex: 1; min-width: 0; }
.home-attention-when {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #B03A34;
    margin-bottom: 4px;
}
html[data-theme="dark"] .home-attention-when { color: #E77C76; }
.home-attention-title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #7A2D28;
    line-height: 1.25;
    margin-bottom: 10px;
}
html[data-theme="dark"] .home-attention-title { color: #F0A09B; }

.pillar-list {
    display: flex;
    flex-direction: column;
    gap: 1px; /* Thin divider effect */
    background: var(--orbit-border); /* Acts as the divider */
    border-radius: var(--r-md);
    overflow: hidden;
    border: 1px solid var(--orbit-border);
}
.pillar-card {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 16px 18px;
    background: var(--orbit-surface);
    border: 0;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    color: inherit;
    transition: background .12s ease;
    min-height: 68px;
}
.pillar-card:hover { background: var(--orbit-surface-2); }
.pillar-icon {
    width: 36px; height: 36px;
    border-radius: var(--r-sm); /* Less rounded */
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.pillar-icon-green  { background: var(--orbit-green-soft); color: var(--orbit-green); }
.pillar-icon-blue   { background: #E5EEF9; color: #4C7FC4; }
.pillar-icon-amber  { background: #FBEEDF; color: #A85E1A; }
.pillar-icon-red    { background: #FBE3E1; color: #C94A45; }
.pillar-icon-purple { background: #EFEBFA; color: #7868B7; }
html[data-theme="dark"] .pillar-icon-blue   { background: #1A2538; color: #82A8E6; }
html[data-theme="dark"] .pillar-icon-amber  { background: #3A2A18; color: #D9A441; }
html[data-theme="dark"] .pillar-icon-red    { background: #3A1E1C; color: #E77C76; }
html[data-theme="dark"] .pillar-icon-purple { background: #2A2440; color: #B7ADE0; }

.pillar-body { flex: 1; min-width: 0; }
.pillar-title {
    display: block;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.005em;
    color: var(--orbit-text);
    line-height: 1.25;
}
.pillar-sub {
    display: block;
    font-size: 12.5px;
    color: var(--orbit-text-2);
    margin-top: 2px;
    line-height: 1.4;
}
.pillar-chev {
    color: var(--orbit-text-3);
    display: flex;
    flex-shrink: 0;
}

.quick-actions-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
@media (min-width: 600px) {
    .quick-actions-row {
        flex-direction: row;
    }
    .quick-action-btn { flex: 1; }
}
.quick-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 16px;
    background: var(--orbit-surface);
    color: var(--orbit-text);
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-md);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    min-height: 48px;
    transition: background .12s ease, border-color .12s ease;
    white-space: nowrap;
}
.quick-action-btn:hover {
    background: var(--orbit-surface-2);
    border-color: var(--orbit-border-strong);
}
.quick-action-btn .icon { color: var(--orbit-green); }

.mobile-topbar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.topbar-avatar-btn {
    padding: 2px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
}

button.home-head-avatar {
    background: transparent;
    border: 0;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
}

/* =========================================================
   TASKS — new card layout
   ========================================================= */
.task-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.task-cards.is-done { opacity: 0.7; }

.task-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--orbit-surface);
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-md);
    transition: border-color .12s ease;
}
.task-card:hover { border-color: var(--orbit-border-strong); }
.task-card.is-done { background: var(--orbit-surface-2); border-color: transparent; }

.task-card-check {
    width: 26px; height: 26px;
    border-radius: 8px;
    border: 1.75px solid var(--orbit-border-strong);
    background: var(--orbit-surface);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    color: transparent;
    padding: 0;
    transition: all .15s ease;
}
.task-card-check:hover { border-color: var(--orbit-green); }
.task-card-check.is-done {
    background: var(--orbit-green);
    border-color: var(--orbit-green);
    color: #FFFFFF;
}

.task-card-body { flex: 1; min-width: 0; }
.task-card-title {
    font-size: 15px;
    font-weight: 500;
    letter-spacing: -0.005em;
    line-height: 1.35;
    color: var(--orbit-text);
    word-break: break-word;
}
.task-card.is-done .task-card-title {
    color: var(--orbit-text-3);
    text-decoration: line-through;
}
.task-card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    font-size: 12.5px;
    color: var(--orbit-text-3);
    flex-wrap: wrap;
}
.task-card-time {
    font-weight: 600;
    color: var(--orbit-text-2);
    font-variant-numeric: tabular-nums;
}
.task-card-sep { opacity: 0.6; }
.task-card-priority { display: inline-flex; align-items: center; gap: 6px; }

.task-card-actions {
    display: flex;
    gap: 0;
    flex-shrink: 0;
}
@media (hover: hover) {
    .task-card-actions { opacity: 0; transition: opacity .12s ease; }
    .task-card:hover .task-card-actions,
    .task-card:focus-within .task-card-actions { opacity: 1; }
}

/* Priority chips in the task form */
.task-priority-row {
    display: flex;
    gap: 8px;
}
.task-priority-chip {
    flex: 1;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    color: var(--orbit-text-2);
    background: var(--orbit-surface-2);
    border: 1px solid transparent;
    border-radius: var(--r-md);
    cursor: pointer;
    transition: background .12s ease, color .12s ease;
    min-height: 40px;
}
.task-priority-chip:hover { background: var(--orbit-surface-3); }
.task-priority-chip.active {
    background: var(--orbit-green);
    color: #FFFFFF;
    font-weight: 600;
}

/* =========================================================
   HOME — today list (tasks + events)
   ========================================================= */
.home-today-list {
    display: flex;
    flex-direction: column;
}
.home-today-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 4px;
    border-bottom: 1px solid var(--divider);
    text-align: left;
    font-family: inherit;
    color: inherit;
    background: transparent;
    border-left: 0; border-right: 0; border-top: 0;
    width: 100%;
    min-height: 52px;
}

.home-today-row:last-child { border-bottom: 0; }
.home-today-row.is-task { cursor: pointer; }
.home-today-row.is-task:hover { background: var(--orbit-surface-2); }

.home-today-check {
    width: 20px; height: 20px;
    border-radius: 50%;
    border: 1.5px solid var(--orbit-border-strong);
    flex-shrink: 0;
    background: var(--orbit-surface);
    transition: border-color .14s ease;
}
.home-today-row.is-task:hover .home-today-check { border-color: var(--orbit-green); }

.home-today-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--orbit-info);
    flex-shrink: 0;
}

.home-today-body { flex: 1; min-width: 0; }
.home-today-title {
    display: block;
    font-size: 14.5px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--orbit-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.home-today-meta {
    display: block;
    font-size: 12.5px;
    color: var(--orbit-text-3);
    margin-top: 1px;
    font-variant-numeric: tabular-nums;
}

/* =========================================================
   HOME — task toggle button
   ========================================================= */
.home-today-check-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1.75px solid var(--orbit-border-strong);
    background: var(--orbit-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    transition: border-color .14s ease, background .14s ease, transform .14s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.home-today-check-btn:hover {
    border-color: var(--orbit-green);
    background: var(--orbit-green-soft);
}
.home-today-check-btn:active {
    transform: scale(0.92);
}
.home-today-check-inner {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: transparent;
    transition: background .14s ease;
}
.home-today-check-btn:hover .home-today-check-inner {
    background: var(--orbit-green);
}

/* Tick button state (home today list) */
.home-today-check-btn.is-done {
    background: var(--orbit-green);
    border-color: var(--orbit-green);
    color: #FFFFFF;
}
.home-today-check-btn.is-done .icon {
    width: 14px;
    height: 14px;
    stroke-width: 2.6;
}
.home-today-check-btn.is-done:hover {
    background: var(--orbit-green);
    border-color: var(--orbit-green);
}

/* Task row mid-tick on home — visually softens so the tick reads clearly */
.home-today-row.is-ticking {
    background: var(--orbit-green-soft);
}
html[data-theme="dark"] .home-today-row.is-ticking {
    background: var(--orbit-green-soft);
}

/* Task card mid-tick on the tasks page */
.task-card.is-ticking {
    background: var(--orbit-green-soft);
    border-color: var(--orbit-green);
    transition: background .25s ease, border-color .25s ease;
}
.task-card.is-ticking .task-card-title {
    color: var(--orbit-text);
}

/* =========================================================
   MEAL PLANNER
   ========================================================= */
.meal-budget-strip {
    background: var(--orbit-green-soft);
    border-radius: var(--r-lg);
    padding: 18px 20px;
}
.meal-budget-strip.is-over { background: #FBE3E1; }
html[data-theme="dark"] .meal-budget-strip.is-over { background: #2E1A18; }

.meal-budget-main {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--orbit-text);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}
.meal-budget-strip.is-over .meal-budget-main { color: var(--orbit-danger); }
.meal-budget-sub {
    font-size: 13.5px;
    color: var(--orbit-text-2);
    margin-top: 4px;
}
.meal-budget-note {
    font-size: 12.5px;
    color: var(--orbit-text-3);
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--divider);
}
.meal-budget-note a { color: var(--orbit-green); font-weight: 600; cursor: pointer; }

.meal-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--orbit-surface-2);
    border-radius: var(--r-md);
    margin-bottom: 20px;
}
.meal-tab {
    flex: 1;
    padding: 10px;
    border-radius: var(--r-sm);
    background: transparent;
    border: 0;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--orbit-text-2);
    cursor: pointer;
    min-height: 40px;
    transition: background .12s ease, color .12s ease;
}
.meal-tab.active {
    background: var(--orbit-surface);
    color: var(--orbit-text);
    box-shadow: var(--shadow-sm);
}

.meal-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.meal-card {
    background: var(--orbit-surface);
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-md);
    padding: 14px 16px;
    transition: opacity .15s ease;
}
.meal-card.is-skipped { opacity: 0.55; }
.meal-card.is-kept { border-color: var(--orbit-green); }

.meal-card-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 4px;
}
.meal-card-slot {
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--orbit-text-3);
}
.meal-card-cost {
    font-size: 13px;
    font-weight: 700;
    color: var(--orbit-text-2);
    font-variant-numeric: tabular-nums;
}
.meal-card-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--orbit-text);
    line-height: 1.35;
    margin-bottom: 4px;
}
.meal-card-status {
    font-size: 12px;
    font-weight: 600;
    color: var(--orbit-text-3);
    margin-bottom: 6px;
}
.meal-card-status.is-kept { color: var(--orbit-green); }

.meal-card-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 8px;
}
.meal-action-btn {
    padding: 6px 12px;
    font-size: 12.5px;
    font-weight: 600;
    font-family: inherit;
    color: var(--orbit-text-2);
    background: var(--orbit-surface-2);
    border: 0;
    border-radius: var(--r-pill);
    cursor: pointer;
    transition: background .12s ease, color .12s ease;
    min-height: 32px;
}
.meal-action-btn:hover { background: var(--orbit-surface-3); color: var(--orbit-text); }
.meal-action-btn.is-cheaper { color: var(--orbit-green); }
.meal-action-btn.is-cheaper:hover { background: var(--orbit-green-soft); }
.meal-action-btn.is-skip { color: var(--orbit-danger); }

.shopping-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 4px;
    border-bottom: 1px solid var(--divider);
}
.shopping-row:last-child { border-bottom: 0; }
.shopping-row.is-owned .shopping-title { color: var(--orbit-text-3); }
.shopping-row.is-purchased .shopping-title {
    text-decoration: line-through;
    color: var(--orbit-text-3);
}

.shopping-check {
    width: 22px; height: 22px;
    border-radius: 6px;
    border: 1.5px solid var(--orbit-border-strong);
    background: var(--orbit-surface);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    color: transparent;
    padding: 0;
    transition: all .15s ease;
}
.shopping-check:hover { border-color: var(--orbit-green); }
.shopping-check.is-done {
    background: var(--orbit-green);
    border-color: var(--orbit-green);
    color: #FFFFFF;
}

.shopping-body { flex: 1; min-width: 0; }
.shopping-title {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--orbit-text);
    line-height: 1.35;
}
.shopping-meta {
    font-size: 12.5px;
    color: var(--orbit-text-3);
    margin-top: 2px;
    font-variant-numeric: tabular-nums;
}

.shopping-owned {
    padding: 5px 11px;
    font-size: 11.5px;
    font-weight: 600;
    font-family: inherit;
    color: var(--orbit-text-3);
    background: var(--orbit-surface-2);
    border: 0;
    border-radius: var(--r-pill);
    cursor: pointer;
    flex-shrink: 0;
    transition: background .12s ease, color .12s ease;
}
.shopping-owned.is-on {
    background: var(--orbit-green-soft);
    color: var(--orbit-green);
}

/* Home today row — meal */
.home-today-row.is-meal {
    cursor: pointer;
    text-align: left;
    width: 100%;
    font-family: inherit;
    color: inherit;
    background: transparent;
    border-left: 0;
    border-right: 0;
    border-top: 0;
}
.home-today-row.is-meal:hover { background: var(--orbit-surface-2); }
.home-today-meal-dot {
    width: 20px; height: 20px;
    border-radius: 50%;
    background: #FBEEDF;
    color: #A85E1A;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
html[data-theme="dark"] .home-today-meal-dot { background: #3A2A18; color: #D9A441; }
.home-today-meal-dot .icon { width: 12px; height: 12px; }

/* =========================================================
   MEAL PLANNER — Ingredient selector
   ========================================================= */
.ing-selector-shell {
    position: fixed;
    inset: 0;
    background: var(--orbit-bg);
    z-index: 210;
    display: flex;
    flex-direction: column;
    padding: calc(16px + env(safe-area-inset-top)) 0 calc(16px + env(safe-area-inset-bottom));
    overflow: hidden;
}
.ing-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 20px 16px;
    flex-shrink: 0;
}
.ing-title {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--orbit-text);
}
.ing-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 0;
    background: transparent;
    color: var(--orbit-text);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .12s ease;
}
.ing-icon-btn:hover { background: var(--orbit-surface-2); }

.ing-search-wrap {
    padding: 0 20px 12px;
    flex-shrink: 0;
}
.ing-search {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    background: var(--orbit-surface);
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-md);
    min-height: 46px;
    color: var(--orbit-text-3);
}
.ing-search input {
    flex: 1;
    border: 0;
    outline: none;
    background: transparent;
    font-size: 15px;
    color: var(--orbit-text);
    padding: 12px 0;
}
.ing-search input::placeholder { color: var(--orbit-text-3); }

.ing-categories {
    display: flex;
    gap: 8px;
    padding: 0 20px 12px;
    overflow-x: auto;
    scrollbar-width: none;
    flex-shrink: 0;
}
.ing-categories::-webkit-scrollbar { display: none; }
.ing-cat {
    flex-shrink: 0;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--orbit-text-2);
    background: transparent;
    border: 0;
    border-radius: var(--r-pill);
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    transition: background .12s ease, color .12s ease;
    min-height: 36px;
}
.ing-cat:hover { background: var(--orbit-surface-2); color: var(--orbit-text); }
.ing-cat.active {
    background: var(--orbit-green);
    color: #FFFFFF;
    font-weight: 600;
}

.ing-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 20px 12px;
    -webkit-overflow-scrolling: touch;
}
.ing-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 4px;
    border-bottom: 1px solid var(--divider);
    cursor: pointer;
    transition: background .12s ease;
}
.ing-row:last-child { border-bottom: 0; }
.ing-row:hover { background: var(--orbit-surface-2); border-radius: var(--r-sm); }
.ing-row.selected { background: var(--orbit-green-soft); border-radius: var(--r-sm); }

.ing-check {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 1.5px solid var(--orbit-border-strong);
    background: var(--orbit-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: transparent;
    transition: all .15s ease;
}
.ing-row.selected .ing-check {
    background: var(--orbit-green);
    border-color: var(--orbit-green);
    color: #FFFFFF;
}
.ing-check .icon {
    width: 14px;
    height: 14px;
    stroke-width: 2.6;
}

.ing-body { flex: 1; min-width: 0; }
.ing-name {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--orbit-text);
    line-height: 1.35;
}
.ing-meta {
    font-size: 12.5px;
    color: var(--orbit-text-3);
    margin-top: 2px;
    font-variant-numeric: tabular-nums;
}

.ing-empty {
    padding: 48px 20px;
    text-align: center;
    color: var(--orbit-text-3);
    font-size: 14px;
}

.ing-summary {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px 0;
    border-top: 1px solid var(--divider);
    background: var(--orbit-bg);
}
.ing-summary-count {
    flex: 1;
    font-size: 13.5px;
    color: var(--orbit-text-2);
    font-variant-numeric: tabular-nums;
}
.ing-summary-count strong {
    color: var(--orbit-text);
    font-weight: 700;
}
.ing-clear-btn {
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    color: var(--orbit-text-2);
    background: transparent;
    border: 0;
    border-radius: var(--r-pill);
    cursor: pointer;
    min-height: 36px;
    transition: background .12s ease, color .12s ease;
}
.ing-clear-btn:hover { background: var(--orbit-surface-2); color: var(--orbit-text); }
.ing-save-btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    color: #FFFFFF;
    background: var(--orbit-green);
    border: 0;
    border-radius: var(--r-pill);
    cursor: pointer;
    min-height: 44px;
    transition: background .14s ease, transform .14s ease;
}
.ing-save-btn:hover { background: var(--orbit-green-dark); }
.ing-save-btn:active { transform: translateY(1px); }

/* Estimate note — used in the budget strip */
.price-note {
    font-size: 12px;
    color: var(--orbit-text-3);
    line-height: 1.5;
    padding: 10px 4px 0;
}

@media (max-width: 420px) {
    .ing-header { padding: 6px 16px 12px; }
    .ing-search-wrap { padding: 0 16px 10px; }
    .ing-categories { padding: 0 16px 10px; }
    .ing-list { padding: 4px 16px 12px; }
    .ing-summary { padding: 12px 16px 0; }
}

.meal-card-meta {
    font-size: 12.5px;
    color: var(--orbit-text-3);
    margin-top: 2px;
    margin-bottom: 4px;
    font-variant-numeric: tabular-nums;
}

/* Money budget reference — Meals */
.meal-budget-ref {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--divider);
    font-size: 13px;
    color: var(--orbit-text-2);
    line-height: 1.5;
}
.meal-budget-ref-label { color: var(--orbit-text-3); }
.meal-budget-ref-value {
    font-weight: 600;
    color: var(--orbit-text);
    margin-left: 4px;
    font-variant-numeric: tabular-nums;
}
.meal-budget-ref-sub {
    margin-top: 2px;
    font-size: 12px;
    color: var(--orbit-text-3);
}

.money-ref-block {
    background: var(--orbit-surface-2);
    border-radius: var(--r-md);
    padding: 14px 16px;
    margin-top: -6px;
    margin-bottom: 14px;
}
.money-ref-label {
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--orbit-text-3);
    margin-bottom: 4px;
}
.money-ref-value {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--orbit-text);
    font-variant-numeric: tabular-nums;
}
.money-ref-hint {
    font-size: 12.5px;
    color: var(--orbit-text-2);
    line-height: 1.5;
    margin-top: 4px;
}
.money-ref-use {
    margin-top: 10px;
    padding: 8px 14px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--orbit-green);
    background: transparent;
    border: 1px solid var(--orbit-green);
    border-radius: var(--r-pill);
    cursor: pointer;
    min-height: 36px;
    transition: background .12s ease;
}
.money-ref-use:hover { background: var(--orbit-green-soft); }

.meal-note {
    background: var(--orbit-surface-2);
    border-radius: var(--r-md);
    padding: 14px 16px;
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--orbit-text-2);
}
.meal-note strong { color: var(--orbit-text); }

/* =========================================================
   PHASE 1 — Academic Tasks inside courses
   ========================================================= */

/* Section header that carries an inline action button */
.cd-section-head-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.cd-section-head-row .btn-sm {
    min-height: 32px;
    padding: 4px 10px;
}

/* Course banner shown at the top of Add Task modal */
.task-course-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--orbit-green-soft);
    border-radius: var(--r-md);
    margin-bottom: 16px;
    font-size: 13px;
    overflow: hidden;
}
.task-course-code {
    font-weight: 700;
    color: var(--orbit-green-dark);
    letter-spacing: -0.01em;
    flex-shrink: 0;
}
.task-course-name {
    color: var(--orbit-green);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
html[data-theme="dark"] .task-course-code { color: #7FC69A; }
html[data-theme="dark"] .task-course-name { color: #4FB477; }

/* Course badge inside Home "Today" task rows */
.home-today-course {
    color: var(--orbit-green);
    font-weight: 700;
    font-size: 11.5px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
html[data-theme="dark"] .home-today-course { color: #7FC69A; }

/* =========================================================
   PHASE 2 — Materials inside courses
   ========================================================= */

/* Unsorted-materials row: select should not stretch */
.list-row > select.input-xs {
    min-height: 34px;
    flex-shrink: 0;
}

/* Material file meta line — quieter than a task's */
.doc-meta {
    font-variant-numeric: tabular-nums;
}

/* =========================================================
   PHASE 3.2 — Flashcard recall ratings
   ========================================================= */

/* Rating buttons row under the flipped card */
.flash-rating-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    width: 100%;
    max-width: 460px;
    margin-top: 16px;
}
.flash-rating-btn {
    padding: 12px 8px;
    border-radius: var(--r-md);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    border: 1px solid transparent;
    cursor: pointer;
    min-height: 48px;
    transition: background .14s ease, color .14s ease;
}
.flash-rating-btn.again { background: #FBE3E1; color: #B03A34; }
.flash-rating-btn.again:hover { background: #C94A45; color: #FFFFFF; }
.flash-rating-btn.hard  { background: #FBF1DF; color: #8A5518; }
.flash-rating-btn.hard:hover  { background: #C77A20; color: #FFFFFF; }
.flash-rating-btn.good  { background: var(--orbit-green-soft); color: var(--orbit-green-dark); }
.flash-rating-btn.good:hover  { background: var(--orbit-green); color: #FFFFFF; }
.flash-rating-btn.easy  { background: #E7F1EA; color: #1B5E33; }
.flash-rating-btn.easy:hover  { background: var(--orbit-success); color: #FFFFFF; }

html[data-theme="dark"] .flash-rating-btn.again { background: #3A1E1C; color: #E77C76; }
html[data-theme="dark"] .flash-rating-btn.hard  { background: #2E2317; color: #D9A441; }
html[data-theme="dark"] .flash-rating-btn.good  { background: var(--orbit-green-soft); color: #7FC69A; }
html[data-theme="dark"] .flash-rating-btn.easy  { background: #16261B; color: #7FC69A; }

/* Rating badge in the flashcard list row */
.rating-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--r-pill);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    margin-left: 4px;
    flex-shrink: 0;
}
.rating-badge.again { background: #FBE3E1; color: #B03A34; }
.rating-badge.hard  { background: #FBF1DF; color: #8A5518; }
.rating-badge.good  { background: var(--orbit-green-soft); color: var(--orbit-green-dark); }
.rating-badge.easy  { background: #E7F1EA; color: #1B5E33; }
html[data-theme="dark"] .rating-badge.again { background: #3A1E1C; color: #E77C76; }
html[data-theme="dark"] .rating-badge.hard  { background: #2E2317; color: #D9A441; }
html[data-theme="dark"] .rating-badge.good  { background: var(--orbit-green-soft); color: #7FC69A; }
html[data-theme="dark"] .rating-badge.easy  { background: #16261B; color: #7FC69A; }

/* On narrow phones, keep the four buttons legible */
@media (max-width: 380px) {
    .flash-rating-btn { font-size: 12px; padding: 10px 6px; min-height: 44px; }
}

/* =========================================================
   PHASE 3.3 — Study tools (Explain It, Practice, Mistake Bank)
   ========================================================= */

/* Unified study tools list inside a course Materials tab */
.study-tool-list {
    display: flex;
    flex-direction: column;
    background: var(--orbit-surface);
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-lg);
    overflow: hidden;
}
.study-tool-row {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 16px;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--divider);
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    color: inherit;
    transition: background .12s ease;
    min-height: 60px;
}
.study-tool-row:last-child { border-bottom: 0; }
.study-tool-row:hover { background: var(--orbit-surface-2); }

.study-tool-icon {
    width: 36px; height: 36px;
    border-radius: var(--r-md);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.study-tool-icon.green  { background: var(--orbit-green-soft); color: var(--orbit-green); }
.study-tool-icon.purple { background: #EFEBFA; color: #7868B7; }
.study-tool-icon.blue   { background: #E5EEF9; color: #4C7FC4; }
.study-tool-icon.amber  { background: #FBEEDF; color: #A85E1A; }
html[data-theme="dark"] .study-tool-icon.purple { background: #2A2440; color: #B7ADE0; }
html[data-theme="dark"] .study-tool-icon.blue   { background: #1A2538; color: #82A8E6; }
html[data-theme="dark"] .study-tool-icon.amber  { background: #3A2A18; color: #D9A441; }

.study-tool-body { flex: 1; min-width: 0; }
.study-tool-title {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: var(--orbit-text);
    line-height: 1.25;
}
.study-tool-sub {
    display: block;
    font-size: 12.5px;
    color: var(--orbit-text-3);
    margin-top: 2px;
}
.study-tool-chev { color: var(--orbit-text-3); display: flex; flex-shrink: 0; }

/* List-row used for explanations / practice / mistakes */
.study-tool-item .list-body { cursor: pointer; }
.study-tool-preview { line-height: 1.4; }

/* Explanation detail modal */
.explanation-body {
    font-size: 14.5px;
    line-height: 1.65;
    color: var(--orbit-text);
    white-space: pre-wrap;
    word-break: break-word;
}

/* Practice self-test modal */
.practice-question {
    font-size: 16px;
    font-weight: 600;
    color: var(--orbit-text);
    line-height: 1.5;
    margin-bottom: 16px;
    white-space: pre-wrap;
    word-break: break-word;
}
.practice-answer {
    margin-top: 8px;
    margin-bottom: 16px;
    padding: 14px 16px;
    background: var(--orbit-green-soft);
    border-radius: var(--r-md);
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--orbit-green-dark);
    white-space: pre-wrap;
    word-break: break-word;
}
html[data-theme="dark"] .practice-answer { color: #7FC69A; }

/* Mistake detail modal */
.mistake-block {
    margin-bottom: 18px;
}
.mistake-block:last-child { margin-bottom: 0; }
.mistake-label {
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--orbit-text-3);
    margin-bottom: 4px;
}
.mistake-text {
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--orbit-text);
    white-space: pre-wrap;
    word-break: break-word;
    padding: 10px 14px;
    background: var(--orbit-surface-2);
    border-radius: var(--r-md);
}
.mistake-text.wrong   { background: #FBE3E1; color: #7A2D28; }
.mistake-text.correct { background: var(--orbit-green-soft); color: var(--orbit-green-dark); }
html[data-theme="dark"] .mistake-text.wrong   { background: #2E1A18; color: #F0A09B; }
html[data-theme="dark"] .mistake-text.correct { background: var(--orbit-green-soft); color: #7FC69A; }





/* Transparent text layer for selection */
.text-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    opacity: 1;
    line-height: 1;
    /* Container must not intercept touches — otherwise it blocks vertical
       scroll on mobile. Descendant spans opt back in for text selection. */
    pointer-events: none;
    user-select: text;
    -webkit-user-select: text;
}
.text-layer span {
    color: transparent;
    position: absolute;
    white-space: pre;
    cursor: text;
    transform-origin: 0% 0%;
    /* Spans receive pointer events so selection works, but `pan-y` lets a
       vertical drag scroll the container instead of starting selection.
       Horizontal drag or tap still selects text. */
    pointer-events: auto;
    touch-action: pan-y;
    user-select: text;
    -webkit-user-select: text;
}
.text-layer span::selection {
    background: rgba(23, 107, 58, 0.3);
}



@keyframes readerPopIn {
    from { opacity: 0; transform: translateY(2px); }
    to { opacity: 1; transform: none; }
}

/* =========================================================
   PHASE 2 — READER WORKSPACE REDESIGN (Light Theme)
   ========================================================= */

/* Document Toolbar */
.reader-doc-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: var(--orbit-surface);
    border-bottom: 1px solid var(--orbit-border);
    flex-shrink: 0;
}
.reader-doc-info {
    display: flex;
    flex-direction: column;
}
.reader-doc-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--orbit-text);
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.reader-doc-meta {
    font-size: 11px;
    color: var(--orbit-text-2);
    margin-top: 2px;
}
.reader-doc-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--orbit-surface-2);
    border-radius: var(--r-pill);
    padding: 2px;
}
.reader-doc-controls .reader-nav-btn {
    width: 28px;
    height: 28px;
}
.reader-doc-controls .reader-page-pill {
    font-size: 12px;
    padding: 0 8px;
    min-width: 60px;
    background: transparent;
}




/* Study Smarter Banner */
.reader-workspace-card {
    background: var(--orbit-green-soft);
    border-radius: var(--r-md);
    padding: 12px 16px;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.reader-workspace-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--orbit-green-dark);
    display: flex;
    align-items: center;
    gap: 6px;
}
.reader-workspace-sub {
    font-size: 12px;
    color: var(--orbit-green);
    line-height: 1.4;
}



/* =========================================================
   PHASE 3 — READING CONTROLS & CROPPING FIX
   ========================================================= */

/* 1. Prevent clipping */
.reader-page {
    position: relative;
    background: #FFFFFF;
    border: 1px solid var(--orbit-border-strong);
    box-shadow: 0 4px 12px rgba(30, 45, 35, 0.06);
    border-radius: 8px;
    overflow: visible; /* CHANGED: allows canvas to paint fully */
    flex-shrink: 0;
    touch-action: manipulation;
}
.reader-page canvas {
    display: block;
    border-radius: 8px; /* Rounds the actual PDF paper */
}

/* 2. Text layer must be absolute and centered */
.reader-text-layer {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    overflow: hidden; line-height: 1;
    pointer-events: none; user-select: text; -webkit-user-select: text;
    z-index: 2; touch-action: manipulation;
}
.reader-text-layer span {
    color: transparent; position: absolute; white-space: pre; cursor: text;
    transform-origin: 0% 0%; pointer-events: auto;
    user-select: text !important; -webkit-user-select: text !important;
    -webkit-touch-callout: default; touch-action: manipulation;
}
.reader-text-layer ::selection {
    background: rgba(23, 107, 58, 0.3);
}

/* 3. Zoom and Page controls spacing */
.reader-doc-controls {
    display: flex;
    align-items: center;
    gap: 2px;
    background: var(--orbit-surface-2);
    border-radius: var(--r-pill);
    padding: 2px 6px;
}
.reader-doc-controls .reader-nav-btn {
    width: 28px; height: 28px; font-size: 14px; font-weight: 500;
}
.reader-doc-controls .reader-page-pill {
    font-size: 12px; padding: 0 8px; min-width: 50px;
    background: transparent; font-variant-numeric: tabular-nums;
    cursor: pointer;
}
.reader-doc-controls .reader-page-pill:hover {
    background: var(--orbit-surface-3);
}

/* =========================================================
   PHASE 4 — NOTES LIST STYLING
   ========================================================= */

.reader-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.reader-list-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--orbit-text);
}

.reader-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.reader-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    background: var(--orbit-surface);
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-md);
    cursor: pointer;
}
.reader-list-item:hover {
    border-color: var(--orbit-border-strong);
}
.reader-list-item-content {
    flex: 1;
    min-width: 0;
}
.reader-list-item-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--orbit-text);
    margin-bottom: 2px;
}
.reader-list-item-meta {
    font-size: 11px;
    color: var(--orbit-text-3);
}

/* =========================================================
   PHASE 4 — BOTTOM SHEET (MODAL) STYLES
   ========================================================= */

.reader-sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 20, 16, 0.5);
    z-index: 600;
    opacity: 0;
    transition: opacity 0.2s ease;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
.reader-sheet-overlay[hidden] {
    display: none !important;
}
.reader-sheet-overlay.open { opacity: 1; }

.reader-sheet {
    width: 100%;
    max-width: 540px;
    background: var(--orbit-surface);
    border-radius: 16px 16px 0 0;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.25s ease;
    padding-bottom: env(safe-area-inset-bottom);
    max-height: 85vh;
}
.reader-sheet-overlay.open .reader-sheet { transform: translateY(0); }

.reader-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--divider);
    flex-shrink: 0;
}
.reader-sheet-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--orbit-text);
}
.reader-sheet-close {
    width: 30px; height: 30px;
    border-radius: 50%;
    border: 0;
    background: var(--orbit-surface-2);
    color: var(--orbit-text);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
}
.reader-sheet-close:hover {
    background: var(--orbit-surface-3);
}
.reader-sheet-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    -webkit-overflow-scrolling: touch;
}
.reader-sheet-footer {
    display: flex;
    gap: 10px;
    padding: 14px 16px;
    border-top: 1px solid var(--divider);
    flex-shrink: 0;
}
.reader-sheet-footer .btn { flex: 1; }

.reader-sheet-selection {
    background: var(--orbit-surface-2);
    border-radius: var(--r-md);
    padding: 12px;
    margin-bottom: 16px;
    border-left: 3px solid var(--orbit-green);
}
.reader-sheet-selection-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--orbit-text-3);
    margin-bottom: 4px;
    letter-spacing: 0.04em;
}
.reader-sheet-selection-body {
    font-size: 13px;
    color: var(--orbit-text-2);
    line-height: 1.5;
    max-height: 100px;
    overflow-y: auto;
}

/* =========================================================
   PHASE 5 — FLASHCARD REVIEW UI
   ========================================================= */

.flash-review-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}
.flash-review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--orbit-text-2);
    margin-bottom: 12px;
}
.flash-review-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--orbit-surface);
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-lg);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    min-height: 180px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.flash-review-content {
    font-size: 16px;
    font-weight: 500;
    color: var(--orbit-text);
    line-height: 1.5;
}
.flash-review-hint {
    font-size: 11px;
    color: var(--orbit-text-3);
    margin-top: 16px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.flash-review-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}
.flash-review-actions .btn {
    flex: 1;
    min-height: 44px;
}

/* =========================================================
   PHASE 7 — REVISE WORKSPACE
   ========================================================= */

.revise-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}
.revise-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--orbit-text-2);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.revise-score {
    color: var(--orbit-green);
}
.revise-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--orbit-surface);
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-lg);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    min-height: 180px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}
.revise-content {
    font-size: 17px;
    font-weight: 500;
    color: var(--orbit-text);
    line-height: 1.5;
}
.revise-hint {
    font-size: 11px;
    color: var(--orbit-text-3);
    margin-top: 16px;
}
.revise-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}
.revise-actions .btn {
    flex: 1;
    min-height: 48px;
}
.revise-results {
    text-align: center;
    padding: 32px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}

/* =========================================================
   FLOATING ACTION BUTTON (Option 5)
   ========================================================= */

.reader-fab-container {
    position: absolute;
    bottom: calc(24px + env(safe-area-inset-bottom));
    right: 24px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

.reader-fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--orbit-green);
    color: #fff;
    border: none;
    box-shadow: 0 4px 12px rgba(23, 107, 58, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
}

.reader-fab:active {
    transform: scale(0.95);
}

.reader-fab-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--orbit-surface);
    padding: 8px;
    border-radius: var(--r-lg);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    border: 1px solid var(--orbit-border);
}

.reader-fab-menu[hidden] {
    display: none !important;
}

.reader-fab-menu button {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px 8px 8px;
    background: transparent;
    border: none;
    border-radius: var(--r-md);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--orbit-text);
    cursor: pointer;
    white-space: nowrap;
}

.reader-fab-menu button:hover {
    background: var(--orbit-surface-2);
}

.reader-fab-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.reader-fab-icon.green { background: var(--orbit-green-soft); color: var(--orbit-green); }
.reader-fab-icon.purple { background: #EFEBFA; color: #7868B7; }
.reader-fab-icon.amber { background: #FBEEDF; color: #A85E1A; }
.reader-fab-icon.blue { background: #E5EEF9; color: #4C7FC4; }

.reader-fab-backdrop {
    position: fixed;
    inset: 0;
    z-index: 99;
    background: transparent;
}

.reader-fab-backdrop[hidden] {
    display: none !important;
}

/* =========================================================
   READER REFINEMENTS — TEXT SELECTION & FULLSCREEN
   ========================================================= */

/* Ensure text layer receives precise selection events */
.reader-text-layer {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    overflow: hidden; line-height: 1;
    pointer-events: auto; /* Important for selection */
    user-select: text !important;
    -webkit-user-select: text !important;
    z-index: 2; 
    touch-action: pan-y; /* Allow scrolling, but not horizontal panning */
}
.reader-text-layer span {
    color: transparent; 
    position: absolute; 
    white-space: pre; 
    cursor: text;
    transform-origin: 0% 0%; 
    pointer-events: auto;
    user-select: text !important; 
    -webkit-user-select: text !important;
    -webkit-touch-callout: default; /* Restore native copy menu */
    touch-action: pan-y;
}
.reader-text-layer ::selection {
    background: rgba(23, 107, 58, 0.3);
}

/* Prevent the wrapper from clipping the canvas at high zoom */
.reader-page {
    position: relative;
    background: #FFFFFF;
    border: 1px solid var(--orbit-border-strong);
    box-shadow: 0 4px 12px rgba(30, 45, 35, 0.06);
    border-radius: 8px;
    overflow: visible; /* Changed from hidden to prevent cropping */
    flex-shrink: 0;
    touch-action: pan-y;
}
.reader-page canvas {
    display: block;
    border-radius: 8px; 
}

/* Ensure the main scroll container handles the layout correctly */
.reader-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    position: relative;
    scroll-behavior: auto; /* Must remain auto */
}

/* =========================================================
   FINAL READER LAYOUT FIXES
   ========================================================= */

/* 1. PDF Container (No Cropping) */
.reader-page {
    position: relative;
    background: #FFFFFF;
    border: 1px solid var(--orbit-border-strong);
    box-shadow: 0 4px 12px rgba(30, 45, 35, 0.06);
    border-radius: 8px;
    overflow: visible; 
    flex-shrink: 0;
    touch-action: pan-y;
}
.reader-page canvas {
    display: block;
    border-radius: 8px;
}
.reader-text-layer {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    overflow: hidden; line-height: 1;
    pointer-events: auto; 
    user-select: text !important;
    -webkit-user-select: text !important;
    z-index: 2; 
    touch-action: pan-y;
}
.reader-text-layer span {
    color: transparent; position: absolute; white-space: pre; cursor: text;
    transform-origin: 0% 0%; pointer-events: auto;
    user-select: text !important; -webkit-user-select: text !important;
    -webkit-touch-callout: default; touch-action: pan-y;
}
.reader-text-layer ::selection {
    background: rgba(23, 107, 58, 0.3);
}

/* 2. Floating Action Button */
.reader-fab-container {
    position: absolute;
    bottom: calc(24px + env(safe-area-inset-bottom));
    right: 24px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}
.reader-fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--orbit-green);
    color: #fff;
    border: none;
    box-shadow: 0 4px 12px rgba(23, 107, 58, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
}
.reader-fab:active {
    transform: scale(0.95);
}
.reader-fab-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--orbit-surface);
    padding: 8px;
    border-radius: var(--r-lg);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    border: 1px solid var(--orbit-border);
}
.reader-fab-menu[hidden] {
    display: none !important;
}
.reader-fab-menu button {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px 8px 8px;
    background: transparent;
    border: none;
    border-radius: var(--r-md);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--orbit-text);
    cursor: pointer;
    white-space: nowrap;
}
.reader-fab-menu button:hover {
    background: var(--orbit-surface-2);
}
.reader-fab-icon {
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.reader-fab-icon.green { background: var(--orbit-green-soft); color: var(--orbit-green); }
.reader-fab-icon.purple { background: #EFEBFA; color: #7868B7; }
.reader-fab-icon.amber { background: #FBEEDF; color: #A85E1A; }
.reader-fab-icon.blue { background: #E5EEF9; color: #4C7FC4; }
.reader-fab-backdrop {
    position: fixed; inset: 0; z-index: 99; background: transparent;
}
.reader-fab-backdrop[hidden] {
    display: none !important;
}

/* 3. Bottom Sheet */
.reader-sheet-overlay {
    position: fixed; inset: 0;
    background: rgba(15, 20, 16, 0.5);
    z-index: 600; opacity: 0; transition: opacity 0.2s ease;
    display: flex; align-items: flex-end; justify-content: center;
}
.reader-sheet-overlay[hidden] { display: none !important; }
.reader-sheet-overlay.open { opacity: 1; }
.reader-sheet {
    width: 100%; max-width: 540px;
    background: var(--orbit-surface);
    border-radius: 16px 16px 0 0;
    display: flex; flex-direction: column;
    transform: translateY(100%); transition: transform 0.25s ease;
    padding-bottom: env(safe-area-inset-bottom);
    max-height: 85vh;
}
.reader-sheet-overlay.open .reader-sheet { transform: translateY(0); }
.reader-sheet-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; border-bottom: 1px solid var(--divider); flex-shrink: 0;
}
.reader-sheet-title { font-size: 15px; font-weight: 700; color: var(--orbit-text); }
.reader-sheet-close {
    width: 30px; height: 30px; border-radius: 50%; border: 0;
    background: var(--orbit-surface-2); color: var(--orbit-text);
    display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.reader-sheet-body { flex: 1; overflow-y: auto; padding: 16px; -webkit-overflow-scrolling: touch; }
.reader-sheet-footer {
    display: flex; gap: 10px; padding: 14px 16px;
    border-top: 1px solid var(--divider); flex-shrink: 0;
}
.reader-sheet-footer .btn { flex: 1; }

/* =========================================================
   PRACTICE — Mode picker
   ========================================================= */
.practice-mode-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.practice-mode-card {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 18px;
    background: var(--orbit-surface);
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-lg);
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    color: inherit;
    transition: border-color .14s ease, background .14s ease, transform .14s ease;
    min-height: 88px;
}
.practice-mode-card:hover { border-color: var(--orbit-border-strong); background: var(--orbit-surface-2); }
.practice-mode-card:active { transform: scale(0.995); }
.practice-mode-body { flex: 1; min-width: 0; }
.practice-mode-title {
    display: block;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--orbit-text);
    margin-bottom: 4px;
}
.practice-mode-sub {
    display: block;
    font-size: 13px;
    color: var(--orbit-text-2);
    line-height: 1.45;
    margin-bottom: 6px;
}
.practice-mode-meta {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--orbit-text-3);
}

/* =========================================================
   PRACTICE — Session
   ========================================================= */
.practice-question-block { margin-bottom: 20px; }
.practice-question {
    font-size: 17px;
    font-weight: 600;
    color: var(--orbit-text);
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.practice-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.practice-option {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    min-height: 56px;
    padding: 14px 16px;
    background: var(--orbit-surface);
    border: 1.5px solid var(--orbit-border);
    border-radius: var(--r-md);
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    color: inherit;
    font-size: 15px;
    transition: border-color .14s ease, background .14s ease;
}
.practice-option:hover:not(:disabled) { border-color: var(--orbit-border-strong); }
.practice-option.is-selected { border-color: var(--orbit-green); background: var(--orbit-green-soft); }
.practice-option.is-correct { border-color: var(--orbit-success); background: #E7F1EA; color: #176B3A; }
.practice-option.is-wrong { border-color: var(--orbit-danger); background: #FBE3E1; color: #7A2D28; }
.practice-option.is-neutral { opacity: 0.7; }
.practice-option:disabled { cursor: default; }
.practice-option-label {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--orbit-surface-2);
    color: var(--orbit-text-2);
    font-weight: 700;
    font-size: 13px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.practice-option.is-selected .practice-option-label { background: var(--orbit-green); color: #FFFFFF; }
.practice-option.is-correct .practice-option-label { background: var(--orbit-success); color: #FFFFFF; }
.practice-option.is-wrong .practice-option-label { background: var(--orbit-danger); color: #FFFFFF; }
.practice-option-text { flex: 1; line-height: 1.4; word-break: break-word; }

.practice-feedback {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-radius: var(--r-md);
    font-size: 14px;
    font-weight: 600;
    margin-top: 16px;
}
.practice-feedback.is-correct { background: #E7F1EA; color: #176B3A; }
.practice-feedback.is-wrong { background: #FBE3E1; color: #7A2D28; }
html[data-theme="dark"] .practice-feedback.is-correct { background: #16261B; color: #7FC69A; }
html[data-theme="dark"] .practice-feedback.is-wrong { background: #2E1A18; color: #F0A09B; }

.practice-summary {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 40px 20px;
    max-width: 380px;
    margin: 0 auto;
}
.practice-summary-icon {
    width: 64px; height: 64px;
    border-radius: 50%;
    background: var(--orbit-green-soft);
    color: var(--orbit-green);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 20px;
}
.practice-summary-icon .icon { width: 32px; height: 32px; }
.practice-summary-title {
    font-size: 22px; font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--orbit-text);
    margin-bottom: 8px;
}
.practice-summary-sub {
    font-size: 14px;
    color: var(--orbit-text-2);
    line-height: 1.5;
    margin-bottom: 24px;
}

/* Radio in objective form */
.field input[type="radio"] { cursor: pointer; }

/* =========================================================
   BATCH 4 — Responsive tightening for study tools
   ========================================================= */
@media (max-width: 420px) {
    /* 4 course-detail tabs fit more comfortably */
    .cd-tab { padding: 10px 10px; font-size: 13px; }
    /* Modal footer with 3 buttons (Delete + status + Edit) wraps cleanly */
    .modal-foot { padding: 12px 14px; gap: 8px; }
    .modal-foot .btn { min-height: 42px; padding: 8px 12px; font-size: 13px; }
    /* Session primary buttons stay touch-friendly */
    .flash-show-answer { min-height: 48px; }
    /* Practice options compact but tappable */
    .practice-option { padding: 12px 14px; min-height: 52px; }
    .practice-option-label { width: 26px; height: 26px; font-size: 12px; }
    /* Study mode container padding */
    .flash-study { padding: 0 4px; }
}

/* Dictation-safe: long dictated strings won't overflow */
textarea.input { word-break: break-word; overflow-wrap: anywhere; }

/* Focus parity for new interactive elements */
.practice-option:focus-visible,
.flash-show-answer:focus-visible,
.flash-rate-btn:focus-visible,
.practice-mode-card:focus-visible {
    outline: 2px solid var(--orbit-green);
    outline-offset: 2px;
}

/* =========================================================
   DATE PICKER
   ========================================================= */
.date-picker-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 20, 16, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    padding: 16px;
    animation: fadeIn 0.15s ease;
}
.date-picker-modal {
    width: 100%;
    max-width: 360px;
    background: var(--orbit-surface);
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}
.date-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 12px;
    border-bottom: 1px solid var(--divider);
}
.date-picker-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--orbit-text);
}
.date-picker-nav {
    display: flex;
    gap: 4px;
}
.date-picker-nav button {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 0;
    background: transparent;
    color: var(--orbit-text-2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.date-picker-nav button:hover {
    background: var(--orbit-surface-2);
    color: var(--orbit-text);
}
.date-picker-months {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
}
.date-picker-months select {
    padding: 6px 10px;
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-sm);
    background: var(--orbit-surface);
    color: var(--orbit-text);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.date-picker-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    padding: 8px 12px 12px;
}
.date-picker-dow {
    text-align: center;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--orbit-text-3);
    padding: 6px 0;
}
.date-picker-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    border-radius: 50%;
    cursor: pointer;
    color: var(--orbit-text);
    background: transparent;
    border: 1.5px solid transparent;
    transition: background 0.1s, border-color 0.1s;
}
.date-picker-cell:hover:not(.muted):not(.selected) {
    background: var(--orbit-surface-2);
}
.date-picker-cell.muted {
    color: var(--orbit-text-3);
    opacity: 0.4;
}
.date-picker-cell.today {
    border-color: var(--orbit-green);
    font-weight: 700;
    color: var(--orbit-green);
}
.date-picker-cell.selected {
    background: var(--orbit-green);
    color: #FFFFFF;
    border-color: var(--orbit-green);
    font-weight: 700;
}
.date-picker-footer {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--divider);
    justify-content: space-between;
    align-items: center;
}
.date-picker-shortcuts {
    display: flex;
    gap: 6px;
}
.date-picker-shortcuts button {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-pill);
    background: transparent;
    color: var(--orbit-text-2);
    cursor: pointer;
}
.date-picker-shortcuts button:hover {
    background: var(--orbit-surface-2);
    color: var(--orbit-text);
}
.date-picker-confirm {
    padding: 8px 20px;
    background: var(--orbit-green);
    color: #FFFFFF;
    border: 0;
    border-radius: var(--r-pill);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.date-picker-confirm:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Study Plan */
.study-plan-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.study-plan-date-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}
.study-plan-date-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--orbit-surface);
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-pill);
    font-size: 14px;
    font-weight: 600;
    color: var(--orbit-text);
    cursor: pointer;
    min-height: 40px;
}
.study-plan-date-btn:hover {
    border-color: var(--orbit-border-strong);
}
.study-plan-today-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--orbit-green);
    border-radius: var(--r-pill);
    font-size: 13px;
    font-weight: 600;
    color: var(--orbit-green);
    cursor: pointer;
    min-height: 40px;
}
.study-plan-today-btn:hover {
    background: var(--orbit-green-soft);
}
.study-plan-task-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.study-plan-task {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: var(--orbit-surface);
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-md);
    transition: border-color 0.12s;
}
.study-plan-task:hover {
    border-color: var(--orbit-border-strong);
}
.study-plan-task.done {
    opacity: 0.65;
}
.study-plan-task-check {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 1.5px solid var(--orbit-border-strong);
    background: var(--orbit-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    margin-top: 2px;
    color: transparent;
    transition: all 0.15s;
}
.study-plan-task-check:hover {
    border-color: var(--orbit-green);
}
.study-plan-task-check.done {
    background: var(--orbit-green);
    border-color: var(--orbit-green);
    color: #FFFFFF;
}
.study-plan-task-body {
    flex: 1;
    min-width: 0;
}
.study-plan-task-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--orbit-text);
    line-height: 1.35;
}
.study-plan-task.done .study-plan-task-title {
    text-decoration: line-through;
    color: var(--orbit-text-3);
}
.study-plan-task-meta {
    font-size: 12.5px;
    color: var(--orbit-text-3);
    margin-top: 2px;
}
.study-plan-task-actions {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

.study-plan-task.missed {
    border-color: var(--orbit-danger);
    background: #FBE3E1;
}
html[data-theme="dark"] .study-plan-task.missed {
    background: #2E1A18;
    border-color: #3E2422;
}

/* =========================================================
   UI/UX POLISH — CLEAN & UNCLUTTERED
   ========================================================= */

/* 1. Softer borders, better breathing room */
.page-header { margin-bottom: 20px; }
.section { margin-bottom: 24px; }
.list-row { padding: 14px 6px; }
.list-leading { background: transparent; border: 1px solid var(--orbit-border); }

/* 2. Pillar Cards (More Academics) */
.pillar-list {
    background: transparent;
    border: none;
    gap: 8px;
    display: flex;
    flex-direction: column;
}
.pillar-card {
    background: var(--orbit-surface);
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-md);
    padding: 14px 16px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
    transition: transform 0.1s ease, border-color 0.1s ease;
}
.pillar-card:active { transform: scale(0.995); }
.pillar-card:last-child { border-bottom: 1px solid var(--orbit-border); } /* Reset the list styling */
.pillar-icon { width: 36px; height: 36px; border-radius: 10px; }

/* 3. Study Plan Page Header */
.study-plan-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--orbit-surface);
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-lg);
    padding: 8px 12px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}
.study-plan-date-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}
.study-plan-date-btn {
    border: none;
    background: transparent;
    padding: 8px 12px;
    min-height: 38px;
    font-size: 14.5px;
    font-weight: 600;
    color: var(--orbit-text);
}
.study-plan-date-btn:hover { background: var(--orbit-surface-2); border-radius: var(--r-sm); }
.study-plan-today-btn {
    border: 1px solid var(--orbit-border);
    background: var(--orbit-surface-2);
    color: var(--orbit-text-2);
    padding: 6px 14px;
    font-size: 12.5px;
    border-radius: var(--r-pill);
}
.study-plan-today-btn:hover { background: var(--orbit-surface-3); color: var(--orbit-text); }

/* 4. Study Plan Tasks */
.study-plan-task {
    padding: 14px 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
    background: var(--orbit-surface);
}
.study-plan-task.missed {
    border-color: transparent; /* Let the left accent do the work */
    border-left: 3px solid var(--orbit-danger);
    background: var(--orbit-surface);
}
html[data-theme="dark"] .study-plan-task.missed {
    background: var(--orbit-surface);
    border-left-color: var(--orbit-danger);
}
.study-plan-task.missed .study-plan-task-title { color: var(--orbit-danger); }

/* 5. Exams List - Cleaner Layout */
.exam-list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--orbit-surface);
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-md);
    margin-bottom: 10px;
    cursor: pointer;
    transition: border-color 0.15s ease;
}
.exam-list-row:hover { border-color: var(--orbit-border-strong); }
.exam-list-row .exam-date-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--orbit-surface-2);
    border-radius: var(--r-sm);
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    margin-right: 14px;
    line-height: 1.1;
}
.exam-list-row .exam-date-badge .day { font-size: 18px; font-weight: 700; color: var(--orbit-text); }
.exam-list-row .exam-date-badge .month { font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--orbit-text-3); }
.exam-list-row.past .exam-date-badge { opacity: 0.5; }
.exam-list-row.past .exam-info { opacity: 0.6; }

/* =========================================================
   SPIRITUAL LIFE
   ========================================================= */
.spiritual-shell {
    max-width: 680px;
    margin: 0 auto;
    padding-bottom: 40px;
}

.spiritual-onboarding {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding-top: 20px;
}

.spiritual-welcome-title {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--orbit-text);
    margin-bottom: 12px;
    line-height: 1.2;
}

.spiritual-welcome-sub {
    font-size: 15px;
    color: var(--orbit-text-2);
    line-height: 1.6;
    max-width: 420px;
    margin-bottom: 40px;
}

.spiritual-faith-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--orbit-text-3);
    margin-bottom: 16px;
}

.spiritual-faith-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 340px;
    margin-bottom: 32px;
}

.spiritual-faith-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--orbit-surface);
    border: 1.5px solid var(--orbit-border);
    border-radius: var(--r-lg);
    cursor: pointer;
    font-family: inherit;
    color: inherit;
    transition: border-color 0.14s ease, background 0.14s ease, transform 0.14s ease;
    text-align: left;
}

.spiritual-faith-card:hover {
    border-color: var(--orbit-green);
    background: var(--orbit-green-soft);
}

.spiritual-faith-card.selected {
    border-color: var(--orbit-green);
    background: var(--orbit-green-soft);
    transform: scale(0.98);
}

.spiritual-icon-wrap {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--orbit-surface-2);
    color: var(--orbit-text-2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.spiritual-faith-card:hover .spiritual-icon-wrap,
.spiritual-faith-card.selected .spiritual-icon-wrap {
    background: var(--orbit-surface);
    color: var(--orbit-green);
}

.spiritual-faith-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--orbit-text);
}

.spiritual-onboarding-footer {
    width: 100%;
    max-width: 340px;
}

/* Dashboard Sections */
.spiritual-section {
    margin-bottom: 24px;
}

.spiritual-card {
    background: var(--orbit-surface);
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-lg);
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.spiritual-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 16px 0;
}

.spiritual-decor-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--orbit-surface-2);
    color: var(--orbit-text-3);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.spiritual-decor-icon .icon {
    width: 22px;
    height: 22px;
}

.spiritual-empty-state h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--orbit-text);
    margin-bottom: 6px;
}

.spiritual-empty-state p {
    font-size: 14px;
    color: var(--orbit-text-2);
    line-height: 1.5;
    max-width: 320px;
}

/* Dark theme overrides */
html[data-theme="dark"] .spiritual-card {
    box-shadow: none;
}
html[data-theme="dark"] .spiritual-faith-card:hover,
html[data-theme="dark"] .spiritual-faith-card.selected {
    background: var(--orbit-green-soft);
}

/* Spiritual Tabs */
.spiritual-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--orbit-border);
    overflow-x: auto;
    scrollbar-width: none;
}
.spiritual-tabs::-webkit-scrollbar { display: none; }
.spiritual-tabs button {
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--orbit-text-3);
    background: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    white-space: nowrap;
    min-height: 44px;
}
.spiritual-tabs button.active {
    color: var(--orbit-green);
    border-bottom-color: var(--orbit-green);
}

/* Date Navigation */
.spiritual-date-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: var(--orbit-surface-2);
    border-radius: var(--r-pill);
    margin-bottom: 20px;
}
.spiritual-date-btn {
    background: transparent;
    border: none;
    font-size: 15px;
    font-weight: 600;
    color: var(--orbit-text);
    cursor: pointer;
    padding: 4px 8px;
}

/* Routine List */
.spiritual-routine-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.spiritual-task-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--orbit-surface);
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-md);
    transition: opacity 0.2s ease;
}
.spiritual-task-row.is-done {
    opacity: 0.6;
    background: var(--orbit-surface-2);
}
.spiritual-task-check {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1.5px solid var(--orbit-border-strong);
    background: var(--orbit-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    color: transparent;
    transition: all 0.15s ease;
}
.spiritual-task-check:hover { border-color: var(--orbit-green); }
.spiritual-task-check.is-done {
    background: var(--orbit-green);
    border-color: var(--orbit-green);
    color: #FFFFFF;
}
.spiritual-task-body { flex: 1; min-width: 0; }
.spiritual-task-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--orbit-text);
    line-height: 1.35;
}
.spiritual-task-row.is-done .spiritual-task-title {
    text-decoration: line-through;
    color: var(--orbit-text-3);
}
.spiritual-task-sub {
    font-size: 12.5px;
    color: var(--orbit-text-2);
    margin-top: 2px;
}

/* Day Picker (Routine Form) */
.spiritual-day-picker {
    display: flex;
    gap: 8px;
    justify-content: space-between;
}
.spiritual-day-btn {
    flex: 1;
    aspect-ratio: 1;
    max-width: 44px;
    border-radius: 50%;
    border: 1.5px solid var(--orbit-border);
    background: var(--orbit-surface);
    color: var(--orbit-text-2);
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.12s ease;
}
.spiritual-day-btn:hover { border-color: var(--orbit-border-strong); }
.spiritual-day-btn.active {
    background: var(--orbit-green);
    border-color: var(--orbit-green);
    color: #FFFFFF;
}

/* Progress */
.spiritual-progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.spiritual-progress-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--orbit-text-3);
    margin-bottom: 4px;
}
.spiritual-progress-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--orbit-text);
    line-height: 1;
}
.spiritual-progress-unit {
    font-size: 14px;
    font-weight: 500;
    color: var(--orbit-text-2);
}
.spiritual-progress-ring {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.spiritual-progress-ring::after {
    content: '';
    position: absolute;
    inset: 6px;
    background: var(--orbit-surface);
    border-radius: 50%;
}
.spiritual-progress-ring span {
    position: relative;
    z-index: 1;
    font-size: 13px;
    font-weight: 700;
    color: var(--orbit-text);
}

/* Spiritual Learning */
.spiritual-card-list {
    display: flex;
    flex-direction: column;
}
.spiritual-card {
    background: var(--orbit-surface);
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-md);
}
/* =========================================================
   SPIRITUAL LIFE — POLISHED & RESPONSIVE
   ========================================================= */
.spiritual-shell {
    max-width: 1000px;
    margin: 0 auto;
    padding-bottom: 40px;
}

/* Desktop 2-column layout */
.spiritual-dashboard-grid {
    display: flex;
    flex-direction: column;
    gap: 24px;
}
@media (min-width: 900px) {
    .spiritual-dashboard-grid {
        display: grid;
        grid-template-columns: 1.6fr 1fr;
        align-items: start;
    }
    .spiritual-side-col {
        display: flex;
        flex-direction: column;
        gap: 20px;
    }
}

/* Tabs */
.spiritual-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--orbit-border);
    overflow-x: auto;
    scrollbar-width: none;
}
.spiritual-tabs::-webkit-scrollbar { display: none; }
.spiritual-tabs button {
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--orbit-text-3);
    background: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    white-space: nowrap;
}
.spiritual-tabs button.active {
    color: var(--orbit-green);
    border-bottom-color: var(--orbit-green);
}

/* Date Nav */
.spiritual-date-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--orbit-surface);
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-lg);
    padding: 12px 16px;
    margin-bottom: 20px;
}
.spiritual-date-btn {
    background: transparent;
    border: none;
    font-size: 15px;
    font-weight: 600;
    color: var(--orbit-text);
    cursor: pointer;
}

/* Routine List */
.spiritual-routine-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.spiritual-task-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--orbit-surface);
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-lg);
    transition: all 0.15s ease;
}
.spiritual-task-row.is-done {
    opacity: 0.65;
    background: var(--orbit-surface-2);
}
.spiritual-task-check {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1.5px solid var(--orbit-border-strong);
    background: var(--orbit-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    color: transparent;
    transition: all 0.15s ease;
}
.spiritual-task-check:hover { border-color: var(--orbit-green); }
.spiritual-task-check.is-done {
    background: var(--orbit-green);
    border-color: var(--orbit-green);
    color: #FFFFFF;
}
.spiritual-task-body { flex: 1; min-width: 0; }
.spiritual-task-title {
    font-size: 15.5px;
    font-weight: 600;
    color: var(--orbit-text);
    line-height: 1.35;
}
.spiritual-task-row.is-done .spiritual-task-title {
    text-decoration: line-through;
    color: var(--orbit-text-3);
}
.spiritual-task-sub {
    font-size: 13px;
    color: var(--orbit-text-2);
    margin-top: 2px;
}

/* Day Picker (Routine Form) */
.spiritual-day-picker {
    display: flex;
    gap: 8px;
    justify-content: space-between;
}
.spiritual-day-btn {
    flex: 1;
    aspect-ratio: 1;
    max-width: 44px;
    border-radius: 50%;
    border: 1.5px solid var(--orbit-border);
    background: var(--orbit-surface);
    color: var(--orbit-text-2);
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.spiritual-day-btn.active {
    background: var(--orbit-green);
    border-color: var(--orbit-green);
    color: #FFFFFF;
}

/* =========================================================
   MY DIARY
   ========================================================= */
.diary-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.diary-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--orbit-surface);
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-md);
    padding: 16px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.diary-card:hover {
    border-color: var(--orbit-border-strong);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}

.diary-card-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--orbit-surface-2);
    color: var(--orbit-text-2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

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

.diary-card-title {
    font-size: 15.5px;
    font-weight: 600;
    color: var(--orbit-text);
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.diary-card-date {
    font-size: 13px;
    color: var(--orbit-text-3);
    margin-top: 2px;
}

.diary-card-chev {
    color: var(--orbit-border-strong);
    display: flex;
    flex-shrink: 0;
}

.diary-editor {
    display: flex;
    flex-direction: column;
    background: var(--orbit-surface);
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-lg);
    padding: 24px;
    min-height: 60vh;
    box-shadow: 0 2px 8px rgba(0,0,0,0.01);
}

.diary-input-title {
    width: 100%;
    border: none;
    background: transparent;
    font-size: 24px;
    font-weight: 700;
    color: var(--orbit-text);
    outline: none;
    margin-bottom: 16px;
    font-family: inherit;
    border-bottom: 1px solid var(--orbit-divider);
    padding-bottom: 12px;
}
.diary-input-title::placeholder {
    color: var(--orbit-border-strong);
    font-weight: 500;
}

.diary-input-body {
    width: 100%;
    flex: 1;
    border: none;
    background: transparent;
    font-size: 16.5px;
    line-height: 1.7;
    color: var(--orbit-text);
    outline: none;
    resize: none;
    font-family: inherit;
    min-height: 300px;
}

/* =========================================================
   PHASE 2 — ACADEMIC EDITORIAL LAYOUT
   ========================================================= */

/* The new, simplified course row */
.course-row-simple {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    padding: 16px 0;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--orbit-border);
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: background .12s ease;
}
.course-row-simple:hover {
    background: var(--orbit-surface-2);
    padding-left: 8px;
    padding-right: 8px;
    border-radius: var(--r-sm);
    border-bottom-color: transparent;
}
.course-row-simple:last-child {
    border-bottom: 0;
}
.course-row-simple-code {
    font-family: var(--font-editorial);
    font-size: 17px;
    font-weight: 600;
    color: var(--orbit-text);
    min-width: 80px;
}
.course-row-simple-body {
    flex: 1;
    min-width: 0;
}
.course-row-simple-name {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--orbit-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.course-row-simple-meta {
    display: block;
    font-size: 12px;
    color: var(--orbit-text-3);
    margin-top: 2px;
}
.course-row-simple-grade {
    font-family: var(--font-editorial);
    font-size: 18px;
    font-weight: 600;
    color: var(--orbit-green);
    min-width: 30px;
    text-align: right;
}

/* Simplify the course tabs */
.courses-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--orbit-border);
}
.courses-tab {
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--orbit-text-3);
    background: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    transition: color .14s ease, border-color .14s ease;
}
.courses-tab:hover {
    color: var(--orbit-text);
}
.courses-tab.active {
    color: var(--orbit-text);
    border-bottom-color: var(--orbit-green);
}

/* Simplify the study tool rows inside Course Detail */
.study-tool-list {
    display: flex;
    flex-direction: column;
}
.study-tool-row {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 16px 4px;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--orbit-border);
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    color: inherit;
    transition: background .12s ease;
}
.study-tool-row:hover { background: var(--orbit-surface-2); }
.study-tool-row:last-child { border-bottom: 0; }
.study-tool-icon {
    width: 32px; height: 32px;
    border-radius: var(--r-sm);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.study-tool-title {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: var(--orbit-text);
}
.study-tool-sub {
    display: block;
    font-size: 12.5px;
    color: var(--orbit-text-3);
    margin-top: 2px;
}

/* Clean up the Academic Card / CGPA Stats */
.cd-stats-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}
.cd-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.cd-stat-label {
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--orbit-text-3);
}
.cd-stat-value {
    font-family: var(--font-editorial);
    font-weight: 600;
    color: var(--orbit-text);
    line-height: 1.1;
}

/* =========================================================
   PHASE 2 — DARK MODE BUTTON VISIBILITY FIX
   Ghost buttons, chips, and inactive tabs were vanishing
   against the dark background. Lift them into view.
   ========================================================= */

/* --- Ghost buttons (Cancel, secondary actions) --- */
html[data-theme="dark"] .btn-ghost {
    background: rgba(255, 255, 255, 0.04);
    color: var(--orbit-text-2);
    border-color: var(--orbit-border-strong);
}
html[data-theme="dark"] .btn-ghost:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--orbit-text);
    border-color: #4A544D;
}

/* --- Secondary buttons (green outline) --- */
html[data-theme="dark"] .btn-secondary {
    background: rgba(79, 180, 119, 0.10);
    color: #5BC28A;
    border-color: #4FB477;
}
html[data-theme="dark"] .btn-secondary:hover {
    background: rgba(79, 180, 119, 0.20);
    border-color: #5BC28A;
}

/* --- Subtle / primary-soft buttons --- */
html[data-theme="dark"] .btn-subtle {
    background: rgba(79, 180, 119, 0.14);
    color: #5BC28A;
    border: 1px solid rgba(79, 180, 119, 0.30);
}

/* --- Small buttons --- */
html[data-theme="dark"] .btn-sm {
    border-width: 1px;
}
html[data-theme="dark"] .btn-ghost.btn-sm {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--orbit-border-strong);
}

/* --- Icon buttons (bell, back, edit, more) --- */
html[data-theme="dark"] .icon-btn {
    color: var(--orbit-text-2);
}
html[data-theme="dark"] .icon-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--orbit-text);
}
html[data-theme="dark"] .icon-btn.bordered {
    border-color: var(--orbit-border-strong);
    background: rgba(255, 255, 255, 0.03);
}

/* --- Chips (filters, categories) --- */
html[data-theme="dark"] .chip {
    background: rgba(255, 255, 255, 0.05);
    color: var(--orbit-text-2);
    border: 1px solid var(--orbit-border-strong);
}
html[data-theme="dark"] .chip:hover {
    background: rgba(255, 255, 255, 0.10);
    color: var(--orbit-text);
}
html[data-theme="dark"] .chip.active {
    background: var(--orbit-green);
    color: #FFFFFF;
    border-color: var(--orbit-green);
}

/* --- Course tabs (Current / Completed) --- */
html[data-theme="dark"] .courses-tab:not(.active) {
    color: var(--orbit-text-3);
}
html[data-theme="dark"] .courses-tab:not(.active):hover {
    color: var(--orbit-text);
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--r-sm);
}

/* --- Budget / expense / meal chips --- */
html[data-theme="dark"] .budget-chip:not(.active),
html[data-theme="dark"] .expense-chip:not(.active),
html[data-theme="dark"] .meal-tab:not(.active) {
    background: rgba(255, 255, 255, 0.05);
    color: var(--orbit-text-2);
    border: 1px solid var(--orbit-border-strong);
}
html[data-theme="dark"] .budget-chip:not(.active):hover,
html[data-theme="dark"] .expense-chip:not(.active):hover {
    background: rgba(255, 255, 255, 0.10);
    color: var(--orbit-text);
}

/* --- Segmented control (theme switcher, meal slots) --- */
html[data-theme="dark"] .seg {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--orbit-border-strong);
}
html[data-theme="dark"] .seg button:not(.active) {
    color: var(--orbit-text-2);
}
html[data-theme="dark"] .seg button.active {
    background: rgba(255, 255, 255, 0.12);
    color: var(--orbit-text);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* --- Modal footer buttons --- */
html[data-theme="dark"] .modal-foot .btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--orbit-text);
    border-color: var(--orbit-border-strong);
}
html[data-theme="dark"] .modal-foot .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* --- Back button (chevron in page headers) --- */
html[data-theme="dark"] .back-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* --- Add material / action buttons --- */
html[data-theme="dark"] .add-mat-opt {
    background: var(--orbit-surface);
}
html[data-theme="dark"] .add-mat-opt:hover {
    background: var(--orbit-surface-2);
}

/* --- Study tool rows hover for dark mode --- */
html[data-theme="dark"] .study-tool-row:hover,
html[data-theme="dark"] .course-row-simple:hover,
html[data-theme="dark"] .pillar-card:hover {
    background: rgba(255, 255, 255, 0.04);
}

/* --- Inputs (also need slight lift in dark mode) --- */
html[data-theme="dark"] .input {
    background: rgba(255, 255, 255, 0.03);
    border-color: var(--orbit-border-strong);
}
html[data-theme="dark"] .input:focus {
    background: rgba(255, 255, 255, 0.05);
    border-color: #4FB477;
    box-shadow: 0 0 0 3px rgba(79, 180, 119, 0.18);
}

/* =========================================================
   PHASE 2 — DARK MODE TAB VISIBILITY FIX
   Course Detail tabs (Overview, Tasks, Materials, Study Tools,
   Topics) and generic .tabs were invisible in dark mode because
   --orbit-green (#176B3A) is too dark against #0F1410.
   ========================================================= */

/* --- Course Detail tabs (Overview / Tasks / Materials / etc) --- */
html[data-theme="dark"] .cd-tabs {
    border-bottom-color: var(--orbit-border-strong);
    background: rgba(255, 255, 255, 0.025);
    border-radius: var(--r-sm) var(--r-sm) 0 0;
    padding: 0 4px;
    gap: 2px;
}

html[data-theme="dark"] .cd-tab {
    color: var(--orbit-text-2);
    border-bottom: 2px solid transparent;
}

html[data-theme="dark"] .cd-tab:hover {
    color: var(--orbit-text);
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--r-sm) var(--r-sm) 0 0;
}

html[data-theme="dark"] .cd-tab.active {
    color: #5BC28A;
    border-bottom-color: #4FB477;
    background: rgba(79, 180, 119, 0.10);
    border-radius: var(--r-sm) var(--r-sm) 0 0;
    font-weight: 600;
}

/* --- Generic .tabs (Semesters, GPA sub-tabs, etc) --- */
html[data-theme="dark"] .tabs {
    border-bottom-color: var(--orbit-border-strong);
}

html[data-theme="dark"] .tab {
    color: var(--orbit-text-2);
}

html[data-theme="dark"] .tab:hover {
    color: var(--orbit-text);
}

html[data-theme="dark"] .tab.active {
    color: #5BC28A;
    border-bottom-color: #4FB477;
    font-weight: 600;
}

/* --- Spiritual tabs (Today / My Activities / Learning) --- */
html[data-theme="dark"] .spiritual-tabs {
    border-bottom-color: var(--orbit-border-strong);
}
html[data-theme="dark"] .spiritual-tabs button:not(.active) {
    color: var(--orbit-text-2);
}
html[data-theme="dark"] .spiritual-tabs button:not(.active):hover {
    color: var(--orbit-text);
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--r-sm) var(--r-sm) 0 0;
}
html[data-theme="dark"] .spiritual-tabs button.active {
    color: #5BC28A;
    border-bottom-color: #4FB477;
}

/* --- Meal tabs (Discover / Saved / Schedule / Shopping) --- */
html[data-theme="dark"] .meal-tabs {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--orbit-border-strong);
}
html[data-theme="dark"] .meal-tab:not(.active) {
    color: var(--orbit-text-2);
}
html[data-theme="dark"] .meal-tab:not(.active):hover {
    color: var(--orbit-text);
    background: rgba(255, 255, 255, 0.06);
}
html[data-theme="dark"] .meal-tab.active {
    background: rgba(79, 180, 119, 0.14);
    color: #5BC28A;
    box-shadow: none;
}

/* =========================================================
   PHASE 2 — BATCH 3: MONEY, MEALS & MODALS
   ========================================================= */

/* --- Money Editorial Hero --- */
.money-editorial-hero {
    padding: 8px 0 16px;
    border-bottom: 1px solid var(--orbit-border);
}
.money-editorial-value {
    font-family: var(--font-editorial);
    font-size: 44px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--orbit-text);
    margin-top: 4px;
    margin-bottom: 6px;
}
.money-editorial-value.is-over {
    color: var(--orbit-danger);
}

/* --- Money Breakdown List --- */
.money-breakdown-list {
    display: flex;
    flex-direction: column;
}
.money-breakdown-row-simple {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--orbit-border);
    font-size: 14px;
}
.money-breakdown-row-simple:last-child { border-bottom: 0; }
.money-breakdown-label { color: var(--orbit-text-2); }
.money-breakdown-amount { font-weight: 600; color: var(--orbit-text); font-variant-numeric: tabular-nums; }

/* --- Clean Expense Rows --- */
.expense-row-simple {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 4px;
    border-bottom: 1px solid var(--orbit-border);
    cursor: pointer;
    transition: background .12s ease;
    gap: 12px;
}
.expense-row-simple:hover { background: var(--orbit-surface-2); }
.expense-row-simple:last-child { border-bottom: 0; }
.expense-row-simple-body { flex: 1; min-width: 0; }
.expense-row-simple-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--orbit-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.expense-row-simple-meta {
    font-size: 12.5px;
    color: var(--orbit-text-3);
    margin-top: 2px;
}
.expense-row-simple-amount {
    font-family: var(--font-editorial);
    font-size: 17px;
    font-weight: 600;
    color: var(--orbit-text);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

/* --- Clean Meal List Items --- */
.meal-list-item {
    padding: 16px 4px;
    border-bottom: 1px solid var(--orbit-border);
}
.meal-list-item:last-child { border-bottom: 0; }
.meal-list-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
}
.meal-list-item-title {
    font-family: var(--font-editorial);
    font-size: 18px;
    font-weight: 600;
    color: var(--orbit-text);
    line-height: 1.25;
    margin-bottom: 4px;
}
.meal-list-item-desc {
    font-size: 13.5px;
    color: var(--orbit-text-2);
    line-height: 1.5;
    margin-bottom: 12px;
    cursor: pointer;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    box-orient: vertical;
    overflow: hidden;
}
.meal-list-item-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--orbit-text-3);
}

/* --- MODAL REFINEMENTS --- */
.modal-header h3 {
    font-family: var(--font-editorial);
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--orbit-text);
}
.modal-body {
    padding: 20px 24px;
}
.modal-foot {
    padding: 16px 24px;
    background: var(--orbit-surface);
    border-top: 1px solid var(--orbit-border);
}
.modal-foot .btn {
    min-height: 42px;
}

/* =========================================================
   PHASE 3 — MOBILE & TABLET RESPONSIVENESS
   ========================================================= */

/* --- Mobile Tab Scrolling (Course Detail, etc) --- */
@media (max-width: 600px) {
    .cd-tabs, .courses-tabs, .tabs, .spiritual-tabs {
        display: flex;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Firefox */
        padding-bottom: 2px; /* Prevents underline clipping */
    }
    .cd-tabs::-webkit-scrollbar, 
    .courses-tabs::-webkit-scrollbar,
    .tabs::-webkit-scrollbar,
    .spiritual-tabs::-webkit-scrollbar {
        display: none;
    }
    .cd-tab, .courses-tab, .tab, .spiritual-tabs button {
        flex-shrink: 0; /* Prevents tabs from squishing */
        padding: 12px 16px; /* Larger touch target */
        font-size: 14px;
    }
    
    /* Ensure tab underlines are fully visible */
    html[data-theme="dark"] .cd-tab.active,
    html[data-theme="dark"] .tab.active {
        border-bottom-width: 3px;
    }
}

/* --- Dashboard Pillars (Tablet & Desktop Grid) --- */
/* Currently the pillars (Academics, Life, Money) are a single vertical list. 
   On tablets, we can show them side-by-side to use the space better. */
@media (min-width: 768px) {
    .pillar-list {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
        background: transparent;
        border: none;
        overflow: visible;
    }
    .pillar-card {
        border: 1px solid var(--orbit-border);
        border-radius: var(--r-md);
        box-shadow: var(--shadow-sm);
    }
    .pillar-card:hover {
        border-color: var(--orbit-border-strong);
        transform: translateY(-1px);
    }
    
    /* Make the dashboard "Today" list and "Attention" card span beautifully */
    .home-today-list {
        border: 1px solid var(--orbit-border);
        border-radius: var(--r-md);
        padding: 0 16px;
        background: var(--orbit-surface);
    }
}

/* --- Narrow Phone Adjustments (320px - 380px) --- */
@media (max-width: 380px) {
    /* Ensure course codes don't push the grade off screen */
    .course-row-simple-code {
        min-width: 65px;
        font-size: 15px;
    }
    .course-row-simple-name {
        font-size: 13px;
    }
    .course-row-simple-grade {
        font-size: 16px;
    }
    .course-row-simple {
        gap: 10px;
        padding: 14px 0;
    }

    /* Ensure meal titles don't cause overflow */
    .meal-list-item-title {
        font-size: 16px;
    }
    
    /* Modal padding for tiny screens */
    .modal-body { padding: 16px; }
    .modal-foot { padding: 12px 16px; }
    
    /* Ensure the page title doesn't wrap awkwardly */
    .page-title {
        font-size: 22px;
    }
    .home-head-greeting {
        font-size: 24px;
    }
}

/* --- Touch Target Minimums --- */
/* Ensure all interactive elements are at least 44px tall for accessibility */
.btn, 
.icon-btn, 
.course-row-simple, 
.expense-row-simple, 
.study-tool-row,
.pillar-card,
.meal-list-item-header {
    min-height: 44px;
}

/* =========================================================
   PHASE 3 — BATCH 2: DESKTOP LAYOUTS & FORM POLISH
   ========================================================= */

/* --- Desktop Dashboard Grid --- */
@media (min-width: 1024px) {
    .home-desktop-layout {
        display: grid;
        grid-template-columns: 1fr 320px;
        gap: 32px;
        align-items: start;
    }
    .home-main-col {
        min-width: 0; /* Prevents flex/grid blowout */
    }
    .home-side-col {
        position: sticky;
        top: 24px;
    }
}

/* --- Fix iOS Zoom on Inputs --- */
/* On mobile, any input smaller than 16px triggers automatic zoom. */
@media (max-width: 860px) {
    input.input, 
    select.input, 
    textarea.input {
        font-size: 16px !important; 
    }
    /* Keep placeholder slightly smaller for aesthetics */
    input.input::placeholder, 
    textarea.input::placeholder {
        font-size: 14px;
    }
}

/* --- Tablet Layout Tweaks (600px - 1024px) --- */
@media (max-width: 1024px) and (min-width: 600px) {
    .home-desktop-layout {
        display: flex;
        flex-direction: column;
        gap: 24px;
    }
    /* Keep the pillars as a 3-col grid on tablet */
    .home-side-col .pillar-list {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* --- Date Picker Overlay Fix --- */
.date-picker-overlay {
    z-index: 1000 !important; /* Ensure it sits above modals */
    padding: 16px;
}
.date-picker-modal {
    max-height: 90vh;
    overflow-y: auto;
}

/* --- Modal Overflow Scroll Fix --- */
/* On short screens, ensure the modal body scrolls and the footer stays pinned */
.modal {
    display: flex;
    flex-direction: column;
    max-height: 90vh; /* Limits height to viewport */
}
.modal-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.modal-header, .modal-foot {
    flex-shrink: 0;
}

/* =========================================================
   PHASE 3 — DESKTOP SIDEBAR LAYOUT FIX
   The tablet grid was bleeding into the desktop sidebar,
   causing horizontal overflow and squished pillars.
   ========================================================= */

@media (min-width: 1024px) {
    /* Restore the vertical list style for the desktop sidebar */
    .home-side-col .pillar-list {
        display: flex;
        flex-direction: column;
        gap: 1px; /* Thin divider effect */
        background: var(--orbit-border);
        border-radius: var(--r-md);
        overflow: hidden;
        border: 1px solid var(--orbit-border);
    }
    
    .home-side-col .pillar-card {
        border: 0; /* Remove the standalone tablet box */
        border-radius: 0;
        box-shadow: none;
        background: var(--orbit-surface);
        min-height: 68px;
    }
    
    .home-side-col .pillar-card:hover {
        transform: none; /* Remove the tablet hover lift */
        background: var(--orbit-surface-2);
    }

    /* Ensure the entire page doesn't have horizontal scroll */
    body, html {
        overflow-x: hidden;
    }
}

/* =========================================================
   PHASE 4 — FINAL UX POLISH & ACCESSIBILITY
   ========================================================= */

/* 1. Global Hidden Rule (Strict Rule #4) */
[hidden] {
    display: none !important;
}

/* 2. Highly Visible Focus Indicators (Accessibility) */
*:focus-visible {
    outline: 2px solid var(--orbit-green);
    outline-offset: 2px;
    border-radius: 4px;
}
html[data-theme="dark"] *:focus-visible {
    outline: 2px solid #5BC28A; /* Bright green for dark mode */
}

/* 3. Fix overlapping Z-index for sticky elements */
.sidebar, .mobile-topbar, .bottom-nav {
    z-index: 40;
}
.modal-overlay, .drawer-overlay {
    z-index: 100;
}
.modal {
    z-index: 101;
}

/* 4. Clean up tap highlights on mobile */
a, button, input, select, textarea {
    -webkit-tap-highlight-color: transparent;
}

/* 5. Ensure disabled states are clearly communicated */
.btn:disabled, .icon-btn:disabled, select.input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* =========================================================
   PHASE 4 — DARK MODE SELECT DROPDOWN FIX
   Native <select> options ignore dark mode backgrounds
   by default, causing white text on white backgrounds.
   ========================================================= */

html[data-theme="dark"] select.input {
    color-scheme: dark; /* Tells the browser to use native dark mode UI */
}

html[data-theme="dark"] select.input option {
    background-color: var(--orbit-surface); /* Dark background for the list */
    color: var(--orbit-text); /* Light text */
}

/* =========================================================
   HOME EMPTY STATE
   ========================================================= */
.home-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 48px 24px;
    background: var(--orbit-surface);
    border: 1px dashed var(--orbit-border-strong);
    border-radius: var(--r-lg);
    margin-top: 8px;
}
.home-empty-icon {
    width: 56px; height: 56px;
    border-radius: 50%;
    background: var(--orbit-green-soft);
    color: var(--orbit-green);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 16px;
}
.home-empty-state h3 {
    font-family: var(--font-editorial);
    font-size: 20px;
    font-weight: 600;
    color: var(--orbit-text);
    margin-bottom: 8px;
}
.home-empty-state p {
    font-size: 14px;
    color: var(--orbit-text-2);
    max-width: 320px;
    line-height: 1.5;
    margin-bottom: 16px;
}
html[data-theme="dark"] .home-empty-icon {
    background: rgba(79, 180, 119, 0.15);
    color: #5BC28A;
}

/* =========================================================
   APP TOUR / ONBOARDING
   ========================================================= */
.tour-shell {
    position: fixed;
    inset: 0;
    background: var(--orbit-bg);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    padding: calc(16px + env(safe-area-inset-top)) 24px calc(24px + env(safe-area-inset-bottom));
    max-width: 600px;
    margin: 0 auto;
}

.tour-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}

.tour-progress-dots {
    display: flex;
    gap: 6px;
}
.tour-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--orbit-border-strong);
    transition: background 0.2s, transform 0.2s;
}
.tour-dot.active {
    background: var(--orbit-green);
    transform: scale(1.5);
}

.tour-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 32px;
}

.tour-visual-area {
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 1000px;
}

.tour-text-area {
    text-align: center;
}

.tour-title {
    font-family: var(--font-editorial);
    font-size: 28px;
    font-weight: 600;
    color: var(--orbit-text);
    line-height: 1.15;
    margin-bottom: 12px;
}

.tour-desc {
    font-size: 15px;
    color: var(--orbit-text-2);
    line-height: 1.55;
    max-width: 380px;
    margin: 0 auto;
}

.tour-footer {
    display: flex;
    gap: 12px;
    margin-top: 32px;
}

/* --- Custom Tour Previews --- */
.tour-preview-card {
    background: var(--orbit-surface);
    border: 1px solid var(--orbit-border);
    border-radius: var(--r-lg);
    padding: 24px;
    width: 100%;
    max-width: 320px;
    box-shadow: var(--shadow-md);
    animation: tourPopIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes tourPopIn {
    from { opacity: 0; transform: translateY(10px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.tour-preview-header {
    font-family: var(--font-editorial);
    font-size: 20px;
    font-weight: 600;
    color: var(--orbit-text);
    margin-bottom: 16px;
}

.tour-preview-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--orbit-border);
}
.tour-preview-row:last-child { border-bottom: 0; }

.tour-preview-icon {
    width: 32px; height: 32px;
    border-radius: var(--r-sm);
    display: flex; align-items: center; justify-content: center;
}
.tour-preview-icon.green { background: var(--orbit-green-soft); color: var(--orbit-green); }
.tour-preview-icon.blue { background: #E5EEF9; color: #4C7FC4; }
.tour-preview-icon.amber { background: #FBEEDF; color: #A85E1A; }
.tour-preview-icon.purple { background: #EFEBFA; color: #7868B7; }

.tour-preview-text {
    display: flex;
    flex-direction: column;
    text-align: left;
}
.tour-preview-text strong {
    font-size: 14px;
    color: var(--orbit-text);
    font-weight: 600;
}
.tour-preview-text span {
    font-size: 12px;
    color: var(--orbit-text-3);
}

.tour-preview-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--orbit-border);
}
.tour-preview-list-item:last-child { border-bottom: 0; }
.tour-preview-code {
    font-family: var(--font-editorial);
    font-size: 15px;
    font-weight: 600;
    width: 60px;
}
.tour-preview-name {
    flex: 1;
    font-size: 13px;
    color: var(--orbit-text-2);
    text-align: left;
}
.tour-preview-grade {
    font-family: var(--font-editorial);
    font-size: 16px;
    font-weight: 600;
    color: var(--orbit-green);
}

.tour-preview-file {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--orbit-border);
}
.tour-preview-file:last-child { border-bottom: 0; }
.tour-preview-file-icon {
    width: 36px; height: 36px;
    border-radius: var(--r-md);
    background: var(--orbit-surface-2);
    color: var(--orbit-text-2);
    display: flex; align-items: center; justify-content: center;
}
.tour-preview-file-text {
    display: flex;
    flex-direction: column;
    text-align: left;
}
.tour-preview-file-text strong { font-size: 13.5px; font-weight: 600; color: var(--orbit-text); }
.tour-preview-file-text span { font-size: 12px; color: var(--orbit-text-3); }

.tour-preview-task {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--orbit-border);
}
.tour-preview-task:last-child { border-bottom: 0; }
.tour-preview-check {
    width: 24px; height: 24px;
    border-radius: 6px;
    background: var(--orbit-green);
    color: white;
    display: flex; align-items: center; justify-content: center;
}
.tour-preview-task-text { text-align: left; }
.tour-preview-task-text strong { display: block; font-size: 14px; font-weight: 500; color: var(--orbit-text); }
.tour-preview-task-text span { font-size: 12px; color: var(--orbit-text-3); }

.tour-preview-bar {
    height: 4px;
    background: var(--orbit-surface-3);
    border-radius: 2px;
    overflow: hidden;
}
.tour-preview-bar-fill {
    height: 100%;
    background: var(--orbit-green);
    border-radius: 2px;
}

html[data-theme="dark"] .tour-preview-icon.blue { background: #1A2538; color: #82A8E6; }
html[data-theme="dark"] .tour-preview-icon.amber { background: #3A2A18; color: #D9A441; }
html[data-theme="dark"] .tour-preview-icon.purple { background: #2A2440; color: #B7ADE0; }
html[data-theme="dark"] .tour-preview-task .tour-preview-check[style*="transparent"] { border-color: var(--orbit-border-strong) !important; }

/* =========================================================
   UNIFIED CALENDAR EVENT STYLING
   Events are blue to distinguish them from green Tasks
   ========================================================= */

/* 1. Home Page Custom Event Checkbox */
.event-check-btn {
    border-color: var(--orbit-info) !important; /* Blue outline */
}
.event-check-btn:hover {
    border-color: var(--orbit-info) !important;
    background: rgba(76, 127, 196, 0.1) !important;
}
.event-check-btn:hover .home-today-check-inner {
    background: var(--orbit-info) !important;
}
.event-check-btn.is-done {
    background: var(--orbit-info) !important;
    border-color: var(--orbit-info) !important;
    color: #FFFFFF !important;
}
.event-check-btn.is-done .home-today-check-inner {
    background: #FFFFFF !important;
}

/* 2. Life Page & Calendar List Event Checkbox */
.event-check {
    border-color: var(--orbit-info) !important;
}
.event-check:hover {
    border-color: var(--orbit-info) !important;
    background: rgba(76, 127, 196, 0.1) !important;
}
.event-check.done {
    background: var(--orbit-info) !important;
    border-color: var(--orbit-info) !important;
    color: #FFFFFF !important;
}

/* 3. Event Badge (Calendar Icon + Text) */
.home-today-event-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--orbit-info);
}
.home-today-event-badge .icon {
    width: 12px;
    height: 12px;
    stroke: var(--orbit-info);
}

/* 4. Dark Mode Adjustments */
html[data-theme="dark"] .event-check-btn.is-done {
    background: #82A8E6 !important; /* Softer blue for dark mode */
    border-color: #82A8E6 !important;
}
html[data-theme="dark"] .home-today-event-badge {
    color: #82A8E6;
}
html[data-theme="dark"] .home-today-event-badge .icon {
    stroke: #82A8E6;
}/* =========================================================
   PHASE 1 — PROFILE ALIGNMENT & TEXT WRAPPING
   ========================================================= */
.profile-hero-name {
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    padding: 0 16px;
}
.profile-hero-sub {
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    padding: 0 16px;
    white-space: normal; /* Overrides any existing nowrap */
}

/* =========================================================
   PHASE 1 — TOUR ALIGNMENT (Mobile Friendly)
   ========================================================= */
.tour-visual-area {
    max-height: 35vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}
.tour-content {
    justify-content: flex-start; /* Prevents pushing text out of view */
    padding-top: 16px;
}
.tour-text-area {
    overflow-y: auto;
    padding-bottom: 16px;
}

/* =========================================================
   PHASE 2 — BATCH 1: GLOBAL BUTTONS, INPUTS & FORMS
   ========================================================= */

/* 1. Touch Targets (Accessibility) */
.btn-sm {
    min-height: 44px !important; 
    padding: 8px 16px !important;
    font-size: 13.5px !important;
}
.icon-btn {
    min-width: 44px !important;
    min-height: 44px !important;
    width: 44px !important;
    height: 44px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* 2. Form Inputs & Focus States */
.input, 
select.input, 
textarea.input {
    min-height: 48px !important;
    font-size: 15px !important;
    background-color: var(--orbit-surface) !important;
    border: 1px solid var(--orbit-border) !important;
    border-radius: var(--r-md) !important;
    padding: 12px 16px !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
}

/* Standardized Focus Ring */
.input:focus, 
select.input:focus, 
textarea.input:focus {
    outline: none !important;
    border-color: var(--orbit-green) !important;
    box-shadow: 0 0 0 3px var(--orbit-green-soft) !important;
}

html[data-theme="dark"] .input:focus, 
html[data-theme="dark"] select.input:focus, 
html[data-theme="dark"] textarea.input:focus {
    border-color: #4FB477 !important; /* Bright green for dark mode */
    box-shadow: 0 0 0 3px rgba(79, 180, 119, 0.15) !important;
}

/* Form Labels */
.field label {
    font-size: 12.5px !important;
    font-weight: 600 !important;
    color: var(--orbit-text-2) !important;
    margin-bottom: 6px !important;
    display: block !important;
}

/* 3. Dark Mode Button Visibility (Ghost & Secondary) */
html[data-theme="dark"] .btn-ghost {
    background: rgba(255, 255, 255, 0.04) !important;
    color: var(--orbit-text-2) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}
html[data-theme="dark"] .btn-ghost:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: var(--orbit-text) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

html[data-theme="dark"] .btn-secondary {
    background: rgba(79, 180, 119, 0.1) !important;
    color: #5BC28A !important;
    border-color: rgba(79, 180, 119, 0.3) !important;
}
html[data-theme="dark"] .btn-secondary:hover {
    background: rgba(79, 180, 119, 0.2) !important;
    border-color: #4FB477 !important;
}

/* 4. Small Text Inputs (used in some specific places) */
.input-xs {
    min-height: 40px !important;
    padding: 8px 12px !important;
    font-size: 13px !important;
}
/* =========================================================
   PHASE 2 — BATCH 2: CARDS, LISTS & MODALS
   ========================================================= */

/* 1. Standardize Card & List Paddings */
.list-row, 
.course-row-simple, 
.expense-row-simple, 
.meal-list-item {
    padding: 14px 4px !important;
    border-bottom: 1px solid var(--orbit-border) !important;
    align-items: center;
}

.list-row:last-child, 
.course-row-simple:last-child, 
.expense-row-simple:last-child, 
.meal-list-item:last-child {
    border-bottom: none !important;
}

/* 2. Modal Layout & Scrolling Fix */
.modal {
    display: flex !important;
    flex-direction: column !important;
    max-height: 90vh !important;
}

.modal-header {
    flex-shrink: 0 !important;
}

/* Ensure the body scrolls internally if content is too long */
.modal-body {
    flex: 1 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
}

/* Ensure the footer stays pinned and well-padded */
.modal-foot {
    flex-shrink: 0 !important;
    padding: 16px 20px !important;
    background: var(--orbit-surface) !important;
    border-top: 1px solid var(--orbit-divider) !important;
    position: sticky !important;
    bottom: 0 !important;
    z-index: 10 !important;
}

/* 3. Mobile Specific Adjustments */
@media (max-width: 600px) {
    /* Tighter empty states so they don't push content off screen */
    .empty-state {
        padding: 32px 16px !important;
    }
    
    /* Tighter modal padding for small screens */
    .modal-body {
        padding: 16px !important;
    }
    .modal-foot {
        padding: 12px 16px !important;
        gap: 8px !important; /* Ensure buttons don't touch */
    }
    .modal-header {
        padding: 16px !important;
    }
}
/* =========================================================
   PHASE 2 — BATCH 3: TYPOGRAPHY & PAGE HEADERS
   ========================================================= */

/* 1. Enforce Editorial Serif for Main Page Titles */
.page-title,
.title-row h1,
.cd-title,
.auth-page-title,
.setup-complete-title,
.home-head-greeting,
.onboarding-title {
    font-family: var(--font-editorial) !important;
    font-weight: 600 !important;
    letter-spacing: -0.015em !important;
    color: var(--orbit-text) !important;
}

/* 2. Standardize Page Subtitles */
.page-sub {
    font-family: var(--font-ui) !important;
    font-size: 14.5px !important;
    color: var(--orbit-text-2) !important;
    line-height: 1.5 !important;
    margin-top: 4px !important;
}

/* 3. Align Title Row (Back button + Title) */
.title-row {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    margin-bottom: 4px !important;
}

/* Optical alignment for the back button */
.title-row .back-btn {
    margin-left: -8px !important; 
}

/* 4. Home Greeting Specific Tweaks */
.home-head-greeting {
    font-size: 28px !important;
    line-height: 1.15 !important;
}

/* 5. Section Headers (e.g., "Today", "Your Courses") */
.section-head .section-title {
    font-family: var(--font-ui) !important;
    font-size: 11.5px !important;
    font-weight: 600 !important;
    letter-spacing: 0.08em !important;
    color: var(--orbit-text-3) !important;
    text-transform: uppercase !important;
}

/* 6. Modal Titles */
.modal-header h3 {
    font-family: var(--font-editorial) !important;
    font-size: 20px !important;
    font-weight: 600 !important;
    letter-spacing: -0.01em !important;
}

/* =========================================================
   PHASE 3 — LOADING SPINNER
   ========================================================= */
.loading-spinner-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px 20px;
    width: 100%;
}
.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--orbit-border);
    border-top-color: var(--orbit-green);
    border-radius: 50%;
    animation: orbit-spin 0.8s linear infinite;
}
@keyframes orbit-spin {
    to { transform: rotate(360deg); }
}