/* =========================================================
   VARIABLES
========================================================= */

:root {
    --primary: #1f7a4d;
    --primary-dark: #155c39;
    --primary-soft: #eaf6ef;
    --primary-shadow: rgba(31, 122, 77, 0.2);

    --background: #f5f7f6;
    --surface: #ffffff;
    --surface-elevated: #ffffff;

    --text: #17201b;
    --text-secondary: #6b756f;
    --text-muted: #9aa39e;

    --border: #e5e9e6;
    --hover: #f2f5f3;
    --input-bg: #fafbfa;
    --topbar-bg: rgba(255, 255, 255, 0.94);

    --success: #18864b;
    --success-bg: #e8f7ee;
    --warning: #c58a13;
    --warning-bg: #fff5dd;
    --danger: #c74747;
    --danger-bg: #fdeaea;
    --status-orange: #d97706;
    --status-orange-bg: #fff4e5;
    --status-info: #2f7c9a;
    --status-info-bg: #e6f3f8;

    --overlay: rgba(0, 0, 0, 0.35);
    --card-shadow: 0 2px 8px rgba(15, 23, 42, 0.025);
    --chart-end: #66b58a;

    --sidebar-width: 260px;
    --sidebar-collapsed: 78px;
    --topbar-height: 70px;
    /* Marco único de contenido — todos los módulos (base Facturas/Pagos) */
    --content-pad: 10px;
    --radius: 14px;
    --table-radius: 8px;
    --table-border: 1px solid var(--border);
    /* Fondo opaco del thead sticky (nunca rgba transparente) */
    --table-head-bg: #eaf6ef;
    --transition: 0.25s ease;

    /* Tipografía base — tamaños se controlan en controles.css */

    color-scheme: light;
}

[data-theme="dark"] {
    --primary: #3dba75;
    --primary-dark: #2fa365;
    --primary-soft: rgba(61, 186, 117, 0.16);
    --primary-shadow: rgba(61, 186, 117, 0.28);

    --background: #101614;
    --surface: #1a221e;
    --surface-elevated: #212c27;

    --text: #e7eee9;
    --text-secondary: #a3b0a9;
    --text-muted: #7a857e;

    --border: #2c3832;
    --hover: rgba(255, 255, 255, 0.05);
    --input-bg: #151c19;
    --topbar-bg: rgba(26, 34, 30, 0.92);

    --success: #3dba75;
    --success-bg: rgba(61, 186, 117, 0.16);
    --warning: #e0a82e;
    --warning-bg: rgba(224, 168, 46, 0.16);
    --danger: #e05c5c;
    --danger-bg: rgba(224, 92, 92, 0.16);
    --status-orange: #f0a14a;
    --status-orange-bg: rgba(240, 161, 74, 0.16);
    --status-info: #5aa8c8;
    --status-info-bg: rgba(90, 168, 200, 0.16);

    --overlay: rgba(0, 0, 0, 0.55);
    --card-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
    --chart-end: #5dca8c;
    /* Opaco primary+surface (evita sangrado bajo sticky; sin color-mix → html2canvas) */
    --table-head-bg: #24352c;

    color-scheme: dark;
}


/* =========================================================
   RESET
========================================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:focus {
    outline: none;
}

:focus-visible {
    outline: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-shadow);
}

/* =========================================================
   CHECKBOX
========================================================= */

.check input,
.container input {
    display: none;
}

.check,
.container {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    position: relative;
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.checkmark {
    position: relative;
    top: 0;
    left: 0;
    display: block;
    box-sizing: border-box;
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    font-size: 15px;
    margin: 0;
    background-color: transparent;
    border-radius: 0.25em;
    transition: all 0.25s;
}

.check input:checked ~ .checkmark,
.container input:checked ~ .checkmark,
.check input:indeterminate ~ .checkmark,
.container input:indeterminate ~ .checkmark {
    background-color: var(--primary);
    box-shadow: 0 4px 12px var(--primary-shadow);
}

.checkmark:after {
    content: "";
    position: absolute;
    transform: rotate(0deg);
    border: 0.1em solid color-mix(in srgb, var(--primary) 55%, var(--text-muted));
    left: 0;
    top: 0;
    width: 1.05em;
    height: 1.05em;
    border-radius: 0.25em;
    transition: all 0.25s, border-width 0.1s;
}

.check input:checked ~ .checkmark:after,
.container input:checked ~ .checkmark:after {
    left: 0.45em;
    top: 0.25em;
    width: 0.25em;
    height: 0.5em;
    border-color: #fff0 #fff #fff #fff0;
    border-width: 0 0.15em 0.15em 0;
    border-radius: 0em;
    transform: rotate(45deg);
}

.check:hover .checkmark:after,
.container:hover .checkmark:after {
    border-color: var(--primary);
}

.check input:checked ~ .checkmark:after,
.check:hover input:checked ~ .checkmark:after,
.container input:checked ~ .checkmark:after,
.container:hover input:checked ~ .checkmark:after {
    border-color: #fff0 #fff #fff #fff0;
}

.check input:indeterminate ~ .checkmark:after,
.check:hover input:indeterminate ~ .checkmark:after,
.container input:indeterminate ~ .checkmark:after,
.container:hover input:indeterminate ~ .checkmark:after {
    left: 0.28em;
    top: 0.52em;
    width: 0.7em;
    height: 0;
    border-color: #fff;
    border-width: 0 0 0.15em 0;
    border-radius: 0;
    transform: none;
}

.check:has(input:disabled),
.container:has(input:disabled) {
    cursor: not-allowed;
    opacity: 0.55;
}

.check:has(input:focus-visible) .checkmark,
.container:has(input:focus-visible) .checkmark {
    box-shadow: 0 0 0 3px var(--primary-shadow);
}

@media (prefers-reduced-motion: reduce) {
    .checkmark,
    .checkmark:after {
        transition: none;
    }
}

.date-picker-panel button:focus,
.date-picker-panel button:focus-visible,
.month-picker-panel button:focus,
.month-picker-panel button:focus-visible,
.select-picker-panel button:focus,
.select-picker-panel button:focus-visible,
.date-picker-query,
.month-picker-query,
.select-picker-query {
    border-color: transparent;
    box-shadow: none !important;
    outline: none !important;
}

.month-picker-query,
.date-picker-query,
.select-picker-query,
.month-picker-year {
    appearance: none;
    -webkit-appearance: none;
}

.month-picker-query:focus,
.month-picker-query:focus-visible,
.date-picker-query:focus,
.date-picker-query:focus-visible,
.select-picker-query:focus,
.select-picker-query:focus-visible {
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
}

.month-picker-search:focus-within,
.select-picker-search:focus-within {
    border-color: var(--primary);
    box-shadow: none;
}

.month-picker-year:focus,
.month-picker-year:focus-visible {
    border-color: var(--primary);
    box-shadow: none;
}

html,
body,
button,
a,
input,
select,
label,
textarea {
    -webkit-tap-highlight-color: transparent;
}

html {
    background: var(--background);
    /* Scrollbars finos: definición universal en controles.css */
}

body {
    font-family: var(--font-ui, "Segoe UI", ui-sans-serif, system-ui, sans-serif);
    font-size: var(--font-size-data, 11px);
    background: var(--background);
    color: var(--text);
    overflow-x: hidden;
    transition: background var(--transition), color var(--transition);
}

button,
input,
select,
textarea {
    font-family: inherit;
}

textarea {
    max-width: 100%;
    resize: vertical;
    box-sizing: border-box;
}

button {
    cursor: pointer;
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    appearance: none;
    -webkit-appearance: none;
}

svg {
    display: block;
}


/* =========================================================
   APP
========================================================= */

.app {
    min-height: 100vh;
}


/* =========================================================
   SIDEBAR
========================================================= */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    /* Nav: blanco en claro / oscuro en dark */
    background: #ffffff;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition:
        width var(--transition),
        background var(--transition),
        border-color var(--transition);
}

html[data-theme="dark"] .sidebar {
    background: #101614;
}

html:not(.ui-ready) .sidebar,
html:not(.ui-ready) .main {
    transition: none !important;
}


/* =========================================================
   LOGO
========================================================= */

.logo-container {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid var(--border);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
}

.logo {
    min-width: 40px;
    width: 40px;
    height: 40px;
    border-radius: 11px;
    object-fit: cover;
    box-shadow: 0 5px 15px var(--primary-shadow);
    flex-shrink: 0;
    display: block;
}

.brand {
    margin-left: 11px;
    white-space: nowrap;
    transition: opacity var(--transition), transform var(--transition);
}

.brand-name {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
}

.brand-subtitle {
    margin-top: 2px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}


/* =========================================================
   NAVIGATION
========================================================= */

.navigation {
    flex: 1;
    padding: 20px 12px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.section-title {
    padding: 0 12px;
    margin: 0 0 8px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-sedes {
    margin: 0 0 14px;
}

.sidebar-sedes .section-title {
    margin-bottom: 6px;
}

.sidebar-sedes-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 10px;
}

.sidebar-sede-chip {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    padding: 4px 9px;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--primary) 28%, var(--border));
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    font-family: inherit;
}

.sidebar-sede-chip.is-all {
    border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
    color: var(--primary);
}

.sidebar-sede-chip.is-on {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.sidebar-sede-chip.is-empty {
    border-style: dashed;
    border-color: var(--border);
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
    cursor: default;
}

.menu-item.is-sede-hidden,
.submenu.is-sede-hidden,
.menu-item-dept.is-sede-hidden {
    display: none !important;
}

.menu-item[hidden],
.submenu[hidden],
.section-title[hidden],
[data-access][hidden],
.view-panel[hidden],
.submenu a[hidden],
.submenu button[hidden],
[data-export][hidden] {
    display: none !important;
}


/* =========================================================
   MENU ITEM
========================================================= */

.menu-item {
    width: 100%;
    min-height: 44px;
    padding: 0 12px;
    margin-bottom: 3px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary);
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    text-decoration: none;
    font-size: 13px;
    line-height: 1;
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
}

.menu-item:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

.menu-item.active {
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 600;
}

.menu-item.active:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

.menu-icon {
    width: 22px;
    height: 22px;
    min-width: 22px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
}

.menu-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 1.8;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.menu-label {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
}

.menu-item-dept {
    min-height: 52px;
    height: auto;
    padding-top: 8px;
    padding-bottom: 8px;
    align-items: flex-start;
}

.menu-item-dept .menu-label {
    white-space: normal;
    font-size: 12px;
    line-height: 1.35;
    padding-right: 4px;
}

.menu-item.is-soon {
    opacity: 0.62;
    cursor: not-allowed;
}

.menu-soon {
    flex: 0 0 auto;
    margin-left: auto;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    white-space: nowrap;
}

.submenu .submenu .submenu-inner {
    margin-left: 18px;
    padding-left: 10px;
}

.submenu .menu-item {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    min-height: 38px;
    padding: 0 8px;
    font-size: 12px;
}

.submenu .menu-icon {
    width: 18px;
    min-width: 18px;
    margin-right: 8px;
}

.submenu .menu-icon svg {
    width: 16px;
    height: 16px;
}

.submenu .menu-item .menu-label {
    white-space: normal;
    text-overflow: unset;
    overflow: visible;
}

.menu-arrow {
    margin-left: auto;
    width: 18px;
    min-width: 18px;
    height: 18px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition);
}

.menu-arrow svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.menu-item.open .menu-arrow {
    transform: rotate(180deg);
}


/* =========================================================
   SUBMENU
========================================================= */

.submenu {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.2s ease;
}

.submenu.open {
    max-height: 2000px;
    opacity: 1;
}

.submenu-inner {
    margin: 3px 0 7px 33px;
    padding-left: 13px;
    border-left: 1px solid var(--border);
}

.submenu a:not(.menu-item),
.submenu button:not(.menu-item) {
    display: block;
    width: 100%;
    padding: 9px 8px;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 12px;
    line-height: 1.35;
    white-space: normal;
    text-align: left;
    text-decoration: none;
    border-radius: 7px;
    cursor: pointer;
    transition: 0.2s;
}

.submenu a:not(.menu-item):hover,
.submenu button:not(.menu-item):hover {
    background: var(--primary-soft);
    color: var(--primary);
}

.submenu a:not(.menu-item).active {
    color: var(--primary);
    font-weight: 600;
}


/* =========================================================
   SIDEBAR FOOTER
========================================================= */

.sidebar-footer {
    padding: 12px 16px 14px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
    overflow: visible;
}

.sidebar-footer-theme {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
}

.theme-footer-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.sidebar-chat-label {
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.sidebar-footer .theme-switch {
    --toggle-size: 11px;
}

.user {
    display: flex;
    align-items: center;
    padding: 7px;
    border-radius: 10px;
    overflow: hidden;
}

.logout-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    margin-left: auto;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}

.logout-btn:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

.logout-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.user-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    cursor: pointer;
}

.user-avatar.has-photo {
    padding: 0;
    overflow: hidden;
    background: transparent;
}

.user-avatar.has-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.user-info {
    margin-left: 10px;
    margin-right: 8px;
    min-width: 0;
    flex: 1;
    overflow: hidden;
    transition: opacity var(--transition), transform var(--transition);
}

