/* ============================================================
   AppLab — Estilos Globales Unificados
   Integración con ui-ux-pro-max-skill:
   - Estilo: Minimalism & Swiss Style + Soft UI Evolution
   - Paleta: Construction/Architecture (adaptada) #1E40AF + #EA580C
   - Tipografía: Outfit (headings) + Work Sans (body) - pairing #11
   ============================================================ */

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

:root {
    --primary: #1E40AF;
    --primary-light: #3B82F6;
    --primary-dark: #1E3A8A;
    --primary-50: #EFF6FF;
    --primary-100: #DBEAFE;
    --accent: #EA580C;
    --accent-light: #F97316;
    --accent-50: #FFF7ED;
    --white: #FFFFFF;
    --bg: #F8FAFC;
    --bg-alt: #F1F5F9;
    --surface: #FFFFFF;
    --border: #E2E8F0;
    --border-light: #F1F5F9;
    --text: #0F172A;
    --text-secondary: #475569;
    --text-muted: #94A3B8;
    --text-inverse: #FFFFFF;
    --success: #16A34A;
    --success-bg: #F0FDF4;
    --error: #DC2626;
    --error-bg: #FEF2F2;
    --warning: #D97706;
    --warning-bg: #FFFBEB;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Work Sans', sans-serif;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    --sidebar-width: 260px;
    --topbar-height: 64px;
}

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

body {
    font-family: var(--font-body);
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.25;
    color: var(--text);
}

h1 { font-size: 1.5rem; font-weight: 700; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.125rem; }

a { color: var(--primary); text-decoration: none; transition: color 0.2s ease; }
a:hover { color: var(--primary-light); }

img { max-width: 100%; height: auto; display: block; }
input, button, textarea, select { font-family: inherit; font-size: inherit; }

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

.form-label {
    display: block;
    font-family: var(--font-heading);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-wrapper { position: relative; display: flex; align-items: center; }

.input-icon {
    position: absolute; left: 14px;
    color: var(--text-muted); pointer-events: none; flex-shrink: 0;
}

.form-input {
    width: 100%; height: 48px; padding: 0 16px;
    background: var(--bg); border: 1.5px solid var(--border);
    border-radius: var(--radius-md); color: var(--text);
    font-size: 0.9375rem; font-family: var(--font-body);
    transition: all 0.2s ease; outline: none;
}

.form-input:focus {
    border-color: var(--primary); background: var(--white);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.form-input::placeholder { color: var(--text-muted); }
.input-wrapper .form-input { padding-left: 42px; }

.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px; height: 48px; padding: 0 24px; border: none;
    border-radius: var(--radius-md); font-family: var(--font-heading);
    font-size: 0.9375rem; font-weight: 600; cursor: pointer;
    transition: all 0.2s ease; outline: none; white-space: nowrap;
}

.btn:focus-visible { box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.3); }

.btn:disabled,
.btn[disabled] {
    background: var(--bg-alt) !important;
    color: var(--text-muted) !important;
    border: 1px solid var(--border) !important;
    cursor: not-allowed !important;
    opacity: 0.6;
    box-shadow: none !important;
    transform: none !important;
}

.btn-primary { background: var(--primary); color: var(--text-inverse); }
.btn-primary:hover { background: var(--primary-dark); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-block { width: 100%; }
.btn-sm { height: 36px; padding: 0 14px; font-size: 0.8125rem; }

.btn-outline {
    background: transparent; border: 1.5px solid var(--border); color: var(--text-secondary);
}
.btn-outline:hover { border-color: var(--text-muted); background: var(--bg); }

.alert {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; border-radius: var(--radius-md);
    margin-bottom: 1.25rem; font-size: 0.875rem; line-height: 1.5;
}

.alert-error { background: var(--error-bg); color: var(--error); border: 1px solid rgba(220,38,38,0.15); }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 20px; }
.login-container { display: flex; width: 100%; max-width: 920px; min-height: 560px; background: var(--surface); border-radius: var(--radius-xl); box-shadow: var(--shadow-xl); overflow: hidden; }
.login-brand { display: none; width: 45%; background: linear-gradient(135deg,var(--primary) 0%,var(--primary-dark) 100%); color: var(--text-inverse); padding: 48px 36px; position: relative; overflow: hidden; }
.login-brand::before { content: ''; position: absolute; top: -50%; right: -30%; width: 200%; height: 200%; background: radial-gradient(circle,rgba(255,255,255,0.05) 0%,transparent 70%); pointer-events: none; }
.brand-content { position: relative; z-index: 1; display: flex; flex-direction: column; justify-content: center; height: 100%; }
.brand-icon { margin-bottom: 20px; }
.brand-icon svg { width: 52px; height: 52px; }
.brand-title { font-family: var(--font-heading); font-size: 2rem; font-weight: 700; margin-bottom: 4px; color: var(--text-inverse); }
.brand-subtitle { font-size: 0.9375rem; opacity: 0.85; margin-bottom: 24px; font-weight: 400; }
.brand-desc { font-size: 0.875rem; line-height: 1.6; opacity: 0.7; margin-bottom: 28px; }
.brand-features { display: flex; flex-wrap: wrap; gap: 8px; }
.feature-chip { display: inline-block; padding: 4px 14px; border-radius: var(--radius-full); background: rgba(255,255,255,0.12); font-size: 0.75rem; font-weight: 500; letter-spacing: 0.3px; }
.login-form-panel { width: 100%; display: flex; align-items: center; justify-content: center; padding: 40px 28px; }
.form-wrapper { width: 100%; max-width: 360px; }
.form-header { margin-bottom: 28px; }
.form-title { font-family: var(--font-heading); font-size: 1.5rem; font-weight: 700; margin-bottom: 6px; }
.form-subtitle { color: var(--text-muted); font-size: 0.875rem; }
.toggle-password { position: absolute; right: 12px; background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 6px; display: flex; align-items: center; transition: color 0.2s; }
.toggle-password:hover { color: var(--text-secondary); }
.credentials-hint { margin-top: 20px; text-align: center; font-size: 0.75rem; color: var(--text-muted); }
.credentials-hint code { background: var(--bg-alt); padding: 1px 6px; border-radius: 4px; font-family: monospace; color: var(--text-secondary); }

/* ============================================================
   DASHBOARD LAYOUT
   ============================================================ */
.dashboard-body { display: flex; min-height: 100vh; background: var(--bg); }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(15,23,42,0.5); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); z-index: 99; opacity: 0; transition: opacity 0.35s ease; }
.sidebar-overlay.active { opacity: 1; }

.sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-width); background: var(--white); border-right: 1px solid var(--border); display: flex; flex-direction: column; z-index: 100; transition: transform 0.3s cubic-bezier(0.4,0,0.2,1); }
.sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.sidebar-brand { display: flex; align-items: center; gap: 10px; }
.sidebar-logo { color: var(--primary); line-height: 0; }
.sidebar-logo svg { width: 32px; height: 32px; }
.sidebar-brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.sidebar-brand-text strong { font-family: var(--font-heading); font-size: 1rem; font-weight: 700; color: var(--text); }
.sidebar-brand-text span { font-size: 0.75rem; color: var(--text-muted); }
.sidebar-close { display: none; background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 4px; border-radius: var(--radius-sm); transition: all 0.2s; }
.sidebar-close:hover { background: var(--bg); color: var(--text); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 16px 12px; }
.nav-section-label { font-family: var(--font-heading); font-size: 0.6875rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; padding: 8px 12px 6px; margin-top: 8px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-md); color: var(--text-secondary); font-size: 0.875rem; font-weight: 500; transition: all 0.15s ease; cursor: pointer; }
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--primary-50); color: var(--primary); font-weight: 600; }
.nav-item.disabled { opacity: 0.45; cursor: not-allowed; }
.nav-item.disabled:hover { background: transparent; color: var(--text-secondary); }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-md); color: var(--text-secondary); font-size: 0.875rem; font-weight: 500; transition: all 0.15s ease; cursor: pointer; text-decoration: none; }
.nav-link:hover { background: var(--bg); color: var(--text); }
.nav-link i { width: 20px; text-align: center; font-size: 16px; }
.badge-prox { margin-left: auto; font-size: 0.625rem; font-weight: 600; background: var(--bg-alt); color: var(--text-muted); padding: 2px 8px; border-radius: var(--radius-full); text-transform: uppercase; letter-spacing: 0.3px; }
.sidebar-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 36px; height: 36px; border-radius: var(--radius-full); background: var(--primary); color: var(--text-inverse); display: flex; align-items: center; justify-content: center; font-family: var(--font-heading); font-weight: 700; font-size: 0.8125rem; }
.user-details { display: flex; flex-direction: column; line-height: 1.2; }
.user-name { font-size: 0.8125rem; font-weight: 600; color: var(--text); }
.user-role { font-size: 0.6875rem; color: var(--text-muted); }
.logout-btn { color: var(--text-muted); padding: 6px; border-radius: var(--radius-sm); transition: all 0.2s; display: flex; align-items: center; }
.logout-btn:hover { background: var(--error-bg); color: var(--error); }

