/* ── Fuente global Montserrat ── */
body, button, input, select, textarea, th, td, label, a {
    font-family: 'Montserrat', sans-serif !important;
}

/* ── Variables de layout ── */
:root {
    --sidebar-w-closed: 64px;
    --sidebar-w-open:   224px;
    --sidebar-bg:       #16171C;
    --sidebar-hover-bg: var(--color-primary-shadow-md);
    --sidebar-hover-fg: #ffffff;
    --sidebar-active-bg:var(--color-primary);
    --sidebar-active-fg:#ffffff;
    --header-h:         52px;
}

/* ───────────────────────────
   NAVBAR (full width, fijo)
─────────────────────────────*/
.top-nav-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-h);
    background: #ffffff;
    border-bottom: 1px solid #f0f0f0;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
    z-index: 12;
    display: flex;
    align-items: center;
}

.topnav-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0 20px;
}

.topnav-left { display: flex; align-items: center; }

.topnav-logo {
    height: 28px;
    object-fit: contain;
    object-position: left center;
}

.topnav-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* User info block */
.topnav-user {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Black avatar circle */
.topnav-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #1a1a1a;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: 0;
    user-select: none;
}

.topnav-user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.35;
}
/* Nombre del usuario — arriba, bold */
.topnav-username {
    font-size: 11px;
    font-weight: 700;
    color: #262626;
    white-space: nowrap;
    display: block;
    text-transform: uppercase;
}
/* Rol — abajo, gris */
.topnav-company {
    font-size: 11px;
    font-weight: 400;
    color: #8c8c8c;
    white-space: nowrap;
    display: block;
}

/* Logout button */
.topnav-logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    color: #595959;
    text-decoration: none !important;
    font-size: 15px;
    border: 1px solid #e8e8e8;
    background: #fff;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    flex-shrink: 0;
}
.topnav-logout-btn:hover {
    background: #fff2f0;
    border-color: #ffa39e;
    color: #cf1322;
    text-decoration: none !important;
}
.topnav-logout-btn:focus {
    color: #595959;
    text-decoration: none !important;
    outline: none;
}

/* ───────────────────────────
   SIDEBAR (empieza bajo el navbar)
─────────────────────────────*/
.sidebar {
    z-index: 10;
    position: fixed;
    top: var(--header-h);   /* empieza donde termina el navbar */
    bottom: 0;
    left: 0;
    width: var(--sidebar-w-closed);
    background-color: var(--sidebar-bg);
    overflow: hidden;
    transition: width 0.25s ease;
    box-shadow: 2px 0 10px rgba(0,0,0,.35);
    display: flex;
    flex-direction: column;
}

.sidebar.sidebar-open {
    width: var(--sidebar-w-open);
}

/* ── Sidebar header (solo toggle, centrado) ── */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    height: 48px;
    min-height: 48px;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,.06);
}

.sidebar-toggle {
    background: none;
    border: none;
    color: rgba(255,255,255,.65);
    font-size: 15px;
    cursor: pointer;
    padding: 8px 10px;
    border-radius: 6px;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
    outline: none;
}
.sidebar-toggle:hover {
    background: rgba(255,255,255,.1);
    color: #fff;
}
.sidebar-toggle:focus { outline: none; }