.user-name {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    margin-top: 2px;
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* =========================================================
   COLLAPSED SIDEBAR
========================================================= */

.sidebar.collapsed,
html[data-sidebar="collapsed"] .sidebar {
    width: var(--sidebar-collapsed);
}

.sidebar.collapsed .logo-container,
html[data-sidebar="collapsed"] .sidebar .logo-container {
    justify-content: center;
    padding: 0;
}

.sidebar.collapsed .navigation,
html[data-sidebar="collapsed"] .sidebar .navigation {
    padding: 16px 0;
    align-items: center;
}

.sidebar.collapsed .brand,
.sidebar.collapsed .menu-label,
.sidebar.collapsed .menu-soon,
.sidebar.collapsed .section-title,
.sidebar.collapsed .sidebar-sedes,
.sidebar.collapsed .menu-arrow,
.sidebar.collapsed .user-info,
.sidebar.collapsed .logout-btn,
.sidebar.collapsed .theme-footer-label,
.sidebar.collapsed .sidebar-chat-label,
html[data-sidebar="collapsed"] .sidebar .brand,
html[data-sidebar="collapsed"] .sidebar .menu-label,
html[data-sidebar="collapsed"] .sidebar .menu-soon,
html[data-sidebar="collapsed"] .sidebar .section-title,
html[data-sidebar="collapsed"] .sidebar .sidebar-sedes,
html[data-sidebar="collapsed"] .sidebar .menu-arrow,
html[data-sidebar="collapsed"] .sidebar .user-info,
html[data-sidebar="collapsed"] .sidebar .logout-btn,
html[data-sidebar="collapsed"] .sidebar .theme-footer-label,
html[data-sidebar="collapsed"] .sidebar .sidebar-chat-label {
    display: none;
    flex: 0 0 0;
    opacity: 0;
    width: 0;
    min-width: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    transform: none;
    pointer-events: none;
}

.sidebar.collapsed .menu-item,
html[data-sidebar="collapsed"] .sidebar .menu-item {
    justify-content: center;
    align-items: center;
    padding: 0;
    margin-left: auto;
    margin-right: auto;
}

.sidebar.collapsed .menu-item-dept,
html[data-sidebar="collapsed"] .sidebar .menu-item-dept {
    min-height: 44px;
    align-items: center;
}

.sidebar.collapsed .menu-icon,
html[data-sidebar="collapsed"] .sidebar .menu-icon {
    margin: 0;
}

.sidebar.collapsed .submenu,
html[data-sidebar="collapsed"] .sidebar .submenu {
    display: none;
}

.sidebar.collapsed .user,
html[data-sidebar="collapsed"] .sidebar .user {
    justify-content: center;
    padding: 7px;
}

.sidebar.collapsed .sidebar-footer,
html[data-sidebar="collapsed"] .sidebar .sidebar-footer {
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 0;
}

.sidebar.collapsed .sidebar-footer-theme,
html[data-sidebar="collapsed"] .sidebar .sidebar-footer-theme {
    justify-content: center;
}

.sidebar.collapsed .sidebar-footer .theme-switch,
html[data-sidebar="collapsed"] .sidebar .sidebar-footer .theme-switch {
    --toggle-size: 9px;
    margin: 0 auto;
}

.sidebar.collapsed .app-chat,
html[data-sidebar="collapsed"] .sidebar .app-chat {
    width: auto;
}

.sidebar.collapsed .app-chat-fab,
html[data-sidebar="collapsed"] .sidebar .app-chat-fab {
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 12px;
    margin: 0 auto;
}


/* =========================================================
   MAIN
========================================================= */

.main {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left var(--transition);
}

.sidebar.collapsed ~ .main,
html[data-sidebar="collapsed"] .main {
    margin-left: var(--sidebar-collapsed);
}

/* =========================================================
   PRESENTATION / KIOSK (Alt+F) — hide chrome, fill viewport
========================================================= */

html[data-presentation="on"] .sidebar,
html[data-presentation="on"] .overlay,
html[data-presentation="on"] .topbar,
html[data-presentation="on"] .app-chat,
html[data-presentation="on"] .app-chat-panel,
html[data-presentation="on"] .app-chat-fab {
    display: none !important;
}

html[data-presentation="on"] .main,
html[data-presentation="on"] .sidebar.collapsed ~ .main,
html[data-presentation="on"][data-sidebar="collapsed"] .main {
    margin-left: 0 !important;
    width: 100%;
    min-height: 100vh;
}

html[data-presentation="on"] .content {
    padding: var(--content-pad);
    min-height: 100vh;
    width: 100%;
    box-sizing: border-box;
}

html[data-presentation="on"],
html[data-presentation="on"] body {
    overflow-x: hidden;
}



/* =========================================================
   TOPBAR
========================================================= */

.topbar {
    position: sticky;
    top: 0;
    min-height: var(--topbar-height);
    height: auto;
    background: #ffffff;
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 28px;
    z-index: 900;
    transition: background var(--transition), border-color var(--transition);
}

html[data-theme="dark"] .topbar {
    background: #101614;
}

.top-left {
    display: flex;
    align-items: center;
    gap: 18px;
}

.hamburger,
.top-icon {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: 0.2s;
    flex-shrink: 0;
}

.hamburger:hover,
.top-icon:hover {
    background: var(--hover);
    color: var(--primary);
}

.hamburger svg,
.top-icon svg {
    width: 19px;
    height: 19px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.top-icon {
    width: 38px;
    height: 38px;
    border-radius: 9px;
    position: relative;
}

.top-icon svg {
    width: 17px;
    height: 17px;
    stroke-width: 1.7;
}

.theme-switch {
    --toggle-size: 10px;
    --container-width: 5.625em;
    --container-height: 2.5em;
    --container-radius: 6.25em;
    --container-light-bg: #3D7EAE;
    --container-night-bg: #1D1F2C;
    --circle-container-diameter: 3.375em;
    --sun-moon-diameter: 2.125em;
    --sun-bg: #ECCA2F;
    --moon-bg: #C4C9D1;
    --spot-color: #959DB1;
    --circle-container-offset: calc((var(--circle-container-diameter) - var(--container-height)) / 2 * -1);
    --stars-color: #fff;
    --clouds-color: #F3FDFF;
    --back-clouds-color: #AACADF;
    --switch-transition: .5s cubic-bezier(0, -0.02, 0.4, 1.25);
    --circle-transition: .3s cubic-bezier(0, -0.02, 0.35, 1.17);
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.theme-switch,
.theme-switch *,
.theme-switch *::before,
.theme-switch *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-size: var(--toggle-size);
}

.theme-switch__container {
    width: var(--container-width);
    height: var(--container-height);
    background-color: var(--container-light-bg);
    border-radius: var(--container-radius);
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0em -0.062em 0.062em rgba(0, 0, 0, 0.25), 0em 0.062em 0.125em rgba(255, 255, 255, 0.94);
    transition: var(--switch-transition);
    position: relative;
}

.theme-switch__container::before {
    content: "";
    position: absolute;
    z-index: 1;
    inset: 0;
    box-shadow: 0em 0.05em 0.187em rgba(0, 0, 0, 0.25) inset, 0em 0.05em 0.187em rgba(0, 0, 0, 0.25) inset;
    border-radius: var(--container-radius);
}

.theme-switch__checkbox {
    display: none;
}

.theme-switch__circle-container {
    width: var(--circle-container-diameter);
    height: var(--circle-container-diameter);
    background-color: rgba(255, 255, 255, 0.1);
    position: absolute;
    left: var(--circle-container-offset);
    top: var(--circle-container-offset);
    border-radius: var(--container-radius);
    box-shadow: inset 0 0 0 3.375em rgba(255, 255, 255, 0.1), inset 0 0 0 3.375em rgba(255, 255, 255, 0.1), 0 0 0 0.625em rgba(255, 255, 255, 0.1), 0 0 0 1.25em rgba(255, 255, 255, 0.1);
    display: flex;
    transition: var(--circle-transition);
    pointer-events: none;
}

.theme-switch__sun-moon-container {
    pointer-events: auto;
    position: relative;
    z-index: 2;
    width: var(--sun-moon-diameter);
    height: var(--sun-moon-diameter);
    margin: auto;
    border-radius: var(--container-radius);
    background-color: var(--sun-bg);
    box-shadow: 0.062em 0.062em 0.062em 0em rgba(254, 255, 239, 0.61) inset, 0em -0.062em 0.062em 0em #a1872a inset;
    filter: drop-shadow(0.062em 0.125em 0.125em rgba(0, 0, 0, 0.25)) drop-shadow(0em 0.062em 0.125em rgba(0, 0, 0, 0.25));
    overflow: hidden;
    transition: var(--switch-transition);
}

.theme-switch__moon {
    transform: translateX(100%);
    width: 100%;
    height: 100%;
    background-color: var(--moon-bg);
    border-radius: inherit;
    box-shadow: 0.062em 0.062em 0.062em 0em rgba(254, 255, 239, 0.61) inset, 0em -0.062em 0.062em 0em #969696 inset;
    transition: var(--switch-transition);
    position: relative;
}

.theme-switch__spot {
    position: absolute;
    top: 0.75em;
    left: 0.312em;
    width: 0.75em;
    height: 0.75em;
    border-radius: var(--container-radius);
    background-color: var(--spot-color);
    box-shadow: 0em 0.0312em 0.062em rgba(0, 0, 0, 0.25) inset;
}

.theme-switch__spot:nth-of-type(2) {
    width: 0.375em;
    height: 0.375em;
    top: 0.937em;
    left: 1.375em;
}

.theme-switch__spot:nth-last-of-type(3) {
    width: 0.25em;
    height: 0.25em;
    top: 0.312em;
    left: 0.812em;
}

.theme-switch__clouds {
    width: 1.25em;
    height: 1.25em;
    background-color: var(--clouds-color);
    border-radius: var(--container-radius);
    position: absolute;
    bottom: -0.625em;
    left: 0.312em;
    box-shadow: 0.937em 0.312em var(--clouds-color), -0.312em -0.312em var(--back-clouds-color), 1.437em 0.375em var(--clouds-color), 0.5em -0.125em var(--back-clouds-color), 2.187em 0 var(--clouds-color), 1.25em -0.062em var(--back-clouds-color), 2.937em 0.312em var(--clouds-color), 2em -0.312em var(--back-clouds-color), 3.625em -0.062em var(--clouds-color), 2.625em 0em var(--back-clouds-color), 4.5em -0.312em var(--clouds-color), 3.375em -0.437em var(--back-clouds-color), 4.625em -1.75em 0 0.437em var(--clouds-color), 4em -0.625em var(--back-clouds-color), 4.125em -2.125em 0 0.437em var(--back-clouds-color);
    transition: 0.5s cubic-bezier(0, -0.02, 0.4, 1.25);
}

.theme-switch__stars-container {
    position: absolute;
    color: var(--stars-color);
    top: -100%;
    left: 0.312em;
    width: 2.75em;
    height: auto;
    transition: var(--switch-transition);
}

.theme-switch__stars-container svg {
    width: 100%;
    height: auto;
    display: block;
    stroke: none;
    fill: currentColor;
}

.theme-switch__checkbox:checked + .theme-switch__container,
[data-theme="dark"] .theme-switch__container {
    background-color: var(--container-night-bg);
}

.theme-switch__checkbox:checked + .theme-switch__container .theme-switch__circle-container,
[data-theme="dark"] .theme-switch__circle-container {
    left: calc(100% - var(--circle-container-offset) - var(--circle-container-diameter));
}

.theme-switch__checkbox:checked + .theme-switch__container .theme-switch__circle-container:hover,
[data-theme="dark"] .theme-switch__circle-container:hover {
    left: calc(100% - var(--circle-container-offset) - var(--circle-container-diameter) - 0.187em);
}

.theme-switch__circle-container:hover {
    left: calc(var(--circle-container-offset) + 0.187em);
}

.theme-switch__checkbox:checked + .theme-switch__container .theme-switch__moon,
[data-theme="dark"] .theme-switch__moon {
    transform: translate(0);
}

.theme-switch__checkbox:checked + .theme-switch__container .theme-switch__clouds,
[data-theme="dark"] .theme-switch__clouds {
    bottom: -4.062em;
}

.theme-switch__checkbox:checked + .theme-switch__container .theme-switch__stars-container,
[data-theme="dark"] .theme-switch__stars-container {
    top: 50%;
    transform: translateY(-50%);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: var(--text-muted);
}

.breadcrumb strong {
    color: var(--text);
}

.top-right {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.topbar-user {
    display: flex;
    align-items: center;
    max-width: 340px;
    min-width: 0;
    padding: 4px 6px 4px 8px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
}

.topbar-user .user-info {
    margin-left: 8px;
    margin-right: 4px;
}

.topbar-user .logout-btn {
    margin-left: 2px;
}

.top-support {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 38px;
    padding: 0 12px 0 10px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    cursor: pointer;
    position: relative;
    overflow: visible;
    animation: support-glow 2.8s ease-in-out infinite;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.top-support:hover {
    background: var(--hover);
    color: var(--primary);
    border-color: var(--primary);
    animation: none;
    transform: translateY(-1px);
}

.top-support svg {
    width: 17px;
    height: 17px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
    animation: support-bob 2.4s ease-in-out infinite;
}

.top-support:hover svg {
    animation: none;
}

.support-ping {
    position: absolute;
    inset: -3px;
    border-radius: inherit;
    border: 1.5px solid var(--primary);
    opacity: 0;
    pointer-events: none;
}

.top-support .support-ping:nth-child(1),
.login-fab-support .support-ping:nth-child(1) {
    animation: support-ripple 2.4s ease-out infinite;
}

.top-support .support-ping:nth-child(2),
.login-fab-support .support-ping:nth-child(2) {
    animation: support-ripple 2.4s ease-out infinite 0.8s;
}

.support-wave {
    opacity: 0.2;
}

.top-support .support-wave-l,
.login-fab-support .support-wave-l {
    animation: support-wave 1.6s ease-in-out infinite;
}

.top-support .support-wave-r,
.login-fab-support .support-wave-r {
    animation: support-wave 1.6s ease-in-out infinite 0.35s;
}

@keyframes support-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-1.5px); }
}

@keyframes support-glow {
    0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 0%, transparent); }
    50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--primary) 14%, transparent); }
}

@keyframes support-ripple {
    0% { transform: scale(0.92); opacity: 0.4; }
    100% { transform: scale(1.18); opacity: 0; }
}

@keyframes support-wave {
    0%, 100% { opacity: 0.12; }
    50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .top-support,
    .top-support svg,
    .support-ping,
    .support-wave-l,
    .support-wave-r {
        animation: none !important;
    }
}

.net-status-wrap {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.net-status {
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: color 0.3s ease, background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
}

.net-beacon {
    position: relative;
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
}

.net-ping {
    position: absolute;
    inset: 1px;
    border-radius: 50%;
    border: 1.5px solid currentColor;
    opacity: 0;
    pointer-events: none;
}

.net-icon {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.55;
    stroke-linecap: round;
    stroke-linejoin: round;
    position: relative;
    z-index: 1;
}

.net-globe {
    fill: color-mix(in srgb, currentColor 16%, transparent);
}

.net-wave {
    opacity: 0.35;
}

.net-slash {
    opacity: 0;
    stroke-width: 2;
    stroke-linecap: round;
    transform-origin: center;
    transition: opacity 0.25s ease;
}

.net-status.is-on {
    color: var(--primary);
    border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
    background: var(--primary-soft);
    animation: net-glow 2.4s ease-in-out infinite;
}

.net-status.is-on .net-ping:nth-child(1) {
    animation: net-ripple 2.2s ease-out infinite;
}

.net-status.is-on .net-ping:nth-child(2) {
    animation: net-ripple 2.2s ease-out infinite 0.75s;
}

.net-status.is-on .net-wave-a {
    animation: net-wave 1.8s ease-in-out infinite;
}

.net-status.is-on .net-wave-b {
    animation: net-wave 1.8s ease-in-out infinite 0.4s;
}

.net-status.is-on .net-globe {
    animation: net-core 2.2s ease-in-out infinite;
}

.net-status.is-on .net-meridian {
    stroke-dasharray: 5 5;
    animation: net-orbit 5.5s linear infinite;
}

.net-status.is-warn {
    color: #d97706;
    border-color: color-mix(in srgb, #d97706 40%, var(--border));
    background: rgba(217, 119, 6, 0.12);
    animation: net-warn 1.1s ease-in-out infinite;
}

.net-status.is-warn .net-slash {
    opacity: 1;
}

.net-status.is-warn .net-wave-a,
.net-status.is-warn .net-wave-b {
    animation: net-flicker 1.05s ease-in-out infinite;
}

.net-status.is-off {
    color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 45%, var(--border));
    background: var(--danger-bg);
    animation: net-off 1.8s ease-in-out infinite;
}

.net-status.is-off .net-slash {
    opacity: 1;
    animation: net-slash-in 0.35s ease;
}

.net-status.is-off .net-wave,
.net-status.is-off .net-globe,
.net-status.is-off .net-meridian,
.net-status.is-off .net-eq {
    opacity: 0.38;
}

.net-status.is-checking .net-ping:nth-child(1),
.net-status.is-checking .net-ping:nth-child(2) {
    animation: net-ripple 0.85s ease-out infinite;
}

.net-status.is-checking .net-icon {
    animation: net-spin-soft 0.9s ease-in-out;
}

.net-status:hover {
    transform: translateY(-1px);
}

[data-theme="dark"] .net-status.is-warn {
    color: #fbbf24;
    border-color: color-mix(in srgb, #fbbf24 40%, var(--border));
    background: rgba(251, 191, 36, 0.14);
}

@keyframes net-ripple {
    0% { transform: scale(0.45); opacity: 0.55; }
    100% { transform: scale(1.7); opacity: 0; }
}

@keyframes net-wave {
    0%, 100% { opacity: 0.18; }
    45% { opacity: 1; }
}

@keyframes net-glow {
    0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 0%, transparent); }
    50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--primary) 16%, transparent); }
}

