/* ============================================
   OPTIKSUITE - Estilos globales
   Paleta basada en el logo oficial
   ============================================ */

:root {
    /* ==== MARCA (colores del logo) ==== */
    --marca: #007dfe;              /* Azul eléctrico - "OptiK" */
    --marca-hover: #0062c3;        /* Azul medio - centro del ojo */
    --marca-acento: #38cff3;       /* Cian brillante - alrededor del ojo */
    --marca-secundaria: #9b9fa7;   /* Gris azulado - "suite" */

    /* ==== BOTONES PRIMARIOS ==== */
    --primary: #007dfe;            /* Azul eléctrico */
    --primary-dark: #0062c3;       /* Azul medio (hover) */
    --primary-light: #38cff3;      /* Cian brillante (focus ring) */

    /* ==== FONDOS OSCUROS ==== */
    --sidebar-bg: #1e293b;
    --sidebar-border: #334155;
    --sidebar-text: #cbd5e1;
    --sidebar-text-muted: #94a3b8;
    --sidebar-hover-bg: #334155;
    --sidebar-active-bg: #007dfe;

    /* ==== FONDOS CLAROS ==== */
    --fondo-claro: #f1f5f9;

    /* ==== TEXTOS ==== */
    --texto-principal: #1e293b;
    --texto-secundario: #64748b;

    --marca-rgb: 0, 125, 254;    /* componente rgb para usar en rgba() */
    --marca-acento-rgb: 56, 207, 243;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--fondo-app);
    margin: 0;
    color: var(--texto-principal);
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

/* ============================================
   LAYOUT (Web)
   ============================================ */

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--fondo-app);
    margin: 0;
    padding: 0;
    color: var(--texto-principal);
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

.app-wrapper {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar-wrapper {
    width: 250px;
    flex-shrink: 0;
    height: 100vh;
    overflow-y: auto;
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    min-width: 0;
}

/* El contenido central con scroll */
#app-content {
    padding: 20px;
    flex-grow: 1;
    overflow-y: auto;
    min-height: 0;
}

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
    width: 250px;
    min-width: 250px;
    height: 100vh;
    position: sticky;
    top: 0;
    background: radial-gradient(circle at 20% 20%, var(--sidebar-grad-1) 0%, transparent 50%),
                radial-gradient(circle at 80% 90%, var(--sidebar-grad-2) 0%, transparent 50%),
                var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    padding: 12px 16px 16px 16px;
    overflow: hidden;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--sidebar-border);
    border-radius: 3px;
}

/* La marca del sidebar */
.sidebar-marca {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0 12px 0;
    margin: 0 0 16px 0;
    border-bottom: 1px solid var(--sidebar-border);
    text-decoration: none;
    flex-shrink: 0;
}

.sidebar-marca img {
    height: 82px;
    width: auto;
    display: block;
}

/* El menú interno con scroll propio */
#sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    flex-grow: 1;
    overflow-y: auto;
}

#sidebar-menu::-webkit-scrollbar {
    width: 4px;
}

#sidebar-menu::-webkit-scrollbar-track {
    background: transparent;
}

#sidebar-menu::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.3);
    border-radius: 4px;
    transition: background 0.2s;
}

#sidebar-menu::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.6);
}

/* Items raíz */
#sidebar-menu > li {
    margin-bottom: 4px;
}

/* Item directo (sin submenú) */
#sidebar-menu > li > a,
#sidebar-menu > li > button {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px 14px;
    border-radius: 6px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    background: transparent;
    border: none;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    line-height: 1.4;
}

#sidebar-menu > li > a i,
#sidebar-menu > li > button i {
    font-size: 16px;
    margin-right: 10px;
    flex-shrink: 0;
    width: 18px;
    text-align: center;
}

#sidebar-menu > li > a:hover,
#sidebar-menu > li > button:hover {
    background-color: var(--sidebar-hover-bg);
    color: #fff;
}

/* Item activo — versión botón (con submenú) */
#sidebar-menu > li > button.active {
    color: #fff;
    background-color: var(--sidebar-active-bg);
    box-shadow: 0 4px 12px rgba(var(--marca-rgb), 0.35);
    position: relative;
}

