:root {
    --font-sans: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --transition: 0.2s ease;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.08);
}

/* ========================================
   TRANSICIÓN SUAVE DE TEMA (claro/oscuro)
   Se activa añadiendo .theme-transition al <html>.
   Evitamos transicionar TODO para no causar jank; limitamos a props de color.
   ======================================== */
html.theme-transition,
html.theme-transition body,
html.theme-transition .app-container,
html.theme-transition .main-content,
html.theme-transition .content-wrapper,
html.theme-transition .sidebar,
html.theme-transition .top-navbar,
html.theme-transition .card,
html.theme-transition .modal-content,
html.theme-transition .stat-card,
html.theme-transition .toast,
html.theme-transition .table,
html.theme-transition .table th,
html.theme-transition .table td,
html.theme-transition .list-group-item,
html.theme-transition .form-control,
html.theme-transition .form-select,
html.theme-transition .btn,
html.theme-transition .badge,
html.theme-transition .note-card,
html.theme-transition .timeline-item,
html.theme-transition .calendar-day,
html.theme-transition .calendar-event,
html.theme-transition .autocomplete-list,
html.theme-transition .autocomplete-item,
html.theme-transition .report-container,
html.theme-transition .summary-card,
html.theme-transition input,
html.theme-transition select,
html.theme-transition textarea {
    transition:
        background-color 0.35s ease,
        border-color 0.35s ease,
        color 0.35s ease,
        box-shadow 0.35s ease,
        fill 0.35s ease,
        stroke 0.35s ease;
}

/* El backdrop/overlay del sidebar se transiciona por separado (más corto) */
.sidebar-backdrop { transition: opacity 0.25s ease; }

/* ========================================
   PULL-TO-REFRESH (sólo PWA / móvil)
   ======================================== */
.ptr-indicator {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translate(-50%, -100%);
    z-index: 9500;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    background: var(--bg-card);
    border-radius: 0 0 16px 16px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.12);
    border: 1px solid var(--border);
    border-top: none;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    transition: transform 0.2s ease;
    pointer-events: none;
    opacity: 0;
}
.ptr-indicator.ptr-active { opacity: 1; }
.ptr-indicator.ptr-ready { color: var(--primary); }
.ptr-spinner {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}
.ptr-indicator.ptr-ready .ptr-spinner {
    border-color: var(--primary-bg);
    border-top-color: var(--primary);
    transform: rotate(180deg);
    animation: none;
}
.ptr-info { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.ptr-last-update { font-size: 10px; color: var(--text-muted); opacity: 0.8; }

[data-theme="light"] {
    --bg: #f5f6fa;
    --bg-card: #ffffff;
    --bg-sidebar: #1e293b;
    --bg-hover: #f0f2f5;
    --bg-glass: rgba(0,0,0,0.03);
    --text: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --primary: #4f46e5;
    --primary-light: #6366f1;
    --primary-bg: rgba(79,70,229,0.08);
    --success: #059669;
    --success-bg: rgba(5,150,105,0.08);
    --warning: #d97706;
    --warning-bg: rgba(217,119,6,0.08);
    --danger: #dc2626;
    --danger-bg: rgba(220,38,38,0.08);
    --info: #0284c7;
    --sidebar-text: #cbd5e1;
    --sidebar-text-active: #ffffff;
    --sidebar-hover: rgba(255,255,255,0.08);
    --gradient: linear-gradient(135deg, #4f46e5, #7c3aed);
    --gradient-success: linear-gradient(135deg, #059669, #10b981);
    --gradient-warning: linear-gradient(135deg, #d97706, #f59e0b);
    --gradient-danger: linear-gradient(135deg, #dc2626, #ef4444);
    --gradient-info: linear-gradient(135deg, #0284c7, #38bdf8);
    --gradient-accent: linear-gradient(135deg, #db2777, #f472b6);
    --gradient-primary: linear-gradient(135deg, #4f46e5, #6366f1);
    --bs-body-color: var(--text);
    --bs-body-bg: var(--bg);
    --bs-table-bg: var(--bg-card);
    --bs-table-color: var(--text);
    --bs-table-striped-color: var(--text);
    --bs-table-striped-bg: var(--bg-glass);
    --bs-table-hover-color: var(--text);
    --bs-table-hover-bg: var(--bg-glass);
    --bs-border-color: var(--border);
    --bs-card-bg: var(--bg-card);
    --bs-card-color: var(--text);
    --bs-card-border-color: var(--border);
    --bs-list-group-bg: var(--bg-card);
    --bs-list-group-color: var(--text);
    --bs-list-group-border-color: var(--border);
    --bs-list-group-hover-bg: var(--bg-glass);
    --bs-modal-bg: var(--bg-card);
    --bs-modal-color: var(--text);
    --bs-form-control-bg: var(--bg-card);
    --bs-form-control-color: var(--text);
    --bs-form-control-border-color: var(--border);
    --bs-input-bg: var(--bg-card);
    --bs-input-color: var(--text);
    --bs-input-border-color: var(--border);
}

[data-theme="dark"] {
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-sidebar: #0f172a;
    --bg-hover: #334155;
    --bg-glass: rgba(255,255,255,0.04);
    --text: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --border: #334155;
    --primary: #818cf8;
    --primary-light: #a5b4fc;
    --primary-bg: rgba(129,140,248,0.1);
    --success: #34d399;
    --success-bg: rgba(52,211,153,0.1);
    --warning: #fbbf24;
    --warning-bg: rgba(251,191,36,0.1);
    --danger: #f87171;
    --danger-bg: rgba(248,113,113,0.1);
    --info: #38bdf8;
    --sidebar-text: #94a3b8;
    --sidebar-text-active: #ffffff;
    --sidebar-hover: rgba(255,255,255,0.06);
    --gradient: linear-gradient(135deg, #818cf8, #a78bfa);
    --gradient-success: linear-gradient(135deg, #34d399, #6ee7b7);
    --gradient-warning: linear-gradient(135deg, #fbbf24, #fcd34d);
    --gradient-danger: linear-gradient(135deg, #f87171, #fca5a5);
    --gradient-info: linear-gradient(135deg, #38bdf8, #7dd3fc);
    --gradient-accent: linear-gradient(135deg, #f472b6, #f9a8d4);
    --gradient-primary: linear-gradient(135deg, #4f46e5, #818cf8);
    --bs-body-color: var(--text);
    --bs-body-bg: var(--bg);
    --bs-table-bg: var(--bg-card);
    --bs-table-color: var(--text);
    --bs-table-striped-color: var(--text);
    --bs-table-striped-bg: var(--bg-glass);
    --bs-table-hover-color: var(--text);
    --bs-table-hover-bg: var(--bg-glass);
    --bs-border-color: var(--border);
    --bs-card-bg: var(--bg-card);
    --bs-card-color: var(--text);
    --bs-card-border-color: var(--border);
    --bs-list-group-bg: var(--bg-card);
    --bs-list-group-color: var(--text);
    --bs-list-group-border-color: var(--border);
    --bs-list-group-hover-bg: var(--bg-glass);
    --bs-modal-bg: var(--bg-card);
    --bs-modal-color: var(--text);
    --bs-form-control-bg: var(--bg-card);
    --bs-form-control-color: var(--text);
    --bs-form-control-border-color: var(--border);
    --bs-input-bg: var(--bg-card);
    --bs-input-color: var(--text);
    --bs-input-border-color: var(--border);
}

/* Bootstrap overrides - MUST come after Bootstrap */
body, .app-container, .main-content, .content-wrapper {
    color: var(--text) !important;
    background-color: var(--bg) !important;
}

.card, .modal-content, .stat-card, .top-navbar, .login-card {
    background-color: var(--bg-card) !important;
    color: var(--text) !important;
}

.text-muted, .text-secondary, small, .small, .form-text, .list-group-item .text-muted, .calendar-day-header, .stat-label, .timeline-date, .calendar-more, .legend-item, .form-label {
    color: var(--text-secondary) !important;
}

.text-body, .page-title, h1, h2, h3, h4, h5, h6, p, th, td, .nav-link, .btn-logout, .user-name, .sidebar-text, .brand-text, .card-header, .modal-header h3, .list-group-item {
    color: var(--text) !important;
}

.table th {
    color: var(--text-secondary) !important;
}

.border, .card, .modal-content, .top-navbar, .stat-card, .profile-header, .login-card, .sidebar, .list-group-item, .timeline-item, .calendar-day, .calendar-day-header, .toast, .autocomplete-list {
    border-color: var(--border) !important;
}

.bg-light, .bg-white {
    background-color: var(--bg) !important;
}

.alert, .btn-secondary, .autocomplete-item {
    background-color: var(--bg-glass) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

input, select, textarea, .form-control, .form-select {
    background-color: var(--bg-card) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

input::placeholder, .form-control::placeholder {
    color: var(--text-muted) !important;
}

body {
    font-family: var(--font-sans);
    margin: 0;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::selection { background: var(--primary); color: #fff; }

.app-container { display: flex; min-height: 100vh; }

/* ========================================
   SIDEBAR - Rediseño moderno
   3 estados: expanded | collapsed (iconos) | hidden
   ======================================== */

.sidebar {
    width: 240px;
    background: var(--bg-sidebar) !important;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1100;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.08);
}

/* Estado colapsado: solo iconos (desktop) */
.sidebar.collapsed {
    width: 64px;
}

/* Estado oculto: completamente fuera */
.sidebar.hidden {
    transform: translateX(-100%);
}

/* Backdrop para móvil cuando el sidebar está abierto */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1050;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}
.sidebar-backdrop.active {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

/* Header del sidebar */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 14px;
    gap: 6px;
    min-height: 56px;
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--sidebar-text-active);
    text-decoration: none;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.3px;
    flex: 1;
    min-width: 0;
}

.brand-icon {
    width: 36px;
    height: 36px;
    background: var(--gradient);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-brand-text {
    flex-shrink: 1;
    overflow: hidden;
    white-space: nowrap;
}

/* Colapsado: ocultar texto del brand */
.sidebar.collapsed .sidebar-brand-text {
    display: none;
}

.sidebar.collapsed .sidebar-brand {
    justify-content: center;
}

/* Botón flecha (contraer/expandir a iconos) */
.sidebar-toggle-desktop {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    color: var(--sidebar-text);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s ease, transform 0.25s ease;
    min-width: 36px;
    min-height: 36px;
}

.sidebar-toggle-desktop:hover {
    background: var(--sidebar-hover);
}

.sidebar.collapsed .sidebar-toggle-desktop {
    transform: rotate(180deg);
}

/* Colapsado: apilar logo y flecha verticalmente, ambos centrados */
.sidebar.collapsed .sidebar-header {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 12px 0;
    gap: 4px;
}

.sidebar.collapsed .sidebar-brand {
    flex: 0;
}

/* Navegación */
.sidebar-nav {
    list-style: none;
    padding: 8px 10px;
    margin: 0;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-item {
    margin-bottom: 2px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: var(--sidebar-text) !important;
    text-decoration: none;
    border-radius: 8px;
    transition: background 0.2s ease, color 0.2s ease;
    font-size: 14px;
    font-weight: 500;
    position: relative;
    min-height: 42px;
}

.nav-link:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-active) !important;
}

.nav-link.active {
    background: var(--primary-bg);
    color: var(--sidebar-text-active) !important;
}

/* Indicador lateral izquierdo para item activo */
.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--primary-light);
    border-radius: 0 3px 3px 0;
}

.nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.nav-text {
    flex-shrink: 1;
    overflow: hidden;
    white-space: nowrap;
}

/* Colapsado: solo iconos */
.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 10px 0;
}

.sidebar.collapsed .nav-text {
    display: none;
}

.sidebar.collapsed .nav-link.active::before {
    left: -10px;
}

/* Badge de notificaciones */
.notification-badge {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    padding: 1px 6px;
    min-width: 18px;
    text-align: center;
    border-radius: 10px;
    background: var(--danger);
    color: #fff;
    font-weight: 600;
}
/* Variante ámbar (warning) para pendientes */
.notification-badge.badge-warning { background: var(--warning); }
/* Variante éxito (verde) para realizadas */
.notification-badge.badge-success { background: var(--success); }

.sidebar.collapsed .notification-badge {
    right: 4px;
    top: 6px;
    transform: none;
}

/* Footer del sidebar */
.sidebar-footer {
    padding: 12px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}

.user-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 500;
}

.sidebar.collapsed .user-info {
    flex-direction: column;
    gap: 6px;
}

.sidebar.collapsed .user-name {
    display: none;
}

.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 9px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: var(--sidebar-text) !important;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    text-decoration: none;
}

.btn-logout:hover {
    background: rgba(248, 113, 113, 0.15);
    color: var(--danger) !important;
}

.sidebar.collapsed .btn-logout {
    padding: 10px;
}

.sidebar.collapsed .btn-logout-text {
    display: none;
}

/* Tooltips cuando está colapsado */
.sidebar.collapsed .nav-link::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-card);
    color: var(--text);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    z-index: 9999;
    border: 1px solid var(--border);
    pointer-events: none;
}

.sidebar.collapsed .nav-link:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 240px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed ~ .main-content {
    margin-left: 64px;
}

.sidebar.hidden ~ .main-content {
    margin-left: 0;
}

.top-navbar {
    display: flex; align-items: center;
    padding: 14px 24px;
    border-bottom: 1px solid var(--border);
    gap: 14px; position: sticky; top: 0; z-index: 900;
    background: var(--bg-card) !important;
}

/* Botón hamburguesa: siempre visible */
.menu-toggle {
    font-size: 20px; padding: 8px 10px; background: none; border: none;
    cursor: pointer; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s ease;
    color: var(--text);
    min-width: 40px;
    min-height: 40px;
}
.menu-toggle:hover { background: var(--bg-glass); }

.page-title { font-size: 18px; font-weight: 600; margin: 0; flex: 1; }

/* Breadcrumb contextual bajo el título de página */
.page-header-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.2;
    list-style: none;
    padding: 0;
    flex-wrap: wrap;
}
.breadcrumb-item { display: inline-flex; align-items: center; gap: 6px; }
.breadcrumb-item a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.15s ease;
    padding: 2px 0;
}
.breadcrumb-item a:hover { color: var(--primary); }
.breadcrumb-sep { color: var(--text-muted); opacity: 0.7; user-select: none; }
.breadcrumb-item.current { color: var(--text-secondary); font-weight: 500; }
.breadcrumb-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    flex-shrink: 0;
    margin-right: 8px;
    text-decoration: none;
}
.breadcrumb-back:hover { background: var(--bg-glass); color: var(--primary); border-color: var(--primary-light); }

/* ========================================
   TOOLTIPS CONTEXTUALES - top-navbar y botones
   Uso: <button data-tooltip="Mensaje">…</button>
   ======================================== */
[data-tooltip] { position: relative; }
[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    background: var(--bg-card);
    color: var(--text);
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    z-index: 9800;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}
[data-tooltip]:hover::before,
[data-tooltip]:focus-visible::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}
/* Variantes de posición */
[data-tooltip-pos="top"]::before {
    top: auto;
    bottom: calc(100% + 8px);
    transform: translateX(-50%) translateY(4px);
}
[data-tooltip-pos="top"]:hover::before,
[data-tooltip-pos="top"]:focus-visible::before {
    transform: translateX(-50%) translateY(0);
}
[data-tooltip-pos="bottom"]::before {
    top: calc(100% + 8px);
    bottom: auto;
    transform: translateX(-50%) translateY(-4px);
}
[data-tooltip-pos="bottom"]:hover::before,
[data-tooltip-pos="bottom"]:focus-visible::before {
    transform: translateX(-50%) translateY(0);
}
/* Flecha pequeña */
[data-tooltip]::after {
    content: '';
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 5px solid var(--bg-card);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
    filter: drop-shadow(0 -1px 1px rgba(0,0,0,0.06));
}
[data-tooltip-pos="top"]::after {
    top: auto;
    bottom: calc(100% + 6px);
    border-top: 5px solid var(--bg-card);
    border-bottom: none;
    transform: translateX(-50%) translateY(4px);
}
[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}
/* En móvil, los tooltips pueden molestar; los desactivamos en táctil pequeño */
@media (max-width: 575px) {
    [data-tooltip]::before, [data-tooltip]::after { display: none !important; }
}

/* Excepciones:
   - nav-link del sidebar ya muestra el texto del enlace y, colapsado, usa su propio tooltip lateral (::after).
   - Anulamos sólo el ::before (el nuevo) y el ::after global (flecha) para no interferir con el ::after lateral existente del sidebar colapsado. */
.sidebar .nav-link[data-tooltip]::before { display: none !important; }
.sidebar .nav-link[data-tooltip]::after  { display: none !important; }
/* Mantener el tooltip lateral del sidebar colapsado */
.sidebar.collapsed .nav-link::after { display: block !important; }

@media (max-width: 767px) {
    .page-title { font-size: 15px; }
    .breadcrumb { font-size: 11px; }
    .breadcrumb-item span.breadcrumb-label { display: none; }
}

.top-nav-actions { display: flex; align-items: center; gap: 6px; }

.theme-toggle, .settings-btn, .notification-bell {
    background: none; border: none; cursor: pointer; padding: 6px 8px; border-radius: 6px;
    font-size: 16px; transition: var(--transition);
    color: var(--text-secondary) !important;
    text-decoration: none;
}
.theme-toggle:hover, .settings-btn:hover, .notification-bell:hover { background: var(--bg-glass); color: var(--text) !important; }

.notification-bell { position: relative; }
.notif-count {
    position: absolute; top: 0; right: 2px;
    font-size: 9px; padding: 1px 5px; min-width: 15px; text-align: center;
    border-radius: 8px; background: var(--danger); color: #fff;
}

.content-wrapper { padding: 24px; flex: 1; overflow-x: hidden; }

.card {
    border-radius: var(--radius);
    box-shadow: var(--shadow); border: 1px solid var(--border);
    margin-bottom: 16px;
    transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}
.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    border-color: var(--primary-light);
}
.card-header {
    padding: 16px 20px; border-bottom: 1px solid var(--border);
    font-weight: 600; font-size: 15px;
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
}
.card-body { padding: 20px; }
.card-body.p-0 { padding: 0; }

.stat-card {
    border-radius: var(--radius);
    padding: 18px; box-shadow: var(--shadow);
    border: 1px solid var(--border);
    display: flex; align-items: center; gap: 14px;
    transition: all 0.2s ease;
    cursor: default;
    height: 100%;
}
.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    border-color: var(--primary-light);
}

.stat-icon {
    width: 44px; height: 44px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; color: #fff; flex-shrink: 0;
}
.stat-icon.g-primary { background: var(--gradient-primary); }
.stat-icon.g-success { background: var(--gradient-success); }
.stat-icon.g-warning { background: var(--gradient-warning); }
.stat-icon.g-danger { background: var(--gradient-danger); }
.stat-icon.g-info { background: var(--gradient-info); }
.stat-icon.g-accent { background: var(--gradient-accent); }

.stat-info { flex: 1; min-width: 0; }
.stat-number { display: block; font-size: 20px; font-weight: 700; line-height: 1.2; color: var(--text); overflow-wrap: break-word; word-break: break-word; hyphens: auto; max-width: 100%; }
.stat-label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; color: var(--text-secondary) !important; }

.table-container { overflow-x: auto; }
.table-responsive-desktop { overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (min-width: 768px) {
    .table-responsive-desktop { overflow-x: visible; }
}
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
    padding: 12px 16px; text-align: left; font-weight: 600; font-size: 12px;
    text-transform: uppercase; letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-glass);
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background 0.15s ease; }
.table tbody tr:nth-child(even) { background: rgba(128, 128, 160, 0.03); }
.table tbody tr:hover { background: var(--bg-glass); }

.badge {
    padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 500;
    display: inline-block;
}
.badge-pending { background: var(--warning-bg); color: var(--warning) !important; border: 1px solid rgba(217,119,6,0.2); }
.badge-completed { background: var(--success-bg); color: var(--success) !important; border: 1px solid rgba(5,150,105,0.2); }
.badge-cancelled { background: var(--danger-bg); color: var(--danger) !important; border: 1px solid rgba(220,38,38,0.2); }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 18px; border-radius: 8px; font-size: 14px; font-weight: 500;
    border: none; cursor: pointer; transition: all var(--transition);
    text-decoration: none; line-height: 1.4;
}
.btn-primary { background: var(--gradient); color: #fff !important; }
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-success { background: var(--gradient-success); color: #fff !important; }
.btn-success:hover { opacity: 0.9; }
.btn-danger { background: var(--gradient-danger); color: #fff !important; }
.btn-danger:hover { opacity: 0.9; }
.btn-warning { background: var(--gradient-warning); color: #fff !important; }
.btn-info { background: var(--gradient-info); color: #fff !important; }
.btn-secondary { background: var(--bg-glass); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-hover); }

/* Spinner para botones en estado de carga */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
.btn-loading {
    pointer-events: none;
    opacity: 0.75;
    position: relative;
}
.btn-loading > *:not(.spinner) {
    opacity: 0;
    position: absolute;
}
.btn-loading::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
.btn-secondary.btn-loading::after {
    border-color: rgba(0, 0, 0, 0.2);
    border-top-color: var(--text);
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-secondary); }
.btn-outline:hover, .btn-outline.active { border-color: var(--primary); color: var(--primary) !important; background: var(--primary-bg); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 28px; font-size: 16px; }

.btn-group { display: inline-flex; gap: 0; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: 8px 0 0 8px; }
.btn-group .btn:last-child { border-radius: 0 8px 8px 0; }
.btn-group .btn + .btn { border-left: 1px solid var(--border); }

.form-group { margin-bottom: 16px; }
.form-label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 13px; }
.form-control, .form-select {
    width: 100%; padding: 10px 14px;
    border: 1.5px solid var(--border); border-radius: 8px;
    font-size: 14px; transition: all var(--transition);
    font-family: var(--font-sans);
}
.form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12), 0 0 8px rgba(79, 70, 229, 0.08) !important;
}
[data-theme="dark"] .form-control:focus, [data-theme="dark"] .form-select:focus {
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.15), 0 0 8px rgba(129, 140, 248, 0.1) !important;
}
textarea.form-control { resize: vertical; min-height: 80px; }

