/* ============================================================================
   K10 ERP - ESTILO CORPORATIVO ULTRA-COMPACTO, MODALES & ALTA DENSIDAD
   ============================================================================ */

:root {
    --primary-blue: #0284c7;
    --primary-blue-hover: #0369a1;
    --primary-orange: #ea580c;
    --primary-orange-hover: #c2410c;
    --banner-blue-start: #00337f;
    --banner-blue-end: #001f52;
    --bg-main: #f8fafc;
    --card-bg: #ffffff;
    --text-dark: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --border-subtle: #e2e8f0;
    --border-strong: #cbd5e1;
    --font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-family);
}

/* ============================================================================
   1. LOGIN CLARO / BLANCO ESTÉTICO
   ============================================================================ */
body.login-body {
    min-height: 100vh;
    background-color: var(--bg-main);
    background-image: 
        radial-gradient(ellipse at 50% 50%, rgba(255, 255, 255, 0.9) 0%, rgba(241, 245, 249, 0.6) 100%),
        linear-gradient(to right, rgba(226, 232, 240, 0.6) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(226, 232, 240, 0.6) 1px, transparent 1px);
    background-size: 100% 100%, 36px 36px, 36px 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

body.login-body::before {
    content: "";
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(2, 132, 199, 0.12) 0%, rgba(2, 132, 199, 0) 65%);
    top: -150px;
    left: -150px;
    border-radius: 50%;
    filter: blur(50px);
    pointer-events: none;
}

body.login-body::after {
    content: "";
    position: absolute;
    width: 550px;
    height: 550px;
    background: radial-gradient(circle, rgba(234, 88, 12, 0.10) 0%, rgba(234, 88, 12, 0) 65%);
    bottom: -120px;
    right: -120px;
    border-radius: 50%;
    filter: blur(50px);
    pointer-events: none;
}

.toast-container {
    position: fixed;
    top: 25px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 1;
}

.toast-container.hidden {
    top: -70px;
    opacity: 0;
    pointer-events: none;
}

.toast-card {
    background: #0f172a;
    border: 1px solid #ef4444;
    color: #ffffff;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
    padding: 0.75rem 1.4rem;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.86rem;
    font-weight: 600;
}

.toast-card i { color: #ef4444; font-size: 1.1rem; }

.login-wrapper {
    width: 100%;
    max-width: 860px;
    position: relative;
    z-index: 2;
}

.login-card-container {
    background: #ffffff;
    border-radius: 22px;
    box-shadow: 
        0 20px 45px -10px rgba(15, 23, 42, 0.08),
        0 10px 20px -5px rgba(15, 23, 42, 0.04),
        0 0 0 1px rgba(226, 232, 240, 0.9);
    display: flex;
    overflow: hidden;
    min-height: 490px;
}

.brand-column {
    flex: 0 0 56%;
    background: linear-gradient(160deg, #ffffff 0%, #f8fafc 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px solid #f1f5f9;
    padding: 3rem 2.5rem;
    text-align: center;
    position: relative;
}

.brand-column::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(2, 132, 199, 0.03) 0%, transparent 70%);
    pointer-events: none;
}

.brand-content { max-width: 290px; position: relative; z-index: 1; }

.logo-k10 {
    font-size: 4.8rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 1.2rem;
    letter-spacing: -2px;
}

