/* ==========================================================================
   PRINTMONITOR MÓVIL (PWA TÉCNICOS)
   Soporte Completo Modo Claro Deskly SaaS (Por Defecto) & Modo Oscuro
   ========================================================================== */

:root,
[data-theme="light"] {
    --bg-main: #f8fafc;
    --bg-header: rgba(255, 255, 255, 0.94);
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --bg-input: #ffffff;
    --border: #e2e8f0;
    --border-hover: #cbd5e1;
    
    --primary: #2563eb;
    --primary-gradient: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    --primary-glow: rgba(37, 99, 235, 0.2);
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    
    --success: #10b981;
    --success-bg: #d1fae5;
    --success-text: #065f46;
    --warning: #f59e0b;
    --warning-bg: #fef3c7;
    --warning-text: #92400e;
    --danger: #ef4444;
    --danger-bg: #fee2e2;
    --danger-text: #991b1b;
    
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.25rem;
    --radius-pill: 9999px;
    
    --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.06), 0 1px 2px -1px rgba(0, 0, 0, 0.06);
    --shadow-sheet: 0 -10px 40px rgba(0, 0, 0, 0.15);
    
    --bg-gauge: #f8fafc;
    --track-bg: #e2e8f0;
    --sheet-bg: #ffffff;
    --sheet-border: #e2e8f0;
    --sheet-tabs-bg: #f8fafc;
    
    --btn-header-bg: #f1f5f9;
    --btn-header-text: #475569;
    --pill-bg: #ffffff;
    --pill-border: #e2e8f0;
    --pill-text: #475569;
    
    --meta-chip-bg: #f8fafc;
    --meta-chip-border: #e2e8f0;
    --meta-chip-text: #334155;
    --meta-chip-strong: #0f172a;
    
    --serial-chip-bg: #eff6ff;
    --serial-chip-border: #bfdbfe;
    --serial-chip-text: #1d4ed8;
    
    --brand-tag-bg: #eff6ff;
    --brand-tag-border: #bfdbfe;
    --brand-tag-text: #1d4ed8;
    
    --toast-bg: #ffffff;
    --toast-text: #0f172a;
    --toast-border: #e2e8f0;
    --toast-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    --bg-main: #090d16;
    --bg-header: rgba(15, 23, 42, 0.88);
    --bg-card: #111a2e;
    --bg-card-hover: #15223a;
    --bg-input: rgba(15, 23, 42, 0.75);
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(59, 130, 246, 0.4);
    
    --primary: #3b82f6;
    --primary-gradient: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    --primary-glow: rgba(37, 99, 235, 0.28);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.12);
    --success-text: #6ee7b7;
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.12);
    --warning-text: #fde68a;
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.12);
    --danger-text: #fca5a5;
    
    --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.35);
    --shadow-sheet: 0 -10px 40px rgba(0, 0, 0, 0.6);
    
    --bg-gauge: rgba(0, 0, 0, 0.25);
    --track-bg: rgba(255, 255, 255, 0.08);
    --sheet-bg: #111827;
    --sheet-border: rgba(255, 255, 255, 0.12);
    --sheet-tabs-bg: rgba(0, 0, 0, 0.15);
    
    --btn-header-bg: rgba(255, 255, 255, 0.05);
    --btn-header-text: #94a3b8;
    --pill-bg: rgba(255, 255, 255, 0.04);
    --pill-border: rgba(255, 255, 255, 0.08);
    --pill-text: #94a3b8;
    
    --meta-chip-bg: rgba(255, 255, 255, 0.04);
    --meta-chip-border: rgba(255, 255, 255, 0.08);
    --meta-chip-text: #94a3b8;
    --meta-chip-strong: #e2e8f0;
    
    --serial-chip-bg: rgba(59, 130, 246, 0.08);
    --serial-chip-border: rgba(59, 130, 246, 0.25);
    --serial-chip-text: #93c5fd;
    
    --brand-tag-bg: rgba(59, 130, 246, 0.15);
    --brand-tag-border: rgba(59, 130, 246, 0.25);
    --brand-tag-text: #93c5fd;
    
    --toast-bg: rgba(17, 24, 39, 0.95);
    --toast-text: #ffffff;
    --toast-border: rgba(255, 255, 255, 0.08);
    --toast-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    padding-bottom: calc(2rem + env(safe-area-inset-bottom));
    overflow-x: hidden;
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* ==========================================================================
   OFFLINE BANNER & NOTIFICATIONS
   ========================================================================== */
