/**
 * style.css
 * Estilos globales de WebÁp
 * Colores corporativos: Azul petróleo #004C66, Cian #01A7E1, grises azulados y blanco
 *
 * WebÁp © 2026 Ignacio André Reyes Osorio
 */

/* ============================================================
   VARIABLES CSS
   ============================================================ */
:root {
    --primario: #004C66;
    --primario-oscuro: #003547;
    --primario-claro: #E6F1F6;
    --secundario: #01A7E1;
    --secundario-oscuro: #0186B5;
    --secundario-claro: #DFF3FC;
    --gris-oscuro: #2B3A44;
    --gris-medio: #5B6B76;
    --gris-claro: #DCE4E9;
    --gris-fondo: #F3F6F8;
    --blanco: #FFFFFF;
    --rojo: #DC3545;
    --naranja: #FD7E14;
    --azul: #0D6EFD;
    --morado: #6F42C1;
    --verde: #00A651;
    --amarillo: #FFC107;
    --sombra: 0 2px 8px rgba(0, 53, 71, 0.08);
    --sombra-hover: 0 4px 16px rgba(0, 53, 71, 0.12);
    --radio: 8px;
    --sidebar-width: 260px;
    --header-height: 60px;
    --transicion: all 0.25s ease;
}

/* ============================================================
   RESET Y BASE
   ============================================================ */
* {
    margin: 0;
    padding: 0;
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--gris-fondo);
    color: var(--gris-oscuro);
    line-height: 1.5;
    font-size: 14px;
}

::selection {
    background: rgba(1, 167, 225, 0.25);
}

a {
    color: var(--secundario-oscuro);
    text-decoration: none;
}

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

img {
    max-width: 100%;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    line-height: 1.3;
}

code {
    background: var(--gris-fondo);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--primario);
}

hr {
    border: none;
    border-top: 1px solid var(--gris-claro);
    margin: 16px 0;
}

/* ============================================================
   FIX GLOBAL: box-sizing para evitar desbordes
   ============================================================ */
.form-control,
.btn,
.btn-block,
.card,
.card-header,
.alert,
.badge,
.sidebar-footer,
.form-group,
.form-row,
table.data-table,
table.data-table th,
table.data-table td,
.ss-container,
.ss-display,
.ss-dropdown,
.ss-search,
.ss-options,
.ss-option {
    box-sizing: border-box;
}

/* ============================================================
   LOGIN
   ============================================================ */
.login-html {
    margin: 0;
    background: var(--primario-oscuro);
    overflow-x: hidden;
}

body.login-page,
body.login-page *,
body.login-page *::before,
body.login-page *::after {
    box-sizing: border-box;
}

body.login-page {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
    position: relative;
    background: linear-gradient(160deg, #002b3a 0%, var(--primario) 40%, #0179a8 74%, var(--secundario) 100%);
    background-size: 160% 160%;
    animation: bgShift 22s ease-in-out infinite;
}

@keyframes bgShift {
    0%, 100% { background-position: 0% 50%; }
    50%      { background-position: 100% 50%; }
}

body.login-page::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        repeating-linear-gradient(45deg, rgba(255,255,255,0.04) 0 1px, transparent 1px 16px),
        radial-gradient(70% 55% at 10% -5%, rgba(1,167,225,0.22), transparent 60%);
}

body.login-page::after {
    content: "";
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 42vh;
    z-index: 0;
    pointer-events: none;
    background: radial-gradient(120% 100% at 50% 130%, rgba(1,167,225,0.40), rgba(1,167,225,0) 62%);
    animation: floorPulse 9s ease-in-out infinite;
}

@keyframes floorPulse {
    0%, 100% { opacity: 0.75; }
    50%      { opacity: 1; }
}

.login-shell {
    position: relative;
    z-index: 1;
    margin: auto 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 16px;
}

.login-container {
    width: 100%;
    max-width: 440px;
    animation: loginRise 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes loginRise {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

.login-card {
    width: 100%;
    background: var(--blanco);
    border-radius: 16px;
    padding: 40px 36px;
    box-shadow: 0 18px 50px rgba(0, 33, 48, 0.35);
    text-align: center;
}

.login-header {
    text-align: center;
    margin-bottom: 24px;
}

.login-logo-img {
    width: 220px;
    height: auto;
    max-width: 100%;
    display: block;
    margin: 0 auto 14px;
    mix-blend-mode: multiply;
    animation: logoIn 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both;
    transition: transform 0.4s ease;
}

.login-logo-img:hover {
    transform: scale(1.04);
}

@keyframes logoIn {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: scale(1); }
}

.login-header h1 {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--gris-oscuro);
    margin: 4px 0 4px;
}