.main-content { margin-left: var(--sidebar-width); flex: 1; min-height: 100vh; display: flex; flex-direction: column; transition: margin-left 0.3s ease; }

.topbar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 12px; height: var(--topbar-height); padding: 0 28px; background: rgba(255,255,255,0.85); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.topbar-toggle { display: none; background: none; border: none; cursor: pointer; color: var(--text-secondary); padding: 6px; border-radius: var(--radius-sm); transition: all 0.2s; }
.hamburger-box {
    width: 20px;
    height: 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.hamburger-line {
    display: block;
    width: 100%;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    transform-origin: center;
}

/* ============================================================
   RIPPLE EFFECT
   ============================================================ */
.ripple-container {
    position: relative;
    overflow: hidden;
}
.ripple-effect {
    position: absolute;
    border-radius: 50%;
    background: rgba(30, 64, 175, 0.3);
    transform: scale(0);
    animation: ripple-anim 0.6s ease-out forwards;
    pointer-events: none;
}
@keyframes ripple-anim {
    to {
        transform: scale(4);
        opacity: 0;
    }
}


.topbar-toggle:hover { background: var(--bg); color: var(--text); }
.topbar-title h1 { font-size: 1.125rem; font-weight: 600; }
.topbar-actions { margin-left: auto; }
.topbar-date { font-size: 0.75rem; color: var(--text-muted); text-transform: capitalize; }
.content-area { flex: 1; padding: 24px 28px 32px; }

/* ============================================================
   DASHBOARD HOME
   ============================================================ */
.welcome-banner { display: flex; align-items: center; justify-content: space-between; background: linear-gradient(135deg,var(--primary) 0%,#2563EB 100%); border-radius: var(--radius-lg); padding: 28px 32px; color: var(--text-inverse); margin-bottom: 24px; }
.welcome-text h2 { color: var(--text-inverse); font-size: 1.25rem; margin-bottom: 4px; }
.welcome-text p { font-size: 0.875rem; opacity: 0.8; max-width: 400px; }
.welcome-illustration { color: var(--text-inverse); opacity: 0.3; flex-shrink: 0; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { display: flex; align-items: center; gap: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 20px; transition: all 0.2s ease; }
.stat-card:hover { box-shadow: var(--shadow-md); border-color: transparent; transform: translateY(-2px); }
.stat-icon { width: 48px; height: 48px; border-radius: var(--radius-md); background: var(--primary-50); color: var(--stat-color,var(--primary)); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-info { display: flex; flex-direction: column; }
.stat-value { font-family: var(--font-heading); font-size: 1.125rem; font-weight: 700; color: var(--text); }
.stat-label { font-size: 0.75rem; color: var(--text-muted); }
.modules-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.module-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 24px; transition: all 0.2s ease; }
.module-card:not(.disabled):hover { box-shadow: var(--shadow-md); border-color: transparent; transform: translateY(-2px); }
.module-card.disabled { opacity: 0.6; }
.module-card-icon { width: 44px; height: 44px; border-radius: var(--radius-md); background: var(--primary-50); color: var(--mod-color,var(--primary)); display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.module-card h3 { font-size: 1rem; margin-bottom: 4px; }
.module-card p { font-size: 0.8125rem; color: var(--text-muted); margin-bottom: 14px; }
.module-link { font-family: var(--font-heading); font-size: 0.8125rem; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; color: var(--primary); }
.module-link span { transition: transform 0.2s; }
.module-link:hover span { transform: translateX(3px); }
.module-badge { display: inline-block; font-size: 0.6875rem; font-weight: 600; padding: 3px 10px; border-radius: var(--radius-full); background: var(--bg-alt); color: var(--text-muted); letter-spacing: 0.3px; }

/* ============================================================
   CONVERSOR MODULE
   ============================================================ */
.modulo-conversor { max-width: 800px; }
.conversor-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 0.75rem; font-weight: 600; padding: 6px 14px; border-radius: var(--radius-full); background: var(--success-bg); color: var(--success); }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); animation: pulse-dot 2s ease-in-out infinite; }
@keyframes pulse-dot { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
.conversor-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
.conversor-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; }
.card-label { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-heading); font-size: 0.8125rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 20px; }
.card-label svg { color: var(--primary); flex-shrink: 0; }
.conversor-form { display: flex; flex-direction: column; }
.input-group { margin-bottom: 8px; }
.input-group label { display: block; font-size: 0.8125rem; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.input-with-unit { position: relative; display: flex; align-items: center; }
.input-with-unit .form-input { padding-right: 52px; height: 52px; font-size: 1.25rem; font-weight: 600; font-family: var(--font-heading); }
.input-unit { position: absolute; right: 14px; font-family: var(--font-heading); font-size: 0.8125rem; font-weight: 600; color: var(--text-muted); pointer-events: none; }
.conversor-equals { display: flex; justify-content: center; padding: 8px 0; color: var(--text-muted); }
.result-group label { color: var(--text-muted); font-weight: 400; }
.result-display { display: flex; align-items: baseline; gap: 6px; padding: 8px 0 4px; }
.result-value { font-family: var(--font-heading); font-size: 2rem; font-weight: 700; color: var(--primary); line-height: 1; }
.result-unit { font-family: var(--font-heading); font-size: 0.875rem; font-weight: 500; color: var(--text-muted); }
.resultados-dual { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.resultados-dual .result-value { font-size: 1.5rem; }
.asistente-card { display: flex; align-items: flex-start; gap: 14px; margin-top: 16px; padding: 16px; background: var(--primary-50); border-radius: var(--radius-md); border: 1px solid rgba(30,64,175,0.1); }
.asistente-icono { flex-shrink: 0; color: var(--primary); margin-top: 2px; }
.asistente-titulo { display: block; font-family: var(--font-heading); font-size: 0.875rem; font-weight: 600; color: var(--primary); margin-bottom: 2px; }
.asistente-desc { font-size: 0.8125rem; color: var(--text-secondary); line-height: 1.5; }
.referencia-tabla { margin-top: 20px; border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--border); }
.ref-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; cursor: pointer; font-size: 0.8125rem; font-weight: 500; color: var(--text-secondary); user-select: none; transition: background 0.2s; }
.ref-header:hover { background: var(--bg); }
.ref-arrow { transition: transform 0.2s ease; }
.referencia-tabla.open .ref-arrow { transform: rotate(180deg); }
.ref-content { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; }
.referencia-tabla.open .ref-content { max-height: 400px; }
.ref-table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
.ref-table th { background: var(--bg); font-family: var(--font-heading); font-weight: 600; color: var(--text-secondary); text-align: left; padding: 10px 16px; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; border-top: 1px solid var(--border); }
.ref-table td { padding: 8px 16px; border-bottom: 1px solid var(--border-light); color: var(--text-secondary); }
.ref-table tr:last-child td { border-bottom: none; }
.ref-table tr:hover td { background: var(--bg); }

/* ============================================================
   MODULE HEADER (compartido por todos los módulos)
   ============================================================ */
.module-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }
.module-header h2 { font-size: 1.125rem; margin-bottom: 2px; }
.module-header p { font-size: 0.8125rem; color: var(--text-muted); }
.module-header-badges { display: flex; gap: 6px; flex-wrap: wrap; }

/* Variante oscura para Cono y Arena */
.cono-header {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: #fff;
    border-radius: var(--radius);
    padding: 16px 24px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}
.cono-header h1 {
    font-size: 1.15rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #ffffff;
    margin: 0;
}
.cono-header p {
    color: #cbd5e1;
    font-size: 0.8125rem;
    margin: 2px 0 0 0;
}

/* ============================================================
   SUELOS MODULE
   ============================================================ */
.modulo-suelos, .modulo-concreto { max-width: 900px; animation: fade-in 0.3s ease; }

