/* =========================================================
   THEME OFICIAL - DASHBOARD SAP BUSINESS ONE
   Base visual ejecutiva, sobria y profesional
   ========================================================= */

/* ---------------------------
   Variables globales
--------------------------- */
:root {
    --color-primary: #1f3a5f;
    --color-primary-2: #2d4f7c;
    --color-primary-soft: #eaf1f8;

    --color-bg: #f4f6f8;
    --color-surface: #ffffff;
    --color-surface-soft: #f8fafc;

    --color-text: #1f2937;
    --color-text-soft: #6b7280;
    --color-text-muted: #94a3b8;

    --color-border: #d9e2ec;
    --color-border-strong: #c3cfdb;

    --color-success: #2e7d57;
    --color-warning: #c7921e;
    --color-danger: #b54747;
    --color-info: #3d6ea8;

    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 6px 20px rgba(15, 23, 42, 0.08);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-7: 32px;

    --font-base: "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;

    --sidebar-width: 260px;
    --header-height: 72px;

    --transition-fast: 0.18s ease;
}

/* ---------------------------
   Reset base
--------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-base);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#react-entry-point,
._dash-app-content {
    min-height: 100vh;
    background: var(--color-bg);
}

/* ---------------------------
   Tipografía base
--------------------------- */
h1, h2, h3, h4, h5, h6 {
    margin: 0 0 var(--space-3);
    color: var(--color-text);
    font-weight: 700;
    line-height: 1.2;
}

h1 {
    font-size: 2rem;
    letter-spacing: -0.02em;
}

h2 {
    font-size: 1.5rem;
    letter-spacing: -0.01em;
}

h3 {
    font-size: 1.125rem;
}

h4 {
    font-size: 1rem;
}

p {
    margin: 0 0 var(--space-3);
    color: var(--color-text-soft);
}

small {
    color: var(--color-text-muted);
}

/* ---------------------------
   Links
--------------------------- */
a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-primary-2);
}

/* ---------------------------
   Layout general preparado
--------------------------- */
.app-shell {
    min-height: 100vh;
    display: flex;
    background: var(--color-bg);
}

.app-sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--color-primary);
    color: #fff;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: var(--shadow-sm);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
}

.app-sidebar-inner {
    padding: var(--space-6);
}

.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    margin-left: var(--sidebar-width);
}

.app-header {
    height: var(--header-height);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-6);
    box-shadow: var(--shadow-xs);
    position: sticky;
    top: 0;
    z-index: 900;
}

.app-content {
    padding: var(--space-6);
}

/* ---------------------------
   Compatibilidad con layout actual
--------------------------- */
.header {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-2));
    color: #ffffff;
    padding: 28px 36px;
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header h1 {
    color: #ffffff;
    margin-bottom: var(--space-2);
    font-size: 2rem;
    font-weight: 700;
}

.header p {
    color: rgba(255, 255, 255, 0.88);
    font-size: 1rem;
    margin: 0;
}

.dashboard-container {
    max-width: 1720px;
    margin: 0 auto;
    padding: var(--space-6);
}

/* ---------------------------
   Títulos de bloque / sección
--------------------------- */
.section-title,
.page-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: var(--space-4);
}

.section-subtitle,
.page-subtitle {
    font-size: 0.95rem;
    color: var(--color-text-soft);
    margin-top: -6px;
    margin-bottom: var(--space-5);
}

/* ---------------------------
   Cards base
--------------------------- */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-5);
    box-shadow: var(--shadow-xs);
    margin-bottom: var(--space-5);
    transition: box-shadow var(--transition-fast), border-color var(--transition-fast);
    width: 100%;
    min-width: 0;
}

.card:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--color-border-strong);
}

.card h3 {
    color: var(--color-primary);
    font-size: 1.05rem;
    margin-bottom: var(--space-4);
    font-weight: 700;
}

.card h4 {
    color: var(--color-text);
    font-weight: 700;
}

.card--compact {
    padding: var(--space-4);
}

.card--flat {
    box-shadow: none;
}

.card--highlight {
    border-left: 4px solid var(--color-primary);
}

/* ---------------------------
   KPI cards
--------------------------- */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}

.metric-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 18px 18px 16px;
    text-align: center;
    box-shadow: var(--shadow-xs);
    min-height: 132px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.metric-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
    border-color: var(--color-border-strong);
}

.metric-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-soft);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: center;
    margin-bottom: var(--space-3);
}

.metric-value {
    font-size: clamp(1.7rem, 2.2vw, 2.5rem);
    font-weight: 700;
    line-height: 1.08;
    color: var(--color-primary-2);
    text-align: center;
    word-break: break-word;
    overflow-wrap: anywhere;
    margin-bottom: var(--space-2);
}

.metric-subtitle {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    text-align: center;
    margin-top: var(--space-1);
}

.metric-card.is-money .metric-value,
.metric-value.is-money {
    font-size: clamp(1.35rem, 1.8vw, 2rem);
    letter-spacing: -0.02em;
}

.metric-card.success {
    border-left: 4px solid var(--color-success);
}

.metric-card.warning {
    border-left: 4px solid var(--color-warning);
}

.metric-card.danger {
    border-left: 4px solid var(--color-danger);
}

