/* ==========================================================================
   PRINTMONITOR — TEMA CLARO DESKLY SAAS STYLE
   Variables CSS, Componentes y Layout
   ========================================================================== */
:root {
    /* Paleta Principal Deskly Light */
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --bg-sidebar: #ffffff;
    --border: #e2e8f0;
    --border-hover: #cbd5e1;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-glow: rgba(37, 99, 235, 0.15);
    
    --success: #10b981;
    --success-bg: #d1fae5;
    --success-text: #065f46;
    --warning: #f59e0b;
    --warning-bg: #fef3c7;
    --warning-text: #92400e;
    --danger: #ef4444;
    --danger-bg: #fee2e2;
    --danger-text: #991b1b;
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.05), 0 1px 2px -1px rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.07);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.08);
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   IMPERSONATION BANNER
   ========================================================================== */
.impersonation-banner {
    background: linear-gradient(90deg, #d97706 0%, #b45309 100%);
    color: #fff;
    padding: 0.5rem 1.5rem;
    font-size: 0.8125rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.btn-sm-warning {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #fff;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    cursor: pointer;
    font-weight: 600;
}

/* ==========================================================================
   TOPBAR (DESKLY STYLE)
   ========================================================================== */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.25rem;
    color: #0f172a;
}

.gradient-text {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tenant-pill {
    background: #f1f5f9;
    border: 1px solid var(--border);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.role-pill {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    background: #d1fae5;
    color: #065f46;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #fff;
    font-weight: 700;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
}

.user-meta {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--text-primary);
}

.user-email {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.btn-logout {
    background: #ffffff;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-logout:hover {
    color: #dc2626;
    border-color: #fca5a5;
    background: #fef2f2;
}

/* ==========================================================================
   NAVIGATION TABS
   ========================================================================== */
.nav-tabs {
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    padding: 0 1.5rem;
}

.nav-tabs-container {
    display: flex;
    gap: 0.5rem;
}

.nav-tab {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    padding: 0.8rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.nav-tab:hover {
    color: var(--primary);
    background: #f8fafc;
}

.nav-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
    background: #eff6ff;
}

.badge-count {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fca5a5;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 9999px;
}

/* ==========================================================================
   LAYOUT PRINCIPAL
   ========================================================================== */
.main-layout {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.tab-pane {
    display: none;
    flex: 1;
    padding: 1.5rem;
}

.tab-pane.active {
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   DOBLE PANEL KYOCERA (SPLIT VIEW)
   ========================================================================== */
.devices-split-view {
    display: grid;
    grid-template-columns: 290px 1fr;
    gap: 1.25rem;
    flex: 1;
    min-height: calc(100vh - 120px);
}

/* Panel Izquierdo: Sedes */
.sidebar-groups {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
}

.sidebar-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.9375rem;
    color: var(--text-primary);
    display: block;
    margin-bottom: 0.6rem;
}

.sidebar-search input {
    width: 100%;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.45rem 0.65rem;
    color: var(--text-primary);
    font-size: 0.8125rem;
    outline: none;
    transition: border-color 0.2s;
}

.sidebar-search input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.groups-tree-container {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.group-tree-item {
    padding: 0.55rem 1rem;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: background 0.15s;
    user-select: none;
    border-left: 3px solid transparent;
}

.group-tree-item:hover {
    background: #f8fafc;
}

.group-tree-item.active {
    background: #eff6ff;
    border-left-color: var(--primary);
}

.group-tree-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.group-tree-item.active .group-name {
    color: var(--primary);
    font-weight: 600;
}

.group-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.group-badge {
    background: #f1f5f9;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.1rem 0.4rem;
    border-radius: 9999px;
}

.group-tree-item.active .group-badge {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* Árbol Jerárquico Clientes / Sedes Colapsable */
.clients-tree-list {
    display: flex;
    flex-direction: column;
}

.client-tree-branch {
    border-bottom: 1px solid #f1f5f9;
}

.client-header-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 0.85rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--text-primary);
    user-select: none;
    transition: background 0.15s;
    border-left: 3px solid transparent;
}

.client-header-row:hover {
    background: #f8fafc;
}

.client-header-row.active {
    background: #eff6ff;
    border-left-color: var(--primary);
    color: var(--primary);
}

.tree-chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: transform 0.15s;
}

.client-sites-sublist {
    background: #fafbfc;
    border-left: 2px solid #e2e8f0;
    margin-left: 1.25rem;
    padding: 0.2rem 0;
}

.site-tree-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.site-tree-row:hover {
    background: #f1f5f9;
    color: var(--text-primary);
}

.site-tree-row.active {
    background: #eff6ff;
    color: var(--primary);
    font-weight: 600;
}

.tree-loading {
    padding: 1rem;
    text-align: center;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* ==========================================================================
   PANEL DERECHO: LISTADO COMPLETO
   ========================================================================== */
.fleet-main-pane {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

.fleet-toolbar {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.85rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    box-shadow: var(--shadow-sm);
}

.toolbar-left {
    display: flex;
    flex-direction: column;
}

.view-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.view-subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.search-input-box {
    position: relative;
}

.search-input-box input {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.45rem 0.75rem;
    color: var(--text-primary);
    font-size: 0.8125rem;
    width: 250px;
    outline: none;
    transition: border-color 0.2s;
}

.search-input-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.custom-select {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.45rem 0.75rem;
    color: var(--text-primary);
    font-size: 0.8125rem;
    outline: none;
    cursor: pointer;
}

.custom-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border: none;
    color: #fff;
    font-weight: 600;
    font-size: 0.8125rem;
    padding: 0.5rem 0.95rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
    transition: opacity 0.2s, transform 0.1s;
}

.btn-primary:hover {
    opacity: 0.95;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #ffffff;
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.8125rem;
    padding: 0.5rem 0.85rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: var(--primary);
}

/* ==========================================================================
   TABLA KYOCERA & DESKLY STYLE
   ========================================================================== */
.table-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.kyocera-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.kyocera-table th {
    background: #f8fafc;
    padding: 0.45rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

.kyocera-table td {
    padding: 0.35rem 0.65rem;
    font-size: 0.8125rem;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-primary);
    vertical-align: middle;
}

.kyocera-table tbody tr {
    cursor: pointer;
    transition: background 0.15s;
}

.kyocera-table tbody tr:hover {
    background: #f8fafc;
}

.printer-model-cell {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 600;
    color: var(--text-primary);
}

.printer-icon {
    font-size: 1.1rem;
}

.printer-serial {
    font-family: monospace;
    font-size: 0.8125rem;
    color: #2563eb;
    font-weight: 600;
}

.ip-link {
    color: #2563eb;
    text-decoration: none;
    font-family: monospace;
    font-size: 0.78rem;
}

.ip-link:hover {
    text-decoration: underline;
}

/* Badges de Estado */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
    border-radius: 9999px;
}

.status-online {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.status-offline {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid rgba(148, 163, 184, 0.4);
}

/* Barra de Insumos */
.toner-summary-bar {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.toner-mini-progress {
    width: 60px;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
}

.toner-mini-fill {
    height: 100%;
    border-radius: 3px;
}

.toner-percent {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.counter-value {
    font-family: monospace;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.85rem;
}

/* ==========================================================================
   KPIS GRID & CHARTS (DASHBOARD)
   ========================================================================== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
}

.kpi-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-weight: 500;
}

.kpi-value {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0.25rem 0;
}

.kpi-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.25rem;
}

.chart-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.chart-header h3 {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.chart-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    background: #f1f5f9;
    border-radius: 9999px;
    color: var(--text-secondary);
}

.volume-bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    height: 190px;
    padding-top: 1rem;
    border-bottom: 1px solid var(--border);
}

.chart-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
    gap: 0.25rem;
    transition: transform 0.2s ease;
}

.chart-column:hover {
    transform: translateY(-2px);
}

.chart-column:hover .bar-mono {
    filter: brightness(1.15);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.bar-track {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    max-height: 125px;
}

.bar-mono {
    width: 100%;
    background: linear-gradient(180deg, #3b82f6 0%, #1d4ed8 100%);
    border-radius: 4px 4px 0 0;
    min-height: 4px;
}

.col-label {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.dashboard-brand-item {
    transition: background-color 0.15s ease, transform 0.15s ease;
}

.dashboard-brand-item:hover {
    background-color: var(--bg-hover, #f8fafc);
    transform: translateX(2px);
}

/* ==========================================================================
   MODALES (ESTILO DESKLY LIGHT)
   ========================================================================== */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

#modal-onboarding-tour {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 999999 !important;
    align-items: center !important;
    justify-content: center !important;
}

.modal-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 560px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: var(--text-primary);
}

.modal-lg {
    max-width: 840px;
}

.modal-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
}

.modal-header h3 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.btn-close-modal {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.2rem;
    line-height: 1;
}

.btn-close-modal:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    max-height: 80vh;
}

.modal-footer {
    padding: 0.85rem 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    background: #f8fafc;
}

.modal-internal-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

.modal-tab {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    padding: 0.5rem 0.8rem;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
}

.modal-tab:hover {
    color: var(--primary);
}

.modal-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.modal-tab-content {
    display: none;
}

.modal-tab-content.active {
    display: block;
}

.device-spec-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.spec-group {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.85rem;
    display: flex;
    flex-direction: column;
}

.spec-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.spec-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 0.15rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* ==========================================================================
   GESTION DE CLIENTES Y SEDES (TABLA JERÁRQUICA & SEDES PLEGABLES)
   ========================================================================== */
.clients-quick-pills .pill-filter-btn {
    padding: 0.35rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 20px;
    cursor: pointer;
    border: 1px solid var(--border);
    background: #ffffff;
    color: var(--text-secondary);
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.clients-quick-pills .pill-filter-btn:hover {
    border-color: #93c5fd;
    color: var(--text-primary);
    background: #f8fafc;
}
.clients-quick-pills .pill-filter-btn#client-pill-all.active {
    background: #2563eb !important;
    border-color: #2563eb !important;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35) !important;
}
.clients-quick-pills .pill-filter-btn#client-pill-online.active {
    background: #16a34a !important;
    border-color: #16a34a !important;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.35) !important;
}
.clients-quick-pills .pill-filter-btn#client-pill-offline.active {
    background: #d97706 !important;
    border-color: #d97706 !important;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.35) !important;
}
.clients-quick-pills .pill-filter-btn#client-pill-empty.active {
    background: #64748b !important;
    border-color: #64748b !important;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(100, 116, 139, 0.35) !important;
}

