/* UniAI Paraguay — themed with CSS variables for light/dark */
:root, html.dark {
    --bg:        #08110d;
    --bg-rgb:    8 17 13;
    --bg-surf:   #0f1c17;
    --bg-surf-rgb: 15 28 23;
    --bg-elev:   #15241d;
    --bg-hover:  #1c3025;
    --ink:       #eaf4ee;
    --ink-mut:   #9bb1a6;
    --ink-dim:   #6b8278;
    --brand:     #10b981;
    --brand-h:   #34d399;
    --brand-soft:#10b98118;
    --teal:      #14b8a6;
    --sun:       #fbbf24;
    --rose:      #fb7185;
    --edge:      #1f3a2c;
    --edge-strong: #2c5040;
    --shadow-color: 0,0,0;
    --shadow-brand: 16,185,129;
    --ring:      0 0 0 4px rgba(16,185,129,0.18);
    --elev-1:    0 1px 2px rgba(0,0,0,0.25), 0 4px 14px -8px rgba(0,0,0,0.4);
    --elev-2:    0 4px 12px -4px rgba(0,0,0,0.45), 0 14px 36px -14px rgba(0,0,0,0.55);
    --elev-3:    0 10px 24px -8px rgba(0,0,0,0.55), 0 24px 56px -16px rgba(0,0,0,0.6);
}
html.light {
    --bg:        #f5f9f6;
    --bg-rgb:    245 249 246;
    --bg-surf:   #ffffff;
    --bg-surf-rgb: 255 255 255;
    --bg-elev:   #f0f7f3;
    --bg-hover:  #e3eee8;
    --ink:       #0d1c14;
    --ink-mut:   #4a6359;
    --ink-dim:   #7c8f86;
    --brand:     #059669;
    --brand-h:   #047857;
    --brand-soft:#05966914;
    --teal:      #0d9488;
    --sun:       #d97706;
    --rose:      #e11d48;
    --edge:      #d6e8de;
    --edge-strong: #a8c5b6;
    --shadow-color: 6,12,9;
    --shadow-brand: 5,150,105;
    --ring:      0 0 0 4px rgba(5,150,105,0.16);
    --elev-1:    0 1px 2px rgba(15,40,28,0.06), 0 4px 14px -8px rgba(15,40,28,0.12);
    --elev-2:    0 4px 12px -4px rgba(15,40,28,0.10), 0 14px 36px -14px rgba(15,40,28,0.18);
    --elev-3:    0 10px 24px -8px rgba(15,40,28,0.14), 0 24px 56px -16px rgba(15,40,28,0.22);
}

* { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
html, body { font-family: 'Plus Jakarta Sans', system-ui, sans-serif; background: var(--bg); color: var(--ink); }
html { scroll-behavior: smooth; }
::selection { background: rgba(16,185,129,0.35); color: var(--ink); }
html.light ::selection { background: rgba(5,150,105,0.18); color: var(--ink); }

/* Global focus ring (accessibility) */
:where(a, button, [role="button"], input, select, textarea):focus-visible {
    outline: none;
    box-shadow: var(--ring);
    border-radius: 10px;
}

/* Override Tailwind colors via classes used in HTML — keep specificity */
.bg-bg { background-color: var(--bg) !important; }
.bg-bg-surface { background-color: var(--bg-surf) !important; }
.bg-bg-elev { background-color: var(--bg-elev) !important; }
.bg-bg-hover { background-color: var(--bg-hover) !important; }
/* Theme-aware translucent backgrounds (replaces baked Tailwind alpha utilities) */
.bg-bg\/75 { background-color: rgb(var(--bg-rgb) / 0.75) !important; }
.bg-bg\/80 { background-color: rgb(var(--bg-rgb) / 0.80) !important; }
.bg-bg\/85 { background-color: rgb(var(--bg-rgb) / 0.85) !important; }
.bg-bg-surface\/75 { background-color: rgb(var(--bg-surf-rgb) / 0.75) !important; }
.bg-bg-surface\/80 { background-color: rgb(var(--bg-surf-rgb) / 0.80) !important; }
.bg-bg-surface\/85 { background-color: rgb(var(--bg-surf-rgb) / 0.85) !important; }
.text-ink { color: var(--ink) !important; }
.text-ink-muted { color: var(--ink-mut) !important; }
.text-ink-dim { color: var(--ink-dim) !important; }
.border-edge { border-color: var(--edge) !important; }
.text-brand, .text-brand-hover { color: var(--brand) !important; }
.text-teal { color: var(--teal) !important; }
.text-sun { color: var(--sun) !important; }
.text-rose { color: var(--rose) !important; }
.bg-brand\/10 { background-color: var(--brand-soft) !important; }

/* Sidebar language picker */
.lang-pill {
    display: inline-flex; align-items: center; justify-content: center; gap: 4px;
    padding: 7px 4px; border-radius: 8px;
    font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
    color: var(--ink-mut); cursor: pointer; transition: all 150ms ease;
    background: transparent; border: none;
}
.lang-pill > span { font-size: 11px; }
.lang-pill:hover { color: var(--ink); background: var(--bg-hover); }
.lang-pill.active {
    background: linear-gradient(135deg, var(--brand), var(--teal));
    color: #ffffff;
    box-shadow: 0 4px 12px -4px rgba(var(--shadow-brand),0.4);
}
html.dark .lang-pill.active { color: #0b1410; }

/* Sidebar role pill */
.role-pill {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; padding: 8px 4px; border-radius: 8px;
    font-size: 11px; font-weight: 600;
    color: var(--ink-mut); cursor: pointer; transition: all 150ms ease; background: transparent; border: none;
}
.role-pill > span { font-size: 10px; opacity: 0.85; }
.role-pill:hover { color: var(--ink); }
.role-pill.active {
    background: linear-gradient(135deg, var(--brand), var(--teal));
    color: #ffffff;
    font-weight: 800;
    box-shadow: 0 4px 14px -4px rgba(16,185,129,0.4);
}
html.light .role-pill.active { color: #ffffff; }

/* Sidebar nav */
.nav-link {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px; border-radius: 12px;
    font-size: 14px; font-weight: 500; color: var(--ink-mut);
    transition: background 160ms ease, color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
    cursor: pointer; position: relative; text-decoration: none;
}
.nav-link:hover { background: var(--bg-hover); color: var(--ink); transform: translateX(2px); }
.nav-link.active {
    background: linear-gradient(135deg, rgba(16,185,129,0.20), rgba(20,184,166,0.08));
    color: var(--ink); font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(16,185,129,0.32), 0 8px 22px -10px rgba(16,185,129,0.32);
}
html.light .nav-link.active {
    background: linear-gradient(135deg, rgba(5,150,105,0.14), rgba(13,148,136,0.07));
    box-shadow: inset 0 0 0 1px rgba(5,150,105,0.28), 0 6px 18px -8px rgba(5,150,105,0.18);
}
.nav-link.active::before {
    content: ''; position: absolute; left: -3px; top: 50%;
    width: 3px; height: 20px; background: var(--brand);
    border-radius: 0 3px 3px 0; transform: translateY(-50%);
    box-shadow: 0 0 12px var(--brand);
}
.nav-icon { font-size: 18px; width: 22px; display: inline-flex; justify-content: center; }

/* Cards */
.card {
    background: var(--bg-surf); border: 1px solid var(--edge);
    border-radius: 18px; padding: 22px;
    box-shadow: var(--elev-1);
    transition: border-color 220ms ease, transform 220ms ease, box-shadow 220ms ease;
}
.card:hover { border-color: var(--edge-strong); box-shadow: var(--elev-2); }
.card-header {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin-bottom: 16px;
    font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--ink-mut);
}
.card-header > span:first-child { color: var(--ink); letter-spacing: 0.06em; text-transform: none; font-size: 13px; font-weight: 600; }
.card-header-hint { color: var(--ink-dim); font-size: 10.5px; font-weight: 600; }

/* Section titles — jerarquía clara entre bloques de la página */
.section-title-row {
    display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
    margin-bottom: 4px;
}
.section-kicker {
    font-size: 10.5px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase;
    color: var(--brand); opacity: 0.85; margin-bottom: 4px;
}
.section-title {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 22px; font-weight: 600; line-height: 1.15; letter-spacing: -0.015em;
    color: var(--ink); margin: 0;
}
@media (max-width: 640px) {
    .section-title { font-size: 19px; }
}
.card-soft { background: linear-gradient(150deg, var(--bg-elev), var(--bg-surf)); }
.card-glow { box-shadow: 0 0 0 1px rgba(16,185,129,0.22), 0 14px 44px -12px rgba(16,185,129,0.28); }
.card-interactive { cursor: pointer; }
.card-interactive:hover { transform: translateY(-2px); }

/* Hero card — used on dashboards (welcome banner) */
.hero {
    background: linear-gradient(135deg, rgba(16,185,129,0.16), rgba(20,184,166,0.06) 60%, transparent);
    box-shadow: var(--elev-2), inset 0 1px 0 rgba(255,255,255,0.04);
    position: relative;
}
html.light .hero {
    background: linear-gradient(135deg, rgba(5,150,105,0.10), rgba(13,148,136,0.05) 60%, var(--bg-surf));
    box-shadow: var(--elev-2);
}

/* ====================================================================
   PAGE HERO — banner unificado para todas las vistas (jobs, teacher,
   admin, course detail). Reemplaza patrones ad-hoc.
   ==================================================================== */
.page-hero {
    position: relative;
    border-radius: 22px;
    padding: 22px 24px;
    background: linear-gradient(135deg, rgba(16,185,129,0.12), rgba(20,184,166,0.04) 70%, transparent);
    box-shadow: var(--elev-1), inset 0 1px 0 rgba(255,255,255,0.04);
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.04);
}
.page-hero.tone-teal   { background: linear-gradient(135deg, rgba(20,184,166,0.13), rgba(16,185,129,0.04) 70%, transparent); }
.page-hero.tone-purple { background: linear-gradient(135deg, rgba(168,85,247,0.13), rgba(20,184,166,0.04) 70%, transparent); }
.page-hero.tone-rose   { background: linear-gradient(135deg, rgba(251,113,133,0.13), rgba(251,191,36,0.04) 70%, transparent); }
html.light .page-hero            { background: linear-gradient(135deg, rgba(5,150,105,0.09), rgba(13,148,136,0.03) 70%, var(--bg-surf)); border-color: rgba(15,40,28,0.04); }
html.light .page-hero.tone-teal  { background: linear-gradient(135deg, rgba(13,148,136,0.10), rgba(5,150,105,0.03) 70%, var(--bg-surf)); }
html.light .page-hero.tone-purple{ background: linear-gradient(135deg, rgba(168,85,247,0.10), rgba(13,148,136,0.03) 70%, var(--bg-surf)); }
html.light .page-hero.tone-rose  { background: linear-gradient(135deg, rgba(225,29,72,0.10), rgba(217,119,6,0.03) 70%, var(--bg-surf)); }
.page-hero-blob {
    display: block; position: absolute; pointer-events: none; border-radius: 50%;
    filter: blur(60px); -webkit-filter: blur(60px);
    opacity: 0.18; z-index: 0;
}
/* Fallback: si filter: blur falla, los blobs igual son CHICOS y semi-transparentes */
@supports not ((filter: blur(60px)) or (-webkit-filter: blur(60px))) {
    .page-hero-blob { display: none; }
}
.page-hero-blob.b1 { top: -50px; right: -30px; width: 140px; height: 140px; background: var(--brand); }
.page-hero-blob.b2 { bottom: -60px; left: -20px; width: 130px; height: 130px; background: var(--teal); }
.page-hero > *:not(.page-hero-blob) { position: relative; z-index: 1; }
.page-hero-row {
    display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.page-hero-icon {
    width: 56px; height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--brand), var(--teal));
    display: flex; align-items: center; justify-content: center;
    font-size: 26px; flex-shrink: 0;
    box-shadow: 0 8px 22px -8px rgba(var(--shadow-brand), 0.5);
}
.page-hero-body { flex: 1; min-width: 0; }
.page-hero-kicker {
    font-size: 10.5px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase;
    color: var(--brand); opacity: 0.85; margin-bottom: 6px;
}
.page-hero-title {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 26px; font-weight: 600; line-height: 1.1; letter-spacing: -0.02em;
    color: var(--ink); margin: 0;
}
.page-hero-desc {
    font-size: 14px; color: var(--ink-mut); margin-top: 6px; line-height: 1.5;
    max-width: 60ch;
}
@media (max-width: 640px) {
    .page-hero { padding: 18px 18px; border-radius: 18px; }
    .page-hero-icon { width: 44px; height: 44px; font-size: 20px; border-radius: 12px; }
    .page-hero-title { font-size: 22px; }
    .page-hero-desc { font-size: 13px; }
}