.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.5); z-index: 2000;
    align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal-content {
    border-radius: var(--radius-lg);
    width: 100%; max-width: 560px; max-height: 85vh;
    overflow-y: auto; box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 22px 14px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { margin: 0; font-size: 17px; font-weight: 600; }
.modal-close {
    background: none; border: none; font-size: 20px; cursor: pointer;
    color: var(--text-muted); padding: 4px 8px; border-radius: 6px;
    transition: var(--transition);
}
.modal-close:hover { background: var(--bg-glass); }
.modal-body { padding: 20px 22px; }
.modal-footer { padding: 14px 22px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ========================================
   CONFIRM DIALOG - Reemplaza confirm() nativo
   ======================================== */
.confirm-dialog { max-width: 420px; }
.confirm-dialog .modal-body {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding: 22px 22px 16px;
}
.confirm-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 22px;
    background: var(--danger-bg);
    color: var(--danger);
}
.confirm-dialog.is-info .confirm-icon { background: var(--primary-bg); color: var(--primary); }
.confirm-dialog.is-warning .confirm-icon { background: var(--warning-bg); color: var(--warning); }
.confirm-dialog.is-success .confirm-icon { background: var(--success-bg); color: var(--success); }
.confirm-content { flex: 1; min-width: 0; }
.confirm-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 6px;
    line-height: 1.3;
}
.confirm-message {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}
.confirm-dialog .modal-footer { gap: 10px; }
.confirm-dialog .btn-confirm-cancel {
    background: var(--bg-glass);
    color: var(--text);
    border: 1px solid var(--border);
    min-width: 96px;
}
.confirm-dialog .btn-confirm-cancel:hover { background: var(--bg-hover); }
.confirm-dialog .btn-confirm-ok {
    min-width: 96px;
}
/* Variantes del botón principal según tipo */
.confirm-dialog.is-danger .btn-confirm-ok { background: var(--gradient-danger); color: #fff !important; }
.confirm-dialog.is-info .btn-confirm-ok { background: var(--gradient-info); color: #fff !important; }
.confirm-dialog.is-warning .btn-confirm-ok { background: var(--gradient-warning); color: #fff !important; }
.confirm-dialog.is-success .btn-confirm-ok { background: var(--gradient-success); color: #fff !important; }
.confirm-dialog .btn-confirm-ok.btn-loading::after { border-color: rgba(255,255,255,0.3); border-top-color: #fff; }

/* Animación de entrada para el contenido del modal de confirmación */
 .modal-overlay.active .modal-content { animation: modalSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1); }
 @keyframes modalSlideIn {
     from { opacity: 0; transform: translateY(-12px) scale(0.98); }
     to { opacity: 1; transform: translateY(0) scale(1); }
 }

/* ========================================
   QUICK ACTIONS MODAL - Grid 2x2 visual
   ======================================== */
.quick-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.quick-action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 22px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
    color: var(--text);
    gap: 12px;
}
.quick-action-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.quick-action-card .qa-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}
.quick-action-card.qa-primary .qa-icon { background: var(--gradient-primary); }
.quick-action-card.qa-success  .qa-icon { background: var(--gradient-success); }
.quick-action-card.qa-info     .qa-icon { background: var(--gradient-info); }
.quick-action-card.qa-warning  .qa-icon { background: var(--gradient-warning); }
.quick-action-card.qa-primary:hover { border-color: var(--primary-light); }
.quick-action-card.qa-success:hover  { border-color: var(--success); }
.quick-action-card.qa-info:hover     { border-color: var(--info); }
.quick-action-card.qa-warning:hover  { border-color: var(--warning); }
.quick-action-card .qa-content { display: flex; flex-direction: column; gap: 4px; }
.quick-action-card .qa-title { font-size: 15px; font-weight: 600; color: var(--text); }
.quick-action-card .qa-desc  { font-size: 12px; color: var(--text-secondary); line-height: 1.4; }
.quick-actions-hint {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 18px;
}
.quick-actions-hint kbd {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 5px;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 600;
    margin: 0 2px;
}

@media (max-width: 575px) {
    .quick-action-card { padding: 16px 10px; }
    .quick-action-card .qa-icon { width: 48px; height: 48px; }
    .quick-action-card .qa-desc { display: none; }
}

.toast-container { position: fixed; top: 20px; right: 20px; z-index: 99999; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast {
    border-radius: 12px; padding: 14px 18px 14px 18px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
    display: flex; align-items: center; gap: 12px;
    min-width: 300px; max-width: 420px;
    animation: toastSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    background: var(--bg-card);
    border: 1px solid var(--border);
    pointer-events: auto;
    position: relative;
    overflow: hidden;
}
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    background: var(--primary);
    opacity: 0.6;
    transform-origin: left;
    animation: toastProgress 4s linear forwards;
}
.toast.error .toast-progress { background: var(--danger); }
.toast.success .toast-progress { background: var(--success); }
.toast.warning .toast-progress { background: var(--warning); }
@keyframes toastProgress {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}
.toast::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    border-radius: 12px 0 0 12px;
}
.toast.success::before { background: var(--success); }
.toast.error::before { background: var(--danger); }
.toast.warning::before { background: var(--warning); }
.toast.info::before { background: var(--info); }
.toast-icon {
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; flex-shrink: 0;
}
.toast.success .toast-icon { background: rgba(5,150,105,0.12); color: var(--success); }
.toast.error .toast-icon { background: rgba(220,38,38,0.12); color: var(--danger); }
.toast.warning .toast-icon { background: rgba(217,119,6,0.12); color: var(--warning); }
.toast.info .toast-icon { background: rgba(2,132,199,0.12); color: var(--info); }
.toast-message { flex: 1; font-size: 13px; line-height: 1.4; color: var(--text); font-weight: 500; }
.toast-close {
    background: none; border: none; font-size: 18px; cursor: pointer;
    color: var(--text-muted); padding: 0 4px; opacity: 0.5;
    transition: opacity 0.15s; line-height: 1;
}
.toast-close:hover { opacity: 1; }

/* Botón de acción dentro del toast (p. ej. Deshacer) */
.toast-action {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--primary) !important;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.toast-action:hover {
    background: var(--primary-bg);
    border-color: var(--primary-light);
}
.toast.error .toast-action { color: var(--danger) !important; }
.toast.error .toast-action:hover { background: var(--danger-bg); border-color: var(--danger); }

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateX(40px) scale(0.95); }
    to { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toastSlideOut {
    from { opacity: 1; transform: translateX(0) scale(1); }
    to { opacity: 0; transform: translateX(40px) scale(0.95); }
}

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.search-box { position: relative; max-width: 300px; }
.search-box .form-control { padding-right: 36px; }
.search-box .search-icon { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); }