.badge { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: var(--radius-full); font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.3px; --badge-bg: var(--primary-50); --badge-fg: var(--primary); background: var(--badge-bg); color: var(--badge-fg); }
.badge-sucs { --badge-bg: #F0FDF4; --badge-fg: #16A34A; }
.badge-aashto { --badge-bg: #EFF6FF; --badge-fg: #2563EB; }
.badge-proctor { --badge-bg: #FFF7ED; --badge-fg: #EA580C; }

.modulo-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: 16px; overflow: hidden; }
.section-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; cursor: pointer; user-select: none; transition: background 0.2s; }
.section-header:hover { background: var(--bg); }
.section-header-left { display: flex; align-items: center; gap: 12px; }
.section-number { font-family: var(--font-heading); font-size: 0.75rem; font-weight: 700; color: var(--text-muted); letter-spacing: 1px; }
.section-header h3 { font-size: 0.9375rem; font-weight: 600; }
.section-arrow { color: var(--text-muted); transition: transform 0.3s ease; flex-shrink: 0; }
.modulo-section .section-arrow { transform: rotate(-90deg); transition: transform 0.3s ease; }
.section-content { max-height: 0; overflow: hidden; transition: max-height 0.35s ease, padding 0.3s ease; padding: 0 20px; }
.section-content.open { max-height: 2000px; padding: 0 20px 20px; }

.atterberg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.atterberg-card { padding: 14px; background: var(--bg); border-radius: var(--radius-md); }
.card-label-sm { display: flex; align-items: center; gap: 6px; font-size: 0.75rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.card-label-sm svg { color: var(--primary); flex-shrink: 0; }
.atterberg-card .input-with-unit .form-input { height: 44px; font-size: 1.125rem; }
.result-ip .card-label-sm { color: var(--primary); }
.ip-display { display: flex; align-items: baseline; gap: 6px; }
.ip-value { font-family: var(--font-heading); font-size: 1.75rem; font-weight: 700; color: var(--primary); line-height: 1; }
.plasticidad-chart { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; padding: 16px; background: var(--bg); border-radius: var(--radius-md); margin-top: 8px; }
.plasticidad-info { flex: 1; min-width: 200px; }
.pi-class { display: inline-block; margin-top: 4px; padding: 3px 10px; border-radius: var(--radius-full); background: var(--primary-50); color: var(--primary); font-size: 0.8125rem; font-weight: 600; }
.pi-desc { margin-top: 8px; font-size: 0.8125rem; color: var(--text-secondary); line-height: 1.5; }
.plasticidad-canvas-wrapper { flex-shrink: 0; border-radius: var(--radius-sm); overflow: hidden; background: var(--white); border: 1px solid var(--border); line-height: 0; }
.plasticidad-canvas-wrapper canvas { display: block; max-width: 100%; height: auto; }

.sucs-intro { margin-bottom: 12px; }
.sucs-intro p { font-size: 0.8125rem; color: var(--text-secondary); }
.sucs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.sucs-field label { display: block; font-size: 0.75rem; font-weight: 500; color: var(--text-secondary); margin-bottom: 4px; }
.sucs-field .input-with-unit .form-input { height: 42px; font-size: 1rem; }
.sucs-resultado { display: flex; align-items: center; gap: 20px; padding: 16px; background: var(--success-bg); border: 1px solid rgba(22,163,74,0.15); border-radius: var(--radius-md); }
.sucs-symbol { flex-shrink: 0; }
.sucs-big { font-family: var(--font-heading); font-size: 2.25rem; font-weight: 800; color: var(--success); line-height: 1; }
.sucs-descripcion strong { display: block; font-size: 0.9375rem; margin-bottom: 2px; }
.sucs-descripcion p { font-size: 0.8125rem; color: var(--text-secondary); }

.aashto-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.aashto-field label { display: block; font-size: 0.75rem; font-weight: 500; color: var(--text-secondary); margin-bottom: 4px; }
.aashto-field .input-with-unit .form-input { height: 42px; font-size: 1rem; }
.aashto-ig-display { padding: 8px 0; }
.aashto-ig-display .ip-value { font-size: 1.5rem; }
.aashto-resultado { padding: 16px; background: var(--primary-50); border: 1px solid rgba(30,64,175,0.1); border-radius: var(--radius-md); }
.aashto-class { margin-bottom: 4px; }
.aashto-class strong { font-size: 0.8125rem; color: var(--text-secondary); }
.aashto-badge { display: inline-block; margin-left: 6px; padding: 3px 10px; border-radius: var(--radius-full); background: var(--primary); color: var(--text-inverse); font-family: var(--font-heading); font-size: 0.8125rem; font-weight: 700; }
.aashto-desc { font-size: 0.8125rem; color: var(--text-secondary); }

.proctor-table-wrapper { overflow-x: auto; margin-bottom: 16px; }
.proctor-table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
.proctor-table th { background: var(--bg); font-family: var(--font-heading); font-weight: 600; color: var(--text-secondary); text-align: left; padding: 10px 12px; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 2px solid var(--border); }
.proctor-table td { padding: 6px 12px; border-bottom: 1px solid var(--border-light); }
.proctor-table .form-input { height: 38px; font-size: 0.875rem; padding: 0 10px; }
.proctor-canvas-wrapper { border-radius: var(--radius-md); overflow: hidden; background: var(--white); border: 1px solid var(--border); margin-bottom: 16px; line-height: 0; }
.proctor-canvas-wrapper canvas { display: block; width: 100%; height: auto; }
.proctor-resultados { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.proctor-stat { display: flex; flex-direction: column; padding: 14px; background: var(--bg); border-radius: var(--radius-md); }
.proctor-stat-label { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 4px; }
.proctor-stat-value { font-family: var(--font-heading); font-size: 1.25rem; font-weight: 700; color: var(--text); }

/* ============================================================
   CONCRETO MODULE
   ============================================================ */
.aci-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.aci-field label { display: block; font-size: 0.75rem; font-weight: 500; color: var(--text-secondary); margin-bottom: 4px; }
.aci-field .input-with-unit .form-input { height: 42px; font-size: 1rem; }
.aci-field select.form-input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 5L6 8L9 5' stroke='%2394A3B8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.ac-display { padding: 8px 0; }
.ac-display .ip-value { font-size: 1.5rem; }
.aci-resultados { padding: 16px; background: var(--bg); border-radius: var(--radius-md); border: 1px solid var(--border); }
.aci-titulo { font-family: var(--font-heading); font-size: 0.8125rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.aci-tabla-wrapper { overflow-x: auto; }
.aci-tabla { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
.aci-tabla th { background: var(--surface); font-weight: 600; color: var(--text-secondary); text-align: left; padding: 8px 12px; border-bottom: 2px solid var(--border); font-size: 0.75rem; text-transform: uppercase; }
.aci-tabla td { padding: 8px 12px; border-bottom: 1px solid var(--border-light); color: var(--text-secondary); }
.aci-tabla .total-row td { border-top: 2px solid var(--border); color: var(--text); font-weight: 600; }
.material-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; vertical-align: middle; }
.aci-nota { margin-top: 10px; font-size: 0.75rem; color: var(--text-muted); font-style: italic; }

.cilindro-controls { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.cilindro-table-wrapper { overflow-x: auto; margin-bottom: 12px; }
.cilindro-table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; min-width: 600px; }
.cilindro-table th { background: var(--bg); font-family: var(--font-heading); font-weight: 600; color: var(--text-secondary); text-align: left; padding: 10px 8px; font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 2px solid var(--border); }
.cilindro-table td { padding: 4px 8px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
.cil-input { height: 34px; font-size: 0.8125rem; padding: 0 8px; width: 80px; }
.cil-area, .cil-fc { font-family: var(--font-heading); font-weight: 600; font-size: 0.875rem; color: var(--primary); }
.cil-del { background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 4px 8px; border-radius: var(--radius-sm); transition: all 0.2s; font-size: 0.875rem; }
.cil-del:hover { background: var(--error-bg); color: var(--error); }
.cilindro-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.cil-stat { padding: 14px; background: var(--bg); border-radius: var(--radius-md); }
.cil-stat-label { display: block; font-size: 0.75rem; color: var(--text-muted); margin-bottom: 2px; }
.cil-stat-value { font-family: var(--font-heading); font-size: 1.125rem; font-weight: 700; color: var(--primary); }
.madurez-canvas-wrapper { border-radius: var(--radius-md); overflow: hidden; background: var(--white); border: 1px solid var(--border); line-height: 0; }
.madurez-canvas-wrapper canvas { display: block; width: 100%; height: auto; }
.madurez-title { font-size: 0.8125rem; font-weight: 600; padding: 12px 16px 0; color: var(--text-secondary); line-height: 1.4; }

/* ============================================================
   ACERO MODULE
   ============================================================ */
.modulo-acero { max-width: 900px; animation: fade-in 0.3s ease; }

.acero-tabla-wrapper { overflow-x: auto; }
.acero-tabla { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
.acero-tabla th { background: var(--bg); font-family: var(--font-heading); font-weight: 600; color: var(--text-secondary); text-align: left; padding: 10px 12px; font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 2px solid var(--border); }
.acero-tabla td { padding: 8px 12px; border-bottom: 1px solid var(--border-light); color: var(--text-secondary); }
.acero-tabla tbody tr:hover td { background: var(--bg); }
.acero-tabla td strong { color: var(--text); }
.acero-nota { margin-top: 8px; font-size: 0.75rem; color: var(--text-muted); font-style: italic; }

.acero-calc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.acero-calc-field label { display: block; font-size: 0.75rem; font-weight: 500; color: var(--text-secondary); margin-bottom: 4px; }
.acero-calc-field .input-with-unit .form-input { height: 42px; font-size: 1rem; }
.acero-calc-field select.form-input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 5L6 8L9 5' stroke='%2394A3B8' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

.acero-resultados { padding: 16px; background: var(--bg); border-radius: var(--radius-md); border: 1px solid var(--border); margin-bottom: 12px; }
.acero-r-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.acero-r-item { display: flex; flex-direction: column; }
.acero-r-label { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 2px; }
.acero-r-value { font-family: var(--font-heading); font-size: 1.125rem; font-weight: 700; color: var(--primary); }

.acero-ec-wrap { border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--border); }
.acero-ec-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; cursor: pointer; font-size: 0.8125rem; font-weight: 500; color: var(--text-secondary); user-select: none; }
.acero-ec-header:hover { background: var(--bg); }
.acero-ec-content { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; padding: 0 14px; }
.acero-ec-wrap.open .acero-ec-content { max-height: 200px; padding: 0 14px 12px; }
.acero-ec-content p { font-size: 0.8125rem; color: var(--text-secondary); margin-bottom: 4px; }

.losa-result { padding: 8px 0; display: flex; align-items: baseline; gap: 6px; }

/* ============================================================
   PRINT / PDF
   ============================================================ */
.print-btn,
.btn-pdf {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--white); border: 1.5px solid var(--border);
    border-radius: var(--radius-md); padding: 8px 14px; cursor: pointer;
    font-family: var(--font-heading); font-size: 0.75rem; font-weight: 600;
    color: var(--text-secondary); transition: all 0.2s;
}
.print-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-50); }
.btn-pdf {
    border-color: #DC2626;
    color: #DC2626;
    background: #FEF2F2;
}
.btn-pdf:hover {
    background: #DC2626;
    color: #FFFFFF;
    border-color: #DC2626;
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

@media print {
    body { background: white !important; }
    .sidebar, .topbar, .sidebar-overlay, .logout-btn, .print-btn { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .content-area { padding: 0.3in !important; }
    .modulo-section, .conversor-card { break-inside: avoid; page-break-inside: avoid; border: 1px solid #ddd !important; }
    .section-content.open { max-height: none !important; overflow: visible !important; }
    .section-arrow { display: none !important; }
    .section-header { cursor: default !important; }
    .section-header:hover { background: transparent !important; }
    canvas { max-width: 100% !important; }
    @page { margin: 0.3in; }
}

/* ============================================================
   HERRAMIENTAS MODULE
   ============================================================ */
.modulo-herramientas { max-width: 900px; animation: fade-in 0.3s ease; }

.herra-grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.herra-field label { display: block; font-size: 0.75rem; font-weight: 500; color: var(--text-secondary); margin-bottom: 4px; }
.herra-field .input-with-unit .form-input { height: 42px; font-size: 1rem; }
.herra-field select.form-input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 5L6 8L9 5' stroke='%2394A3B8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

.herra-resultados { padding: 16px; background: var(--bg); border-radius: var(--radius-md); border: 1px solid var(--border); margin-bottom: 12px; }
.herra-titulo { font-family: var(--font-heading); font-size: 0.75rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 12px; }
.herra-r-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.herra-r-item { display: flex; flex-direction: column; }
.herra-r-label { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 2px; }
.herra-r-value { font-family: var(--font-heading); font-size: 1rem; font-weight: 700; color: var(--text); }
.herra-r-value sub { font-size: 0.7em; }

.herra-sugerencia { display: flex; align-items: center; gap: 8px; padding: 12px 16px; background: var(--primary-50); border: 1px solid rgba(30,64,175,0.1); border-radius: var(--radius-md); color: var(--primary); font-size: 0.8125rem; font-weight: 500; }

/* ============================================================
   AJAX LOADER
   ============================================================ */
.ajax-loader {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(248, 250, 252, 0.7);
    backdrop-filter: blur(4px);
    z-index: 9999;
    opacity: 0; pointer-events: none;
    transition: opacity 0.2s ease;
}
.ajax-loader.active {
    opacity: 1; pointer-events: all;
}
.ajax-spinner {
    width: 24px; height: 24px;
    border: 2.5px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: ajax-spin 0.6s linear infinite;
}
.ajax-loader span {
    font-family: var(--font-heading);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
}
@keyframes ajax-spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 768px) {
    .herra-grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
    .herra-grid-3 { grid-template-columns: 1fr; }
}

/* ============================================================
   PROYECTOS MODULE (CRUD)
   ============================================================ */
.modulo-proyectos { max-width: 960px; animation: fade-in 0.3s ease; }

.proyecto-toast {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 16px; border-radius: var(--radius-md);
    margin-bottom: 16px; font-size: 0.8125rem; font-weight: 500;
    animation: fade-in 0.3s ease;
}

.proyecto-form { padding: 0; }
.proyecto-grid-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.proyecto-grid-form .proyecto-field:last-child {
    grid-column: 1 / -1;
}

.proyecto-field label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.proyecto-field .input-with-unit .form-input {
    height: 44px;
    font-size: 0.9375rem;
}

.proyecto-field .btn {
    height: 44px;
}

/* ── Tabla de proyectos ── */
.proyecto-tabla-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}
.proyecto-tabla {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}
.proyecto-tabla th {
    background: var(--bg);
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--text-secondary);
    text-align: left;
    padding: 10px 12px;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
}
.proyecto-tabla td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
    vertical-align: middle;
}
.proyecto-tabla tbody tr:hover td {
    background: var(--bg);
}
.proyecto-tabla tbody tr:last-child td {
    border-bottom: none;
}
.proyecto-id {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.proyecto-badge-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 24px;
    padding: 0 8px;
    border-radius: var(--radius-full);
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 700;
}

