:root {
    --bg: #0b1220;
    --card: #0f1a33;
    --text: #e7eefc;
    --muted: #a8b4d6;
    --line: rgba(255, 255, 255, .10);
    --accent: #4aa3ff;
    --accent2: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
}

html,
body {
    height: 100%
}

body {
    min-height: 100vh;
    background-color: var(--bg);
    background-image:
        radial-gradient(circle at 20% 0%, rgba(74, 163, 255, .20), transparent 60%),
        radial-gradient(circle at 80% 0%, rgba(34, 197, 94, .15), transparent 60%);
    background-repeat: no-repeat;
    background-attachment: fixed;
    /* 🔥 clave */
    color: var(--text);
}

a {
    color: inherit
}

.text-muted {
    color: var(--muted) !important
}

.card {
    background: rgba(255, 255, 255, .03) !important;
    border: 1px solid var(--line) !important;
    border-radius: 18px !important;
}

.table {
    color: var(--text) !important;
}

.table thead th {
    border-bottom: 1px solid var(--line) !important;
}

.table td,
.table th {
    border-color: var(--line) !important;
}

.table-warning {
    background: rgba(245, 158, 11, .12) !important;
}

.alert {
    border: 1px solid var(--line) !important;
    background: rgba(255, 255, 255, .04) !important;
    color: var(--text) !important;
}

.alert-success {
    border-color: rgba(34, 197, 94, .45) !important;
    background: rgba(34, 197, 94, .10) !important;
}

.alert-danger {
    border-color: rgba(239, 68, 68, .45) !important;
    background: rgba(239, 68, 68, .10) !important;
}

.btn-primary {
    border: none !important;
    background: linear-gradient(135deg, var(--accent), #7c3aed) !important;
}

.btn-outline-secondary,
.btn-outline-primary,
.btn-outline-success,
.btn-outline-warning,
.btn-outline-danger,
.btn-outline-dark {
    border-color: var(--line) !important;
    color: var(--text) !important;
}

.btn-outline-secondary:hover,
.btn-outline-primary:hover,
.btn-outline-success:hover,
.btn-outline-warning:hover,
.btn-outline-danger:hover,
.btn-outline-dark:hover {
    background: rgba(255, 255, 255, .08) !important;
}

.form-control,
.form-select {
    background: rgba(255, 255, 255, .04) !important;
    border: 1px solid var(--line) !important;
    color: var(--text) !important;
    border-radius: 12px !important;
}

.form-control::placeholder {
    color: rgba(168, 180, 214, .75)
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(74, 163, 255, .6) !important;
    box-shadow: 0 0 0 3px rgba(74, 163, 255, .12) !important;
}

.badge.bg-success {
    background: rgba(34, 197, 94, .20) !important;
    border: 1px solid rgba(34, 197, 94, .35) !important
}

.badge.bg-secondary {
    background: rgba(255, 255, 255, .08) !important;
    border: 1px solid var(--line) !important
}

.badge.bg-warning {
    background: rgba(245, 158, 11, .22) !important;
    border: 1px solid rgba(245, 158, 11, .35) !important
}

.operis-nav {
    border-bottom: 1px solid var(--line);
    padding: 14px 0;
    margin-bottom: 18px;
}

.operis-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 900;
    letter-spacing: .2px;
}

.operis-logo {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    box-shadow: 0 10px 30px rgba(74, 163, 255, .25);
    display: inline-block;
}

.home-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.home-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.home-user-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    margin-left: auto;
}

.home-user-chip {
    border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(255, 255, 255, .04);
    border-radius: 14px;
    padding: 10px 12px;
    min-width: 210px;
    line-height: 1.2;
}

.home-logout-form {
    margin: 0;
}

.home-head .btn,
.home-head .btn.btn-sm,
.home-head .btn.btn-outline-secondary,
.home-head .btn.btn-outline-primary,
.home-head .btn.btn-primary {
    border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(255, 255, 255, .04);
    color: var(--text);
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 14px;
    display: inline-flex;
    gap: 8px;
    align-items: center;
    font-weight: 800;
    line-height: 1;
    transition: transform .12s ease, background .12s ease, border-color .12s ease, filter .12s ease;
    box-shadow: none;
}

.home-head .btn:hover,
.home-head .btn.btn-outline-secondary:hover,
.home-head .btn.btn-outline-primary:hover,
.home-head .btn.btn-primary:hover {
    background: rgba(255, 255, 255, .08);
    border-color: rgba(255, 255, 255, .22);
    color: var(--text);
    transform: translateY(-1px);
}

.home-head .btn.btn-primary {
    border-color: transparent;
    background: linear-gradient(135deg, rgba(74, 163, 255, 1), rgba(124, 58, 237, 1)) !important;
    box-shadow: 0 14px 30px rgba(74, 163, 255, .16);
    color: #fff !important;
}

.home-head .btn.btn-primary:hover {
    color: #fff !important;
    filter: brightness(1.05);
}

@media (max-width: 768px) {
    .home-head {
        flex-direction: column;
        align-items: stretch;
    }

    .home-user-actions {
        justify-content: stretch;
        margin-left: 0;
    }

    .home-user-chip,
    .home-user-actions .ab-btn,
    .home-user-actions .btn {
        width: 100%;
    }

    .home-user-actions .ab-btn,
    .home-user-actions .btn {
        justify-content: center;
    }
}

/* Fila bajo mínimo (modo oscuro) */
.table tbody tr.low-stock td {
    background: rgba(245, 158, 11, .12) !important;
    /* warning oscuro */
    color: var(--text) !important;
}

/* Que no se “laven” los botones dentro de la fila */
.table tbody tr.low-stock .btn {
    filter: none !important;
    opacity: 1 !important;
}

/* Un borde para que se note sin aclarar toda la fila */
.table tbody tr.low-stock td:first-child {
    border-left: 4px solid rgba(245, 158, 11, .65);
}

/* Badge warning legible */
.table tbody tr.low-stock .badge.bg-warning {
    background: rgba(245, 158, 11, .85) !important;
    color: #111 !important;
}

/* Quitar flechas en Chrome, Edge, Safari */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Quitar flechas en Firefox */
input[type="number"] {
    -moz-appearance: textfield;
}

/* Select cerrado */
select.form-select,
select.form-control {
    background-color: #1a2236 !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, .15) !important;
}