#sidebar-menu > li > button.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--marca-acento);
    border-radius: 0 3px 3px 0;
}

#sidebar-menu > li > button.active i {
    color: #fff;
}

/* Item padre activo (botón con submenú) — fondo sutil, jerarquía padre > hijo */
#sidebar-menu > li > button.active {
    color: #fff;
    background-color: rgba(var(--marca-rgb), 0.18);
    position: relative;
}

#sidebar-menu > li > button.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--marca-acento);
    border-radius: 0 3px 3px 0;
}

#sidebar-menu > li > button.active i {
    color: #fff;
}

/* Item activo */
#sidebar-menu > li > a.active {
    color: #fff;
    background-color: var(--sidebar-active-bg);
    box-shadow: 0 4px 12px rgba(var(--marca-rgb), 0.35);
    position: relative;
}

#sidebar-menu > li > a.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--marca-acento);
    border-radius: 0 3px 3px 0;
}

#sidebar-menu > li > a.active i {
    color: #fff;
}

/* Items con submenú */
#sidebar-menu .btn-toggle-custom {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#sidebar-menu .btn-toggle-custom i.chevron-icon {
    margin: 0;
    width: auto;
    font-size: 12px;
    transition: transform 0.2s;
}

/* Submenú */
.submenu {
    list-style: none;
    padding: 0;
    margin: 4px 0 4px 0;
    padding-left: 8px;
}

.submenu li a {
    display: flex;
    align-items: center;
    padding: 8px 14px;
    border-radius: 6px;
    color: var(--sidebar-text-muted);
    text-decoration: none;
    font-size: 13px;
    transition: background 0.15s, color 0.15s;
    line-height: 1.4;
}

.submenu li a i {
    font-size: 14px;
    margin-right: 8px;
    flex-shrink: 0;
    width: 16px;
    text-align: center;
    opacity: 0.7;
}

.submenu li a:hover {
    background-color: var(--sidebar-hover-bg);
    color: #fff;
}

.submenu li a:hover i {
    opacity: 1;
}

/* Subitem activo */
.submenu li a.active {
    background-color: var(--sidebar-active-bg);
    color: #fff;
    box-shadow: 0 4px 12px rgba(var(--marca-rgb), 0.35);
    position: relative;
}

.submenu li a.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--marca-acento);
    border-radius: 0 3px 3px 0;
}

.submenu li a.active i {
    opacity: 1;
}

/* Separador */
.sidebar-separador {
    height: 1px;
    background: var(--sidebar-border);
    margin: 8px 0;
    list-style: none;
    opacity: 0.6;
}

/* ============================================
   NAVBAR SUPERIOR
   ============================================ */

.navbar-superior {
    background: var(--fondo-navbar);
    border-bottom: 1px solid var(--borde-suave);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
}

.navbar-superior .titulo {
    font-weight: 600;
    font-size: 16px;
    color: var(--texto-principal);
}

.navbar-superior .usuario-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ============================================
   DROPDOWN DE USUARIO
   ============================================ */

.btn-usuario {
    display: flex;
    align-items: center;
    background: transparent;
    border: 1px solid var(--borde-suave);
    border-radius: 8px;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.15s;
    color: var(--texto-principal);
}

.btn-usuario:hover {
    background: var(--fondo-tabla-head);
    border-color: var(--texto-muted);
}

.usuario-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--marca);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-right: 10px;
    flex-shrink: 0;
}

.usuario-datos {
    text-align: left;
    line-height: 1.2;
}

.usuario-datos .usuario-nombre {
    font-size: 13px;
    font-weight: 600;
    color: var(--texto-principal);
}

.usuario-datos .usuario-rol {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--texto-secundario);
    letter-spacing: 0.5px;
    font-weight: 600;
}

.dropdown-menu {
    background: var(--fondo-dropdown);
    border: 1px solid var(--borde-suave);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 6px;
    min-width: 240px;
    margin-top: 8px;
}

.dropdown-item {
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--texto-principal);
    transition: all 0.15s;
}