.proyecto-acciones {
    display: inline-flex;
    gap: 4px;
}
.proyecto-btn-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}
.proyecto-btn-sm:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-50);
}
.proyecto-btn-sm:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.proyecto-btn-sm:disabled:hover {
    border-color: var(--border);
    color: var(--text-secondary);
    background: var(--surface);
}

.proyecto-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

@media (max-width: 768px) {
    .proyecto-grid-form,
    .modulo-proyectos form div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
}

/* ============================================================
   NORMAS MODULE (submódulos + upload)
   ============================================================ */
.modulo-normas,
.modulo-normas-sub { max-width: 960px; animation: fade-in 0.3s ease; }

.normas-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }

.back-link {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: var(--radius-sm);
    color: var(--text-secondary); transition: all 0.2s; flex-shrink: 0;
}
.back-link:hover { background: var(--bg); color: var(--primary); }

/* Upload form */
.upload-form { margin-top: 0; }
.upload-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.upload-field label { display: block; font-size: 0.75rem; font-weight: 500; color: var(--text-secondary); margin-bottom: 4px; }
.upload-field .form-input { height: 42px; font-size: 0.875rem; }

.upload-file-wrapper { position: relative; }
.upload-file-input {
    position: absolute; width: 1px; height: 1px; opacity: 0;
    overflow: hidden; pointer-events: none;
}
.upload-file-label {
    display: flex; align-items: center; gap: 8px;
    height: 42px; padding: 0 14px;
    background: var(--bg); border: 1.5px dashed var(--border);
    border-radius: var(--radius-md); color: var(--text-muted);
    font-size: 0.8125rem; cursor: pointer;
    transition: all 0.2s ease;
}
.upload-file-label:hover {
    border-color: var(--primary); color: var(--primary); background: var(--primary-50);
}

.upload-msg {
    margin-top: 10px; padding: 8px 12px;
    border-radius: var(--radius-sm); font-size: 0.8125rem;
    font-weight: 500; display: none;
}
.upload-msg-success { display: block; background: var(--success-bg); color: var(--success); border: 1px solid rgba(22,163,74,0.15); }
.upload-msg-error { display: block; background: var(--error-bg); color: var(--error); border: 1px solid rgba(220,38,38,0.15); }

/* Normas table */
.norma-tabla-wrapper { overflow-x: auto; }
.norma-tabla { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
.norma-tabla th { background: var(--bg); font-family: var(--font-heading); font-weight: 600; color: var(--text-secondary); text-align: left; padding: 10px 12px; font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 2px solid var(--border); }
.norma-tabla td { padding: 8px 12px; border-bottom: 1px solid var(--border-light); color: var(--text-secondary); }
.norma-tabla tbody tr:hover td { background: var(--bg); }
.norma-tabla td strong { color: var(--text); font-family: var(--font-heading); }

/* Archivos list */
.norma-archivos-list { display: flex; flex-direction: column; gap: 8px; }
.norma-archivo-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px;
    background: var(--bg); border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    transition: all 0.2s;
}
.norma-archivo-item:hover { border-color: var(--border); background: var(--surface); }
.norma-archivo-icon { flex-shrink: 0; line-height: 0; }
.norma-archivo-info {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; gap: 1px;
}
.norma-archivo-info strong { font-family: var(--font-heading); font-size: 0.8125rem; color: var(--text); }
.norma-archivo-info span { font-size: 0.8125rem; color: var(--text-secondary); }
.norma-archivo-info small { font-size: 0.75rem; color: var(--text-muted); }