.login-header p {
    color: var(--gris-medio);
    font-size: 13px;
    letter-spacing: 0.3px;
}

.login-form {
    width: 100%;
    margin: 0 auto;
    text-align: center;
}

.login-form .form-group {
    margin-bottom: 18px;
    text-align: center;
}

.login-form .form-group label {
    text-align: center;
}

.login-form .form-control {
    text-align: center;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.login-form .form-control::placeholder {
    text-align: center;
    opacity: 0.7;
}

body.login-page .form-control:focus {
    border-color: var(--secundario);
    box-shadow: 0 0 0 4px rgba(1, 167, 225, 0.16);
    transform: translateY(-1px);
}

body.login-page .btn-primary {
    position: relative;
    overflow: hidden;
}

body.login-page .btn-primary::after {
    content: "";
    position: absolute;
    top: 0;
    left: -120%;
    width: 60%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255,255,255,0.35), transparent);
    transform: skewX(-20deg);
    transition: left 0.6s ease;
    pointer-events: none;
}

body.login-page .btn-primary:hover::after {
    left: 130%;
}

.login-bottom-footer {
    width: 100%;
    max-width: 440px;
    margin-top: 22px;
    padding: 6px 24px 4px;
    text-align: center;
    font-size: 12px;
    line-height: 1.7;
    letter-spacing: 0.2px;
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 1px 2px rgba(0, 20, 30, 0.4);
    position: relative;
    z-index: 1;
    animation: footerIn 0.8s ease 0.55s both;
    transition: color 0.3s ease;
}

.login-bottom-footer::before {
    content: "";
    display: block;
    width: 40px;
    height: 2px;
    margin: 0 auto 12px;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent);
}

.login-bottom-footer:hover {
    color: rgba(255, 255, 255, 0.98);
}

@keyframes footerIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 600px) {
    .login-shell {
        padding: 24px 14px;
    }
    .login-card {
        padding: 30px 22px;
    }
    .login-logo-img {
        width: 170px;
    }
    .login-bottom-footer {
        padding: 6px 16px 4px;
        font-size: 11px;
        margin-top: 18px;
    }
}

@media (max-height: 620px) {
    .login-shell {
        margin: 0;
    }
}

/* ============================================================
   LAYOUT PRINCIPAL
   ============================================================ */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--blanco);
    border-right: 1px solid var(--gris-claro);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100dvh;
    max-height: 100dvh;
    z-index: 100;
    transition: var(--transicion);
    box-shadow: 2px 0 8px rgba(0, 53, 71, 0.06);
    overflow-y: auto;
}

.sidebar-header {
    height: auto;
    min-height: calc(var(--header-height) + 10px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gris-claro);
    background: linear-gradient(135deg, var(--primario-claro) 0%, var(--blanco) 100%);
    flex-shrink: 0;
}

.sidebar-logo-wrapper {
    text-align: center;
    width: 100%;
}

.sidebar-logo-img {
    width: 160px;
    height: auto;
    max-width: 100%;
    display: block;
    margin: 0 auto 6px;
    mix-blend-mode: multiply;
}

.sidebar-subtitle {
    font-size: 13px;
    font-weight: 700;
    color: var(--primario);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-top: 4px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radio);
    color: var(--gris-medio);
    font-weight: 500;
    margin-bottom: 4px;
    transition: var(--transicion);
}

.nav-item:hover {
    background: var(--primario-claro);
    color: var(--primario);
}

.nav-item.active {
    background: var(--primario);
    color: var(--blanco);
    box-shadow: 0 2px 8px rgba(0, 76, 102, 0.25);
}

.nav-item .icon {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--gris-claro);
    background: var(--gris-fondo);
    flex-shrink: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primario);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.user-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--gris-oscuro);
}

.user-role {
    font-size: 11px;
    color: var(--gris-medio);
}

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