/* Flecha del select */
select.form-select {
    background-image: url("data:image/svg+xml,%3Csvg fill='%23ffffff' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5.516 7.548a.625.625 0 01.884-.032L10 10.803l3.6-3.287a.625.625 0 11.852.916l-4.026 3.675a.625.625 0 01-.852 0L5.548 8.432a.625.625 0 01-.032-.884z'/%3E%3C/svg%3E");
}

/* Dropdown abierto (opciones) */
select.form-select option,
select.form-control option {
    background-color: #ffffff;
    color: #000000;
}

.bg-dark-subtle {
    background: rgba(255, 255, 255, .04) !important;
    border-color: rgba(255, 255, 255, .10) !important;
    color: var(--text) !important;
}

/* TABLA BASE DARK */
.table {
    color: var(--text) !important;
}

/* Hover en modo oscuro */
.table-hover tbody tr:hover {
    background-color: rgba(74, 163, 255, 0.12) !important;
    color: #ffffff !important;
}

/* Forzar texto visible dentro del hover */
.table-hover tbody tr:hover td,
.table-hover tbody tr:hover th {
    color: #ffffff !important;
}

/* Si tienes filas warning (bajo mínimo) */
.table-warning {
    background-color: rgba(245, 158, 11, 0.18) !important;
    color: #fff !important;
}

.table-warning td {
    color: #fff !important;
}

/* ====== MODALS (dark) ====== */
.modal-content {
    background: rgba(15, 26, 51, .98) !important;
    /* similar al card */
    color: #e7eefc !important;
    border: 1px solid rgba(255, 255, 255, .12) !important;
    border-radius: 16px;
}

.modal-header,
.modal-footer {
    border-color: rgba(255, 255, 255, .10) !important;
}

.modal-title {
    color: #e7eefc !important;
}

.modal-body {
    color: #e7eefc !important;
}

/* Botón cerrar (la X) visible en dark */
.modal-header .btn-close {
    filter: invert(1) grayscale(100%);
    opacity: .85;
}

.modal-header .btn-close:hover {
    opacity: 1;
}

/* Backdrop un poco más oscuro */
.modal-backdrop.show {
    opacity: .75;
}

/* Menús de acciones dentro de tablas: no cortar verticalmente y usar scroll interno del menú si crece demasiado. */
.table-responsive {
    overflow-x: auto;
    overflow-y: visible;
    position: relative;
}

.card-body.table-responsive,
.modal-body .table-responsive {
    overflow-y: visible;
}

.table-responsive .dropdown-menu {
    z-index: 1085;
    max-height: min(70vh, 420px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* Inputs dentro del modal */
.modal-content .form-control,
.modal-content .form-select,
.modal-content textarea {
    background: rgba(255, 255, 255, .06) !important;
    color: #e7eefc !important;
    border: 1px solid rgba(255, 255, 255, .14) !important;
}

.modal-content .form-control::placeholder,
.modal-content textarea::placeholder {
    color: rgba(231, 238, 252, .65) !important;
}

/* Select: que no quede texto blanco sobre blanco */
.modal-content .form-select option {
    color: #0b1220;
    /* opciones en dropdown legibles */
}

/* === Selector demo comercial === */
.date-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .10);
    background: rgba(255, 255, 255, .04);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.date-pill:hover {
    transform: translateY(-1px);
    border-color: rgba(74, 163, 255, .35);
    box-shadow: 0 10px 30px rgba(74, 163, 255, .12);
    background: rgba(255, 255, 255, .055);
}

.date-ico {
    color: rgba(74, 163, 255, .95);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: rgba(74, 163, 255, .10);
    border: 1px solid rgba(74, 163, 255, .22);
}

.date-sep {
    color: rgba(255, 255, 255, .25);
    font-weight: 800;
    user-select: none;
}

.date-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border: none;
    outline: none;
    background: transparent;
    color: rgba(255, 255, 255, .92);
    font-weight: 700;
    font-size: 13px;
    letter-spacing: .2px;
    padding: 4px 6px;
    border-radius: 10px;
    cursor: pointer;
    transition: background .12s ease, color .12s ease;
}

.date-select:hover {
    background: rgba(255, 255, 255, .06);
}

.date-select option {
    background: #0b1220;
    color: #fff;
}

.date-btn {
    border: none;
    padding: 6px 12px;
    border-radius: 999px;
    font-weight: 900;
    font-size: 12px;
    letter-spacing: .2px;
    color: #0b1220;
    background: linear-gradient(135deg, #4aa3ff, #7c3aed);
    box-shadow: 0 10px 24px rgba(74, 163, 255, .18);
    cursor: pointer;
    transition: transform .12s ease, filter .12s ease, box-shadow .12s ease;
}

.date-btn:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(74, 163, 255, .22);
}

.date-btn:active {
    transform: translateY(0);
}

/* Botones tipo “chip” */
.ab-btn {
    border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(255, 255, 255, .04);
    color: var(--text);
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 14px;
    display: inline-flex;
    gap: 8px;
    align-items: center;
    font-weight: 800;
    line-height: 1;
    transition: transform .12s ease, background .12s ease, border-color .12s ease;
}

.ab-btn:hover {
    background: rgba(255, 255, 255, .08);
    border-color: rgba(255, 255, 255, .22);
    transform: translateY(-1px);
}

.ab-ico {
    opacity: .9;
}

.ab-primary {
    border-color: transparent;
    background: linear-gradient(135deg, rgba(74, 163, 255, 1), rgba(124, 58, 237, 1));
    box-shadow: 0 14px 30px rgba(74, 163, 255, .16);
}

.ab-primary:hover {
    filter: brightness(1.05);
}

.kpi-card {
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 18px;
    background: rgba(255, 255, 255, .03);
}

.kpi-card a:hover {
    color: var(--text) !important;
    text-decoration: underline !important;
}

.kpi-card h2 {
    font-weight: 900;
    margin: 0
}

.section-card {
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 18px;
    background: rgba(255, 255, 255, .03);
}

.table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: rgba(11, 18, 32, .95);
}

.top-item {
    border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(255, 255, 255, .03);
    border-radius: 14px;
    padding: 14px;
}

.progress {
    height: 10px;
    background: rgba(255, 255, 255, .06)
}

.progress-bar {
    background: linear-gradient(135deg, rgba(74, 163, 255, 1), rgba(124, 58, 237, 1)) !important;
}