/* Search + category badge + delete btn */
.norma-search-wrapper { position:relative; margin-bottom:14px; }
.norma-search-icon { position:absolute; left:14px; top:50%; transform:translateY(-50%); color:var(--text-muted); pointer-events:none; }
.norma-search-input { height:42px; padding-left:40px; font-size:0.875rem; }

.norma-cat-badge {
    display:inline-block; padding:2px 8px; border-radius:var(--radius-full);
    background:var(--primary-50); color:var(--primary);
    font-size:0.6875rem; font-weight:600; letter-spacing:0.3px;
}

.norma-del-btn {
    display:inline-flex; align-items:center; justify-content:center;
    width:32px; height:32px; border-radius:var(--radius-sm);
    border:1px solid var(--border); background:var(--surface);
    color:var(--text-muted); cursor:pointer;
    transition:all 0.2s; flex-shrink:0;
}
.norma-del-btn:hover { border-color:var(--error); color:var(--error); background:var(--error-bg); }
.norma-del-btn:disabled { opacity:0.4; cursor:not-allowed; }

.categoria-desc {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
    min-height: 1.1em;
    margin-top: 4px;
    padding-left: 2px;
    font-style: italic;
    transition: opacity 0.15s ease;
}

.norma-count-badge {
    display:inline-block; padding:2px 8px; border-radius:var(--radius-full);
    background:var(--bg-alt); color:var(--text-muted);
    font-family:var(--font-heading); font-size:0.6875rem; font-weight:600;
    vertical-align:middle; margin-left:6px;
}

@media (max-width: 768px) {
    .upload-grid { grid-template-columns: 1fr; }
    .normas-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   PDF INLINE VIEWER MODAL (PDF.js)
   ============================================================ */
.pdf-modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fade-in 0.2s ease;
}
.pdf-modal-overlay.active {
    display: flex;
}
.pdf-modal-container {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
    width: 100%;
    max-width: 1100px;
    height: 90vh;
    max-height: 800px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modal-in 0.25s ease;
}
@keyframes modal-in {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.pdf-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    flex-shrink: 0;
}
.pdf-modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-heading);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    min-width: 0;
    flex: 1;
}
.pdf-modal-title svg {
    color: #DC2626;
    flex-shrink: 0;
}
.pdf-modal-title span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pdf-modal-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.pdf-modal-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 30px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    font-family: var(--font-heading);
    font-size: 0.6875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}
.pdf-modal-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-50);
}
.pdf-modal-btn.pdf-modal-close {
    border: none;
    background: transparent;
    color: var(--text-muted);
    padding: 0 6px;
    width: 30px;
    justify-content: center;
}
.pdf-modal-btn.pdf-modal-close:hover {
    color: var(--error);
    background: var(--error-bg);
}

.pdf-doc-counter {
    font-family: var(--font-heading);
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 0 2px;
    min-width: 30px;
    text-align: center;
}

.pdf-separator {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 4px;
}

.pdf-toolbar {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 6px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-alt);
    flex-shrink: 0;
    gap: 12px;
}
.pdf-toolbar-left,
.pdf-toolbar-right {
    display: flex;
    align-items: center;
    gap: 6px;
}
.pdf-toolbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}
.pdf-toolbar-btn:hover {
    border-color: var(--border);
    background: var(--surface);
    color: var(--text);
}
.pdf-toolbar-btn:active {
    background: var(--bg);
}
.pdf-page-info {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}
.pdf-page-input {
    width: 38px;
    height: 24px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 600;
    outline: none;
    padding: 0;
    -moz-appearance: textfield;
}
.pdf-page-input::-webkit-inner-spin-button,
.pdf-page-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.pdf-page-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(30, 64, 175, 0.1);
}
.pdf-zoom-level {
    font-family: var(--font-heading);
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 36px;
    text-align: center;
}

.pdf-body-wrapper {
    flex: 1;
    display: flex;
    min-height: 0;
    position: relative;
}

.pdf-thumb-panel {
    width: 0;
    overflow: hidden;
    background: var(--bg-alt);
    border-right: 1px solid var(--border);
    transition: width 0.25s ease;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}
.pdf-thumb-panel.open {
    width: 160px;
}
.pdf-thumb-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.pdf-thumb-title {
    font-family: var(--font-heading);
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.pdf-thumb-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}
.pdf-thumb-close:hover {
    background: var(--bg);
    color: var(--text);
}
.pdf-thumb-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.pdf-thumb-loading {
    display: flex;
    justify-content: center;
    padding: 20px;
}
.pdf-thumb-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    cursor: pointer;
}
.pdf-thumb-item {
    width: 100%;
    height: auto;
    border: 2px solid transparent;
    border-radius: 4px;
    transition: border-color 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    background: white;
}
.pdf-thumb-item:hover {
    border-color: var(--primary-light);
}
.pdf-thumb-item.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(30,64,175,0.2);
}
.pdf-thumb-label {
    font-size: 0.625rem;
    color: var(--text-muted);
    font-family: var(--font-heading);
    font-weight: 600;
}

.pdf-modal-body {
    flex: 1;
    position: relative;
    background: #525659;
    min-height: 0;
    overflow: auto;
    display: flex;
    justify-content: center;
    padding: 20px;
}
.pdf-canvas {
    display: none;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    background: white;
    max-width: 100%;
}
.pdf-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: rgba(255, 255, 255, 0.7);
    font-family: var(--font-heading);
    font-size: 0.8125rem;
}
.pdf-loader .ajax-spinner {
    border-color: rgba(255, 255, 255, 0.2);
    border-top-color: white;
    width: 32px;
    height: 32px;
    border-width: 3px;
}
.pdf-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.6);
}
.pdf-error svg { color: #EF4444; }

/* Search overlay */
.pdf-search-overlay {
    position: absolute;
    top: 0;
    right: 0;
    width: 0;
    height: 100%;
    background: var(--surface);
    border-left: 1px solid var(--border);
    overflow: hidden;
    transition: width 0.25s ease;
    display: flex;
    flex-direction: column;
    z-index: 10;
}
.pdf-search-overlay.open {
    width: 300px;
}
.pdf-search-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    flex-shrink: 0;
}
.pdf-search-icon {
    color: var(--text-muted);
    flex-shrink: 0;
}
.pdf-search-input {
    flex: 1;
    height: 28px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.75rem;
    padding: 0 8px;
    outline: none;
    min-width: 0;
}
.pdf-search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(30,64,175,0.1);
}
.pdf-search-count {
    font-family: var(--font-heading);
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}
.pdf-search-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.15s;
    flex-shrink: 0;
}
.pdf-search-btn:hover {
    background: var(--bg);
    color: var(--text);
}
.pdf-search-btn.pdf-search-close {
    color: var(--text-muted);
}
.pdf-search-btn.pdf-search-close:hover {
    color: var(--error);
    background: var(--error-bg);
}
.pdf-search-results {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}
.pdf-search-result {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px 10px;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: all 0.15s;
}
.pdf-search-result:hover {
    background: var(--bg);
}
.pdf-search-result.active {
    background: var(--primary-50);
    border-left-color: var(--primary);
}
.pdf-search-result-page {
    font-family: var(--font-heading);
    font-size: 0.625rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
}
.pdf-search-result-text {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-all;
}
.pdf-search-result-text mark {
    background: #FDE68A;
    color: #92400E;
    padding: 0 1px;
    border-radius: 2px;
}
.pdf-search-empty {
    padding: 20px 10px;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.pdf-search-more {
    padding: 6px 10px;
    text-align: center;
    font-size: 0.6875rem;
    color: var(--text-muted);
}

@media (max-width: 768px) {
    .pdf-thumb-panel.open { width: 120px; }
    .pdf-search-overlay.open { width: 240px; }
    .pdf-modal-body { padding: 10px; }
}

/* ============================================================
   CONFIRM DELETE MODAL + TOAST
   ============================================================ */
.confirm-modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.confirm-modal-overlay.active {
    display: flex;
    opacity: 1;
}
.confirm-modal-overlay.closing {
    opacity: 0;
}
.confirm-modal-container {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 460px;
    padding: 32px 28px 24px;
    animation: modal-in 0.25s ease;
    text-align: center;
}
.confirm-modal-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #FEF2F2;
    color: #DC2626;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}
.confirm-modal-title {
    font-family: var(--font-heading);
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}
.confirm-modal-message {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 16px;
}
.confirm-modal-details {
    text-align: left;
    margin-bottom: 24px;
}
.confirm-modal-details ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.confirm-modal-details li {
    position: relative;
    padding: 6px 0 6px 24px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.4;
}
.confirm-modal-details li::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 13px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    opacity: 0.4;
}
.confirm-modal-details .confirm-modal-irreversible {
    color: var(--error);
    font-weight: 600;
    margin-top: 4px;
}
.confirm-modal-details .confirm-modal-irreversible::before {
    background: var(--error);
    opacity: 0.6;
}
.confirm-modal-actions {
    display: flex;
    gap: 10px;
}
.confirm-modal-actions .btn {
    height: 42px;
    font-size: 0.875rem;
}
.confirm-modal-actions .btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Toast notification */
@keyframes toast-in {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 480px) {
    .confirm-modal-container { padding: 24px 20px; margin: 10px; }
    .confirm-modal-icon { width: 48px; height: 48px; }
    .confirm-modal-title { font-size: 1rem; }
}