.topbar {
    height: var(--header-height);
    background: var(--blanco);
    border-bottom: 1px solid var(--gris-claro);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.page-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--gris-oscuro);
}

.content-area {
    padding: 24px;
    flex: 1;
}

/* ============================================================
   COMPONENTES COMUNES
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border: none;
    border-radius: var(--radio);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transicion);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primario);
    color: white;
}

.btn-primary:hover {
    background: var(--primario-oscuro);
    color: white;
}

.btn-secondary {
    background: var(--gris-claro);
    color: var(--gris-oscuro);
}

.btn-secondary:hover {
    background: #d1d5db;
}

.btn-danger {
    background: var(--rojo);
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-success {
    background: var(--verde);
    color: white;
}

.btn-success:hover {
    background: #008c44;
}

.btn-warning {
    background: var(--amarillo);
    color: var(--gris-oscuro);
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-menu {
    background: var(--gris-claro);
    border: none;
    border-radius: var(--radio);
    padding: 8px 12px;
    cursor: pointer;
    font-size: 18px;
    display: none;
}

.card {
    background: var(--blanco);
    border-radius: 10px;
    box-shadow: var(--sombra);
    padding: 20px;
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gris-claro);
    flex-wrap: wrap;
    gap: 10px;
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--gris-oscuro);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 6px;
    color: var(--gris-oscuro);
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gris-claro);
    border-radius: var(--radio);
    font-size: 14px;
    transition: var(--transicion);
    background: var(--blanco);
    color: var(--gris-oscuro);
}

.form-control:focus {
    outline: none;
    border-color: var(--secundario);
    box-shadow: 0 0 0 3px rgba(1, 167, 225, 0.18);
}

select.form-control {
    cursor: pointer;
}

textarea.form-control {
    min-height: 90px;
    resize: vertical;
}

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

.alert {
    padding: 12px 16px;
    border-radius: var(--radio);
    margin-bottom: 16px;
    font-size: 13px;
}

.alert-error {
    background: #fde8e8;
    color: #9b1c1c;
    border: 1px solid #f5c2c2;
}

.alert-success {
    background: #e6f7ed;
    color: #0d6832;
    border: 1px solid #a3e4b8;
}

.alert-info {
    background: #e8f4fd;
    color: #0c4a6e;
    border: 1px solid #bae0fd;
}

.alert-warning {
    background: #fff8e1;
    color: #856404;
    border: 1px solid #ffe082;
}

.table-responsive {
    overflow-x: auto;
}

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

table.data-table th {
    background: var(--gris-fondo);
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    color: var(--gris-medio);
    border-bottom: 2px solid var(--gris-claro);
    white-space: nowrap;
}

table.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--gris-claro);
    vertical-align: middle;
}

table.data-table tr:hover td {
    background: #fafbfc;
}

table.data-table tfoot td {
    background: var(--gris-fondo);
    font-weight: 700;
    border-top: 2px solid var(--gris-claro);
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}

.badge-pendiente {
    background: #fff3cd;
    color: #856404;
}

.badge-en_proceso,
.badge-en_curso {
    background: #cce5ff;
    color: #004085;
}

.badge-cotizada,
.badge-enviada {
    background: #d4edda;
    color: #155724;
}

.badge-aceptada,
.badge-finalizada,
.badge-emitida,
.badge-facturada,
.badge-pagada {
    background: #d1e7dd;
    color: #0f5132;
}

.badge-rechazada,
.badge-cancelada,
.badge-anulada {
    background: #f8d7da;
    color: #842029;
}

.badge-borrador {
    background: #e2e3e5;
    color: #41464b;
}

.badge-urgente {
    background: #f8d7da;
    color: #842029;
}

.badge-alta {
    background: #ffe5d0;
    color: #984c0c;
}

.badge-media {
    background: #fff3cd;
    color: #856404;
}

.badge-baja {
    background: #d1e7dd;
    color: #0f5132;
}

/* Badges PC */
.badge-no_ingresada_lioren {
    background: #e2e3e5;
    color: #41464b;
}

.badge-ingresada_lioren {
    background: #cce5ff;
    color: #004085;
}

.badge-no_aceptada {
    background: #f8d7da;
    color: #842029;
}

.badge-modificada_no_ingresada {
    background: #fff3cd;
    color: #856404;
}

/* Badges inventario */
.badge-entrada {
    background: #d1e7dd;
    color: #0f5132;
}