@keyframes net-orbit {
    0% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -20; }
}

@keyframes net-core {
    0%, 100% { fill: color-mix(in srgb, currentColor 12%, transparent); }
    50% { fill: color-mix(in srgb, currentColor 32%, transparent); }
}

@keyframes net-warn {
    0%, 100% { box-shadow: 0 0 0 0 rgba(217, 119, 6, 0); }
    50% { box-shadow: 0 0 0 5px rgba(217, 119, 6, 0.18); }
}

@keyframes net-flicker {
    0%, 100% { opacity: 0.15; }
    35% { opacity: 1; }
    48% { opacity: 0.2; }
    70% { opacity: 0.85; }
}

@keyframes net-off {
    0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--danger) 0%, transparent); }
    50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--danger) 18%, transparent); }
}

@keyframes net-slash-in {
    from { opacity: 0; stroke-dasharray: 24; stroke-dashoffset: 24; }
    to { opacity: 1; stroke-dasharray: 24; stroke-dashoffset: 0; }
}

@keyframes net-spin-soft {
    0% { transform: rotate(0deg) scale(1); }
    40% { transform: rotate(-8deg) scale(0.94); }
    100% { transform: rotate(0deg) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .net-status,
    .net-status .net-ping,
    .net-status .net-wave,
    .net-status .net-globe,
    .net-status .net-meridian,
    .net-status .net-eq,
    .net-status .net-icon,
    .net-status .net-slash {
        animation: none !important;
    }
}

.app-chat {
    position: relative;
    width: 100%;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    overflow: visible;
}

.app-chat-panel {
    position: fixed;
    top: var(--topbar-height);
    right: 0;
    left: auto;
    bottom: 0;
    z-index: 1200;
    width: min(400px, 100vw);
    height: auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border);
    border-right: none;
    border-radius: 16px 0 0 0;
    background: var(--surface);
    box-shadow: -16px 0 40px rgba(16, 22, 20, 0.16);
}

html[data-sidebar="collapsed"] .app-chat-panel {
    left: auto;
}

body.chat-dock-open .content {
    padding-right: calc(24px + min(400px, 36vw));
}

.app-chat-panel[hidden] {
    display: none !important;
}

.app-chat-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 12px 12px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--primary-soft);
}

.app-chat-avatar {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    flex-shrink: 0;
}

.app-chat-avatar svg,
.app-chat-close svg,
.app-chat-send svg,
.app-chat-fab svg {
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.app-chat-avatar svg {
    width: 18px;
    height: 18px;
}

.app-chat-head strong {
    display: block;
    font-size: 13px;
    line-height: 1.2;
}

.app-chat-head span {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
}

.app-chat-close {
    margin-left: auto;
    width: auto;
    min-width: 32px;
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}

.app-chat-close:hover {
    background: var(--hover);
    color: var(--text);
}

.app-chat-close svg {
    width: 16px;
    height: 16px;
}

.app-chat-body {
    flex: 1;
    overflow: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.app-chat-bubble {
    max-width: 85%;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--hover);
    color: var(--text);
    font-size: 13px;
    line-height: 1.4;
    align-self: flex-start;
}

.app-chat-bubble.is-user {
    align-self: flex-end;
    background: var(--primary);
    color: #fff;
}

.app-chat-form {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--border);
}

.app-chat-input {
    flex: 1;
    min-width: 0;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--input-bg);
    color: var(--text);
    font: inherit;
    font-size: 13px;
}

.app-chat-input:focus {
    outline: none;
    border-color: var(--primary);
}

.app-chat-send,
.app-chat-fab {
    border: none;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
}

.app-chat-send {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.app-chat-send:hover,
.app-chat-fab:hover {
    background: var(--primary-dark, var(--primary));
}

.app-chat-send svg {
    width: 18px;
    height: 18px;
}

.app-chat-fab {
    position: relative;
    width: 100%;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    overflow: visible;
    box-shadow: 0 6px 16px var(--primary-shadow);
    animation: chat-glow 2.8s ease-in-out infinite;
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.app-chat-fab:hover {
    transform: translateY(-1px);
    animation: none;
}

.app-chat-fab .icon-chat {
    animation: chat-bob 2.4s ease-in-out infinite;
}

.app-chat-fab:hover .icon-chat,
.app-chat-fab.is-open .icon-chat {
    animation: none;
}

.chat-ping {
    position: absolute;
    inset: -3px;
    border-radius: inherit;
    border: 1.5px solid rgba(255, 255, 255, 0.65);
    opacity: 0;
    pointer-events: none;
}

.app-chat-fab .chat-ping:nth-child(1),
.login-fab-chat .chat-ping:nth-child(1) {
    animation: chat-ripple 2.4s ease-out infinite;
}

.app-chat-fab .chat-ping:nth-child(2),
.login-fab-chat .chat-ping:nth-child(2) {
    animation: chat-ripple 2.4s ease-out infinite 0.8s;
}

.chat-line {
    opacity: 0.35;
}

.app-chat-fab .chat-line-1,
.login-fab-chat .chat-line-1 {
    animation: chat-type 1.8s ease-in-out infinite;
}

.app-chat-fab .chat-line-2,
.login-fab-chat .chat-line-2 {
    animation: chat-type 1.8s ease-in-out infinite 0.4s;
}

.app-chat-fab .icon-close,
.app-chat-fab.is-open .icon-chat {
    display: none;
}

.app-chat-fab.is-open .icon-close {
    display: block;
}

.app-chat-fab.is-open,
.app-chat-fab.is-open .chat-ping,
.app-chat-fab.is-open .chat-line-1,
.app-chat-fab.is-open .chat-line-2,
.login-fab-chat.is-open .chat-ping,
.login-fab-chat.is-open .chat-line-1,
.login-fab-chat.is-open .chat-line-2 {
    animation: none;
}

.app-chat-fab svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.app-chat-fab.is-open .sidebar-chat-label {
    display: none;
}

@keyframes chat-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-1.5px); }
}

@keyframes chat-glow {
    0%, 100% { box-shadow: 0 6px 16px var(--primary-shadow); }
    50% { box-shadow: 0 8px 20px var(--primary-shadow), 0 0 0 6px color-mix(in srgb, var(--primary) 22%, transparent); }
}

@keyframes chat-ripple {
    0% { transform: scale(0.92); opacity: 0.45; }
    100% { transform: scale(1.2); opacity: 0; }
}

@keyframes chat-type {
    0%, 100% { opacity: 0.22; }
    50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .app-chat-fab,
    .app-chat-fab .icon-chat,
    .login-fab-chat .icon-chat,
    .chat-ping,
    .chat-line-1,
    .chat-line-2 {
        animation: none !important;
    }
}

.search-wrap {
    position: relative;
}

.search {
    width: 240px;
    height: 38px;
    padding: 0 13px;
    border: 1px solid var(--border);
    border-radius: 9px;
    outline: none;
    background: var(--input-bg);
    color: var(--text);
    font-size: 12px;
    transition: 0.2s;
}

.search::placeholder {
    color: var(--text-muted);
}

.search:focus {
    border-color: #9acbb0;
    box-shadow: 0 0 0 3px rgba(31, 122, 77, 0.08);
}

[data-theme="dark"] .search:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(61, 186, 117, 0.16);
}

.search-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: min(380px, calc(100vw - 32px));
    max-height: 420px;
    overflow: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(15, 40, 28, 0.16);
    z-index: 40;
}

.search-panel[hidden] {
    display: none;
}

.search-group,
.search-empty {
    padding: 10px 14px 6px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.search-empty {
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    font-size: 13px;
}

.search-item {
    display: grid;
    gap: 2px;
    width: 100%;
    padding: 10px 14px;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.search-item:hover {
    background: var(--hover);
}

.search-item strong {
    font-size: 13px;
}

.search-item span {
    color: var(--text-muted);
    font-size: 12px;
}

.notification-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #dc4444;
    border: 1px solid var(--surface);
}

.notify-wrap {
    position: relative;
}

.notify-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    z-index: 2;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: #dc4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    letter-spacing: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 1px solid var(--surface);
    box-sizing: border-box;
    /* El glifo del dígito se ve bajo: sube 1px el contenido */
    padding-bottom: 1px;
    transform-origin: center center;
}

.notify-badge[hidden] {
    display: none !important;
}

.notify-btn {
    overflow: visible;
}

.notify-btn svg {
    transform-origin: 50% 12%;
    animation: notify-idle 4.2s ease-in-out infinite;
}

.notify-ping {
    position: absolute;
    inset: -3px;
    border-radius: inherit;
    border: 1.5px solid #dc4444;
    opacity: 0;
    pointer-events: none;
}

.notify-btn.has-unread {
    color: #dc4444;
    border-color: color-mix(in srgb, #dc4444 40%, var(--border));
    background: color-mix(in srgb, #dc4444 10%, var(--surface));
    animation: notify-glow 1.8s ease-in-out infinite;
}

.notify-btn.has-unread svg {
    animation: notify-ring 1.55s ease-in-out infinite;
}

.notify-btn.has-unread .notify-ping:nth-child(1),
.notify-btn.is-arriving .notify-ping:nth-child(1) {
    animation: notify-ripple 1.8s ease-out infinite;
}

.notify-btn.has-unread .notify-ping:nth-child(2),
.notify-btn.is-arriving .notify-ping:nth-child(2) {
    animation: notify-ripple 1.8s ease-out infinite 0.55s;
}

.notify-btn.is-arriving {
    color: #dc4444;
    border-color: color-mix(in srgb, #dc4444 45%, var(--border));
    animation: notify-glow 0.9s ease-in-out infinite;
}

.notify-btn.is-arriving svg {
    animation: notify-ring 0.85s ease-in-out infinite;
}

.notify-btn.has-unread .notification-dot {
    animation: notify-dot 1.2s ease-in-out infinite;
}

.notify-btn.has-unread .notify-badge {
    animation: notify-badge 1.4s ease-in-out infinite;
}

.notify-btn.has-unread[aria-expanded="true"],
.notify-btn.has-unread[aria-expanded="true"] svg,
.notify-btn.has-unread[aria-expanded="true"] .notify-ping,
.notify-btn.has-unread[aria-expanded="true"] .notify-badge,
.notify-btn.has-unread[aria-expanded="true"] .notification-dot {
    animation: none;
}

@keyframes notify-idle {
    0%, 82%, 100% { transform: rotate(0); }
    86% { transform: rotate(10deg); }
    90% { transform: rotate(-8deg); }
    94% { transform: rotate(5deg); }
}

@keyframes notify-ring {
    0%, 100% { transform: rotate(0); }
    12% { transform: rotate(16deg); }
    24% { transform: rotate(-14deg); }
    36% { transform: rotate(10deg); }
    48% { transform: rotate(-7deg); }
    60% { transform: rotate(3deg); }
}

@keyframes notify-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 68, 68, 0); }
    50% { box-shadow: 0 0 0 6px rgba(220, 68, 68, 0.16); }
}

@keyframes notify-ripple {
    0% { transform: scale(0.92); opacity: 0.5; }
    100% { transform: scale(1.22); opacity: 0; }
}

@keyframes notify-dot {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.35); }
}

@keyframes notify-badge {
    0%, 100% { transform: scale(1); }
    40% { transform: scale(1.12); }
    55% { transform: scale(0.96); }
}

@media (prefers-reduced-motion: reduce) {
    .notify-btn,
    .notify-btn svg,
    .notify-btn .notify-ping,
    .notify-btn .notify-badge,
    .notify-btn .notification-dot {
        animation: none !important;
    }
}

.notify-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: min(360px, calc(100vw - 32px));
    max-height: 420px;
    overflow: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(15, 40, 28, 0.16);
    z-index: 40;
}

.notify-panel[hidden] {
    display: none;
}

.notify-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--border);
}

.notify-head strong {
    font-size: 13px;
}

.notify-empty,
.notify-item {
    padding: 12px 16px;
}

.notify-empty {
    color: var(--text-muted);
    font-size: 13px;
}

.notify-item {
    display: grid;
    gap: 2px;
    width: 100%;
    border: 0;
    border-bottom: 1px solid var(--border);
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.notify-item:last-child {
    border-bottom: 0;
}

.notify-item:hover {
    background: var(--hover);
}

.notify-item.is-new {
    background: color-mix(in srgb, var(--primary) 8%, transparent);
}

.notify-item strong {
    font-size: 13px;
}

.notify-item span {
    color: var(--text-muted);
    font-size: 12px;
}


/* =========================================================
   CONTENT
========================================================= */

.content {
    padding: var(--content-pad);
    box-sizing: border-box;
}

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.page-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.page-header-actions .ghost-button,
.page-header-actions .primary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.page-header-actions .ghost-button svg,
.page-header-actions .primary-button svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: 0 0 auto;
}

#btnSeleccionarFacturas,
#btnPagosMasivos {
    animation: mass-btn-in 0.22s ease;
}

/* SVG en ghost del toolbar: stroke, no fill negro (display:block global lo apilaba y tapaba el texto). */
#btnSeleccionarFacturas {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

#btnSeleccionarFacturas svg {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

#btnPagosMasivos:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    filter: grayscale(0.15);
}