.clients-table-wrapper {
    width: 100%;
    overflow-x: auto;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.clients-hierarchical-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.clients-hierarchical-table th {
    background: #f8fafc;
    padding: 0.55rem 0.85rem;
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.client-parent-row {
    cursor: pointer;
    transition: background 0.15s ease;
    border-bottom: 1px solid #f1f5f9;
}
.client-parent-row:hover {
    background: #f8fafc;
}
.client-parent-row.expanded {
    background: #f0f7ff;
    border-bottom: 1px solid #bfdbfe;
}

.client-parent-row td {
    padding: 0.65rem 0.85rem;
    font-size: 0.8125rem;
    color: var(--text-primary);
    vertical-align: middle;
}

.client-expand-chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: #ffffff;
    color: var(--text-secondary);
    font-size: 0.72rem;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), background 0.15s;
    user-select: none;
}
.client-parent-row:hover .client-expand-chevron {
    border-color: #93c5fd;
    color: var(--primary);
}
.client-parent-row.expanded .client-expand-chevron {
    transform: rotate(90deg);
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.client-drawer-row {
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
}
.client-drawer-cell {
    padding: 0.75rem 1.25rem 0.95rem 2.85rem;
}
.client-drawer-container {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.85rem 1.15rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.03);
}

.drawer-site-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.78rem;
    gap: 0.65rem;
    flex-wrap: wrap;
    transition: all 0.15s ease;
}
.drawer-site-item:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

/* Compatibilidad grid */
.clients-grid {
    display: block;
    width: 100%;
}

.sede-mini-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.2rem 0.5rem;
    font-size: 0.72rem;
    color: var(--text-secondary);
    transition: all 0.15s ease;
}

.sede-mini-chip:hover {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: var(--text-primary);
}

.client-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.client-card-title-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
}