/* ====================================================================
   STAT BREAKDOWN (apilado horizontal con barras proporcionales)
   Reemplaza las "5 cards de 1 número cada una" del teacher dashboard.
   ==================================================================== */
.stat-stack { display: flex; flex-direction: column; gap: 10px; }
.stat-stack-bar {
    display: flex; height: 12px; border-radius: 999px;
    background: var(--edge); overflow: hidden;
    box-shadow: inset 0 1px 0 rgba(0,0,0,0.18);
}
.stat-stack-bar > span { height: 100%; transition: flex 600ms cubic-bezier(0.2,0.8,0.2,1); position: relative; }
.stat-stack-bar > span:first-child { border-top-left-radius: 999px; border-bottom-left-radius: 999px; }
.stat-stack-bar > span:last-child  { border-top-right-radius: 999px; border-bottom-right-radius: 999px; }
.stat-stack-legend {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 12px;
}
.stat-stack-legend-item {
    display: flex; align-items: center; gap: 9px; min-width: 0;
}
.stat-stack-legend-dot {
    width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0;
}
.stat-stack-legend-text { display: flex; flex-direction: column; min-width: 0; }
.stat-stack-legend-label { font-size: 11px; font-weight: 600; color: var(--ink-mut); letter-spacing: 0.04em; text-transform: uppercase; }
.stat-stack-legend-value { font-size: 18px; font-weight: 800; color: var(--ink); line-height: 1.1; letter-spacing: -0.01em; }

/* Tutor sidebar context buttons */
.ctx-btn {
    display: flex; align-items: center; gap: 12px;
    width: 100%; padding: 10px 12px; border-radius: 12px;
    font-size: 13px; color: var(--ink-mut);
    background: transparent; border: 1px solid transparent;
    cursor: pointer; transition: all 150ms ease;
    text-align: left;
}
.ctx-btn:hover { background: var(--bg-hover); color: var(--ink); border-color: var(--edge); }
.ctx-btn.active {
    background: linear-gradient(135deg, rgba(16,185,129,0.16), rgba(20,184,166,0.06));
    color: var(--ink);
    border-color: rgba(16,185,129,0.32);
    box-shadow: 0 6px 18px -8px rgba(var(--shadow-brand), 0.3);
}
.ctx-btn-icon { font-size: 16px; width: 22px; text-align: center; flex-shrink: 0; }
.ctx-btn-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ctx-btn-title { font-weight: 500; font-size: 13px; line-height: 1.25; }
.ctx-btn-meta { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 10.5px; color: var(--ink-dim); letter-spacing: 0.02em; }