@keyframes mass-btn-in {
    from { opacity: 0; transform: translateY(4px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.th-check,
.td-check {
    width: 52px;
    min-width: 52px;
    padding-left: 10px;
    padding-right: 6px;
    font-size: 11px;
}

.th-check .check,
.td-check .check {
    justify-content: center;
}

.table-card:not(.has-mass-check) .th-check,
.table-card:not(.has-mass-check) .td-check {
    display: none;
}

.mass-pay-card {
    width: min(100%, 520px);
    padding: 22px 22px 18px;
    overflow: visible;
}

.mass-pay-head {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
    gap: 16px 20px;
    margin-bottom: 16px;
}

.mass-pay-head-copy {
    min-width: 0;
}

.mass-pay-head .modal-title {
    text-align: left;
    font-size: 18px;
}

.mass-pay-head .modal-text {
    margin: 4px 0 0;
    text-align: left;
    color: var(--text-secondary);
    font-size: 12px;
}

.mass-pay-apply {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.mass-pay-apply label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--text-muted);
    text-align: right;
    white-space: nowrap;
}

.mass-pay-apply .date-picker {
    width: 128px;
    margin: 0;
}

.mass-pay-table .date-picker {
    width: 128px;
    max-width: 100%;
    display: inline-block;
    vertical-align: middle;
    margin: 0 auto;
}

.mass-pay-apply .date-picker-trigger,
.mass-pay-table .date-picker-trigger {
    width: 128px;
    max-width: 100%;
    height: 34px;
    padding: 0 8px;
    border-radius: 10px;
    justify-content: center;
    gap: 6px;
}

.mass-pay-apply .date-picker-value,
.mass-pay-table .date-picker-value {
    flex: none;
    width: auto;
    text-align: center;
    font-size: 12px;
}

.mass-pay-table-wrap {
    max-height: min(42vh, 280px);
    overflow-x: hidden;
    overflow-y: auto;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
}

.mass-pay-table {
    width: 100%;
    table-layout: fixed;
}

.mass-pay-table th:nth-child(1),
.mass-pay-table td:nth-child(1),
.mass-pay-table th:nth-child(2),
.mass-pay-table td:nth-child(2) {
    width: 31%;
}

.mass-pay-table th:nth-child(3),
.mass-pay-table td:nth-child(3) {
    width: 38%;
}

.mass-pay-table th,
.mass-pay-table td {
    padding: 8px 6px;
    text-align: center;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mass-pay-table th {
    font-size: var(--font-size-table-head, 10px);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--primary);
    border: none;
    background-color: var(--table-head-bg, var(--primary-soft));
    background-image: none;
    box-shadow: 0 1px 0 var(--border);
    position: sticky;
    top: 0;
    z-index: 1;
}

.mass-pay-table td {
    color: var(--text);
    font-weight: 500;
}

.mass-pay-table tbody tr:hover td {
    background: color-mix(in srgb, var(--primary) 6%, transparent);
}

.mass-pay-card .modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 0;
}

.mass-pay-card .modal-btn {
    width: auto;
    min-width: 108px;
    height: 38px;
    padding: 0 16px;
    flex: 0 0 auto;
}

#massPayProgressBar {
    stroke: url(#massPayProgressGrad);
}

.mass-pay-card.is-saving .mass-pay-head,
.mass-pay-card.is-saving .mass-pay-apply,
.mass-pay-card.is-saving .mass-pay-table-wrap,
.mass-pay-card.is-saving .modal-actions {
    pointer-events: none;
}

.page-title {
    font-size: 26px;
    letter-spacing: -0.02em;
    font-weight: 700;
}

.page-description {
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 12px;
}

.primary-button {
    border: none;
    border-radius: 9px;
    padding: 11px 15px;
    background: var(--primary);
    color: white;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 5px 12px rgba(31, 122, 77, 0.15);
    transition: 0.2s;
}

.primary-button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

a.primary-button {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}


/* =========================================================
   STAT CARDS
========================================================= */

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

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: var(--card-shadow);
    transition: background var(--transition), border-color var(--transition);
}

.stat-card {
    min-height: 145px;
}

.stat-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 12px;
}

.stat-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--primary-soft);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 17px;
    height: 17px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.stat-icon.is-success {
    background: var(--success-bg);
    color: var(--success);
}

.stat-icon.is-warn {
    background: var(--warning-bg);
    color: var(--warning);
}

.stat-icon.is-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.report-kpi {
    overflow: hidden;
}

.stat-value {
    margin-top: 13px;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.stat-amounts {
    display: grid;
    gap: 4px;
    margin-top: 13px;
}

.stat-amount {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.stat-change {
    margin-top: 5px;
    font-size: 10px;
    color: var(--success);
}

.stat-change.down {
    color: var(--danger);
}

.stat-card.is-accent {
    position: relative;
    overflow: hidden;
}

.stat-card.is-accent::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary);
}

.stat-card.is-accent.is-warn::before {
    background: var(--warning);
}

.stat-card.is-accent.is-danger::before {
    background: var(--danger);
}

.stat-card.is-accent.is-success::before {
    background: var(--success);
}


/* =========================================================
   DASHBOARD
========================================================= */

.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.card-title {
    font-size: 13px;
    font-weight: 700;
}

.card-action {
    font-size: 11px;
    color: var(--primary);
    text-decoration: none;
}

.chart-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.chart-period {
    position: relative;
    display: inline-flex;
    padding: 3px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--input-bg);
}

.chart-period-thumb {
    position: absolute;
    top: 3px;
    left: 0;
    height: 28px;
    border-radius: 999px;
    background: var(--primary);
    box-shadow: 0 6px 14px var(--primary-shadow);
    opacity: 0;
    transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1), width 0.38s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease;
    pointer-events: none;
}

.chart-period.is-ready .chart-period-thumb {
    opacity: 1;
}

.chart-period button {
    position: relative;
    z-index: 1;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    height: 28px;
    padding: 0 12px;
    border-radius: 999px;
    cursor: pointer;
    transition: color 0.22s ease;
}

.chart-period button.is-active {
    color: #fff;
}


/* =========================================================
   CHART
========================================================= */

.chart-container {
    height: 245px;
    display: flex;
    align-items: flex-end;
    gap: 14px;
    padding: 8px 8px 0;
    overflow: hidden;
}

.chart-col {
    flex: 1;
    min-width: 20px;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.chart-bar {
    width: 100%;
    min-height: 6px;
    background: linear-gradient(to top, var(--primary), var(--chart-end));
    border-radius: 7px 7px 3px 3px;
    opacity: 0.86;
    transform-origin: bottom center;
    transition: opacity 0.2s ease, box-shadow 0.2s ease;
}

.chart-bar:hover {
    opacity: 1;
    box-shadow: 0 8px 16px var(--primary-shadow);
}

.chart-container.is-leaving .chart-bar {
    animation: chart-shrink 0.2s ease forwards;
}

.chart-container.is-entering .chart-bar {
    animation: chart-grow 0.65s cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-delay: calc(var(--i, 0) * 52ms);
}

.chart-container.is-entering .chart-label {
    animation: chart-label-in 0.35s ease both;
    animation-delay: calc(var(--i, 0) * 52ms + 80ms);
}

@keyframes chart-shrink {
    to {
        transform: scaleY(0);
        opacity: 0;
    }
}

@keyframes chart-grow {
    from { transform: scaleY(0); }
    to { transform: scaleY(1); }
}

@keyframes chart-label-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .chart-period-thumb,
    .chart-bar,
    .chart-container.is-leaving .chart-bar,
    .chart-container.is-entering .chart-bar,
    .chart-container.is-entering .chart-label {
        animation: none;
        transition: none;
    }
}

.chart-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.25;
    white-space: normal;
}

.chart-container.is-week {
    gap: 8px;
}

.chart-container.is-week .chart-label {
    font-size: 9px;
    min-height: 44px;
}

.chart-week {
    display: block;
    margin-bottom: 2px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.03em;
    color: var(--primary);
}

.chart-empty {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
}

.chart-container.is-days {
    gap: 3px;
    overflow-x: auto;
}

.chart-container.is-days .chart-col {
    min-width: 14px;
}

.chart-container.is-days .chart-label {
    font-size: 9px;
    font-weight: 700;
}

.chart-container.is-days .chart-col.is-empty .chart-bar {
    opacity: 0.22;
    min-height: 4px;
}

.chart-container.is-days .chart-col.is-today .chart-bar,
.chart-container.is-week .chart-col.is-today .chart-bar {
    opacity: 1;
    box-shadow: 0 0 0 2px var(--primary-soft);
}

.chart-container.is-week .chart-col.is-empty .chart-bar {
    opacity: 0.28;
}

.report-filters {
    display: flex;
    align-items: end;
    flex-wrap: wrap;
    gap: 12px;
}

.report-filter {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 168px;
}

.report-filter.is-wide {
    width: 220px;
}

.report-filter > span {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.report-filter .select-picker,
.report-filter .select-picker-trigger {
    width: 100%;
}

.report-extra {
    margin-top: 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.report-main {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.report-main > .card:first-child {
    grid-column: span 2;
}

.report-rank,
.report-compare {
    display: grid;
    gap: 12px;
    min-height: 168px;
    align-content: start;
}

.report-rank-row {
    display: grid;
    grid-template-columns: 22px 1fr;
    gap: 10px;
    align-items: center;
}

.report-rank-n {
    width: 22px;
    height: 22px;
    border-radius: 7px;
    background: var(--primary-soft);
    color: var(--primary);
    display: grid;
    place-items: center;
    font-size: 11px;
    font-weight: 800;
}

.report-rank-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
    font-size: 12px;
}

.report-rank-head strong {
    color: var(--text);
    font-weight: 600;
}

.report-rank-head span {
    color: var(--text-muted);
    font-weight: 700;
}

.report-compare-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 12px;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 12px;
    color: var(--text-secondary);
}

.report-compare-row strong {
    color: var(--text);
}

.report-compare-row em {
    font-style: normal;
    font-weight: 700;
}

.report-compare-row em.is-up { color: var(--success); }
.report-compare-row em.is-down { color: var(--danger); }

.report-staff {
    display: grid;
    gap: 10px;
    min-height: 168px;
    align-content: start;
}

.report-staff-row {
    display: grid;
    grid-template-columns: 22px 1fr;
    gap: 10px;
    align-items: start;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.report-staff-row:last-child {
    border-bottom: 0;
}

.report-staff-row .report-rank-n {
    margin-top: 2px;
}

.report-staff-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 0;
    background: transparent;
    color: var(--primary);
    font: inherit;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    padding: 0;
}

.report-staff-toggle svg {
    width: 12px;
    height: 12px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 0.2s ease;
}

.report-staff-row.is-open .report-staff-toggle svg {
    transform: rotate(180deg);
}

.report-staff-detail {
    display: grid;
    gap: 8px;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    transition: max-height 0.28s ease, opacity 0.2s ease, margin 0.28s ease;
}

.report-staff-row.is-open .report-staff-detail {
    max-height: 140px;
    opacity: 1;
    margin-top: 10px;
}

.report-staff-metric {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 10px;
    align-items: center;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 12px;
    color: var(--text-secondary);
}

.report-staff-metric strong {
    color: var(--text);
}

.report-staff-metric em {
    font-style: normal;
    font-weight: 800;
    color: var(--primary);
}

.report-staff-idle {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
}

.report-month {
    display: flex;
    align-items: center;
    gap: 10px;
}

.report-month-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ===== INICIO: MONTH PICKER ===== */
.month-picker {
    position: relative;
}

.month-picker-trigger {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 188px;
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--input-bg);
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    font-weight: 400;
    cursor: pointer;
}

.month-picker-trigger:hover,
.month-picker.is-open .month-picker-trigger {
    border-color: var(--primary);
    box-shadow: none;
}

.month-picker-value {
    flex: 1;
    text-align: left;
}

.month-picker-trigger svg {
    width: 16px;
    height: 16px;
    stroke: var(--primary);
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

.month-picker-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 40;
    width: 268px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--card-shadow), 0 16px 40px rgba(15, 23, 42, 0.1);
}

.month-picker-panel.is-above,
.date-picker-panel.is-above,
.select-picker-panel.is-above {
    top: auto;
    bottom: calc(100% + 8px);
}

.date-picker-panel.is-right,
.month-picker-panel.is-right,
.select-picker-panel.is-right {
    left: auto;
    right: 0;
}

.month-picker-search {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 32px;
    margin-bottom: 8px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--input-bg);
}

.month-picker-search svg {
    width: 15px;
    height: 15px;
    stroke: var(--text-secondary);
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
    opacity: 0.9;
}

.month-picker-query,
.date-picker-query {
    width: auto;
    flex: 1;
    min-width: 0;
    height: auto;
    padding: 0;
    border: none !important;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: 12px;
    font-weight: 400;
    outline: none !important;
    box-shadow: none !important;
}

.month-picker-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.month-picker-year {
    width: 72px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--input-bg);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: -0.02em;
    text-align: center;
    outline: none;
}

.month-picker-year:focus {
    border-color: var(--primary);
}

.month-picker-nav {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--input-bg);
    color: var(--text);
    display: grid;
    place-items: center;
    cursor: pointer;
}

.month-picker-nav:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.month-picker-nav svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.month-picker-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.month-picker-month {
    height: 32px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: 12px;
    font-weight: 400;
    cursor: pointer;
}

.month-picker-month:hover {
    background: var(--hover);
}

.month-picker-month.is-now {
    border-color: var(--primary);
    color: var(--primary);
}

.month-picker-month.is-active {
    background: var(--hover);
}

.month-picker-month.is-selected {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.month-picker-empty {
    grid-column: 1 / -1;
    padding: 18px 8px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
}

.month-picker-foot {
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.month-picker-today {
    border: none;
    background: none;
    color: var(--primary);
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.month-picker-today:hover {
    text-decoration: underline;
}
/* ===== FIN: MONTH PICKER ===== */

/* ===== INICIO: DATE PICKER / CALENDARIO
   CSS principal del control. Ajuste de altura/radio en controles.css
   (bloque "Date picker — solo ajuste de tamaño").
   JS: Forms.bindDatePicker / Forms.refreshDatePicker (catalogos.js)
========================================================= */
.date-picker {
    position: relative;
    width: 100%;
    z-index: 2;
}

.date-picker.is-open {
    z-index: 12;
}

.date-picker-native,
.date-picker-native.field-control {
    position: absolute !important;
    inset: 0 auto auto 0;
    width: 1px !important;
    height: 1px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    overflow: hidden !important;
    color: transparent !important;
    -webkit-text-fill-color: transparent !important;
    font-size: 0 !important;
}

.date-picker-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    height: var(--ctrl-height, 44px);
    padding: 0 var(--ctrl-pad-x, 14px);
    border: 1px solid var(--border);
    border-radius: var(--ctrl-radius, 12px);
    background: var(--input-bg);
    color: var(--text);
    font-family: var(--font-ui, inherit);
    font-size: var(--ctrl-font-size, 13px);
    font-weight: 400;
    cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.date-picker-trigger:hover,
.date-picker.is-open .date-picker-trigger,
.date-picker-trigger:focus-visible {
    border-color: var(--primary);
    box-shadow: none;
}

.date-picker-value {
    flex: 1;
    text-align: left;
    font-size: var(--ctrl-font-size, 13px);
    font-weight: 400;
    color: var(--text);
}

.date-picker-value.is-placeholder {
    font-size: var(--ctrl-placeholder-size, var(--ctrl-font-size, 13px));
    font-weight: 400;
    color: var(--text-muted);
}

.date-picker-trigger svg {
    width: 16px;
    height: 16px;
    stroke: var(--primary);
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

.date-picker-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 40;
    width: 268px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--card-shadow), 0 16px 40px rgba(15, 23, 42, 0.1);
}

.date-picker-caption {
    min-width: 140px;
    text-align: center;
    font-size: 13px;
    font-weight: 800;
}

.date-picker-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    margin: 4px 0 2px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    text-align: center;
}

.date-picker-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.date-picker-day {
    height: 28px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: 12px;
    font-weight: 400;
    cursor: pointer;
}

.date-picker-day.is-blank {
    visibility: hidden;
    pointer-events: none;
}

.date-picker-day:hover,
.date-picker-day.is-active {
    background: var(--hover);
}

.date-picker-day.is-today {
    border-color: var(--primary);
    color: var(--primary);
}

.date-picker-day.is-selected {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.date-picker-day.is-disabled,
.date-picker-day:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    color: var(--text-muted, #94a3b8);
    pointer-events: none;
}

.date-picker-day.is-disabled:hover,
.date-picker-day:disabled:hover {
    background: transparent;
}

.date-picker.is-disabled .date-picker-trigger {
    cursor: not-allowed;
}

.date-picker.is-invalid .date-picker-trigger {
    border-color: var(--danger);
    color: var(--danger);
    box-shadow: 0 0 0 3px rgba(199, 71, 71, 0.12);
}

.date-picker.is-invalid .date-picker-value,
.field.is-over-limit .date-picker-value {
    color: var(--danger);
    font-weight: 400;
}

.date-picker.is-invalid .date-picker-trigger svg,
.field.is-over-limit .date-picker-trigger svg {
    stroke: var(--danger);
}
/* ===== FIN: DATE PICKER / CALENDARIO ===== */

.report-chart-meta {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: right;
}

.report-mix {
    display: grid;
    gap: 16px;
    padding-top: 4px;
}

.report-mix-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px 10px;
    align-items: center;
}

.report-mix-head {
    display: flex;
    justify-content: space-between;
    grid-column: 1 / -1;
    font-size: 12px;
    color: var(--text-secondary);
}

.report-mix-head strong {
    color: var(--text);
    font-size: 14px;
}

.report-mix-track {
    height: 10px;
    border-radius: 999px;
    background: var(--input-bg);
    overflow: hidden;
}

.report-mix-track i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--primary);
}