.badge-salida {
    background: #f8d7da;
    color: #842029;
}

.badge-consumo {
    background: #cce5ff;
    color: #004085;
}

.badge-merma {
    background: #ffe5d0;
    color: #984c0c;
}

.badge-traspaso {
    background: #e2d9f3;
    color: #3d2b6b;
}

.badge-ajuste {
    background: #fff3cd;
    color: #856404;
}

/* ============================================================
   AGENDA (CALENDARIO MENSUAL)
   ============================================================ */
.agenda-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.agenda-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.agenda-mes-anio {
    font-size: 20px;
    font-weight: 700;
    min-width: 180px;
    text-align: center;
}

.agenda-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-top: 12px;
}

.agenda-dia-nombre {
    background: var(--primario);
    color: #fff;
    padding: 8px;
    text-align: center;
    font-weight: 600;
    font-size: 13px;
    border-radius: 4px;
}

.agenda-celda {
    background: #fff;
    border: 1px solid var(--gris-claro);
    border-radius: 6px;
    min-height: 110px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.agenda-celda.vacia {
    background: #fafafa;
    opacity: 0.5;
}

.agenda-celda.hoy {
    border: 2px solid var(--secundario);
    background: #f0f9ff;
}

.agenda-dia-num {
    font-weight: 700;
    font-size: 14px;
    color: var(--primario);
    border-bottom: 1px solid var(--gris-claro);
    padding-bottom: 4px;
    margin-bottom: 2px;
}

.agenda-evento {
    display: block;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 11px;
    line-height: 1.3;
    text-decoration: none;
    word-break: break-word;
    transition: opacity 0.15s;
}

.agenda-evento:hover {
    opacity: 0.85;
}

.calendario {
    background: var(--blanco);
    border-radius: 12px;
    box-shadow: var(--sombra);
    overflow: hidden;
}

.calendario-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--primario);
    color: white;
}

.calendario-header div {
    padding: 12px;
    text-align: center;
    font-weight: 600;
    font-size: 13px;
}