/* Kpi tile — used in teacher/admin headers */
.kpi-tile {
    display: flex; align-items: center; gap: 14px;
    padding: 16px 18px; border-radius: 14px;
    background: var(--bg-surf); border: 1px solid var(--edge);
    transition: border-color 200ms ease, transform 200ms ease;
}
.kpi-tile:hover { border-color: var(--edge-strong); transform: translateY(-1px); }
.kpi-tile-icon {
    width: 42px; height: 42px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    background: var(--brand-soft); color: var(--brand); font-size: 20px;
    flex-shrink: 0;
}
.kpi-tile-body { display: flex; flex-direction: column; min-width: 0; }
.kpi-tile-label { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-dim); }
.kpi-tile-value { font-size: 22px; font-weight: 800; color: var(--ink); line-height: 1.1; letter-spacing: -0.015em; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px; border-radius: 12px;
    font-size: 14px; font-weight: 600; cursor: pointer; line-height: 1.2;
    transition: transform 180ms ease, box-shadow 200ms ease, background 180ms ease, border-color 180ms ease, color 180ms ease, filter 200ms ease;
    border: 1px solid transparent; white-space: nowrap; user-select: none;
}
.btn:active { transform: translateY(0) scale(0.98); }
.btn-primary {
    background: linear-gradient(135deg, var(--brand), var(--teal));
    color: #ffffff;
    box-shadow: 0 6px 18px -6px rgba(var(--shadow-brand),0.55), inset 0 1px 0 rgba(255,255,255,0.18);
}
html.dark .btn-primary { color: #0b1410; }
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.06); box-shadow: 0 12px 26px -6px rgba(var(--shadow-brand),0.6), inset 0 1px 0 rgba(255,255,255,0.22); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; filter: grayscale(0.2); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--edge); }
.btn-ghost:hover { background: var(--bg-hover); border-color: var(--edge-strong); transform: translateY(-1px); }
.btn-danger { background: rgba(251,113,133,0.1); color: var(--rose); border-color: rgba(251,113,133,0.3); }
.btn-danger:hover { background: rgba(251,113,133,0.18); transform: translateY(-1px); }
.btn-sm { padding: 7px 13px; font-size: 12px; border-radius: 10px; }
.btn-icon { padding: 7px; min-width: 32px; }

/* Inputs */
.input, .select, .textarea {
    width: 100%; background: var(--bg); border: 1.5px solid var(--edge);
    color: var(--ink); padding: 12px 14px; border-radius: 12px;
    font-size: 14px; font-family: inherit;
    transition: border-color 160ms ease, box-shadow 200ms ease, background 160ms ease;
}
.input::placeholder, .textarea::placeholder { color: var(--ink-dim); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--edge-strong); }
.input:focus, .select:focus, .textarea:focus {
    outline: none; border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(var(--shadow-brand),0.14);
}
.textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-mut); margin-bottom: 6px; letter-spacing: 0.02em; }

/* Text gradient helper */
.text-gradient {
    background: linear-gradient(135deg, var(--brand), var(--teal));
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: transparent;
}