.metric-card.info {
    border-left: 4px solid var(--color-info);
}

/* ---------------------------
   Filtros / formularios
--------------------------- */
label {
    display: inline-block;
    margin-bottom: var(--space-2);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text);
}

input,
select,
textarea,
button {
    font-family: var(--font-base);
}

/* Grid específico para filtros */
.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

/* Dash Dropdown */
.Select-control,
.Select-menu-outer,
.DateInput_input,
.DateInput,
.SingleDatePickerInput,
.DateRangePickerInput {
    border-radius: var(--radius-sm) !important;
}

.Select-control {
    min-height: 42px !important;
    border: 1px solid var(--color-border) !important;
    box-shadow: none !important;
    background: var(--color-surface) !important;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast) !important;
}

.Select-control:hover {
    border-color: var(--color-border-strong) !important;
}

.is-focused:not(.is-open) > .Select-control,
.Select.is-focused > .Select-control {
    border-color: var(--color-primary-2) !important;
    box-shadow: 0 0 0 3px rgba(45, 79, 124, 0.12) !important;
}

.Select-placeholder,
.Select--single > .Select-control .Select-value {
    color: var(--color-text-soft) !important;
    padding-left: 12px !important;
    line-height: 40px !important;
}

.Select-input > input {
    color: var(--color-text) !important;
}

.Select-value-label {
    color: var(--color-text) !important;
}

.Select-menu-outer {
    border: 1px solid var(--color-border) !important;
    box-shadow: var(--shadow-sm) !important;
    background: var(--color-surface) !important;
    z-index: 1200 !important;
}

.Select-option {
    background: var(--color-surface) !important;
    color: var(--color-text) !important;
    padding: 10px 12px !important;
}

.Select-option.is-focused {
    background: var(--color-primary-soft) !important;
    color: var(--color-primary) !important;
}

.Select-option.is-selected {
    background: rgba(31, 58, 95, 0.1) !important;
    color: var(--color-primary) !important;
    font-weight: 600;
}

.Select--multi .Select-value {
    background: rgba(31, 58, 95, 0.08) !important;
    border: 1px solid rgba(31, 58, 95, 0.15) !important;
    border-radius: 8px !important;
    color: var(--color-primary) !important;
}

/* DatePicker */
.DateRangePickerInput,
.SingleDatePickerInput {
    border: 1px solid var(--color-border) !important;
    background: var(--color-surface) !important;
    border-radius: var(--radius-sm) !important;
    overflow: hidden !important;
}

.DateInput {
    background: transparent !important;
}

.DateInput_input {
    height: 42px !important;
    padding: 0 12px !important;
    font-size: 0.95rem !important;
    color: var(--color-text) !important;
    background: var(--color-surface) !important;
    border: none !important;
}

.DateInput_input__focused {
    border: none !important;
    box-shadow: inset 0 -2px 0 var(--color-primary-2) !important;
}

.DateRangePickerInput_arrow {
    color: var(--color-text-soft) !important;
}

/* ---------------------------
   Botones
--------------------------- */
button,
.btn {
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
    box-shadow: none;
}

button:hover,
.btn:hover {
    transform: translateY(-1px);
}

button:disabled,
.btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

button,
.btn-primary {
    background: var(--color-primary);
    color: #ffffff;
    border-color: var(--color-primary);
}

button:hover,
.btn-primary:hover {
    background: var(--color-primary-2);
    border-color: var(--color-primary-2);
}

.btn-secondary {
    background: var(--color-surface);
    color: var(--color-primary);
    border-color: var(--color-border);
}

.btn-secondary:hover {
    background: var(--color-primary-soft);
    border-color: var(--color-border-strong);
}

.btn-success {
    background: var(--color-success);
    color: #ffffff;
    border-color: var(--color-success);
}

.btn-warning {
    background: var(--color-warning);
    color: #ffffff;
    border-color: var(--color-warning);
}

.btn-danger {
    background: var(--color-danger);
    color: #ffffff;
    border-color: var(--color-danger);
}

/* ---------------------------
   Tabs
--------------------------- */
.tab,
.custom-tab {
    font-weight: 600;
}

.dash-tabs,
.dcc-tabs,
div[role="tablist"] {
    background: transparent;
}

.tab,
div[role="tab"] {
    background: var(--color-surface) !important;
    border: 1px solid var(--color-border) !important;
    border-bottom: none !important;
    color: var(--color-text-soft) !important;
    padding: 14px 18px !important;
    font-size: 0.95rem !important;
    font-weight: 600 !important;
    transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast) !important;
}

.tab--selected,
div[role="tab"][aria-selected="true"] {
    background: var(--color-surface) !important;
    color: var(--color-primary) !important;
    border-top: 3px solid var(--color-primary) !important;
    box-shadow: inset 0 1px 0 #fff;
}

.tab:hover,
div[role="tab"]:hover {
    color: var(--color-primary) !important;
    background: var(--color-surface-soft) !important;
}

.tab-content,
.tabs-content,
#compras-tab-content {
    margin-top: var(--space-5);
    min-width: 0;
}

/* ---------------------------
   Tablas
--------------------------- */
.dash-table-container {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    width: 100%;
    overflow-x: auto;
}