.pagination { display: flex; gap: 4px; justify-content: center; margin-top: 16px; }
.pagination .page-link {
    padding: 7px 14px; border: 1px solid var(--border); border-radius: 6px;
    text-decoration: none; font-size: 13px;
    transition: var(--transition); background: transparent;
}
.pagination .page-link:hover { background: var(--bg-glass); }
.pagination .active .page-link { background: var(--primary); color: #fff !important; }

.row { display: flex; flex-wrap: wrap; margin: 0 -10px; }
.row.g-3 { margin: 0 -6px; }
.row.g-3 > [class*="col-"] { padding: 0 6px; margin-bottom: 12px; }
.col-6 { width: 50%; }
.col-4 { width: 33.333%; }
.col-12 { width: 100%; }
[class*="col-"] { padding: 0 10px; margin-bottom: 16px; }

@media (min-width: 768px) { .col-md-6 { width: 50%; } .col-md-4 { width: 33.333%; } }
@media (min-width: 992px) { .col-lg-2 { width: 16.666%; } .col-lg-3 { width: 25%; } .col-lg-4 { width: 33.333%; } .col-lg-6 { width: 50%; } .col-lg-8 { width: 66.666%; } }

.list-group { list-style: none; padding: 0; margin: 0; }
.list-group-item { padding: 14px 18px; border-bottom: 1px solid var(--border); transition: background var(--transition); }
.list-group-item:last-child { border-bottom: none; }
.list-group-item:hover { background: var(--bg-glass); }

.actions-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 16px; }

.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); }
.avatar-lg { width: 100px; height: 100px; border-radius: 50%; object-fit: cover; border: 3px solid var(--primary); box-shadow: 0 4px 15px rgba(79,70,229,0.2); }

.profile-header {
    display: flex; align-items: center; gap: 24px; padding: 28px;
    border-radius: var(--radius);
    border: 1px solid var(--border); margin-bottom: 20px;
    flex-wrap: wrap;
    background: var(--bg-card);
}

/* Modern Profile */
.profile-hero {
    display: flex; align-items: center; gap: 20px; padding: 24px;
    border-radius: var(--radius); margin-bottom: 20px;
    background: var(--bg-card); border: 1px solid var(--border);
    flex-wrap: wrap;
}
.profile-avatar-wrap { position: relative; flex-shrink: 0; }
.profile-avatar { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; border: 3px solid var(--primary); }
.profile-avatar-letter {
    width: 72px; height: 72px; border-radius: 50%;
    background: var(--gradient); display: flex; align-items: center;
    justify-content: center; font-size: 28px; font-weight: 700; color: #fff;
}
.profile-badge {
    position: absolute; top: -4px; right: -4px;
    background: var(--danger); color: #fff; font-size: 10px;
    padding: 2px 7px; border-radius: 10px; font-weight: 600;
    border: 2px solid var(--bg-card);
}
.profile-hero-info { flex: 1; min-width: 180px; }
.profile-hero-name { margin: 0 0 6px; font-size: 20px; font-weight: 700; color: var(--text); }
.profile-hero-contacts {
    display: flex; flex-wrap: wrap; gap: 4px 14px;
    font-size: 13px; color: var(--text-secondary);
}
.profile-hero-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; flex: 1; }
.profile-stats-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px;
}
.profile-content-grid {
    display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start;
}
.profile-main { min-width: 0; max-width: 100%; overflow: hidden; }
.profile-side { min-width: 0; max-width: 100%; overflow: hidden; }
.profile-chart { max-height: 200px; max-width: 100%; display: block; }
.profile-chart-wrap { position: relative; width: 100%; overflow: hidden; }

.notes-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; gap: 8px; }
.notes-status { font-size: 12px; font-weight: 500; }
.notes-status.saved { color: var(--success); }
.notes-status.error { color: var(--danger); }

.history-list { }
.history-item {
    display: flex; gap: 12px; padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s; align-items: flex-start;
}
.history-item:last-child { border-bottom: none; }
.history-item:hover { background: var(--bg-glass); }
.history-item-left { flex: 1; min-width: 0; }
.history-item-right { text-align: right; flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.history-date { font-weight: 600; font-size: 13px; color: var(--text); }
.history-time { font-weight: 400; font-size: 12px; color: var(--text-muted); margin-left: 8px; }
.history-service { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.history-obs { font-size: 11px; color: var(--text-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 250px; }
.history-price { font-weight: 600; font-size: 14px; color: var(--text); }
.history-actions { display: flex; gap: 4px; margin-top: 4px; }
.history-more { padding: 12px 20px; border-top: 1px solid var(--border); text-align: center; }

.maps-wrap { position: relative; width: 100%; padding-bottom: 50%; border-radius: 0 0 var(--radius) var(--radius); overflow: hidden; }
.maps-wrap iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; }

/* Notes Modal System */
.note-inline-item {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    cursor: default;
    transition: background 0.15s;
}
.note-inline-item:last-child { border-bottom: none; }
.note-inline-item:hover { background: var(--bg-glass); }
.note-inline-text {
    font-size: 12px;
    line-height: 1.4;
    color: var(--text);
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.note-inline-time {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 3px;
}
.note-inline-more {
    padding: 8px 14px;
    text-align: center;
    font-size: 12px;
    color: var(--primary);
    cursor: pointer;
    border-top: 1px solid var(--border);
    font-weight: 500;
    transition: background 0.15s;
}
.note-inline-more:hover { background: var(--bg-glass); }

.notes-search-bar {
    padding: 8px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    position: sticky;
    top: 52px;
    z-index: 2;
}
.notes-search-bar input {
    border-radius: 8px;
    font-size: 12px;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    transition: all 0.2s;
}
.notes-search-bar input:focus {
    box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
    border-color: var(--primary);
}
.notes-add-bar {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-glass);
    position: sticky;
    top: 0;
    z-index: 2;
}
.notes-add-bar input {
    border-radius: 10px;
    transition: all 0.2s;
}
.notes-add-bar input:focus {
    box-shadow: 0 0 0 3px rgba(79,70,229,0.15);
    border-color: var(--primary);
}
.notes-modal-list {
    max-height: 50vh;
    overflow-y: auto;
}
.notes-modal-list::-webkit-scrollbar { width: 5px; }
.notes-modal-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; }
.note-modal-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.note-modal-item:last-child { border-bottom: none; }
.note-modal-item:hover { background: linear-gradient(135deg, var(--bg-glass), rgba(79,70,229,0.03)); }
.note-modal-content { flex: 1; min-width: 0; }
.note-modal-text {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    word-break: break-word;
}
.note-modal-item:hover .note-modal-text { color: var(--primary); }
.note-modal-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}
.note-modal-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    opacity: 0;
    transition: all 0.2s;
}
.note-modal-item:hover .note-modal-actions { opacity: 1; }
.nma-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px 8px;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    transition: all 0.15s;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.nma-btn:hover { background: rgba(79,70,229,0.08); color: var(--primary); }
.nma-btn.danger:hover { background: rgba(220,38,38,0.08); color: var(--danger); }