.logo-k { color: #0284c7; }

.logo-10 {
    background: linear-gradient(135deg, #ea580c 0%, #f97316 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-subtitle {
    font-size: 0.64rem;
    font-weight: 800;
    letter-spacing: 1.4px;
    color: #64748b;
    display: block;
    margin-bottom: 0.3rem;
}

.brand-title {
    font-size: 1.55rem;
    font-weight: 800;
    color: #1e3a8a;
    margin-bottom: 0.35rem;
}

.brand-tagline { font-size: 0.82rem; color: #64748b; margin-bottom: 1.8rem; }

.indicator-dots { display: flex; justify-content: center; gap: 0.45rem; }
.dot { width: 7px; height: 7px; border-radius: 50%; }
.dot-yellow { background-color: #f59e0b; }
.dot-orange { background-color: #ea580c; width: 16px; border-radius: 10px; }
.dot-blue   { background-color: #0284c7; }

.form-column {
    flex: 0 0 44%;
    padding: 2.75rem 2.4rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #ffffff;
}

.form-header h2 { font-size: 1.45rem; font-weight: 800; color: #0f172a; letter-spacing: -0.4px; margin-bottom: 0.25rem; }
.form-header p { font-size: 0.78rem; color: #64748b; margin-bottom: 1.5rem; }
.input-group { margin-bottom: 1.05rem; }

.input-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: #334155;
    margin-bottom: 0.35rem;
}

.input-field { position: relative; display: flex; align-items: center; }

.input-icon {
    position: absolute;
    left: 0.9rem;
    color: #0284c7;
    font-size: 1rem;
    pointer-events: none;
}

.input-field input,
.input-field select {
    width: 100%;
    padding: 0.65rem 0.85rem 0.65rem 2.45rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    background-color: #f8fafc;
    font-size: 0.85rem;
    color: #1e293b;
    outline: none;
    transition: all 0.2s ease;
}

.input-field select {
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: calc(100% - 0.9rem) center;
}

.input-field input:focus,
.input-field select:focus {
    border-color: #0284c7;
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
}

.btn-toggle-eye {
    position: absolute; right: 0.9rem; background: none; border: none;
    color: #94a3b8; cursor: pointer; font-size: 0.95rem; transition: color 0.15s;
}
.btn-toggle-eye:hover { color: #0f172a; }

.form-options { display: flex; justify-content: space-between; align-items: center; margin: 1.1rem 0 1.4rem; font-size: 0.76rem; }
.remember-me { display: flex; align-items: center; gap: 0.45rem; color: #475569; cursor: pointer; font-weight: 500; }
.remember-me input { accent-color: #ea580c; cursor: pointer; }
.forgot-link { color: #0284c7; text-decoration: none; font-weight: 600; }
.forgot-link:hover { text-decoration: underline; }

.btn-submit {
    width: 100%;
    padding: 0.78rem;
    background: linear-gradient(135deg, #ea580c 0%, #f97316 100%);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 6px 16px rgba(234, 88, 12, 0.28);
    transition: all 0.2s ease;
}
.btn-submit:hover { background: linear-gradient(135deg, #c2410c 0%, #ea580c 100%); transform: translateY(-1px); }

/* ============================================================================
   2. TOPBAR & HUB HEADER
   ============================================================================ */
body.hub-body {
    min-height: 100vh;
    background-color: var(--bg-main);
    color: var(--text-dark);
    font-size: 13px;
    display: flex;
    flex-direction: column;
}

.hub-header {
    height: 56px;
    background: #ffffff;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.hub-header-left { display: flex; align-items: center; gap: 1rem; }

.logo-k10-mini {
    font-size: 1.45rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -1px;
    cursor: pointer;
    user-select: none;
}

.empresa-pill {
    background: #f8fafc;
    border: 1px solid var(--border-subtle);
    padding: 0.25rem 0.75rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.empresa-pill i { color: #0284c7; }

.hub-header-center { flex: 0 1 440px; }

.search-bar-header { position: relative; display: flex; align-items: center; }
.search-bar-header i { position: absolute; left: 0.85rem; color: #94a3b8; }
.search-bar-header input {
    width: 100%;
    padding: 0.42rem 3.5rem 0.42rem 2.3rem;
    border: 1.5px solid var(--border-subtle);
    border-radius: 8px;
    background: #f8fafc;
    font-size: 0.78rem;
    outline: none;
    transition: all 0.2s;
}
.search-bar-header input:focus { background: #ffffff; border-color: #0284c7; box-shadow: 0 0 0 2.5px rgba(2, 132, 199, 0.12); }
.shortcut-tag {
    position: absolute; right: 0.5rem; background: #e2e8f0; color: #475569;
    padding: 0.12rem 0.35rem; border-radius: 4px; font-size: 0.65rem; font-weight: 700;
}

.hub-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* User Badge Compacto */
.user-profile-wrapper { position: relative; display: inline-block; }

.user-badge {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.25rem 0.75rem;
    border-radius: 24px;
    background: #f8fafc;
    border: 1.5px solid var(--border-subtle);
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-badge:hover { background: #f1f5f9; border-color: #cbd5e1; }

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ea580c 0%, #f97316 100%);
    color: white;
    font-weight: 800;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-meta { display: flex; flex-direction: column; text-align: left; line-height: 1.15; }
.user-name { font-size: 0.78rem; font-weight: 800; color: #0f172a; }
.user-role { font-size: 0.66rem; color: #64748b; font-weight: 600; }
.user-arrow { font-size: 0.66rem; color: #94a3b8; margin-left: 0.2rem; transition: transform 0.2s ease; }
.user-profile-wrapper:hover .user-arrow { transform: rotate(180deg); color: #0284c7; }

.user-popover-card {
    position: absolute; top: calc(100% + 8px); right: 0; width: 260px;
    background: #ffffff; border-radius: 14px; border: 1px solid var(--border-subtle);
    box-shadow: 0 16px 32px -4px rgba(15, 23, 42, 0.15); padding: 1rem;
    opacity: 0; visibility: hidden; transform: translateY(-6px);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1); z-index: 200;
}
.user-profile-wrapper:hover .user-popover-card { opacity: 1; visibility: visible; transform: translateY(0); }
.popover-header { display: flex; align-items: center; gap: 0.75rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border-subtle); margin-bottom: 0.75rem; }
.popover-avatar { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, #ea580c 0%, #f97316 100%); color: white; font-weight: 800; font-size: 0.9rem; display: flex; align-items: center; justify-content: center; }
.popover-title-group h4 { font-size: 0.85rem; font-weight: 800; color: #0f172a; }
.popover-title-group span { font-size: 0.72rem; color: #64748b; }
.popover-body { display: flex; flex-direction: column; gap: 0.55rem; }
.popover-item { display: flex; align-items: center; gap: 0.55rem; font-size: 0.74rem; }
.popover-item i { font-size: 0.9rem; color: #0284c7; width: 16px; text-align: center; }
.lbl-prop { font-size: 0.62rem; color: #94a3b8; font-weight: 700; text-transform: uppercase; display: block; }
.val-prop { color: #1e293b; font-weight: 600; display: block; }

.btn-exit-elegant {
    padding: 0.35rem 0.85rem; 
    border: 1px solid #fee2e2; 
    background: #fff5f5; 
    color: #dc2626;
    border-radius: 8px; 
    font-size: 0.75rem; 
    font-weight: 700; 
    cursor: pointer;
    display: flex; 
    align-items: center; 
    gap: 0.4rem; 
    transition: all 0.2s ease;
    height: 32px;
}
.btn-exit-elegant:hover { background: #fee2e2; border-color: #fca5a5; transform: translateY(-1px); }

/* ============================================================================
   3. ÁREA DE TRABAJO (WORKSPACE COMPACTO - CERO ESPACIO MUERTO)
   ============================================================================ */
.hub-container {
    max-width: 1440px; 
    width: 100%; 
    margin: 0 auto; 
    padding: 0.6rem 1.25rem 2rem;
    flex: 1;
}

/* BREADCRUMB PLANO */
.workspace-nav-bar {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0 0 0.5rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
}

.breadcrumb-group {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
}

.btn-breadcrumb {
    background: none;
    border: none;
    color: #0284c7;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.1rem 0.25rem;
    border-radius: 4px;
}
.btn-breadcrumb:hover { background: #e0f2fe; }
.separator { color: #94a3b8; font-size: 0.65rem; }
.breadcrumb-current { font-weight: 800; color: #0f172a; }

/* Banners del Hub */
.welcome-banner.clean-banner,
.welcome-banner.module-banner {
    background: linear-gradient(135deg, var(--banner-blue-start) 0%, var(--banner-blue-end) 100%);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    color: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 51, 127, 0.14);
    margin-bottom: 0.85rem;
}

.banner-content h1 { font-size: 1.2rem; font-weight: 800; margin-bottom: 0.1rem; }
.banner-content p { font-size: 0.76rem; color: #cbd5e1; margin-bottom: 0.4rem; }
.banner-tags { display: flex; gap: 0.4rem; }

.tag-status, .tag-date {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(6px);
    padding: 0.15rem 0.5rem;
    border-radius: 8px;
    font-size: 0.66rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.btn-back-elegant {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #ffffff;
    padding: 0.35rem 0.85rem;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    transition: all 0.2s ease;
}
.btn-back-elegant:hover { background: #ffffff; color: #0f172a; transform: translateY(-1px); }

/* Grid de Módulos */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.module-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.85rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.02);
    position: relative;
    overflow: hidden;
}

.module-card::before {
    content: ""; position: absolute; top: 0; left: 0; bottom: 0; width: 3px; background: #0284c7; opacity: 0; transition: opacity 0.2s ease;
}

.module-card:hover {
    transform: translateY(-2px);
    border-color: #cbd5e1;
    box-shadow: 0 6px 14px -4px rgba(15, 23, 42, 0.06);
}
.module-card:hover::before { opacity: 1; }

.module-icon-box {
    width: 38px; height: 38px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px;
    display: flex; align-items: center; justify-content: center; color: #0284c7; font-size: 1.1rem; flex-shrink: 0; transition: all 0.2s ease;
}

.module-card:hover .module-icon-box {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff; border-color: transparent; transform: scale(1.04);
}

.module-info { display: flex; flex-direction: column; overflow: hidden; }
.module-title { font-size: 0.82rem; font-weight: 800; color: #1e293b; margin-bottom: 0.1rem; }
.module-desc { font-size: 0.7rem; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ============================================================================
   4. SUBMÓDULOS, CABECERAS Y FILTROS COMPACTOS
   ============================================================================ */
.submodule-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.submodule-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border-subtle);
}

.submodule-header-bar h3 {
    font-size: 1.05rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.2px;
}

.submodule-header-bar p {
    font-size: 0.72rem;
    color: #64748b;
    margin-top: 0.05rem;
}

.submodule-filter-bar {
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 0.45rem 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.015);
}

.filter-search-box {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}

.filter-search-box i {
    position: absolute;
    left: 0.65rem;
    color: #94a3b8;
    font-size: 0.78rem;
}

.filter-search-box input {
    width: 100%;
    padding-left: 2rem !important;
}

/* ============================================================================
   5. BOTONES Y ACCIONES CORPORATIVAS
   ============================================================================ */
.btn-primary {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff;
    border: none;
    padding: 0.35rem 0.85rem;
    border-radius: 6px;
    font-size: 0.74rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    box-shadow: 0 1px 3px rgba(2, 132, 199, 0.2);
    transition: all 0.15s ease;
    height: 28px;
}

.btn-primary:hover { background: #0369a1; transform: translateY(-1px); }

.btn-save {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff;
    border: none;
    padding: 0.4rem 1.1rem;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(2, 132, 199, 0.2);
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    height: 30px;
}

.btn-save:hover { background: #0369a1; transform: translateY(-1px); }

.btn-cancel {
    background: #ffffff;
    color: #475569;
    border: 1px solid #cbd5e1;
    padding: 0.4rem 0.95rem;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    height: 30px;
}

.btn-cancel:hover { background: #f1f5f9; color: #0f172a; border-color: #94a3b8; }

.btn-table-action {
    background: transparent;
    border: none;
    font-size: 0.88rem;
    color: #64748b;
    cursor: pointer;
    padding: 0.15rem 0.3rem;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.btn-table-action:hover { color: #0284c7; background: #f1f5f9; }

/* Badges de Estado */
.badge-status {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.66rem;
    font-weight: 700;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.2px;
}

.badge-status.active {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.badge-status.inactive {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.badge-level {
    background: #e2e8f0;
    color: #334155;
    padding: 1px 5px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.68rem;
}

/* ============================================================================
   6. INPUTS Y SELECTS DE ALTA PRECISIÓN (COMPACTOS)
   ============================================================================ */
.grid-cell-input,
.filter-search-box input,
.form-group input,
.form-group select,
.form-group textarea {
    height: 28px;
    padding: 0.25rem 0.55rem;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    background-color: #ffffff !important;
    color: #0f172a !important;
    font-size: 0.76rem;
    outline: none;
    transition: all 0.15s ease;
    box-sizing: border-box;
}

.grid-cell-input:focus,
.filter-search-box input:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #0284c7;
    box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15);
}

select.grid-cell-input,
select.form-group input,
.submodule-wrapper select {
    appearance: auto;
    cursor: pointer;
}

select option { background-color: #ffffff; color: #0f172a; padding: 4px 6px; }

/* ============================================================================
   7. TABLAS DE DATOS & TABLAS JERÁRQUICAS (MÁXIMA DENSIDAD)
   ============================================================================ */
.table-container {
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    overflow-x: auto;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.015);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.76rem;
}

.data-table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 700;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-subtle);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.2px;
}

.data-table td {
    padding: 0.45rem 0.75rem;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    font-variant-numeric: tabular-nums;
}

.data-table tr:hover td { background: #f8fafc; }

.tfoot-totals td {
    padding: 0.5rem 0.75rem;
    background: #f8fafc;
    font-weight: 800;
    border-top: 1.5px solid #cbd5e1;
    color: #0f172a;
}

/* Árbol PUC y Drilldown */
.tree-row.nivel-1 { background: #f8fafc; font-weight: 800; color: #0f172a; border-left: 3px solid #0284c7; }
.tree-row.nivel-2 { font-weight: 700; color: #1e293b; }
.tree-row.nivel-3 { font-weight: 600; color: #334155; }
.tree-row.nivel-4 { font-weight: 500; color: #475569; }
.tree-row.nivel-5 { font-weight: 400; color: #0f172a; }

.tree-node-expander {
    display: inline-block;
    width: 16px;
    height: 16px;
    text-align: center;
    line-height: 16px;
    cursor: pointer;
    margin-right: 3px;
    border-radius: 3px;
    color: #64748b;
    font-size: 0.68rem;
}
.tree-node-expander:hover { background: #e2e8f0; color: #0f172a; }

.badge-drill {
    display: inline-block;
    background: #e0f2fe;
    color: #0369a1;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 700;
    cursor: pointer;
    margin-left: 5px;
    font-size: 0.65rem;
}
.badge-drill:hover { background: #bae6fd; }

.row-drilldown-container { background: #f8fafc !important; padding: 0 !important; }
.drilldown-table-wrapper {
    margin: 0.3rem 0.6rem 0.6rem 1.5rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #ffffff;
    overflow: hidden;
}
.drilldown-table { width: 100%; border-collapse: collapse; font-size: 0.7rem; }
.drilldown-table thead th { background: #e0f2fe; color: #0369a1; font-weight: 700; padding: 4px 6px; text-align: left; }
.drilldown-table tbody td { padding: 3px 6px; border-bottom: 1px solid #f1f5f9; }

/* ============================================================================
   8. VENTANAS FLOTANTES / MODALES MODERNOS (ERP PRO)
   ============================================================================ */
.app-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 1rem;
}

.app-modal-window {
    background: #ffffff;
    width: 100%;
    max-width: 540px;
    border-radius: 12px;
    box-shadow: 0 20px 40px -10px rgba(15, 23, 42, 0.35), 0 0 0 1px rgba(226, 232, 240, 0.6);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalScaleIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.app-modal-window.modal-sm { max-width: 420px; }
.app-modal-window.modal-wide { max-width: 860px; }

@keyframes modalScaleIn {
    from { opacity: 0; transform: scale(0.96) translateY(6px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.app-modal-header {
    background: linear-gradient(135deg, var(--banner-blue-start) 0%, var(--banner-blue-end) 100%);
    color: #ffffff;
    padding: 0.75rem 1.15rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.app-modal-header h4 {
    font-size: 0.95rem;
    font-weight: 800;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    letter-spacing: -0.2px;
}

.btn-modal-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    font-size: 1rem;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.btn-modal-close:hover {
    background: rgba(220, 38, 38, 0.85);
    color: #ffffff;
}

.app-modal-body {
    padding: 1.15rem;
    background: #ffffff;
    max-height: 78vh;
    overflow-y: auto;
}

.app-modal-footer {
    padding: 0.65rem 1.15rem;
    background: #f8fafc;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Formularios en Secciones */
.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 0.65rem;
}

.form-group label,
.submodule-wrapper label {
    font-size: 0.72rem;
    font-weight: 700;
    color: #334155;
    margin-bottom: 0.25rem;
    display: block;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.form-section-card {
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 0.85rem;
    margin-bottom: 0.65rem;
    position: relative;
}

.form-section-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 3.5px;
    background: #0284c7;
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}

.form-section-title {
    font-size: 0.8rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 0.65rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.2px;
}
.form-section-title i { color: #0284c7; font-size: 0.9rem; }

.check-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.74rem;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
}

/* ============================================================================
   9. DIÁLOGOS K10 (ALERT, CONFIRM, TOAST) & AUTOCOMPLETE
   ============================================================================ */
.k10-dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: k10FadeIn 0.15s ease-out;
}

.k10-dialog-box {
    background: #ffffff;
    width: 90%;
    max-width: 400px;
    border-radius: 14px;
    box-shadow: 0 20px 40px -10px rgba(15, 23, 42, 0.3), 0 0 0 1px rgba(226, 232, 240, 0.8);
    padding: 1.35rem;
    text-align: center;
    animation: k10ScaleUp 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.k10-dialog-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    margin: 0 auto 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.k10-dialog-icon.success { background: #dcfce7; color: #16a34a; }
.k10-dialog-icon.error   { background: #fee2e2; color: #dc2626; }
.k10-dialog-icon.warning { background: #fef3c7; color: #d97706; }
.k10-dialog-icon.info    { background: #e0f2fe; color: #0284c7; }

.k10-dialog-title { font-size: 1rem; font-weight: 800; color: #0f172a; margin-bottom: 0.35rem; }
.k10-dialog-msg { font-size: 0.78rem; color: #475569; line-height: 1.45; margin-bottom: 1.15rem; word-break: break-word; }
.k10-dialog-actions { display: flex; justify-content: center; gap: 0.55rem; }

.k10-btn { padding: 0.45rem 1.1rem; border-radius: 6px; font-size: 0.78rem; font-weight: 700; cursor: pointer; border: none; transition: all 0.15s ease; }
.k10-btn-primary { background: #0284c7; color: #ffffff; }
.k10-btn-primary:hover { background: #0369a1; }
.k10-btn-danger  { background: #dc2626; color: #ffffff; }
.k10-btn-danger:hover { background: #b91c1c; }
.k10-btn-cancel  { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.k10-btn-cancel:hover { background: #e2e8f0; color: #0f172a; }

@keyframes k10FadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes k10ScaleUp { from { transform: scale(0.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.2);
    max-height: 180px;
    overflow-y: auto;
    z-index: 10500;
}

.autocomplete-item {
    padding: 5px 8px;
    font-size: 0.74rem;
    color: #1e293b;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
}
.autocomplete-item:hover { background: #f0f9ff; color: #0284c7; }

/* Visibilidad */
.hidden { display: none !important; }

/* Responsividad */
@media (max-width: 1200px) { .modules-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 900px) { .modules-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .modules-grid { grid-template-columns: 1fr; } }