.dash-spreadsheet-container {
    border: 1px solid var(--color-border) !important;
    border-radius: var(--radius-md) !important;
    overflow-x: auto !important;
    overflow-y: auto !important;
    box-shadow: var(--shadow-xs);
    background: var(--color-surface);
    width: 100%;
    max-width: 100%;
}

.dash-spreadsheet-inner table {
    border-collapse: separate !important;
    border-spacing: 0 !important;
    min-width: max-content !important;
}

.dash-spreadsheet-inner th {
    background: #eef3f8 !important;
    color: var(--color-text) !important;
    font-size: 0.84rem !important;
    font-weight: 700 !important;
    border-bottom: 1px solid var(--color-border) !important;
    border-right: 1px solid #e7edf3 !important;
    padding: 10px 12px !important;
    text-align: left !important;
}

.dash-spreadsheet-inner td {
    background: var(--color-surface) !important;
    color: var(--color-text) !important;
    font-size: 0.84rem !important;
    border-bottom: 1px solid #edf2f7 !important;
    border-right: 1px solid #f1f5f9 !important;
    padding: 9px 12px !important;
}

.dash-spreadsheet-inner tr:hover td {
    background: #f8fbff !important;
}

.dash-spreadsheet-menu {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

/* ---------------------------
   Alerts / debug / estados
--------------------------- */
.alert,
.debug-box,
.status-box {
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    box-shadow: var(--shadow-xs);
    margin-bottom: var(--space-4);
}

.status-success,
.text-success {
    color: var(--color-success) !important;
}

.status-warning,
.text-warning {
    color: var(--color-warning) !important;
}

.status-danger,
.text-danger {
    color: var(--color-danger) !important;
}

.status-info,
.text-info {
    color: var(--color-info) !important;
}

/* ---------------------------
   Plotly graph wrappers
--------------------------- */
.graph-container,
.plot-card,
.js-plotly-plot {
    border-radius: var(--radius-sm);
    min-width: 0;
}

.card .js-plotly-plot .plotly .main-svg {
    border-radius: var(--radius-sm);
}

/* ---------------------------
   Sidebar listo para futura fase
--------------------------- */
.sidebar-title {
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: var(--space-5);
}

.sidebar-section {
    margin-bottom: var(--space-6);
}

.sidebar-section-title {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.65);
    margin-bottom: var(--space-3);
    font-weight: 700;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.9);
    transition: background var(--transition-fast), color var(--transition-fast);
    margin-bottom: 6px;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.sidebar-link.active {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    font-weight: 700;
}

/* ---------------------------
   Header listo para futura fase
--------------------------- */
.header-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-text);
}

.header-subtitle {
    font-size: 0.88rem;
    color: var(--color-text-soft);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ---------------------------
   Helpers utilitarios
--------------------------- */
.text-muted {
    color: var(--color-text-muted) !important;
}

.text-soft {
    color: var(--color-text-soft) !important;
}

.text-primary {
    color: var(--color-primary) !important;
}

.bg-surface {
    background: var(--color-surface) !important;
}

.border-soft {
    border: 1px solid var(--color-border) !important;
}

.shadow-soft {
    box-shadow: var(--shadow-xs) !important;
}

.rounded-soft {
    border-radius: var(--radius-md) !important;
}

.w-full {
    width: 100% !important;
}

/* ---------------------------
   Scrollbar
--------------------------- */
* {
    scrollbar-width: thin;
    scrollbar-color: #b7c4d1 transparent;
}

*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background: #c5d0db;
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: content-box;
}

*::-webkit-scrollbar-thumb:hover {
    background: #aebbc7;
    background-clip: content-box;
}

/* =========================================================
   Mejoras UX - sidebar colapsable / tablas / header
   ========================================================= */

.app-main {
    transition: margin-left var(--transition-fast), width var(--transition-fast);
}

.app-sidebar {
    transition: width var(--transition-fast), min-width var(--transition-fast), transform var(--transition-fast);
}

.app-sidebar.collapsed {
    width: 78px;
    min-width: 78px;
}

.app-main.sidebar-collapsed {
    margin-left: 78px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: var(--space-6);
}