.calendario-body {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.dia {
    min-height: 120px;
    border: 1px solid var(--gris-claro);
    padding: 8px;
    position: relative;
    background: var(--blanco);
    transition: var(--transicion);
}

.dia:hover {
    background: #fafbfc;
}

.dia.otro-mes {
    background: #f9fafb;
    color: #adb5bd;
}

.dia.hoy {
    background: var(--primario-claro);
}

.dia.hoy .dia-numero {
    background: var(--primario);
    color: white;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dia-numero {
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 6px;
}

.evento {
    font-size: 11px;
    padding: 3px 6px;
    border-radius: 4px;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    color: white;
    font-weight: 500;
}

.evento-solicitud {
    background: #0D6EFD;
}

.evento-cotizacion {
    background: #FD7E14;
}

.evento-orden {
    background: var(--primario);
}

.evento-prefactura {
    background: #6F42C1;
}

.evento-precotizacion {
    background: var(--azul);
}

.evento-guia {
    background: var(--naranja);
}

.leyenda {
    display: flex;
    gap: 16px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.leyenda-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.leyenda-color {
    width: 14px;
    height: 14px;
    border-radius: 3px;
}

/* ============================================================
   MODALES
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 30, 45, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transicion);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--blanco);
    border-radius: 12px;
    width: 95%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 30, 45, 0.2);
    transform: translateY(20px);
    transition: var(--transicion);
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid var(--gris-claro);
}

.modal-title {
    font-size: 17px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--gris-medio);
    line-height: 1;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--gris-claro);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ============================================================
   PIE DE PÁGINA DEL SISTEMA
   ============================================================ */
.app-footer {
    background: var(--blanco);
    border-top: 1px solid var(--gris-claro);
    padding: 14px 24px;
    font-size: 12px;
    color: var(--gris-medio);
    text-align: center;
    margin-top: auto;
}

/* ============================================================
   MENÚ USUARIO Y RELOJ
   ============================================================ */
.user-menu {
    position: relative;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gris-oscuro);
    font-size: 13px;
    font-weight: 600;
}

.user-menu-nombre {
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: var(--blanco);
    border: 1px solid var(--gris-claro);
    border-radius: 10px;
    box-shadow: var(--sombra-hover);
    min-width: 260px;
    display: none;
    z-index: 300;
    overflow: hidden;
}

.user-dropdown.open {
    display: block;
}

.user-dropdown a {
    display: flex;
    gap: 8px;
    padding: 11px 14px;
    font-size: 13px;
    color: var(--gris-oscuro);
}

.user-dropdown a:hover {
    background: var(--primario-claro);
}

.topbar-reloj {
    font-size: 12px;
    color: var(--gris-medio);
    font-variant-numeric: tabular-nums;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.topbar-reloj-fecha {
    opacity: .85;
    font-size: .92em;
}

.topbar-reloj-sep {
    opacity: .55;
}

.topbar-reloj-hora {
    font-variant-numeric: tabular-nums;
}

/* ============================================================
   AVATAR DE USUARIO
   ============================================================ */
.user-avatar-img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: contain;
    object-position: center;
    background: var(--gris-fondo);
    border: 2px solid var(--secundario);
    box-sizing: border-box;
    flex-shrink: 0;
}

body[data-theme="oscuro"] .user-avatar-img {
    background: var(--gris-claro);
}

.user-avatar {
    flex-shrink: 0;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 12px;
}

.avatar-md {
    width: 48px;
    height: 48px;
    font-size: 18px;
}

.avatar-lg {
    width: 72px;
    height: 72px;
    font-size: 26px;
}

/* ============================================================
   TEMA OSCURO
   ============================================================ */
body[data-theme="oscuro"] {
    --gris-fondo: #12181c;
    --blanco: #1c2429;
    --gris-oscuro: #e6ecef;
    --gris-medio: #9fb0b9;
    --gris-claro: #2c363c;
    --primario-claro: #12303f;
    --sombra: 0 2px 8px rgba(0, 0, 0, .4);
    --sombra-hover: 0 4px 16px rgba(0, 0, 0, .5);
}

body[data-theme="oscuro"] .form-control {
    background: #232d33;
    color: var(--gris-oscuro);
    border-color: var(--gris-claro);
}

body[data-theme="oscuro"] table.data-table th {
    background: #232d33;
}

body[data-theme="oscuro"] table.data-table tr:hover td {
    background: #232d33;
}

body[data-theme="oscuro"] .login-card {
    background: var(--blanco);
}

body[data-theme="oscuro"] .agenda-celda {
    background: var(--blanco);
}

body[data-theme="oscuro"] .agenda-celda.vacia {
    background: #161d21;
}

body[data-theme="oscuro"] .agenda-celda.hoy {
    background: var(--primario-claro);
}

/* ============================================================
   CONFIGURACIÓN - PESTAÑAS
   ============================================================ */
.config-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.config-tab {
    background: var(--blanco);
    border: 1px solid var(--gris-claro);
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--gris-medio);
}

.config-tab:hover {
    background: var(--primario-claro);
    color: var(--primario);
}

.config-tab.active {
    background: var(--primario);
    color: var(--blanco);
    border-color: var(--primario);
}

@media (max-width: 600px) {
    .config-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 6px;
    }
    .config-tab {
        white-space: nowrap;
    }
}

/* ============================================================
   SEARCHABLE SELECT (Dropdown con búsqueda integrada)
   ============================================================ */
.ss-container {
    position: relative;
    width: 100%;
}

.ss-display {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 38px;
    user-select: none;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gris-claro);
    border-radius: var(--radio);
    font-size: 14px;
    transition: var(--transicion);
    background: var(--blanco);
    color: var(--gris-oscuro);
}

.ss-display:hover {
    border-color: var(--secundario);
}

.ss-display::after {
    content: '▾';
    font-size: 12px;
    color: var(--gris-medio);
    margin-left: 8px;
    flex-shrink: 0;
}

.ss-container.ss-open .ss-display::after {
    content: '▴';
}

.ss-placeholder {
    color: var(--gris-medio);
    opacity: 0.7;
}

.ss-value {
    color: var(--gris-oscuro);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ss-new-value {
    color: var(--secundario);
    font-style: italic;
}

.ss-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1050;
    background: var(--blanco);
    border: 1px solid var(--gris-claro);
    border-radius: var(--radio);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    margin-top: 4px;
    max-height: 320px;
    display: flex;
    flex-direction: column;
}