.report-mix-track i.is-success {
    background: var(--success);
}

.report-mix-track i.is-warn {
    background: var(--warning);
}

.report-mix-track i.is-danger {
    background: var(--danger);
}

.report-mix-track i.is-muted {
    background: var(--text-muted);
}

.report-mix-pct {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
}

.report-mix-empty {
    min-height: 180px;
    display: grid;
    place-items: center;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
}

.report-donut-wrap {
    display: grid;
    justify-items: center;
    gap: 18px;
    padding: 8px 4px 4px;
}

.report-donut {
    position: relative;
    width: 168px;
    height: 168px;
}

.report-donut svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.report-donut-track,
.report-donut-seg {
    fill: none;
    stroke-width: 12;
}

.report-donut-track {
    stroke: var(--border);
}

.report-donut-seg {
    stroke-linecap: butt;
    transition: stroke-dasharray 0.45s ease;
}

.report-donut-seg.is-success { stroke: var(--success); }
.report-donut-seg.is-warn { stroke: var(--warning); }
.report-donut-seg.is-danger { stroke: var(--danger); }
.report-donut-seg.is-muted { stroke: var(--text-muted); }

.report-donut-center {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    text-align: center;
}

.report-donut-center strong {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1;
}

.report-donut-center span {
    margin-top: 4px;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
}

.report-donut-legend {
    width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 8px;
}

.report-donut-legend li {
    display: grid;
    grid-template-columns: 8px 1fr auto auto;
    gap: 8px;
    align-items: center;
    font-size: 12px;
    color: var(--text-secondary);
}

.report-donut-legend i {
    width: 8px;
    height: 8px;
    border-radius: 99px;
}

.report-donut-legend i.is-success { background: var(--success); }
.report-donut-legend i.is-warn { background: var(--warning); }
.report-donut-legend i.is-danger { background: var(--danger); }
.report-donut-legend i.is-muted { background: var(--text-muted); }

.report-donut-legend strong {
    color: var(--text);
    font-size: 13px;
}

.report-donut-legend em {
    font-style: normal;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 32px;
    text-align: right;
}


/* =========================================================
   ACTIVITY
========================================================= */

.activity-list {
    display: flex;
    flex-direction: column;
    min-height: 245px;
    max-height: 245px;
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.activity-item {
    display: flex;
    gap: 11px;
    padding: 12px 2px;
    border-bottom: 1px solid var(--border);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.activity-icon svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.activity-text {
    flex: 1;
    min-width: 0;
    font-size: 11px;
    line-height: 1.45;
}

.activity-text strong {
    font-weight: 600;
}

.activity-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.activity-head strong {
    min-width: 0;
}

.activity-meta {
    margin-top: 3px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.activity-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 6px;
}

.activity-amount {
    font-size: 12px;
    font-weight: 700;
}

.activity-time {
    margin-top: 0;
    color: var(--text-muted);
    font-size: 9px;
    white-space: nowrap;
}

.activity-empty {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    padding: 12px 0;
}

.activity-list:has(.activity-empty) {
    display: grid;
    place-items: center;
}


/* =========================================================
   TABLE
========================================================= */

.table-card {
    overflow: hidden;
}

.table-wrapper,
.table-wrap {
    max-height: 320px;
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 13px 9px;
    text-align: center;
    vertical-align: middle;
    border-top: 1px solid var(--border);
    white-space: nowrap;
}

/* Universal table headers — tipografía desde controles.css */
table thead th,
table > thead > tr > th,
th {
    position: sticky;
    top: 0;
    z-index: 5;
    color: var(--primary);
    font-family: var(--font-table, var(--font-ui, "Segoe UI", ui-sans-serif, system-ui, sans-serif));
    font-size: var(--font-size-table-head, 10px);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background-color: var(--table-head-bg, var(--primary-soft));
    background-image: none;
    border: none;
    box-shadow: 0 1px 0 var(--border);
}

td {
    font-family: var(--font-table, var(--font-ui, "Segoe UI", ui-sans-serif, system-ui, sans-serif));
    font-size: var(--font-size-table-row, 12px);
}

.empty-row td {
    padding: 28px 9px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    white-space: normal;
}

.invoice-number {
    font-weight: 600;
    color: var(--primary);
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 600;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.latest-card .card-header {
    align-items: flex-start;
    gap: 12px;
}

.latest-head {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.latest-insight {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.latest-chip {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 8px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    background: var(--primary-soft);
    color: var(--primary);
    cursor: pointer;
    font-family: inherit;
    appearance: none;
}

.latest-chip:hover {
    filter: brightness(0.96);
}

.latest-chip.is-active {
    box-shadow: 0 0 0 2px var(--primary-shadow);
    border-color: currentColor;
}

.latest-chip.is-warn {
    background: var(--warning-bg);
    color: var(--warning);
}

.latest-chip.is-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.latest-wrapper {
    max-height: 380px;
}

.latest-table th,
.latest-table td {
    text-align: center;
    vertical-align: middle;
}

.latest-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 0;
}

.latest-cell strong {
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
}

.latest-cell span {
    color: var(--text-secondary);
    font-size: 10px;
}

.latest-table .badge {
    margin: 0 auto;
    justify-content: center;
}

.due-chip {
    display: inline-flex;
    align-items: center;
    margin-top: 3px;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 700;
    width: fit-content;
}

.due-ok {
    background: var(--success-bg);
    color: var(--success);
}

.due-soon {
    background: var(--warning-bg);
    color: var(--warning);
}

.due-today,
.due-late {
    background: var(--danger-bg);
    color: var(--danger);
}

.dash-alert {
    width: 26px;
    height: 26px;
    margin: 0 auto;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.dash-alert svg {
    width: 13px;
    height: 13px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.dash-alert-ok {
    background: var(--success-bg);
    color: var(--success);
    box-shadow: 0 0 0 1px var(--success);
}

.dash-alert-ok svg {
    fill: none;
    stroke: #fff;
}

.dash-alert-ok .alert-check-bg {
    fill: currentColor;
    stroke: currentColor;
}

.dash-alert-danger {
    background: var(--danger-bg);
    color: var(--danger);
    box-shadow: 0 0 0 1px var(--danger);
}

.dash-alert-danger svg {
    fill: none;
    stroke: #fff;
}

.dash-alert-danger .alert-triangle {
    fill: currentColor;
    stroke: currentColor;
}

.dash-alerts {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.latest-table tr.is-over-limit td,
.latest-table tr.is-overdue td {
    color: var(--danger);
    background: var(--danger-bg);
    font-weight: 600;
}

.latest-table tr.is-over-limit .invoice-number,
.latest-table tr.is-over-limit .latest-cell strong,
.latest-table tr.is-overdue .invoice-number,
.latest-table tr.is-overdue .latest-cell strong {
    color: var(--danger);
}

.latest-table tr.is-within-limit td {
    background: var(--success-bg);
}

.latest-table .th-alert,
.latest-table .td-alert {
    text-align: center;
    width: 72px;
}


/* =========================================================
   MOBILE OVERLAY
========================================================= */

.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 999;
}


/* =========================================================
   RESPONSIVE
========================================================= */

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

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .report-main > .card:first-child {
        grid-column: auto;
    }

    .search {
        width: 170px;
    }
}

@media (max-width: 760px) {
    .sidebar {
        transform: translateX(-100%);
        width: 260px;
        transition: transform var(--transition);
    }

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

    .sidebar.collapsed {
        width: 260px;
    }

    .sidebar.collapsed .brand,
    .sidebar.collapsed .menu-label,
    .sidebar.collapsed .section-title,
    .sidebar.collapsed .menu-arrow,
    .sidebar.collapsed .user-info,
    .sidebar.collapsed .logout-btn,
    .sidebar.collapsed .theme-footer-label {
        display: block;
        flex: unset;
        opacity: 1;
        width: auto;
        min-width: unset;
        overflow: visible;
        transform: none;
        pointer-events: auto;
    }

    .sidebar.collapsed .sidebar-chat-label {
        display: inline;
        flex: unset;
        opacity: 1;
        width: auto;
        min-width: unset;
        overflow: visible;
        transform: none;
        pointer-events: auto;
    }

    .sidebar.collapsed .menu-label {
        flex: 1;
        min-width: 0;
        overflow: hidden;
    }

    .sidebar.collapsed .menu-arrow {
        display: flex;
        flex: 0 0 auto;
    }

    .sidebar.collapsed .logout-btn {
        display: flex;
    }

    .sidebar.collapsed .brand {
        margin-left: 11px;
    }

    .sidebar.collapsed .section-title {
        padding: 0 12px;
        margin: 0 0 8px;
    }

    .sidebar.collapsed .section-title:not(:first-child) {
        margin-top: 24px;
    }

    .sidebar.collapsed .menu-arrow {
        width: 18px;
        min-width: 18px;
        margin-left: auto;
    }

    .sidebar.collapsed .user-info {
        margin-left: 10px;
    }

    .sidebar.collapsed .logout-btn {
        width: 32px;
        min-width: 32px;
        margin-left: auto;
    }

    .sidebar.collapsed .sidebar-footer {
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-end;
        gap: 10px;
        padding: 12px 16px 14px;
    }

    .sidebar.collapsed .sidebar-footer-theme {
        justify-content: space-between;
    }

    .sidebar.collapsed .sidebar-footer .theme-switch {
        margin: 0;
    }

    .sidebar.collapsed .app-chat,
    html[data-sidebar="collapsed"] .sidebar .app-chat {
        width: 100%;
    }

    .sidebar.collapsed .app-chat-fab,
    html[data-sidebar="collapsed"] .sidebar .app-chat-fab {
        width: 100%;
        height: 40px;
        border-radius: 10px;
        margin: 0;
    }

    .sidebar.collapsed .navigation {
        padding: 20px 12px;
        align-items: stretch;
    }

    .sidebar.collapsed .sidebar-footer .theme-switch {
        --toggle-size: 11px;
    }

    .sidebar.collapsed .logo-container {
        justify-content: flex-start;
        padding: 0 20px;
    }

    .sidebar.collapsed .menu-item {
        justify-content: flex-start;
        padding: 0 12px;
    }

    .sidebar.collapsed .menu-icon {
        margin-right: 12px;
    }

    .sidebar.collapsed .submenu {
        display: block;
    }

    .sidebar.collapsed .user {
        justify-content: flex-start;
    }

    .sidebar.mobile-open ~ .overlay {
        display: block;
    }

    .main,
    .sidebar.collapsed ~ .main {
        margin-left: 0;
    }

    .topbar {
        padding: 0 16px;
    }

    .breadcrumb {
        display: none;
    }

    .top-right {
        margin-left: auto;
    }

    .topbar-user {
        max-width: 148px;
    }

    .top-support span {
        display: none;
    }

    .top-support {
        width: 38px;
        padding: 0;
    }

    .app-chat-panel,
    html[data-sidebar="collapsed"] .app-chat-panel {
        top: var(--topbar-height);
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        border-radius: 0;
        border-right: 1px solid var(--border);
    }

    body.chat-dock-open .content {
        padding-right: var(--content-pad);
    }

    .search {
        display: none;
    }

    .content {
        padding: var(--content-pad);
    }

    .page-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 15px;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    .page-title {
        font-size: 22px;
    }

    .report-month,
    .report-filters {
        width: 100%;
        justify-content: space-between;
    }

    .report-filter,
    .report-filter .field-select,
    .report-filter .select-picker,
    .report-filter .select-picker-trigger {
        width: 100%;
        min-width: 0;
    }

    .month-picker,
    .month-picker-trigger {
        width: 100%;
    }

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

    .export-modulo {
        grid-template-columns: 1fr;
    }
}


/* =========================================================
   LOGOUT MODAL
========================================================= */

body.modal-open,
html.modal-open {
    overflow: hidden !important;
    overscroll-behavior: none;
}

body.modal-open {
    position: fixed;
    inset: 0 auto auto 0;
    width: 100%;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    place-items: center;
    align-content: center;
    padding: 24px;
    background: rgba(10, 16, 13, 0.42);
    backdrop-filter: blur(16px) saturate(1.15);
    -webkit-backdrop-filter: blur(16px) saturate(1.15);
    animation: modal-fade 0.22s ease;
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

.modal-overlay[hidden] {
    display: none;
}

.modal-overlay-soft {
    padding: 14px;
    background: rgba(10, 16, 13, 0.16);
    backdrop-filter: blur(5px) saturate(1.04);
    -webkit-backdrop-filter: blur(5px) saturate(1.04);
}

.modal-card {
    position: relative;
    overflow: hidden;
    width: min(100%, 380px);
    padding: 28px 26px 22px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--surface);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
    text-align: center;
    animation: modal-scale 0.22s ease;
}

.modal-card-wide {
    width: max-content;
    max-width: calc(100vw - 56px);
    height: auto;
    max-height: calc(100vh - 56px);
    padding: 20px 20px 22px;
    text-align: left;
    display: flex;
    flex-direction: column;
    animation: modal-fade 0.18s ease;
}

.modal-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 14px;
    border-radius: 16px;
    background: var(--danger-bg);
    color: var(--danger);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-icon svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.modal-item {
    margin: 12px 0 0;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--hover);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    word-break: break-word;
}

.modal-text {
    margin: 8px 0 22px;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

.modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.modal-actions.is-single {
    grid-template-columns: 1fr;
}

.modal-btn {
    height: 42px;
    border-radius: 11px;
    font-size: 13px;
    font-weight: 600;
    transition: 0.2s;
}

.modal-btn-ghost {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
}

.modal-btn-ghost:hover {
    background: var(--hover);
    color: var(--text);
}

.modal-card-form {
    width: min(100%, 480px);
    text-align: left;
    overflow: visible;
    padding: 28px 28px 24px;
    margin: auto;
}

.gme-area-modal.modal-card-form {
    width: min(100%, 420px);
    padding: 20px 20px 16px;
}

.gme-area-modal .modal-title {
    margin-bottom: 6px;
    font-size: 1.15rem;
}

.gme-area-modal .modal-text {
    margin: 0 0 4px;
    font-size: 13px;
    line-height: 1.4;
}

.gme-area-modal-fields.modal-fields {
    gap: 10px;
    margin: 10px 0 14px;
}

.gme-area-modal .modal-field-row {
    gap: 10px;
}

.gme-area-modal .modal-actions {
    margin-top: 0;
}

.gme-area-corr-hint {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-secondary);
}

#lblGmeAreaCorrelativo.field-control {
    display: flex;
    align-items: center;
    height: 44px;
    padding: 0 14px;
    line-height: 1.2;
}

.date-picker-panel.is-fixed,
.month-picker-panel.is-fixed {
    width: 268px;
    z-index: 2100;
}

#soporteModal .select-picker-panel,
#soporteModal .select-picker-panel.is-fixed,
.select-picker-panel.is-fixed {
    background: var(--surface-elevated, var(--surface)) !important;
    background-color: var(--surface-elevated, var(--surface)) !important;
    opacity: 1 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35) !important;
    z-index: 3200 !important;
}

#soporteModal .select-picker-panel .select-picker-list,
.select-picker-panel.is-fixed .select-picker-list {
    background: transparent;
    overflow: auto;
}

.modal-card-form .modal-icon {
    margin-left: auto;
    margin-right: auto;
}

.modal-card-form .modal-title,
.modal-card-form .modal-text {
    text-align: center;
}

.modal-icon-primary {
    background: var(--primary-soft);
    color: var(--primary);
}

.modal-fields {
    display: grid;
    gap: 12px;
    margin: 4px 0 20px;
    overflow: visible;
}

.modal-field .date-picker,
.modal-field .date-picker.is-open {
    z-index: 30;
}

.modal-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.modal-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.modal-field[hidden] {
    display: none !important;
}

.modal-field label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.modal-field input:not(.date-picker-query):not(.month-picker-query):not(.select-picker-query),
.modal-field .date-picker-trigger,
.modal-field .date-picker-value {
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--input-bg);
    color: var(--text);
    font-size: 13px;
    font-weight: 400;
    outline: none;
}

.modal-field .date-picker-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-right: 12px;
}

