:root {
    --teh-primary: #1e3a8a;
    --teh-primary-dark: #1e40af;
    --teh-accent: #dc2626;
    --teh-accent-dark: #b91c1c;
    --teh-body-bg: #f4f7fb;
    --teh-sidebar-bg: #ffffff;
    --teh-topbar-bg: #ffffff;
    --teh-text: #2a3547;
    --teh-muted: #5a6a85;
    --teh-border: #ebf1f6;
    --teh-shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Plus Jakarta Sans", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--teh-text);
    background: var(--teh-body-bg);
}

a {
    color: var(--teh-primary);
    text-decoration: none;
}

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

.btn-primary {
    --bs-btn-bg: var(--teh-primary);
    --bs-btn-border-color: var(--teh-primary);
    --bs-btn-hover-bg: var(--teh-primary-dark);
    --bs-btn-hover-border-color: var(--teh-primary-dark);
    --bs-btn-active-bg: var(--teh-primary-dark);
    --bs-btn-active-border-color: var(--teh-primary-dark);
}

.btn-outline-primary {
    --bs-btn-color: var(--teh-primary);
    --bs-btn-border-color: var(--teh-primary);
    --bs-btn-hover-bg: var(--teh-primary);
    --bs-btn-hover-border-color: var(--teh-primary);
}

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

.form-control:focus {
    border-color: rgba(30, 58, 138, 0.55);
    box-shadow: 0 0 0 0.25rem rgba(30, 58, 138, 0.15);
}

#main-wrapper {
    min-height: 100vh;
}

.radial-gradient {
    background:
        radial-gradient(circle at top left, rgba(30, 58, 138, 0.15), transparent 35%),
        radial-gradient(circle at bottom right, rgba(220, 38, 38, 0.12), transparent 30%),
        linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
}

.authentication-login {
    box-shadow: var(--teh-shadow);
}

.auth-max-width {
    max-width: 480px;
    width: 100%;
}

.z-index-5 {
    position: relative;
    z-index: 5;
}

.h-n80 {
    min-height: 80vh;
}

.mb-7 {
    margin-bottom: 2rem !important;
}

.py-8 {
    padding-top: 0.85rem !important;
    padding-bottom: 0.85rem !important;
}

.card {
    border: 1px solid var(--teh-border);
    box-shadow: var(--teh-shadow);
    border-radius: 1rem;
}

.card-title {
    color: var(--teh-text);
}

.metric-card {
    color: inherit;
}

.metric-card:hover {
    color: inherit;
    border-color: rgba(30, 58, 138, 0.35);
}

.metric-label {
    margin-bottom: 0.35rem;
    color: var(--teh-muted);
    font-size: 0.85rem;
}

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--teh-primary);
}

.metric-value-sm {
    font-size: 1.6rem;
}

.metric-card-critico .metric-value {
    color: var(--teh-accent);
}

.metric-bar {
    height: 8px;
    background: #e8eef6;
    border-radius: 999px;
    overflow: hidden;
}

.metric-bar > span {
    display: block;
    height: 100%;
    background: var(--teh-primary);
}

.metric-bar-critico > span {
    background: var(--teh-accent);
}