.notes-empty {
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.notes-empty::before { content: '📝'; font-size: 36px; opacity: 0.4; }

.note-item-removing {
    opacity: 0 !important;
    transform: translateX(30px) !important;
    max-height: 0 !important;
    padding: 0 16px !important;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-bottom: none !important;
}

.note-badge {
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--primary); color: #fff; font-size: 10px; font-weight: 700;
    min-width: 20px; height: 20px; border-radius: 10px; padding: 0 6px;
    margin-left: 6px;
}

/* Finances - category tags */
.cat-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.cat-tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 20px; font-size: 11px; background: var(--bg-glass); border: 1px solid var(--border); color: var(--text-secondary); }
.cat-tag .cat-del { cursor: pointer; opacity: 0.5; font-weight: bold; margin-left: 2px; }
.cat-tag .cat-del:hover { opacity: 1; color: var(--danger); }
.fab-btn { position: fixed; bottom: 24px; right: 24px; z-index: 100; width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 24px; box-shadow: 0 4px 20px rgba(79,70,229,0.35); }

.chart-container { position: relative; width: 100%; height: 280px; }

/* History Filters */
.history-filters { padding: 14px 20px; border-bottom: 1px solid var(--border); background: var(--bg-glass); }
.hf-row { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.hf-field label { display: block; font-size: 11px; color: var(--text-secondary); margin-bottom: 4px; font-weight: 500; }
.hf-field input, .hf-field select { width: 150px; }
.hf-svc select { width: 160px; }
.hf-actions { display: flex; gap: 6px; padding-bottom: 1px; }
.history-count { padding: 8px 20px; font-size: 12px; color: var(--text-secondary); background: var(--bg-glass); border-bottom: 1px solid var(--border); }

/* Notes Tab System */
.notes-tabs { display: flex; border-bottom: 1px solid var(--border); }
.ntab { flex: 1; padding: 10px 12px; border: none; background: transparent; color: var(--text-secondary); font-size: 12px; font-weight: 500; cursor: pointer; transition: all 0.15s; position: relative; }
.ntab.active { color: var(--primary); background: var(--primary-bg); }
.ntab.active::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 2px; background: var(--primary); }
.ntab:hover { color: var(--text); background: var(--bg-glass); }
.notes-panel { padding: 16px; }
.notes-empty { padding: 30px; text-align: center; color: var(--text-muted); font-size: 13px; }
.notes-private-wrap { }
.note-card { border-radius: 8px; padding: 12px 14px; margin-bottom: 10px; position: relative; }
.note-text { font-size: 13px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.note-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; font-size: 11px; opacity: 0.8; }
.note-date { }
.note-actions { display: flex; gap: 4px; }
.note-btn { background: none; border: none; cursor: pointer; opacity: 0.6; font-size: 13px; padding: 2px 4px; }
.note-btn:hover { opacity: 1; }
.note-color-row { display: flex; gap: 16px; margin: 12px 0; flex-wrap: wrap; }
.nc-group { flex: 1; min-width: 140px; }
.nc-group label { display: block; font-size: 11px; color: var(--text-secondary); margin-bottom: 6px; font-weight: 500; }
.nc-presets { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; }
.nc-swatch { width: 24px; height: 24px; border-radius: 4px; border: 2px solid transparent; cursor: pointer; transition: all 0.15s; }
.nc-swatch.active { border-color: var(--primary); transform: scale(1.15); }
.nc-swatch:hover { transform: scale(1.1); }
.nc-picker { width: 100%; height: 32px; border: 1px solid var(--border); border-radius: 6px; padding: 2px; cursor: pointer; background: var(--bg-card); }

@media (max-width: 767px) {
    .hf-field input, .hf-field select { width: 100%; }
    .hf-row { flex-direction: column; }
    .hf-actions { width: 100%; }
    .hf-actions button { flex: 1; }
    .note-color-row { flex-direction: column; }
    .nc-group { min-width: 100%; }
}

@media (max-width: 1100px) {
    .profile-content-grid { grid-template-columns: 1fr; }
    .profile-stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 767px) {
    .profile-hero { flex-direction: column; text-align: center; padding: 20px; }
    .profile-hero-actions { justify-content: center; }
    .profile-hero-contacts { justify-content: center; gap: 2px 10px; font-size: 12px; }
    .profile-stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .profile-stats-grid .stat-card { padding: 12px 10px; gap: 10px; }
    .profile-stats-grid .stat-icon { width: 32px; height: 32px; font-size: 13px; }
    .profile-stats-grid .stat-number { font-size: 15px; }
    .profile-stats-grid .stat-label { font-size: 9px; letter-spacing: 0.3px; }
    .profile-content-grid { grid-template-columns: 1fr; }
    .profile-avatar, .profile-avatar-letter { width: 60px; height: 60px; flex-shrink: 0; }
    .profile-avatar-letter { font-size: 22px; }
    .profile-chart { max-height: 140px; }
    .history-item { flex-direction: column; padding: 12px 16px; }
    .history-item-right { flex-direction: row; align-items: center; gap: 8px; flex-wrap: wrap; }
    .history-obs { max-width: 100%; }
    /* Fix history filter layout on mobile */
    .history-filters .hf-field input,
    .history-filters .hf-field select { width: 100%; min-width: 0; }
    .history-filters .hf-field { width: 100%; }
    .history-filters .hf-actions { width: 100%; }
    .history-filters .hf-actions button { flex: 1; }
    /* Fix notes panel overflow */
    .notes-panel { padding: 12px; overflow: hidden; }
    .note-card { max-width: 100%; overflow: hidden; }
    /* Stat cards for large numbers */
    .stat-card { padding: 14px; gap: 10px; }
    .stat-number { font-size: 17px; }
}
@media (max-width: 575px) {
    .profile-stats-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
    .profile-stats-grid .stat-card { padding: 10px 8px; gap: 8px; }
    .profile-stats-grid .stat-icon { width: 28px; height: 28px; font-size: 11px; }
    .profile-stats-grid .stat-number { font-size: 14px; }
    .profile-stats-grid .stat-label { font-size: 8px; }
    .profile-hero { padding: 14px; }
    .profile-hero-name { font-size: 17px; }
    /* Fix chart on very small screens */
    .profile-chart { max-height: 120px; }
    .profile-content-grid { gap: 12px; }
}
.profile-info { flex: 1; }
.profile-info h2 { margin: 0 0 4px; font-size: 22px; font-weight: 700; }
.profile-info p { margin: 2px 0; font-size: 14px; }
.profile-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn-whatsapp { background: #25d366; color: #fff !important; }
.btn-whatsapp:hover { opacity: 0.9; }

.timeline { position: relative; padding-left: 24px; max-height: 500px; overflow-y: auto; }
.timeline::before {
    content: ''; position: absolute; left: 8px; top: 0; bottom: 0;
    width: 2px; background: var(--border);
}
.timeline-item { position: relative; margin-bottom: 12px; padding: 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-glass); }
.timeline-item::before {
    content: ''; position: absolute; left: -20px; top: 18px;
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--primary); border: 2px solid var(--bg-card);
}
.timeline-date { font-size: 12px; }
.timeline-content { margin-top: 4px; }
.timeline-content strong { font-size: 14px; }

.autocomplete-wrapper { position: relative; }
.autocomplete-list {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 100;
    border: 1px solid var(--border);
    border-radius: 0 0 8px 8px; box-shadow: var(--shadow-lg);
    max-height: 200px; overflow-y: auto;
    background: var(--bg-card);
}
.autocomplete-item { padding: 10px 14px; cursor: pointer; font-size: 13px; border-bottom: 1px solid var(--border); }
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover { background: var(--bg-glass); }

.login-page {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; padding: 20px;
}
.login-container { width: 100%; max-width: 400px; }
.login-card {
    border-radius: var(--radius-lg);
    padding: 40px 32px; box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}
.login-header { text-align: center; margin-bottom: 28px; }
.login-icon {
    width: 56px; height: 56px; margin: 0 auto 14px;
    background: var(--gradient); border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; color: #fff;
}
.login-header h1 { font-size: 22px; font-weight: 700; margin: 0; }
.login-header p { margin: 4px 0 0; font-size: 14px; }
.login-form .form-group { margin-bottom: 18px; }
.login-form .form-control { padding: 12px 16px; font-size: 15px; }
.btn-block { width: 100%; padding: 12px; }

.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.justify-content-end { justify-content: flex-end; }
.justify-content-center { justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.gap-2 { gap: 8px; }.gap-3 { gap: 16px; }
.mb-4 { margin-bottom: 24px; }.mb-3 { margin-bottom: 16px; }.mb-0 { margin-bottom: 0; }
.mt-2 { margin-top: 8px; }.mt-3 { margin-top: 16px; }
.p-0 { padding: 0; }
.text-center { text-align: center; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-info { color: var(--info) !important; }
.fw-bold { font-weight: 700; }
.w-100 { width: 100%; }
.d-none { display: none; }
.hidden { display: none; }

.fab-quick {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1500;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--gradient);
    color: #fff;
    border: none;
    font-size: 24px;
    font-weight: 300;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(79,70,229,0.4);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.fab-quick:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(79,70,229,0.5); }
.fab-quick:active { transform: scale(0.95); }

@media (max-width: 767px) {
    .fab-quick {
        bottom: 16px;
        right: 16px;
        width: 48px;
        height: 48px;
        font-size: 22px;
    }
}

/* Touch optimizations */
html {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

button, .btn, a, .calendar-day, .calendar-event, .list-group-item, .nav-link, .timeline-item, .autocomplete-item {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

.table { background: var(--bg-card) !important; color: var(--text) !important; }
.table td, .table th { color: inherit !important; }
.list-group-item { background: var(--bg-card) !important; color: var(--text) !important; }
.list-group-item:hover { background: var(--bg-glass) !important; }

@media (max-width: 991px) {
    /* Móvil: sidebar como overlay */
    .sidebar { transform: translateX(-100%); width: 240px; }
    .sidebar.open { transform: translateX(0); }

    /* En móvil no aplicar estados desktop */
    .sidebar.collapsed { width: 240px; }
    .sidebar.collapsed .sidebar-brand-text,
    .sidebar.collapsed .nav-text,
    .sidebar.collapsed .user-name,
    .sidebar.collapsed .btn-logout-text { display: block; }
    .sidebar.collapsed .sidebar-brand { justify-content: flex-start; }
    .sidebar.collapsed .nav-link { justify-content: flex-start; padding: 10px 12px; }
    .sidebar.collapsed .user-info { flex-direction: row; }
    .sidebar.collapsed .btn-logout { padding: 9px 14px; }
    .sidebar.collapsed .nav-link::after { display: none; }

    /* Toggle desktop oculto en móvil */
    .sidebar-toggle-desktop { display: none; }

    /* Backdrop visible cuando sidebar abierto */
    .sidebar.open ~ .sidebar-backdrop { display: block; opacity: 1; pointer-events: auto; }

    .sidebar.hidden { transform: translateX(-100%); }
    .main-content,
    .sidebar.collapsed ~ .main-content,
    .sidebar.hidden ~ .main-content { margin-left: 0; }
    .top-navbar { padding: 10px 14px; }
    .content-wrapper { padding: 16px; }
}

@media (max-width: 767px) {
    .page-title { font-size: 15px; }
    .stat-card { padding: 14px; }
    .stat-icon { width: 38px; height: 38px; font-size: 16px; }
    .stat-number { font-size: 17px; }
    .profile-header { flex-direction: column; text-align: center; padding: 20px; }
    .profile-actions { justify-content: center; }
    .table { font-size: 13px; }
    .table th, .table td { padding: 8px 10px; }
    .actions-bar { flex-direction: column; align-items: stretch; }
    .search-box { max-width: 100%; }
    .col-md-6 { width: 100%; }
}

@media (max-width: 575px) {
    .content-wrapper { padding: 8px; }
    .col-6 { width: 50%; }
    .card-body { padding: 14px; }
}

/* Mobile table helpers */
.client-cell-main { display: flex; align-items: center; gap: 10px; }
.client-avatar-sm {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--gradient); display: flex; align-items: center;
    justify-content: center; font-size: 13px; font-weight: 600;
    color: #fff; flex-shrink: 0;
}
.client-name { color: var(--text) !important; font-size: 14px; }
.show-mobile { display: none; }

@media (max-width: 767px) {
    .hide-mobile { display: none !important; }
    .show-mobile { display: block; }
    .table { font-size: 13px; }
    .table td { padding: 10px 12px; white-space: normal; }
    .table th { padding: 10px 12px; font-size: 11px; }
    .btn-sm { padding: 5px 10px; font-size: 11px; }
    .stat-card { padding: 12px; }
    .stat-icon { width: 34px; height: 34px; font-size: 14px; }
    .stat-number { font-size: 16px; }
    .stat-label { font-size: 10px; }
}

/* ========================================
   EMPTY STATE - Componente reutilizable
   ======================================== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: var(--text-secondary);
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--bg-glass);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.empty-state-icon svg {
    width: 28px;
    height: 28px;
}

.empty-state-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.empty-state-desc {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    max-width: 320px;
    line-height: 1.5;
}

.empty-state-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--primary);
    color: #fff !important;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.15s ease;
}

.empty-state-action:hover {
    background: var(--primary-dark, var(--primary));
    transform: translateY(-1px);
    color: #fff !important;
}

/* Empty state para tablas (fila completa) */
.empty-state-row {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-secondary);
}

.empty-state-row svg {
    width: 28px;
    height: 28px;
    margin-bottom: 8px;
    opacity: 0.5;
}

.empty-state-row .empty-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 4px;
}