.modal-field .date-picker-value {
    width: auto;
    height: auto;
    padding: 0;
    border: none;
    background: none;
}

.modal-field input:not(.date-picker-query):not(.month-picker-query):not(.select-picker-query):focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.modal-field select,
.modal-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--input-bg);
    color: var(--text);
    font-size: 13px;
    font-weight: 400;
    outline: none;
    font-family: inherit;
}

.modal-field select {
    height: 42px;
}

.modal-field textarea {
    min-height: 96px;
    resize: vertical;
    line-height: 1.4;
}

.modal-field select:focus,
.modal-field textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.soporte-card.modal-card-wide {
    width: min(980px, 96vw);
    height: min(680px, 92vh);
    max-height: min(92vh, 720px);
    padding: 18px 18px 16px;
    border-radius: 12px;
    overflow: hidden;
    text-align: left;
    display: flex;
    flex-direction: column;
}

.soporte-login-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    flex-shrink: 0;
}

.soporte-card .modal-title {
    margin: 0;
    text-align: left;
}

.soporte-title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.soporte-title-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--primary-soft);
    color: var(--primary);
    flex-shrink: 0;
    overflow: visible;
    animation: support-glow 2.8s ease-in-out infinite;
}

.soporte-title-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
    animation: support-bob 2.4s ease-in-out infinite;
}

.soporte-title-icon .support-ping:nth-child(1) {
    animation: support-ripple 2.4s ease-out infinite;
}

.soporte-title-icon .support-ping:nth-child(2) {
    animation: support-ripple 2.4s ease-out infinite 0.8s;
}

.soporte-title-icon .support-wave-l {
    animation: support-wave 1.6s ease-in-out infinite;
}

.soporte-title-icon .support-wave-r {
    animation: support-wave 1.6s ease-in-out infinite 0.35s;
}

@media (prefers-reduced-motion: reduce) {
    .soporte-title-icon,
    .soporte-title-icon svg,
    .soporte-title-icon .support-ping,
    .soporte-title-icon .support-wave-l,
    .soporte-title-icon .support-wave-r {
        animation: none;
    }
}

.soporte-card .modal-text {
    margin: 6px 0 0;
    text-align: left;
}

.soporte-card.is-platform #soporteSinCredWrap {
    display: none !important;
}

.soporte-login-head-text {
    min-width: 0;
    flex: 1;
}

.soporte-check.container {
    flex: 0 0 auto;
    align-self: flex-start;
    margin-top: 2px;
    padding: 7px 10px 7px 8px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--input-bg);
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.soporte-check-text {
    line-height: 1.2;
}

#soporteNombreRef,
.soporte-nombre-upper {
    text-transform: uppercase;
}

.soporte-check .checkmark {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    font-size: 14px;
}

#soporteCorreo.is-locked,
#soporteCorreo:disabled,
#soporteAsunto.is-locked,
#soporteAsunto:disabled,
#soporteTipo.is-locked,
#soporteTipo:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    background: var(--hover);
    pointer-events: none;
}

#soporteModal .select-picker {
    position: relative;
    width: 100%;
    z-index: 2;
}

#soporteModal .select-picker-native,
#soporteModal .select-picker > select,
#soporteModal .modal-field .select-picker > select {
    position: absolute !important;
    inset: 0 auto auto 0 !important;
    width: 1px !important;
    height: 1px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    overflow: hidden !important;
    color: transparent !important;
    font-size: 0 !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    background: transparent !important;
    box-shadow: none !important;
}

#soporteModal .select-picker-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--input-bg);
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    font-weight: 400;
    outline: none;
    cursor: pointer;
}

#soporteModal .select-picker-value {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
}

#soporteModal .select-picker-chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    line-height: 0;
}

#soporteModal .select-picker-trigger svg,
#soporteModal .select-picker-chevron svg,
#soporteModal .soporte-prio-picker .select-picker-chevron svg {
    width: 16px !important;
    height: 16px !important;
    max-width: 16px !important;
    max-height: 16px !important;
    stroke: var(--text-secondary);
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    display: block;
}

#soporteModal .select-picker.is-open .select-picker-chevron svg {
    transform: rotate(180deg);
    stroke: var(--primary);
}

#soporteModal .select-picker.is-locked,
#soporteModal .select-picker.is-disabled {
    opacity: 0.55;
    pointer-events: none;
}

#soporteModal .select-picker.is-locked .select-picker-trigger,
#soporteModal .select-picker.is-disabled .select-picker-trigger {
    cursor: not-allowed;
    background: var(--hover);
}

.soporte-ticket-toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 3300;
    display: grid;
    gap: 10px;
    width: min(380px, calc(100vw - 48px));
    padding: 14px 16px;
    border-radius: 14px;
    background: var(--success, #1f9d55);
    color: #fff;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.2);
    animation: toast-in 0.22s ease;
}

.soporte-ticket-toast[hidden] {
    display: none !important;
}

.soporte-ticket-toast-msg {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    white-space: pre-line;
}

.soporte-ticket-copy {
    display: flex;
    align-items: stretch;
    overflow: hidden;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.soporte-ticket-copy input {
    flex: 1;
    min-width: 0;
    height: 40px;
    border: none;
    outline: none;
    background: transparent;
    color: #122018;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.02em;
    padding: 0 12px;
    cursor: default;
    user-select: none;
    caret-color: transparent;
}

.soporte-ticket-copy button {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #86efac;
    color: #052e16;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.12s ease;
}

.soporte-ticket-copy button:hover {
    background: #4ade80;
}

.soporte-ticket-copy button:active {
    transform: scale(0.96);
}

#soporteModal .modal-field:has([aria-invalid="true"]) > label,
#soporteModal .modal-field:has(.select-picker.is-invalid) > label,
#soporteModal .modal-field:has(.soporte-prio-picker.is-invalid) > label {
    color: var(--danger);
}

#soporteModal .modal-field input[aria-invalid="true"],
#soporteModal .modal-field textarea[aria-invalid="true"],
#soporteModal .modal-field .soporte-usuario-libre[aria-invalid="true"] {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(199, 71, 71, 0.12);
}

#soporteModal .select-picker.is-invalid .select-picker-trigger,
#soporteModal .soporte-prio-picker.is-invalid .select-picker-trigger {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(199, 71, 71, 0.12);
}

.soporte-desc-count {
    margin: 0 0 10px;
    text-align: right;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.soporte-desc-count.is-full {
    color: var(--danger);
}

.soporte-usuario-libre {
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--input-bg);
    color: var(--text);
    font-size: 13px;
    outline: none;
}

.soporte-usuario-libre:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.soporte-usuario-libre[hidden] {
    display: none !important;
}

.soporte-login-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(240px, .9fr);
    gap: 14px;
    align-items: stretch;
    flex: 1;
    min-height: 0;
}

.soporte-login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

.soporte-login-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto minmax(120px, 1fr);
    gap: 10px 12px;
    margin: 0;
    overflow: auto;
    flex: 1 1 auto;
    min-height: 0;
}

.soporte-login-grid .modal-field {
    min-width: 0;
}

.soporte-login-grid .modal-field.is-full {
    grid-column: 1 / -1;
    min-height: 120px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.soporte-login-grid .modal-field textarea {
    flex: 1;
    min-height: 110px;
    max-height: none;
    height: 100%;
    resize: none;
}

.soporte-login-grid .modal-field input,
.soporte-login-grid .modal-field .select-picker-trigger,
#soporteModal .select-picker-trigger {
    min-height: 42px;
}

.soporte-desc-count {
    flex-shrink: 0;
}

.soporte-login-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: auto;
    flex-shrink: 0;
    padding-top: 2px;
}

.soporte-login-actions .modal-btn {
    border-radius: 10px;
    min-height: 42px;
    height: 42px;
    flex-shrink: 0;
    white-space: nowrap;
}

.soporte-prio-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.soporte-prio-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.soporte-prio-icon svg,
.soporte-prio-mark svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
}

.soporte-prio-option {
    width: 100%;
    min-height: 44px;
    display: grid;
    grid-template-columns: 28px 1fr 18px;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    text-align: left;
    font-family: inherit;
}

.soporte-prio-option:hover {
    background: var(--hover);
}

.soporte-prio-option.is-selected {
    background: var(--primary-soft);
    border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
}

.soporte-prio-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.soporte-prio-text strong {
    font-size: 13px;
    font-weight: 600;
}

.soporte-prio-text small {
    font-size: 11px;
    color: var(--text-muted);
}

.tone-normal .soporte-prio-icon { background: var(--success-bg); color: var(--success); }
.tone-prio .soporte-prio-icon { background: var(--warning-bg); color: var(--warning); }
.tone-urgente .soporte-prio-icon { background: var(--status-orange-bg); color: var(--status-orange); }
.tone-critico .soporte-prio-icon { background: var(--danger-bg); color: var(--danger); }

.soporte-prio-panel.select-picker-panel {
    display: grid;
    gap: 4px;
    overflow: auto;
    padding: 6px;
}

.soporte-prio-panel.select-picker-panel[hidden] {
    display: none !important;
}

.soporte-login-media {
    min-height: 0;
    height: 100%;
}

.soporte-gallery {
    position: relative;
    height: 100%;
    min-height: 0;
    border-radius: 10px;
    background: transparent;
}

.soporte-gallery-empty {
    width: 100%;
    height: 100%;
    min-height: 0;
    display: grid;
    place-content: center;
    gap: 8px;
    justify-items: center;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--input-bg);
    color: var(--text-secondary);
    cursor: pointer;
    text-align: center;
    padding: 24px;
}

.soporte-gallery-empty[hidden],
.soporte-gallery:not([data-count="0"]) .soporte-gallery-empty {
    display: none !important;
}

.soporte-gallery-empty strong {
    color: var(--text);
    font-size: 14px;
}

.soporte-gallery-empty span {
    font-size: 12px;
}

.soporte-gallery-empty em {
    color: var(--primary);
    font-style: normal;
    font-weight: 700;
    text-decoration: underline;
}

.soporte-gallery-empty.is-drag {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.soporte-gallery-empty-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: var(--primary-soft);
    color: var(--primary);
    margin-bottom: 4px;
}

.soporte-gallery-empty-icon svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.7;
}

.soporte-gallery-grid {
    display: none;
    height: 100%;
    min-height: 0;
    gap: 8px;
}

.soporte-gallery[data-count="0"] .soporte-gallery-grid {
    display: none !important;
}

.soporte-gallery[data-count="1"] .soporte-gallery-grid,
.soporte-gallery[data-count="2"] .soporte-gallery-grid,
.soporte-gallery[data-count="3"] .soporte-gallery-grid {
    display: grid;
}

.soporte-gallery[data-count="1"] .soporte-gallery-grid {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
}

.soporte-gallery[data-count="2"] .soporte-gallery-grid {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
}

.soporte-gallery[data-count="2"] .soporte-gallery-item:nth-child(1) { grid-row: 1; }
.soporte-gallery[data-count="2"] .soporte-gallery-item:nth-child(2) { grid-row: 2; }

.soporte-gallery[data-count="1"] .soporte-gallery-add,
.soporte-gallery[data-count="2"] .soporte-gallery-add {
    position: absolute;
    right: 10px;
    bottom: 10px;
    z-index: 2;
    width: auto;
    min-width: 96px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--card-shadow);
}

.soporte-gallery[data-count="3"] .soporte-gallery-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1.1fr .9fr;
}

.soporte-gallery[data-count="3"] .soporte-gallery-item:nth-child(1) { grid-column: 1; grid-row: 1; }
.soporte-gallery[data-count="3"] .soporte-gallery-item:nth-child(2) { grid-column: 2; grid-row: 1; }
.soporte-gallery[data-count="3"] .soporte-gallery-item:nth-child(3) {
    grid-column: 1 / -1;
    grid-row: 2;
}

.soporte-gallery[data-count="3"] .soporte-gallery-add {
    display: none;
}

.soporte-gallery-item {
    position: relative;
    min-height: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    background: var(--input-bg);
    display: grid;
    place-items: center;
}

.soporte-gallery-shot {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
    background: var(--input-bg);
}

.soporte-gallery-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 8px;
    background: rgba(0, 0, 0, .55);
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
}

.soporte-gallery-remove svg,
.soporte-gallery-add svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
}

.soporte-gallery-add {
    display: none;
    cursor: pointer;
}

.soporte-gallery-add span {
    font-size: 12px;
    font-weight: 600;
}

@media (max-width: 1180px) {
    .soporte-card.modal-card-wide {
        width: min(720px, 96vw);
        height: auto;
        max-height: min(92dvh, 920px);
        overflow: auto;
        -webkit-overflow-scrolling: touch;
    }

    .soporte-login-layout {
        grid-template-columns: 1fr;
        align-items: start;
        flex: none;
        height: auto;
        min-height: 0;
    }

    .soporte-login-form {
        overflow: visible;
        height: auto;
        min-height: 0;
        flex: none;
    }

    .soporte-login-grid {
        grid-template-rows: none;
        overflow: visible;
        flex: none;
    }

    .soporte-login-grid .modal-field.is-full {
        min-height: 0;
        height: auto;
    }

    .soporte-login-grid .modal-field textarea {
        height: auto;
        min-height: 120px;
        flex: none;
    }

    .soporte-login-actions {
        margin-top: 8px;
    }

    .soporte-login-media {
        position: relative;
        width: 100%;
        height: auto !important;
        min-height: 180px;
        flex: none;
        z-index: 0;
    }

    .soporte-gallery,
    .soporte-gallery-empty,
    .soporte-gallery-grid {
        position: relative;
        width: 100%;
        min-height: 180px;
        height: 200px !important;
    }
}