.ss-search {
    margin: 8px;
    width: calc(100% - 16px);
    border: 1px solid var(--gris-claro);
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 13px;
    outline: none;
    background: var(--blanco);
    color: var(--gris-oscuro);
}

.ss-search:focus {
    border-color: var(--secundario);
    box-shadow: 0 0 0 2px rgba(1, 167, 225, 0.2);
}

.ss-options {
    overflow-y: auto;
    max-height: 240px;
    padding: 4px 0;
}

.ss-option {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.1s;
    border-left: 3px solid transparent;
}

.ss-option:hover,
.ss-option.ss-highlighted {
    background: var(--primario-claro);
    border-left-color: var(--secundario);
}

.ss-option.ss-selected {
    background: var(--primario-claro);
    font-weight: 600;
    border-left-color: var(--primario);
}

.ss-option.ss-new {
    color: var(--secundario);
    font-weight: 500;
    border-top: 1px dashed var(--gris-claro);
    margin-top: 4px;
    padding-top: 10px;
}

.ss-empty {
    padding: 12px;
    text-align: center;
    color: var(--gris-medio);
    font-size: 13px;
    font-style: italic;
}

/* ============================================================
   SUB-NAVEGACIÓN DE MÓDULOS
   ============================================================ */
.sub-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.sub-nav .btn {
    font-size: 12px;
}

/* ============================================================
   KPIs DEL DASHBOARD
   ============================================================ */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.kpi-card {
    background: var(--blanco);
    border-radius: 10px;
    box-shadow: var(--sombra);
    padding: 16px;
    text-align: center;
    border-top: 4px solid var(--primario);
    transition: var(--transicion);
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--sombra-hover);
}

.kpi-card.kpi-azul { border-top-color: var(--azul); }
.kpi-card.kpi-naranja { border-top-color: var(--naranja); }
.kpi-card.kpi-verde { border-top-color: var(--verde); }
.kpi-card.kpi-morado { border-top-color: var(--morado); }
.kpi-card.kpi-rojo { border-top-color: var(--rojo); }
.kpi-card.kpi-primario { border-top-color: var(--primario); }

.kpi-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--gris-oscuro);
}

.kpi-label {
    font-size: 12px;
    color: var(--gris-medio);
    margin-top: 4px;
}

/* ============================================================
   GRÁFICO DE BARRAS SIMPLE (CSS)
   ============================================================ */
.chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 180px;
    padding: 10px 0;
    border-bottom: 1px solid var(--gris-claro);
}

.chart-bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
}

.chart-bar {
    width: 60%;
    max-width: 40px;
    border-radius: 4px 4px 0 0;
    transition: height 0.3s ease;
    min-height: 2px;
}

.chart-bar.bar-ventas {
    background: linear-gradient(180deg, var(--secundario), var(--azul));
}

.chart-bar.bar-costos {
    background: linear-gradient(180deg, var(--naranja), var(--amarillo));
}

.chart-bar-label {
    font-size: 11px;
    color: var(--gris-medio);
    margin-top: 6px;
    text-align: center;
}

/* ============================================================
   PISTOLEO DE SERIES (GD)
   ============================================================ */
.input-scan {
    border: 2px dashed var(--secundario) !important;
    background: var(--secundario-claro) !important;
    font-family: 'Courier New', monospace;
    font-size: 15px;
    letter-spacing: 1px;
}

.input-scan:focus {
    border-color: var(--primario) !important;
    box-shadow: 0 0 0 3px rgba(0, 76, 102, 0.15) !important;
}

.lista-series {
    margin-top: 8px;
}

.contador-series {
    font-weight: 700;
    color: var(--primario);
}

/* ============================================================
   CAMPOS DE SOLO LECTURA
   ============================================================ */
input.form-control[readonly],
textarea.form-control[readonly] {
    background: var(--gris-fondo);
    color: var(--gris-medio);
    cursor: not-allowed;
}

/* ============================================================
   TABLA DE ÍTEMS - inputs compactos
   ============================================================ */
table.data-table td input[type="number"].form-control,
table.data-table td input[type="text"].form-control,
table.data-table td select.form-control {
    padding: 6px 8px;
}

table.data-table td input[type="number"].form-control {
    text-align: right;
}

/* ============================================================
   TOTALES Y RENTABILIDAD
   ============================================================ */