.sidebar-brand-icon {
    min-width: 40px;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.9rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-link-icon {
    min-width: 34px;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.74rem;
    font-weight: 700;
    color: #ffffff;
}

.sidebar-link-text {
    white-space: nowrap;
}

.app-sidebar.collapsed .sidebar-title,
.app-sidebar.collapsed .sidebar-section-title,
.app-sidebar.collapsed .sidebar-link-text {
    display: none;
}

.app-sidebar.collapsed .sidebar-brand {
    justify-content: center;
}

.app-sidebar.collapsed .sidebar-link {
    justify-content: center;
    padding-left: 8px;
    padding-right: 8px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.sidebar-toggle-btn {
    min-width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-primary);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: var(--shadow-xs);
}

.sidebar-toggle-btn:hover {
    background: var(--color-primary-soft);
    border-color: var(--color-border-strong);
}

.card .dash-table-container,
.card .dash-spreadsheet-container {
    width: 100%;
    overflow-x: auto;
}

details.card summary {
    list-style: none;
}

details.card summary::-webkit-details-marker {
    display: none;
}

details.card summary::before {
    content: "▸";
    display: inline-block;
    margin-right: 8px;
    transition: transform var(--transition-fast);
}

details[open].card summary::before {
    transform: rotate(90deg);
}

@media (max-width: 1200px) {
    .dashboard-container,
    .app-content {
        padding: var(--space-5);
    }

    .metrics-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
}

@media (max-width: 992px) {
    .app-main {
        margin-left: 0 !important;
    }

    .app-sidebar {
        width: 78px;
        min-width: 78px;
    }

    .app-sidebar .sidebar-title,
    .app-sidebar .sidebar-section-title,
    .app-sidebar .sidebar-link-text {
        display: none;
    }

    .app-sidebar .sidebar-brand {
        justify-content: center;
    }

    .app-sidebar .sidebar-link {
        justify-content: center;
    }

    .header {
        padding: 24px 20px;
    }

    .header h1 {
        font-size: 1.75rem;
    }
}

@media (max-width: 768px) {
    .dashboard-container,
    .app-content {
        padding: var(--space-4);
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .metric-card {
        min-height: 118px;
    }

    .metric-value {
        font-size: clamp(1.4rem, 6vw, 2rem);
    }

    .header {
        padding: 20px 16px;
    }

    .header h1 {
        font-size: 1.55rem;
    }

    .header p {
        font-size: 0.92rem;
    }

    div[role="tab"] {
        padding: 12px 14px !important;
        font-size: 0.9rem !important;
    }
}
/* =========================================================
   Portal base: login, home, header de usuario
   Agregado por core/auth + app.py al cerrar la etapa de Compras.
   ========================================================= */

/* --- Sidebar oculto en login / sin sesión --- */
.app-main.full-width {
    margin-left: 0 !important;
    width: 100% !important;
}

/* --- Login --- */
.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-6);
    background: var(--color-background, #F5F7FA);
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 6px 24px rgba(15, 23, 42, 0.08);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.login-brand {
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #64748b;
}

.login-title {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
    color: #0f172a;
}

.login-subtitle {
    margin: 0 0 8px 0;
    font-size: 0.9rem;
}

.login-input {
    height: 42px;
}

.login-submit {
    height: 42px;
    width: 100%;
    margin-top: 4px;
    font-weight: 600;
}

.login-error {
    min-height: 20px;
    color: #b91c1c;
    font-size: 0.88rem;
    text-align: center;
}

/* --- Header: bloque de usuario y logout --- */
.header-user-block {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.2;
    margin-right: 12px;
}

.header-user-name {
    font-size: 0.92rem;
    font-weight: 600;
    color: #0f172a;
}

.header-user-role {
    font-size: 0.78rem;
}

.app-header .header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --- Home: tarjetas de módulos --- */
.home-shell {
    padding: var(--space-6, 24px);
}

.home-title {
    font-size: 1.6rem;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 4px;
}

.home-subtitle {
    margin-bottom: 24px;
    font-size: 0.95rem;
}

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

.home-card-link {
    text-decoration: none;
    color: inherit;
}

.home-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 22px;
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 150px;
}

.home-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08);
    border-color: #cbd5e1;
}

.home-card.disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.home-card.disabled:hover {
    transform: none;
    box-shadow: none;
    border-color: #e5e7eb;
}

.home-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #0f172a;
}

.home-card-desc {
    font-size: 0.88rem;
    color: #475569;
    flex-grow: 1;
}

.home-card-action {
    font-size: 0.85rem;
    font-weight: 600;
    color: #0070F3;
}

.home-card-action.muted {
    color: #94a3b8;
}

/* --- Módulo en construcción --- */
.module-empty-shell {
    padding: var(--space-6, 24px);
}

.module-empty-card {
    max-width: 720px;
}

.module-empty-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 8px;
}

.module-empty-desc {
    font-size: 0.95rem;
    color: #475569;
    margin-bottom: 8px;
}

.module-empty-status {
    font-size: 0.85rem;
}

/* =========================================================
   Modulo Balance: filtros, KPIs, grids, tabs
   ========================================================= */
.bal-shell {
    padding: var(--space-6, 24px);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.bal-module-header {
    margin-bottom: 4px;
}

.bal-module-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #0f172a;
    margin: 0;
}

.bal-module-subtitle {
    font-size: 0.95rem;
    margin-top: 2px;
}

/* Filtros */
.bal-filters-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px;
}

.bal-filters-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    align-items: end;
}

.bal-filter {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.bal-filter-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 2px;
}

.bal-filter-input { width: 100%; }

.bal-refresh-btn { width: 100%; }

/* Tabs */
.bal-tabs { margin-top: 4px; }
.bal-tab-content { margin-top: 12px; }

/* Section title */
.bal-section-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #0f172a;
    margin: 8px 0 4px 0;
}

/* KPI grid */
.bal-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 14px;
}

.bal-kpi-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 100px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.bal-kpi-label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
}

.bal-kpi-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
}

.bal-kpi-foot {
    font-size: 0.78rem;
    font-weight: 500;
    margin-top: auto;
}

/* Grids 2 columnas */
.bal-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

@media (max-width: 1100px) {
    .bal-grid-2 { grid-template-columns: 1fr; }
}

.bal-mini-controls {
    padding: 14px;
    margin-bottom: 12px;
}