@media (max-width: 640px) {
    #soporteModal.modal-overlay {
        padding: 8px;
        align-items: start;
        place-items: start center;
    }

    .soporte-login-grid {
        grid-template-columns: 1fr;
    }

    .soporte-card.modal-card-wide {
        width: min(100vw - 16px, 96vw);
        max-height: min(94dvh, 940px);
        margin: 8px auto;
        padding: 14px 12px 12px;
    }

    .soporte-login-media,
    .soporte-gallery,
    .soporte-gallery-empty,
    .soporte-gallery-grid {
        min-height: 160px;
        height: 180px !important;
    }
}

.export-modulo {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.export-modulo label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 42px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--input-bg);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}

.export-modulo input {
    display: none;
}

.export-modulo.is-two {
    grid-template-columns: 1fr 1fr;
}

.export-modulo label:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--primary);
}

.export-modulo label.is-disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.modal-btn-primary {
    border: none;
    background: var(--primary);
    color: white;
}

.modal-btn-primary:hover {
    background: var(--primary-dark);
}

.modal-btn-danger {
    border: none;
    background: var(--danger);
    color: white;
}

.modal-btn-danger:hover {
    filter: brightness(0.92);
}

.modal-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    pointer-events: none;
}

.modal-card-form.is-exporting {
    overflow: hidden;
}

.modal-card-form.is-exporting .date-picker,
.modal-card-form.is-exporting .date-picker.is-open,
.modal-card-form.is-exporting .select-picker,
.modal-card-form.is-exporting .month-picker,
.modal-card-form.is-exporting .export-modulo {
    z-index: 1;
    pointer-events: none;
}

.export-progress {
    position: absolute;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 28px;
    border-radius: inherit;
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
}

.export-progress[hidden] {
    display: none;
}

.export-progress-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: min(100%, 220px);
}

.export-progress-ring {
    position: relative;
    width: 132px;
    height: 132px;
}

.export-progress-glow {
    position: absolute;
    inset: 16px;
    border-radius: 50%;
    background: radial-gradient(circle, color-mix(in srgb, var(--primary) 28%, transparent) 0%, transparent 72%);
    filter: blur(8px);
    animation: export-glow 2.4s ease-in-out infinite;
}

.export-progress-ring > svg {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.export-progress-track,
.export-progress-bar {
    fill: none;
    stroke-width: 7;
}

.export-progress-track {
    stroke: color-mix(in srgb, var(--primary) 16%, var(--border));
}

.export-grad-start { stop-color: #8ee0b3; }
.export-grad-mid { stop-color: var(--primary); }
.export-grad-end { stop-color: var(--primary-dark); }

.export-progress-bar {
    stroke: url(#exportProgressGrad);
    stroke-linecap: round;
    filter: drop-shadow(0 0 8px var(--primary-shadow));
    transition: stroke-dashoffset 0.12s linear;
}

/* GME: gradiente propio (el de Facturas vive en #exportModal[hidden] y no pinta el aro). */
#gmeExportProgressBar {
    stroke: url(#gmeExportProgressGrad);
}

.export-progress-core,
.export-progress-check {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: grid;
    place-items: center;
    place-content: center;
    grid-auto-flow: column;
}

.export-progress-core {
    align-items: baseline;
    gap: 1px;
}

.export-progress-value {
    color: var(--text);
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.export-progress-suffix {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
}

.export-progress-check {
    color: var(--primary);
}

.export-progress-check[hidden],
.export-progress-core[hidden] {
    display: none;
}

.export-progress-check svg {
    width: 36px;
    height: 36px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transform: none;
}

.export-progress-check path {
    stroke-dasharray: 28;
    stroke-dashoffset: 28;
}

.export-progress-ring.is-complete .export-progress-check path {
    animation: export-check 0.42s ease forwards;
}

.export-progress-ring.is-complete .export-progress-glow {
    animation: export-success 0.8s ease;
}

.export-progress-label {
    margin: 0;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.01em;
    text-align: center;
}

.export-progress-label.is-swap {
    animation: export-label 0.28s ease;
}

.export-progress-steps {
    display: flex;
    gap: 6px;
}

.export-progress-step {
    width: 6px;
    height: 6px;
    border-radius: 99px;
    background: var(--border);
    transition: 0.25s ease;
}

.export-progress-step.is-active {
    width: 16px;
    background: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

.export-progress-step.is-done {
    background: color-mix(in srgb, var(--primary) 55%, var(--border));
}

@keyframes export-glow {
    0%, 100% { opacity: 0.55; transform: scale(0.96); }
    50% { opacity: 1; transform: scale(1.05); }
}

@keyframes export-check {
    to { stroke-dashoffset: 0; }
}

@keyframes export-success {
    0% { opacity: 0.4; transform: scale(0.9); }
    45% { opacity: 1; transform: scale(1.18); }
    100% { opacity: 0.7; transform: scale(1); }
}

@keyframes export-label {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .export-progress-glow,
    .export-progress-label.is-swap,
    .export-progress-bar,
    .export-progress-ring.is-complete .export-progress-check path {
        animation: none;
        transition: none;
    }

    .export-progress-ring.is-complete .export-progress-check path {
        stroke-dashoffset: 0;
    }
}

.logout-loading {
    position: absolute;
    inset: 0;
    z-index: 6;
    display: grid;
    place-items: center;
    border-radius: inherit;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.logout-loading[hidden] {
    display: none;
}

[data-theme="dark"] .logout-loading {
    background: rgba(16, 22, 20, 0.72);
}

.logout-loading-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.logout-loading-text {
    margin: 0;
    color: var(--primary);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.loader {
    --loader-size: 154px;
    --loader-dot: 16px;
    --loader-arm: 4px;
    --loader-border: 3px;
    position: relative;
    width: var(--loader-size);
    height: var(--loader-size);
    background: transparent;
    border: var(--loader-border) solid color-mix(in srgb, var(--primary) 14%, transparent);
    border-radius: 50%;
    text-align: center;
    line-height: var(--loader-size);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 1px;
    text-transform: uppercase;
    text-shadow: 0 0 10px var(--primary-shadow);
    box-shadow: 0 0 20px var(--primary-shadow);
}

.loader.loader-sm {
    --loader-size: 68px;
    --loader-dot: 10px;
    --loader-arm: 3px;
    --loader-border: 2px;
    font-size: 0;
    color: transparent;
    letter-spacing: 0;
    text-shadow: none;
    box-shadow: 0 0 12px var(--primary-shadow);
}

.loader::before {
    content: "";
    position: absolute;
    top: calc(var(--loader-border) * -1);
    left: calc(var(--loader-border) * -1);
    width: 100%;
    height: 100%;
    border: var(--loader-border) solid transparent;
    border-top: var(--loader-border) solid var(--primary);
    border-right: var(--loader-border) solid var(--primary);
    border-radius: 50%;
    animation: login-loader-ring 2s linear infinite;
}

.loader span {
    display: block;
    position: absolute;
    top: calc(50% - (var(--loader-arm) / 2));
    left: 50%;
    width: 50%;
    height: var(--loader-arm);
    background: transparent;
    transform-origin: left;
    animation: login-loader-arm 2s linear infinite;
}

.loader span::before {
    content: "";
    position: absolute;
    width: var(--loader-dot);
    height: var(--loader-dot);
    border-radius: 50%;
    background: var(--primary);
    top: calc((var(--loader-dot) / -2) + (var(--loader-arm) / 2));
    right: calc(var(--loader-dot) / -2);
    box-shadow: 0 0 16px 4px var(--primary);
}

.loader-sm span::before {
    box-shadow: 0 0 10px 3px var(--primary);
}

@keyframes login-loader-ring {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes login-loader-arm {
    0% {
        transform: rotate(45deg);
    }

    100% {
        transform: rotate(405deg);
    }
}

.app-tooltip {
    position: fixed;
    z-index: 4000;
    padding: 0.32em 0.7em;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.35;
    white-space: nowrap;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(calc(-100% - 10px)) scale(0);
    transform-origin: var(--tip-arrow, 50%) bottom;
    transition:
        opacity 0.35s cubic-bezier(0.07, 1.17, 0.44, 1.41),
        transform 0.35s cubic-bezier(0.07, 1.17, 0.44, 1.41),
        visibility 0.35s;
}

.app-tooltip.is-multiline {
    white-space: pre-line;
    text-align: left;
    font-weight: 500;
    padding: 0.55em 0.8em;
    line-height: 1.55;
    letter-spacing: 0;
    max-width: min(240px, calc(100vw - 24px));
}

.app-tooltip.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(calc(-100% - 10px)) scale(1);
}

.app-tooltip.is-below {
    transform: translateY(10px) scale(0);
    transform-origin: var(--tip-arrow, 50%) top;
}

.app-tooltip.is-below.is-visible {
    transform: translateY(10px) scale(1);
}

.app-tooltip::before {
    content: "";
    position: absolute;
    left: var(--tip-arrow, 50%);
    bottom: -4px;
    width: 8px;
    height: 8px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    transform: translateX(-50%) rotate(45deg);
}

.app-tooltip.is-below::before {
    bottom: auto;
    top: -4px;
    border-right: none;
    border-bottom: none;
    border-left: 1px solid var(--border);
    border-top: 1px solid var(--border);
}

@keyframes modal-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modal-scale {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* --- Soporte en linea (admin) --- */
.menu-notify {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.1rem;
    height: 1.1rem;
    margin-left: 0.45rem;
    padding: 0 0.28rem;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    vertical-align: middle;
}

#navSoporteEnLinea.menu-item { text-decoration: none; }
#navSoporteEnLinea .menu-label { display: inline-flex; align-items: center; }

.soporte-linea-page {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    max-width: 100%;
}

.soporte-linea-layout {
    display: grid;
    grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
    gap: 14px;
    min-height: calc(100vh - 140px);
    align-items: stretch;
    width: 100%;
}

body.chat-dock-open .soporte-linea-layout {
    grid-template-columns: minmax(200px, 250px) minmax(0, 1fr);
}

.soporte-cola,
.soporte-detalle {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    padding: 14px;
    border-radius: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--card-shadow);
    color: var(--text);
}

.soporte-detalle { overflow: auto; }

.soporte-cola-tools {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.soporte-cola-tools .search,
.soporte-cola-search {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border);
    color: var(--text);
}

.soporte-cola-tools .select-picker,
.soporte-cola-tools .select-picker-trigger {
    width: 100%;
    min-height: 40px;
}

.soporte-cola-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: auto;
    flex: 1;
}

.soporte-cola-item {
    text-align: left;
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 10px 12px;
    background: var(--input-bg);
    color: var(--text);
    cursor: pointer;
}

.soporte-cola-item:hover { border-color: var(--border); background: var(--hover); }
.soporte-cola-item.is-active { border-color: var(--primary); background: var(--primary-soft); }

.soporte-cola-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 22px;
}

.soporte-cola-top .soporte-cola-code {
    display: inline-flex;
    align-items: center;
    margin: 0;
    min-height: 22px;
    line-height: 1;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
}

.soporte-cola-top .soporte-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    height: 22px;
    margin: 0;
    padding: 0 10px;
    line-height: 1;
    flex: 0 0 auto;
}

.soporte-cola-asunto {
    margin-top: 4px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    color: var(--text);
}

.soporte-cola-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-secondary);
}

.soporte-cola-meta .soporte-state {
    align-self: center;
    line-height: 1;
}

.soporte-pill,
.soporte-chip,
.soporte-state {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
}

.soporte-pill.tone-normal { background: var(--status-info-bg); color: var(--status-info); }
.soporte-pill.tone-prioritario { background: var(--warning-bg); color: var(--warning); }
.soporte-pill.tone-urgente { background: var(--status-orange-bg); color: var(--status-orange); }
.soporte-pill.tone-critico { background: var(--danger-bg); color: var(--danger); }
.soporte-state.state-pendiente { background: var(--warning-bg); color: var(--warning); }
.soporte-state.state-en_atencion { background: var(--status-info-bg); color: var(--status-info); }
.soporte-state.state-resuelto { background: var(--success-bg); color: var(--success); }
.soporte-state.state-cerrado,
.soporte-state.state-cancelado { background: var(--danger-bg); color: var(--danger); }

.soporte-empty {
    padding: 24px 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.soporte-detalle-head {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    text-align: center;
}

.soporte-detalle-title { min-width: 0; width: 100%; }

.soporte-detalle-title h2 {
    margin: 0;
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.35em;
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--text);
}

.soporte-code {
    margin: 0;
    font-size: inherit;
    font-weight: inherit;
    letter-spacing: 0.03em;
    color: var(--primary);
}

.soporte-title-sep {
    color: var(--text-muted);
    font-weight: 400;
}

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

.soporte-detalle-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
}

.soporte-detalle-actions .soporte-atencion-select {
    position: relative;
    flex: 0 1 300px;
    min-width: 220px;
    max-width: 340px;
    margin: 0;
    text-align: left;
}

.soporte-detalle-actions .field-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.soporte-detalle-actions .select-picker,
.soporte-detalle-actions .select-picker-trigger {
    width: 100%;
    min-height: 40px;
}

.soporte-atencion-btns {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.soporte-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-elevated);
    color: var(--text);
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 550;
    white-space: nowrap;
    transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.soporte-action-btn svg {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.soporte-action-btn.is-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 6px 14px var(--primary-shadow);
}

.soporte-action-btn.is-success {
    background: var(--success-bg);
    border-color: transparent;
    color: var(--success);
}

.soporte-action-btn.is-user {
    background: var(--status-info-bg);
    border-color: transparent;
    color: var(--status-info);
}

.soporte-action-btn.is-danger {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
    box-shadow: 0 6px 14px rgba(220, 38, 38, 0.28);
}

.soporte-action-btn.is-ghost { background: transparent; }

.soporte-action-btn:hover:not(:disabled) { transform: translateY(-1px); }
.soporte-action-btn.is-primary:hover:not(:disabled) svg { animation: soporte-icon-bounce 0.55s ease; }
.soporte-action-btn.is-success:hover:not(:disabled) svg { animation: soporte-icon-check 0.55s ease; }
.soporte-action-btn.is-danger:hover:not(:disabled) {
    background: #b91c1c;
    border-color: #b91c1c;
}
.soporte-action-btn.is-danger:hover:not(:disabled) svg { animation: soporte-icon-spin 0.45s ease; }
.soporte-action-btn.is-ghost:hover:not(:disabled) svg { animation: soporte-icon-spin 0.45s ease; }
.soporte-action-btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; transform: none; }

@keyframes soporte-icon-bounce {
    0%, 100% { transform: translateY(0) scale(1); }
    40% { transform: translateY(-2px) scale(1.12); }
    70% { transform: translateY(1px) scale(0.96); }
}
@keyframes soporte-icon-check {
    0% { transform: scale(0.7) rotate(-18deg); opacity: 0.5; }
    60% { transform: scale(1.18) rotate(6deg); opacity: 1; }
    100% { transform: scale(1) rotate(0); }
}
@keyframes soporte-icon-spin {
    0% { transform: rotate(0); }
    100% { transform: rotate(90deg); }
}