select.form-select,
input.form-control {
    background-color: rgba(255, 255, 255, .06);
    color: var(--text);
    border-color: rgba(255, 255, 255, .12);
}

select.form-select option {
    color: #111;
}

/* ✅ Selector "pill" centrado y chico */
.date-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(255, 255, 255, .03);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .20);
}

.date-ico {
    opacity: .85;
    display: flex;
    align-items: center
}

.date-select {
    border: 0;
    outline: 0;
    padding: 6px 8px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .06);
    color: var(--text);
    font-weight: 800;
    font-size: 13px;
}

.date-sep {
    opacity: .6;
    font-weight: 900
}

.date-btn {
    border: 1px solid rgba(255, 255, 255, .16);
    background: linear-gradient(135deg, rgba(74, 163, 255, 1), rgba(124, 58, 237, 1));
    color: #fff;
    padding: 7px 10px;
    border-radius: 12px;
    font-weight: 900;
    font-size: 13px;
    cursor: pointer;
}

.date-btn:hover {
    filter: brightness(1.05);
}

/* Action bar layout */
.actionbar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 14px;
    align-items: center;
    background: transparent;
    border-radius: 18px;
    padding: 12px 0px;
}

.action-left {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.action-center {
    display: flex;
    justify-content: center;
}

.action-right {
    display: flex;
    justify-content: flex-end;
}

/* Botones tipo “chip” */
.ab-btn {
    border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(255, 255, 255, .04);
    color: var(--text);
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 14px;
    display: inline-flex;
    gap: 8px;
    align-items: center;
    font-weight: 800;
    line-height: 1;
    transition: transform .12s ease, background .12s ease, border-color .12s ease;
}

.ab-btn:hover {
    background: rgba(255, 255, 255, .08);
    border-color: rgba(255, 255, 255, .22);
    transform: translateY(-1px);
}

.ab-ico {
    opacity: .9;
}

.ab-primary {
    border-color: transparent;
    background: linear-gradient(135deg, rgba(74, 163, 255, 1), rgba(124, 58, 237, 1));
    box-shadow: 0 14px 30px rgba(74, 163, 255, .16);
}

.ab-primary:hover {
    filter: brightness(1.05);
}

/* Selector compacto y bonito */
.date-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(255, 255, 255, .04);
}

.date-ico {
    opacity: .85;
}

.date-select {
    appearance: none;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text);
    font-weight: 900;
    font-size: 13px;
    padding: 2px 2px;
}

.date-select option {
    color: #111;
}

.date-sep {
    opacity: .55;
    font-weight: 900;
}

.date-btn {
    border: 1px solid rgba(255, 255, 255, .16);
    background: rgba(255, 255, 255, .06);
    color: var(--text);
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 900;
}

.date-btn:hover {
    background: rgba(255, 255, 255, .10);
}

/* Responsive: selector abajo centrado */
@media (max-width: 900px) {
    .actionbar {
        grid-template-columns: 1fr;
    }

    .action-center {
        justify-content: flex-start;
    }

    .action-right {
        justify-content: flex-start;
    }
}

/* Select oscuro legible */
.date-select,
select.form-select {
    background-color: #1a2236 !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, .2) !important;
}

/* Opciones del dropdown */
.date-select option,
select.form-select option {
    background-color: #ffffff !important;
    color: #111111 !important;
}

/* Cuando está enfocado */
.date-select:focus {
    box-shadow: 0 0 0 3px rgba(74, 163, 255, .25);
}

/* ===== Premium Date Picker (Operis) ===== */
.datebar {
    display: flex;
    justify-content: center;
    margin: 10px 0 22px;
}

.dp {
    position: relative;
    width: min(520px, 100%);
}

.dp-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid rgba(255, 255, 255, .14);
    background: rgba(255, 255, 255, .04);
    color: var(--text);
    border-radius: 999px;
    padding: 10px 14px;
    cursor: pointer;
    user-select: none;
    transition: background .15s ease, border-color .15s ease, transform .05s ease;
}

.dp-trigger:hover {
    background: rgba(255, 255, 255, .06);
    border-color: rgba(255, 255, 255, .22);
}

.dp-trigger:active {
    transform: translateY(1px);
}

.dp-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.dp-ico {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .12);
    background: radial-gradient(800px 150px at 20% 0%, rgba(74, 163, 255, .18), transparent),
        rgba(255, 255, 255, .04);
}

.dp-title {
    display: flex;
    flex-direction: column;
    line-height: 1.05;
    min-width: 0;
}

.dp-title b {
    font-size: 14px;
    letter-spacing: .2px;
    font-weight: 900;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dp-title span {
    font-size: 12px;
    color: var(--muted);
}

.dp-right {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-weight: 800;
}

.dp-caret {
    width: 10px;
    height: 10px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform .15s ease;
    margin-right: 4px;
}

.dp.open .dp-caret {
    transform: rotate(-135deg);
}

.dp-panel {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(15, 26, 51, .98);
    box-shadow: 0 18px 50px rgba(0, 0, 0, .45);
    padding: 12px;
    display: none;
    z-index: 50;
}

.dp.open .dp-panel {
    display: block;
}

.dp-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.dp-search {
    width: 100%;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(255, 255, 255, .04);
    color: var(--text);
    padding: 10px 12px;
    outline: none;
}

.dp-search:focus {
    border-color: rgba(74, 163, 255, .6);
    box-shadow: 0 0 0 3px rgba(74, 163, 255, .12);
}

.dp-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 10px;
}

.dp-item {
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, .10);
    background: rgba(255, 255, 255, .03);
    padding: 10px 10px;
    cursor: pointer;
    transition: background .12s ease, border-color .12s ease;
    text-align: center;
    font-weight: 900;
    color: var(--text);
}

.dp-item:hover {
    background: rgba(255, 255, 255, .06);
    border-color: rgba(255, 255, 255, .18);
}

.dp-item.active {
    border-color: rgba(74, 163, 255, .55);
    background: rgba(74, 163, 255, .12);
}

