:root {
    --primary: #A70A15;
    --primary-dark: #7F060E;
    --primary-soft: #f5e8e8;
    --bg-page: #f3f4f6;
    --bg-card: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --success: #15803d;
    --error: #b91c1c;
    --info: #1d4ed8;
    --shadow-soft: 0 18px 40px rgba(17, 24, 39, 0.08);
    --wine-950: #b91c1c;
    --wine-800: #5f0b1b;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    min-height: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

body {
    font-family: "Inter", "Segoe UI", Arial, sans-serif;
    background: linear-gradient(135deg, #f8f8f8 0%, #f1f1f2 100%);
    color: var(--text-main);
}

img {
    display: block;
    max-width: 100%;
}

button,
input,
select {
    font: inherit;
}

.login-page {
    min-height: 100svh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: #f5f3f2;
}

.login-shell {
    position: relative;
    width: min(100%, 1100px);
    min-height: min(680px, calc(100svh - 4rem));
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    border-radius: 24px;
    background: var(--bg-card);
    box-shadow: 0 28px 70px rgba(42, 7, 16, .15);
    overflow: hidden;
}

.login-card-brand {
    display: flex;
    justify-content: center;
    margin-bottom: 2.2rem;
}

.login-massive-logo {
    width: 100%;
    max-width: 320px;
    height: auto;
    object-fit: contain;
}

@keyframes slideUpFade {
    0% { opacity: 0; transform: translateY(40px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes floatOrb {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-25px) scale(1.05); }
}

@keyframes floatOrbReverse {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(30px) scale(0.95); }
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.login-visual {
    position: relative;
    overflow: hidden;
    padding: clamp(2rem, 5vw, 4.5rem);
    display: flex;
    align-items: center; /* Center the title vertically */
    justify-content: center;
    background: linear-gradient(145deg, var(--wine-950), var(--primary), #8B0000, var(--wine-950));
    background-size: 300% 300%;
    animation: gradientShift 12s ease-in-out infinite;
    color: #fff;
    text-align: center;
}

.login-visual::before {
    content: ""; position: absolute; inset: 0; opacity: .15;
    background-image: linear-gradient(90deg, transparent 49%, rgba(255,255,255,.2) 50%, transparent 51%), linear-gradient(0deg, transparent 49%, rgba(255,255,255,.2) 50%, transparent 51%);
    background-size: 74px 74px;
    transform: perspective(340px) rotateX(58deg) scale(2) translateY(17%);
    transform-origin: bottom;
}

.login-visual-content {
    z-index: 10;
    width: 100%;
}

.animate-title {
    font-size: clamp(2.4rem, 4.5vw, 3.8rem);
    line-height: 1.1;
    letter-spacing: -.03em;
    font-weight: 800;
    text-shadow: 0 10px 30px rgba(0,0,0,0.3);
    opacity: 0;
    animation: slideUpFade 1.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.visual-orb { position: absolute; z-index: 1; border-radius: 50%; }
.orb-one {
    width: 390px; height: 390px; top: -100px; right: -150px;
    border: 2px solid rgba(255,255,255,.12);
    box-shadow: 0 0 0 40px rgba(255,255,255,.02), 0 0 0 90px rgba(255,255,255,.015);
    animation: floatOrb 9s ease-in-out infinite;
}
.orb-two {
    width: 250px; height: 250px; bottom: 40px; left: -100px;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
    animation: floatOrbReverse 12s ease-in-out infinite;
}
.orb-three {
    width: 140px; height: 140px; top: 30%; left: 15%;
    background: rgba(255,255,255,.04);
    backdrop-filter: blur(4px);
    animation: floatOrb 7s ease-in-out infinite;
    animation-delay: 1.5s;
}

.login-card {
    display: flex; flex-direction: column; justify-content: center;
    background: var(--bg-card); padding: clamp(2rem, 5vw, 5rem);
}

.brand-block {
    align-self: flex-start; margin-bottom: 2.4rem;
}

.brand-logo {
    width: min(100%, 380px);
    height: auto;
    object-fit: contain;
    margin-bottom: 1rem;
}

.login-intro { margin-bottom: 1.7rem; }.login-intro h1 { font-size: clamp(1.75rem, 3vw, 2.35rem); line-height: 1.15; letter-spacing: -.045em; margin: .55rem 0 .5rem; }.login-intro > p:last-child { color: var(--text-muted); font-size: .9rem; }

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.form-field label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
}

.form-field input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    padding: 0.8rem 0.85rem;
    color: var(--text-main);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-field input::placeholder {
    color: #9ca3af;
}

.form-field input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(139, 0, 0, 0.08);
}

.btn-login,
.btn-primary {
    border: none;
    border-radius: 12px;
    background: var(--primary);
    color: #ffffff;
    font-weight: 700;
    padding: 0.9rem 1rem;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
}
.btn-login { display: flex; justify-content: space-between; align-items: center; margin-top: .25rem; }.btn-login span { font-size: 1.25rem; line-height: 0; }

.btn-login:hover,
.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-login:active,
.btn-primary:active {
    transform: translateY(1px);
}

.btn-secondary {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    color: var(--text-main);
    font-weight: 600;
    padding: 0.75rem 1rem;
    cursor: pointer;
}

.login-feedback {
    min-height: 1.25rem;
    margin-top: 0.2rem;
    font-size: 0.82rem;
    text-align: left;
    color: var(--text-muted);
}
.login-footer { margin-top: 2.2rem; padding-top: 1rem; border-top: 1px solid var(--border); font-size: .75rem; color: var(--text-muted); }

/* Dashboard */
.app-page { background: #f7f7f8; }.dashboard-layout { min-height: 100svh; display: grid; grid-template-columns: 248px 1fr; }.sidebar { background: linear-gradient(rgba(185, 28, 28, 0.85), rgba(139, 0, 0, 0.95)), url('../assets/images/ai-bg.jpg'); background-size: cover; background-position: center; color: #e9dce0; padding: 2rem 1rem 1.4rem; display: flex; flex-direction: column; }.sidebar-brand { display: block; padding: 0 .75rem; margin-bottom: 3.25rem; }.sidebar-brand img { width: 150px; filter: brightness(0) invert(1); }.sidebar-nav { display: grid; gap: .35rem; }.sidebar-link { color: #d7bfc5; text-decoration: none; display: flex; align-items: center; gap: .8rem; padding: .8rem .9rem; border-radius: 9px; font-size: .88rem; font-weight: 600; }.sidebar-link span { width: 18px; text-align: center; font-size: 1.05rem; }.sidebar-link:hover, .sidebar-link.active { background: rgba(255,255,255,.12); color: #fff; }.sidebar-footer { margin-top: auto; font-size: .74rem; color: #d7bfc5; padding: .75rem; }.online-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #55d48a; margin-right: .35rem; }.sidebar-logout { display: block; margin-top: 1rem; border: 0; background: transparent; padding: 0; color: #fff; font-size: .78rem; cursor: pointer; }.dashboard-main { max-width: 100vw; min-width: 0; width: 100%; margin: 0 auto; padding: clamp(1.75rem, 4vw, 3.5rem); }
.dashboard-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 2.3rem; }
.dashboard-header h1 { font-size: clamp(1.8rem, 3.2vw, 2.6rem); letter-spacing: -.055em; margin: .45rem 0; }
.dashboard-header h1 span { color: var(--primary); }
.header-copy { color: var(--text-muted); font-size: .9rem; }
.dashboard-cta { width: auto; text-decoration: none; white-space: nowrap; display: inline-flex; align-items: center; gap: .75rem; }
.dashboard-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1rem; }
.kpi-card, .dashboard-panel { background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 5px 18px rgba(17,24,39,.035); min-width: 0; }
.kpi-card { display: flex; gap: .85rem; padding: 1.15rem; align-items: center; }
.kpi-card p { font-size: .78rem; color: var(--text-muted); }
.kpi-card strong { display: block; line-height: 1.1; margin: .2rem 0; font-size: 1.7rem; letter-spacing: -.05em; }
.kpi-card small { color: #94a3b8; font-size: .7rem; }
.kpi-icon { width: 38px; height: 38px; display:grid; place-items:center; border-radius: 10px; background: #f7e7ea; color: var(--primary); font-weight: 800; }
.icon-success { background: #e8f7ef; color: #15803d; }
.icon-info { background: #e9f0ff; color: #2759b8; }
.icon-warning { background: #fff3dd; color: #bc7708; }
.dashboard-content-grid { display: grid; grid-template-columns: 1.35fr .85fr; gap: 1rem; margin-bottom: 1rem; min-width: 0; }
.dashboard-panel { padding: 1.45rem; width: 100%; max-width: 100%; }
.panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 1rem; margin-bottom: 1.3rem; }
.panel-heading h2, .quick-actions h2 { margin-top: .3rem; font-size: 1.15rem; letter-spacing: -.03em; }
.panel-heading a { color: var(--primary); font-size: .78rem; font-weight: 700; text-decoration: none; }
.status-list { display: grid; gap: 1rem; }
.status-row { display: grid; grid-template-columns: 110px 1fr 32px; align-items:center; gap: .7rem; font-size: .78rem; color: var(--text-main); }
.status-bar { height: 7px; border-radius: 99px; background: #f0f1f3; overflow: hidden; }
.status-fill { display:block; height:100%; border-radius:inherit; background: var(--primary); }
.status-fill.stock { background: #2775c7; }
.status-fill.mantenimiento { background: #d38b12; }
.quick-actions { display: flex; flex-direction: column; }
.quick-action { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .75rem; text-decoration: none; color: var(--text-main); padding: .85rem 0; border-bottom: 1px solid var(--border); }
.quick-action:first-of-type { margin-top: .6rem; }
.quick-action:last-child { border: 0; }
.quick-action strong, .quick-action small { display:block; }
.quick-action strong { font-size: .82rem; }
.quick-action small { color: var(--text-muted); font-size: .7rem; margin-top: .15rem; }
.quick-action b { color: var(--primary); }
.quick-icon { width: 33px; height:33px; display:grid; place-items:center; background:#f8ecee; border-radius:9px; color: var(--primary); }
.recent-table-wrap { overflow-x: auto; width: 100%; -webkit-overflow-scrolling: touch; }.recent-table { width:100%; border-collapse:collapse; min-width:550px; }.recent-table th { text-align:left; font-size:.66rem; letter-spacing:.06em; color:#94a3b8; padding: .25rem .5rem .7rem; }.recent-table td { padding:.8rem .5rem; border-top:1px solid var(--border); font-size:.78rem; }.badge { display:inline-block; padding:.25rem .5rem; border-radius:99px; font-size:.64rem; font-weight:700; background:#eff6ff; color:#2563eb; }.badge.asignado { background:#e9f8ef; color:#15803d; }.badge.mantenimiento { background:#fff4df; color:#a16207; }.empty-state { color: var(--text-muted); font-size: .82rem; text-align:center; padding: 1.1rem; }.dashboard-error { color: var(--error); margin-top: 1rem; font-size: .82rem; }

.app-header {
    max-width: 1200px;
    margin: 1.2rem auto 0;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.brand-inline {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.brand-inline-logo {
    width: 92px;
}

.brand-inline h1 {
    font-size: 1.25rem;
    margin-bottom: 0.2rem;
}

.brand-inline p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.app-main {
    max-width: 1200px;
    margin: 1rem auto 2rem;
    padding: 0 1rem;
    display: grid;
    gap: 1rem;
}

.module-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.module-tab {
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: var(--text-main);
    padding: 0.55rem 1rem;
    font-weight: 600;
    cursor: pointer;
}

.module-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.status-card,
.module-section,
.metrics-grid {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-soft);
}

.status-card {
    padding: 0.85rem 1rem;
}

.status-line {
    min-height: 1.2rem;
    font-size: 0.9rem;
}

.status-info {
    color: var(--info);
}

.status-ok {
    color: var(--success);
}

.status-error {
    color: var(--error);
}

.metrics-grid {
    display: grid;
    gap: 0.8rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 0.9rem;
}

.metric-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    background: #fff;
}

.metric-card span {
    display: block;
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-bottom: 0.35rem;
}

.metric-card strong {
    font-size: 1.65rem;
    color: var(--primary);
}

.module-section {
    padding: 1rem;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.8rem;
}

.filters-row {
    display: grid;
    grid-template-columns: 1fr 220px auto;
    gap: 0.7rem;
    align-items: end;
    margin-bottom: 0.9rem;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.filter-field input {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.62rem 0.7rem;
    background: #fff;
}

.table-container {
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
}

#activosTable {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.83rem;
    min-width: 980px;
    background: #fff;
}

#activosTable th,
#activosTable td {
    border-bottom: 1px solid var(--border);
    text-align: left;
    padding: 0.55rem 0.65rem;
    vertical-align: top;
}

#activosTable th {
    position: sticky;
    top: 0;
    background: #f8fafc;
    z-index: 1;
}

.btn-action {
    border: none;
    border-radius: 8px;
    background: #f1f5f9;
    color: #0f172a;
    padding: 0.45rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}

.inventory-form .form-grid {
    display: grid;
    gap: 0.85rem;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.inventory-form label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
}

.inventory-form input,
.inventory-form select {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.68rem 0.72rem;
    background: #fff;
}

.inventory-form input:focus,
.inventory-form select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(139, 0, 0, 0.08);
}

.btn-submit {
    margin-top: 1rem;
}

.acta-panel {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
}

.acta-preview {
    padding: 1rem;
    line-height: 1.48;
    background: #e5e7eb;
    overflow-x: auto;
}

/* On-screen Acta Styling (matches print.css visually) */
.acta-page {
    position: relative;
    padding: 2rem;
    min-height: 600px;
    background: #fff;
    border-left: 20px solid var(--primary);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    margin: 0 auto;
    max-width: 850px;
}

.acta-header-new {
    text-align: center;
    margin-bottom: 1.5rem;
}

.acta-logo-new {
    width: 100%;
    max-width: 350px;
    height: auto;
    object-fit: contain;
    margin: 0 auto 0.75rem;
}

.acta-divider {
    border-top: 2px solid var(--primary);
    width: 60%;
    margin: 0 auto;
}

.acta-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 2rem;
    font-size: 0.8rem;
    color: #111;
}

.acta-table td {
    border: 1px solid #111;
    padding: 0.4rem 0.5rem;
}

.company-col,
.consecutivo-col,
.title-col,
.section-col,
.header-col td {
    background-color: #E6E6E6;
    font-weight: 700;
    text-align: center;
}

.data-col {
    background-color: #fff;
}

.item-col {
    width: 50px;
    text-align: center;
}

.fecha-col {
    width: 130px;
}

.firmas-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    margin-top: 3rem;
    margin-bottom: 2rem;
}

.firma-box {
    text-align: left;
    font-size: 0.8rem;
    color: #111;
}

.linea-firma { margin-top: 60px;
    border-top: 1px solid #111;
    margin-bottom: 0.5rem;
    width: 100%;
}

.firma-box p {
    margin-bottom: 0.25rem;
}

.acta-footer {
    margin-top: 2rem;
    padding-top: 1rem;
}

.footer-red-text {
    color: var(--primary);
    text-align: center;
    font-weight: 700;
    font-size: 0.75rem;
    margin-bottom: 1rem;
}

.footer-cols {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
    border-top: 1px solid var(--border);
    padding-top: 1rem;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.f-col {
    line-height: 1.5;
}

.acta-actions {
    border-top: 1px solid var(--border);
    padding: 0.8rem 1rem;
    display: flex;
    gap: 0.65rem;
    justify-content: flex-end;
}

.helper-text {
    margin-top: 0.8rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

@media (max-width: 900px) {
    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .app-header {
        flex-direction: column;
        align-items: stretch;
    }

    .section-head {
        flex-direction: column;
        align-items: stretch;
    }

    .filters-row {
        grid-template-columns: 1fr;
    }

    .acta-actions {
        flex-direction: column;
    }

    .firmas-grid {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 640px) {
    .login-card {
        padding: 1.8rem;
    }
}

@media (max-width: 900px) {
    .login-page { padding: 1.25rem; align-items: center; }
    .login-shell { min-height: auto; width: 100%; grid-template-columns: 1fr; border-radius: 20px; box-shadow: 0 15px 40px rgba(0,0,0,0.15); }
    .login-visual { display: flex; padding: 2rem 1rem; border-radius: 20px 20px 0 0; }
    .animate-title { font-size: 1.8rem; }
    .orb-one, .orb-two, .orb-three { display: none; } /* Menos carga visual en móvil */
    .login-card { padding: 2.2rem 1.5rem; border-radius: 0 0 20px 20px; }
    
    .dashboard-layout { grid-template-columns: 1fr; padding-top: 70px; padding-bottom: 75px; }
    .sidebar { position: fixed; top: 0; left: 0; right: 0; z-index: 900; padding: 0.8rem 1.2rem; flex-direction: row; align-items: center; justify-content: space-between; border-radius: 0; }
    .sidebar-brand { padding: 0; margin: 0; }
    .sidebar-brand img { width: 130px; margin: 0; }
    
    .sidebar-footer { display: flex; flex-direction: row; margin: 0; padding: 0; gap: 0.8rem; }
    #userRoleDisplay { display: none; } 
    .sidebar-logout { margin: 0; font-size: 0.8rem; padding: 0.5rem 0.8rem; background: rgba(255,255,255,0.1); border-radius: 8px; }
    
    /* Nueva barra de navegación inferior móvil */
    .sidebar-nav { 
        display: flex; flex-direction: row; justify-content: space-around; 
        position: fixed; bottom: 0; left: 0; right: 0; 
        background: #ffffff; padding: 0.5rem; z-index: 900;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.08); border-top: 1px solid var(--border);
    }
    .sidebar-link { 
        flex-direction: column; gap: 0.25rem; padding: 0.4rem; font-size: 0.65rem; font-weight: 700; border-radius: 12px; flex: 1; justify-content: center;
        color: var(--text-muted); 
    }
    .sidebar-link span { font-size: 1.25rem; margin-bottom: 0.1rem; }
    .sidebar-link:hover, .sidebar-link.active { background: var(--primary-soft); color: var(--primary); }
    
    .dashboard-kpis { grid-template-columns: repeat(2, 1fr); }
    .dashboard-content-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .dashboard-main { padding: 1.25rem 1rem 2rem; }
    .dashboard-header { align-items: flex-start; flex-direction: column; margin-bottom: 1.5rem; gap: 0.8rem; }
    .header-actions { width: 100%; }
    .header-actions .btn-primary { width: 100%; justify-content: center; }
    .dashboard-cta { width: 100%; justify-content: space-between; }
    .dashboard-kpis { grid-template-columns: 1fr; gap: .8rem; }
    .kpi-card { padding: 1.15rem; }
    .dashboard-panel { padding: 1.15rem; overflow: hidden; }
    .panel-heading { align-items: flex-start; flex-direction: column; gap: 0.8rem; }
    .panel-heading .search-box { width: 100%; }
    .panel-heading .search-box select, .panel-heading .search-box input { width: 100%; }
    
    /* Ajustes específicos de Login en celular */
    .login-card-brand { margin-bottom: 1.5rem; }
    .login-massive-logo { max-width: 200px; }
    .login-intro h1 { font-size: 1.7rem; }
}

/* Branding and navigation refinements */
.sidebar-brand img { width: 260px; max-width: 100%; margin-left: -6px; }

.brand-inline-logo { width: 230px; }
.app-header-actions { display: flex; align-items: center; gap: .65rem; }
.role-chip { display: inline-flex; align-items: center; gap: .35rem; border-radius: 999px; padding: .5rem .75rem; background: var(--primary-soft); color: var(--primary); font-size: .74rem; font-weight: 800; }
.role-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.btn-dashboard { text-decoration: none; display: inline-flex; align-items: center; white-space: nowrap; }

@media (max-width: 900px) {
    .acta-document-header { grid-template-columns: 1fr auto; }
    .acta-document-title { grid-column: 1 / -1; grid-row: 2; }
}

/* Cabecera del inventario: la marca es el elemento principal. */
.brand-inline-logo { width: min(280px, 50vw); }
.app-header { min-height: 86px; }
.app-header-actions { margin-left: auto; }
.section-title h2 { font-size: 1.28rem; letter-spacing: -.03em; }
.section-kicker { margin-bottom: .2rem; color: var(--primary); font-size: .67rem; font-weight: 800; letter-spacing: .12em; }
.inventory-toolbar { display: flex; align-items: end; justify-content: flex-end; flex-wrap: wrap; gap: .55rem; }
.inventory-toolbar .filter-field { min-width: 155px; }
.inventory-toolbar .filter-search { min-width: 220px; }
.inventory-toolbar button { min-height: 40px; width: auto; white-space: nowrap; }
.inventory-toolbar .btn-primary { padding-inline: 1rem; }
.module-section > .section-head { align-items: end; }

@media (max-width: 650px) {
    .sidebar-brand img { width: 145px; }
    .app-header-actions { width: 100%; }
    .app-header-actions .btn-dashboard, .app-header-actions .btn-secondary { flex: 1; justify-content: center; text-align: center; }
    .role-chip { display: none; }
    .brand-inline-logo { width: 210px; }
    .module-section > .section-head { align-items: stretch; }
    .inventory-toolbar { align-items: stretch; }
    .inventory-toolbar .filter-field, .inventory-toolbar .filter-search { min-width: 0; flex: 1 1 100%; }
    .inventory-toolbar button { flex: 1; }
}

/* =========================================================
   MÓDULO GERENCIA & REPORTES EJECUTIVOS
   ========================================================= */
.gerencia-kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.gerencia-charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.gerencia-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.2rem;
}

.gerencia-filters {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.gerencia-filters input,
.gerencia-filters select {
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #ffffff;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.gerencia-filters input:focus,
.gerencia-filters select:focus {
    border-color: var(--primary);
}

.btn-export {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #15803d;
    color: #ffffff;
    border: none;
    border-radius: 10px;
    padding: 0.65rem 1.15rem;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
}

.btn-export:hover {
    background: #166534;
}

.btn-export:active {
    transform: translateY(1px);
}

@media (max-width: 900px) {
    .gerencia-kpis {
        grid-template-columns: repeat(2, 1fr);
    }
    .gerencia-charts-grid {
        grid-template-columns: 1fr;
    }
    .gerencia-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .gerencia-filters {
        width: 100%;
    }
    .gerencia-filters input,
    .gerencia-filters select,
    .btn-export {
        width: 100%;
    }
}

.forgot-password-link { text-align: center; margin-top: 1rem; }
.forgot-password-link a { color: var(--primary); font-size: 0.82rem; text-decoration: none; font-weight: 500; }
.forgot-password-link a:hover { text-decoration: underline; }

.login-hint { line-height: 1.4; border-left: 3px solid #7c0b0b; padding-left: 10px; margin-bottom: 25px; text-align: left; }
.btn-login:disabled { opacity: 0.7; cursor: not-allowed; }

/* Fix FOUC para roles */
.admin-only { display: none !important; }
body.is-admin .admin-only { display: flex !important; }



/* --- WATERMARK BACKGROUND --- */



/* --- TRANSPARENT UI FOR WATERMARK --- */
.card, .dashboard-panel, .kpi-card { background: rgba(255, 255, 255, 0.85) !important; backdrop-filter: blur(4px); }
#activosTable th { background: rgba(248, 250, 252, 0.85) !important; }
#activosTable td { background: transparent !important; }
.table-container { background: transparent !important; }
body::before { z-index: 0; opacity: 0.08; width: 60vw; height: 60vh; }
.dashboard-main { position: relative; z-index: 1; }

.dir-email { display:block; font-size:0.75rem; color:#64748b; margin-top:2px; }
.dir-btn { background:transparent; border:1px solid var(--border); border-radius:4px; font-size:0.7rem; padding:0.2rem 0.4rem; cursor:pointer; }
.dir-btn:hover { background:var(--primary-soft); }

/* ========================================================
   TEMA IA - GLASSMORPHISM MODERNO
======================================================== */

/* Fondo de pantalla completa con la imagen IA */
body.app-page {
    background: linear-gradient(rgba(20, 15, 35, 0.42), rgba(20, 15, 35, 0.42)), url('../assets/images/ai-bg.jpg') no-repeat center center fixed !important;
    background-size: cover !important;
    color: #e2e8f0;
}

/* Sidebar: rojo vivo y más claro, con brillo */
.sidebar {
    background: linear-gradient(180deg, rgba(220, 38, 38, 0.92) 0%, rgba(153, 27, 27, 0.94) 100%) !important;
    backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 120, 120, 0.25);
}

/* ---- TARJETAS PRINCIPALES (KPIs, Panels, Charts) ---- */
.kpi-card {
    background: rgba(30, 20, 45, 0.55) !important;
    backdrop-filter: blur(16px) saturate(1.4) !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2) !important;
    border-radius: 16px !important;
}
.kpi-card p { color: rgba(255,255,255,0.75) !important; }
.kpi-card strong { color: #ffffff !important; }

.chart-card, .dashboard-panel {
    background: rgba(30, 20, 45, 0.5) !important;
    backdrop-filter: blur(16px) saturate(1.3) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: #f1f5f9 !important;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2) !important;
    border-radius: 16px !important;
}
.chart-card h3 { color: #ffffff !important; }

/* ---- DIRECTORIO & ORGANIGRAMA ---- */
.org-section {
    background: rgba(255, 255, 255, 0.08) !important;
    backdrop-filter: blur(14px) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
}
.org-card {
    background: rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    box-shadow: none !important;
    transition: all 0.3s ease !important;
}
.org-card:hover {
    background: rgba(255, 255, 255, 0.18) !important;
    border-color: rgba(255, 255, 255, 0.25) !important;
    transform: translateY(-3px) !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2) !important;
}
.org-leader {
    background: rgba(255, 255, 255, 0.12) !important;
    backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-left: 4px solid var(--primary) !important;
}

/* ---- MODAL / FICHAS ---- */
.section, .corporate-form-container, .modal-ficha, .modal-content {
    background: rgba(15, 20, 40, 0.85) !important;
    backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    color: #f1f5f9 !important;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4) !important;
}

/* ---- TEXTOS ---- */
.dashboard-header h1, h1, h2, h3, h4, h5 {
    color: #ffffff !important;
}
.dashboard-header p, .header-copy {
    color: rgba(255, 255, 255, 0.6) !important;
}
.org-section-title, .corp-title, .corp-subtitle {
    color: #ffffff !important;
}
.org-info p, .dir-email, .muted {
    color: rgba(255, 255, 255, 0.6) !important;
}
.org-leader-info h4, .org-info h5 { color: #ffffff !important; }
.org-leader-info p { color: rgba(255,255,255,0.7) !important; }

/* ---- Excepcion: modales con fondo blanco (Directorio: Editar Contacto / Mini Perfil) ---- */
/* Estos modales tienen fondo blanco explicito, asi que sus textos deben ser oscuros, no blancos */
#modalDir h1, #modalDir h2, #modalDir h3, #modalDir h4, #modalDir h5,
#modalDir label, #modalDir p,
#modalPerfilDir h1, #modalPerfilDir h2, #modalPerfilDir h3, #modalPerfilDir h4, #modalPerfilDir h5 {
    color: #0f172a !important;
}
#modalDir input, #modalDir select {
    color: #0f172a !important;
    background: #fff !important;
}
/* La regla general ".modal-content" (linea ~985) pinta fondo oscuro a TODOS los modales;
   aqui forzamos que estos 2 modales concretos (fondo blanco) no queden oscuros por encima */
#modalDir .modal-content, #modalPerfilDir .modal-content {
    background: #ffffff !important;
    backdrop-filter: none !important;
    color: #0f172a !important;
}
#modalDir .modal-content *:not(button):not(.modal-close), #modalPerfilDir .modal-content *:not(button):not(.modal-close) {
    color: #0f172a !important;
}
#modalPerfilDir #perfilDirCargo { color: #b91c1c !important; }

/* ---- KPI ICONOS (más brillantes) ---- */
.kpi-icon { background: rgba(255,255,255,0.15) !important; color: #ff6b6b !important; }
.icon-success { background: rgba(21, 128, 61, 0.25) !important; color: #4ade80 !important; }
.icon-info { background: rgba(37, 99, 235, 0.25) !important; color: #60a5fa !important; }
.icon-warning { background: rgba(188, 119, 8, 0.25) !important; color: #fbbf24 !important; }

/* ---- INPUTS Y SELECTS ---- */
.corp-input, .corp-select, .app-page input, .app-page select, .app-page textarea {
    background: rgba(0, 0, 0, 0.25) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
    border-radius: 8px;
}
.corp-input:focus, .corp-select:focus, .app-page input:focus {
    border-color: var(--primary) !important;
    background: rgba(0, 0, 0, 0.4) !important;
    box-shadow: 0 0 0 3px rgba(167, 10, 21, 0.3) !important;
}
.app-page ::placeholder { color: rgba(255,255,255,0.35) !important; }

/* ---- TABLAS ---- */
.app-page table thead th {
    background: rgba(0, 0, 0, 0.3) !important;
    color: rgba(255, 255, 255, 0.85) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    font-weight: 700;
}
.app-page table tbody td {
    color: #f1f5f9 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
}
.app-page table tbody tr:hover {
    background: rgba(255, 255, 255, 0.08) !important;
}

/* ---- BADGES (estados) ---- */
.app-page .badge {
    background: rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.app-page .badge.asignado, .app-page .badge-Activo {
    background: rgba(21, 128, 61, 0.3) !important;
    color: #4ade80 !important;
    border-color: rgba(74, 222, 128, 0.3);
}

/* ---- TABS DEL INVENTARIO ---- */
.app-page .module-tab {
    background: rgba(255, 255, 255, 0.08) !important;
    color: rgba(255, 255, 255, 0.7) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
}
.app-page .module-tab.active {
    background: var(--primary) !important;
    color: #ffffff !important;
    border-color: var(--primary) !important;
}

/* ---- TABLE CONTAINER ---- */
.app-page .table-container {
    background: rgba(255, 255, 255, 0.06) !important;
    backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 14px !important;
}

/* ---- BOTONES ---- */
.app-page .btn-secondary {
    background: rgba(255, 255, 255, 0.12) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}
.app-page .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2) !important;
}
.btn-danger, .app-page .btn-danger {
    background: #dc2626 !important;
    color: #ffffff !important;
    border: 1px solid rgba(255,255,255,0.2) !important;
    border-radius: 8px;
    padding: 0.6rem 1rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.btn-danger:hover, .app-page .btn-danger:hover {
    background: #b91c1c !important;
}
.app-page .btn-ghost {
    background: rgba(167, 10, 21, 0.2) !important;
    color: #ff8a8a !important;
    border: 1px solid rgba(167, 10, 21, 0.3) !important;
    border-radius: 8px;
    padding: 0.4rem 0.8rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.8rem;
}
.app-page .btn-ghost:hover {
    background: var(--primary) !important;
    color: #fff !important;
}

/* ---- MODAL ---- */
/* Overlay flotante por defecto para cualquier .modal-overlay que no defina su propio estilo de posicionamiento (ej: organigrama.html) */
.modal-overlay {
    position: fixed !important;
    inset: 0 !important;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    overflow-y: auto;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.75) !important;
}
.modal-overlay .modal-content {
    max-height: 90vh;
    overflow-y: auto;
}
.modal-header, .modal-footer {
    border-color: rgba(255, 255, 255, 0.1) !important;
}

/* ---- DIRECTORIO BOTONES ---- */
.dir-btn {
    color: rgba(255,255,255,0.8);
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    padding: 0.3rem 0.6rem;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s;
}
.dir-btn:hover { background: rgba(255,255,255,0.18); color: #fff; }

/* ---- SCROLL BAR PERSONALIZADO ---- */
.app-page ::-webkit-scrollbar { width: 6px; }
.app-page ::-webkit-scrollbar-track { background: rgba(0,0,0,0.1); }
.app-page ::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }
.app-page ::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

/* ---- LINKS ---- */
.app-page a { color: #ff8a8a; }
.app-page a:hover { color: #ffffff; }
.app-page .panel-heading a { color: #ff8a8a !important; }

/* ---- RESPONSIVE: Barra inferior móvil sobre fondo oscuro ---- */
@media (max-width: 768px) {
    .sidebar-nav {
        background: rgba(10, 10, 20, 0.95) !important;
        border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.3) !important;
    }
    .sidebar-link { color: rgba(255,255,255,0.6) !important; }
    .sidebar-link:hover, .sidebar-link.active { color: #ffffff !important; background: rgba(255,255,255,0.1) !important; }
}