.totales-box {
    max-width: 400px;
    margin-left: auto;
}

.totales-box table {
    width: 100%;
}

.totales-box td {
    padding: 8px 12px;
}

.totales-box tr:last-child td {
    font-weight: 700;
    font-size: 15px;
    border-top: 2px solid var(--gris-claro);
}

.rentabilidad-positiva {
    color: var(--verde);
    font-weight: 700;
}

.rentabilidad-negativa {
    color: var(--rojo);
    font-weight: 700;
}

/* ============================================================
   FIRMA DIGITAL
   ============================================================ */
.firma-container {
    border: 1px solid var(--gris-claro);
    border-radius: var(--radio);
    background: #fafafa;
    display: inline-block;
}

.firma-container canvas {
    display: block;
    cursor: crosshair;
}

/* ============================================================
   SPINNER DE CARGA
   ============================================================ */
.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--gris-claro);
    border-top-color: var(--primario);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

.spinner-sm {
    width: 24px;
    height: 24px;
    border-width: 3px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.spinner-respaldo {
    width: 48px;
    height: 48px;
    border: 4px solid #e0e0e0;
    border-top-color: var(--primario);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

/* ============================================================
   OVERLAY DE CARGA
   ============================================================ */
.overlay-loading {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.overlay-loading.active {
    display: flex;
}

.overlay-content {
    background: var(--blanco);
    border-radius: 12px;
    padding: 32px 48px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* ============================================================
   INVENTARIO - STOCK
   ============================================================ */
.stock-bajo {
    color: var(--rojo);
    font-weight: 700;
}

.stock-medio {
    color: var(--naranja);
    font-weight: 700;
}

.stock-ok {
    color: var(--verde);
}

.stock-bar {
    width: 100%;
    height: 6px;
    background: var(--gris-claro);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 4px;
}

.stock-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.stock-bar-fill.stock-ok { background: var(--verde); }
.stock-bar-fill.stock-medio { background: var(--naranja); }
.stock-bar-fill.stock-bajo { background: var(--rojo); }

/* ============================================================
   TIMELINE / HISTORIAL
   ============================================================ */
.timeline {
    position: relative;
    padding-left: 24px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--gris-claro);
}

.timeline-item {
    position: relative;
    padding-bottom: 16px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--secundario);
    border: 2px solid var(--blanco);
}

.timeline-fecha {
    font-size: 11px;
    color: var(--gris-medio);
}

.timeline-texto {
    font-size: 13px;
    color: var(--gris-oscuro);
}

/* ============================================================
   TABS GENÉRICAS
   ============================================================ */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--gris-claro);
    margin-bottom: 16px;
    overflow-x: auto;
}

.tab {
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--gris-medio);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    transition: var(--transicion);
    text-decoration: none;
}

.tab:hover {
    color: var(--primario);
}

.tab.active {
    color: var(--primario);
    border-bottom-color: var(--primario);
}

/* ============================================================
   TOOLTIP SIMPLE
   ============================================================ */
.tooltip-wrapper {
    position: relative;
    display: inline-block;
}

.tooltip-wrapper .tooltip-text {
    visibility: hidden;
    background: var(--gris-oscuro);
    color: white;
    text-align: center;
    border-radius: 6px;
    padding: 6px 10px;
    position: absolute;
    z-index: 10;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s;
}

.tooltip-wrapper:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
    .sidebar,
    .topbar,
    .btn,
    .sub-nav,
    .config-tabs,
    .no-print {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .content-area {
        padding: 0 !important;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #ddd;
    }

    body {
        background: white !important;
    }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .dia {
        min-height: 80px;
    }

    .btn-menu {
        display: inline-block;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 30, 45, 0.5);
        z-index: 99;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

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

    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 768px) {
    .agenda-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .agenda-dia-nombre {
        display: none;
    }

    .agenda-celda {
        min-height: 80px;
    }

    .content-area {
        padding: 12px;
    }

    .topbar {
        padding: 0 12px;
    }

    .topbar-reloj {
        display: none;
    }

    table.data-table {
        font-size: 12px;
    }

    table.data-table th,
    table.data-table td {
        padding: 8px 10px;
    }
}

@media (max-width: 576px) {
    .topbar-reloj {
        font-size: 12px;
    }

    .topbar-reloj-fecha {
        display: none;
    }

    .user-menu-nombre {
        display: none;
    }

    .btn {
        padding: 8px 12px;
        font-size: 12px;
    }

    .card {
        padding: 14px;
    }
}

