:root {
    color-scheme: light;
    --bg: #edf2f8;
    --surface: #ffffff;
    --surface-soft: #f7f9fc;
    --text: #182230;
    --muted: #667085;
    --line: #d9e2ec;
    --primary: #155eef;
    --primary-dark: #004eeb;
    --navy: #102a56;
    --danger: #b42318;
    --danger-soft: #fef3f2;
    --success: #027a48;
    --success-soft: #ecfdf3;
    --info: #175cd3;
    --info-soft: #eff8ff;
    --shadow: 0 18px 50px rgba(16, 24, 40, .10);
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
    min-height: 100vh;
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 10% 10%, rgba(21, 94, 239, .09), transparent 32rem),
        var(--bg);
}

a { color: inherit; }
button, input { font: inherit; }
h1, h2, p { margin-top: 0; }

.card {
    background: var(--surface);
    border: 1px solid rgba(208, 213, 221, .85);
    border-radius: 22px;
    box-shadow: var(--shadow);
}

.brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 18px;
}

.brand-link { text-decoration: none; }
.brand-mark {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    border-radius: 15px;
    color: #fff;
    background: linear-gradient(135deg, #155eef, #00359e);
    box-shadow: 0 10px 24px rgba(21, 94, 239, .25);
    font-weight: 900;
    letter-spacing: .04em;
}
.brand-copy strong { display: block; font-size: 1.05rem; }
.brand-copy span { color: var(--muted); font-size: .88rem; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 17px;
    border: 0;
    border-radius: 11px;
    cursor: pointer;
    font-weight: 800;
    text-decoration: none;
    transition: transform .12s, background .12s, box-shadow .12s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { color: #fff; background: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 9px 22px rgba(21, 94, 239, .22); }
.btn-light { color: var(--text); background: var(--surface-soft); border: 1px solid var(--line); }
.btn-danger { color: #fff; background: var(--danger); }
.btn-full { width: 100%; }

/* Inicio */
.home-page {
    display: grid;
    place-items: center;
    padding: 28px 18px;
}
.home-shell { width: min(100%, 980px); }
.home-card {
    overflow: hidden;
    border: 1px solid rgba(208, 213, 221, .85);
    border-radius: 28px;
    background: var(--surface);
    box-shadow: var(--shadow);
}
.brand-home {
    justify-content: flex-start;
    margin: 0;
    padding: 22px 28px;
    border-bottom: 1px solid var(--line);
}
.home-content {
    padding: clamp(38px, 7vw, 76px) clamp(24px, 7vw, 76px) 48px;
    text-align: center;
}
.eyebrow {
    display: inline-flex;
    margin-bottom: 16px;
    padding: 7px 11px;
    border-radius: 999px;
    color: #1849a9;
    background: #eaf2ff;
    font-size: .75rem;
    font-weight: 900;
    letter-spacing: .08em;
}
.home-content h1 {
    max-width: 760px;
    margin: 0 auto 18px;
    font-size: clamp(2rem, 5vw, 3.65rem);
    line-height: 1.05;
    letter-spacing: -.05em;
}
.home-content p {
    max-width: 690px;
    margin: 0 auto 28px;
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.65;
}
.btn-home { min-width: 220px; }
.home-features {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1px;
    background: var(--line);
    border-top: 1px solid var(--line);
}
.home-features article { padding: 22px; background: var(--surface-soft); }
.home-features strong { display: block; margin-bottom: 6px; }
.home-features span { color: var(--muted); font-size: .88rem; line-height: 1.45; }

/* Login y cambio de contraseña */
.auth-page {
    display: grid;
    place-items: center;
    padding: 30px 18px;
}
.auth-shell { width: min(100%, 430px); }
.auth-card { padding: 30px; }
h1 { margin-bottom: 8px; font-size: 1.65rem; letter-spacing: -.025em; }
.subtitle { margin-bottom: 25px; color: var(--muted); line-height: 1.55; }
.field { margin-bottom: 17px; }
label { display: block; margin-bottom: 7px; font-weight: 700; font-size: .92rem; }
input {
    width: 100%;
    min-height: 46px;
    padding: 10px 13px;
    color: var(--text);
    background: #fff;
    border: 1px solid #cfd8e6;
    border-radius: 11px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(21, 94, 239, .12); }
.alert {
    margin-bottom: 18px;
    padding: 12px 14px;
    border-radius: 11px;
    font-size: .92rem;
    line-height: 1.45;
}
.alert-error { color: var(--danger); background: var(--danger-soft); border: 1px solid #fecdca; }
.alert-success { color: var(--success); background: var(--success-soft); border: 1px solid #abefc6; }
.alert-info { color: var(--info); background: var(--info-soft); border: 1px solid #b2ddff; }
.help { margin-top: 16px; color: var(--muted); font-size: .84rem; line-height: 1.5; text-align: center; }
.password-rules { margin: 0 0 18px; padding-left: 20px; color: var(--muted); font-size: .88rem; line-height: 1.6; }

/* Panel */
.app-page { min-height: 100vh; }
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 13px clamp(18px, 4vw, 50px);
    color: #fff;
    background: var(--navy);
    box-shadow: 0 4px 18px rgba(16, 42, 86, .18);
}
.topbar-title strong { display: block; }
.topbar-title span { display: block; color: #cbd8ef; font-size: .82rem; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.topbar .btn-light { color: #fff; background: rgba(255,255,255,.10); border-color: rgba(255,255,255,.20); }
.topbar form { margin: 0; }
.container { width: min(1180px, calc(100% - 32px)); margin: 32px auto 60px; }
.hero {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}
.hero h1 { margin-bottom: 7px; }
.hero p { margin: 0; color: var(--muted); }
.role-pill {
    display: inline-flex;
    padding: 7px 11px;
    border-radius: 999px;
    color: #1849a9;
    background: #eaf2ff;
    font-weight: 800;
    font-size: .8rem;
}
.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card { padding: 22px; }
.stat-label { color: var(--muted); font-weight: 700; font-size: .88rem; }
.stat-value { margin-top: 8px; font-size: 2rem; font-weight: 900; letter-spacing: -.04em; }
.stat-note { margin-top: 7px; color: var(--muted); font-size: .78rem; }
.panel { padding: 24px; }
.panel-header { margin-bottom: 18px; }
.panel-header h2 { margin-bottom: 6px; font-size: 1.15rem; }
.panel-header p { margin: 0; color: var(--muted); }
.module-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.module {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: var(--surface-soft);
}
.module strong { display: block; margin: 7px 0 6px; }
.module > span:last-child { color: var(--muted); font-size: .87rem; line-height: 1.45; }
.module-tag { color: var(--primary); font-size: .67rem; font-weight: 900; letter-spacing: .07em; }

@media (max-width: 850px) {
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .module-grid { grid-template-columns: 1fr; }
}

@media (max-width: 650px) {
    .home-features { grid-template-columns: 1fr; }
    .brand-home { padding: 18px 20px; }
}

@media (max-width: 560px) {
    .auth-card { padding: 24px 20px; }
    .topbar { align-items: flex-start; flex-direction: column; }
    .topbar-actions { width: 100%; }
    .topbar-actions .btn { flex: 1; }
    .hero { align-items: flex-start; flex-direction: column; }
    .stats { grid-template-columns: 1fr; }
}