.client-avatar-badge {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #2563eb;
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.client-card-name {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.2;
}

.client-card-taxid {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
}

.client-card-header-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.client-card-meta {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.35rem 0.6rem;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.45rem 0.65rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.client-card-meta-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.client-card-meta-full {
    grid-column: span 2;
}

.client-card-actions-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.client-card-badges {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.client-badge-pill {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.45rem;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.client-badge-printers {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.client-badge-printers.zero {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #cbd5e1;
}

.client-badge-sites {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

.client-card-sedes-section {
    border-top: 1px solid #f1f5f9;
    padding-top: 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.client-card-sedes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.sede-item-card {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.6rem;
    transition: background 0.15s, border-color 0.15s;
}

.sede-item-card:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.sede-item-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.sede-item-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.8125rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.sede-item-address {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sede-item-token-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.sede-item-token {
    font-family: monospace;
    font-size: 0.72rem;
    color: #2563eb;
    background: #ffffff;
    border: 1px solid var(--border);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
}

.sede-item-actions {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-shrink: 0;
}

.sede-empty-box {
    background: #fef3c7;
    border: 1px dashed #f59e0b;
    border-radius: 8px;
    padding: 0.65rem 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.sede-empty-text {
    font-size: 0.78rem;
    color: #92400e;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.text-danger {
    color: #dc2626 !important;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.section-header h2 {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
}

.section-header .subtitle {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.section-actions {
    display: flex;
    gap: 0.6rem;
    align-items: center;
}

/* ==========================================================================
   TAB CONFIGURACION (SMTP & UMBRALES)
   ========================================================================== */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 1.25rem;
}

.settings-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.settings-card-header {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--border);
}

.settings-card-icon {
    font-size: 1.5rem;
    line-height: 1;
    background: #f1f5f9;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
}

.settings-card-header h3 {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
}

.settings-card-header p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.85rem;
}

.form-row .form-group {
    margin-bottom: 0;
}

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

.form-help {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.settings-card-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border);
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.settings-card-actions.justify-end {
    justify-content: flex-end;
}

.test-smtp-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ==========================================================================
   RESPONSIVE DESIGN & MOBILE OPTIMIZATIONS (ADMIN & USERS EN CELULAR)
   ========================================================================== */

/* Botón toggle de sedes (oculto en escritorio) */
.mobile-sidebar-toggle-btn {
    display: none;
    align-items: center;
    gap: 0.3rem;
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.55rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
}

.sidebar-header-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mobile-table-hint {
    display: none;
    font-size: 0.72rem;
    color: var(--text-muted);
    background: #f8fafc;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.65rem;
    margin-bottom: 0.5rem;
    text-align: center;
}

/* TABLET & MOBILE (< 900px) */
@media (max-width: 900px) {
    /* Padding general de páginas */
    .tab-pane {
        padding: 0.75rem !important;
    }

    /* Topbar móvil */
    .topbar {
        padding: 0.5rem 0.85rem !important;
    }
    .topbar-left {
        gap: 0.4rem !important;
    }
    .logo-text {
        font-size: 1.1rem !important;
    }
    .tenant-pill {
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 0.72rem !important;
        padding: 0.15rem 0.45rem !important;
    }
    .role-pill {
        display: none !important;
    }
    .user-email {
        display: none !important;
    }
    .user-name {
        font-size: 0.8rem !important;
        max-width: 85px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .user-avatar {
        width: 30px !important;
        height: 30px !important;
        font-size: 0.75rem !important;
    }
    .btn-logout {
        padding: 0.3rem 0.55rem !important;
        font-size: 0.75rem !important;
    }

    /* Tabs de navegación con scroll horizontal táctil */
    .nav-tabs {
        padding: 0 0.5rem !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .nav-tabs::-webkit-scrollbar {
        display: none;
    }
    .nav-tabs-container {
        display: flex !important;
        flex-wrap: nowrap !important;
        min-width: max-content;
        gap: 0.25rem !important;
    }
    .nav-tab {
        padding: 0.65rem 0.85rem !important;
        font-size: 0.82rem !important;
        white-space: nowrap;
    }

    /* Layout de Dispositivos (De 2 columnas a 1 columna vertical) */
    .devices-split-view {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.75rem !important;
        min-height: auto !important;
    }

    /* Sidebar de Sedes colapsable en móvil */
    .mobile-sidebar-toggle-btn {
        display: inline-flex !important;
    }
    .sidebar-groups {
        border-radius: var(--radius-md);
        box-shadow: var(--shadow-sm);
    }
    .sidebar-header {
        padding: 0.65rem 0.85rem !important;
        cursor: pointer;
    }
    .sidebar-title {
        margin-bottom: 0 !important;
        font-size: 0.875rem !important;
    }
    /* Oculto por defecto en móvil, se despliega con toggle */
    .sidebar-groups:not(.expanded) .sidebar-search,
    .sidebar-groups:not(.expanded) .groups-tree-container {
        display: none !important;
    }
    .sidebar-groups.expanded .sidebar-search {
        display: block !important;
        margin-top: 0.6rem;
    }
    .sidebar-groups.expanded .groups-tree-container {
        display: block !important;
        max-height: 280px;
        overflow-y: auto;
    }

    /* Fleet Toolbar en móvil */
    .fleet-toolbar {
        padding: 0.75rem !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.6rem !important;
    }
    .toolbar-left {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: baseline;
    }
    .view-title {
        font-size: 1rem !important;
    }
    .toolbar-right {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 0.45rem !important;
        width: 100% !important;
    }
    .search-input-box {
        grid-column: 1 / -1 !important;
        width: 100% !important;
    }
    .search-input-box input {
        width: 100% !important;
        height: 38px !important;
        font-size: 0.85rem !important;
    }
    .custom-select {
        height: 38px !important;
        font-size: 0.8rem !important;
    }
    #btn-refresh-fleet,
    #btn-open-monitoring-modal,
    #btn-add-printer {
        height: 38px !important;
        font-size: 0.8rem !important;
        padding: 0 0.5rem !important;
        justify-content: center !important;
        white-space: nowrap;
    }

    /* Pista y contenedor con scroll horizontal para la tabla */
    .mobile-table-hint {
        display: block !important;
    }
    .table-card {
        border-radius: var(--radius-md) !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        margin: 0 !important;
        width: 100% !important;
    }
    .kyocera-table {
        min-width: 680px !important; /* Asegura legibilidad total en scroll horizontal */
    }
    .kyocera-table th,
    .kyocera-table td {
        padding: 0.45rem 0.55rem !important;
        font-size: 0.8rem !important;
    }

    /* Grillas del Dashboard en móvil */
    .kpi-grid,
    .metrics-grid,
    .stats-row,
    .chart-container,
    .charts-grid {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }

    /* Tarjetas de Clientes & Sedes */
    .clients-grid {
        grid-template-columns: 1fr !important;
    }

    /* Modales en móvil */
    .modal-content,
    .kyocera-modal-card,
    .client-modal-compact {
        width: 95vw !important;
        max-width: 95vw !important;
        max-height: 90vh !important;
        margin: auto !important;
        padding: 1rem !important;
        overflow-y: auto !important;
    }
    .modal-body-two-cols {
        grid-template-columns: 1fr !important;
    }
    .modal-tabs {
        overflow-x: auto !important;
        white-space: nowrap !important;
    }
}

/* SMARTPHONES PEQUEÑOS (< 500px) */
@media (max-width: 500px) {
    .toolbar-right {
        grid-template-columns: 1fr !important;
    }
    .toolbar-right > * {
        grid-column: 1 / -1 !important;
    }
}

/* ==========================================================================
   MENÚ CONTEXTUAL Y ACCIONES DEL AGENTE (MÁS FUNCIONES)
   ========================================================================== */
.context-menu {
    position: fixed;
    z-index: 10000;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    min-width: 250px;
    padding: 0.35rem;
    animation: fadeInContextMenu 0.15s ease-out;
}

@keyframes fadeInContextMenu {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

.context-menu-header {
    padding: 0.5rem 0.75rem 0.35rem;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #f1f5f9;
    margin-bottom: 0.25rem;
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color 0.12s, color 0.12s;
    user-select: none;
}

.context-menu-item:hover {
    background-color: #f1f5f9;
    color: var(--primary);
}

.context-menu-item.danger:hover {
    background-color: var(--danger-bg);
    color: var(--danger);
}

.context-menu-divider {
    height: 1px;
    background-color: var(--border);
    margin: 0.3rem 0;
}

.btn-actions-menu {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-actions-menu:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

/* ==========================================================================
   SEGUIMIENTO EN VIVO DE COMANDOS REMOTOS (STEPPER & CONSOLA)
   ========================================================================== */
.cmd-stepper-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    margin: 1.25rem 0 1.5rem 0;
    padding: 0 0.5rem;
}

.cmd-stepper-container::before {
    content: '';
    position: absolute;
    top: 18px;
    left: 40px;
    right: 40px;
    height: 3px;
    background: #e2e8f0;
    z-index: 1;
}

.cmd-stepper-progress {
    position: absolute;
    top: 18px;
    left: 40px;
    height: 3px;
    background: #2563eb;
    z-index: 2;
    transition: width 0.4s ease;
    width: 0%;
}

.cmd-step-item {
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 80px;
}

.cmd-step-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: #64748b;
    transition: all 0.3s ease;
}

.cmd-step-item.active .cmd-step-circle {
    border-color: #2563eb;
    background: #2563eb;
    color: #ffffff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.2);
}

.cmd-step-item.completed .cmd-step-circle {
    border-color: #10b981;
    background: #10b981;
    color: #ffffff;
}

.cmd-step-item.failed .cmd-step-circle {
    border-color: #ef4444;
    background: #ef4444;
    color: #ffffff;
}

.cmd-step-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: #64748b;
    margin-top: 0.4rem;
    line-height: 1.2;
}

.cmd-step-item.active .cmd-step-label {
    color: #2563eb;
    font-weight: 700;
}

.cmd-step-item.completed .cmd-step-label {
    color: #059669;
}

.cmd-step-item.failed .cmd-step-label {
    color: #dc2626;
}

.cmd-terminal-box {
    background: #0f172a;
    color: #38bdf8;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.78rem;
    padding: 0.85rem;
    border-radius: 6px;
    border: 1px solid #1e293b;
    max-height: 180px;
    overflow-y: auto;
    white-space: pre-wrap;
    line-height: 1.45;
    word-break: break-all;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   ESTILOS DE NUEVOS DESCUBRIMIENTOS & PERFIL DE USUARIO
   ========================================================================== */
.user-profile {
    transition: all 0.2s ease;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
}
.user-profile:hover {
    background: rgba(37, 99, 235, 0.08);
}

.badge-new-discovery {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 6px;
    background: linear-gradient(135deg, rgba(147, 51, 234, 0.15) 0%, rgba(79, 70, 229, 0.15) 100%);
    border: 1px solid rgba(147, 51, 234, 0.35);
    color: #7e22ce;
    font-size: 0.68rem;
    font-weight: 700;
    border-radius: 4px;
    letter-spacing: 0.02em;
    animation: pulseNew 2.5s infinite;
}

@keyframes pulseNew {
    0% { transform: scale(1); opacity: 0.9; }
    50% { transform: scale(1.04); opacity: 1; box-shadow: 0 0 8px rgba(147, 51, 234, 0.3); }
    100% { transform: scale(1); opacity: 0.9; }
}

.btn-sm-action-approve {
    background: #10b981;
    color: #ffffff;
    border: 1px solid #059669;
    border-radius: var(--radius-sm);
    padding: 3px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}
.btn-sm-action-approve:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.25);
}

.btn-sm-action-reject {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-sm);
    padding: 3px 7px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s ease;
}
.btn-sm-action-reject:hover {
    background: #dc2626;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.25);
}

/* ==========================================================================
   MEJORAS RESPONSIVAS & ERGONOMÍA VISUAL (PANTALLAS CHICAS / LAPTOPS)
   ========================================================================== */

/* Botón colapsar Sedes en Desktop / Laptop */
.desktop-sidebar-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.2rem 0.45rem;
    font-size: 0.75rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    margin-left: auto;
}
.desktop-sidebar-toggle-btn:hover {
    background: #f1f5f9;
    color: var(--text-primary);
    border-color: #94a3b8;
}

.devices-split-view.sidebar-collapsed {
    grid-template-columns: 48px 1fr !important;
}
.devices-split-view.sidebar-collapsed .sidebar-groups .sidebar-search,
.devices-split-view.sidebar-collapsed .sidebar-groups .groups-tree-container,
.devices-split-view.sidebar-collapsed .sidebar-groups .sidebar-title {
    display: none !important;
}
.devices-split-view.sidebar-collapsed .sidebar-groups .sidebar-header {
    padding: 0.65rem 0.35rem !important;
    display: flex;
    justify-content: center;
}

/* Tabla de equipos con scroll horizontal fluido y columnas que no se deforman */
.table-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    box-shadow: var(--shadow-sm);
    width: 100%;
}
.kyocera-table {
    width: 100%;
    min-width: 980px !important; /* Evita que las 10 columnas se apretujen en laptops */
    border-collapse: collapse;
    text-align: left;
}

/* Ficha de Equipo Modal: Altura estable en todas las pestañas (sin encogimiento ni saltos) */
#device-detail-modal .modal-card {
    max-width: 980px !important;
    width: 95% !important;
    min-height: 640px !important;
    max-height: 92vh !important;
    display: flex !important;
    flex-direction: column !important;
}
#device-detail-modal .modal-body {
    overflow-y: auto !important;
    flex: 1 1 auto !important;
    min-height: 500px !important;
    max-height: calc(92vh - 135px) !important;
    padding: 0.9rem 1.25rem !important;
}
#device-detail-modal .modal-tab-content {
    min-height: 480px;
}