.dp-subtitle {
    margin: 10px 0 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .3px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.dp-actions {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    margin: 10px 0 12px !important;
}

.dp-status {
    justify-content: center;
    text-align: center;
    white-space: nowrap;
}

.dp-btn {
    border-radius: 12px;
    padding: 9px 12px;
    border: 1px solid rgba(255, 255, 255, .14);
    background: rgba(255, 255, 255, .04);
    color: var(--text);
    font-weight: 900;
    cursor: pointer;
}

.dp-btn.primary {
    border-color: transparent;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
}

.dp-btn:hover {
    background: rgba(255, 255, 255, .06);
}

.dp-btn.primary:hover {
    filter: brightness(1.05);
}

/* ✅ FIX: panel suficientemente ancho + sin overflow raro */
.dp-panel {
    width: min(420px, calc(100vw - 24px));
    min-width: 360px;
    max-width: calc(100vw - 24px);
    box-sizing: border-box;
    overflow: hidden;
    /* evita que la grilla “salga” */
}

/* ✅ FIX: grillas dentro del panel */
.dp-grid {
    display: grid;
    gap: 10px;
}

/* ✅ Años: 4 columnas pero sin desbordarse */
#dpYears {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* ✅ Si la pantalla es angosta, baja a 3 columnas */
@media (max-width: 420px) {
    .dp-panel {
        min-width: 0;
    }

    #dpYears {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* ===== Baseline móvil app ===== */
@media (max-width: 991.98px) {
    body {
        background-attachment: scroll;
    }

    .container,
    .container-sm,
    .container-md,
    .container-lg,
    .container-xl,
    .container-xxl {
        padding-left: 14px;
        padding-right: 14px;
    }

    .ab-btn {
        padding: 9px 10px;
        border-radius: 12px;
        font-size: .92rem;
    }

    .table {
        font-size: .9rem;
    }

    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }

    .modal-dialog {
        margin: .4rem auto;
        max-width: calc(100vw - .8rem);
    }
}

@media (max-width: 575.98px) {
    .form-control,
    .form-select,
    input[type="text"],
    input[type="number"],
    input[type="email"],
    input[type="password"],
    textarea {
        font-size: 16px !important;
    }

    .table td,
    .table th {
        padding: .5rem .45rem;
    }
}

/* ===== Tema Claro ===== */
body.theme-light {
    --bg: #f3f7ff;
    --card: #ffffff;
    --text: #13243b;
    --muted: #5f6f86;
    --line: rgba(15, 23, 42, .16);
    --accent: #2563eb;
    --accent2: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;

    background-color: var(--bg);
    background-image:
        radial-gradient(circle at 20% 0%, rgba(37, 99, 235, .12), transparent 58%),
        radial-gradient(circle at 80% 0%, rgba(22, 163, 74, .08), transparent 62%);
    color: var(--text);
}

body.theme-light .text-muted {
    color: var(--muted) !important;
}

body.theme-light .card,
body.theme-light .kpi-card,
body.theme-light .section-card,
body.theme-light .top-item {
    background: #fff !important;
    border-color: var(--line) !important;
    box-shadow: 0 10px 26px rgba(15, 23, 42, .06);
}

body.theme-light .table,
body.theme-light .table td,
body.theme-light .table th {
    color: var(--text) !important;
    border-color: var(--line) !important;
}

body.theme-light .table thead th {
    background: rgba(247, 250, 255, .96) !important;
}

body.theme-light .table-hover tbody tr:hover {
    background-color: rgba(37, 99, 235, .10) !important;
    color: var(--text) !important;
}

body.theme-light .table-hover tbody tr:hover td,
body.theme-light .table-hover tbody tr:hover th {
    color: var(--text) !important;
}

body.theme-light .table-warning {
    background-color: rgba(217, 119, 6, .14) !important;
    color: var(--text) !important;
}

body.theme-light .table-warning td {
    color: var(--text) !important;
}

body.theme-light .table tbody tr.low-stock td {
    background: rgba(217, 119, 6, .10) !important;
    color: var(--text) !important;
}

body.theme-light .table tbody tr.low-stock td:first-child {
    border-left: 4px solid rgba(217, 119, 6, .55);
}

body.theme-light .alert {
    background: #fff !important;
    color: var(--text) !important;
    border-color: var(--line) !important;
}

body.theme-light .alert-success {
    border-color: rgba(22, 163, 74, .38) !important;
    background: rgba(22, 163, 74, .11) !important;
}

body.theme-light .alert-danger {
    border-color: rgba(220, 38, 38, .35) !important;
    background: rgba(220, 38, 38, .11) !important;
}

body.theme-light .badge.bg-secondary {
    background: rgba(15, 23, 42, .08) !important;
    border-color: rgba(15, 23, 42, .18) !important;
    color: var(--text) !important;
}

body.theme-light .badge.bg-warning {
    background: rgba(217, 119, 6, .24) !important;
    border-color: rgba(217, 119, 6, .35) !important;
    color: #5b3300 !important;
}

body.theme-light .ab-btn {
    border-color: rgba(15, 23, 42, .18);
    background: #fff;
    color: var(--text);
}

body.theme-light .home-head .btn,
body.theme-light .home-head .btn.btn-sm,
body.theme-light .home-head .btn.btn-outline-secondary,
body.theme-light .home-head .btn.btn-outline-primary,
body.theme-light .home-head .btn.btn-primary {
    border-color: rgba(15, 23, 42, .18) !important;
    background: #fff !important;
    color: var(--text) !important;
}

body.theme-light .home-head .btn:hover,
body.theme-light .home-head .btn.btn-outline-secondary:hover,
body.theme-light .home-head .btn.btn-outline-primary:hover {
    background: #eef4ff !important;
    border-color: rgba(37, 99, 235, .35) !important;
}

body.theme-light .home-head .btn.btn-primary {
    color: #fff !important;
    border-color: transparent !important;
    background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
    box-shadow: 0 14px 30px rgba(37, 99, 235, .18);
}

body.theme-light .home-head .btn.btn-primary:hover {
    color: #fff !important;
    background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
    border-color: transparent !important;
    filter: brightness(1.05);
}

body.theme-light .ab-btn:not(.ab-primary):hover {
    background: #eef4ff;
    border-color: rgba(37, 99, 235, .35);
}

body.theme-light .ab-primary {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    box-shadow: 0 14px 30px rgba(37, 99, 235, .18);
}

body.theme-light .ab-primary:hover {
    color: #fff;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border-color: transparent;
    filter: brightness(1.05);
}

body.theme-light .btn-outline-secondary,
body.theme-light .btn-outline-primary,
body.theme-light .btn-outline-success,
body.theme-light .btn-outline-warning,
body.theme-light .btn-outline-danger,
body.theme-light .btn-outline-dark {
    border-color: rgba(15, 23, 42, .20) !important;
    color: var(--text) !important;
}

body.theme-light .btn-outline-secondary:hover,
body.theme-light .btn-outline-primary:hover,
body.theme-light .btn-outline-success:hover,
body.theme-light .btn-outline-warning:hover,
body.theme-light .btn-outline-danger:hover,
body.theme-light .btn-outline-dark:hover {
    background: #eef4ff !important;
}

body.theme-light .form-control,
body.theme-light .form-select,
body.theme-light textarea,
body.theme-light input.form-control,
body.theme-light select.form-select,
body.theme-light select.form-control {
    background: #fff !important;
    color: var(--text) !important;
    border: 1px solid rgba(15, 23, 42, .20) !important;
}

body.theme-light .form-control::placeholder,
body.theme-light textarea::placeholder {
    color: #7b889a !important;
}

body.theme-light .form-control:focus,
body.theme-light .form-select:focus,
body.theme-light .date-select:focus {
    border-color: rgba(37, 99, 235, .55) !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .14) !important;
}