.offline-banner {
    background: linear-gradient(90deg, #b45309, #d97706);
    color: #ffffff;
    padding: 0.55rem 1rem;
    font-size: 0.78rem;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 60;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.offline-banner-content {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.offline-pulse-icon {
    font-size: 0.9rem;
    animation: pulse 1.8s infinite;
}

.btn-sync-pill {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-pill);
    font-size: 0.72rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.btn-sync-pill:active {
    transform: scale(0.96);
}

/* ==========================================================================
   STICKY HEADER & NAVIGATION
   ========================================================================== */
.mobile-header {
    background: var(--bg-header);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding: 0.65rem 0.75rem 0.55rem;
    position: sticky;
    top: 0;
    z-index: 45;
    transition: background 0.2s ease, border-color 0.2s ease;
    box-sizing: border-box;
    width: 100%;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
    flex-shrink: 1;
}

.brand-logo-badge {
    width: 28px;
    height: 28px;
    background: var(--primary-gradient);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 2px 8px var(--primary-glow);
    flex-shrink: 0;
}

.brand-logo-badge svg {
    width: 16px;
    height: 16px;
}

.brand-text {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    min-width: 0;
}

.brand-title {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    white-space: nowrap;
}

.brand-title strong {
    color: var(--primary);
}

.brand-tag {
    background: var(--brand-tag-bg);
    border: 1px solid var(--brand-tag-border);
    color: var(--brand-tag-text);
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.1rem 0.38rem;
    border-radius: var(--radius-pill);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    flex-shrink: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.28rem;
    flex-shrink: 0;
    margin-left: auto;
}

.net-badge {
    display: flex;
    align-items: center;
    gap: 0.28rem;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 0.2rem 0.45rem;
    border-radius: var(--radius-pill);
    border: 1px solid transparent;
    flex-shrink: 0;
    white-space: nowrap;
}

.net-badge.online {
    background: var(--success-bg);
    color: var(--success-text);
    border-color: rgba(16, 185, 129, 0.3);
}

.net-badge.offline {
    background: var(--warning-bg);
    color: var(--warning-text);
    border-color: rgba(245, 158, 11, 0.3);
}

.net-badge .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: currentColor;
    display: inline-block;
    box-shadow: 0 0 6px currentColor;
    flex-shrink: 0;
}

.btn-header-icon {
    background: var(--btn-header-bg);
    border: 1px solid var(--border);
    color: var(--btn-header-text);
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.88rem;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s, transform 0.15s;
    box-sizing: border-box;
}

.btn-header-icon:active {
    transform: scale(0.92);
}

.btn-header-icon svg {
    width: 16px;
    height: 16px;
}

.user-strip {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0.5rem 0 0.65rem;
}

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

.tech-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.tenant-name {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.pending-badge {
    background: var(--warning-bg);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: var(--warning-text);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-pill);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* ==========================================================================
   SEARCH BAR & QR SCANNER
   ========================================================================== */
.search-bar-row {
    display: flex;
    gap: 0.45rem;
    align-items: center;
    margin-bottom: 0.6rem;
}

.search-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    color: var(--text-muted);
    pointer-events: none;
}

.search-input-wrapper input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.6rem 2.2rem 0.6rem 2.2rem;
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.15s, background 0.15s;
}

.search-input-wrapper input:focus {
    border-color: var(--primary);
}

[data-theme="dark"] .search-input-wrapper input:focus {
    background: rgba(26, 36, 56, 0.9);
}

.search-input-wrapper input::placeholder {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.btn-search-clear {
    position: absolute;
    right: 0.65rem;
    background: var(--btn-header-bg);
    border: none;
    color: var(--text-muted);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 0.7rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-scan-qr {
    background: var(--brand-tag-bg);
    border: 1px solid var(--brand-tag-border);
    color: var(--brand-tag-text);
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, transform 0.15s;
}

.btn-scan-qr:active {
    background: var(--primary);
    color: #fff;
    transform: scale(0.95);
}

/* ==========================================================================
   FILTER PILLS (QUICK CHIPS)
   ========================================================================== */
.filter-pills-scroll {
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 0.15rem;
}

.filter-pills-scroll::-webkit-scrollbar {
    display: none;
}

.filter-pill {
    background: var(--pill-bg);
    border: 1px solid var(--pill-border);
    color: var(--pill-text);
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-pill);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    transition: all 0.15s ease;
}

.filter-pill .pill-count {
    background: var(--track-bg);
    color: var(--text-primary);
    padding: 0.05rem 0.35rem;
    border-radius: var(--radius-pill);
    font-size: 0.68rem;
    font-weight: 700;
}

.filter-pill.active {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1d4ed8;
}

[data-theme="dark"] .filter-pill.active {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.5);
    color: #93c5fd;
}

.filter-pill.active .pill-count {
    background: var(--primary);
    color: #ffffff;
}

.filter-pill.pill-warning.active {
    background: var(--warning-bg);
    border-color: rgba(245, 158, 11, 0.5);
    color: var(--warning-text);
}

.filter-pill.pill-danger.active {
    background: var(--danger-bg);
    border-color: rgba(239, 68, 68, 0.5);
    color: var(--danger-text);
}

.filter-pill.pill-unmonitored.active {
    background: var(--track-bg);
    border-color: var(--border);
    color: var(--text-primary);
}

.filter-client-wrapper {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.filter-client-select {
    background: var(--pill-bg);
    border: 1.5px solid var(--pill-border);
    color: var(--pill-text);
    padding: 0.35rem 1.6rem 0.35rem 0.75rem;
    border-radius: var(--radius-pill);
    font-size: 0.73rem;
    font-weight: 700;
    font-family: inherit;
    outline: none;
    max-width: 165px;
    cursor: pointer;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.55rem center;
    background-size: 10px;
    flex-shrink: 0;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.filter-client-select:focus,
.filter-client-select.has-value {
    background-color: #eff6ff;
    border-color: #3b82f6;
    color: #1d4ed8;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

[data-theme="dark"] .filter-client-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

[data-theme="dark"] .filter-client-select:focus,
[data-theme="dark"] .filter-client-select.has-value {
    background-color: rgba(59, 130, 246, 0.18);
    border-color: #60a5fa;
    color: #93c5fd;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

/* ==========================================================================
   PRINTER CARDS FEED
   ========================================================================== */
.mobile-main {
    padding: 0.85rem 1rem;
    max-width: 640px;
    margin: 0 auto;
}

.printers-feed {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.printer-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.95rem;
    position: relative;
    box-shadow: var(--shadow-card);
    transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.printer-card:active {
    transform: scale(0.985);
}

.printer-card.has-alert {
    border-color: rgba(245, 158, 11, 0.45);
}

.printer-card.is-offline {
    border-color: rgba(239, 68, 68, 0.3);
    opacity: 0.95;
}

/* Card Header */
.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.45rem;
}

.card-title-group {
    flex: 1;
    min-width: 0;
    padding-right: 0.5rem;
}

.card-brand-tag {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--brand-tag-text);
    display: block;
    margin-bottom: 0.15rem;
}

.card-model-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-location-row {
    font-size: 0.76rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-location-row strong {
    color: var(--text-primary);
    font-weight: 600;
}

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

.btn-header-test-page {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
    padding: 0.22rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.68rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
    transition: all 0.15s ease;
    line-height: 1.2;
    white-space: nowrap;
}

.btn-header-test-page:active {
    transform: scale(0.95);
    background: #dbeafe;
}

[data-theme="dark"] .btn-header-test-page {
    background: rgba(59, 130, 246, 0.16);
    border-color: rgba(96, 165, 250, 0.35);
    color: #93c5fd;
}

.btn-header-test-page.is-loading,
.btn-card-test.is-loading,
.btn-sheet-test-page.is-loading {
    opacity: 0.75;
    pointer-events: none;
    cursor: wait;
}

.btn-header-test-page.is-success,
.btn-card-test.is-success,
.btn-sheet-test-page.is-success {
    background: #ecfdf5 !important;
    border-color: #a7f3d0 !important;
    color: #065f46 !important;
}

[data-theme="dark"] .btn-header-test-page.is-success,
[data-theme="dark"] .btn-card-test.is-success,
[data-theme="dark"] .btn-sheet-test-page.is-success {
    background: rgba(16, 185, 129, 0.2) !important;
    border-color: rgba(52, 211, 153, 0.4) !important;
    color: #34d399 !important;
}

.spin-icon {
    animation: spin 0.8s linear infinite;
}

.badge-status-dot {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.22rem 0.55rem;
    border-radius: var(--radius-pill);
    white-space: nowrap;
}

.status-online { 
    background: var(--success-bg); 
    color: var(--success-text); 
    border: 1px solid rgba(16, 185, 129, 0.3); 
}

.status-warning { 
    background: var(--warning-bg); 
    color: var(--warning-text); 
    border: 1px solid rgba(245, 158, 11, 0.3); 
}

.status-error { 
    background: var(--danger-bg); 
    color: var(--danger-text); 
    border: 1px solid rgba(239, 68, 68, 0.3); 
}

.status-unmonitored {
    background: var(--pill-bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.printer-card.is-unmonitored {
    opacity: 0.88;
    border-left: 3px solid var(--text-muted);
}

/* Visual Toner Level Bar (Gauge) */
.toner-gauge-block {
    margin: 0.65rem 0 0.55rem;
    background: var(--bg-gauge);
    border-radius: var(--radius-md);
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
}

.toner-gauge-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.35rem;
    font-size: 0.74rem;
}

.toner-label {
    color: var(--text-secondary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.toner-pct-value {
    font-weight: 800;
    font-size: 0.82rem;
}

.toner-pct-value.level-high { color: #059669; }
.toner-pct-value.level-med { color: #d97706; }
.toner-pct-value.level-low { color: #dc2626; }
.toner-pct-value.level-unknown { color: var(--text-muted); }

[data-theme="dark"] .toner-pct-value.level-high { color: #34d399; }
[data-theme="dark"] .toner-pct-value.level-med { color: #fbbf24; }
[data-theme="dark"] .toner-pct-value.level-low { color: #f87171; }

.toner-track {
    width: 100%;
    height: 7px;
    background: var(--track-bg);
    border-radius: var(--radius-pill);
    overflow: hidden;
    position: relative;
}

.toner-fill {
    height: 100%;
    border-radius: var(--radius-pill);
    transition: width 0.4s ease;
}

.fill-high { background: linear-gradient(90deg, #059669, #10b981); }
.fill-med { background: linear-gradient(90deg, #d97706, #f59e0b); }
.fill-low { background: linear-gradient(90deg, #dc2626, #ef4444); }

/* Multi-toner CMYK row for color machines */
.cmyk-gauge-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.4rem;
    margin-top: 0.4rem;
}

.cmyk-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.cmyk-item-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: var(--text-muted);
}

.cmyk-item-header strong { 
    font-weight: 700; 
    color: var(--text-primary); 
}

.cmyk-track {
    height: 5px;
    background: var(--track-bg);
    border-radius: 99px;
    overflow: hidden;
}

.cmyk-fill { height: 100%; border-radius: 99px; }
.cmyk-k { background: #334155; }
[data-theme="dark"] .cmyk-k { background: #94a3b8; }
.cmyk-c { background: #06b6d4; }
.cmyk-m { background: #ec4899; }
.cmyk-y { background: #eab308; }

/* Micro Metadata Row */
.card-micro-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.75rem;
    font-size: 0.73rem;
}

.meta-chip {
    background: var(--meta-chip-bg);
    border: 1px solid var(--meta-chip-border);
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    color: var(--meta-chip-text);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.meta-chip strong {
    color: var(--meta-chip-strong);
    font-weight: 700;
}

.meta-chip.serial-chip {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    color: var(--serial-chip-text);
    border-color: var(--serial-chip-border);
    background: var(--serial-chip-bg);
    cursor: pointer;
}

.meta-chip.serial-chip:active {
    filter: brightness(0.95);
}

.autonomy-tag {
    font-size: 0.72rem;
    font-weight: 700;
    color: #0369a1;
    background: #e0f2fe;
    border: 1px solid #bae6fd;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
}

[data-theme="dark"] .autonomy-tag {
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.1);
    border-color: rgba(56, 189, 248, 0.25);
}

/* Card Action Button */
.btn-card-primary {
    width: 100%;
    background: var(--primary-gradient);
    border: none;
    color: #ffffff;
    padding: 0.65rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    cursor: pointer;
    box-shadow: 0 2px 10px var(--primary-glow);
    transition: transform 0.15s ease, filter 0.15s ease;
}

.btn-card-primary:active {
    transform: scale(0.97);
    filter: brightness(1.1);
}

/* ==========================================================================
   BOTTOM SHEET DRAWER (NATIVE MOBILE UX)
   ========================================================================== */
.sheet-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 100;
    animation: fadeIn 0.2s ease;
}

[data-theme="dark"] .sheet-backdrop {
    background: rgba(0, 0, 0, 0.75);
}

.sheet-panel {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    max-height: 88vh;
    background: var(--sheet-bg);
    border-top: 1px solid var(--sheet-border);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    box-shadow: var(--shadow-sheet);
    z-index: 101;
    display: flex;
    flex-direction: column;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    animation: slideUp 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.sheet-handle-bar {
    padding: 0.6rem 0 0.2rem;
    display: flex;
    justify-content: center;
    cursor: pointer;
}

.sheet-handle {
    width: 38px;
    height: 4px;
    background: var(--border-hover);
    border-radius: var(--radius-pill);
}

.sheet-header {
    padding: 0.5rem 1.25rem 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid var(--border);
}

.sheet-title-group {
    flex: 1;
    min-width: 0;
}

.sheet-badge-brand {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
}

.sheet-model {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0.1rem 0 0.25rem;
}

.sheet-subinfo {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    gap: 0.6rem;
    align-items: center;
}

.sheet-serial {
    font-family: ui-monospace, monospace;
    color: var(--primary);
    font-weight: 700;
}

.sheet-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.btn-sheet-test-page {
    background: #e0f2fe;
    border: 1px solid #bae6fd;
    color: #0369a1;
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-md);
    font-size: 0.74rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-sheet-test-page:active {
    transform: scale(0.96);
    background: #bae6fd;
}

[data-theme="dark"] .btn-sheet-test-page {
    background: rgba(14, 165, 233, 0.18);
    border-color: rgba(56, 189, 248, 0.35);
    color: #38bdf8;
}

.btn-sheet-close {
    background: var(--btn-header-bg);
    border: none;
    color: var(--text-secondary);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.sheet-tabs {
    display: flex;
    padding: 0.65rem 1rem 0.5rem;
    gap: 0.4rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.sheet-tab {
    flex: 1;
    min-width: fit-content;
    white-space: nowrap;
    background: var(--btn-header-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    transition: all 0.15s ease;
}

.sheet-tab.active {
    background: var(--primary);
    color: #ffffff !important;
    border-color: var(--primary);
    box-shadow: 0 2px 8px var(--primary-glow);
}

.card-action-buttons {
    display: flex;
    gap: 0.45rem;
    margin-top: 0.75rem;
}

.card-action-buttons .btn-card-secondary {
    flex: 1;
}

.card-action-buttons .btn-card-test {
    flex: 1.1;
    border-color: #7dd3fc;
    background: #f0f9ff;
    color: #0369a1;
}

.card-action-buttons .btn-card-primary {
    flex: 1.1;
}

.card-action-buttons .btn-card-secondary {
    flex: 1;
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
    padding: 0.65rem 0.5rem;
    border-radius: var(--radius-md);
    font-size: 0.76rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

[data-theme="dark"] .card-action-buttons .btn-card-secondary {
    background: rgba(245, 158, 11, 0.14);
    border-color: rgba(245, 158, 11, 0.3);
    color: #fde68a;
}

.card-action-buttons .btn-card-secondary:active {
    transform: scale(0.98);
}

.card-action-buttons .btn-card-test {
    flex: 1;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
    padding: 0.65rem 0.4rem;
    border-radius: var(--radius-md);
    font-size: 0.76rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

[data-theme="dark"] .card-action-buttons .btn-card-test {
    background: rgba(59, 130, 246, 0.14);
    border-color: rgba(96, 165, 250, 0.3);
    color: #93c5fd;
}

.card-action-buttons .btn-card-test:active {
    transform: scale(0.98);
}

.card-action-buttons .btn-card-primary {
    flex: 1.1;
    margin-top: 0;
    padding: 0.65rem 0.5rem;
    font-size: 0.78rem;
}

.badge-card-alerts {
    background: #ef4444;
    color: #ffffff;
    font-size: 0.62rem;
    font-weight: 800;
    padding: 0.1rem 0.35rem;
    border-radius: var(--radius-pill);
    line-height: 1.2;
}

.sheet-view-content {
    padding: 1rem 1.25rem;
    overflow-y: auto;
    max-height: calc(88vh - 160px);
}

/* Bottom Sheet Form Styles */
.form-section {
    margin-bottom: 1rem;
}

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

.label-with-hint {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
}

.counter-hint {
    font-size: 0.7rem;
    color: var(--primary);
    font-weight: 600;
}

.task-chips-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
}

.task-chip {
    background: var(--pill-bg);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.55rem 0.6rem;
    border-radius: var(--radius-md);
    font-size: 0.78rem;
    font-weight: 600;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.task-chip.active {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #1d4ed8;
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.15);
}

[data-theme="dark"] .task-chip.active {
    background: rgba(59, 130, 246, 0.18);
    border-color: rgba(59, 130, 246, 0.6);
    color: #ffffff;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}

.parts-quick-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.45rem;
}

.part-add-chip {
    background: var(--btn-header-bg);
    border: 1px dashed var(--border-hover);
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.22rem 0.5rem;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: all 0.15s ease;
}

.part-add-chip:active {
    background: rgba(37, 99, 235, 0.15);
    border-color: var(--primary);
    color: var(--primary);
    transform: scale(0.95);
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon .input-icon {
    position: absolute;
    left: 0.75rem;
    color: var(--text-muted);
}

.sheet-view-content input[type="number"],
.sheet-view-content input[type="text"],
.sheet-view-content textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.65rem 0.85rem;
    color: var(--text-primary);
    font-size: 0.88rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s ease;
}

.input-with-icon input {
    padding-left: 2.2rem;
}

.sheet-view-content input:focus,
.sheet-view-content textarea:focus {
    border-color: var(--primary);
}

.sheet-actions {
    margin-top: 1.25rem;
}

.btn-primary-action {
    width: 100%;
    background: var(--primary-gradient);
    border: none;
    color: #fff;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.92rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    box-shadow: 0 4px 16px var(--primary-glow);
    transition: transform 0.15s ease;
}

.btn-primary-action:active {
    transform: scale(0.98);
}

/* History Feed in Bottom Sheet */
.history-feed {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.history-item-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.75rem;
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.35rem;
}

.history-item-type {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary);
}

.history-item-date {
    font-size: 0.68rem;
    color: var(--text-muted);
}

.history-item-meta {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.history-item-notes {
    font-size: 0.8rem;
    color: var(--text-primary);
    background: var(--bg-main);
    border: 1px solid var(--border);
    padding: 0.45rem 0.6rem;
    border-radius: var(--radius-sm);
    line-height: 1.4;
}

/* ==========================================================================
   TOAST NOTIFICATION SYSTEM
   ========================================================================== */
.toast-container {
    position: fixed;
    bottom: 2rem;
    left: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    pointer-events: none;
    z-index: 200;
}

.toast {
    background: var(--toast-bg);
    border: 1px solid var(--toast-border);
    color: var(--toast-text);
    padding: 0.65rem 1.1rem;
    border-radius: var(--radius-pill);
    font-size: 0.8rem;
    font-weight: 600;
    box-shadow: var(--toast-shadow);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    gap: 0.45rem;
    pointer-events: auto;
    animation: toastPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.toast-success { border-color: rgba(16, 185, 129, 0.4); }
.toast.toast-warning { border-color: rgba(245, 158, 11, 0.4); }
.toast.toast-danger { border-color: rgba(239, 68, 68, 0.4); }

/* ==========================================================================
   LOADING & EMPTY STATES
   ========================================================================== */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 1rem;
    color: var(--text-muted);
    gap: 0.8rem;
    font-size: 0.85rem;
}

.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-state-sm {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Animations */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes toastPop { from { transform: translateY(20px) scale(0.9); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ==========================================================================
   PUBLIC QR SCAN ACTIONS (TONER REPOSITION & TECHNICAL SERVICE REQUESTS)
   ========================================================================== */
.public-actions-box {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-top: 1.1rem;
}

.public-actions-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.2rem;
}

.btn-public-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    padding: 0.8rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s ease, filter 0.15s ease, background 0.15s ease;
    text-align: center;
}

.btn-public-action:active {
    transform: scale(0.98);
}

.btn-toner-req {
    background: #eff6ff;
    border: 1.5px solid #3b82f6;
    color: #1d4ed8;
}

[data-theme="dark"] .btn-toner-req {
    background: rgba(59, 130, 246, 0.15);
    border-color: #3b82f6;
    color: #93c5fd;
}

.btn-service-req {
    background: #fef2f2;
    border: 1.5px solid #ef4444;
    color: #dc2626;
}

[data-theme="dark"] .btn-service-req {
    background: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
    color: #fca5a5;
}

.public-request-form {
    background: var(--bg-main);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-top: 0.85rem;
    animation: fadeIn 0.2s ease;
}

.public-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
}

.public-form-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

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

.public-request-form input,
.public-request-form textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.75rem;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
    margin-bottom: 0.75rem;
}

.public-request-form input:focus,
.public-request-form textarea:focus {
    border-color: var(--primary);
}

.public-form-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.4rem;
}

.btn-public-submit {
    flex: 1;
    background: var(--primary-gradient);
    border: none;
    color: #ffffff;
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
}

.btn-public-cancel {
    background: var(--btn-header-bg);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.public-success-card {
    background: var(--success-bg);
    border: 1.5px solid rgba(16, 185, 129, 0.4);
    border-radius: var(--radius-md);
    padding: 1.25rem 1rem;
    text-align: center;
    margin-top: 0.85rem;
    animation: fadeIn 0.25s ease;
}

.public-success-card h4 {
    color: var(--success-text);
    font-size: 1.05rem;
    font-weight: 800;
    margin-bottom: 0.35rem;
}

.public-success-card p {
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.4;
}

/* ==========================================================================
   PWA: BOTÓN DE INSTALACIÓN, BANNER Y MODAL PARA IOS
   ========================================================================== */
.btn-install-pwa {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--primary-gradient);
    color: #ffffff;
    border: none;
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-pill);
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 6px var(--primary-glow);
    transition: transform 0.15s ease, opacity 0.15s ease;
    animation: pulseInstall 2s infinite ease-in-out;
}

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

@keyframes pulseInstall {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); }
}

.pwa-install-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-md);
    padding: 0.65rem 0.85rem;
    margin: 0.5rem 0.85rem 0.25rem 0.85rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    animation: fadeIn 0.3s ease;
}

.pwa-banner-left {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex: 1;
    min-width: 0;
}

.pwa-app-icon img {
    display: block;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.pwa-banner-texts {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.pwa-banner-texts strong {
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pwa-banner-texts span {
    font-size: 0.74rem;
    color: var(--text-muted);
    line-height: 1.25;
}

.pwa-banner-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.btn-pwa-dismiss {
    background: transparent;
    border: none;
    color: var(--text-muted);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-pwa-dismiss:hover {
    background: var(--btn-header-bg);
    color: var(--text-primary);
}

.btn-pwa-action {
    background: var(--primary-gradient);
    color: #ffffff;
    border: none;
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 6px var(--primary-glow);
}

.btn-pwa-action:hover {
    opacity: 0.95;
}

/* Modal iOS Safari */
.ios-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 99999;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: fadeIn 0.25s ease;
}

.ios-modal-card {
    background: var(--sheet-bg);
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-width: 480px;
    padding: 1.25rem 1.25rem 2rem 1.25rem;
    box-shadow: var(--shadow-sheet);
    border-top: 1px solid var(--sheet-border);
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.ios-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.75rem;
}

.ios-modal-header h3 {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0;
}

.ios-step-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.ios-step-num {
    background: var(--primary);
    color: #ffffff;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
    flex-shrink: 0;
    margin-top: 2px;
}

.ios-step-text {
    font-size: 0.84rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.ios-badge-icon {
    display: inline-block;
    background: var(--btn-header-bg);
    border: 1px solid var(--border);
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.8rem;
    margin-left: 0.2rem;
    color: var(--primary);
}

.ios-modal-footer {
    margin-top: 1.25rem;
}

/* ==========================================================================
   COLA OFFLINE & SINCRONIZACIÓN PARA TÉCNICOS
   ========================================================================== */

.pending-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--warning-bg);
    color: var(--warning-text);
    border: 1px solid rgba(245, 158, 11, 0.4);
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-pill);
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(245, 158, 11, 0.2);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
    user-select: none;
}

.pending-badge:active {
    transform: scale(0.96);
}

.pending-badge .sync-icon {
    font-size: 0.85rem;
    animation: spinSlow 3s linear infinite;
    display: inline-block;
}

@keyframes spinSlow {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Modal / Sheet de Cola de Sincronización */
.queue-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(5px);
    z-index: 99998;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: fadeIn 0.25s ease;
}

.queue-modal-card {
    background: var(--sheet-bg);
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    padding: 1.25rem 1.25rem 1.75rem 1.25rem;
    box-shadow: var(--shadow-sheet);
    border-top: 1px solid var(--sheet-border);
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.queue-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.75rem;
}

.queue-modal-body {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.25rem;
    margin-bottom: 1rem;
}

.queue-items-feed {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.queue-empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--text-muted);
}

.queue-empty-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    opacity: 0.8;
}

.queue-item-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--warning);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    position: relative;
}

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

.queue-item-badge {
    background: var(--warning-bg);
    color: var(--warning-text);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-pill);
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
}

.queue-item-date {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.queue-item-printer {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
}

.queue-item-serial {
    font-family: monospace;
    font-size: 0.75rem;
    color: var(--primary);
    background: var(--serial-chip-bg);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
}

.queue-item-notes {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.35;
    background: var(--bg-input);
    padding: 0.45rem 0.6rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    white-space: pre-line;
}

.queue-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.queue-item-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.25rem;
}

.btn-delete-queue-item {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--danger);
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.btn-delete-queue-item:active {
    background: var(--danger-bg);
}

/* Tarjetas de Historia Clínica Local / Pendiente */
.history-item.is-pending {
    border-left: 3px solid var(--warning);
    background: var(--bg-card);
    position: relative;
}

.pending-history-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--warning-bg);
    color: var(--warning-text);
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

/* ==========================================================================
   ALERTAS Y EVENTOS DE HARDWARE EN MÓVIL (ATASCOS, TAPAS, TÓNER, ERRORES)
   ========================================================================== */
.card-alerts-block {
    margin: 0.5rem 0 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.card-alert-badge {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fde68a;
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.55rem;
    font-size: 0.74rem;
    font-weight: 600;
    line-height: 1.35;
}

[data-theme="dark"] .card-alert-badge {
    background: rgba(245, 158, 11, 0.12);
    color: #fde68a;
    border-color: rgba(245, 158, 11, 0.25);
}

.card-alert-badge.alert-danger {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fecaca;
}

[data-theme="dark"] .card-alert-badge.alert-danger {
    background: rgba(239, 68, 68, 0.12);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.25);
}

.card-alert-badge.alert-offline {
    background: #f8fafc;
    color: #64748b;
    border-color: #cbd5e1;
}

[data-theme="dark"] .card-alert-badge.alert-offline {
    background: rgba(255, 255, 255, 0.05);
    color: #94a3b8;
    border-color: rgba(255, 255, 255, 0.1);
}

/* Banner de Alertas en Cabecera de Ficha Bottom Sheet */
.sheet-active-alerts-container {
    padding: 0.65rem 1.25rem;
    background: #fffbeb;
    border-bottom: 1px solid #fde68a;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

[data-theme="dark"] .sheet-active-alerts-container {
    background: rgba(245, 158, 11, 0.14);
    border-bottom-color: rgba(245, 158, 11, 0.25);
}

.sheet-alert-item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: #92400e;
    line-height: 1.35;
}

[data-theme="dark"] .sheet-alert-item {
    color: #fde68a;
}

.sheet-tab-badge {
    background: #ef4444;
    color: #ffffff;
    font-size: 0.62rem;
    font-weight: 800;
    padding: 0.1rem 0.35rem;
    border-radius: var(--radius-pill);
    margin-left: 0.25rem;
    vertical-align: middle;
}

/* Feed de Historial de Alertas / Eventos SNMP */
.alerts-history-feed {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.event-history-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    border-left: 3.5px solid var(--primary);
}

.event-history-card.event-danger {
    border-left-color: #ef4444;
}

.event-history-card.event-warning {
    border-left-color: #f59e0b;
}

.event-history-card.event-resolved {
    border-left-color: #10b981;
    opacity: 0.92;
}

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

.event-card-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.event-badge-resolved {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-pill);
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
    white-space: nowrap;
}

[data-theme="dark"] .event-badge-resolved {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border-color: rgba(16, 185, 129, 0.3);
}

.event-badge-active {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-pill);
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    white-space: nowrap;
    animation: pulse 2s infinite;
}

[data-theme="dark"] .event-badge-active {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.3);
}

.event-card-detail {
    font-size: 0.76rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.event-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
    padding-top: 0.35rem;
    border-top: 1px dashed var(--border);
}

/* ==========================================================================
   RESPONSIVE DESIGN ADAPTATIONS (MOBILE DEVICES 320PX - 430PX)
   ========================================================================== */
@media (max-width: 410px) {
    .brand-tag {
        display: none;
    }
    .brand-title {
        font-size: 1rem;
    }
    .header-actions {
        gap: 0.22rem;
    }
    .btn-header-icon {
        width: 29px;
        height: 29px;
    }
    .filter-client-select {
        max-width: 140px;
    }
}

@media (max-width: 360px) {
    .net-badge #net-badge-text {
        display: none;
    }
    .net-badge {
        padding: 0.25rem 0.35rem;
    }
    .mobile-header {
        padding: 0.5rem 0.55rem 0.45rem;
    }
    .brand-title {
        font-size: 0.95rem;
    }
    .btn-header-icon {
        width: 28px;
        height: 28px;
    }
}