@media (max-width: 380px) {
    .topbar-reloj-hora {
        font-size: 12px;
    }

    .kpi-value {
        font-size: 20px;
    }
}

/* ============================================================
   UTILIDADES
   ============================================================ */
.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-muted {
    color: var(--gris-medio);
}

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

.text-bold {
    font-weight: 700;
}

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }

.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }

.ml-2 { margin-left: 8px; }
.mr-2 { margin-right: 8px; }

.p-2 { padding: 8px; }
.p-3 { padding: 16px; }

.d-flex {
    display: flex;
}

.d-grid {
    display: grid;
}

.d-none {
    display: none;
}

.d-block {
    display: block;
}

.d-inline-block {
    display: inline-block;
}

.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }
.gap-4 { gap: 24px; }

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.justify-end {
    justify-content: flex-end;
}

.align-center {
    align-items: center;
}

.align-start {
    align-items: flex-start;
}

.align-end {
    align-items: flex-end;
}

.flex-wrap {
    flex-wrap: wrap;
}

.flex-1 {
    flex: 1;
}

.flex-column {
    flex-direction: column;
}

.w-100 {
    width: 100%;
}

.h-100 {
    height: 100%;
}

.overflow-hidden {
    overflow: hidden;
}

.overflow-auto {
    overflow: auto;
}

.position-relative {
    position: relative;
}

.position-absolute {
    position: absolute;
}

.cursor-pointer {
    cursor: pointer;
}

.border-radius {
    border-radius: var(--radio);
}

.shadow {
    box-shadow: var(--sombra);
}

.shadow-hover:hover {
    box-shadow: var(--sombra-hover);
}

.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* ============================================================
   SECCIONES DEL MENÚ LATERAL
   ============================================================ */
.nav-seccion-titulo {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--gris-medio, #5B6B76);
    padding: 14px 14px 4px;
    margin-top: 4px;
    opacity: 0.7;
}

.nav-seccion-titulo:first-child {
    margin-top: 0;
}

body[data-theme="oscuro"] .nav-seccion-titulo {
    color: var(--gris-medio, #9fb0b9);
    opacity: 0.6;
}
/* ============================================================
   SEARCHABLE SELECT
   ============================================================ */
.ss-container {
    position: relative;
    width: 100%;
}

.ss-display {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 38px;
    user-select: none;
    background: var(--blanco);
}

.ss-display::after {
    content: '▾';
    font-size: 12px;
    color: var(--gris-medio);
    margin-left: 8px;
}

.ss-container.ss-open .ss-display::after {
    content: '▴';
}

.ss-placeholder {
    color: var(--gris-medio);
    opacity: 0.7;
}

.ss-value {
    color: var(--gris-oscuro);
}

.ss-new-value {
    color: var(--secundario);
    font-style: italic;
}

.ss-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1050;
    background: var(--blanco);
    border: 1px solid var(--gris-claro);
    border-radius: var(--radio);
    box-shadow: var(--sombra-hover);
    margin-top: 4px;
    max-height: 320px;
    display: flex;
    flex-direction: column;
}

.ss-search {
    margin: 8px;
    width: calc(100% - 16px);
    border: 1px solid var(--gris-claro);
    border-radius: var(--radio);
    padding: 8px 12px;
    font-size: 13px;
    outline: none;
}

.ss-search:focus {
    border-color: var(--secundario);
    box-shadow: 0 0 0 2px rgba(1, 167, 225, 0.15);
}

.ss-options {
    overflow-y: auto;
    max-height: 240px;
    padding: 4px 0;
}

.ss-option {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s;
}

.ss-option:hover,
.ss-option.ss-highlighted {
    background: var(--primario-claro);
}

.ss-option.ss-selected {
    background: var(--secundario-claro);
    font-weight: 600;
}

.ss-option.ss-new {
    color: var(--secundario);
    border-top: 1px dashed var(--gris-claro);
    margin-top: 4px;
    padding-top: 10px;
}

.ss-empty {
    padding: 12px;
    text-align: center;
    color: var(--gris-medio);
    font-size: 12px;
    font-style: italic;
}
/* FIN ARCHIVO */