body.theme-light select.form-select option,
body.theme-light select.form-control option,
body.theme-light .date-select option {
    background-color: #fff !important;
    color: #0f172a !important;
}

body.theme-light .bg-dark-subtle {
    background: #f2f6ff !important;
    border-color: var(--line) !important;
    color: var(--text) !important;
}

body.theme-light .modal-content {
    background: #fff !important;
    color: var(--text) !important;
    border: 1px solid rgba(15, 23, 42, .18) !important;
}

body.theme-light .modal-header,
body.theme-light .modal-footer {
    border-color: rgba(15, 23, 42, .12) !important;
}

body.theme-light .modal-title,
body.theme-light .modal-body {
    color: var(--text) !important;
}

body.theme-light .modal-header .btn-close {
    filter: none;
    opacity: .78;
}

body.theme-light .modal-backdrop.show {
    opacity: .45;
}

body.theme-light .date-pill,
body.theme-light .dp-trigger,
body.theme-light .dp-search,
body.theme-light .dp-btn,
body.theme-light .dp-item,
body.theme-light .dp-panel {
    background: #fff !important;
    color: var(--text) !important;
    border-color: rgba(15, 23, 42, .16) !important;
}

body.theme-light .dp-item.active {
    border-color: rgba(37, 99, 235, .55) !important;
    background: rgba(37, 99, 235, .12) !important;
}

body.theme-light .dp-ico {
    border-color: rgba(37, 99, 235, .20) !important;
    background: rgba(37, 99, 235, .08) !important;
}

/* ===== Compatibilidad light para vistas con estilos inline dark ===== */
body.theme-light .text-light,
body.theme-light .text-white {
    color: var(--text) !important;
}

body.theme-light .dashboard-shell {
    border-color: rgba(37, 99, 235, .16) !important;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, .08), transparent 36%),
        #ffffff !important;
    box-shadow: 0 18px 40px rgba(15, 23, 42, .08) !important;
}

body.theme-light .home-user-chip,
body.theme-light .cc-user-chip,
body.theme-light .ci-user-chip,
body.theme-light .ct-summary-box,
body.theme-light .cc-toolbar,
body.theme-light .cc-section,
body.theme-light .cc-kpi-card,
body.theme-light .cc-summary-card,
body.theme-light .cc-mini,
body.theme-light .cc-export-list,
body.theme-light .top-item,
body.theme-light .mv-section-card,
body.theme-light .alert-card,
body.theme-light .action-group,
body.theme-light .mobile-admin-trigger,
body.theme-light .dashboard-switch,
body.theme-light .conta-metric-switch {
    background: #ffffff !important;
    border-color: var(--line) !important;
    box-shadow: 0 10px 26px rgba(15, 23, 42, .06);
}

body.theme-light .dashboard-shell .kpi-card,
body.theme-light .dashboard-shell .section-card,
body.theme-light .ct-detail-wrap td {
    background: #f8fbff !important;
}

body.theme-light .action-group-summary:hover,
body.theme-light .ab-btn:not(.ab-primary):hover,
body.theme-light .dp-trigger:hover,
body.theme-light .dp-item:hover,
body.theme-light .dp-btn:hover {
    background: #eef4ff !important;
}

body.theme-light .dp-subtitle,
body.theme-light .mv-section-kicker,
body.theme-light .ct-summary-label,
body.theme-light .cc-kpi-title,
body.theme-light .cc-summary-title,
body.theme-light .conta-alert-title {
    color: #35506e !important;
}

body.theme-light .cc-select {
    background: #ffffff !important;
    color: var(--text) !important;
    border-color: rgba(15, 23, 42, .20) !important;
}

body.theme-light .mv-section-sub,
body.theme-light .alert-sub,
body.theme-light .pay-status-label,
body.theme-light .sub-breakdown-label,
body.theme-light .pay-breakdown-label {
    color: var(--muted) !important;
}

body.theme-light .cc-badge,
body.theme-light .doc-badge {
    border-color: rgba(37, 99, 235, .22) !important;
    background: rgba(37, 99, 235, .10) !important;
    color: #1d4ed8 !important;
}

body.theme-light .module-state-pill,
body.theme-light .alert-badge,
body.theme-light .alert-chip {
    border-color: rgba(217, 119, 6, .30) !important;
    background: rgba(217, 119, 6, .14) !important;
    color: #8a5800 !important;
}

body.theme-light .sub-breakdown-row.is-total .sub-breakdown-label,
body.theme-light .sub-breakdown-row.is-total .sub-breakdown-value,
body.theme-light .pay-breakdown-row.is-total .pay-breakdown-label,
body.theme-light .pay-breakdown-row.is-total .pay-breakdown-value {
    color: #1d4ed8 !important;
}

body.theme-light .sub-status,
body.theme-light .pay-status-badge {
    border-color: var(--line) !important;
}

body.theme-light .ct-info-dot {
    border-color: rgba(15, 23, 42, .16) !important;
    background: #eef4ff !important;
    color: #35506e !important;
}

body.theme-light .sub-status.is-success,
body.theme-light .pay-status-badge.is-success {
    color: #166534 !important;
}