/* Modal Descarga de Agente: Diseño Panorámico y Responsive */
#agent-download-modal .modal-card {
    max-width: 960px !important;
    width: 95% !important;
    max-height: 92vh !important;
    display: flex !important;
    flex-direction: column !important;
}
#agent-download-modal .modal-body {
    overflow-y: auto !important;
    max-height: calc(92vh - 130px) !important;
}
@media (max-width: 820px) {
    #agent-download-modal .modal-card {
        width: 98% !important;
        max-height: 96vh !important;
    }
}
#device-detail-modal .device-spec-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 0.5rem !important;
}
@media (max-width: 1024px) {
    #device-detail-modal .device-spec-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}
@media (max-width: 640px) {
    #device-detail-modal .device-spec-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}
#device-detail-modal .spec-group {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.45rem 0.65rem !important;
    display: flex;
    flex-direction: column;
}
#device-detail-modal .spec-label {
    font-size: 0.68rem !important;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.15rem;
}
#device-detail-modal .spec-value {
    font-size: 0.825rem !important;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-word;
}
#device-detail-modal .modal-footer {
    flex-shrink: 0 !important;
    padding: 0.65rem 1.25rem !important;
    background: #ffffff !important;
    border-top: 1px solid var(--border) !important;
}

/* Botón sutil para Gestionar Cliente (elimina el saturado botón azul repetido 12 veces) */
.btn-subtle-manage {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    color: #334155;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.28rem 0.65rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.btn-subtle-manage:hover {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #1d4ed8;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.12);
}