@media (max-width: 768px) {
    .pdf-modal-overlay { padding: 8px; }
    .pdf-modal-container {
        height: 96vh;
        max-height: none;
        border-radius: var(--radius-md);
    }
    .pdf-modal-header {
        flex-wrap: wrap;
        gap: 6px;
        padding: 8px 10px;
    }
    .pdf-modal-title { font-size: 0.75rem; max-width: 120px; }
    .pdf-modal-actions { gap: 3px; }
    .pdf-modal-btn { height: 28px; padding: 0 6px; font-size: 0.625rem; }
    .pdf-modal-btn svg { width: 12px; height: 12px; }
    .pdf-toolbar {
        flex-wrap: wrap;
        padding: 4px 10px;
        gap: 6px;
    }
    .pdf-modal-body { padding: 10px; }
    .pdf-doc-counter { font-size: 0.625rem; min-width: 24px; }
    .pdf-page-input { width: 32px; height: 22px; font-size: 0.6875rem; }
}

/* ============================================================
   ANIMATIONS & REDUCED MOTION
   ============================================================ */
@keyframes fade-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .content-area { padding: 20px; }
    .topbar { padding: 0 20px; }
}

/* ============================================================
   MOBILE SIDEBAR — UI ENHANCEMENTS
   ============================================================ */
@media (max-width: 768px) {
    .sidebar {
        box-shadow: -8px 0 30px rgba(15,23,42,0.1);
        background: rgba(255,255,255,0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
        overflow: hidden;
    }
    .sidebar::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background:
            radial-gradient(ellipse 80% 60% at 50% -10%, rgba(30,64,175,0.04) 0%, transparent 100%),
            radial-gradient(ellipse 60% 40% at 10% 85%, rgba(234,88,12,0.03) 0%, transparent 100%),
            radial-gradient(ellipse 50% 30% at 90% 90%, rgba(30,64,175,0.03) 0%, transparent 100%);
        pointer-events: none;
        z-index: -1;
    }
    .sidebar::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-image:
            repeating-linear-gradient(
                0deg,
                transparent,
                transparent 24px,
                rgba(30,64,175,0.015) 24px,
                rgba(30,64,175,0.015) 25px
            ),
            repeating-linear-gradient(
                90deg,
                transparent,
                transparent 24px,
                rgba(30,64,175,0.015) 24px,
                rgba(30,64,175,0.015) 25px
            );
        pointer-events: none;
        z-index: -1;
    }
    
    .sidebar-overlay {
        background: linear-gradient(135deg, rgba(15,23,42,0.6), rgba(15,23,42,0.4));
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }

    .sidebar-header {
        padding: 16px 20px;
        background: linear-gradient(135deg, var(--primary-50), #FFFFFF);
        border-bottom: 1px solid rgba(226,232,240,0.6);
    }

    .sidebar-close {
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: var(--radius-full);
        background: rgba(255,255,255,0.75);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border: 1px solid rgba(226,232,240,0.8);
        color: var(--text-secondary);
        box-shadow: 0 2px 8px rgba(15,23,42,0.06);
        transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
        cursor: pointer;
        position: relative;
    }
    .sidebar-close:hover {
        background: var(--error-bg);
        border-color: rgba(220,38,38,0.25);
        color: var(--error);
        transform: rotate(90deg) scale(1.05);
        box-shadow: 0 4px 16px rgba(220,38,38,0.15);
    }
    .sidebar-close:active {
        transform: rotate(90deg) scale(0.92);
    }
    .sidebar-close .sidebar-close-icon {
        font-size: 20px;
        font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 20;
        transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    }
    .sidebar-close:hover .sidebar-close-icon {
        transform: scale(0.82);
    }

    .sidebar-nav {
        padding: 8px 8px;
    }
    .sidebar-nav .nav-section-label {
        padding: 10px 16px 6px;
        font-size: 0.65rem;
        letter-spacing: 1.2px;
        color: var(--text-muted);
    }
    .sidebar-nav .nav-item {
        padding: 12px 14px;
        margin: 1px 0;
        border-radius: 12px;
        font-size: 0.85rem;
        transition: all 0.2s cubic-bezier(0.22, 1, 0.36, 1);
    }
    .sidebar-nav .nav-item:active {
        transform: scale(0.97);
    }
    .sidebar-nav .nav-item.active {
        background: linear-gradient(135deg, var(--primary-50), rgba(30,64,175,0.04));
        border: 1px solid rgba(30,64,175,0.12);
        box-shadow: 0 2px 8px rgba(30,64,175,0.08);
    }
    .sidebar-nav .nav-item.active svg {
        color: var(--primary);
        filter: drop-shadow(0 1px 2px rgba(30,64,175,0.2));
    }

    .sidebar-footer {
        padding: 12px 16px 16px;
        background: linear-gradient(0deg, var(--bg) 0%, transparent 100%);
        border-top: 1px solid rgba(226,232,240,0.6);
    }
    .sidebar-footer .user-avatar {
        width: 38px;
        height: 38px;
        font-size: 0.875rem;
        border: 2px solid rgba(30,64,175,0.15);
    }
    .sidebar-footer .user-name {
        font-size: 0.8125rem;
    }

    .topbar-toggle {
        padding: 8px;
        border-radius: var(--radius-md);
        border: 1px solid transparent;
        transition: all 0.25s ease;
        color: var(--text-secondary);
        background: transparent;
    }
    .topbar-toggle:active {
        transform: scale(0.92);
        background: var(--bg);
    }
    .topbar-toggle svg,
    .topbar-toggle .hamburger-box {
        transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    }
    .sidebar.open ~ .main-content .topbar .topbar-toggle {
        color: var(--primary);
    }
    .sidebar.open ~ .main-content .topbar .topbar-toggle .hamburger-line-1 {
        transform: translateY(7px) rotate(45deg);
    }
    .sidebar.open ~ .main-content .topbar .topbar-toggle .hamburger-line-2 {
        opacity: 0;
        transform: scaleX(0);
    }
    .sidebar.open ~ .main-content .topbar .topbar-toggle .hamburger-line-3 {
        transform: translateY(-7px) rotate(-45deg);
    }

    .sidebar-brand-text strong { font-size: 1.05rem; }
    .sidebar-brand-text span { font-size: 0.7rem; }
    .sidebar-logo svg { width: 34px; height: 34px; }

    .nav-badge {
        font-size: 0.55rem;
        padding: 0.2rem 0.5rem;
        border-radius: 6px;
    }
}