body.theme-light .sub-status.is-warning,
body.theme-light .pay-status-badge.is-warning {
    color: #8a5800 !important;
}

body.theme-light .sub-status.is-danger,
body.theme-light .pay-status-badge.is-danger {
    color: #b42318 !important;
}

body.theme-light .pay-status-badge.is-info {
    color: #1d4ed8 !important;
}

body.theme-light .conta-metric-btn.is-active,
body.theme-light .cc-scope-btn.is-active {
    background: rgba(37, 99, 235, .14) !important;
    color: #1d4ed8 !important;
    box-shadow: none !important;
}

body.theme-light .cc-close-final td {
    background: rgba(37, 99, 235, .12) !important;
    color: #123461 !important;
}

/* ===== Boton flotante tema ===== */
.operis-theme-fab {
    position: fixed;
    right: 16px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
    z-index: 1040;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .24);
    background: rgba(15, 26, 51, .92);
    color: #e7eefc;
    text-decoration: none;
    font-weight: 900;
    font-size: 13px;
    letter-spacing: .2px;
    box-shadow: 0 14px 32px rgba(0, 0, 0, .28);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: transform .12s ease, box-shadow .12s ease, background .12s ease, border-color .12s ease;
}

.operis-theme-fab:hover {
    color: #fff;
    transform: translateY(-1px);
    border-color: rgba(74, 163, 255, .48);
    background: rgba(20, 34, 64, .96);
    box-shadow: 0 16px 34px rgba(0, 0, 0, .32);
}

.operis-theme-fab-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: radial-gradient(circle at 30% 30%, #fde047 0 35%, #f59e0b 70%);
    box-shadow: 0 0 0 2px rgba(253, 224, 71, .18);
}

body.theme-light .operis-theme-fab {
    border-color: rgba(15, 23, 42, .22);
    background: rgba(255, 255, 255, .95);
    color: #13243b;
    box-shadow: 0 12px 28px rgba(15, 23, 42, .18);
}

body.theme-light .operis-theme-fab:hover {
    color: #13243b;
    border-color: rgba(37, 99, 235, .42);
    background: #ffffff;
    box-shadow: 0 14px 30px rgba(37, 99, 235, .20);
}

body.theme-light .operis-theme-fab-dot {
    background: radial-gradient(circle at 35% 35%, #1d4ed8 0 35%, #2563eb 75%);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, .16);
}

@media (max-width: 991.98px) {
    .operis-theme-fab {
        right: 12px;
        bottom: calc(env(safe-area-inset-bottom, 0px) + 82px);
        padding: 9px 11px;
        font-size: 12px;
    }
}

/* ===== Navegacion modular global ===== */
.operis-module-nav {
    margin: 0 0 1rem;
}

.operis-module-nav-shell {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
}

.operis-module-group {
    border: 1px solid rgba(148, 163, 184, .22);
    border-radius: 18px;
    background: rgba(11, 18, 32, .72);
    box-shadow: 0 14px 34px rgba(2, 8, 23, .18);
    overflow: hidden;
}

.operis-module-summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
}

.operis-module-group.is-active,
.operis-module-group[open] {
    border-color: rgba(74, 163, 255, .45);
    box-shadow: 0 16px 34px rgba(12, 28, 56, .28);
}

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

.operis-module-head {
    min-width: 0;
}

.operis-module-kicker {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #93c5fd;
    font-weight: 800;
    margin-bottom: 2px;
}

.operis-module-title {
    font-size: 17px;
    line-height: 1.1;
    font-weight: 900;
    color: #f8fafc;
}

.operis-module-sub {
    margin-top: 4px;
    font-size: 12px;
    color: #a8b4d6;
}

.operis-module-caret {
    width: 12px;
    height: 12px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    color: #a8b4d6;
    transition: transform .18s ease;
    flex: 0 0 auto;
    margin-right: 4px;
}

.operis-module-group[open] .operis-module-caret {
    transform: rotate(225deg);
}

.operis-module-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 18px 18px;
}

.operis-module-links .ab-btn {
    font-size: 12px;
    padding: 9px 12px;
    border-radius: 12px;
    background: rgba(15, 23, 42, .9);
    border-color: rgba(148, 163, 184, .34);
    color: #e2e8f0;
}

.operis-module-links .ab-btn:hover {
    background: rgba(30, 41, 59, .95);
    border-color: rgba(125, 211, 252, .6);
    color: #f8fafc;
}

.operis-module-links .operis-module-link-current {
    background: linear-gradient(180deg, #4aa3ff 0%, #2b7de2 100%);
    color: #f8fbff;
    border-color: rgba(74, 163, 255, .65);
    box-shadow: 0 12px 24px rgba(43, 125, 226, .28);
}

body.theme-light .operis-module-group {
    background: #ffffff;
    border-color: rgba(148, 163, 184, .35);
    box-shadow: 0 12px 28px rgba(15, 23, 42, .08);
}

body.theme-light .operis-module-title {
    color: #0f172a;
}

body.theme-light .operis-module-sub {
    color: #64748b;
}

body.theme-light .operis-module-kicker {
    color: #2563eb;
}

body.theme-light .operis-module-caret {
    color: #64748b;
}

body.theme-light .operis-module-links .operis-module-link-current {
    color: #ffffff;
    border-color: rgba(37, 99, 235, .55);
    box-shadow: 0 12px 22px rgba(37, 99, 235, .18);
}

/* ===== Menu modular SaaS ===== */
.operis-saas-menu {
    width: 100%;
    margin: 0 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.operis-saas-menu .saas-module-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.operis-saas-menu .saas-module-card {
    position: relative;
    border: 1px solid rgba(148, 163, 184, .24);
    border-radius: 18px;
    background:
        radial-gradient(circle at top left, rgba(74, 163, 255, .22), transparent 42%),
        linear-gradient(135deg, rgba(14, 24, 42, .94), rgba(6, 35, 44, .9));
    color: #e2e8f0;
    min-height: 96px;
    padding: 14px 14px 12px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    text-align: left;
    cursor: pointer;
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease, filter .2s ease;
    box-shadow: 0 14px 28px rgba(2, 8, 23, .28);
    backdrop-filter: blur(8px);
}

.operis-saas-menu .saas-module-card:hover {
    transform: translateY(-2px);
    border-color: rgba(96, 165, 250, .55);
    box-shadow: 0 18px 36px rgba(2, 8, 23, .35);
    filter: brightness(1.04);
}

.operis-saas-menu .saas-module-card.is-active {
    border-color: rgba(96, 165, 250, .75);
    box-shadow: 0 0 0 1px rgba(96, 165, 250, .26), 0 18px 38px rgba(37, 99, 235, .28);
}

.operis-saas-menu .saas-module-card.is-disabled {
    opacity: .78;
}

.operis-saas-menu .saas-module-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, .28);
    background: rgba(15, 23, 42, .5);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex: 0 0 34px;
}

