:root {
    --tl-purple: #2f4b6b;
    --tl-purple-light: #4d6f93;
    --tl-purple-soft: #edf2f8;
    --tl-orange: #9a6d4c;
    --tl-orange-light: #b28666;
    --tl-orange-soft: #f8f2ed;
    --tl-ui-bg: #f5f7fa;
    --tl-white: #FFFFFF;
    --tl-text: #1F2937;
    --tl-text-muted: #6B7280;
    --tl-border: #E5E7EB;
    --tl-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

html,
body {
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    line-height: 1.35;
}

body,
.page-content,
.authentication-bg {
    background: var(--tl-ui-bg) !important;
    color: var(--tl-text);
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-weight: 650;
    letter-spacing: 0.01em;
    line-height: 1.25;
}

p,
li,
.list-group-item,
.table td,
.table th {
    line-height: 1.35;
}

.page-content {
    padding: calc(var(--rsk-topbar-height, 70px) + 0.75rem) 12px 24px;
}

.page-content > .container-fluid {
    padding-top: 0.35rem;
}

.main-nav {
    background: #28415f !important;
    border-right: 1px solid rgba(255, 255, 255, 0.12);
}

.main-nav .logo-box {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 0.5rem;
}

.main-nav .nav-link,
.main-nav .nav-text,
.main-nav .menu-title,
.main-nav .sub-nav-link,
.main-nav .nav-icon,
.main-nav .logo-box,
.main-nav iconify-icon {
    color: #fff !important;
}

.main-nav .nav-link,
.main-nav .sub-nav-link {
    font-weight: 600;
}

.main-nav .nav-link:hover,
.main-nav .sub-nav-link:hover,
.main-nav .nav-link.active {
    background: rgba(255, 255, 255, 0.12) !important;
    border-radius: 10px;
}

.main-nav .tl-submenu-list {
    padding-left: 1.6rem;
    margin-top: 0.25rem;
    margin-bottom: 0.4rem;
}

.main-nav .sub-nav-link {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: rgba(255, 255, 255, 0.88) !important;
    padding: 0.35rem 0.6rem;
    border-radius: 8px;
    font-size: 0.82rem;
}

.main-nav .sub-nav-link.active {
    background: rgba(255, 255, 255, 0.16) !important;
    color: #fff !important;
}

.main-nav .tl-submenu-caret {
    font-size: 0.9rem;
    opacity: 0.8;
}

.card,
.auth-card,
.tl-card {
    border: 1px solid #ECEFF5;
    border-radius: 14px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
    padding: 16px;
    background: var(--tl-white);
}

.card-title,
.tl-section-title {
    font-weight: 700;
    letter-spacing: 0.01em;
}

.card-header {
    background: #F8FAFC;
    border-bottom: 1px solid #E5EAF0;
}

.card .card,
.auth-card .card {
    box-shadow: none;
    padding: 0;
}

.form-label {
    color: var(--tl-text);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    margin-bottom: 0.3rem;
}

.form-control,
.form-select,
.form-control:focus,
.form-select:focus {
    min-height: 36px;
    height: 36px;
    border-radius: 8px;
}

.form-control,
.form-select {
    border: 1px solid var(--tl-border);
    color: var(--tl-text);
    background-color: #fff;
    font-size: 0.84rem;
    padding: 0.32rem 0.65rem;
}

textarea.form-control {
    min-height: 92px;
    height: auto;
}

.form-control::placeholder {
    color: #9CA3AF;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--tl-purple);
    box-shadow: 0 0 0 0.2rem rgba(31, 58, 95, 0.14);
}

.btn {
    min-height: 36px;
    border-radius: 8px;
    font-weight: 600;
    padding: 0.45rem 0.9rem;
    border: 0;
}

.btn-primary,
.btn-success {
    background: #1F3A5F;
    color: #fff;
    box-shadow: none;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-success:hover,
.btn-success:focus {
    background: #182F4C;
    color: #fff;
}

.btn-secondary,
.btn-warning,
.btn-danger {
    background: #8B5E3C;
    color: #fff;
    box-shadow: none;
}

.btn-secondary:hover,
.btn-warning:hover,
.btn-danger:hover,
.btn-secondary:focus,
.btn-warning:focus,
.btn-danger:focus {
    background: #734C30;
    color: #fff;
}

.table {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: #FAFAFA;
    --bs-table-hover-bg: #FAFAFA;
    color: var(--tl-text);
}

.table thead th {
    background: #EEF3F8;
    border-bottom: 1px solid var(--tl-border);
    border-top: 0;
    color: var(--tl-text-muted);
    font-weight: 600;
    padding-top: 0.95rem;
    padding-bottom: 0.95rem;
}

.table tbody tr:nth-child(even) {
    background: #F8FAFC;
}

.table tbody td .badge {
    border-radius: 999px;
    padding: 0.35rem 0.6rem;
    font-weight: 600;
}

.table tbody td {
    border-color: #EEF0F5;
    padding-top: 0.95rem;
    padding-bottom: 0.95rem;
    vertical-align: middle;
    font-weight: 500;
}

.table tbody tr:hover {
    background: #FAFAFA;
}

.nav-tabs {
    border-bottom: 1px solid var(--tl-border);
    gap: 8px;
}

.nav-tabs .nav-link {
    border: 0;
    border-radius: 8px;
    color: var(--tl-text-muted);
    font-weight: 600;
}

.nav-tabs .nav-link.active,
.nav-tabs .nav-link:hover {
    color: var(--tl-purple);
    background: rgba(31, 58, 95, 0.1);
}

.modal-content {
    border: 0;
    border-radius: 12px;
    box-shadow: var(--tl-shadow);
}

.modal-footer {
    border-top: 1px solid #E5EAF0;
    gap: 0.45rem;
}

.modal-footer .btn {
    min-height: 32px;
    padding: 0.35rem 0.75rem;
    border-radius: 7px;
    font-size: 0.82rem;
    box-shadow: none !important;
}

.modal-footer .btn-primary,
.modal-footer .btn-success {
    background: #1F3A5F;
}

.modal-footer .btn-secondary,
.modal-footer .btn-light,
.modal-footer .btn-outline-secondary {
    background: #fff;
    color: #4b5563;
    border: 1px solid #d9dce3;
}

.alert {
    border: 0;
    border-radius: 10px;
    font-weight: 600;
}

.alert-info,
.alert-primary {
    background: var(--tl-purple-soft);
    color: #1F3A5F;
}

.alert-warning,
.alert-danger {
    background: var(--tl-orange-soft);
    color: #8B5E3C;
}

.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: var(--tl-ui-bg);
}

.auth-shell .auth-box {
    max-width: 420px;
    width: 100%;
}

.tl-section-title {
    margin-bottom: 14px;
    color: var(--tl-text);
    font-weight: 700;
}


.tl-form-card {
    border: 1px solid #E1E8F0;
    border-radius: 12px;
    padding: 14px;
    background: #FFFFFF;
}

.tl-form-card-title {
    font-size: 0.82rem;
    color: #2A4568;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.75rem;
    font-weight: 700;
}

.tl-form-actions {
    border-top: 1px solid #EEF0F6;
    margin-top: 0.25rem;
    padding-top: 0.85rem;
}

.tl-input-group .input-group-text {
    background: #EEF3F8;
    border-color: var(--tl-border);
    color: #7A8091;
    font-size: 0.78rem;
}

.topbar {
    border-bottom: 1px solid #E5EAF0;
    background: #ffffff;
}

.tl-brand-block {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.3rem 0.55rem;
    border: 1px solid #ebe5fa;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.88);
}

.main-nav .tl-brand-block {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
}

.main-nav .tl-brand-name {
    color: #fff;
}

.tl-brand-logo {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    padding: 0.2rem;
    background: #1F3A5F;
    box-shadow: 0 8px 18px rgba(31, 58, 95, 0.2);
}

.tl-brand-name {
    font-weight: 700;
    letter-spacing: 0.01em;
    color: #1F3048;
}

.tl-brand-subtitle {
    font-size: 0.68rem;
    font-weight: 600;
    color: #667A93;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.tl-topbar-clean {
    border-bottom: 1px solid #e8ecf4;
    background: #ffffff;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
}

.tl-topbar-layout {
    min-height: 70px;
    gap: 0.75rem;
}

.tl-topbar-left,
.tl-topbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tl-topbar-left {
    flex: 1;
    min-width: 0;
}

.tl-topbar-right .topbar-item {
    height: auto;
}

.tl-menu-toggle {
    margin-right: 0 !important;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid #e8ecf4;
    color: #6f7f97;
}

.tl-menu-toggle:hover {
    background: #f7f9fc;
    border-color: #d9e1ec;
    color: #3a4a63;
}

.tl-topbar-title-wrap {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.tl-topbar-title {
    font-size: 1.65rem;
    line-height: 1.05;
    font-weight: 700;
    color: #2f3b55;
    letter-spacing: -0.01em;
}

.tl-topbar-context {
    font-size: 0.68rem;
    color: #8b95a8;
    line-height: 1.15;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tl-topbar-action {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid #e8ecf4;
    background: #fff;
    color: #75829b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all .16s ease;
}

.tl-topbar-action:hover {
    color: #33415f;
    border-color: #d7deea;
    background: #f7f9fc;
}

.tl-user-trigger {
    width: auto;
    min-width: 42px;
    height: 36px;
    border-radius: 9px;
    border: 1px solid #e8ecf4;
    background: #fff;
    padding: 0.2rem 0.4rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: #55627b;
}

.tl-user-avatar {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: #1F3A5F;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.74rem;
}

.tl-user-meta {
    min-width: 0;
    flex-direction: column;
    line-height: 1.05;
    white-space: nowrap;
}

.tl-user-name {
    max-width: 150px;
    font-size: 0.74rem;
    color: #2f3b55;
}

.tl-user-role {
    max-width: 150px;
    font-size: 0.63rem;
    color: #8b95a8;
}

.tl-user-dropdown {
    min-width: 228px;
    border: 1px solid #e7ecf3;
    border-radius: 10px;
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
    margin-top: 0.35rem;
}

@media (max-width: 1199.98px) {
    .tl-topbar-title {
        font-size: 1.35rem;
    }
}

@media (max-width: 767.98px) {
    .topbar .container-fluid {
        padding-left: 0.6rem;
        padding-right: 0.6rem;
    }

    .tl-topbar-title {
        font-size: 1.02rem;
    }

    .tl-topbar-context {
        display: none;
    }

    .tl-topbar-right {
        gap: 0.3rem;
    }

    .tl-topbar-action,
    .tl-menu-toggle {
        width: 31px;
        height: 31px;
    }

    .tl-user-trigger {
        width: 33px;
        height: 33px;
        padding: 0;
        justify-content: center;
    }

    .tl-user-avatar {
        width: 23px;
        height: 23px;
        font-size: 0.68rem;
        border-radius: 6px;
    }

    .tl-user-dropdown {
        min-width: 198px;
    }
}

/* Fix menú lateral en móvil: cuando JS agrega .sidebar-enable debe mostrarse */
@media (max-width: 1140px) {
    html[data-menu-size="hidden"].sidebar-enable .main-nav,
    html.sidebar-enable .main-nav {
        transform: translateX(0) !important;
        margin-left: 0 !important;
        box-shadow: 6px 0 24px rgba(15, 23, 42, 0.2);
        z-index: 1046 !important;
        pointer-events: auto;
    }

    .topbar .button-toggle-menu.tl-menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
    }

    .topbar .button-toggle-menu.tl-menu-toggle iconify-icon {
        font-size: 1.25rem;
    }
}

.tl-minimal-form {
    border: 1px solid #E1E8F0;
    border-radius: 12px;
    padding: 0.9rem;
    background: #fff;
}

.list-group {
    border-radius: 12px;
    overflow: hidden;
}

.list-group-item {
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
    font-size: 0.82rem;
    border-color: #edf1f6;
}

.list-group-item strong {
    font-weight: 700;
}

.badge {
    border-radius: 999px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.page-title,
.tl-page-title {
    font-weight: 700;
    letter-spacing: 0.01em;
}

.table-responsive {
    border: 1px solid #E1E8F0;
    border-radius: 12px;
    overflow-x: auto;
    overflow-y: visible;
}

.card .table-responsive {
    min-height: 24rem;
}

.card .table-responsive .btn.dropdown-toggle {
    border-radius: 999px;
    font-size: 0.75rem;
    line-height: 1.2;
    font-weight: 600;
    padding: 0.3rem 0.65rem;
    border-color: #d9dee5;
    color: #2f3a4c;
    background: #fff;
}

.card .table-responsive .dropdown-menu {
    min-width: 11rem;
    border-radius: 0.6rem;
    border: 1px solid #e7eaef;
    box-shadow: 0 10px 24px rgba(23, 38, 61, 0.12);
    padding: 0.35rem;
    z-index: 1085;
}

.card .table-responsive .dropdown-menu .dropdown-item {
    border-radius: 0.4rem;
    font-size: 0.8125rem;
    padding: 0.45rem 0.6rem;
}


.tl-compact-input {
    min-height: 32px !important;
    height: 32px;
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

.card h5, .tl-section-title {
    font-size: 1rem;
}

.table tbody td, .table thead th {
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
}

/* Formularios estilo pedidos: compactos, ordenados y minimalistas */
.card form.row,
.card .tl-minimal-form {
    row-gap: 0.55rem;
}

.card form .form-label,
.tl-minimal-form .form-label {
    font-size: 0.76rem;
    font-weight: 700;
    color: #4b5563;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-bottom: 0.2rem;
}

.card form .form-control,
.card form .form-select,
.tl-minimal-form .form-control,
.tl-minimal-form .form-select {
    min-height: 34px;
    height: 34px;
    border-radius: 7px;
    border: 1px solid #d8deea;
    background: #fff;
    font-size: 0.84rem;
}

.card form textarea.form-control,
.tl-minimal-form textarea.form-control {
    min-height: 86px;
    height: auto;
}

.card form .form-control:focus,
.card form .form-select:focus,
.tl-minimal-form .form-control:focus,
.tl-minimal-form .form-select:focus {
    border-color: #355880;
    box-shadow: 0 0 0 0.16rem rgba(53, 88, 128, 0.18);
}

.btn {
    border-radius: 7px;
    font-weight: 600;
}

.btn-light,
.btn-outline-secondary {
    border: 1px solid #d9dce3;
    background: #fff;
    color: #4b5563;
}

.btn-light:hover,
.btn-outline-secondary:hover {
    background: #f8f9fc;
    color: #374151;
}

@media (max-width: 767.98px) {
    .form-control,
    .form-select,
    .card form .form-control,
    .card form .form-select,
    .tl-minimal-form .form-control,
    .tl-minimal-form .form-select,
    .tl-compact-input {
        min-height: 31px !important;
        height: 31px !important;
        font-size: 0.8rem;
        padding-top: 0.2rem;
        padding-bottom: 0.2rem;
    }

    textarea.form-control,
    .card form textarea.form-control,
    .tl-minimal-form textarea.form-control {
        min-height: 72px !important;
        height: auto !important;
    }

    .form-label,
    .card form .form-label,
    .tl-minimal-form .form-label {
        font-size: 0.72rem;
        margin-bottom: 0.15rem;
    }

    .btn {
        min-height: 32px;
        font-size: 0.8rem;
        padding: 0.35rem 0.7rem;
    }
}

/* ===== Admin panel style inspired by AdminLTE (no portal cliente) ===== */
.main-nav.tl-main-nav-adminlte {
    background: linear-gradient(180deg, #1f2d3d 0%, #121a23 100%) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.main-nav.tl-main-nav-adminlte .logo-box {
    background: rgba(47, 167, 238, 0.14);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    margin-bottom: .25rem;
}

.main-nav.tl-main-nav-adminlte .menu-title {
    color: rgba(148, 163, 184, 0.75) !important;
    text-transform: uppercase;
    font-size: 0.68rem;
    letter-spacing: .08em;
    margin: .75rem .85rem .35rem;
}

.main-nav.tl-main-nav-adminlte .nav-link,
.main-nav.tl-main-nav-adminlte .sub-nav-link {
    border-radius: 10px;
    margin: 0.12rem 0.45rem;
    color: rgba(226, 232, 240, 0.92) !important;
    font-weight: 600;
    min-height: 40px;
}

.main-nav.tl-main-nav-adminlte .nav-link .nav-icon,
.main-nav.tl-main-nav-adminlte .sub-nav-link .nav-icon {
    color: #8bb6d9 !important;
}

.main-nav.tl-main-nav-adminlte .nav-link.active,
.main-nav.tl-main-nav-adminlte .sub-nav-link.active,
.main-nav.tl-main-nav-adminlte .nav-link:hover,
.main-nav.tl-main-nav-adminlte .sub-nav-link:hover {
    background: rgba(58, 161, 222, 0.22) !important;
    color: #fff !important;
}

.topbar.tl-topbar-adminlte {
    background: #3c8dbc;
    border-bottom: 0;
}

.topbar.tl-topbar-adminlte .tl-topbar-layout {
    min-height: 62px;
}

.topbar.tl-topbar-adminlte .tl-topbar-title,
.topbar.tl-topbar-adminlte .tl-topbar-context,
.topbar.tl-topbar-adminlte .tl-user-name,
.topbar.tl-topbar-adminlte .tl-user-role,
.topbar.tl-topbar-adminlte .tl-topbar-action,
.topbar.tl-topbar-adminlte .tl-menu-toggle,
.topbar.tl-topbar-adminlte .tl-user-trigger {
    color: #fff;
}

.topbar.tl-topbar-adminlte .tl-topbar-action,
.topbar.tl-topbar-adminlte .tl-menu-toggle,
.topbar.tl-topbar-adminlte .tl-user-trigger {
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(15, 23, 42, 0.1);
}

.topbar.tl-topbar-adminlte .tl-user-avatar {
    background: rgba(15, 23, 42, 0.28);
}

.topbar.tl-topbar-adminlte .tl-topbar-context {
    opacity: 0.85;
    font-size: .62rem;
}

.topbar.tl-topbar-adminlte .tl-topbar-title {
    font-size: 1.05rem;
    line-height: 1.1;
}

.topbar.tl-topbar-adminlte .tl-topbar-title-wrap {
    gap: 0;
}

.wrapper:not(.tl-cliente) .page-content {
    padding-top: max(92px, calc(var(--rsk-topbar-height, 70px) + 1.25rem));
}

.wrapper:not(.tl-cliente) .page-content > .container-fluid {
    padding-top: .6rem;
}

.topbar.tl-topbar-adminlte .tl-topbar-action:hover,
.topbar.tl-topbar-adminlte .tl-menu-toggle:hover,
.topbar.tl-topbar-adminlte .tl-user-trigger:hover {
    background: rgba(15, 23, 42, 0.22);
}