.empty-state-row .empty-desc {
    font-size: 13px;
}

/* Empty state para charts (overlay dentro de chart-container) */
.chart-empty-state {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    text-align: center;
    color: var(--text-secondary);
}

.chart-empty-state.active {
    display: flex;
}

.chart-empty-state svg {
    width: 32px;
    height: 32px;
    margin-bottom: 10px;
    opacity: 0.4;
}

.chart-empty-state .empty-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 4px;
}

.chart-empty-state .empty-desc {
    font-size: 13px;
}

/* ========================================
   SKELETON LOADERS - Placeholders durante cargas
   Uso:
     <div class="skeleton skeleton-text"></div>
     <div class="skeleton skeleton-line" style="width:60%"></div>
     <div class="skeleton skeleton-circle"></div>
     <div class="skeleton skeleton-card"></div>
   Para listas:
     <div class="skeleton-rows">
       <div class="skeleton skeleton-row"></div>
       <div class="skeleton skeleton-row"></div>
     </div>
   ======================================== */
.skeleton {
    position: relative;
    overflow: hidden;
    background-color: var(--bg-glass);
    border-radius: 6px;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
}
/* Animación shimmer: degradado que se desplaza */
.skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.06) 40%,
        rgba(255, 255, 255, 0.12) 50%,
        rgba(255, 255, 255, 0.06) 60%,
        transparent 100%
    );
    animation: skeletonShimmer 1.4s ease-in-out infinite;
}
[data-theme="light"] .skeleton::after {
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(0, 0, 0, 0.03) 40%,
        rgba(0, 0, 0, 0.06) 50%,
        rgba(0, 0, 0, 0.03) 60%,
        transparent 100%
    );
}
@keyframes skeletonShimmer {
    100% { transform: translateX(100%); }
}

.skeleton-text      { width: 100%; height: 14px; border-radius: 4px; }
.skeleton-line       { width: 100%; height: 10px; border-radius: 4px; }
.skeleton-circle    { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; }
.skeleton-card      { height: 80px; border-radius: var(--radius); border: 1px solid var(--border); }
.skeleton-row       { height: 20px; margin-bottom: 10px; }
.skeleton-block     { height: 280px; border-radius: var(--radius); }

/* Skeleton ocupando todo el chart-container */
.chart-container.has-skeleton { position: relative; }
.chart-container.has-skeleton > canvas,
.chart-container.has-skeleton > .chart-empty-state { display: none !important; }

/* Skeleton stat-cards del dashboard (.stat-card) */
.stat-card-skeleton {
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 14px;
    height: 100%;
}
.stat-card-skeleton .skeleton-circle { width: 44px; height: 44px; border-radius: 10px; }
.stat-card-skeleton .skeleton-text  { height: 20px; width: 60%; margin-bottom: 6px; }
.stat-card-skeleton .skeleton-line  { height: 11px; width: 40%; }

/* Skeleton para listas (.list-group) */
.skeleton-list-item {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}
.skeleton-list-item:last-child { border-bottom: none; }

/* Skeleton para celdas de tabla */
.skeleton-cell { height: 16px; border-radius: 4px; width: 80%; }
.skeleton-cell.skeleton-cell-sm { width: 60%; }
.skeleton-cell.skeleton-cell-lg { width: 90%; }

/* ===== REPORTES FINANCIEROS (PDF y pantalla) ===== */
.report-container {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 32px;
    border: 1px solid var(--border);
}
.report-header-print {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 2px solid var(--border);
}
.report-brand {
    display: flex;
    align-items: center;
    gap: 16px;
}
.report-brand-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: var(--gradient);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}
.report-title {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
    color: var(--text);
}
.report-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin: 2px 0 0 0;
}
.report-period {
    text-align: right;
}
.period-badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    background: rgba(79,70,229,0.1);
    color: var(--primary);
    border: 1px solid rgba(79,70,229,0.2);
}
.summary-card {
    padding: 20px;
    border-radius: 14px;
    text-align: center;
    border: 1px solid var(--border);
    background: var(--bg-card);
}
.summary-card.summary-income { border-left: 4px solid var(--success); }
.summary-card.summary-expense { border-left: 4px solid var(--danger); }
.summary-card.summary-profit { border-left: 4px solid var(--info); }
.summary-card.summary-loss { border-left: 4px solid var(--danger); }
.summary-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 6px;
}
.summary-value {
    font-size: 26px;
    font-weight: 800;
    line-height: 1.2;
}
.summary-count {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}
.report-table-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.report-table-card .table thead th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 2px solid var(--border);
}
.report-table-card .table tfoot td {
    font-size: 13px;
    border-top: 2px solid var(--border);
}