.operis-saas-menu .saas-module-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.operis-saas-menu .saas-module-title {
    font-size: 15px;
    line-height: 1.15;
    font-weight: 900;
    color: #f8fafc;
}

.operis-saas-menu .saas-module-sub {
    font-size: 12px;
    color: #a8b4d6;
    line-height: 1.25;
}

.operis-saas-menu .saas-state-pill {
    margin-left: auto;
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 18px;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(251, 191, 36, .35);
    background: rgba(251, 191, 36, .14);
    color: #facc15;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .06em;
    text-transform: uppercase;
    line-height: 1;
}

.operis-saas-menu .saas-submenu-shell {
    border: 1px solid rgba(148, 163, 184, .22);
    border-radius: 18px;
    background:
        radial-gradient(circle at top right, rgba(14, 165, 233, .12), transparent 42%),
        rgba(7, 14, 25, .74);
    box-shadow: 0 20px 38px rgba(2, 8, 23, .26);
    backdrop-filter: blur(8px);
    padding: 12px;
}

.operis-saas-menu .saas-submenu-head {
    margin: 0 0 10px;
}

.operis-saas-menu .saas-submenu-title {
    font-size: 15px;
    line-height: 1.15;
    font-weight: 900;
    color: #f8fafc;
}

.operis-saas-menu .saas-submenu-sub {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 2px;
}