/* ── Nav scrollable area ── */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #3a3b42 transparent;
}
.sidebar-nav::-webkit-scrollbar        { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track  { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb  { background: #3a3b42; border-radius: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: #555; }

/* ── Nav list ── */
.sidebar ul {
    list-style: none;
    margin: 0;
    padding: 8px 0;
}
.sidebar li {
    margin: 0;
    padding: 0;
}

.sidebar a {
    display: flex;
    align-items: center;
    height: 44px;
    padding: 0 10px;
    color: rgba(255,255,255,.65);
    text-decoration: none !important;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    border-radius: 8px;
    margin: 2px 8px;
    transition: background 0.15s, color 0.15s;
}

.sidebar a:hover {
    background: var(--sidebar-hover-bg);
    color: var(--sidebar-hover-fg);
    text-decoration: none !important;
}
.sidebar a:hover .fa,
.sidebar a:hover .fas,
.sidebar a:hover .glyphicon {
    color: var(--sidebar-hover-fg);
}

.sidebar a.nav-active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-fg);
}
.sidebar a.nav-active .fa,
.sidebar a.nav-active .fas,
.sidebar a.nav-active .glyphicon {
    color: var(--sidebar-active-fg);
}

/* Icons */
.sidebar a .fa,
.sidebar a .fas,
.sidebar a .glyphicon {
    font-size: 15px !important;
    width: 24px;
    min-width: 24px;
    text-align: center;
    flex-shrink: 0;
    color: rgba(255,255,255,.65);
    position: static !important;
    top: auto !important;
    height: auto !important;
    line-height: 1;
}

/* Nav label */
.nav-item {
    margin-left: 10px;
    opacity: 0;
    transition: opacity 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    flex: 1;
    position: static !important;
    top: auto !important;
    width: auto !important;
}
.sidebar-open .nav-item {
    opacity: 1;
}

/* ── Sidebar footer (versión) ── */
.sidebar-footer {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    border-top: 1px solid rgba(255,255,255,.06);
}
.sidebar-version {
    font-size: 10px;
    color: rgba(255,255,255,.28);
    white-space: nowrap;
    letter-spacing: 0.3px;
}

/* ───────────────────────────
   CONTENEDOR PRINCIPAL
─────────────────────────────*/
.principal-container {
    margin-left: var(--sidebar-w-closed);
    margin-top: var(--header-h);
    padding: 20px 20px 30px;
    transition: margin-left 0.25s ease;
    min-height: calc(100vh - var(--header-h));
    box-sizing: border-box;
}
.principal-container.sidebar-open {
    margin-left: var(--sidebar-w-open);
}

/* ───────────────────────────
   MODULE HEADER (badge de módulo)
─────────────────────────────*/
.cat-module-header {
    display: flex;
    align-items: flex-start;
    margin-bottom: 12px;
}
.cat-module-badge {
    display: flex;
    align-items: center;
    gap: 10px;
}
.cat-module-icon {
    width: 40px;
    height: 40px;
    background: var(--color-primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 17px;
    flex-shrink: 0;
    box-shadow: 0 3px 8px var(--color-primary-shadow-lg);
}
.cat-module-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.cat-module-name {
    font-size: 15px;
    font-weight: 700;
    color: #262626;
    line-height: 1.2;
}
.cat-module-info .cat-back-link {
    margin-bottom: 0;
    font-size: 12px;
    color: #8c8c8c;
}
.cat-module-info .cat-back-link:hover { color: var(--color-primary); }

/* ───────────────────────────
   CARDS de redirección (grid tipo v2)
─────────────────────────────*/
.cat-grid-v2 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    max-width: 820px;
    margin-top: 16px;
}
.cat-card-v2 {
    background: #fff;
    border: 1px solid #f0f0f0;
    border-radius: 12px;
    padding: 18px 18px 16px;
    cursor: pointer;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
    transition: border-color .18s, box-shadow .18s, transform .15s;
    width: 100%;
}
.cat-card-v2:hover {
    border-color: var(--color-primary);
    box-shadow: 0 4px 18px var(--color-primary-shadow-md);
    transform: translateY(-2px);
}
.cat-card-v2:active { transform: translateY(0); background: color-mix(in srgb, var(--color-primary) 4%, white); }
.cat-card-v2:hover .cat-icon-v2 { background: var(--color-primary); color: #fff; }
.cat-card-v2:hover .cat-arrow-v2 { color: var(--color-primary); animation: cat-arrow-slide .85s ease-in-out infinite; }
@keyframes cat-arrow-slide {
    0%   { transform: translateX(-3px); opacity: 0; }
    20%  { opacity: 1; }
    80%  { opacity: 1; }
    100% { transform: translateX(5px); opacity: 0; }
}
.cat-top-v2 {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}
.cat-icon-v2 {
    width: 38px;
    height: 38px;
    border-radius: 9px;
    background: color-mix(in srgb, var(--color-primary) 15%, transparent);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
    transition: background .18s, color .18s;
}
.cat-arrow-v2 { color: #d9d9d9; font-size: 11px; margin-top: 2px; }
.cat-label-v2 { font-size: 13px; font-weight: 600; color: #262626; line-height: 1.35; }
.cat-text-v2 { font-size: 11px; color: #8c8c8c; line-height: 1.3; }
@media (max-width: 640px) { .cat-grid-v2 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 400px) { .cat-grid-v2 { grid-template-columns: 1fr; } }

/* ═══════════════════════════════════════════
   Modal (bootbox) — mismo restyle que frontend-backoffice
   Sin overflow:hidden en modal-content ni overflow-y:auto en
   modal-body para que los drops de chosen/select no queden clipados.
═══════════════════════════════════════════ */
.bootbox .modal-dialog {
    display: flex;
    align-items: center;
    min-height: calc(100% - 3.5rem);
    height: auto;
    margin: 1.75rem auto;
}
.bootbox .modal-content {
    border-radius: 8px;
    border: none;
    box-shadow: 0 6px 16px rgba(0,0,0,.12), 0 3px 6px rgba(0,0,0,.08);
}
.bootbox .modal-header {
    background: #fff !important;
    border-bottom: 1px solid #f0f0f0;
    border-radius: 8px 8px 0 0;
    padding: 16px 20px;
}
.bootbox .modal-title {
    font-size: 14px;
    font-weight: 600;
    color: #262626;
}
.bootbox .modal-title .fa { color: var(--color-primary); margin-right: 6px; }
.bootbox .bootbox-close-button {
    color: #bfbfbf;
    opacity: 1;
    font-size: 10px;
    line-height: 1;
    float: right;
}
.bootbox .bootbox-close-button:hover { color: #262626; }
.bootbox .modal-body {
    padding: 20px 24px;
    background: #fff;
    font-size: 13px;
    color: #262626;
}
.bootbox .modal-footer {
    border-top: 1px solid #f0f0f0;
    background: #fafafa;
    border-radius: 0 0 8px 8px;
    padding: 12px 20px;
    text-align: right;
}
.bootbox .modal-footer .btn + .btn { margin-left: 8px; }
.bootbox .form-group { margin-bottom: 14px; }
.bootbox label {
    font-size: 13px;
    font-weight: 500;
    color: #595959;
    margin-bottom: 4px;
    display: block;
}
.bootbox .form-control {
    height: 34px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-size: 13px;
    color: #262626;
    padding: 4px 11px;
    box-shadow: none;
    transition: border-color .2s, box-shadow .2s;
}
.bootbox .form-control:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px var(--color-primary-shadow);
    outline: none;
}
.bootbox select.form-control { padding-right: 28px; }
.bootbox .chosen-container-active .chosen-single,
.bootbox .chosen-container-active .chosen-choices,
.bootbox .chosen-container-single.chosen-with-drop .chosen-single {
    border-color: var(--color-primary) !important;
    box-shadow: 0 0 0 2px var(--color-primary-shadow) !important;
    outline: 0 !important;
}
.bootbox .chosen-search input[type="text"]:focus {
    border-color: var(--color-primary) !important;
    box-shadow: 0 0 0 2px var(--color-primary-shadow) !important;
    outline: 0 !important;
}
.bootbox textarea.form-control { height: auto; min-height: 80px; }
.bootbox .modal-footer .btn {
    height: 32px;
    padding: 0 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    transition: background .2s, border-color .2s, color .2s;
}
.bootbox .modal-footer .btn-success,
.bootbox .modal-footer .btn-primary {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}
.bootbox .modal-footer .btn-success:hover,
.bootbox .modal-footer .btn-primary:hover {
    background: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
}
.bootbox .modal-footer .btn-default {
    background: #fff;
    border-color: #d9d9d9;
    color: #595959;
}
.bootbox .modal-footer .btn-default:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

/* ═══════════════════════════════════════════
   Toast (bootstrap-notify) — mismo estilo Ant Design que frontend-backoffice
═══════════════════════════════════════════ */
.ant-notif {
    display: flex !important;
    align-items: flex-start;
    gap: 12px;
    background: #fff !important;
    border: none !important;
    border-radius: 8px !important;
    box-shadow: 0 6px 16px 0 rgba(0,0,0,.08),
                0 3px 6px -4px rgba(0,0,0,.12),
                0 9px 28px 8px rgba(0,0,0,.05) !important;
    padding: 16px 36px 16px 16px !important;
    width: 360px;
    position: relative;
}
/* icono FA por tipo */
.ant-notif-icon {
    flex-shrink: 0;
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    font-size: 20px;
    line-height: 1.4;
}
.ant-notif-success .ant-notif-icon::before { content: '\f058'; color: #52c41a; }
.ant-notif-danger  .ant-notif-icon::before { content: '\f057'; color: #ff4d4f; }
.ant-notif-warning .ant-notif-icon::before { content: '\f06a'; color: #faad14; }
.ant-notif-info    .ant-notif-icon::before { content: '\f05a'; color: var(--color-primary); }
/* contenido */
.ant-notif-content { flex: 1; min-width: 0; }
.ant-notif-title {
    font-size: 15px;
    font-weight: 600;
    color: rgba(0,0,0,.88);
    margin-bottom: 6px;
    line-height: 1.4;
}
.ant-notif-title strong { font-weight: inherit; }
.ant-notif-title br { display: none; }
.ant-notif-desc {
    font-size: 13px;
    color: rgba(0,0,0,.65);
    line-height: 1.5715;
}
/* botón cerrar */
.ant-notif-close {
    position: absolute;
    top: 16px;
    right: 12px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 12px;
    color: rgba(0,0,0,.35);
    padding: 4px 0 0 0;
    line-height: 1;
    transition: color .2s;
}
.ant-notif-close:hover { color: rgba(0,0,0,.75); }
/* progress bar — animación CSS pura, sin JS */
@keyframes ant-notif-drain {
    from { width: 100%; }
    to   { width: 0%; }
}
.ant-notif-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(0,0,0,.06);
    border-radius: 0 0 8px 8px;
    overflow: hidden;
}
.ant-notif-progress-bar {
    height: 100%;
    width: 100%;
    border-radius: 0 0 8px 8px;
    animation: ant-notif-drain 6s linear forwards;
}
.ant-notif-success .ant-notif-progress-bar { background: #52c41a; }
.ant-notif-danger  .ant-notif-progress-bar { background: #ff4d4f; }
.ant-notif-warning .ant-notif-progress-bar { background: #faad14; }
.ant-notif-info    .ant-notif-progress-bar { background: var(--color-primary); }

/* ── Table width fix ── */
.fixed-table-container table {
    width: 100% !important;
}

/* ── Metro Loading — rediseño ── */
.mnMlMainContainer {
    background-color: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
}
.mnMlTitle {
    font-size: 12px !important;
    font-weight: 600 !important;
    letter-spacing: 0.3px !important;
    margin-bottom: 20px !important;
    color: #fff !important;
}
.mnMlLoadingIcon {
    width: 20px !important;
    height: 20px !important;
    font-size: 0 !important;
    border: 3px solid rgba(255,255,255,0.25) !important;
    border-top-color: #fff !important;
    border-radius: 50% !important;
    display: inline-block !important;
    animation: mnSpin 0.75s linear infinite !important;
    vertical-align: middle !important;
    box-sizing: border-box !important;
}
.mnMlLoadingIcon::before {
    content: '' !important;
    display: none !important;
}
@keyframes mnSpin {
    to { transform: rotate(360deg); }
}

/* ── Placeholders ── */
::-webkit-input-placeholder { color: #adadad; text-transform: none; }
:-moz-placeholder            { color: #adadad; opacity: 1; text-transform: none; }
::-moz-placeholder           { color: #adadad; opacity: 1; text-transform: none; }
:-ms-input-placeholder       { color: #adadad; text-transform: none; }
::-ms-input-placeholder      { color: #adadad; text-transform: none; }
::placeholder                { color: #adadad; text-transform: none; }