.dropdown-item:hover {
    background: var(--fondo-tabla-hover);
    color: var(--marca);
}

.dropdown-item.text-danger:hover {
    background: var(--danger-bg);
    color: var(--danger-text);
}

.dropdown-divider {
    margin: 6px 0;
    border-color: var(--borde-suave);
}

/* ============================================
   CONTENIDO
   ============================================ */

#app-content {
    padding: 12px 20px;
    flex-grow: 1;
    overflow-y: auto;
    min-height: 0;
}

/* ============================================
   LOGIN
   ============================================ */

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 20% 50%, var(--sidebar-grad-1) 0%, transparent 50%),
                radial-gradient(circle at 80% 80%, var(--sidebar-grad-2) 0%, transparent 50%),
                var(--sidebar-bg);
    padding: 20px;
}

.login-card {
    background: var(--fondo-card);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 420px;
    padding: 40px;
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo h1 {
    font-size: 36px;
    font-weight: 700;
    margin: 0;
    letter-spacing: -1px;
    color: var(--texto-principal);
}

.login-logo .marca-primaria {
    color: var(--marca);
}

.login-logo .marca-secundaria {
    color: var(--texto-muted);
}

.login-logo p {
    color: var(--texto-secundario);
    font-size: 13px;
    margin: 8px 0 0;
}

/* ============================================
   DASHBOARD - Cards
   ============================================ */

.dashboard-titulo {
    font-size: 22px;
    font-weight: 700;
    color: var(--texto-principal);
    margin: 0 0 4px;
}

.dashboard-subtitulo {
    color: var(--texto-secundario);
    font-size: 14px;
    margin: 0;
}

.metrica-card {
    background: var(--fondo-card);
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-left: 4px solid transparent;
    transition: transform 0.15s, box-shadow 0.15s;
}

.metrica-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.metrica-card.border-primary { border-left-color: var(--marca); }
.metrica-card.border-success { border-left-color: var(--success); }
.metrica-card.border-info { border-left-color: var(--info); }
.metrica-card.border-warning { border-left-color: var(--warning); }

.metrica-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--texto-secundario);
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.metrica-valor {
    font-size: 28px;
    font-weight: 700;
    color: var(--texto-principal);
    margin: 0;
    line-height: 1.2;
}

.metrica-icono {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.metrica-icono.bg-primary-subtle { background: rgba(var(--marca-rgb), 0.12); color: var(--marca); }
.metrica-icono.bg-success-subtle { background: var(--success-bg); color: var(--success); }
.metrica-icono.bg-info-subtle { background: var(--info-bg); color: var(--info-text); }
.metrica-icono.bg-warning-subtle { background: var(--warning-bg); color: var(--warning-text); }

/* ============================================
   CARDS GENERALES
   ============================================ */

.card-optiksuite {
    background: var(--fondo-card);
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: none;
    overflow: hidden;
}

.card-optiksuite.card-fill {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.card-optiksuite.card-fill .table-responsive {
    flex-grow: 1;
    overflow-y: auto;
}

#app-content > .card-optiksuite:last-child {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

#app-content > .card-optiksuite:last-child .table-responsive {
    flex-grow: 1;
}

/* ============================================
   TABLAS
   ============================================ */

.table-optiksuite {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 0;
}

.table-optiksuite thead th {
    background: var(--fondo-tabla-head);
    padding: 12px 16px;
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--texto-secundario);
    font-weight: 600;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--borde-suave);
    white-space: nowrap;
}

.table-optiksuite tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--borde-tabla);
    font-size: 13px;
    color: var(--texto-principal);
    vertical-align: middle;
}

.table-optiksuite tbody tr:last-child td {
    border-bottom: none;
}

.table-optiksuite tbody tr:hover {
    background: var(--fondo-tabla-hover);
}