@media (max-width: 768px) {
    .sidebar { left: auto !important; right: 0 !important; transform: translateX(100%); border-right: none; border-left: 1px solid var(--border); }
    .sidebar.open { transform: translateX(0) !important; }
    .sidebar-close { display: flex; }
    .sidebar-overlay { display: block; pointer-events: none; }
    .sidebar-overlay.active { display: block; pointer-events: auto; }
    .main-content { margin-left: 0; }
    .topbar-toggle { display: flex; }
    .topbar-mobile-left { display: flex; align-items: center; gap: 10px; }
    .topbar-mobile-brand { display: flex; align-items: center; gap: 6px; color: var(--primary); font-family: var(--font-heading); font-size: 0.875rem; font-weight: 700; }
    .topbar-mobile-brand svg { flex-shrink: 0; }
    .topbar-mobile-brand span { white-space: nowrap; }
    .topbar-dark-btn {
        display: inline-flex; align-items: center; justify-content: center;
        width: 32px; height: 32px; border-radius: var(--radius-full);
        border: 1px solid var(--border); background: var(--surface);
        color: var(--text-secondary); cursor: pointer;
        transition: all 0.2s ease; flex-shrink: 0;
    }
    .topbar-dark-btn:hover { background: var(--bg); color: var(--accent); border-color: var(--accent); }
    .topbar-dark-btn:active { transform: scale(0.92); }
    .topbar-dark-btn svg { width: 16px; height: 16px; }
    .topbar-mobile-avatar {
        width: 32px; height: 32px; border-radius: var(--radius-full);
        background: linear-gradient(135deg, var(--primary), var(--primary-dark));
        color: var(--text-inverse); display: flex; align-items: center; justify-content: center;
        font-family: var(--font-heading); font-size: 0.75rem; font-weight: 700;
        border: 2px solid var(--surface); box-shadow: var(--shadow-sm); flex-shrink: 0;
    }
    .topbar-left .topbar-title { display: none; }
    .topbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
    .content-area { padding: 16px; }
    .topbar { padding: 0 16px; height: 56px; }
    .topbar-title { min-width: 0; overflow: hidden; }
    .topbar-title h1 { font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .topbar-left { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
    .topbar-date { display: none; }
    .welcome-banner { flex-direction: column; align-items: flex-start; gap: 16px; padding: 20px; }
    .welcome-illustration { display: none; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .modules-grid { grid-template-columns: 1fr; }
    .resultados-dual { grid-template-columns: 1fr; }
    .result-value { font-size: 1.5rem; }
    .resultados-dual .result-value { font-size: 1.25rem; }
    .input-with-unit .form-input { height: 46px; font-size: 1.125rem; }
    .login-container { flex-direction: column; max-width: 400px; min-height: auto; }
    .login-brand { display: flex !important; width: 100%; padding: 28px 24px; min-height: 180px; }
    .login-form-panel { padding: 28px 20px; }
    .brand-icon svg { width: 40px; height: 40px; }
    .brand-title { font-size: 1.5rem; }
    .brand-desc { display: none; }

    .sucs-grid, .aashto-grid, .aci-grid, .atterberg-grid { grid-template-columns: 1fr 1fr; }
    .plasticidad-chart { flex-direction: column; }
    .plasticidad-canvas-wrapper { width: 100%; }
    .plasticidad-canvas-wrapper canvas { width: 100%; height: auto; }
    .sucs-resultado { flex-direction: column; text-align: center; }
    .proctor-table .form-input { width: 70px; }
}

@media (max-width: 480px) {
    .sucs-grid, .aashto-grid, .aci-grid, .atterberg-grid { grid-template-columns: 1fr; }
}

@media (min-width: 769px) {
    .login-brand { display: flex; }
    .login-form-panel { width: 55%; }
    .topbar-mobile-left { display: none !important; }
}

@media (min-width: 1200px) {
    .conversor-grid { grid-template-columns: 1fr 1fr; }
}
/* ============================================================
   PROFILE MODAL — Rediseño profesional
   ============================================================ */
.profile-modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fade-in 0.2s ease;
}
.profile-modal-overlay.active {
    display: flex;
}
.profile-modal-container {
    background: var(--surface);
    border-radius: 12px;
    box-shadow: 0 15px 30px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 420px;
    overflow: hidden;
    animation: modal-in 0.25s ease;
    position: relative;
}

.profile-modal-x {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.profile-modal-x:hover {
    background: rgba(255,255,255,0.35);
    transform: scale(1.1);
}

/* ── Hero: dark band with avatar ── */
.profile-hero {
    background: #2D3748;
    padding: 40px 24px 24px;
    text-align: center;
    position: relative;
}
.profile-avatar-wrapper {
    margin-bottom: 16px;
}
.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #ffffff;
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
    display: block;
    margin: 0 auto;
}
.profile-avatar-fallback {
    display: none;
    align-items: center;
    justify-content: center;
    background: #4A5568;
    font-size: 2.5rem;
    font-weight: 700;
    color: #fff;
    font-family: var(--font-heading);
}
.profile-name {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 4px 0;
    line-height: 1.2;
}
.profile-role {
    font-size: 0.8125rem;
    color: #A0AEC0;
    margin: 0 0 20px 0;
}
.profile-btn-change {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: #3182CE;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-family: var(--font-heading);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}
.profile-btn-change:hover {
    background: #2B6CB0;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(49,130,206,0.3);
}
.profile-btn-change:active {
    transform: translateY(0);
}
.profile-btn-change svg {
    flex-shrink: 0;
}

/* ── Body: settings section ── */
.profile-body {
    padding: 24px;
}
.profile-name-section {
    margin-bottom: 16px;
}
.profile-name-label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
#profileNameText {
    font-family: var(--font-heading);
    font-size: 1.125rem;
    font-weight: 700;
    color: #1A202C;
    margin: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s;
}
#profileNameText:hover {
    color: var(--primary);
}
.profile-edit-icon {
    opacity: 0.3;
    transition: opacity 0.2s;
}
#profileNameText:hover .profile-edit-icon {
    opacity: 0.7;
}
.profile-edit-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.profile-edit-row .form-input {
    height: 40px;
    font-size: 0.9375rem;
    text-align: center;
    max-width: 240px;
}
#profileNameSaveBtn {
    height: 40px;
    background: var(--primary);
    color: white;
    padding: 0 16px;
    border-radius: var(--radius-md);
    font-weight: 500;
}
#profileNameSaveBtn:hover {
    background: var(--primary-dark);
}
.btn-cancel {
    height: 40px;
    background: transparent;
    border: 1px solid var(--border);
    padding: 0 12px;
    border-radius: var(--radius-md);
}
.btn-cancel:hover {
    border-color: var(--text-muted);
    background: var(--bg);
}
.profile-name-status {
    font-size: 0.75rem;
    margin-top: 4px;
    min-height: 1.2em;
    text-align: center;
}

.profile-divider {
    height: 1px;
    background: var(--border);
    margin-bottom: 20px;
}

.profile-upload-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}
.profile-upload-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0 0 12px 0;
}
.profile-upload-status {
    font-size: 0.8rem;
    color: var(--text-muted);
    min-height: 1.2em;
    margin-bottom: 8px;
}
.profile-btn-save {
    display: none;
    background: var(--primary);
    color: white;
    padding: 10px 24px;
    border-radius: var(--radius-md);
    font-weight: 500;
}
.profile-btn-save:hover {
    background: var(--primary-dark);
}

/* ============================================================
   DARK MODE
   ============================================================ */
body.dark-mode {
    --bg: #0F172A;
    --bg-alt: #1E293B;
    --surface: #1E293B;
    --border: #334155;
    --border-light: #1E293B;
    --text: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --text-inverse: #0F172A;
    --primary-50: rgba(30, 64, 175, 0.15);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
}
body.dark-mode .topbar { background: rgba(30, 41, 59, 0.9); border-bottom-color: var(--border); }
body.dark-mode .sidebar { background: var(--surface); }
body.dark-mode .sidebar-header { background: linear-gradient(135deg, rgba(30, 64, 175, 0.2), var(--surface)); }
body.dark-mode .login-container { background: var(--surface); }
body.dark-mode .modulo-section { background: var(--surface); border-color: var(--border); }
body.dark-mode .stat-card { background: var(--surface); border-color: var(--border); }
body.dark-mode .module-card { background: var(--surface); border-color: var(--border); }
body.dark-mode .conversor-card { background: var(--surface); border-color: var(--border); }
body.dark-mode .form-input { background: var(--bg); border-color: var(--border); color: var(--text); }
body.dark-mode .form-input:focus { background: var(--surface); }