/* Avatar */
.avatar {
    border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; color: #ffffff; flex-shrink: 0; background: var(--brand);
    box-shadow: 0 4px 14px -4px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.18);
    position: relative;
}
.avatar::after {
    content: ''; position: absolute; inset: 0; border-radius: 50%;
    box-shadow: inset 0 0 0 1.5px rgba(255,255,255,0.10);
    pointer-events: none;
}
html.dark .avatar { color: #0b1410; }
.avatar-xs { width: 24px; height: 24px; font-size: 10px; }
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-md { width: 40px; height: 40px; font-size: 14px; }
.avatar-lg { width: 56px; height: 56px; font-size: 18px; }
.avatar-xl { width: 80px; height: 80px; font-size: 28px; }

/* Risk meter circular */
.risk-meter {
    --pct: 0; --color: var(--brand);
    width: 140px; height: 140px; border-radius: 50%;
    background: conic-gradient(var(--color) calc(var(--pct) * 1%), var(--edge) 0);
    display: flex; align-items: center; justify-content: center;
    position: relative; transition: --pct 800ms ease;
}
.risk-meter::after {
    content: ''; position: absolute; inset: 8px;
    background: var(--bg-surf); border-radius: 50%;
}
.risk-meter > * { position: relative; z-index: 1; text-align: center; }

/* Progress bars */
.progress {
    height: 8px; background: var(--edge);
    border-radius: 999px; overflow: hidden;
}
.progress > div {
    height: 100%; border-radius: 999px;
    transition: width 600ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Badges */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 10px; border-radius: 999px;
    font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
    line-height: 1.2; white-space: nowrap;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
}
.badge-success { background: rgba(16,185,129,0.16); color: #6ee7b7; box-shadow: inset 0 0 0 1px rgba(16,185,129,0.22); }
.badge-warn    { background: rgba(251,191,36,0.14); color: #fcd34d; box-shadow: inset 0 0 0 1px rgba(251,191,36,0.22); }
.badge-danger  { background: rgba(251,113,133,0.14); color: #fda4af; box-shadow: inset 0 0 0 1px rgba(251,113,133,0.22); }
.badge-info    { background: rgba(20,184,166,0.14); color: #5eead4; box-shadow: inset 0 0 0 1px rgba(20,184,166,0.22); }
.badge-dim     { background: var(--bg-hover); color: var(--ink-mut); box-shadow: inset 0 0 0 1px var(--edge); }
html.light .badge-success { background: #d1fae5; color: #065f46; }
html.light .badge-warn    { background: #fef3c7; color: #92400e; }
html.light .badge-danger  { background: #fce7f3; color: #9f1239; }
html.light .badge-info    { background: #ccfbf1; color: #134e4a; }

/* Modal */
.modal-overlay {
    position: fixed; inset: 0; z-index: 50;
    background: rgba(0,0,0,0.55); backdrop-filter: blur(8px) saturate(120%);
    -webkit-backdrop-filter: blur(8px) saturate(120%);
    display: flex; align-items: center; justify-content: center;
    padding: 16px; animation: fadeIn 180ms ease-out;
}
.modal-content {
    background: var(--bg-surf); border: 1px solid var(--edge);
    border-radius: 20px; width: 100%;
    max-width: 600px; max-height: 90vh; overflow-y: auto;
    box-shadow: var(--elev-3);
    animation: modalIn 280ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.modal-content.large { max-width: 820px; }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes modalIn { from { opacity: 0; transform: scale(0.96) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }

/* Toasts */
.toast {
    background: color-mix(in srgb, var(--bg-elev) 92%, transparent);
    border: 1px solid var(--edge);
    padding: 13px 18px; border-radius: 14px; font-size: 14px;
    box-shadow: var(--elev-3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex; align-items: center; gap: 10px;
    animation: slideIn 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
    min-width: 240px;
}
.toast-success { border-left: 3px solid var(--brand); }
.toast-success .font-bold { color: var(--brand); }
.toast-error   { border-left: 3px solid var(--rose); }
.toast-error .font-bold { color: var(--rose); }
.toast-info    { border-left: 3px solid var(--teal); }
.toast-info .font-bold { color: var(--teal); }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* Chat bubbles */
.chat-msg { display: flex; gap: 12px; animation: slideUp 280ms cubic-bezier(0.2, 0.8, 0.2, 1); }
.chat-msg.user { flex-direction: row-reverse; }
.chat-bubble {
    max-width: 78%; padding: 14px 18px; border-radius: 18px;
    font-size: 14.5px; line-height: 1.55; word-wrap: break-word;
    box-shadow: var(--elev-1);
}
.chat-bubble.user {
    background: linear-gradient(135deg, var(--brand), var(--teal));
    color: #ffffff;
    border-bottom-right-radius: 6px;
    font-weight: 500;
    box-shadow: 0 8px 22px -8px rgba(var(--shadow-brand),0.45), inset 0 1px 0 rgba(255,255,255,0.18);
}
html.dark .chat-bubble.user { color: #0b1410; }
.chat-bubble.assistant {
    background: var(--bg-elev); border: 1px solid var(--edge);
    color: var(--ink); border-bottom-left-radius: 6px;
}
.chat-actions {
    display: flex; gap: 4px; margin-top: 6px;
    opacity: 0; transition: opacity 150ms;
}
.chat-msg:hover .chat-actions { opacity: 1; }
.chat-action {
    background: transparent; border: 1px solid var(--edge);
    color: var(--ink-mut); padding: 4px 10px; border-radius: 8px;
    font-size: 11px; font-weight: 600; cursor: pointer;
    transition: all 150ms;
}
.chat-action:hover { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }

.suggestion-chip {
    background: var(--bg-elev); border: 1px solid var(--edge);
    padding: 8px 14px; border-radius: 999px;
    font-size: 13px; color: var(--ink); cursor: pointer;
    transition: all 150ms; text-align: left;
}
.suggestion-chip:hover { background: var(--bg-hover); border-color: var(--brand); color: var(--brand); }

.tutor-typing {
    display: inline-flex; gap: 4px; padding: 14px 18px;
    background: var(--bg-elev); border: 1px solid var(--edge);
    border-radius: 18px; border-bottom-left-radius: 4px;
}
.tutor-typing span {
    width: 7px; height: 7px; border-radius: 50%; background: var(--brand);
    animation: dot 1.4s infinite ease-in-out;
}
.tutor-typing span:nth-child(2) { animation-delay: 0.16s; }
.tutor-typing span:nth-child(3) { animation-delay: 0.32s; }
@keyframes dot {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* Job match score circle */
.match-score {
    width: 64px; height: 64px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 18px;
    background: conic-gradient(var(--c, var(--brand)) calc(var(--p,0) * 1%), var(--edge) 0);
    position: relative;
}
.match-score::after {
    content: ''; position: absolute; inset: 5px;
    background: var(--bg-surf); border-radius: 50%;
}
.match-score > span { position: relative; z-index: 1; }

/* Achievement tiles */
.achievement {
    background: var(--bg-elev); border: 1px solid var(--edge);
    padding: 14px; border-radius: 14px; text-align: center;
    transition: transform 220ms ease, opacity 220ms ease, filter 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
    opacity: 0.45; filter: grayscale(0.8);
}
.achievement.unlocked {
    opacity: 1; filter: none;
    background: linear-gradient(135deg, rgba(16,185,129,0.14), rgba(20,184,166,0.06));
    border-color: rgba(16,185,129,0.42);
    box-shadow: 0 8px 22px -10px rgba(var(--shadow-brand),0.35);
}
.achievement.unlocked:hover { transform: translateY(-2px); box-shadow: 0 14px 28px -10px rgba(var(--shadow-brand),0.45); }
.achievement-icon { font-size: 28px; line-height: 1; margin-bottom: 8px; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.25)); }
.achievement-title { font-size: 12px; font-weight: 700; color: var(--ink); }
.achievement-desc { font-size: 10px; color: var(--ink-mut); margin-top: 3px; line-height: 1.35; }

/* Timeline */
.timeline { position: relative; padding-left: 24px; }
.timeline::before {
    content: ''; position: absolute; left: 7px; top: 0; bottom: 0;
    width: 2px; background: var(--edge);
}
.timeline-item { position: relative; padding-bottom: 20px; }
.timeline-item::before {
    content: ''; position: absolute; left: -24px; top: 6px;
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--bg-surf); border: 3px solid var(--brand);
    box-shadow: 0 0 0 3px var(--bg-surf);
}
.timeline-item.past::before { border-color: var(--ink-dim); }
.timeline-item.missing::before { border-color: var(--rose); }
.timeline-item.upcoming::before { border-color: var(--sun); }

/* Markdown */
.md p { margin: 0.5em 0; }
.md p:first-child { margin-top: 0; }
.md p:last-child { margin-bottom: 0; }
.md code {
    background: var(--bg); border: 1px solid var(--edge);
    padding: 1px 6px; border-radius: 5px;
    font-family: 'JetBrains Mono', monospace; font-size: 0.86em;
}
.md pre {
    background: var(--bg); border: 1px solid var(--edge);
    padding: 14px; border-radius: 12px; overflow-x: auto; margin: 0.6em 0;
}
.md pre code { background: transparent; border: none; padding: 0; }
.md ul, .md ol { padding-left: 1.5em; margin: 0.5em 0; }
.md li { margin: 0.25em 0; }
.md h1, .md h2, .md h3 { font-weight: 700; margin: 0.7em 0 0.3em; }
.md strong { font-weight: 700; color: var(--brand); }
.md a { color: var(--brand); text-decoration: underline; }

/* Empty */
.empty {
    text-align: center; padding: 56px 24px; color: var(--ink-dim);
    border: 1.5px dashed var(--edge); border-radius: 18px;
    background: linear-gradient(180deg, transparent, rgba(255,255,255,0.015));
}
.empty-icon { font-size: 56px; margin-bottom: 14px; opacity: 0.55; line-height: 1; }

/* Skeleton */
.skel {
    background: linear-gradient(90deg, var(--bg-elev) 0%, var(--bg-hover) 50%, var(--bg-elev) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.6s infinite ease-in-out;
    border-radius: 12px;
}
@keyframes shimmer { 0% { background-position: 200% 0 } 100% { background-position: -200% 0 } }

/* Skeleton compositions — siluetas con la forma del contenido final */
.skel-card { background: var(--bg-surf); border: 1px solid var(--edge); border-radius: 20px; padding: 24px; }
.skel-line { height: 14px; border-radius: 999px; }
.skel-line.lg { height: 22px; }
.skel-line.sm { height: 10px; }
.skel-circle { border-radius: 50%; }

/* ====================================================================
   COMMAND PALETTE (⌘K) — overlay + búsqueda + lista navegable por teclado
   ==================================================================== */
#cmdk-root { position: fixed; inset: 0; z-index: 60; pointer-events: none; opacity: 0; transition: opacity 160ms ease; }
#cmdk-root.show { pointer-events: auto; opacity: 1; }
.cmdk-overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(8px) saturate(120%);
    -webkit-backdrop-filter: blur(8px) saturate(120%);
}
.cmdk-panel {
    position: absolute; top: 14vh; left: 50%; transform: translateX(-50%) scale(0.97);
    width: min(640px, calc(100vw - 24px));
    background: var(--bg-surf); border: 1px solid var(--edge);
    border-radius: 18px; box-shadow: var(--elev-3);
    overflow: hidden; display: flex; flex-direction: column; max-height: 70vh;
    transition: transform 200ms cubic-bezier(0.2,0.8,0.2,1), opacity 160ms ease;
    opacity: 0;
}
#cmdk-root.show .cmdk-panel { transform: translateX(-50%) scale(1); opacity: 1; }
.cmdk-input-wrap {
    display: flex; align-items: center; gap: 12px;
    padding: 16px 18px; border-bottom: 1px solid var(--edge);
    background: linear-gradient(180deg, var(--bg-elev), var(--bg-surf));
}
.cmdk-input-icon { font-size: 18px; opacity: 0.65; }
.cmdk-input {
    flex: 1; min-width: 0;
    background: transparent; border: none; outline: none;
    color: var(--ink); font-size: 16px; font-weight: 500; font-family: inherit;
    padding: 4px 0; letter-spacing: -0.005em;
}
.cmdk-input::placeholder { color: var(--ink-dim); font-weight: 400; }
.cmdk-esc, .cmdk-footer kbd {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 3px 7px; min-width: 22px;
    background: var(--bg-elev); border: 1px solid var(--edge);
    border-radius: 6px; font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 10.5px; font-weight: 700; color: var(--ink-mut);
    box-shadow: inset 0 -1px 0 var(--edge);
}
.cmdk-list {
    flex: 1; overflow-y: auto; padding: 8px 8px 6px;
    scrollbar-gutter: stable;
}
.cmdk-group-label {
    font-size: 10px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase;
    color: var(--ink-dim); padding: 12px 12px 6px; margin-top: 2px;
}
.cmdk-group-label:first-child { margin-top: 0; padding-top: 8px; }
.cmdk-group { display: flex; flex-direction: column; gap: 1px; }
.cmdk-item {
    display: flex; align-items: center; gap: 12px;
    width: 100%; padding: 10px 12px; border-radius: 10px;
    background: transparent; border: none; cursor: pointer;
    color: var(--ink-mut); text-align: left;
    transition: background 120ms ease, color 120ms ease;
    font-family: inherit; font-size: 13.5px;
}
.cmdk-item:hover, .cmdk-item.active {
    background: linear-gradient(135deg, rgba(16,185,129,0.16), rgba(20,184,166,0.07));
    color: var(--ink);
    box-shadow: inset 0 0 0 1px rgba(16,185,129,0.25);
}
html.light .cmdk-item:hover, html.light .cmdk-item.active {
    background: linear-gradient(135deg, rgba(5,150,105,0.10), rgba(13,148,136,0.05));
    box-shadow: inset 0 0 0 1px rgba(5,150,105,0.22);
}
.cmdk-item-icon { font-size: 16px; width: 22px; text-align: center; flex-shrink: 0; }
.cmdk-item-label { flex: 1; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-item-hint {
    font-size: 11px; color: var(--ink-dim); font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: 180px; flex-shrink: 0;
}
.cmdk-item.active .cmdk-item-hint { color: var(--ink-mut); }
.cmdk-item-arrow {
    font-size: 12px; color: var(--brand); margin-left: 4px;
    font-family: 'JetBrains Mono', monospace; font-weight: 700;
}
.cmdk-empty {
    padding: 36px 18px; text-align: center; color: var(--ink-dim);
    font-size: 13px;
}
.cmdk-footer {
    display: flex; align-items: center; gap: 14px;
    padding: 10px 14px; border-top: 1px solid var(--edge);
    background: var(--bg-elev); font-size: 11px; color: var(--ink-dim);
    flex-wrap: wrap;
}
.cmdk-shortcut { display: inline-flex; align-items: center; gap: 5px; }
.cmdk-spacer { flex: 1; }
.cmdk-count-wrap b { color: var(--ink-mut); font-weight: 700; }

@media (max-width: 640px) {
    .cmdk-panel { top: 8vh; max-height: 80vh; width: calc(100vw - 16px); border-radius: 16px; }
    .cmdk-input-wrap { padding: 14px 16px; }
    .cmdk-input { font-size: 15px; }
    .cmdk-footer { font-size: 10.5px; gap: 10px; }
    .cmdk-shortcut:nth-child(2) { display: none; }
}

/* Hero stats inline (student dashboard) — KPIs en el hero card */
.hero-stat {
    display: flex; flex-direction: column; gap: 4px;
    padding: 14px 16px; border-radius: 14px;
    background: rgba(15,28,23,0.45);
    border: 1px solid rgba(255,255,255,0.05);
    backdrop-filter: blur(8px);
    transition: transform 200ms ease, border-color 200ms ease;
    min-width: 0;
}
html.light .hero-stat { background: rgba(255,255,255,0.55); border-color: rgba(15,40,28,0.06); }
.hero-stat:hover { transform: translateY(-2px); border-color: rgba(16,185,129,0.30); }
.hero-stat-label {
    font-size: 10px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--ink-dim);
}
.hero-stat-value {
    font-size: 22px; font-weight: 800; line-height: 1.1; letter-spacing: -0.02em;
    color: var(--ink); display: flex; align-items: baseline; gap: 4px;
}
.hero-stat-value .hero-stat-unit { font-size: 13px; font-weight: 600; color: var(--ink-mut); }
.hero-stat-bar { height: 4px; border-radius: 999px; background: var(--edge); overflow: hidden; margin-top: 4px; }
.hero-stat-bar > i { display: block; height: 100%; border-radius: 999px; background: var(--brand); transition: width 700ms cubic-bezier(0.2,0.8,0.2,1); }

/* Theme toggle button */
.theme-btn {
    background: transparent; border: 1px solid var(--edge);
    color: var(--ink-mut); padding: 6px 10px; border-radius: 8px;
    font-size: 11px; font-weight: 600; cursor: pointer;
    transition: all 150ms; display: inline-flex; align-items: center; gap: 4px;
}
.theme-btn:hover { color: var(--ink); border-color: var(--edge-strong); }

/* Search */
.search-input {
    position: relative;
}
.search-input::before {
    content: '🔍'; position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    font-size: 12px; opacity: 0.6;
}
.search-input input { padding-left: 38px; }

/* Filter pill */
.filter-pill {
    padding: 7px 14px; border-radius: 999px;
    background: var(--bg-elev); border: 1px solid var(--edge);
    color: var(--ink-mut); font-size: 12px; font-weight: 600;
    cursor: pointer; transition: all 150ms; white-space: nowrap;
}
.filter-pill:hover { color: var(--ink); border-color: var(--edge-strong); }
.filter-pill.active {
    background: linear-gradient(135deg, var(--brand), var(--teal));
    color: #ffffff; border-color: transparent;
}
html.dark .filter-pill.active { color: #0b1410; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--edge); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--edge-strong); }

/* Backgrounds blobs (slightly brighter on light) */
html.light .blob-bg { opacity: 0.4; }

/* ============== Mobile responsive overrides ============== */
@media (max-width: 1023px) {
    /* Slightly smaller padding on mobile */
    .card { padding: 18px; border-radius: 16px; }
    .card.\!p-7, .card.\!p-8 { padding: 20px !important; }
    .avatar-xl { width: 64px; height: 64px; font-size: 22px; }
    .risk-meter { width: 110px; height: 110px; }
    .risk-meter::after { inset: 6px; }
}

@media (max-width: 640px) {
    main { padding: 0 !important; }
    main > section { padding: 16px !important; }
    main > header { padding: 14px 16px !important; }
    main > header h1 { font-size: 20px !important; }
    main > header p { font-size: 12px !important; }

    .card { padding: 14px; border-radius: 14px; }
    .card.\!p-7, .card.\!p-8 { padding: 18px !important; }
    .avatar-xl { width: 56px; height: 56px; font-size: 18px; }
    .risk-meter { width: 110px; height: 110px; }

    .font-serif { line-height: 1.2 !important; }
    h2.font-serif { font-size: 1.5rem !important; }
    h3.font-serif { font-size: 1.25rem !important; }

    .btn { padding: 10px 14px; font-size: 13px; }
    .chat-bubble { max-width: 88%; padding: 12px 14px; font-size: 14px; }

    /* Hero card on mobile: stack vertically with avatar pinned left of name */
    .hero { padding: 18px !important; border-radius: 22px !important; }
    .hero > .relative.grid {
        grid-template-columns: auto 1fr !important;
        grid-template-areas: "avatar info" "cta cta" !important;
        gap: 14px !important;
    }
    .hero > .relative.grid > :nth-child(1) { grid-area: avatar; align-self: start; }
    .hero > .relative.grid > :nth-child(2) { grid-area: info; }
    .hero > .relative.grid > :nth-child(3) { grid-area: cta; width: 100%; margin-top: 4px; }
    .hero h2.font-serif { font-size: 1.4rem !important; }

    /* Achievement grid: 3 cols on mobile to keep tiles readable */
    .grid.grid-cols-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
    .achievement { padding: 10px; }
    .achievement-icon { font-size: 22px; margin-bottom: 4px; }
    .achievement-title { font-size: 11px; }
    .achievement-desc { font-size: 9px; }

    /* Tutor panel — full height on mobile */
    section.card[style*="calc(100vh"] { height: calc(100vh - 130px) !important; min-height: auto !important; }
}

/* iOS safe-area for installed PWA */
@supports (padding: env(safe-area-inset-top)) {
    main > header { padding-top: max(14px, env(safe-area-inset-top)) !important; }
    aside#sidebar { padding-bottom: env(safe-area-inset-bottom); }
}

/* Bottom nav for very small screens (mobile) */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: color-mix(in srgb, var(--bg-surf) 88%, transparent);
    border-top: 1px solid var(--edge);
    padding: 6px 8px max(6px, env(safe-area-inset-bottom));
    z-index: 30;
    justify-content: space-around;
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    box-shadow: 0 -8px 24px -16px rgba(0,0,0,0.4);
}
.mobile-nav-item {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    gap: 3px; padding: 8px 6px; border-radius: 12px;
    color: var(--ink-mut); text-decoration: none; font-size: 10px; font-weight: 600;
    transition: color 160ms ease, background 160ms ease, transform 160ms ease;
    position: relative;
}
.mobile-nav-item:hover { color: var(--ink); }
.mobile-nav-item:active { transform: scale(0.94); }
.mobile-nav-item.active { color: var(--brand); }
.mobile-nav-item.active::before {
    content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 28px; height: 3px; border-radius: 0 0 4px 4px;
    background: linear-gradient(90deg, var(--brand), var(--teal));
    box-shadow: 0 0 10px rgba(var(--shadow-brand),0.5);
}
.mobile-nav-item .nav-icon { font-size: 20px; }

@media (max-width: 1023px) {
    .mobile-nav { display: flex; }
    main { padding-bottom: 80px !important; }
    main > section { padding-bottom: 80px !important; }
}

/* Install banner — fixed toast bottom-right (NO inside the flex parent or it stretches) */
.install-banner {
    display: none;
    position: fixed;
    z-index: 45;
    left: 16px; right: 16px; bottom: 16px;
    max-height: 80px;
    padding: 12px 16px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--brand), var(--teal));
    color: #fff;
    font-weight: 600;
    align-items: center;
    gap: 12px;
    box-shadow: 0 16px 40px -10px rgba(16,185,129,0.55), 0 0 0 1px rgba(255,255,255,0.10);
    animation: slideIn 280ms cubic-bezier(0.2,0.8,0.2,1);
}
html.dark .install-banner { color: #0b1410; }
.install-banner.show { display: flex; }
@media (min-width: 768px) {
    .install-banner { left: auto; right: 20px; bottom: 20px; max-width: 360px; }
}
/* On mobile, lift above the bottom nav (80px) */
@media (max-width: 1023px) {
    .install-banner.show { bottom: 84px; }
}
.install-banner button { background: rgba(255,255,255,0.25); border: 0; color: inherit; padding: 7px 14px; border-radius: 8px; font-weight: 700; cursor: pointer; transition: background 150ms; }
.install-banner button:hover { background: rgba(255,255,255,0.35); }

/* QR code in settings */
.qr-card {
    background: #fff; padding: 18px; border-radius: 16px;
    display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.qr-card img { width: 200px; height: 200px; image-rendering: pixelated; }
.qr-url { font-size: 12px; color: #333; word-break: break-all; text-align: center; }