/* ==========================================================================
   CENTRO DE NOTIFICACIONES Y ALERTAS (DESKLY MODERN)
   ========================================================================== */
.notif-filter-chip {
    background: #ffffff;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.45rem 0.9rem;
    border-radius: 20px;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.notif-filter-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #eff6ff;
}
.notif-filter-chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.notif-card {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    padding: 0.38rem 0.85rem;
    margin-bottom: 0.35rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.15s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    position: relative;
    min-height: 38px;
}
.notif-card:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--border-hover);
    background: #fbfcfe;
}
.notif-card.notif-unread {
    background: #f8faff;
    border-left: 3.5px solid var(--primary);
}
.notif-card.notif-severity-danger {
    border-left: 3.5px solid var(--danger);
}
.notif-card.notif-severity-warn {
    border-left: 3.5px solid var(--warning);
}
.notif-card.notif-severity-info {
    border-left: 3.5px solid #3b82f6;
}
.notif-card.notif-resolved {
    opacity: 0.65;
    background: #fafafa;
    border-left: 3.5px solid #94a3b8;
}

.notif-main-line {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    font-size: 0.8rem;
    min-width: 0;
}
.notif-title-bold {
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.825rem;
    flex-shrink: 0;
}
.notif-badge-tag {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 10px;
    white-space: nowrap;
    flex-shrink: 0;
}
.notif-badge-client {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 1.5px 7px;
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.08);
}
.notif-meta-inline {
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.775rem;
}
.notif-time-inline {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}
.notif-actions {
    display: flex;
    gap: 0.35rem;
    align-items: center;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .notif-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.45rem;
        padding: 0.55rem 0.75rem;
    }
    .notif-main-line {
        flex-wrap: wrap;
        white-space: normal;
    }
    .notif-meta-inline {
        white-space: normal;
    }
    .notif-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* ==========================================================================
   PÍLDORAS DE ATENCIÓN RÁPIDA (DISPOSITIVOS & FLOTA)
   ========================================================================== */
.pill-filter-btn {
    border-radius: 20px;
    padding: 0.28rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.16s ease;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    outline: none;
    user-select: none;
}
.pill-filter-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.pill-filter-btn:active {
    transform: translateY(0);
}
.pill-filter-btn#pill-filter-anomaly {
    background: #fdf2f8;
    border-color: #fbcfe8;
    color: #be185d;
}
.pill-filter-btn#pill-filter-anomaly.active {
    background: #be185d !important;
    border-color: #be185d !important;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(190, 24, 93, 0.4) !important;
}
.pill-filter-btn#pill-filter-all {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #334155;
}
.pill-filter-btn#pill-filter-all.active {
    background: #334155 !important;
    border-color: #334155 !important;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(51, 65, 85, 0.4) !important;
}
.pill-filter-btn#pill-filter-online {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #15803d;
}
.pill-filter-btn#pill-filter-online.active {
    background: #16a34a !important;
    border-color: #16a34a !important;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.4) !important;
}
.pill-filter-btn#pill-filter-error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #dc2626;
}
.pill-filter-btn#pill-filter-error.active {
    background: #dc2626 !important;
    border-color: #dc2626 !important;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.4) !important;
}
.pill-filter-btn#pill-filter-supplies,
.pill-filter-btn#pill-filter-toner,
.pill-filter-btn#pill-filter-restock {
    background: #fffbeb;
    border-color: #fde68a;
    color: #b45309;
}
.pill-filter-btn#pill-filter-supplies.active,
.pill-filter-btn#pill-filter-toner.active,
.pill-filter-btn#pill-filter-restock.active {
    background: #d97706 !important;
    border-color: #d97706 !important;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.4) !important;
}
.pill-filter-btn#pill-filter-kit {
    background: #fffbeb;
    border-color: #fde68a;
    color: #b45309;
}
.pill-filter-btn#pill-filter-kit.active {
    background: #d97706 !important;
    border-color: #d97706 !important;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.4) !important;
}
.pill-filter-btn#pill-filter-offline {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #1e293b;
}
.pill-filter-btn#pill-filter-offline.active {
    background: #0f172a !important;
    border-color: #0f172a !important;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.4) !important;
}
.pill-filter-btn#pill-filter-new {
    background: #faf5ff;
    border-color: #e9d5ff;
    color: #9333ea;
}
.pill-filter-btn#pill-filter-new.active {
    background: #9333ea !important;
    border-color: #9333ea !important;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(147, 51, 234, 0.4) !important;
}