/* Badges */
.badge-soft-primary { background: rgba(var(--marca-rgb), 0.12); color: var(--marca); font-weight: 600; }
.badge-soft-success { background: var(--success-bg); color: var(--success-text); font-weight: 600; }
.badge-soft-info    { background: var(--info-bg); color: var(--info-text); font-weight: 600; }
.badge-soft-warning { background: var(--warning-bg); color: var(--warning-text); font-weight: 600; }
.badge-soft-danger  { background: var(--danger-bg); color: var(--danger-text); font-weight: 600; }
.badge-soft-secondary { background: var(--borde-suave); color: var(--texto-secundario); font-weight: 600; }

/* ============================================
   UTILIDADES
   ============================================ */

.cursor-pointer {
    cursor: pointer;
}

.text-small {
    font-size: 12px;
}

.spinner-carga {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--texto-secundario);
}

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

a:hover {
    color: var(--marca-hover);
}

/* Permitir que los dropdowns se vean por encima del table-responsive */
.table-responsive {
    overflow: visible !important;
}

/* ============================================
   BOTONES
   ============================================ */

.btn-primary {
    background: var(--marca);
    border-color: var(--marca);
    color: #ffffff;
    font-weight: 500;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.btn-primary:hover {
    background: color-mix(in srgb, var(--marca) 82%, #ffffff);
    border-color: color-mix(in srgb, var(--marca) 82%, #ffffff);
    color: #ffffff;
}

.btn-primary:active {
    background: color-mix(in srgb, var(--marca) 80%, #000000) !important;
    border-color: color-mix(in srgb, var(--marca) 80%, #000000) !important;
    color: #ffffff;
}

.btn-primary:focus,
.btn-primary:focus-visible {
    background: var(--marca);
    border-color: var(--marca);
    color: #ffffff;
    box-shadow: 0 0 0 0.25rem rgba(var(--marca-rgb), 0.35);
}

.btn-primary:disabled,
.btn-primary.disabled {
    background: color-mix(in srgb, var(--marca) 50%, #ffffff);
    border-color: color-mix(in srgb, var(--marca) 50%, #ffffff);
    opacity: 0.65;
}

/* ---- Outline primary ---- */

.btn-outline-primary {
    color: var(--marca);
    border-color: var(--marca);
    font-weight: 500;
    transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.btn-outline-primary:hover {
    background: var(--marca);
    border-color: var(--marca);
    color: #ffffff;
}

.btn-outline-primary:active {
    background: color-mix(in srgb, var(--marca) 80%, #000000) !important;
    border-color: color-mix(in srgb, var(--marca) 80%, #000000) !important;
    color: #ffffff;
}

.btn-outline-primary:focus,
.btn-outline-primary:focus-visible {
    box-shadow: 0 0 0 0.25rem rgba(var(--marca-rgb), 0.35);
}



/* ============================================
   PALETAS DE COLOR (tema por empresa)
   ============================================ */

:root {
    /* ==== MARCA (default: azul OptiKsuite) ==== */
    --marca: #007dfe;
    --marca-hover: #0062c3;
    --marca-acento: #38cff3;
    --marca-rgb: 0, 125, 254;
    --marca-acento-rgb: 56, 207, 243;

    /* ==== SIDEBAR (default: azul OptiKsuite) ==== */
    --sidebar-bg: #1e293b;
    --sidebar-grad-1: rgba(0, 125, 254, 0.08);
    --sidebar-grad-2: rgba(56, 207, 243, 0.06);
    --sidebar-border: #334155;
    --sidebar-hover-bg: #334155;
    --sidebar-active-bg: #007dfe;
    --sidebar-text: #cbd5e1;
    --sidebar-text-muted: #94a3b8;

    /* ==== SUPERFICIE (cambia con modo claro/oscuro) ==== */
    --fondo-app: #f1f5f9;
    --fondo-card: #ffffff;
    --fondo-navbar: #ffffff;
    --fondo-tabla-head: #f8fafc;
    --fondo-tabla-hover: #f8fafc;
    --fondo-input: #ffffff;
    --fondo-dropdown: #ffffff;

    /* ==== TEXTOS ==== */
    --texto-principal: #1e293b;
    --texto-secundario: #64748b;
    --texto-muted: #94a3b8;

    /* ==== BORDES ==== */
    --borde-suave: #e2e8f0;
    --borde-tabla: #f1f5f9;

    /* ==== ESTADOS SEMÁNTICOS (fijos para todas las paletas) ==== */
    --success: #10b981;
    --success-rgb: 16, 185, 129;
    --success-bg: #d1fae5;
    --success-text: #059669;

    --warning: #f59e0b;
    --warning-rgb: 245, 158, 11;
    --warning-bg: #fef3c7;
    --warning-text: #d97706;

    --info: #0891b2;
    --info-rgb: 8, 145, 178;
    --info-bg: #e0f7fe;
    --info-text: #0891b2;

    --danger: #dc2626;
    --danger-rgb: 220, 38, 38;
    --danger-bg: #fee2e2;
    --danger-text: #dc2626;
}

/* ==== MODO OSCURO ==== */
body[data-modo="oscuro"] {
    --fondo-app: #0f172a;
    --fondo-card: #1e293b;
    --fondo-navbar: #1e293b;
    --fondo-tabla-head: #263449;
    --fondo-tabla-hover: #263449;
    --fondo-input: #334155;
    --fondo-dropdown: #1e293b;

    --texto-principal: #f1f5f9;
    --texto-secundario: #cbd5e1;
    --texto-muted: #94a3b8;

    --borde-suave: #334155;
    --borde-tabla: #334155;

    color-scheme: dark;
}

/* ---- Paleta: Azul (DEFAULT — Manual de marca) ---- */
body[data-tema="azul"] {
    --marca: #007dfe;
    --marca-hover: #0062c3;
    --marca-acento: #38cff3;
    --marca-rgb: 0, 125, 254;
    --marca-acento-rgb: 56, 207, 243;

    --sidebar-bg: #1e293b;
    --sidebar-grad-1: rgba(0, 125, 254, 0.08);
    --sidebar-grad-2: rgba(56, 207, 243, 0.06);
    --sidebar-border: #334155;
    --sidebar-hover-bg: #334155;
    --sidebar-active-bg: #007dfe;
    --sidebar-text: #cbd5e1;
    --sidebar-text-muted: #94a3b8;
}

/* ---- Paleta: Ámbar ---- */
body[data-tema="ambar"] {
    --marca: #e87a1a;
    --marca-hover: #c46412;
    --marca-acento: #f2a85c;
    --marca-rgb: 232, 122, 26;
    --marca-acento-rgb: 242, 168, 92;

    --sidebar-bg: #2a1e0f;
    --sidebar-grad-1: rgba(232, 122, 26, 0.10);
    --sidebar-grad-2: rgba(242, 168, 92, 0.06);
    --sidebar-border: #3d2a15;
    --sidebar-hover-bg: #3d2a15;
    --sidebar-active-bg: #e87a1a;
    --sidebar-text: #e8d5be;
    --sidebar-text-muted: #b8a58e;
}

/* ---- Paleta: Marino ---- */
body[data-tema="marino"] {
    --marca: #1e3a5f;
    --marca-hover: #152843;
    --marca-acento: #4a6d94;
    --marca-rgb: 30, 58, 95;
    --marca-acento-rgb: 74, 109, 148;

    --sidebar-bg: #0f1e33;
    --sidebar-grad-1: rgba(30, 58, 95, 0.15);
    --sidebar-grad-2: rgba(74, 109, 148, 0.08);
    --sidebar-border: #1e3a5f;
    --sidebar-hover-bg: #1e3a5f;
    --sidebar-active-bg: #1e3a5f;
    --sidebar-text: #cbd5e1;
    --sidebar-text-muted: #8fa3bd;
}

/* ---- Paleta: Terracota ---- */
body[data-tema="terracota"] {
    --marca: #c04a1a;
    --marca-hover: #9d3a13;
    --marca-acento: #e07a52;
    --marca-rgb: 192, 74, 26;
    --marca-acento-rgb: 224, 122, 82;

    --sidebar-bg: #2a1510;
    --sidebar-grad-1: rgba(192, 74, 26, 0.12);
    --sidebar-grad-2: rgba(224, 122, 82, 0.07);
    --sidebar-border: #3d1f18;
    --sidebar-hover-bg: #3d1f18;
    --sidebar-active-bg: #c04a1a;
    --sidebar-text: #e8d0c4;
    --sidebar-text-muted: #b8a396;
}

/* ---- Paleta: Chocolate ---- */
body[data-tema="chocolate"] {
    --marca: #5c3a1e;
    --marca-hover: #452a14;
    --marca-acento: #8c6440;
    --marca-rgb: 92, 58, 30;
    --marca-acento-rgb: 140, 100, 64;

    --sidebar-bg: #2a1a0e;
    --sidebar-grad-1: rgba(92, 58, 30, 0.15);
    --sidebar-grad-2: rgba(140, 100, 64, 0.08);
    --sidebar-border: #3d2818;
    --sidebar-hover-bg: #3d2818;
    --sidebar-active-bg: #5c3a1e;
    --sidebar-text: #e0cdb8;
    --sidebar-text-muted: #b8a390;
}

/* ---- Paleta: Óxido ---- */
body[data-tema="oxido"] {
    --marca: #ff6a00;
    --marca-hover: #d95800;
    --marca-acento: #ff9a4d;
    --marca-rgb: 255, 106, 0;
    --marca-acento-rgb: 255, 154, 77;

    --sidebar-bg: #2a1508;
    --sidebar-grad-1: rgba(255, 106, 0, 0.12);
    --sidebar-grad-2: rgba(255, 154, 77, 0.07);
    --sidebar-border: #3d2010;
    --sidebar-hover-bg: #3d2010;
    --sidebar-active-bg: #ff6a00;
    --sidebar-text: #edd5c0;
    --sidebar-text-muted: #b8a290;
}

/* ---- Paleta: Verde ---- */
body[data-tema="verde"] {
    --marca: #16a34a;
    --marca-hover: #15803d;
    --marca-acento: #4ade80;
    --marca-rgb: 22, 163, 74;
    --marca-acento-rgb: 74, 222, 128;

    --sidebar-bg: #0f2a18;
    --sidebar-grad-1: rgba(22, 163, 74, 0.10);
    --sidebar-grad-2: rgba(74, 222, 128, 0.07);
    --sidebar-border: #1a3d24;
    --sidebar-hover-bg: #1a3d24;
    --sidebar-active-bg: #16a34a;
    --sidebar-text: #c4e0cd;
    --sidebar-text-muted: #8fb8a0;
}

/* ---- Paleta: Morado ---- */
body[data-tema="morado"] {
    --marca: #7c3aed;
    --marca-hover: #6d28d9;
    --marca-acento: #a78bfa;
    --marca-rgb: 124, 58, 237;
    --marca-acento-rgb: 167, 139, 250;

    --sidebar-bg: #1f1235;
    --sidebar-grad-1: rgba(124, 58, 237, 0.12);
    --sidebar-grad-2: rgba(167, 139, 250, 0.08);
    --sidebar-border: #2e1d4a;
    --sidebar-hover-bg: #2e1d4a;
    --sidebar-active-bg: #7c3aed;
    --sidebar-text: #d4c4e8;
    --sidebar-text-muted: #a594c0;
}

/* ---- Paleta: Turquesa ---- */
body[data-tema="turquesa"] {
    --marca: #0891b2;
    --marca-hover: #0e7490;
    --marca-acento: #22d3ee;
    --marca-rgb: 8, 145, 178;
    --marca-acento-rgb: 34, 211, 238;

    --sidebar-bg: #0a2530;
    --sidebar-grad-1: rgba(8, 145, 178, 0.12);
    --sidebar-grad-2: rgba(34, 211, 238, 0.08);
    --sidebar-border: #103b4a;
    --sidebar-hover-bg: #103b4a;
    --sidebar-active-bg: #0891b2;
    --sidebar-text: #c0dde5;
    --sidebar-text-muted: #8ab5c0;
}

/* ---- Paleta: Vino ---- */
body[data-tema="vino"] {
    --marca: #7f1d1d;
    --marca-hover: #5f1414;
    --marca-acento: #b85454;
    --marca-rgb: 127, 29, 29;
    --marca-acento-rgb: 184, 84, 84;

    --sidebar-bg: #1f0a0a;
    --sidebar-grad-1: rgba(127, 29, 29, 0.15);
    --sidebar-grad-2: rgba(184, 84, 84, 0.08);
    --sidebar-border: #3a1414;
    --sidebar-hover-bg: #3a1414;
    --sidebar-active-bg: #7f1d1d;
    --sidebar-text: #e0c4c4;
    --sidebar-text-muted: #b89696;
}

/* ---- Paleta: Gris neutro ---- */
body[data-tema="gris"] {
    --marca: #475569;
    --marca-hover: #334155;
    --marca-acento: #94a3b8;
    --marca-rgb: 71, 85, 105;
    --marca-acento-rgb: 148, 163, 184;

    --sidebar-bg: #1a1f2a;
    --sidebar-grad-1: rgba(71, 85, 105, 0.12);
    --sidebar-grad-2: rgba(148, 163, 184, 0.08);
    --sidebar-border: #2a3340;
    --sidebar-hover-bg: #2a3340;
    --sidebar-active-bg: #475569;
    --sidebar-text: #c8ced8;
    --sidebar-text-muted: #98a2b0;
}

/* ============================================
   SELECTOR DE PALETAS (Configuración)
   ============================================ */

.paleta-swatch {
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 8px;
    text-align: center;
    transition: all 0.15s ease;
    background: #fff;
}

.paleta-swatch:hover {
    border-color: #cbd5e1;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.paleta-swatch-activo {
    border-color: var(--marca);
    background: rgba(var(--marca-rgb, 0, 125, 254), 0.05);
    box-shadow: 0 0 0 3px rgba(var(--marca-rgb, 0, 125, 254), 0.15);
}

.paleta-swatch-color {
    width: 100%;
    height: 60px;
    border-radius: 6px;
    margin-bottom: 6px;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.paleta-swatch-nombre {
    font-size: 12px;
    font-weight: 600;
    color: var(--texto-secundario);
}

.paleta-swatch-activo .paleta-swatch-nombre {
    color: var(--marca);
}

/* ============================================
   ACCESOS RÁPIDOS DEL DASHBOARD
   ============================================ */

.dash-accesos-rapidos {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 8px 0;
}

.dash-accesos-label {
    color: var(--texto-secundario);
    font-size: 13px;
    font-weight: 500;
    margin-right: 4px;
}

.dash-btn-rapido {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    border: 1px solid var(--sidebar-border);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.dash-btn-rapido:hover {
    background: var(--sidebar-hover-bg);
    color: #ffffff;
    border-color: var(--sidebar-hover-bg);
}

.dash-btn-rapido:active {
    background: var(--sidebar-active-bg);
    color: #ffffff;
    border-color: var(--sidebar-active-bg);
}

.dash-btn-rapido i {
    font-size: 14px;
}

/* ============================================================
   AYUDA CONTEXTUAL — Estilos del contenido Markdown
   Se aplican dentro de .ayuda-contenido (modal de Ayuda)
   ============================================================ */

.ayuda-contenido {
    font-size: 0.95rem;
    line-height: 1.65;
    color: #334155;
}

/* Títulos */
.ayuda-contenido h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--marca, #007dfe);
    margin-top: 0;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
}

.ayuda-contenido h2 {
    font-size: 1.15rem;
    font-weight: 600;
    color: #1e293b;
    margin-top: 1.75rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid #e2e8f0;
}

.ayuda-contenido h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #475569;
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
}

.ayuda-contenido h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: #64748b;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

/* Párrafos */
.ayuda-contenido p {
    margin-bottom: 0.85rem;
}

/* Listas */
.ayuda-contenido ul,
.ayuda-contenido ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.ayuda-contenido li {
    margin-bottom: 0.35rem;
}

.ayuda-contenido li > strong:first-child {
    color: #1e293b;
}

/* Blockquote (metadatos) */
.ayuda-contenido blockquote {
    background: #f8fafc;
    border-left: 3px solid var(--marca, #007dfe);
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    border-radius: 0 4px 4px 0;
    font-size: 0.85rem;
    color: #64748b;
}

.ayuda-contenido blockquote p {
    margin-bottom: 0.25rem;
}

.ayuda-contenido blockquote p:last-child {
    margin-bottom: 0;
}

/* Código inline */
.ayuda-contenido code {
    background: #f1f5f9;
    color: #be185d;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.85em;
    font-family: 'Consolas', 'Monaco', monospace;
}

/* Bloques de código */
.ayuda-contenido pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 0.85rem;
    margin: 1rem 0;
}

.ayuda-contenido pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    font-size: inherit;
}

/* Tablas */
.ayuda-contenido table {
    width: 100%;
    margin: 1rem 0;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.ayuda-contenido table thead {
    background: #f1f5f9;
    border-bottom: 2px solid #cbd5e1;
}

.ayuda-contenido table th {
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-weight: 600;
    color: #334155;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.ayuda-contenido table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: top;
}

.ayuda-contenido table tbody tr:hover {
    background: #f8fafc;
}

.ayuda-contenido table tbody tr:last-child td {
    border-bottom: none;
}

/* Links */
.ayuda-contenido a {
    color: var(--marca, #007dfe);
    text-decoration: none;
    border-bottom: 1px dotted currentColor;
}

.ayuda-contenido a:hover {
    text-decoration: underline;
    border-bottom-style: solid;
}

/* Separadores */
.ayuda-contenido hr {
    border: 0;
    border-top: 1px solid #e2e8f0;
    margin: 1.5rem 0;
}

/* Blockquote con la advertencia de "ayuda no disponible" */
.ayuda-contenido .ayuda-no-encontrada,
.ayuda-contenido .ayuda-vacia {
    text-align: center;
    padding: 2rem 1rem;
}

.ayuda-contenido .ayuda-no-encontrada h3,
.ayuda-contenido .ayuda-vacia h3 {
    color: #64748b;
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

.ayuda-contenido .ayuda-no-encontrada p,
.ayuda-contenido .ayuda-vacia p {
    color: #94a3b8;
    font-size: 0.9rem;
}

/* Emojis */
.ayuda-contenido em {
    font-style: italic;
    color: #64748b;
}

/* Strong */
.ayuda-contenido strong {
    font-weight: 600;
    color: #1e293b;
}

/* Responsive: en pantallas chicas */
@media (max-width: 768px) {
    .ayuda-contenido {
        font-size: 0.9rem;
    }
    
    .ayuda-contenido h1 {
        font-size: 1.3rem;
    }
    
    .ayuda-contenido h2 {
        font-size: 1.05rem;
    }
    
    .ayuda-contenido table {
        font-size: 0.8rem;
    }
    
    .ayuda-contenido table th,
    .ayuda-contenido table td {
        padding: 0.4rem 0.5rem;
    }
}

/* ============================================================
   BOTÓN DE AYUDA CONTEXTUAL (barra superior)
   ============================================================ */

.btn-ayuda {
    background: transparent;
    border: 1px solid #cbd5e1;
    color: #64748b;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-right: 0.75rem;
    padding: 0;
    flex-shrink: 0;
}

.btn-ayuda:hover {
    background: var(--marca, #007dfe);
    border-color: var(--marca, #007dfe);
    color: #ffffff;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 125, 254, 0.25);
}

.btn-ayuda:active {
    transform: scale(0.95);
}

.btn-ayuda:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--marca-rgb, 0, 125, 254), 0.25);
}

/* Responsive: en pantallas chicas se hace un poco más chico */
@media (max-width: 768px) {
    .btn-ayuda {
        width: 34px;
        height: 34px;
        font-size: 1rem;
        margin-right: 0.5rem;
    }
}

/* Cards clickeables del Dashboard (alertas de vencimiento) */
.dash-card-click {
    transition: box-shadow 0.2s ease, transform 0.1s ease;
}

.dash-card-click:hover {
    box-shadow: 0 0 0 2px var(--marca), 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.dash-card-click:active {
    transform: translateY(0);
}