.soporte-detalle-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.85fr) minmax(180px, 0.65fr);
    gap: 12px;
    align-items: stretch;
}

.soporte-panel {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    background: var(--surface);
    color: var(--text);
    min-width: 0;
}

.soporte-panel-historial { display: flex; flex-direction: column; }
.soporte-panel-wide { grid-column: 1 / -1; }

.soporte-panel h3 {
    margin: 0 0 10px;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text);
}

.soporte-meta-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.soporte-meta-cell {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-elevated);
}

[data-theme="light"] .soporte-meta-cell,
:root:not([data-theme="dark"]) .soporte-meta-cell {
    background: #fff;
    border-color: #e6ebe8;
}

[data-theme="light"] .soporte-panel,
:root:not([data-theme="dark"]) .soporte-panel {
    background: #fff;
    border-color: #e6ebe8;
}

[data-theme="light"] .soporte-desc-box,
:root:not([data-theme="dark"]) .soporte-desc-box,
[data-theme="light"] .soporte-hist-item,
:root:not([data-theme="dark"]) .soporte-hist-item {
    background: #f8faf9;
}

.soporte-meta-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.soporte-meta-value {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    word-break: break-word;
    line-height: 1.35;
}

.soporte-meta-cell .soporte-state,
.soporte-meta-cell .soporte-pill {
    width: fit-content;
    margin-top: 2px;
    align-self: flex-start;
}

.soporte-meta-with-action {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.soporte-meta-with-action .soporte-meta-value {
    flex: 1 1 auto;
    min-width: 0;
}

.soporte-social {
    position: relative;
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 6px;
    border: 1px solid transparent;
    background: rgba(117, 117, 117, 0.12);
    color: #fff;
    text-decoration: none;
    transition: all 0.4s cubic-bezier(0.15, 0.83, 0.66, 1);
}

.soporte-social .socialSvg {
    position: absolute;
    width: 15px;
    height: 15px;
    display: flex;
    transition: all 0.4s cubic-bezier(0.15, 0.83, 0.66, 1);
}

.soporte-social .socialSvg path {
    fill: #fff;
}

.soporte-social.is-mail .socialSvg {
    fill: none;
}

.soporte-social.is-mail .socialSvg path {
    fill: none;
    stroke: #fff;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.soporte-social .socialSvg:first-child {
    opacity: 1;
    transform: translateY(0);
    scale: 1.15;
}

.soporte-social .socialSvg:last-child {
    opacity: 0;
    transform: translateY(18px);
}

.soporte-social:hover {
    transform: scale(1.15);
    border-radius: 8px;
}

.soporte-social.is-wa:hover {
    background-color: #25d366;
}

.soporte-social.is-mail:hover {
    background-color: #0078d4;
}

.soporte-social:hover .socialSvg:first-child {
    transform: translateY(-36px);
    opacity: 0;
}

.soporte-social:hover .socialSvg:last-child {
    transform: translateY(0);
    opacity: 1;
}

.soporte-social:active {
    transform: scale(1.08);
    transition-duration: 0.3s;
}

[data-theme="light"] .soporte-social .socialSvg path,
:root:not([data-theme="dark"]) .soporte-social .socialSvg path {
    fill: var(--text);
}

[data-theme="light"] .soporte-social.is-mail .socialSvg path,
:root:not([data-theme="dark"]) .soporte-social.is-mail .socialSvg path {
    fill: none;
    stroke: var(--text);
}

[data-theme="light"] .soporte-social:hover .socialSvg path,
:root:not([data-theme="dark"]) .soporte-social:hover .socialSvg path {
    fill: #fff;
}

[data-theme="light"] .soporte-social.is-mail:hover .socialSvg path,
:root:not([data-theme="dark"]) .soporte-social.is-mail:hover .socialSvg path {
    fill: none;
    stroke: #fff;
}

.soporte-desc-box {
    max-height: 220px;
    overflow: auto;
    padding: 12px 14px;
    padding-right: 10px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--input-bg);
    white-space: pre-wrap;
    line-height: 1.5;
    font-size: 14px;
    font-weight: 400;
    color: var(--text);
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--border) 80%, transparent) transparent;
}

.soporte-desc-box::-webkit-scrollbar {
    width: 4px;
}

.soporte-desc-box::-webkit-scrollbar-track {
    background: transparent;
}

.soporte-desc-box::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--border) 85%, transparent);
    border-radius: 999px;
}

.soporte-desc-box::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.soporte-fotos {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    max-width: 640px;
    margin: 0 auto;
}

.soporte-foto {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.soporte-foto-open {
    display: block;
    padding: 0;
    border: none;
    background: transparent;
    cursor: zoom-in;
    border-radius: 12px;
    overflow: hidden;
}

.soporte-foto img,
.soporte-foto-empty {
    aspect-ratio: 1;
    width: 100%;
    border-radius: 12px;
    object-fit: cover;
    background: var(--input-bg);
    border: 1px dashed var(--border);
}

.soporte-foto-open img { border-style: solid; display: block; }
.soporte-foto-empty { display: grid; place-items: center; color: var(--text-muted); }
.soporte-foto-empty svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.soporte-foto figcaption { font-size: 11px; text-align: center; color: var(--text-muted); }

.soporte-historial {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: auto;
    flex: 0 1 auto;
    min-height: 0;
    /* ~3 movimientos visibles; el resto con scroll fino */
    max-height: calc((4.6rem + 8px) * 3);
    padding-right: 4px;
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--border) 80%, transparent) transparent;
}

.soporte-historial::-webkit-scrollbar {
    width: 4px;
}

.soporte-historial::-webkit-scrollbar-track {
    background: transparent;
}

.soporte-historial::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--border) 85%, transparent);
    border-radius: 999px;
}

.soporte-historial::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.soporte-hist-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px;
    border-radius: 10px;
    background: var(--input-bg);
    border: 1px solid var(--border);
}

.soporte-hist-main {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
}

.soporte-hist-estado {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 1px 8px;
    font-size: 12px;
    font-weight: 600;
    background: var(--hover);
    color: var(--text-secondary);
}

.soporte-hist-estado.state-pendiente {
    background: var(--warning-bg);
    color: var(--warning);
}

.soporte-hist-estado.state-en_atencion {
    background: var(--status-info-bg);
    color: var(--status-info);
}

.soporte-hist-estado.state-resuelto {
    background: var(--success-bg);
    color: var(--success);
}

.soporte-hist-estado.state-cerrado,
.soporte-hist-estado.state-cancelado {
    background: var(--danger-bg);
    color: var(--danger);
}

.soporte-hist-text {
    font-size: 12px;
    font-weight: 500;
    line-height: 1.35;
    color: var(--text-secondary);
}

.soporte-hist-meta {
    font-size: 11px;
    color: var(--text-muted);
}

.soporte-foto-modal {
    z-index: 3600;
    display: grid;
    place-items: center;
    padding: 18px;
}
.soporte-foto-modal[hidden] { display: none !important; }
.soporte-foto-dialog {
    position: relative;
    width: min(960px, 96vw);
    height: min(88vh, 820px);
    display: grid;
    grid-template-rows: 1fr auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
}
.soporte-foto-stage {
    display: grid;
    place-items: center;
    min-height: 0;
    padding: 28px 64px 16px;
    background: #0b0f0d;
}
.soporte-foto-stage img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
}
.soporte-foto-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-60%);
    z-index: 2;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 999px;
    background: rgba(255,255,255,0.14);
    color: #fff;
    cursor: pointer;
    display: grid;
    place-items: center;
}
.soporte-foto-nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; }
.soporte-foto-nav.is-prev { left: 12px; }
.soporte-foto-nav.is-next { right: 12px; }
.soporte-foto-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--surface-elevated);
}
.soporte-foto-bar-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 20px;
    cursor: pointer;
}
.soporte-foto-dots { display: flex; gap: 8px; align-items: center; }
.soporte-foto-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    border: none;
    background: var(--border);
    cursor: pointer;
    padding: 0;
}
.soporte-foto-dot.is-on { background: var(--primary); transform: scale(1.15); }
.soporte-foto-counter {
    min-width: 52px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

body.chat-dock-open .soporte-meta-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
body.chat-dock-open .soporte-detalle-grid {
    grid-template-columns: minmax(0, 1.7fr) minmax(160px, 0.55fr);
}

@media (max-width: 1200px) {
    .soporte-detalle-grid { grid-template-columns: 1fr; }
    .soporte-panel-historial .soporte-historial { max-height: calc((4.6rem + 8px) * 3); }
}
@media (max-width: 900px) {
    .soporte-linea-layout { grid-template-columns: 1fr; min-height: 0; }
    .soporte-cola { max-height: 300px; }
    .soporte-meta-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
    .soporte-meta-grid { grid-template-columns: 1fr; }
}

/* =========================================================
   FORCE portal table chrome — Facturas/Pagos look (universal)
   Borde + radio 8px en el wrap · thead mint · sin pipes
========================================================= */
html body .table-wrap,
html body .table-wrapper,
html body .table-tall,
html body .oc-items-wrap,
html body .items-modal-wrap.oc-items-wrap,
html body .modal-card .oc-items-wrap,
html body .modal-card-wide .oc-items-wrap,
html body .mass-pay-table-wrap {
    border: var(--table-border) !important;
    border-radius: var(--table-radius, 8px) !important;
    overflow: auto !important;
    background: var(--surface) !important;
    scrollbar-width: thin !important;
    scrollbar-color: color-mix(in srgb, var(--border) 50%, transparent) transparent !important;
}

html body .table-wrap::-webkit-scrollbar,
html body .table-wrapper::-webkit-scrollbar,
html body .table-tall::-webkit-scrollbar,
html body .oc-items-wrap::-webkit-scrollbar,
html body .items-modal-wrap::-webkit-scrollbar,
html body .mass-pay-table-wrap::-webkit-scrollbar {
    width: 4px !important;
    height: 4px !important;
}

html body .table-wrap::-webkit-scrollbar-track,
html body .table-wrapper::-webkit-scrollbar-track,
html body .table-tall::-webkit-scrollbar-track,
html body .oc-items-wrap::-webkit-scrollbar-track,
html body .items-modal-wrap::-webkit-scrollbar-track,
html body .mass-pay-table-wrap::-webkit-scrollbar-track {
    background: transparent !important;
}

html body .table-wrap::-webkit-scrollbar-thumb,
html body .table-wrapper::-webkit-scrollbar-thumb,
html body .table-tall::-webkit-scrollbar-thumb,
html body .oc-items-wrap::-webkit-scrollbar-thumb,
html body .items-modal-wrap::-webkit-scrollbar-thumb,
html body .mass-pay-table-wrap::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--border) 65%, transparent) !important;
    border-radius: 99px !important;
    border: none !important;
    box-shadow: none !important;
}

/* Card contenedor: sin pelear con el wrap (el radio vive en el wrap) */
html body .card.table-card,
html body .table-card,
html body article.card.table-card,
html body .gme-lote-table.card,
html body .gme-lote-table {
    overflow: visible !important;
}

html body table,
html body .data-table,
html body .oc-items-table,
html body .priv-table,
html body .mass-pay-table,
html body .auditoria-acceso-table,
html body .latest-table {
    border: none !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    background: transparent !important;
}

html body table thead,
html body .data-table thead,
html body .oc-items-table thead,
html body .priv-table thead,
html body .mass-pay-table thead,
html body .auditoria-acceso-table thead,
html body .latest-table thead {
    position: sticky !important;
    top: 0 !important;
    z-index: 6 !important;
    background: var(--table-head-bg, var(--primary-soft)) !important;
    background-color: var(--table-head-bg, var(--primary-soft)) !important;
}

html body table tbody,
html body .data-table tbody,
html body .oc-items-table tbody {
    background: var(--surface) !important;
    position: relative !important;
    z-index: 0 !important;
}

html body table tbody td,
html body .data-table tbody td,
html body .table-wrapper table tbody td,
html body .table-wrap table tbody td,
html body .oc-items-table tbody td,
html body .mass-pay-table tbody td,
html body .auditoria-acceso-table tbody td,
html body .latest-table tbody td {
    background-color: var(--surface) !important;
    font-family: var(--font-table, var(--font-ui, "Segoe UI", ui-sans-serif, system-ui, sans-serif)) !important;
    font-size: var(--font-size-table-row, 12px) !important;
}

/* priv-table: tipografía sí; fondos los define Usuarios.css (verde/amarillo/blanco) */
html body .priv-table tbody td {
    font-family: var(--font-table, var(--font-ui, "Segoe UI", ui-sans-serif, system-ui, sans-serif)) !important;
    font-size: var(--font-size-table-row, 12px) !important;
}

html body table tbody tr:nth-child(even) td,
html body .data-table tbody tr:nth-child(even) td,
html body .table-wrapper table tbody tr:nth-child(even) td,
html body .table-wrap table tbody tr:nth-child(even) td,
html body .oc-items-table tbody tr:nth-child(even) td,
html body .mass-pay-table tbody tr:nth-child(even) td,
html body .auditoria-acceso-table tbody tr:nth-child(even) td,
html body .latest-table tbody tr:nth-child(even) td {
    background-color: color-mix(in srgb, var(--primary) 8%, var(--surface)) !important;
}

html body table th,
html body table td,
html body table thead th,
html body table tbody td,
html body table tfoot td,
html body .data-table th,
html body .data-table td,
html body .table-card table th,
html body .table-card table td,
html body .table-wrapper table th,
html body .table-wrapper table td,
html body .table-wrap table th,
html body .table-wrap table td,
html body .oc-items-table th,
html body .oc-items-table td,
html body .priv-table th,
html body .priv-table td,
html body .mass-pay-table th,
html body .mass-pay-table td,
html body .auditoria-acceso-table th,
html body .auditoria-acceso-table td,
html body .latest-table th,
html body .latest-table td {
    border: none !important;
    border-width: 0 !important;
    outline: none !important;
    border-radius: 0 !important;
}

html body table thead th,
html body table > thead > tr > th,
html body .data-table thead th,
html body .data-table th,
html body .table-card table thead th,
html body .table-wrapper table thead th,
html body .table-wrap table thead th,
html body .table-tall table thead th,
html body .oc-items-table thead th,
html body .oc-items-table th,
html body .priv-table thead th,
html body .priv-table th,
html body .mass-pay-table th,
html body .auditoria-acceso-table thead th,
html body .latest-table thead th,
html body[data-page] table thead th {
    position: sticky !important;
    top: 0 !important;
    z-index: 7 !important;
    color: var(--primary) !important;
    font-family: var(--font-table, var(--font-ui, "Segoe UI", ui-sans-serif, system-ui, sans-serif)) !important;
    font-size: var(--font-size-table-head, 10px) !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.04em !important;
    /* Opaco: sin rgba ni gradient transparente */
    background: var(--table-head-bg, #eaf6ef) !important;
    background-color: var(--table-head-bg, #eaf6ef) !important;
    background-image: none !important;
    border: none !important;
    border-radius: 0 !important;
    /* Cubre 1px de sangrado subpixel al scrollear */
    box-shadow: 0 1px 0 var(--border), inset 0 -1px 0 var(--border) !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
}