.relacion-mapa {
    overflow-x: auto;
    padding: 1.75rem 1rem 1.25rem;
    border-radius: 1.25rem;
    background:
        radial-gradient(circle at 1px 1px, rgba(30, 58, 138, 0.08) 1px, transparent 0) 0 0 / 22px 22px,
        linear-gradient(180deg, #f8fafc 0%, #eef3fb 100%);
}

.relacion-arbol {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: max-content;
    min-width: 100%;
}

.relacion-nodo {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    min-width: 11.5rem;
    max-width: 15rem;
    padding: 0.95rem 1rem 0.85rem;
    border: 1px solid #e4ebf5;
    border-radius: 1.1rem;
    background: #fff;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
    text-align: center;
    text-decoration: none;
    color: var(--teh-text);
}

.relacion-nodo strong {
    font-size: 1rem;
    line-height: 1.25;
    letter-spacing: -0.01em;
}

.relacion-kicker {
    color: var(--teh-primary);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.relacion-meta {
    color: var(--teh-muted);
    font-size: 0.78rem;
    line-height: 1.35;
}

.relacion-icono {
    display: grid;
    place-items: center;
    width: 2.3rem;
    height: 2.3rem;
    margin-bottom: 0.2rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    font-size: 1.15rem;
}

.relacion-interaccion {
    min-width: 16rem;
    padding-top: 1.05rem;
    border: 0;
    background: linear-gradient(155deg, #1e3a8a 0%, #2747b0 58%, #3156c9 100%);
    box-shadow: 0 16px 34px rgba(30, 58, 138, 0.28);
    color: #fff;
}

.relacion-interaccion .relacion-kicker,
.relacion-interaccion strong,
.relacion-interaccion .relacion-meta {
    color: #fff;
}

.relacion-interaccion .relacion-kicker {
    color: rgba(255, 255, 255, 0.72);
}

.relacion-interaccion .relacion-meta {
    color: rgba(255, 255, 255, 0.84);
}

.relacion-contexto {
    border-top: 3px solid var(--teh-primary);
}

.relacion-contexto a {
    color: inherit;
    text-decoration: none;
}

.relacion-contexto a:hover {
    color: var(--teh-primary);
}

.relacion-contexto-cerrado {
    border-top-color: #94a3b8;
    background: #f8fafc;
    box-shadow: none;
}

.relacion-solicitud {
    min-width: 10.5rem;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.relacion-solicitud:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.1);
    color: var(--teh-text);
}

.relacion-solicitud-critica {
    border-color: #fecaca;
    background: linear-gradient(180deg, #fff 0%, #fff7f7 100%);
}

.relacion-solicitud-critica .relacion-kicker {
    color: var(--teh-accent);
}

.relacion-vacio {
    border-style: dashed;
    background: rgba(255, 255, 255, 0.55);
    box-shadow: none;
    color: var(--teh-muted);
}

.relacion-vacio strong {
    font-weight: 600;
}

.relacion-sin-temas {
    margin: 1.25rem 0 0;
    color: var(--teh-muted);
    text-align: center;
}

.relacion-ramas,
.relacion-hijos {
    display: flex;
    justify-content: center;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.relacion-ramas > li,
.relacion-hijos > li {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding: 2rem 0.7rem 0;
}

.relacion-ramas > li::before,
.relacion-hijos > li::before,
.relacion-ramas > li::after,
.relacion-hijos > li::after {
    content: "";
    position: absolute;
    top: 0;
    width: 50%;
    height: 2rem;
    border-top: 1.5px solid #c5d2e4;
}

.relacion-ramas > li::before,
.relacion-hijos > li::before {
    right: 50%;
}

.relacion-ramas > li::after,
.relacion-hijos > li::after {
    left: 50%;
    border-left: 1.5px solid #c5d2e4;
}

.relacion-ramas > li:first-child::before,
.relacion-hijos > li:first-child::before,
.relacion-ramas > li:last-child::after,
.relacion-hijos > li:last-child::after {
    border: 0 none;
}

.relacion-ramas > li:last-child::before,
.relacion-hijos > li:last-child::before {
    border-right: 1.5px solid #c5d2e4;
    border-radius: 0 12px 0 0;
}

.relacion-ramas > li:first-child::after,
.relacion-hijos > li:first-child::after {
    border-radius: 12px 0 0 0;
}

.relacion-ramas > li:only-child::before,
.relacion-ramas > li:only-child::after,
.relacion-hijos > li:only-child::before,
.relacion-hijos > li:only-child::after {
    display: none;
}

.relacion-ramas > li:only-child::after,
.relacion-hijos > li:only-child::after {
    display: block;
    left: 50%;
    width: 0;
    border-top: 0;
    border-left: 1.5px solid #c5d2e4;
    border-radius: 0;
}

.solicitud-thread {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 36rem;
    overflow: auto;
}

.solicitud-bubble {
    max-width: 85%;
    padding: 0.65rem 0.9rem;
    border-radius: 1rem;
}

.solicitud-bubble-cliente {
    align-self: flex-start;
    background: #f4f7fb;
}

.solicitud-bubble-bot {
    align-self: flex-end;
    background: #e8eefc;
}

.solicitud-evento {
    border-left: 3px solid #0a3da3;
    padding-left: 0.9rem;
    margin-bottom: 1rem;
}

.solicitud-evento:last-child {
    margin-bottom: 0;
}

.solicitud-evento-critico {
    border-left-color: #ef1d2a;
}

.page-wrapper {
    margin-left: 280px;
    min-height: 100vh;
    transition: margin-left 0.2s ease;
}

#main-wrapper[data-sidebartype="mini-sidebar"] .page-wrapper {
    margin-left: 87px;
}

#main-wrapper[data-sidebartype="mini-sidebar"] .left-sidebar {
    width: 87px;
}

#main-wrapper[data-sidebartype="mini-sidebar"] .hide-menu,
#main-wrapper[data-sidebartype="mini-sidebar"] .nav-small-cap {
    display: none;
}

#main-wrapper[data-sidebartype="mini-sidebar"] .sidebar-link {
    justify-content: center;
}