/* ==========================================================================
   BARRA DE TRANSPARENCIA DE FILTROS ACTIVOS (CHIPS)
   ========================================================================== */
.fleet-active-filters-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.6rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-left: 3.5px solid #2563eb;
    border-radius: 8px;
    padding: 0.45rem 0.85rem;
    margin: 0.5rem 0 0.85rem 0;
    font-size: 0.8rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
    animation: fadeInFilters 0.18s ease-in-out;
}

@keyframes fadeInFilters {
    from { opacity: 0; transform: translateY(-3px); }
    to { opacity: 1; transform: translateY(0); }
}

.active-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.55rem;
    border-radius: 12px;
    font-size: 0.74rem;
    font-weight: 500;
    line-height: 1.3;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #334155;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.active-filter-chip.chip-brand {
    background: #f0fdfa;
    border-color: #99f6e4;
    color: #0f766e;
}

.active-filter-chip.chip-attention {
    background: #fff7ed;
    border-color: #fed7aa;
    color: #c2410c;
}

.active-filter-chip.chip-group {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
}

.active-filter-chip.chip-status {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #334155;
}

.active-filter-chip.chip-query {
    background: #fefce8;
    border-color: #fef08a;
    color: #854d0e;
}

.active-filter-chip .chip-remove {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.72rem;
    line-height: 1;
    padding: 0;
    margin-left: 2px;
    color: #94a3b8;
    transition: color 0.15s ease, transform 0.1s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.active-filter-chip .chip-remove:hover {
    color: #ef4444;
    transform: scale(1.15);
}

.btn-clear-all-filters {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    transition: background 0.15s;
}

.btn-clear-all-filters:hover {
    background: #fee2e2;
}

/* ==========================================================================
   BARRA FLOTANTE DE ACCIONES MASIVAS (BULK BAR)
   ========================================================================== */
.fleet-bulk-bar {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    color: #ffffff;
    padding: 0.6rem 1.25rem;
    border-radius: 50px;
    box-shadow: 0 12px 30px -5px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 100000;
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: none;
    align-items: center;
    gap: 0.85rem;
    pointer-events: auto;
    animation: slideUpBulk 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.fleet-bulk-bar.visible {
    display: flex !important;
}

@keyframes slideUpBulk {
    from {
        opacity: 0;
        transform: translate(-50%, 20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

.bulk-bar-content {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.bulk-bar-badge {
    background: #2563eb;
    color: #ffffff;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.3rem 0.65rem;
    border-radius: 20px;
    letter-spacing: 0.02em;
}

.bulk-bar-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.btn-bulk-action {
    background: rgba(255, 255, 255, 0.1);
    color: #f8fafc;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 0.35rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: all 0.15s ease;
}

.btn-bulk-action:hover {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.35);
}

.btn-bulk-danger {
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.4);
}

.btn-bulk-danger:hover {
    background: rgba(239, 68, 68, 0.25);
    color: #fca5a5;
    border-color: #ef4444;
}

.btn-bulk-close {
    background: transparent;
    color: #94a3b8;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.2rem 0.45rem;
    border-radius: 50%;
    transition: color 0.15s ease;
}

.btn-bulk-close:hover {
    color: #ffffff;
}

/* ==========================================================================
   PESTAÑAS DE PAPELERA & MODALES UNIFICADOS
   ========================================================================== */
.modal-tab-btn {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.5rem 0.85rem;
    font-size: 0.825rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.modal-tab-btn:hover {
    color: var(--text-primary);
}

.modal-tab-btn.active {
    color: var(--primary, #2563eb);
    border-bottom-color: var(--primary, #2563eb);
}

/* ==========================================================================
   ESTILOS DE IMPRESIÓN Y REPORTE CORPORATIVO EN NAVEGADOR
   ========================================================================== */
@media print {
    @page {
        size: landscape;
        margin: 8mm;
    }
    body {
        background: #ffffff !important;
        color: #000000 !important;
        font-size: 8pt !important;
    }
    body * {
        visibility: hidden;
    }
    #printable-report-area, #printable-report-area * {
        visibility: visible;
    }
    #printable-report-area {
        position: absolute;
        left: 0;
        top: 0;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
        border: 1px solid #cbd5e1 !important;
        background: #ffffff !important;
    }
    #printable-report-area div[style*="overflow-x:auto"] {
        overflow: visible !important;
    }
    #report-preview-table {
        width: 100% !important;
        border-collapse: collapse !important;
        font-size: 7.5pt !important;
    }
    #report-preview-table th, #report-preview-table td {
        border: 1px solid #cbd5e1 !important;
        padding: 4px 6px !important;
        color: #0f172a !important;
    }
    #report-preview-table thead th {
        background-color: #1e3a8a !important;
        color: #ffffff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .topbar, .nav-tabs, .sidebar-groups, .fleet-toolbar, .fleet-header-bar, .fleet-filter-bar,
    .fleet-pagination-bar, .priority-pills-bar,
    .report-filters-bar, .section-actions, #fleet-bulk-bar, .modal-backdrop,
    #report-table-search {
        display: none !important;
    }
}

/* ==========================================================================
   RESPONSIVE DESIGN ADAPTATIONS FOR TABLET & LAPTOP
   ========================================================================== */
@media (max-width: 1024px) {
    .topbar {
        padding: 0.6rem 1rem;
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    .topbar-left, .topbar-right {
        gap: 0.5rem;
    }
    .nav-tabs-container {
        overflow-x: auto;
        white-space: nowrap;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    .nav-tabs-container::-webkit-scrollbar {
        display: none;
    }
    .stats-cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
    .fleet-toolbar {
        flex-wrap: wrap;
        gap: 0.6rem;
    }
    .table-responsive-container,
    .devices-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 768px) {
    .user-meta {
        display: none;
    }
    .topbar-left .tenant-pill {
        max-width: 140px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* ==========================================================================
   DISPOSITIVOS — LAYOUT ESCALABLE FULL-WIDTH (500+ CLIENTES / 1000+ EQUIPOS)
   ========================================================================== */
.devices-full-view {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
}

.fleet-view-pane {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 0;
}

/* Fila 1: Header + Breadcrumb + Switcher de vista + Acciones */
.fleet-header-bar {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.75rem 1.1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
    box-shadow: var(--shadow-sm);
}

.fleet-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.15rem;
    flex-wrap: wrap;
}

.fleet-breadcrumb button {
    background: transparent;
    border: none;
    padding: 0;
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
}

.fleet-breadcrumb button:hover {
    text-decoration: underline;
}

.fleet-breadcrumb .bc-sep {
    color: #94a3b8;
}

.fleet-breadcrumb .bc-current {
    color: var(--text-secondary);
    font-weight: 600;
}

.fleet-title-row {
    display: flex;
    align-items: baseline;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.fleet-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Segmented Control: Equipos | Por Cliente */
.fleet-view-switcher {
    display: inline-flex;
    align-items: center;
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 3px;
    gap: 2px;
}

.view-switch-btn {
    background: transparent;
    border: none;
    border-radius: 6px;
    padding: 0.38rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.view-switch-btn:hover {
    color: var(--text-primary);
}

.view-switch-btn.active {
    background: #ffffff;
    color: var(--primary);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
}

.view-switch-count {
    font-size: 0.7rem;
    font-weight: 700;
    background: #e2e8f0;
    color: #475569;
    padding: 0.08rem 0.42rem;
    border-radius: 999px;
}

.view-switch-btn.active .view-switch-count {
    background: #dbeafe;
    color: #1d4ed8;
}

.fleet-global-buttons {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Fila 2: Barra Unificada de Filtros */
.fleet-filter-bar {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.65rem 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    box-shadow: var(--shadow-sm);
}

.fleet-search-grow {
    flex: 1 1 230px;
    min-width: 190px;
}

.fleet-search-grow input {
    width: 100% !important;
}

.btn-group-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
}

.btn-group-toggle.active {
    background: #eff6ff;
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

/* ==========================================================================
   COMBOBOX INTELIGENTE DE CLIENTE / SEDE
   ========================================================================== */
.client-combobox {
    position: relative;
    flex: 0 1 285px;
    min-width: 220px;
}

.client-combobox-trigger {
    width: 100%;
    height: 36px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 0.65rem;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.8125rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
    text-align: left;
}

.client-combobox-trigger:hover {
    border-color: #94a3b8;
    background: #f8fafc;
}

.client-combobox.open .client-combobox-trigger,
.client-combobox-trigger.has-selection {
    border-color: var(--primary);
    background: #eff6ff;
}

.client-combobox.open .client-combobox-trigger {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.combobox-icon {
    font-size: 0.9rem;
    flex-shrink: 0;
}

.combobox-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

.combobox-count-badge {
    background: #e2e8f0;
    color: #334155;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    flex-shrink: 0;
}

.client-combobox-trigger.has-selection .combobox-count-badge {
    background: #2563eb;
    color: #ffffff;
}

.combobox-clear-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 0.68rem;
    font-weight: 700;
    color: #1d4ed8;
    background: rgba(37, 99, 235, 0.15);
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}

.combobox-clear-btn:hover {
    background: #dc2626;
    color: #ffffff;
}

.combobox-caret {
    font-size: 0.72rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* Panel desplegable del Combobox */
.client-combobox-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 400px;
    max-width: calc(100vw - 2rem);
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    box-shadow: 0 18px 40px -10px rgba(15, 23, 42, 0.22), 0 4px 12px rgba(15, 23, 42, 0.08);
    z-index: 1200;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.combobox-search-wrap {
    padding: 0.65rem 0.75rem 0.5rem;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    position: relative;
    display: flex;
    align-items: center;
}

.combobox-search-wrap input {
    width: 100%;
    padding: 0.48rem 2.6rem 0.48rem 0.7rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.82rem;
    outline: none;
    background: #ffffff;
    color: var(--text-primary);
}

.combobox-search-wrap input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.combobox-kbd-hint {
    position: absolute;
    right: 1.15rem;
    font-size: 0.62rem;
    font-weight: 700;
    color: #94a3b8;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    pointer-events: none;
}

.combobox-controls-row {
    padding: 0.45rem 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    background: #f8fafc;
    border-bottom: 1px solid #eef2f7;
}

.combobox-mode-pills {
    display: flex;
    gap: 0.3rem;
}

.cb-mini-pill {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.2rem 0.55rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}

.cb-mini-pill.active {
    background: #1e293b;
    border-color: #1e293b;
    color: #ffffff;
}

.cb-mini-select {
    font-size: 0.72rem;
    padding: 0.2rem 0.45rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #ffffff;
    color: var(--text-secondary);
    cursor: pointer;
    outline: none;
}

.combobox-hide-empty-row {
    padding: 0.38rem 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    font-size: 0.73rem;
    color: var(--text-secondary);
}

.cb-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    user-select: none;
}

.cb-stats-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
}

.combobox-scroll-area {
    max-height: 360px;
    overflow-y: auto;
    padding: 0.35rem 0;
}

.cb-section-label {
    padding: 0.35rem 0.85rem 0.2rem;
    font-size: 0.67rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
}

.cb-option {
    padding: 0.45rem 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    cursor: pointer;
    transition: background 0.12s;
    border-left: 3px solid transparent;
}

.cb-option:hover {
    background: #f1f5f9;
}

.cb-option.active {
    background: #eff6ff;
    border-left-color: var(--primary);
}

.cb-option-all {
    border-bottom: 1px solid #f1f5f9;
    margin-bottom: 0.2rem;
}

.cb-option-main {
    display: flex;
    align-items: center;
    gap: 0.42rem;
    min-width: 0;
    flex: 1;
}

.cb-expand-btn {
    width: 18px;
    height: 18px;
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 0.72rem;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cb-expand-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.cb-option-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cb-option-meta {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-shrink: 0;
}

.cb-health-dot {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.08rem 0.35rem;
    border-radius: 999px;
    line-height: 1.25;
}

.cb-dot-error {
    background: #fee2e2;
    color: #b91c1c;
}

.cb-dot-warn {
    background: #fef3c7;
    color: #b45309;
}

.cb-dot-offline {
    background: #e2e8f0;
    color: #334155;
}

.cb-sites-sublist {
    background: #f8fafc;
    border-bottom: 1px solid #eef2f7;
}

.cb-site-option {
    padding: 0.36rem 0.85rem 0.36rem 2.2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    cursor: pointer;
    font-size: 0.78rem;
    color: var(--text-secondary);
    border-left: 3px solid transparent;
}

.cb-site-option:hover {
    background: #e2e8f0;
    color: var(--text-primary);
}

.cb-site-option.active {
    background: #dbeafe;
    color: #1d4ed8;
    font-weight: 600;
    border-left-color: var(--primary);
}

.cb-show-more-btn {
    width: calc(100% - 1.5rem);
    margin: 0.4rem 0.75rem;
    padding: 0.42rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--primary);
    background: #eff6ff;
    border: 1px dashed #93c5fd;
    border-radius: 6px;
    cursor: pointer;
}

.cb-show-more-btn:hover {
    background: #dbeafe;
}

/* ==========================================================================
   TABLA COMPACTA ORDENABLE + COLUMNA ACCIONES STICKY + AGRUPACIÓN + PAGINACIÓN
   ========================================================================== */
.fleet-table-card {
    position: relative;
}

.kyocera-table-compact {
    min-width: 920px !important;
}

.kyocera-table-compact th {
    padding: 0.5rem 0.6rem;
    white-space: nowrap;
}

.kyocera-table-compact td {
    padding: 0.42rem 0.6rem;
}

.sortable-th {
    cursor: pointer;
    user-select: none;
    transition: background 0.12s, color 0.12s;
}

.sortable-th:hover {
    background: #eef2f7 !important;
    color: var(--primary) !important;
}

.sortable-th.sort-active {
    color: var(--primary) !important;
}

.sort-indicator {
    font-size: 0.68rem;
    margin-left: 2px;
    opacity: 0.7;
}

/* Ocultar columna Cliente/Sede cuando ya se filtró una sede específica */
#fleet-printers-table.hide-client-col .col-client-site {
    display: none;
}

/* Columna Acciones fija a la derecha en pantallas medianas */
.kyocera-table-compact th.sticky-actions-col,
.kyocera-table-compact td.sticky-actions-col {
    position: sticky;
    right: 0;
    z-index: 2;
    box-shadow: -4px 0 8px -4px rgba(15, 23, 42, 0.08);
}

.kyocera-table-compact th.sticky-actions-col {
    background: #f8fafc;
    z-index: 3;
}

.kyocera-table-compact td.sticky-actions-col {
    background: #ffffff;
}

.kyocera-table-compact tbody tr:hover td.sticky-actions-col {
    background: #f8fafc;
}

/* Celda Última Sync compacta */
.sync-cell-compact {
    display: inline-flex;
    flex-direction: column;
    gap: 1px;
    line-height: 1.2;
    white-space: nowrap;
}

.sync-primary {
    font-size: 0.76rem;
    font-weight: 600;
}

.sync-primary.sync-ok {
    color: #059669;
}

.sync-primary.sync-off {
    color: #dc2626;
}

.sync-secondary {
    font-size: 0.67rem;
    color: var(--text-muted);
}

/* Filas de cabecera de grupo (cuando Agrupar por cliente está activo) */
.fleet-group-header-row {
    background: #f1f5f9 !important;
    cursor: pointer;
}

.fleet-group-header-row:hover {
    background: #e2e8f0 !important;
}

.fleet-group-header-row td {
    padding: 0.45rem 0.75rem !important;
    border-top: 1px solid #cbd5e1;
    border-bottom: 1px solid #cbd5e1;
}

.fleet-group-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.fleet-group-header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 0.82rem;
    color: #0f172a;
}

.fleet-group-header-badges {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.fleet-group-focus-btn {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    padding: 0.16rem 0.5rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
}

.fleet-group-focus-btn:hover {
    background: #eff6ff;
    border-color: var(--primary);
}

/* Barra de paginación */
.fleet-pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.65rem 1rem;
    background: #f8fafc;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.pagination-info {
    font-weight: 500;
}

.pagination-right {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.pagination-size-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.pagination-size-select {
    padding: 0.22rem 0.45rem;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: #ffffff;
    font-size: 0.78rem;
    color: var(--text-primary);
    cursor: pointer;
}

.pagination-controls {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.pg-btn {
    min-width: 28px;
    height: 28px;
    padding: 0 0.48rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #ffffff;
    color: var(--text-primary);
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.12s;
}

.pg-btn:hover:not(:disabled) {
    background: #eff6ff;
    border-color: var(--primary);
    color: var(--primary);
}

.pg-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

.pg-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.pg-ellipsis {
    padding: 0 0.25rem;
    color: #94a3b8;
    font-size: 0.78rem;
}

/* ==========================================================================
   VISTA 2: MAPA DE SALUD POR CLIENTE (500+ CLIENTES)
   ========================================================================== */
.clients-health-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
    gap: 0.65rem;
}

.ch-kpi-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.7rem 0.9rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: border-color 0.15s, transform 0.12s;
}

.ch-kpi-card:hover {
    border-color: #94a3b8;
    transform: translateY(-1px);
}

.ch-kpi-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.ch-kpi-value {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.15;
    margin-top: 2px;
}

.ch-kpi-icon {
    font-size: 1.35rem;
    opacity: 0.9;
}

.clients-health-toolbar {
    justify-content: space-between;
}

.clients-health-filter-pills {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.clients-health-table {
    min-width: 760px !important;
}

.health-bar-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.health-progress-bar {
    height: 6px;
    width: 100%;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
    display: flex;
}

.health-seg-online { background: #10b981; }
.health-seg-warn { background: #f59e0b; }
.health-seg-error { background: #ef4444; }
.health-seg-offline { background: #64748b; }

.health-badges-row {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.health-mini-btn {
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 0.1rem 0.45rem;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    transition: filter 0.12s;
}

.health-mini-btn:hover {
    filter: brightness(0.94);
}

.hmb-online { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.hmb-error { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.hmb-supplies { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.hmb-offline { background: #f1f5f9; color: #334155; border-color: #cbd5e1; }

.ch-sites-tags {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
    margin-top: 3px;
}

.ch-site-tag {
    font-size: 0.68rem;
    color: #475569;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 0.06rem 0.38rem;
    cursor: pointer;
}

.ch-site-tag:hover {
    background: #dbeafe;
    border-color: #93c5fd;
    color: #1d4ed8;
}

@media (max-width: 900px) {
    .fleet-header-bar {
        padding: 0.7rem 0.85rem;
    }
    .fleet-header-actions {
        width: 100%;
        justify-content: space-between;
    }
    .fleet-filter-bar {
        padding: 0.65rem;
    }
    .client-combobox {
        flex: 1 1 100%;
        min-width: 100%;
    }
    .client-combobox-dropdown {
        width: 100%;
    }
    .btn-group-toggle {
        flex: 1 1 auto;
        justify-content: center;
    }
    .kyocera-table-compact th.sticky-actions-col,
    .kyocera-table-compact td.sticky-actions-col {
        position: static;
        box-shadow: none;
    }
}