/* =========================================================
   ui_components: alert, error_card, empty_card
   ========================================================= */
.ui-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 10px;
    border-left: 4px solid #f59e0b;
    background: #fffbeb;
    color: #92400e;
    font-size: 0.9rem;
    margin-bottom: 6px;
}

.ui-alert-warning { border-left-color: #f59e0b; background: #fffbeb; color: #92400e; }
.ui-alert-info    { border-left-color: #3b82f6; background: #eff6ff; color: #1e40af; }

.ui-alert-tag {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(0,0,0,0.06);
    flex-shrink: 0;
    margin-top: 1px;
}

.ui-alert-text { line-height: 1.4; }

.ui-error-card {
    border-left: 4px solid #dc2626;
    background: #fef2f2;
}

.ui-error-title {
    color: #991b1b;
    margin: 0 0 4px 0;
    font-size: 1.05rem;
    font-weight: 600;
}

.ui-error-msg {
    color: #7f1d1d;
    font-size: 0.92rem;
    margin: 0 0 8px 0;
    word-break: break-word;
}

.ui-empty-card {
    text-align: center;
    padding: 24px;
    border: 1px dashed #cbd5e1;
    background: #fafbfc;
}

.ui-empty-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 6px;
}

.ui-empty-msg {
    margin: 0;
    font-size: 0.92rem;
}

/* =========================================================
   Modulo Estado de Resultados v2 - UX mejorada
   ========================================================= */

.er-shell {
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ---------- KPIs hero (fila principal) ---------- */
.er-kpi-hero-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 4px;
}

.er-kpi-hero {
    padding: 20px 22px !important;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
    min-height: 130px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.er-kpi-hero-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #475569;
}

.er-kpi-hero-value {
    font-size: 1.85rem;
    font-weight: 700;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.er-kpi-hero-foot {
    font-size: 0.78rem;
    color: #64748b;
    margin-top: auto;
}

/* ---------- KPIs secundarios (fila inferior) ---------- */
.er-kpi-sec-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 4px;
}

.er-kpi-sec {
    padding: 12px 14px !important;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    min-height: 78px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.er-kpi-sec-label {
    font-size: 0.74rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
}

.er-kpi-sec-value {
    font-size: 1.15rem;
    font-weight: 600;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
}

/* ---------- Insights compactos en una sola card ---------- */
.er-insights-card {
    padding: 18px 22px;
}

.er-insights-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e7eb;
}

.er-insights-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #0f172a;
}

.er-insights-badge {
    background: #eff6ff;
    color: #1e40af;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
}

.er-insights-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 8px 18px;
}

.er-insight-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.92rem;
    line-height: 1.4;
    padding: 6px 0;
}

.er-insight-icon {
    flex-shrink: 0;
    font-weight: 700;
    margin-top: 1px;
}

.er-insight-text {
    color: #0f172a;
}

/* ---------- Matriz ERI (mensual / YTD) ---------- */
.er-matrix-card {
    padding: 16px 18px !important;
    width: 100%;
}

/* Forzar ancho 100% del DataTable */
.er-shell .dash-spreadsheet,
.er-shell .dash-spreadsheet-container,
.er-shell .dash-spreadsheet-inner {
    width: 100% !important;
    max-width: 100% !important;
}

.er-shell .dash-spreadsheet table {
    width: 100% !important;
}

/* Que la primera columna fija no se rompa visualmente */
.er-shell td.dash-fixed-column,
.er-shell th.dash-fixed-column {
    background: #ffffff !important;
    border-right: 2px solid #cbd5e1 !important;
}

/* ---------- Ratios cards ---------- */
.er-ratio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 6px;
}

.er-ratio-card {
    padding: 18px 20px !important;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 110px;
}

.er-ratio-label {
    font-size: 0.80rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #475569;
}

.er-ratio-value {
    font-size: 1.7rem;
    font-weight: 700;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
}

.er-ratio-diag {
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: auto;
}

/* ---------- Detalle jerárquico fallback (html.Details) ---------- */
.er-detail-hierarchy {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.er-detail-tipo > summary {
    background: #1e3a8a;
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    list-style: none;
}

.er-detail-tipo > summary::-webkit-details-marker { display: none; }

.er-detail-tipo[open] > summary {
    border-radius: 8px 8px 0 0;
}

.er-detail-n4 > summary {
    background: #eff6ff;
    color: #1e3a8a;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    list-style: none;
    margin-bottom: 4px;
}

.er-detail-n4 > summary::-webkit-details-marker { display: none; }

.er-detail-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 6px;
    font-size: 0.88rem;
}

.er-detail-table th {
    background: #f8fafc;
    color: #0f172a;
    font-weight: 600;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
}

.er-detail-table td {
    padding: 6px 12px;
    border: 1px solid #f1f5f9;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
}

.er-detail-table tfoot td {
    background: #f1f5f9;
    border-top: 2px solid #cbd5e1;
}

/* ---------- Ocultar overlays externos molestos en /estado-resultados ---------- */
/* Botones flotantes (Dash dev tools, MCP, etc.) - ocultar en este modulo */
.er-shell ~ .dash-debug-menu,
.er-shell ~ .dash-debug-menu__outer {
    display: none !important;
}