#main-wrapper[data-sidebartype="mini-sidebar"] .brand-logo {
    justify-content: center;
    padding-inline: 0.5rem;
}

.left-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background: var(--teh-sidebar-bg);
    border-right: 1px solid var(--teh-border);
    z-index: 1030;
    transition: transform 0.2s ease;
}

.left-sidebar > div {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.brand-logo {
    flex-shrink: 0;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--teh-border);
}

.brand-logo .logo-img {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    line-height: 0;
    text-decoration: none;
}

.topbar .logo-img img {
    display: block;
    width: auto;
    max-width: 240px;
    height: auto;
    max-height: 44px;
    object-fit: contain;
}

.sidebar-nav {
    flex: 1;
    min-height: 0;
    padding: 1rem 0.75rem 2rem;
    overflow-y: auto;
}

.sidebar-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-small-cap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0.85rem 0.5rem;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--teh-muted);
    font-weight: 700;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 0.85rem;
    border-radius: 0.75rem;
    color: var(--teh-text);
    margin-bottom: 0.25rem;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.sidebar-link:hover,
.sidebar-link.active {
    background: rgba(30, 58, 138, 0.08);
    color: var(--teh-primary);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    background: var(--teh-topbar-bg);
    border-bottom: 1px solid var(--teh-border);
}

.topbar .navbar {
    min-height: 72px;
    padding-inline: 1.25rem;
}

.topbar .navbar .navbar-nav .dropdown-menu {
    position: absolute;
    min-width: 200px;
    z-index: 1050;
}

.topbar .navbar .navbar-nav .nav-item.dropdown {
    position: relative;
}

.topbar .navbar .navbar-nav .nav-item.dropdown .dropdown-menu-end {
    right: 0;
    left: auto;
    top: 100%;
}

.topbar .navbar .navbar-nav .nav-item .nav-link:not(.nav-link-user) {
    display: flex;
    align-items: center;
    line-height: 72px;
    height: 72px;
    padding: 0 15px;
    font-size: 14px;
    color: var(--teh-text);
}

.topbar .navbar .navbar-nav .nav-link-user {
    display: flex;
    align-items: center;
    height: auto;
    line-height: 1;
    padding: 0 0 0 0.5rem;
}

.user-profile-nav .dropdown-menu {
    margin-top: 0.5rem;
}

.user-profile-menu {
    width: 360px;
    max-width: calc(100vw - 2rem);
    padding: 0;
    overflow: hidden;
}

.user-profile-menu__header {
    padding: 1rem 1.5rem 0.75rem;
}

.user-profile-menu__title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--teh-text);
}

.user-profile-menu__info {
    padding: 1rem 1.5rem 1.25rem;
    border-bottom: 1px solid var(--teh-border);
}

.user-profile-menu__name {
    margin: 0 0 0.35rem;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--teh-text);
}

.user-profile-menu__email {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--teh-muted);
    word-break: break-word;
}

.user-profile-menu__email i {
    flex-shrink: 0;
    font-size: 1rem;
}

.user-profile-menu__links {
    padding: 0.5rem 0;
}

.user-profile-menu__link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1.5rem;
    color: var(--teh-text);
    transition: background-color 0.2s ease;
}

.user-profile-menu__link:hover {
    background: rgba(30, 58, 138, 0.06);
    color: var(--teh-primary);
}