.operis-saas-menu .saas-submenu-track {
    display: none;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.operis-saas-menu .saas-submenu-track.is-active {
    display: flex;
    animation: operis-saas-fade-in .22s ease both;
}

.operis-saas-menu .saas-pill {
    border: 1px solid rgba(148, 163, 184, .3);
    background: rgba(15, 23, 42, .86);
    color: #e2e8f0;
    text-decoration: none;
    border-radius: 999px;
    padding: 9px 12px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    min-height: 36px;
    transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease, color .18s ease;
}

.operis-saas-menu .saas-pill:hover {
    transform: translateY(-1px);
    border-color: rgba(125, 211, 252, .6);
    background: rgba(30, 41, 59, .95);
    color: #f8fafc;
}

.operis-saas-menu .saas-pill.is-primary {
    border-color: rgba(74, 163, 255, .62);
    background: linear-gradient(180deg, #4aa3ff 0%, #2b7de2 100%);
    color: #f8fbff;
    box-shadow: 0 12px 24px rgba(43, 125, 226, .24);
}

.operis-saas-menu .saas-pill.is-current {
    border-color: rgba(16, 185, 129, .62);
    background: linear-gradient(180deg, #0ea5e9 0%, #0f766e 100%);
    color: #f8fbff;
    box-shadow: 0 12px 24px rgba(15, 118, 110, .24);
}

.operis-saas-menu .saas-pill.is-disabled {
    pointer-events: none;
    opacity: .62;
}

.operis-saas-menu .saas-pill.is-soon {
    opacity: .9;
    border-color: rgba(251, 191, 36, .35);
    background: rgba(120, 53, 15, .32);
    color: #fde68a;
}

.operis-saas-menu .saas-pill-note {
    margin-left: 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 16px;
    padding: 2px 7px;
    border-radius: 999px;
    border: 1px solid rgba(251, 191, 36, .35);
    background: rgba(251, 191, 36, .12);
    color: #facc15;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
    line-height: 1;
}

.operis-saas-menu .saas-pill-ico {
    opacity: .95;
    font-size: 13px;
    line-height: 1;
}

@keyframes operis-saas-fade-in {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.operis-unified-head.home-head,
.operis-unified-head.cc-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.operis-unified-head .home-user-actions,
.operis-unified-head .cc-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    margin-left: auto;
}

.operis-unified-head .home-user-chip,
.operis-unified-head .cc-user-chip {
    border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(255, 255, 255, .04);
    border-radius: 14px;
    padding: 10px 12px;
    min-width: 210px;
    line-height: 1.2;
}

.operis-unified-head .home-brand img {
    height: 70px !important;
    width: auto !important;
    border-radius: 12px;
}

.operis-unified-head .operis-dashboard-btn {
    order: 1;
}

.operis-unified-head .home-user-chip,
.operis-unified-head .cc-user-chip {
    order: 2;
}

.operis-unified-head .home-logout-form,
.operis-unified-head form[action="/logout"] {
    margin: 0;
    order: 3;
}

body.theme-light .operis-saas-menu .saas-module-card {
    border-color: rgba(148, 163, 184, .38);
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, .12), transparent 46%),
        linear-gradient(135deg, rgba(255, 255, 255, .96), rgba(241, 245, 249, .96));
    color: #1e293b;
    box-shadow: 0 14px 28px rgba(15, 23, 42, .09);
}

body.theme-light .operis-saas-menu .saas-module-card:hover {
    border-color: rgba(59, 130, 246, .55);
}

body.theme-light .operis-saas-menu .saas-module-card.is-active {
    border-color: rgba(37, 99, 235, .75);
    box-shadow: 0 0 0 1px rgba(37, 99, 235, .2), 0 16px 30px rgba(37, 99, 235, .16);
}

body.theme-light .operis-saas-menu .saas-module-icon {
    border-color: rgba(148, 163, 184, .4);
    background: rgba(255, 255, 255, .88);
}

body.theme-light .operis-saas-menu .saas-module-title,
body.theme-light .operis-saas-menu .saas-submenu-title {
    color: #0f172a;
}

body.theme-light .operis-saas-menu .saas-module-sub,
body.theme-light .operis-saas-menu .saas-submenu-sub {
    color: #64748b;
}

body.theme-light .operis-saas-menu .saas-submenu-shell {
    border-color: rgba(148, 163, 184, .35);
    background:
        radial-gradient(circle at top right, rgba(59, 130, 246, .1), transparent 42%),
        rgba(255, 255, 255, .96);
    box-shadow: 0 14px 30px rgba(15, 23, 42, .09);
}

body.theme-light .operis-saas-menu .saas-pill {
    border-color: rgba(148, 163, 184, .45);
    background: #ffffff;
    color: #1e293b;
}

body.theme-light .operis-saas-menu .saas-pill:hover {
    background: #f8fafc;
    border-color: rgba(59, 130, 246, .48);
}

body.theme-light .operis-saas-menu .saas-pill.is-soon {
    border-color: rgba(217, 119, 6, .45);
    background: rgba(254, 243, 199, .88);
    color: #92400e;
}

body.theme-light .operis-saas-menu .saas-pill-note {
    border-color: rgba(217, 119, 6, .35);
    background: rgba(245, 158, 11, .14);
    color: #a16207;
}

@media (max-width: 991.98px) {
    .operis-saas-menu .saas-module-grid {
        grid-template-columns: 1fr;
    }

    .operis-saas-menu .saas-submenu-track {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 2px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    .operis-saas-menu .saas-pill {
        flex: 0 0 auto;
    }

    .operis-unified-head .home-user-actions,
    .operis-unified-head .cc-actions {
        width: 100%;
        justify-content: stretch;
        margin-left: 0;
    }

    .operis-unified-head .home-user-chip,
    .operis-unified-head .cc-user-chip,
    .operis-unified-head .operis-dashboard-btn,
    .operis-unified-head .home-logout-form,
    .operis-unified-head .home-logout-form .ab-btn,
    .operis-unified-head form[action="/logout"],
    .operis-unified-head form[action="/logout"] .ab-btn {
        width: 100%;
        justify-content: center;
        text-align: center;
    }

    .operis-unified-head .home-brand {
        width: 100%;
        justify-content: center;
    }

    .operis-unified-head .home-brand img {
        height: 56px !important;
    }
}

/* ===== Actividades economicas SII ===== */
.operis-activity-picker {
    position: relative;
}

.operis-activity-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    display: none;
    max-height: 260px;
    overflow: auto;
    z-index: 45;
    padding: 8px;
    border: 1px solid rgba(148, 163, 184, .28);
    border-radius: 16px;
    background: rgba(9, 15, 28, .98);
    box-shadow: 0 18px 42px rgba(2, 8, 23, .34);
    backdrop-filter: blur(10px);
}

.operis-activity-results.show {
    display: grid;
    gap: 6px;
}

.operis-activity-option {
    width: 100%;
    border: 1px solid rgba(148, 163, 184, .18);
    border-radius: 12px;
    background: rgba(15, 23, 42, .88);
    color: #e2e8f0;
    text-align: left;
    padding: 10px 12px;
    transition: border-color .15s ease, background .15s ease, transform .15s ease;
}

.operis-activity-option:hover,
.operis-activity-option:focus {
    border-color: rgba(74, 163, 255, .45);
    background: rgba(25, 40, 68, .94);
    transform: translateY(-1px);
    outline: none;
}

.operis-activity-option-title {
    font-size: 13px;
    font-weight: 800;
    color: #f8fafc;
}

.operis-activity-option-meta,
.operis-activity-meta {
    font-size: 12px;
    color: #94a3b8;
}

.operis-activity-meta {
    min-height: 18px;
}

body.theme-light .operis-activity-results {
    border-color: rgba(148, 163, 184, .35);
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 18px 34px rgba(15, 23, 42, .12);
}

body.theme-light .operis-activity-option {
    background: #f8fafc;
    border-color: rgba(148, 163, 184, .26);
    color: #0f172a;
}

body.theme-light .operis-activity-option:hover,
body.theme-light .operis-activity-option:focus {
    border-color: rgba(37, 99, 235, .35);
    background: #eff6ff;
}

body.theme-light .operis-activity-option-title {
    color: #0f172a;
}

body.theme-light .operis-activity-option-meta,
body.theme-light .operis-activity-meta {
    color: #64748b;
}

/* ===== Comunas Chile ===== */
.operis-location-picker {
    position: relative;
}

.operis-location-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    display: none;
    max-height: 260px;
    overflow: auto;
    z-index: 45;
    padding: 8px;
    border: 1px solid rgba(148, 163, 184, .28);
    border-radius: 16px;
    background: rgba(9, 15, 28, .98);
    box-shadow: 0 18px 42px rgba(2, 8, 23, .34);
    backdrop-filter: blur(10px);
}

.operis-location-results.show {
    display: grid;
    gap: 6px;
}

.operis-location-option {
    width: 100%;
    border: 1px solid rgba(148, 163, 184, .18);
    border-radius: 12px;
    background: rgba(15, 23, 42, .88);
    color: #e2e8f0;
    text-align: left;
    padding: 10px 12px;
    transition: border-color .15s ease, background .15s ease, transform .15s ease;
}

.operis-location-option:hover,
.operis-location-option:focus {
    border-color: rgba(74, 163, 255, .45);
    background: rgba(25, 40, 68, .94);
    transform: translateY(-1px);
    outline: none;
}

.operis-location-option-title {
    font-size: 13px;
    font-weight: 800;
    color: #f8fafc;
}

.operis-location-option-meta,
.operis-location-meta {
    font-size: 12px;
    color: #94a3b8;
}

.operis-location-meta {
    min-height: 18px;
}

.operis-location-warning {
    display: none;
    font-size: 12px;
    color: #fbbf24;
    min-height: 18px;
}

.operis-location-warning.show {
    display: block;
}

body.theme-light .operis-location-results {
    border-color: rgba(148, 163, 184, .35);
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 18px 34px rgba(15, 23, 42, .12);
}

body.theme-light .operis-location-option {
    background: #f8fafc;
    border-color: rgba(148, 163, 184, .26);
    color: #0f172a;
}

body.theme-light .operis-location-option:hover,
body.theme-light .operis-location-option:focus {
    border-color: rgba(37, 99, 235, .35);
    background: #eff6ff;
}

body.theme-light .operis-location-option-title {
    color: #0f172a;
}

body.theme-light .operis-location-option-meta,
body.theme-light .operis-location-meta {
    color: #64748b;
}

body.theme-light .operis-location-warning {
    color: #b45309;
}