@media print {
    @page {
        margin: 15mm;
        size: A4 portrait;
    }
    body { background: #fff !important; }
    .sidebar, .top-navbar, .main-content > .top-navbar,
    .fab-quick, .toast-container, #pwaInstallBanner,
    .actions-bar, .btn-success, .card-header .badge { display: none !important; }
    .app-container { display: block !important; }
    .main-content { margin-left: 0 !important; padding: 0 !important; }
    .content-wrapper { padding: 0 !important; }
    .report-container {
        border: none !important;
        padding: 0 !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        background: #fff !important;
    }
    .report-header-print {
        border-bottom: 2px solid #1e293b !important;
        margin-bottom: 24px !important;
    }
    .report-title { color: #1e293b !important; font-size: 24px !important; }
    .report-subtitle { color: #64748b !important; }
    .period-badge { background: #eef2ff !important; color: #4f46e5 !important; border: 1px solid #c7d2fe !important; }
    .summary-card {
        border: 1px solid #e2e8f0 !important;
        background: #f8fafc !important;
        page-break-inside: avoid;
    }
    .summary-value { font-size: 28px !important; }
    .card, .report-chart-card, .report-table-card {
        border: 1px solid #e2e8f0 !important;
        box-shadow: none !important;
        background: #fff !important;
        page-break-inside: avoid;
    }
    .card-header {
        background: #f8fafc !important;
        color: #1e293b !important;
        border-bottom: 1px solid #e2e8f0 !important;
    }
    .table { font-size: 11px !important; color: #1e293b !important; }
    .table td, .table th { color: #1e293b !important; border-color: #e2e8f0 !important; }
    .table thead th { color: #64748b !important; }
    .table-active td { background: #f1f5f9 !important; }
    .cat-tag { background: #f1f5f9 !important; color: #475569 !important; }
    .text-success { color: #059669 !important; }
    .text-danger { color: #dc2626 !important; }
    .text-info { color: #0284c7 !important; }
    .chart-container canvas { max-width: 100% !important; }
    .report-summary { margin-bottom: 24px !important; }
    a { text-decoration: none !important; }
    .modal-overlay, .modal-content { display: none !important; }
    .d-flex.flex-wrap.gap-2.align-items-center.justify-content-between { display: none !important; }
}

/* ==========================================================================
   MODULO COLORIMETRÍA / DIAGRAMACIÓN VISUAL
   ========================================================================== */
.colorimetria-module { padding: 0; }
.diagrams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 18px;
}
.diagram-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
    display: flex;
    flex-direction: column;
}
.diagram-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
}
.diagram-card-header {
    padding: 14px 16px 10px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid var(--border-light);
}
.diagram-card-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 4px 0;
    color: var(--text);
    line-height: 1.35;
}
.diagram-card-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 10px;
    font-size: 12px;
    color: var(--text-muted);
}
.diagram-client-link {
    color: var(--primary);
    font-weight: 500;
    text-decoration: none;
}
.diagram-client-link:hover { text-decoration: underline; }
.diagram-date { font-size: 11.5px; opacity: .85; }

.diagram-card-row {
    padding: 8px 16px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.mini-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    color: var(--primary);
}
.mini-chip.chip-neutral { background: var(--bg-hover); color: var(--text); }
.mini-chip.chip-gray { background: #e9ecef; color: #343a40; }

.diagram-preview {
    padding: 10px 16px;
    background: color-mix(in srgb, var(--text) 2%, transparent);
    border-bottom: 1px solid var(--border-light);
    flex: 1;
    min-height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.diagram-preview svg { max-height: 150px; width: auto; }

.diagram-card-footer {
    padding: 10px 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    border-top: 1px solid var(--border-light);
    background: color-mix(in srgb, var(--text) 1.5%, transparent);
}

/* ---- Modal editor ---- */
.cd-grid-main {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
    gap: 24px;
}
.cd-section { margin-bottom: 22px; }
.cd-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}
.cd-formula-row {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-bottom: 12px;
    background: color-mix(in srgb, var(--primary) 2%, var(--bg-card));
}
.cd-formula-row-head { margin-bottom: 10px; }
.cd-formula-row-body .form-label { margin-bottom: 2px; }

/* ---- Diagrama visual SVG ---- */
.cd-col-visual { min-width: 0; }
.cd-sticky {
    position: sticky;
    top: 0;
}
.cd-visual-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding: 10px 12px;
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
}
.cd-color-picker-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}
.cd-color-picker-wrap .form-control-color {
    width: 42px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 2px;
    cursor: pointer;
    background: var(--bg-card);
}
.cd-diagram-container {
    background:
        linear-gradient(45deg, var(--bg-hover) 25%, transparent 25%),
        linear-gradient(-45deg, var(--bg-hover) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, var(--bg-hover) 75%),
        linear-gradient(-45deg, transparent 75%, var(--bg-hover) 75%);
    background-size: 18px 18px;
    background-position: 0 0, 0 9px, 9px -9px, -9px 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    user-select: none;
    -webkit-user-select: none;
    max-width: 100%;
}
.cd-diagram-container svg {
    max-height: 460px;
    width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}
.cd-section { transition: opacity .15s ease; }
.cd-diagram-legend {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    font-size: 12px;
    color: var(--text-muted);
}
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-color {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid var(--border);
}
.legend-dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid var(--border);
}
.legend-dot.pattern-highlights { background: repeating-linear-gradient(45deg,#6366f1,#6366f1 3px,#e0e7ff 3px,#e0e7ff 7px); }
.legend-dot.pattern-balayage { background: linear-gradient(135deg,#c9a36a 0%, #f1e9d7 55%, #c9a36a 100%); }
.legend-dot.pattern-babylights { background: repeating-linear-gradient(55deg,#fef3c7,#fef3c7 2px,#d97706 2px,#d97706 4px); }
.legend-dot.pattern-ombre { background: linear-gradient(#111827 0%, #fde68a 60%, #fff7ed 100%); }

/* ---- View modal ---- */
.cd-view-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 22px;
}
.cd-view-svg-card {
    padding: 18px;
    background: var(--bg-hover);
}
.cd-section-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--bg-card);
    border: 1px solid var(--border);
}
.cd-section-chip-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
    display: inline-block;
    border: 1px solid rgba(0,0,0,.1);
}

/* ---- Responsive ---- */
@media (max-width: 991px) {
    .cd-grid-main, .cd-view-grid {
        grid-template-columns: 1fr;
    }
    .cd-sticky { position: static; }
}
@media (max-width: 575px) {
    .diagrams-grid {
        grid-template-columns: 1fr;
    }
    .cd-visual-toolbar { flex-direction: column; align-items: stretch; }
    .diagram-card-footer .btn { flex: 1 1 auto; }
}

/* Print styles for color diagram view */
@media print {
    .cd-view-grid { grid-template-columns: 1fr 1fr; gap: 14px; }
    .cd-view-svg-card { background: #f8fafc !important; }
    .colorimetria-module > .actions-bar, .top-navbar, .sidebar { display: none !important; }
}

/* Historial colorimetría en perfil cliente */
.client-diagrams-list { }
.client-diagram-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    transition: background-color .15s ease;
}
.client-diagram-item:hover { background: color-mix(in srgb, var(--primary) 3%, transparent); }
.client-diagram-item:last-child { border-bottom: none; }
.cdi-left { flex:1;min-width:0; }
.cdi-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 5px;
}
.cdi-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
}
.cdi-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 10px;
    margin-bottom: 4px;
}
.cdi-desc {
    font-size: 12.5px;
    color: var(--text-muted);
    line-height: 1.45;
    margin-top: 2px;
}
.cdi-actions {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}
.cdi-actions .btn { min-width: 64px; }
@media (max-width: 575px) {
    .client-diagram-item { flex-direction: column; }
    .cdi-actions { width: 100%; }
    .cdi-actions .btn { flex: 1; }
}

/* Touch-first enhancements para diagramación SVG */
.cd-diagram-container {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
}
.cd-diagram-container svg { max-height: 60vh; touch-action: manipulation; }
.cd-section, .cd-guide { 
    -webkit-tap-highlight-color: rgba(99,102,241,0.18); 
    touch-action: manipulation; 
}
.cd-section:hover, .cd-guide:hover { outline: 1.5px solid rgba(99,102,241,0.5); outline-offset: 1px; }

/* Toolbar táctil: controles más grandes */
.cd-visual-toolbar .form-select { min-height: 38px; }
.cd-visual-toolbar input[type="color"] { width: 48px !important; height: 38px !important; }
.btn-xs { padding: 2px 8px; font-size: 11px; }

/* Leyenda zonas activas (drag-remove) */
.cd-zone-tech { color: var(--text-muted); font-size: 11.5px; margin-left: 6px; }
.cd-zone-rm { line-height: 1; padding: 0 5px; margin-left: 4px; }

/* Responsive: editor modal en 1 columna en tablet */
.cd-ref-toggle-wrap { margin-top: 10px; }
.cd-reference-panel {
    margin-top: 10px;
    padding: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    max-height: 280px;
    overflow-y: auto;
}
.cd-ref-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}
.cd-ref-item { position: relative; }
.cd-ref-item img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
    cursor: zoom-in;
    transition: transform .15s ease;
}
.cd-ref-item img:hover { transform: scale(1.03); }
.cd-ref-caption {
    display: block;
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}
@media (max-width: 767px) {
    .cd-ref-images { grid-template-columns: 1fr 1fr; }
    .cd-ref-item img { height: 110px; }
}
@media print { .cd-ref-toggle-wrap, .cd-reference-panel { display: none !important; } }

@media (max-width: 991px) {
    .cd-grid-main { grid-template-columns: 1fr !important; }
    .cd-col-visual { order: -1; }
    .cd-sticky { position: static !important; max-height: none !important; }
    .cd-visual-toolbar { flex-direction: row; flex-wrap: wrap; gap: 8px; }
}
@media (max-width: 767px) {
    .modal-content { width: 98% !important; max-width: 100% !important; max-height: 88vh; }
    .modal-body { max-height: 60vh !important; padding: 14px !important; }
    .cd-formula-row-body .row .col-md-1,
    .cd-formula-row-body .row .col-md-2,
    .cd-formula-row-body .row .col-md-3 { flex: 0 0 50%; max-width: 50%; margin-bottom: 6px; }
    .cd-visual-toolbar input[type="color"] { width: 56px !important; height: 42px !important; }
    .cd-visual-toolbar .form-select { min-height: 42px; font-size: 15px; }
    .cd-zone-rm { padding: 4px 10px; min-height: 32px; }
}

/* ========================================
   HEAD SHEET STUDIO — Editor profesional
   ======================================== */
.hs-editor {
    display: flex; flex-direction: column;
    height: calc(100vh - 64px);
    margin: -16px -20px;
    overflow: hidden;
}
.hs-toolbar {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 14px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0; z-index: 5;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.hs-toolbar-back { white-space: nowrap; }
.hs-toolbar-title { max-width: 220px; font-weight: 600; }
.hs-toolbar-select { max-width: 140px; }
.hs-toolbar-spacer { flex: 1; }

.hs-body {
    display: flex; flex: 1; overflow: hidden;
}

/* ---- Sidebar izquierdo ---- */
.hs-sidebar {
    width: 230px; flex-shrink: 0;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    overflow-y: auto; padding: 12px;
    display: flex; flex-direction: column; gap: 14px;
}
.hs-panel { display: flex; flex-direction: column; gap: 8px; }
.hs-panel-title {
    font-size: 10px; letter-spacing: 0.12em;
    color: var(--text-muted); text-transform: uppercase;
    font-weight: 700; margin-bottom: 2px;
    display: flex; align-items: center; justify-content: space-between;
}
.hs-tools { display: flex; flex-direction: column; gap: 4px; }
.hs-tool-btn {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-main);
    font-size: 13px; font-weight: 500;
    cursor: pointer; transition: all 0.15s ease;
    width: 100%; text-align: left;
}
.hs-tool-btn:hover { background: var(--bg-hover, rgba(0,0,0,0.04)); }
.hs-tool-btn.active {
    background: rgba(231,84,128,0.12);
    border-color: #e75480;
    color: #d63971;
}
.hs-tool-icon { width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--text-muted); }
.hs-tool-btn.active .hs-tool-icon { color: #e75480; }
.hs-tool-btn kbd {
    margin-left: auto; font-size: 9px; padding: 1px 5px;
    background: var(--bg-hover, rgba(0,0,0,0.06));
    border-radius: 4px; color: var(--text-muted);
    border: 1px solid var(--border);
}

/* ---- Estilos de trazo ---- */
.hs-stroke-styles { display: flex; gap: 4px; }
.hs-stroke-style {
    flex: 1; padding: 6px 8px;
    background: var(--bg-hover, #f9fafb);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer; display: flex;
    align-items: center; justify-content: center;
    transition: all 0.15s; color: var(--text-muted);
}
.hs-stroke-style:hover { background: rgba(231,84,128,0.08); }
.hs-stroke-style.active { border-color: #e75480; color: #d63971; background: rgba(231,84,128,0.12); }

/* ---- Presets ---- */
.hs-presets { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.hs-preset-btn {
    padding: 7px 4px;
    background: var(--bg-hover, #f9fafb);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 11px; font-weight: 600;
    color: var(--text-muted); cursor: pointer;
    transition: all 0.15s; text-align: center;
}
.hs-preset-btn:hover {
    background: rgba(231,84,128,0.1);
    color: #d63971; border-color: #e75480;
}

/* ---- Paleta ---- */
.hs-palette { display: flex; flex-direction: column; gap: 6px; }
.hs-palette-group { display: flex; flex-direction: column; gap: 3px; }
.hs-palette-group-label { font-size: 9px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.hs-palette-swatches { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; }
.hs-palette-recent { margin-top: 4px; padding-top: 4px; border-top: 1px dashed var(--border); }
.hs-color-swatch {
    width: 100%; aspect-ratio: 1;
    border-radius: 5px; cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.12s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.12);
}
.hs-color-swatch:hover { transform: scale(1.1); }
.hs-color-swatch.active {
    border-color: var(--text-main);
    box-shadow: 0 0 0 2px #e75480;
}
.hs-custom-color { margin-top: 6px; }
.hs-color-input {
    width: 100%; height: 32px;
    border: 1px solid var(--border); border-radius: 6px;
    background: transparent; cursor: pointer;
}

/* ---- Labels y sliders ---- */
.hs-label {
    display: flex; justify-content: space-between;
    font-size: 11px; color: var(--text-muted);
    margin-bottom: 4px;
}
.hs-slider {
    -webkit-appearance: none; width: 100%;
    height: 4px; background: var(--border);
    border-radius: 2px; outline: none;
}
.hs-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px; height: 16px;
    background: #e75480; border-radius: 50%;
    cursor: pointer; border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.hs-slider::-moz-range-thumb {
    width: 14px; height: 14px;
    background: #e75480; border-radius: 50%;
    cursor: pointer; border: 2px solid white;
}

/* ---- Ayuda ---- */
.hs-help {
    margin-top: auto; padding: 10px;
    border-radius: 8px; border: 1px solid var(--border);
    background: var(--bg-hover, rgba(0,0,0,0.02));
    font-size: 10.5px; color: var(--text-muted); line-height: 1.5;
}
.hs-help p { margin: 0 0 4px 0; }
.hs-help b { color: var(--text-main); }

/* ---- Área de dibujo ---- */
.hs-canvas-area {
    flex: 1; overflow: hidden;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 10px;
    background-color: var(--bg-main, #f8f9fa);
    background-image: radial-gradient(var(--border) 1px, transparent 1px);
    background-size: 16px 16px;
    position: relative;
}
.hs-zoom-bar {
    display: flex; align-items: center; gap: 6px;
    padding: 4px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 8px;
    z-index: 3;
}
.hs-zoom-btn {
    min-width: 32px; min-height: 32px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: 700;
    border-radius: 50% !important;
    padding: 0 !important;
}
.hs-zoom-val {
    font-size: 11px; font-weight: 600;
    color: var(--text-muted);
    min-width: 38px; text-align: center;
}
.hs-canvas-wrap {
    width: 100%; flex: 1;
    display: flex; align-items: stretch; justify-content: stretch;
    min-height: 0;
    position: relative;
}
.hs-canvas-wrap svg {
    width: 100%; height: 100%; min-width: 0; min-height: 0;
    filter: drop-shadow(0 20px 40px rgba(0,0,0,0.08));
}

/* Panel flotante de controles para notas de texto */
.hs-note-panel {
    position: absolute;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    background: rgba(255,255,255,0.96);
    border: 1px solid #d1d5db;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    pointer-events: auto;
}
.hs-note-color-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    gap: 2px;
}
.hs-note-color-label {
    font-size: 9px;
    color: #6b7280;
    font-family: Inter, sans-serif;
    line-height: 1;
}
.hs-note-color-swatch {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1.5px solid #9ca3af;
    display: block;
}
.hs-note-color-btn input[type="color"] {
    width: 0; height: 0; padding: 0; border: none;
    opacity: 0; position: absolute; pointer-events: none;
}
.hs-note-del-btn {
    margin-left: 4px;
    width: 24px; height: 24px;
    display: flex; align-items: center; justify-content: center;
    background: #fee2e2;
    color: #dc3545;
    border: 1px solid #dc3545;
    border-radius: 6px;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}
.hs-note-del-btn:hover { background: #fecaca; }
.hs-bg-catcher { fill: transparent; }
.hs-sketch-outline { fill: #d1d5db; stroke: none; pointer-events: none; }
.hs-draw-zone { fill-opacity: 0.6; stroke: rgba(0,0,0,0.4); stroke-width: 0.3; stroke-dasharray: 1 1; mix-blend-mode: multiply; cursor: pointer; }
.hs-draw-zone:hover { fill-opacity: 0.8; }
.hs-brush-stroke { fill: none; stroke-linecap: round; stroke-linejoin: round; mix-blend-mode: multiply; pointer-events: stroke; cursor: pointer; }
.hs-draw-line { fill: none; stroke-linecap: round; pointer-events: stroke; cursor: pointer; }
.hs-vertex-point { fill: #e75480; stroke: white; stroke-width: 0.5; pointer-events: none; }
.hs-selected { outline: 2px dashed #e75480; outline-offset: 2px; }
.hs-resize-handle { fill: #fff; stroke: #e75480; stroke-width: 2; cursor: nwse-resize; }
.hs-rotate-handle { cursor: crosshair; }
.hs-reference-drop { position: absolute; z-index: 2; top: 12px; right: 12px; padding: 8px; border: 1px dashed var(--primary); background: var(--bg-card); font-size: 11px; color: var(--text-muted); }
.hs-reference-drop input { display: block; max-width: 180px; margin-top: 4px; }
.hs-reference-drop.active { background: var(--primary-bg); }
.hs-voice-controls { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-muted); }
.hs-delete-btn { cursor: pointer; }
.hs-note-input {
    position: fixed; background: var(--bg-card);
    border: 1px solid #e75480; color: var(--text-main);
    padding: 6px 10px; border-radius: 6px;
    font-size: 13px; outline: none; z-index: 9999;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 140px; transform: translate(-50%, -120%);
}

/* ---- Sidebar derecho ---- */
.hs-sidebar-right {
    width: 280px; flex-shrink: 0;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    overflow-y: auto; padding: 12px;
    display: flex; flex-direction: column; gap: 14px;
}
.hs-diag-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hs-diag-field { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--text-muted); }
.hs-diag-field span { font-weight: 500; }
.hs-diag-field .form-control, .hs-diag-field .form-select { font-size: 12px; }

/* ---- Fórmulas ---- */
.hs-formulas-panel { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.hs-formulas-scroll { overflow: auto; flex: 1; -webkit-overflow-scrolling: touch; }
.hs-formula-table { font-size: 11px; min-width: 340px; }
.hs-formula-table th { font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
.hs-formula-table input { font-size: 11px; padding: 3px 6px; }

/* ---- Toast ---- */
.hs-toast {
    position: fixed; bottom: 24px; left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--text-main, #1f2937); color: white;
    padding: 10px 20px; border-radius: 8px;
    font-size: 13px; font-weight: 500;
    opacity: 0; transition: all 0.3s ease;
    z-index: 10001; pointer-events: none;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}
.hs-toast.hs-toast-show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- Favoritos toggle ---- */
.hs-fav-toggle {
    display: flex; align-items: center; gap: 5px;
    font-size: 12px; cursor: pointer; white-space: nowrap;
    color: var(--text-secondary); user-select: none;
}
.hs-fav-toggle input { width: 16px; height: 16px; cursor: pointer; }

/* ---- Botón imagen en zoom bar ---- */
.hs-image-btn {
    display: flex; align-items: center; gap: 5px;
    padding: 4px 12px; border-radius: 6px;
    background: var(--bg-card); border: 1px solid var(--border);
    cursor: pointer; font-size: 13px; color: var(--text);
    transition: background 0.15s; white-space: nowrap;
}
.hs-image-btn:hover { background: var(--bg-main); }

/* ---- Popup buttons ---- */
.hs-popup-btn { font-size: 13px; font-weight: 600; padding: 10px; }

/* ---- Modal ---- */
.hs-modal-overlay {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); z-index: 10000;
    align-items: center; justify-content: center; padding: 20px;
}
.hs-modal-overlay.hs-modal-open { display: flex; }
.hs-modal-box {
    background: var(--bg-card); border-radius: 12px;
    width: 100%; max-width: 640px; max-height: 85vh;
    display: flex; flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.hs-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.hs-modal-header h3 { margin: 0; font-size: 16px; font-weight: 700; }
.hs-modal-close {
    background: none; border: none; font-size: 24px;
    cursor: pointer; color: var(--text-secondary); line-height: 1;
    padding: 0 4px;
}
.hs-modal-close:hover { color: var(--danger); }
.hs-modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.hs-modal-body .hs-formula-table { min-width: 500px; font-size: 13px; }
.hs-modal-body .hs-formula-table input { font-size: 13px; padding: 6px 8px; }
.hs-modal-body .hs-formula-table th { font-size: 11px; }

/* ---- Voice notes list ---- */
.hs-voice-list { display: flex; flex-direction: column; gap: 12px; }
.hs-voice-item {
    display: grid; grid-template-columns: 1fr auto; gap: 8px;
    padding: 10px; border: 1px solid var(--border); border-radius: 8px;
    background: var(--bg-main);
}
.hs-voice-item audio { grid-column: 1 / -1; }
.hs-voice-item .btn { min-width: 36px; }
.hs-voice-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hs-voice-controls span { font-size: 12px; color: var(--text-secondary); }

/* ---- Responsive ---- */
@media (max-width: 1199px) {
    .hs-sidebar-right { width: 240px; }
}
@media (max-width: 991px) {
    .hs-editor { height: auto; margin: -12px -14px; }
    .hs-body { flex-direction: column; }
    .hs-sidebar { width: 100%; max-height: 220px; flex-direction: row; flex-wrap: wrap; gap: 8px; overflow-y: auto; }
    .hs-sidebar .hs-panel { flex: 1 1 170px; min-width: 160px; }
    .hs-help { display: none; }
    .hs-sidebar-right { width: 100%; max-height: 280px; border-left: none; border-top: 1px solid var(--border); overflow-y: auto; }
    .hs-canvas-area { min-height: 420px; padding: 6px; }
    .hs-toolbar { flex-wrap: wrap; gap: 6px; padding: 6px 10px; }
    .hs-toolbar-title { max-width: 100%; flex: 1; min-width: 140px; }
    .hs-toolbar .btn { min-height: 36px; font-size: 13px; }
    .hs-toolbar .btn-sm { padding: 5px 10px; font-size: 12px; }
    .hs-toolbar-select { min-height: 36px; font-size: 13px; max-width: 130px; }
}
@media (max-width: 767px) {
    .hs-sidebar { max-height: 180px; gap: 4px; padding: 8px; }
    .hs-sidebar .hs-panel { flex: 1 1 150px; min-width: 140px; }
    .hs-canvas-area { min-height: 350px; padding: 4px; }
    .hs-toolbar { gap: 4px; padding: 5px 8px; }
    .hs-toolbar .btn { min-height: 34px; font-size: 12px; padding: 4px 8px; }
    .hs-toolbar-select { min-height: 34px; font-size: 12px; max-width: 110px; }
    .hs-toolbar-title { font-size: 12px; }
    .hs-fav-toggle { font-size: 11px; }
    .hs-zoom-btn { min-width: 30px; min-height: 30px; font-size: 14px; }
    .hs-zoom-val { font-size: 10px; min-width: 32px; }
    .hs-zoom-bar { padding: 3px 8px; gap: 4px; }
}
@media (max-width: 575px) {
    .hs-toolbar-select { max-width: 90px; font-size: 11px; }
    .hs-palette { grid-template-columns: repeat(5, 1fr); }
    .hs-diag-grid { grid-template-columns: 1fr; }
    .hs-toolbar-back .btn-text { display: none; }
    .hs-toolbar-title { font-size: 11px; }
    .hs-sidebar .hs-panel { flex: 1 1 130px; min-width: 120px; }
    .hs-canvas-area { min-height: 300px; }
}

/* ---- Touch / Tablet optimization ---- */
@media (pointer: coarse) {
    .hs-touch-controls { display: flex; }
    .hs-tool-btn {
        min-height: 44px; padding: 10px 12px;
        font-size: 14px; gap: 12px;
    }
    .hs-tool-btn kbd { display: none; }
    .hs-tool-icon { width: 24px; height: 24px; }
    .hs-tool-icon svg { width: 22px; height: 22px; }
    .hs-preset-btn { min-height: 40px; font-size: 12px; padding: 10px 4px; }
    .hs-stroke-style { min-height: 40px; padding: 10px 8px; }
    .hs-color-swatch { min-height: 32px; border-radius: 6px; }
    .hs-color-input { height: 40px; }
    .hs-slider { height: 6px; }
    .hs-slider::-webkit-slider-thumb { width: 22px; height: 22px; }
    .hs-slider::-moz-range-thumb { width: 20px; height: 20px; }
    .hs-zoom-btn { min-width: 40px; min-height: 40px; font-size: 18px; }
    .hs-zoom-val { font-size: 13px; min-width: 44px; }
    .hs-formula-table input { font-size: 13px; padding: 6px 8px; min-height: 36px; }
    .hs-formula-table th { font-size: 11px; }
    .hs-diag-field .form-control, .hs-diag-field .form-select { font-size: 14px; min-height: 38px; }
    .hs-canvas-area { padding: 6px; }
    .hs-canvas-wrap { max-width: 100%; }
    .hs-note-input { font-size: 15px; padding: 8px 12px; min-width: 160px; }
    .hs-toolbar { padding: 6px 10px; gap: 6px; }
    .hs-toolbar .btn { min-height: 38px; }
    .hs-toolbar-select, .hs-toolbar-title { font-size: 14px; min-height: 38px; }
    .hs-image-btn { min-height: 40px; padding: 8px 14px; font-size: 14px; }
    .hs-popup-btn { min-height: 44px; font-size: 15px; }
    .hs-fav-toggle { font-size: 14px; }
    .hs-fav-toggle input { width: 20px; height: 20px; }
    .hs-modal-box { max-width: 95vw; }
    .hs-modal-header h3 { font-size: 18px; }
    .hs-modal-close { font-size: 28px; padding: 4px 8px; }
    .hs-modal-body .hs-formula-table input { font-size: 15px; min-height: 40px; }
    .hs-voice-item { padding: 12px; }
    .hs-voice-item input { font-size: 15px; min-height: 38px; }
    .hs-voice-item .btn { min-width: 44px; min-height: 38px; font-size: 18px; }
}
@media print { .hs-sidebar, .hs-sidebar-right, .hs-toolbar { display: none !important; } .hs-canvas-area { background: none; } }

/* ========================================
   OPTIMIZACIÓN TÁCTIL PARA MODALES DE CITAS
   @media (pointer: coarse) → tablets y dispositivos táctiles
   Touch target mínimo: 44x44px. Botones full-width en footer.
   ======================================== */
@media (pointer: coarse) {

    /* --- Modales: mejor scroll táctil --- */
    .modal-content {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
    .modal-overlay {
        -webkit-overflow-scrolling: touch;
    }
    .modal-overlay.active .modal-content {
        animation: modalSlideIn 0.2s ease;
    }

    /* --- Header del modal --- */
    .modal-header {
        padding: 18px 20px 14px;
    }
    .modal-header h3 { font-size: 18px; }

    /* --- Botón cerrar (×) del modal: mínimo 44x44px --- */
    .modal-close {
        min-width: 44px;
        min-height: 44px;
        font-size: 28px;
        padding: 4px 12px;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .modal-close:active { background: var(--bg-hover); transform: scale(0.92); transition: all 0.1s; }
    .modal-close:hover { background: var(--bg-glass); }

    /* --- Body del modal --- */
    .modal-body {
        padding: 18px 20px;
        -webkit-overflow-scrolling: touch;
    }

    /* --- Footer del modal: botones full-width apilados --- */
    .modal-footer {
        padding: 14px 20px 18px;
        flex-direction: column-reverse;
        gap: 8px;
    }
    .modal-footer .btn {
        width: 100%;
        min-height: 48px;
        font-size: 15px;
        padding: 12px 20px;
        border-radius: 10px;
    }
    .modal-footer .btn:active {
        transform: scale(0.97);
        transition: transform 0.1s;
    }

    /* --- Footer grid 2x2 para modales con 4+ botones (detalle de cita) --- */
    .modal-footer-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .modal-footer-grid .btn {
        width: 100%;
        min-height: 48px;
        font-size: 14px;
        padding: 12px 8px;
    }

    /* --- Inputs y selects: más grandes para táctil --- */
    .form-control, .form-select {
        min-height: 44px;
        font-size: 15px;
        padding: 12px 14px;
        border-radius: 10px;
    }
    textarea.form-control {
        min-height: 80px;
        font-size: 15px;
    }

    /* --- Labels más legibles --- */
    .form-label {
        font-size: 14px;
        margin-bottom: 8px;
    }

    /* --- Inputs date/time nativos: optimizar para táctil --- */
    input[type="date"], input[type="time"] {
        min-height: 44px;
        font-size: 15px;
        padding: 10px 14px;
    }
    input[type="date"]::-webkit-inner-spin-button,
    input[type="date"]::-webkit-calendar-picker-indicator,
    input[type="time"]::-webkit-inner-spin-button,
    input[type="time"]::-webkit-calendar-picker-indicator {
        min-width: 44px;
        min-height: 44px;
        cursor: pointer;
    }

    /* --- Botones pequeños: mínimo 40px en táctil --- */
    .btn-sm {
        min-height: 40px;
        padding: 8px 14px;
        font-size: 13px;
    }
    .btn:active {
        transform: scale(0.97);
        transition: transform 0.1s;
    }

    /* --- Botones tipo link dentro de formularios --- */
    .btn-link {
        min-height: 40px;
        padding: 8px 12px;
        font-size: 14px;
    }

    /* --- Autocomplete: items más grandes --- */
    .autocomplete-item {
        padding: 14px 16px;
        font-size: 15px;
        min-height: 48px;
        display: flex;
        align-items: center;
    }
    .autocomplete-item:active {
        background: var(--primary-bg);
        transition: background 0.1s;
    }
    .autocomplete-item:hover { background: var(--bg-glass); }

    /* --- Confirm dialog: botones optimizados --- */
    .confirm-dialog .modal-footer {
        flex-direction: column-reverse;
        gap: 8px;
    }
    .confirm-dialog .btn-confirm-cancel,
    .confirm-dialog .btn-confirm-ok {
        width: 100%;
        min-height: 48px;
        font-size: 15px;
        border-radius: 10px;
    }
    .confirm-dialog .btn-confirm-cancel:active,
    .confirm-dialog .btn-confirm-ok:active {
        transform: scale(0.97);
        transition: transform 0.1s;
    }
    .confirm-dialog .confirm-icon {
        width: 52px;
        height: 52px;
        font-size: 24px;
    }
    .confirm-dialog .confirm-title { font-size: 17px; }
    .confirm-dialog .confirm-message { font-size: 15px; }

    /* --- Quick actions modal: tarjetas más grandes --- */
    .quick-action-card {
        padding: 20px 14px;
        min-height: 100px;
    }
    .quick-action-card:active {
        transform: scale(0.97);
        transition: transform 0.1s;
    }
    .quick-action-card .qa-icon {
        width: 56px;
        height: 56px;
    }
    .quick-action-card .qa-title { font-size: 15px; }
    .quick-action-card .qa-desc { font-size: 12px; }

    /* --- FAB: más grande en táctil --- */
    .fab-quick {
        width: 56px;
        height: 56px;
        font-size: 28px;
        bottom: 20px;
        right: 20px;
    }
    .fab-quick:active { transform: scale(0.92); }

    /* --- Toast: botón cerrar más grande --- */
    .toast-close {
        min-width: 36px;
        min-height: 36px;
        font-size: 20px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .toast-action {
        min-height: 36px;
        padding: 6px 14px;
        font-size: 14px;
    }

    /* --- Badges de estado: más visibles --- */
    .badge {
        padding: 5px 12px;
        font-size: 12px;
    }

    /* --- Service options (checkboxes de servicios) --- */
    .service-option {
        padding: 12px 14px !important;
        min-height: 48px;
        font-size: 15px;
        border-width: 1.5px !important;
        border-radius: 10px !important;
    }
    .service-option:active {
        border-color: var(--primary) !important;
        background: var(--primary-bg) !important;
        transition: all 0.1s;
    }
    .service-option input[type="checkbox"] {
        width: 22px !important;
        height: 22px !important;
    }

    /* --- Extra service items --- */
    .extra-service-item {
        padding: 10px 12px !important;
        min-height: 44px;
        font-size: 14px;
        border-radius: 8px !important;
    }
    .extra-service-item .toast-close,
    .extra-svc-remove {
        min-width: 40px !important;
        min-height: 40px !important;
        font-size: 22px !important;
    }
    .extra-svc-remove:active { background: var(--danger-bg); transform: scale(0.92); transition: all 0.1s; }
}

/* ========================================
   TABLET LANDSCAPE (768px–1024px) CON TÁCTIL
   Ajustes específicos para tablets en horizontal
   ======================================== */
@media (pointer: coarse) and (min-width: 769px) and (max-width: 1024px) {

    /* Modales: no full-width pero sí más anchos */
    .modal-content {
        max-width: 90vw;
        max-height: 90vh;
    }

    /* Footer del modal: botones lado a lado en landscape */
    .modal-footer {
        flex-direction: row;
    }
    .modal-footer .btn {
        width: auto;
        flex: 1;
        min-height: 48px;
    }

    /* Confirm dialog en landscape */
    .confirm-dialog .modal-footer {
        flex-direction: row;
    }
    .confirm-dialog .btn-confirm-cancel,
    .confirm-dialog .btn-confirm-ok {
        width: auto;
        flex: 1;
    }
}

/* ========================================
   OPTIMIZACIÓN TÁCTIL GLOBAL PARA TODOS LOS MÓDULOS
   Finanzas, Clientes, Servicios, Reportes, Configuración, etc.
   ======================================== */
@media (pointer: coarse) {

    /* --- Sidebar: items más grandes para táctil --- */
    .sidebar-nav .nav-link {
        min-height: 48px;
        padding: 12px 18px;
    }
    .sidebar-toggle-desktop {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .sidebar-toggle-desktop:active { transform: scale(0.92); }

    /* --- Actions bar: botones más grandes --- */
    .actions-bar {
        gap: 10px;
        flex-wrap: wrap;
    }
    .actions-bar .btn {
        min-height: 44px;
        padding: 10px 18px;
        font-size: 14px;
    }
    .actions-bar .btn:active {
        transform: scale(0.97);
        transition: transform 0.1s;
    }

    /* --- Search box global --- */
    .search-box {
        min-height: 44px;
    }
    .search-box .form-control {
        min-height: 44px;
        font-size: 15px;
    }
    .search-box .search-icon {
        font-size: 16px;
    }

    /* --- Tablas: más espacio táctil --- */
    .table-responsive-desktop {
        -webkit-overflow-scrolling: touch;
        overflow-x: auto;
    }
    .table {
        font-size: 14px;
    }
    .table th {
        padding: 12px 14px;
        font-size: 13px;
    }
    .table td {
        padding: 12px 14px;
        min-height: 48px;
    }
    .table tbody tr:active {
        background: var(--bg-glass);
        transition: background 0.1s;
    }

    /* --- Botones dentro de tablas: mínimo 40x40px --- */
    .table .btn-sm {
        min-height: 40px;
        min-width: 40px;
        padding: 8px 12px;
        font-size: 13px;
        margin: 2px;
    }
    .table .btn-sm:active {
        transform: scale(0.95);
        transition: transform 0.1s;
    }

    /* --- Botón WhatsApp en tabla de clientes --- */
    .table .btn-whatsapp {
        min-width: 44px;
        min-height: 44px;
        font-size: 18px;
    }

    /* --- Pagination: botones más grandes --- */
    .pagination {
        gap: 4px;
        padding: 8px 0;
    }
    .page-item {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .page-link {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 15px;
        padding: 8px 14px;
        border-radius: 10px !important;
    }
    .page-link:active {
        transform: scale(0.95);
        transition: transform 0.1s;
    }
    .page-item.active .page-link {
        font-weight: 700;
    }

    /* --- Card headers: mejor distribución táctil --- */
    .card-header {
        padding: 14px 18px;
        font-size: 15px;
        flex-wrap: wrap;
        gap: 10px;
    }
    .card-header .btn {
        min-height: 40px;
        padding: 8px 14px;
        font-size: 13px;
    }
    .card-header .btn:active {
        transform: scale(0.97);
        transition: transform 0.1s;
    }

    /* --- Stat cards: más grandes y táctiles --- */
    .stat-card {
        padding: 16px 18px;
        min-height: 80px;
    }
    .stat-card:active {
        transform: scale(0.98);
        transition: transform 0.1s;
    }
    .stat-icon {
        width: 48px;
        height: 48px;
        font-size: 22px;
    }
    .stat-number {
        font-size: 22px;
    }
    .stat-label {
        font-size: 12px;
    }

    /* --- Empty state actions --- */
    .empty-state-action {
        min-height: 44px;
        padding: 10px 20px;
        font-size: 14px;
        border-radius: 10px;
    }
    .empty-state-action:active {
        transform: scale(0.97);
        transition: transform 0.1s;
    }

    /* --- Finances: filtros de período --- */
    .finances-module .form-select-sm,
    .finances-module .form-control-sm {
        min-height: 44px;
        font-size: 14px;
    }
    .finances-module .card-header form {
        gap: 8px;
    }
    .finances-module .card-header .btn {
        min-height: 44px;
    }

    /* --- Finances: cat-tag (categorías de gasto) --- */
    .cat-tag {
        min-height: 36px;
        padding: 6px 14px;
        font-size: 13px;
        display: inline-flex;
        align-items: center;
    }
    .cat-del {
        min-width: 28px;
        min-height: 28px;
        font-size: 18px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-left: 6px;
        cursor: pointer;
    }
    .cat-del:active { transform: scale(0.9); }

    /* --- Reports: botones de período --- */
    .reports-module .btn-sm {
        min-height: 40px;
        padding: 8px 14px;
        font-size: 13px;
    }
    .reports-module .btn-sm:active {
        transform: scale(0.97);
        transition: transform 0.1s;
    }
    .reports-module .form-control-sm {
        min-height: 44px;
        font-size: 14px;
    }
    .reports-module .btn-success {
        min-height: 44px;
        padding: 10px 18px;
        font-size: 14px;
    }

    /* --- Reports: summary cards --- */
    .summary-card {
        padding: 16px 18px;
        min-height: 80px;
    }
    .summary-value {
        font-size: 22px;
    }

    /* --- Settings: botones de mantenimiento --- */
    .settings-module .btn,
    .row.justify-content-center .btn {
        min-height: 44px;
        padding: 10px 18px;
        font-size: 14px;
    }
    .row.justify-content-center .btn:active {
        transform: scale(0.97);
        transition: transform 0.1s;
    }

    /* --- Settings: form submit button full-width --- */
    .row.justify-content-center form .btn[type=submit] {
        min-height: 48px;
        width: 100%;
        margin-top: 8px;
        font-size: 15px;
    }

    /* --- Clients: avatar en tabla --- */
    .client-avatar-sm {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    .client-name {
        font-size: 15px;
    }

    /* --- Chart containers: mejor scroll táctil --- */
    .chart-container {
        -webkit-overflow-scrolling: touch;
        min-height: 280px;
    }

    /* --- Navbar toggle (móvil/tablet) --- */
    .navbar-toggle {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .navbar-toggle:active { transform: scale(0.92); }

    /* --- Notification badge: más grande --- */
    .notification-badge {
        min-width: 24px;
        min-height: 24px;
        font-size: 12px;
    }

    /* --- Form text: más legible --- */
    .form-text {
        font-size: 13px;
        padding: 4px 0;
    }

    /* --- File input: más grande --- */
    input[type="file"] {
        min-height: 44px;
        font-size: 14px;
        padding: 10px;
    }

    /* --- Checkbox y radio inputs: más grandes --- */
    input[type="checkbox"],
    input[type="radio"] {
        width: 20px;
        height: 20px;
        accent-color: var(--primary);
    }

    /* --- Text links en tablas: mínimo touch target --- */
    .table a:not(.btn) {
        min-height: 40px;
        display: inline-flex;
        align-items: center;
        padding: 4px 0;
    }

    /* --- Eliminar hover transforms en tarjetas (causa sticky hover en táctil) --- */
    .stat-card:hover,
    .product-card:hover,
    .stock-kpi:hover {
        transform: none;
    }

    /* --- Sidebar nav en táctil: feedback :active --- */
    .sidebar-nav .nav-link:active {
        background: var(--primary-bg);
        transition: background 0.1s;
    }
}