/* ---------- Espaciado consistente ---------- */
.er-shell .card {
    padding: 16px 18px;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
}

.er-shell .bal-grid-2 {
    gap: 16px;
}

/* Altura consistente para los Graph */
.er-shell .js-plotly-plot {
    width: 100% !important;
}

/* ---------- Badges de signo (positivo verde, negativo rojo) ---------- */
.er-positive { color: #059669 !important; }
.er-negative { color: #dc2626 !important; }

/* =========================================================
   Matriz jerarquica ag-grid (Detalle Jerarquico mensual / YTD)
   ========================================================= */

/* Celdas con valores positivos / negativos */
.er-aggrid .er-cell-positive { color: #059669 !important; }
.er-aggrid .er-cell-negative { color: #dc2626 !important; }

/* Header del ag-grid */
.er-aggrid .ag-header-cell {
    background: #1e293b;
    color: white;
    font-weight: 600;
}

.er-aggrid .ag-header-cell-text {
    color: white;
}

/* Filas (alturas y tipografia) */
.er-aggrid .ag-row {
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.er-aggrid .ag-cell {
    border-right: 1px solid #f1f5f9;
}

/* Filas agrupadas (TipoCuenta -> N4 -> ...) con peso visual */
.er-aggrid .ag-row-group {
    background: #f8fafc;
    font-weight: 600;
}
.er-aggrid .ag-row-group-expanded {
    background: #eff6ff;
    color: #1e3a8a;
}

/* Primera columna (Concepto) pinned */
.er-aggrid .ag-pinned-left-cols-container .ag-cell {
    background: #ffffff;
    border-right: 2px solid #cbd5e1 !important;
}
.er-aggrid .ag-pinned-left-cols-container .ag-row-group {
    background: #f8fafc;
}
.er-aggrid .ag-pinned-left-cols-container .ag-row-group-expanded {
    background: #eff6ff;
}

/* Iconos +/- de expansion mas visibles */
.er-aggrid .ag-icon-tree-closed,
.er-aggrid .ag-icon-tree-open {
    color: #1e40af;
    font-weight: 700;
}

/* Hover */
.er-aggrid .ag-row:hover {
    background: #fef3c7 !important;
}

/* Scroll horizontal con sombra suave */
.er-aggrid .ag-body-horizontal-scroll {
    border-top: 1px solid #e5e7eb;
}

/* =========================================================
   Matriz jerarquica MENSUAL V3 - filas calculadas y % por mes
   ========================================================= */

/* Columnas de % - fondo celeste suave */
.er-aggrid-monthly .er-cell-pct {
    background: #f0f9ff !important;
    color: #0369a1 !important;
    font-weight: 500;
    font-size: 0.85em;
}

/* Filas calculadas (Resultado Bruto / Operativo / Neto) */
.er-aggrid-monthly .ag-row.er-row-calc {
    background: #1e40af !important;
    color: white !important;
    font-weight: 700 !important;
}
.er-aggrid-monthly .ag-row.er-row-calc .ag-cell {
    color: white !important;
    border-color: #1e3a8a !important;
}
.er-aggrid-monthly .ag-row.er-row-calc .er-cell-pct {
    background: #1e3a8a !important;
    color: #93c5fd !important;
}
.er-aggrid-monthly .ag-row.er-row-calc.ag-row-hover {
    background: #1e3a8a !important;
}

/* Negativos en rojo claro dentro de filas calculadas */
.er-aggrid-monthly .ag-row.er-row-calc .er-cell-negative {
    color: #fca5a5 !important;
}
.er-aggrid-monthly .ag-row.er-row-calc .er-cell-positive {
    color: #86efac !important;
}

/* Fila Margen Neto % - estilo distinto */
.er-aggrid-monthly .ag-row.er-row-margen {
    background: #fef3c7 !important;
    color: #78350f !important;
    font-weight: 700 !important;
    font-style: italic;
}
.er-aggrid-monthly .ag-row.er-row-margen .ag-cell {
    color: #78350f !important;
}
.er-aggrid-monthly .ag-row.er-row-margen .er-cell-pct {
    background: #fde68a !important;
    color: #78350f !important;
}
.er-aggrid-monthly .ag-row.er-row-margen.ag-row-hover {
    background: #fde68a !important;
}

/* Boton +/- mas visible */
.er-aggrid-monthly .ag-icon-tree-closed,
.er-aggrid-monthly .ag-icon-tree-open {
    color: #1e40af !important;
    font-size: 1.1em !important;
    font-weight: 800;
}

/* Nombre del concepto bien visible (autoGroupColumnDef pinned) */
.er-aggrid-monthly .ag-group-value {
    color: #0f172a;
    font-weight: 500;
}

/* Altura de filas un poco mayor para mejor lectura */
.er-aggrid-monthly .ag-row {
    line-height: 38px;
    font-size: 13px;
}

/* =========================================================
   Panel administrador — ajustes visuales Fase 6B
   ========================================================= */

/* Espacio entre cards del panel admin */
.admin-form {
    margin-bottom: 20px;
}

/* Separación vertical entre filas del formulario */
.admin-form .admin-form-row {
    margin-bottom: 16px;
}

/* Inputs y dropdowns ocupan todo el ancho de su columna */
.admin-form .admin-field,
.admin-form .admin-field input,
.admin-form .admin-field .Select,
.admin-form .admin-field .Select-control,
.admin-form .admin-field .dash-dropdown {
    width: 100% !important;
}

/* Texto de ayuda debajo de un campo */
.admin-form .admin-help {
    font-size: 11px;
    margin-top: 2px;
    color: #94a3b8;
}

/* Columna del botón "Crear usuario": alinear con la base de los inputs */
.admin-form .admin-form-action-col {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
}

.admin-form .admin-form-action-btn {
    min-width: 160px;
    height: 38px;
}

/* Bloque de botones (Guardar / Activar / Desactivar) en Editar */
.admin-form .admin-form-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border, #d9e2ec);
}

.admin-form .admin-form-buttons .btn {
    min-width: 160px;
}

/* Mensajes y notas */
.admin-form .admin-form-msg {
    margin-top: 14px;
}

.admin-form .admin-form-notes {
    margin-top: 6px;
    font-size: 12px;
}

/* =========================================================
   Dropdowns abiertos: que no se monten sobre la tabla.
   El menú flotante de dcc.Dropdown necesita z-index alto
   para quedar por encima de tablas y AgGrid.
   ========================================================= */
.admin-form .Select-menu-outer,
.admin-form .Select-menu,
.admin-form .VirtualizedSelectFocusedOption,
.admin-form .dash-dropdown .Select-menu-outer {
    z-index: 1050 !important;
}

/* Selector de empresa del header también, por consistencia. */
.header-company-block .Select-menu-outer {
    z-index: 1050 !important;
}

/* Margen pequeño sobre la tabla de usuarios para no quedar
   pegada al bloque de edición. */
#admin-users-table {
    margin-top: 4px;
}

/* =========================================================
   Panel administrador — refinamientos Fase 6C (UX pulido)
   ========================================================= */

/* Subtítulo descriptivo bajo cada H3 de sección admin */
.admin-section-subtitle {
    font-size: 12px;
    margin-top: -4px;
    margin-bottom: 14px;
    line-height: 1.4;
    color: #64748b;
}

/* Mensaje de feedback (éxito/error) con borde izquierdo tipo callout.
   Usamos un color neutro por defecto; el carácter ✓/✕ al inicio del
   mensaje ya marca visualmente el estado. */
.admin-form .admin-form-msg {
    margin-top: 14px;
    padding: 8px 12px;
    border-left: 3px solid var(--color-border-strong, #c3cfdb);
    background: var(--color-surface-soft, #f8fafc);
    border-radius: 2px;
    font-size: 13px;
    line-height: 1.4;
    min-height: 0;
}

.admin-form .admin-form-msg:empty {
    display: none;
}

/* Acción destructiva: que se vea más prominente sin ser ruidosa */
.admin-form .admin-form-buttons #admin-btn-deactivate {
    margin-left: auto;
}

/* Mensaje genérico de la sección "Acciones rápidas" */
#admin-message {
    margin-top: 14px;
    padding: 8px 12px;
    border-left: 3px solid var(--color-border-strong, #c3cfdb);
    background: var(--color-surface-soft, #f8fafc);
    border-radius: 2px;
    font-size: 13px;
    line-height: 1.4;
}

#admin-message:empty {
    display: none;
}

/* Tabla de auditoría: columnas más compactas y legibles */
#admin-audit-table {
    margin-top: 8px;
}

/* Cuando una columna "Detalles" tenga texto largo, romper línea
   (mantenido para compatibilidad si algún fallback usa <td>). */
#admin-audit-table td {
    word-break: break-word;
}

/* =========================================================
   Panel administrador — AgGrid (Fase 6C, migración a AG Grid)
   ========================================================= */

/* Wrapper común para los dos AgGrid del panel admin. */
.admin-aggrid {
    margin-top: 6px;
    font-size: 13px;
}

/* Header un poco más compacto y consistente con el resto del portal. */
.admin-aggrid .ag-header-cell-label {
    font-weight: 600;
}

/* Filas con altura un poco mayor para mejor lectura, igual que
   er-aggrid en estado_resultados. */
.admin-aggrid .ag-row {
    line-height: 36px;
}

/* Floating filter más bajo de altura para no comer mucho espacio. */
.admin-aggrid .ag-header-row-floating-filter {
    height: 30px;
}

/* =========================================================
   Vista imprimible — Estado de Cuenta (Fase 10A.7D)
   Estilos sobrios + regla @media print delimitada a .cc-print-area.
   ========================================================= */
.cc-print-area { background: #fff; color: #111827; }
.cc-print-title { margin: 0 0 6px; }
.cc-print-header > div { font-size: 13px; margin: 1px 0; }
.cc-print-lbl { font-weight: 600; }
.cc-print-section {
    margin: 16px 0 6px;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 3px;
    font-size: 15px;
}
.cc-print-summary {
    display: flex; flex-wrap: wrap; gap: 8px 22px; margin-bottom: 8px;
}
.cc-print-kpi-label { font-size: 11px; color: #6b7280; }
.cc-print-kpi-value { font-size: 15px; font-weight: 600; }
.cc-print-table {
    width: 100%; border-collapse: collapse; font-size: 12px;
    margin-bottom: 10px;
}
.cc-print-table th, .cc-print-table td {
    border: 1px solid #d1d5db; padding: 4px 6px;
}
.cc-print-table thead th { background: #f3f4f6; text-align: left; }
.cc-print-footer { margin-top: 14px; font-size: 12px; }
.cc-print-subtitle { color: #6b7280; font-size: 13px; margin: 0 0 8px; }
.cc-print-meta > div { font-size: 13px; margin: 1px 0; }
/* Boton "Vista imprimible" mas visible (parece accion, no texto). */
.cc-print-btn { font-weight: 600; }

@media print {
    /* Imprimir SOLO el reporte (.cc-print-area); ocultar el resto. */
    body * { visibility: hidden !important; }
    .cc-print-area, .cc-print-area * { visibility: visible !important; }

    /* Neutralizar el contenedor del modal para que el reporte no quede
       recortado ni desplazado (overflow/transform/altura del modal). */
    #cc-ec-print-modal,
    #cc-ec-print-modal .modal-dialog,
    #cc-ec-print-modal .modal-content,
    #cc-ec-print-modal .modal-body {
        position: static !important;
        transform: none !important;
        overflow: visible !important;
        max-width: none !important;
        max-height: none !important;
        height: auto !important;
        box-shadow: none !important;
        border: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
    }

    .cc-print-area {
        position: absolute !important;
        left: 0; top: 0; width: 100%;
        padding: 0; margin: 0;
        background: #fff !important;
    }

    /* Ocultar controles no imprimibles (header/footer del modal, etc.). */
    .cc-print-noprint { display: none !important; }

    /* Margenes A4 razonables. */
    @page { margin: 12mm; }
}

/* =========================================================
   Dropdown de Cliente — Estado de Cuenta (Fase 10A.7E pulido)
   Solo afecta a .cc-ec-cliente-dropdown (nombres de cliente largos).
   ========================================================= */
.cc-ec-cliente-dropdown .Select-control,
.cc-ec-cliente-dropdown .Select-placeholder,
.cc-ec-cliente-dropdown .Select-value-label,
.cc-ec-cliente-dropdown .Select-input > input {
    font-size: 12px;
}
.cc-ec-cliente-dropdown .Select-value-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cc-ec-cliente-dropdown .Select-menu-outer,
.cc-ec-cliente-dropdown .Select-menu {
    font-size: 12px;
}
.cc-ec-cliente-dropdown .VirtualizedSelectOption {
    font-size: 12px;
    line-height: 15px;
    padding: 6px 10px;
    white-space: normal;        /* permite 2 líneas para nombres largos */
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
}

/* =======================================================================
   MARCO + LAUNCHER — pulido visual (prototipo)              [UX Marco v1]
   Bloque ADITIVO: gana por orden de cascada. Para revertir, borrá desde
   este comentario hasta el cierre "FIN UX Marco v1".
   Solo toca el MARCO (login, sidebar, header, home). NO toca módulos.
   ======================================================================= */

/* ---------- Login: tarjeta sobre fondo navy ---------- */
.login-shell {
    min-height: 100vh;
    background: radial-gradient(1200px 600px at 70% -10%, #27497a, #16293f 60%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.login-card {
    width: 400px;
    max-width: 100%;
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(10, 25, 50, 0.35);
    padding: 34px 32px;
}
.login-brand {
    font-weight: 700;
    color: var(--color-primary);
    font-size: 1.15rem;
    margin-bottom: 6px;
}
.login-title {
    color: var(--color-primary);
}

/* ---------- Sidebar ---------- */
.sidebar-brand-icon {
    background: linear-gradient(135deg, #3B82C4, #2E6CA4);
    color: #fff;
    border-radius: 8px;
    font-weight: 700;
}
.sidebar-section-title {
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-size: 0.7rem;
    color: var(--color-text-muted);
}
.sidebar-link {
    border-radius: 9px;
}
.sidebar-link.active {
    background: var(--color-primary);
    color: #fff;
}
.sidebar-link.active .sidebar-link-icon,
.sidebar-link.active .sidebar-link-text {
    color: #fff;
}
/* Etiquetas largas: nunca desbordar; ellipsis limpio dentro del flex.
   (.sidebar-link ya es display:flex; min-width:0 habilita el shrink). */
.sidebar-link-text {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- Header ---------- */
.header-user-name {
    font-weight: 600;
}
.header-user-role {
    font-size: 0.78rem;
}

/* ---------- Home / launcher ---------- */
.home-welcome {
    background: linear-gradient(120deg, var(--color-primary), #27497a);
    color: #fff;
    border-radius: 16px;
    padding: 22px 26px;
    margin-bottom: 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.home-welcome-title {
    font-size: 1.25rem;
    font-weight: 600;
}
.home-welcome-sub {
    opacity: 0.85;
    font-size: 0.9rem;
    margin-top: 3px;
}
.home-role-chip {
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 30px;
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}
.home-card {
    border-top: 4px solid var(--color-primary);
}
.home-card-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: var(--color-primary-soft);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}
.home-card-action::after {
    content: " \25B8"; /* ▸ */
}
/* ======================= FIN UX Marco v1 ============================= */