.user-profile-menu__link-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.5rem;
    background: #f6f9fc;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-profile-menu__link-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.user-profile-menu__link-text strong {
    font-size: 0.95rem;
    font-weight: 600;
}

.user-profile-menu__link-text small {
    font-size: 0.82rem;
    color: var(--teh-muted);
}

.user-profile-menu__footer {
    padding: 0.75rem 1.5rem 1.25rem;
    border-top: 1px solid var(--teh-border);
}

.topbar .navbar .navbar-nav.quick-links .nav-item .nav-link {
    position: relative;
    z-index: 2;
}

.topbar .navbar .navbar-nav.quick-links .nav-item:hover .nav-link,
.topbar .navbar .navbar-nav .nav-item.dropdown.show .nav-link {
    color: var(--teh-primary);
}

.hover-dd {
    position: static;
}

.hover-dd .dropdown-menu-nav {
    max-width: 320px;
    width: 100%;
}

.hover-dd .dropdown-menu {
    margin-top: 0;
}

.hover-dd .dropdown-menu ul {
    list-style: none;
    margin: 0;
    padding: 0.5rem;
}

.hover-dd .dropdown-menu .dropdown-item {
    border-radius: 0.5rem;
    padding: 0.65rem 0.85rem;
}

.hover-dd .dropdown-toggle::after {
    display: none;
}

@media (min-width: 768px) {
    .topbar .navbar .navbar-nav .dropdown-menu.content-dd {
        width: 360px;
    }
}

@media (max-width: 767.98px) {
    .topbar .navbar-nav .dropdown-menu {
        width: 100%;
    }

    .topbar .navbar-nav .nav-item.dropdown {
        position: static;
    }
}

.nav-icon-hover-bg {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.nav-icon-hover-bg:hover {
    background: rgba(30, 58, 138, 0.08);
}

.body-wrapper {
    padding: 1.5rem;
}

.user-profile-img {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(30, 58, 138, 0.12);
    color: var(--teh-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.dropdown-menu {
    border: 1px solid var(--teh-border);
    box-shadow: var(--teh-shadow);
    border-radius: 0.85rem;
}

.content-dd {
    min-width: 320px;
}

@media (max-width: 767.98px) {
    .user-profile-menu {
        width: 100%;
        max-width: none;
    }
}

.brand-logo img.brand-logo-full {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
}

.brand-logo img.brand-logo-mini {
    display: none;
    width: 42px;
    height: 42px;
    object-fit: contain;
}

#main-wrapper[data-sidebartype="mini-sidebar"] .brand-logo img.brand-logo-full {
    display: none;
}

#main-wrapper[data-sidebartype="mini-sidebar"] .brand-logo img.brand-logo-mini {
    display: block;
    margin-inline: auto;
}

.login-hero-panel {
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem 2.5rem 2rem 3rem;
}

.login-hero-animation {
    width: 100%;
    height: 92vh;
    max-height: 920px;
    border: 0;
    border-radius: 1rem;
    background: #fff;
    box-shadow: var(--teh-shadow);
}

@media (min-width: 1400px) {
    .login-hero-panel {
        padding: 2rem 3rem 2rem 4rem;
    }
}

@media (max-width: 1199.98px) {
    .page-wrapper,
    #main-wrapper[data-sidebartype="mini-sidebar"] .page-wrapper {
        margin-left: 0;
    }

    .left-sidebar,
    #main-wrapper[data-sidebartype="mini-sidebar"] .left-sidebar {
        width: 280px;
        transform: translateX(-100%);
    }

    #main-wrapper.show-sidebar .left-sidebar,
    body.sidebar-open .left-sidebar {
        transform: translateX(0);
    }

    #main-wrapper.show-sidebar::before,
    body.sidebar-open #main-wrapper::before {
        content: "";
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.45);
        z-index: 1025;
    }
}

@media (max-width: 767.98px) {
    .body-wrapper {
        padding: 1rem;
    }
}

#tbl_filters {
    width: 100%;
}

#tbl_filters td {
    padding: 0.25rem 0.35rem;
    vertical-align: middle;
}

#tbl_filters .form-control-sm {
    min-width: 120px;
}

#list .table th,
#list .table td {
    vertical-align: middle;
}

#list .link {
    cursor: pointer;
}