body.dark-mode .ref-table th, body.dark-mode .ref-table td,
body.dark-mode .proctor-table th, body.dark-mode .proctor-table td,
body.dark-mode .aci-tabla th, body.dark-mode .aci-tabla td,
body.dark-mode .acero-tabla th, body.dark-mode .acero-tabla td,
body.dark-mode .proyecto-tabla th, body.dark-mode .proyecto-tabla td,
body.dark-mode .norma-tabla th, body.dark-mode .norma-tabla td,
body.dark-mode .cilindro-table th, body.dark-mode .cilindro-table td {
    background: var(--bg-alt); border-color: var(--border); color: var(--text-secondary);
}
body.dark-mode .ref-table tr:hover td,
body.dark-mode .proctor-table tr:hover td,
body.dark-mode .acero-tabla tbody tr:hover td,
body.dark-mode .proyecto-tabla tbody tr:hover td,
body.dark-mode .norma-tabla tbody tr:hover td { background: var(--surface); }
body.dark-mode .pdf-modal-header { background: var(--surface); border-color: var(--border); }
body.dark-mode .pdf-modal-title { color: var(--text); }
body.dark-mode .pdf-toolbar { background: var(--bg-alt); border-color: var(--border); }
body.dark-mode .pdf-modal-body { background: #1a1a2e; }
body.dark-mode .pdf-thumb-panel { background: var(--bg-alt); border-color: var(--border); }
body.dark-mode .pdf-search-overlay { background: var(--surface); border-color: var(--border); }
body.dark-mode .pdf-search-bar { background: var(--bg-alt); border-color: var(--border); }
body.dark-mode .pdf-search-result:hover { background: var(--bg-alt); }
body.dark-mode .pdf-search-result.active { background: rgba(30, 64, 175, 0.15); }
body.dark-mode .pdf-thumb-item { background: #2a2a2a; }
body.dark-mode .confirm-modal-container { background: var(--surface); }
body.dark-mode .confirm-modal-icon { background: rgba(220, 38, 38, 0.15); }
body.dark-mode .confirm-modal-title { color: var(--text); }
body.dark-mode .confirm-modal-message { color: var(--text-secondary); }
body.dark-mode .confirm-modal-details li { color: var(--text-secondary); }
body.dark-mode .upload-zone { background: linear-gradient(135deg, var(--bg) 0%, var(--bg-alt) 100%); border-color: var(--border); }
body.dark-mode .section-header:hover { background: var(--bg-alt); }
body.dark-mode .section-number { color: var(--text-muted); }
body.dark-mode .plasticidad-canvas-wrapper,
body.dark-mode .proctor-canvas-wrapper,
body.dark-mode .madurez-canvas-wrapper { background: var(--surface); border-color: var(--border); }

/* ============================================================
   DARK MODE - PROFILE MODAL
   ============================================================ */
body.dark-mode .profile-modal-overlay {
    background: rgba(5, 10, 20, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
body.dark-mode .profile-modal-container {
    background: var(--surface);
    box-shadow: 0 15px 30px rgba(0,0,0,0.3);
}
body.dark-mode .profile-modal-x {
    background: rgba(0,0,0,0.3);
    border-color: rgba(255,255,255,0.15);
}
body.dark-mode .profile-hero {
    background: #1a2332;
}
body.dark-mode .profile-avatar {
    border-color: var(--border);
}
body.dark-mode .profile-avatar-fallback {
    background: var(--bg-alt);
    color: var(--text-secondary);
}
body.dark-mode .profile-name {
    color: var(--text);
}
body.dark-mode .profile-role {
    color: var(--text-muted);
}
body.dark-mode .profile-btn-change {
    background: rgba(49, 130, 206, 0.6);
}
body.dark-mode .profile-btn-change:hover {
    background: rgba(49, 130, 206, 0.8);
    box-shadow: 0 4px 12px rgba(49,130,206,0.2);
}
body.dark-mode #profileNameText {
    color: var(--text);
}
body.dark-mode #profileNameInput {
    background: var(--bg);
    border-color: var(--border);
    color: var(--text);
}
body.dark-mode #profileNameInput:focus {
    border-color: var(--primary);
    background: var(--surface);
}
body.dark-mode .btn-cancel {
    border-color: var(--border);
}
body.dark-mode .btn-cancel:hover {
    border-color: var(--text-muted);
    background: var(--bg-alt);
}
body.dark-mode .profile-divider {
    background: var(--border);
}
body.dark-mode .profile-upload-label {
    color: var(--text);
}
body.dark-mode .profile-upload-hint {
    color: var(--text-muted);
}
body.dark-mode .profile-upload-status {
    color: var(--text-muted);
}

body.dark-mode select.form-input {
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 5L6 8L9 5' stroke='%2364748B' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
body.dark-mode .pdf-modal-btn { background: var(--surface); border-color: var(--border); color: var(--text-secondary); }
body.dark-mode .pdf-modal-btn:hover { border-color: var(--primary); color: var(--primary); background: rgba(30, 64, 175, 0.15); }
body.dark-mode .pdf-toolbar-btn { color: var(--text-secondary); }
body.dark-mode .pdf-toolbar-btn:hover { border-color: var(--border); background: var(--surface); color: var(--text); }
body.dark-mode .pdf-page-input { background: var(--bg); border-color: var(--border); color: var(--text); }
body.dark-mode .pdf-search-input { background: var(--bg); border-color: var(--border); color: var(--text); }
body.dark-mode .proyecto-btn-sm { background: var(--surface); border-color: var(--border); color: var(--text-secondary); }
body.dark-mode .proyecto-btn-sm:hover { border-color: var(--primary); color: var(--primary); background: rgba(30, 64, 175, 0.15); }
body.dark-mode .norma-del-btn { background: var(--surface); border-color: var(--border); }
body.dark-mode .upload-file-label { background: var(--bg); border-color: var(--border); }
body.dark-mode .upload-file-label:hover { border-color: var(--primary); color: var(--primary); background: rgba(30, 64, 175, 0.1); }
body.dark-mode .back-link:hover { background: var(--bg-alt); }
body.dark-mode .nav-item:hover { background: var(--bg-alt); }
body.dark-mode .nav-link:hover { background: var(--bg-alt); }
body.dark-mode .sidebar-close {
    background: rgba(30, 41, 59, 0.6);
    border-color: rgba(51, 65, 85, 0.6);
    color: var(--text-secondary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
body.dark-mode .sidebar-close:hover {
    background: rgba(220, 38, 38, 0.15);
    border-color: rgba(220, 38, 38, 0.3);
    color: #EF4444;
    box-shadow: 0 4px 16px rgba(220, 38, 38, 0.2);
}
body.dark-mode .sidebar-close:active {
    transform: rotate(90deg) scale(0.92);
}
body.dark-mode .sidebar-close .sidebar-close-icon {
    font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 20;
}
body.dark-mode .logout-btn:hover { background: rgba(220, 38, 38, 0.15); color: var(--error); }
body.dark-mode .btn-outline { border-color: var(--border); color: var(--text-secondary); }
body.dark-mode .btn-outline:hover { border-color: var(--text-muted); background: var(--bg-alt); }
body.dark-mode .ref-header:hover { background: var(--bg-alt); }
body.dark-mode .acero-ec-header:hover { background: var(--bg-alt); }
body.dark-mode .welcome-banner { background: linear-gradient(135deg, var(--primary-dark) 0%, #1e3a5f 100%); }
body.dark-mode .asistente-card { background: rgba(30, 64, 175, 0.1); border-color: rgba(30, 64, 175, 0.2); }
body.dark-mode .herra-sugerencia { background: rgba(30, 64, 175, 0.1); }
body.dark-mode .topbar-mobile-left .topbar-dark-btn { background: var(--bg-alt); border-color: var(--border); }
body.dark-mode .topbar-mobile-left .topbar-dark-btn:hover { border-color: var(--accent); color: var(--accent); }

body.dark-mode .sidebar-overlay { background: rgba(5, 10, 20, 0.7); backdrop-filter: blur(6px); }
body.dark-mode .confirm-modal-overlay { background: rgba(5, 10, 20, 0.75); }
body.dark-mode .pdf-modal-overlay { background: rgba(5, 10, 20, 0.7); }
body.dark-mode .ajax-loader { background: rgba(15, 23, 42, 0.85); }
body.dark-mode .ajax-loader span { color: var(--text-muted); }
body.dark-mode .ajax-spinner { border-color: rgba(255, 255, 255, 0.15); border-top-color: var(--primary-light); }
body.dark-mode .pdf-loader span { color: rgba(255, 255, 255, 0.5); }
body.dark-mode .pdf-loader .ajax-spinner { border-color: rgba(255, 255, 255, 0.15); border-top-color: white; }
body.dark-mode .app-toast { box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4); }
body.dark-mode .sidebar-footer { border-top-color: rgba(51, 65, 85, 0.6); }
body.dark-mode .sidebar-footer .user-name { color: var(--text); }
body.dark-mode .norma-archivo-item { background: var(--bg); border-color: var(--border-light); }
body.dark-mode .norma-archivo-item:hover { background: var(--surface); border-color: var(--border); }
body.dark-mode .norma-archivo-info strong { color: var(--text); }
body.dark-mode .norma-archivo-info span { color: var(--text-secondary); }
body.dark-mode .proyecto-tabla-wrapper { border-color: var(--border); }
body.dark-mode .proctor-table .form-input { background: var(--bg); border-color: var(--border); color: var(--text); }
body.dark-mode .proctor-stat { background: var(--bg-alt); }
body.dark-mode .proctor-stat-value { color: var(--text); }
body.dark-mode .cil-stat { background: var(--bg-alt); }
body.dark-mode .acero-resultados { background: var(--bg-alt); border-color: var(--border); }
body.dark-mode .aci-resultados { background: var(--bg-alt); border-color: var(--border); }
body.dark-mode .herra-resultados { background: var(--bg-alt); border-color: var(--border); }
body.dark-mode .sucs-resultado { background: rgba(22, 163, 74, 0.1); border-color: rgba(22, 163, 74, 0.2); }
body.dark-mode .aashto-resultado { background: rgba(30, 64, 175, 0.12); border-color: rgba(30, 64, 175, 0.2); }
body.dark-mode .atterberg-card { background: var(--bg-alt); }
body.dark-mode .plasticidad-chart { background: var(--bg-alt); }
body.dark-mode .profile-badge { background: var(--bg-alt); color: var(--text-muted); }












/* ============================================================
   SIDEBAR TOGGLE (Desktop) + .sidebar-collapsed
   ============================================================ */
#sidebarTogglePC {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    margin-right: 4px;
    flex-shrink: 0;
}
#sidebarTogglePC:hover {
    background: var(--bg);
    color: var(--text);
}
.sidebar-collapsed .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-width)));
}
.sidebar-collapsed .main-content {
    margin-left: 0;
}
@media (min-width: 992px) {
    #sidebarTogglePC {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}
body.dark-mode #sidebarTogglePC:hover {
    background: var(--bg-alt);
    color: var(--text);
}
body.dark-mode.sidebar-collapsed #sidebarTogglePC {
    color: var(--text-secondary);
}
