/**
 * Panel compartido: diseño SaaS con paleta institucional (blanco, azul, verde, naranja).
 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --inst-blue: #2563eb;
    --inst-green: #16a34a;
    --inst-orange: #ea580c;
    --bg-main: #f0f7ff;
    --bg-light: #ffffff;
    --surface: #ffffff;
    --surface-elevated: #f8fbff;
    --surface-muted: #f1f5f9;
    --primary: var(--inst-blue);
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --success: var(--inst-green);
    --success-light: #dcfce7;
    --danger: #dc2626;
    --warning: var(--inst-orange);
    --info: #0284c7;
    --text-dark: #1e3a5f;
    --text-muted: #64748b;
    --text-light: #ffffff;
    --text-gray: #64748b;
    --border: #cfe2f7;
    --border-subtle: #e2e8f0;
    --shadow: 0 1px 3px rgba(37, 99, 235, 0.06), 0 2px 8px rgba(37, 99, 235, 0.04);
    --shadow-md: 0 4px 12px rgba(37, 99, 235, 0.08);
    --shadow-lg: 0 8px 24px rgba(37, 99, 235, 0.1);
    --radius: 8px;
    --radius-sm: 6px;
    --radius-lg: 14px;
    --radius-xl: 16px;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --transition: all 0.2s ease;
    --transition-slow: all 0.3s ease;
    --focus-ring: 2px solid var(--primary);
    --focus-offset: 2px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-sans);
}

/* Skip link (accesibilidad) */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 10000;
    padding: 12px 18px;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    border-radius: var(--radius);
    text-decoration: none;
    box-shadow: var(--shadow-lg);
}

.skip-link:focus {
    left: 16px;
    top: 16px;
    outline: 3px solid #fff;
    outline-offset: 2px;
}

body {
    background: var(--bg-main);
    color: var(--text-dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== HEADER (fondo claro institucional) ===== */
header {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    color: var(--text-dark);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border);
}

header::after {
    content: '';
    display: block;
    height: 3px;
    background: linear-gradient(90deg, var(--inst-blue) 0%, var(--inst-green) 50%, var(--inst-orange) 100%);
}

.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== NAVBAR ===== */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 0;
    position: relative;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-dark);
    text-decoration: none;
}

.brand .brand-text > span:first-child {
    color: var(--primary-dark);
}

.brand-logo-wrap {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
}

.brand-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--inst-blue) 0%, var(--inst-green) 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.brand-subtitle {
    font-size: 12px;
    font-weight: 500;
    color: var(--inst-green);
    opacity: 0.95;
}

.nav-main {
    display: flex;
    align-items: center;
    gap: 5px;
    flex: 1;
    justify-content: center;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    padding: 10px 18px;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    position: relative;
}

.nav-link:hover {
    color: var(--primary-dark);
    background: var(--primary-light);
}

.nav-link.active {
    color: var(--primary-dark);
    background: var(--primary-light);
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.15);
}

.nav-link.active::after {
    display: none;
}

.user-menu {
    position: relative;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--inst-blue) 0%, var(--inst-green) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--text-light);
    border: 2px solid rgba(37, 99, 235, 0.25);
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-dark);
}

.user-role {
    font-size: 12px;
    color: var(--text-gray);
}

.user-trigger {
    background: #f1f5f9;
    color: var(--text-dark);
    border: 1px solid var(--border);
    padding: 7px 10px;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: var(--transition);
}

.user-trigger:hover,
.user-trigger:focus-visible {
    background: var(--primary-light);
    border-color: rgba(37, 99, 235, 0.35);
    outline: none;
}

.user-chevron {
    font-size: 12px;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.user-menu.open .user-chevron {
    transform: rotate(180deg);
}

.user-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    min-width: 240px;
    background: #ffffff;
    color: var(--text-dark);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 1100;
    display: none;
    overflow: hidden;
}

.user-menu.open .user-dropdown {
    display: block;
}

.dropdown-user-head {
    padding: 14px;
    background: linear-gradient(180deg, #f0f9ff 0%, #f8fafc 100%);
    border-bottom: 1px solid var(--border);
}

.dropdown-user-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
}

.dropdown-user-role {
    margin-top: 2px;
    font-size: 12px;
    color: var(--text-gray);
}

.dropdown-actions {
    padding: 8px;
}

.dropdown-link {
    width: 100%;
    text-decoration: none;
    border: none;
    background: transparent;
    color: var(--text-dark);
    font-size: 14px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.dropdown-link:hover {
    background: #f1f5f9;
}

.dropdown-link.logout {
    color: #b91c1c;
}

.dropdown-link.logout:hover {
    background: #fee2e2;
}

.logout-btn {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.logout-btn:hover {
    background: var(--danger);
    color: var(--text-light);
    border-color: var(--danger);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--primary-dark);
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: var(--transition);
}

.menu-toggle:hover {
    background: var(--primary-light);
}

.main {
    flex: 1;
    padding: 30px 0;
}

.page-header {
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    box-shadow: var(--shadow);
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-title i {
    color: var(--primary);
}

.page-header-main {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.page-description {
    font-size: 14px;
    color: var(--text-gray);
    font-weight: 400;
    line-height: 1.5;
    margin: 0;
}

.page-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-ui {
    border: none;
    border-radius: var(--radius);
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    cursor: pointer;
}

.btn-ui.primary {
    background: linear-gradient(135deg, var(--inst-blue) 0%, var(--primary-dark) 100%);
    color: var(--text-light);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-ui.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.35);
}

.btn-ui.success {
    background: linear-gradient(135deg, var(--inst-green) 0%, #15803d 100%);
    color: var(--text-light);
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

.btn-ui.success:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(22, 163, 74, 0.35);
}

.btn-ui.ghost {
    background: var(--bg-light);
    color: var(--text-dark);
    border: 1px solid var(--border);
}

.btn-ui.ghost:hover {
    border-color: var(--inst-orange);
    color: var(--inst-orange);
    background: #fff7ed;
}

.btn-ui.danger,
.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #b91c1c 100%);
    color: var(--text-light);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}

.btn-ui.danger:hover,
.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(220, 38, 38, 0.3);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    color: var(--text-gray);
    flex-wrap: wrap;
}

.breadcrumb a {
    color: var(--text-gray);
    text-decoration: none;
    transition: var(--transition);
}

.breadcrumb a:hover {
    color: var(--primary);
}

.breadcrumb i {
    font-size: 12px;
}

/* Alertas reutilizables */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 14px;
    line-height: 1.45;
    border: 1px solid transparent;
    animation: panelSlideDown 0.25s ease;
}

.alert i {
    flex-shrink: 0;
    margin-top: 2px;
    font-size: 18px;
}

.alert-success {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    color: #065f46;
    border-color: #6ee7b7;
}

.alert-error {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    color: #991b1b;
    border-color: #fca5a5;
}

.alert-warning {
    background: linear-gradient(135deg, #ffedd5, #fed7aa);
    color: #9a3412;
    border-color: #fb923c;
}

.alert-info {
    background: linear-gradient(135deg, #e0f2fe, #bae6fd);
    color: #0369a1;
    border-color: #7dd3fc;
}

/* Toasts */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 12000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: min(400px, calc(100vw - 32px));
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius);
    background: var(--bg-light);
    color: var(--text-dark);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: auto;
}

.toast.toast--show {
    opacity: 1;
    transform: translateY(0);
}

.toast-success {
    border-left: 4px solid var(--success);
}

.toast-error {
    border-left: 4px solid var(--danger);
}

.toast i {
    color: var(--success);
    font-size: 18px;
}

.toast-error i {
    color: var(--danger);
}

/* Focus visible (accesibilidad) */
.brand:focus-visible {
    outline: var(--focus-ring);
    outline-offset: 4px;
    border-radius: 10px;
}

.nav-link:focus-visible,
.btn-ui:focus-visible,
.user-trigger:focus-visible,
.menu-toggle:focus-visible,
.dropdown-link:focus-visible,
.skip-link:focus-visible {
    outline: var(--focus-ring);
    outline-offset: var(--focus-offset);
}

.main input:focus-visible,
.main select:focus-visible,
.main textarea:focus-visible,
.main button:focus-visible {
    outline: var(--focus-ring);
    outline-offset: var(--focus-offset);
}

/* Status badges (layout) */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    gap: 6px;
}

.status-active {
    background: #d1fae5;
    color: #065f46;
}

.status-warning {
    background: #fef3c7;
    color: #92400e;
}

.status-expired {
    background: #fee2e2;
    color: #991b1b;
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 4px;
}

/* ===== SHARED PAGE COMPONENTS ===== */

.section-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: var(--space-5);
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title i {
    color: var(--primary);
}

.page-toolbar,
.destinatarios-header,
.notificaciones-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-6);
    flex-wrap: wrap;
    gap: var(--space-5);
}

.page-toolbar {
    justify-content: flex-end;
}

.header-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.btn-new,
.btn-add-service {
    background: linear-gradient(135deg, var(--success), #10b981);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-slow);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.btn-new:hover,
.btn-add-service:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.3);
    background: linear-gradient(135deg, #0da271, #0e9e6e);
}

/* Stats & dashboard grids */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: var(--space-10);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-5);
    margin-bottom: var(--space-6);
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-md);
    transition: var(--transition-slow);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.stat-card.warning { border-left-color: var(--warning); }
.stat-card.danger { border-left-color: var(--danger); }
.stat-card.success { border-left-color: var(--success); }
.stat-card.info { border-left-color: var(--info); }

.dashboard-grid .stat-card {
    border-left-width: 5px;
    padding: 25px;
}

.dashboard-grid .stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    background: rgba(37, 99, 235, 0.05);
    border-radius: 0 0 0 100%;
}

.dashboard-grid .stat-card.warning::before { background: rgba(234, 88, 12, 0.05); }
.dashboard-grid .stat-card.danger::before { background: rgba(220, 38, 38, 0.05); }
.dashboard-grid .stat-card.success::before { background: rgba(22, 163, 74, 0.05); }
.dashboard-grid .stat-card.info::before { background: rgba(2, 132, 199, 0.05); }

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-5);
    font-size: 22px;
    color: white;
    background: linear-gradient(135deg, var(--primary), #6366f1);
    flex-shrink: 0;
}

.stats-grid .stat-card {
    display: flex;
    align-items: center;
    gap: 15px;
}

.stats-grid .stat-icon {
    margin-bottom: 0;
}

.stat-card .stat-icon {
    background: linear-gradient(135deg, var(--primary), #6366f1);
}

.stat-card.warning .stat-icon { background: linear-gradient(135deg, var(--warning), #f97316); }
.stat-card.danger .stat-icon { background: linear-gradient(135deg, var(--danger), #ef4444); }
.stat-card.success .stat-icon { background: linear-gradient(135deg, var(--success), #10b981); }
.stat-card.info .stat-icon { background: linear-gradient(135deg, var(--info), #0ea5e9); }

.stat-content { flex: 1; }

.stat-content h3 {
    font-size: 14px;
    color: var(--text-gray);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.stat-number {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1;
    margin-bottom: 5px;
}

.dashboard-grid .stat-number { font-size: 36px; }

.stat-label,
.stat-change {
    font-size: 13px;
    color: var(--text-gray);
}

.stat-change {
    display: flex;
    align-items: center;
    gap: 5px;
}

.stat-change.positive { color: var(--success); }
.stat-change.negative { color: var(--danger); }

/* Action cards */
.quick-actions { margin-bottom: var(--space-10); }

.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-5);
}

.action-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 25px;
    text-decoration: none;
    color: inherit;
    transition: var(--transition-slow);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.action-card:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.action-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--inst-green));
}

.action-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--primary-light), white);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-5);
    font-size: 24px;
    color: var(--primary);
    border: 1px solid var(--border);
}

.action-card:hover .action-icon {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.action-card h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 10px;
}

.action-card p {
    color: var(--text-gray);
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 15px;
}

.action-btn {
    color: var(--primary);
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: var(--transition);
}

.action-card:hover .action-btn { transform: translateX(5px); }

/* Recent activity */
.recent-activity {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 25px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding-bottom: var(--space-5);
    border-bottom: 1px solid var(--border);
}

.activity-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 16px;
    flex-shrink: 0;
}

.activity-content { flex: 1; }

.activity-title {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.activity-time {
    font-size: 12px;
    color: var(--text-gray);
}

.activity-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-success { background: #d1fae5; color: #065f46; }
.status-warning { background: #fef3c7; color: #92400e; }
.status-danger { background: #fee2e2; color: #991b1b; }

/* Tables */
.table-container {
    background: var(--surface);
    border-radius: var(--radius-lg);
    overflow: clip;
    box-shadow: var(--shadow-md);
    margin-bottom: var(--space-6);
    overflow-x: auto;
    border: 1px solid var(--border);
}

.services-table,
.users-table,
.destinatarios-table,
.notificaciones-table,
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.services-table { min-width: 1180px; }
.users-table,
.destinatarios-table { min-width: 800px; }
.notificaciones-table { min-width: 900px; }

.services-table thead,
.users-table thead,
.destinatarios-table thead,
.notificaciones-table thead,
.data-table thead {
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border-bottom: 2px solid var(--border);
}

.services-table th,
.users-table th,
.destinatarios-table th,
.notificaciones-table th,
.data-table th {
    padding: 18px 20px;
    text-align: left;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.services-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
}

.services-table tbody tr,
.users-table tbody tr,
.destinatarios-table tbody tr,
.notificaciones-table tbody tr,
.data-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

.services-table tbody tr:hover,
.users-table tbody tr:hover,
.destinatarios-table tbody tr:hover,
.notificaciones-table tbody tr:hover,
.data-table tbody tr:hover {
    background: var(--surface-muted);
}

.services-table td,
.users-table td,
.destinatarios-table td,
.notificaciones-table td,
.data-table td {
    padding: 20px;
    color: var(--text-dark);
    vertical-align: middle;
}

.services-table tbody tr:nth-child(even):not(.row-warning):not(.row-danger):not(.row-inactive) {
    background: rgba(248, 250, 252, 0.9);
}

.services-table tbody tr.row-warning { background: #fff7ed; border-left: 4px solid var(--warning); }
.services-table tbody tr.row-danger { background: #fee2e2; border-left: 4px solid var(--danger); }
.services-table tbody tr.row-active { border-left: 4px solid var(--success); }
.services-table tbody tr.row-inactive { background: #f8fafc; border-left: 4px solid #94a3b8; opacity: 0.8; }

/* Filters */
.table-filters,
.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-5);
    flex-wrap: wrap;
    gap: 15px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-3);
    box-shadow: var(--shadow);
}

.filter-group {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-dark);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.filter-btn:hover:not(.active) {
    border-color: var(--primary);
    color: var(--primary);
}

.search-box {
    position: relative;
    min-width: 250px;
}

.search-box input,
.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    transition: var(--transition);
    background: var(--surface);
    color: var(--text-dark);
}

.search-box input {
    padding-left: 40px;
}

.search-box input:focus,
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.search-box i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-gray);
    font-size: 14px;
}

.ownership-legend {
    margin: 0 0 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    color: var(--text-gray);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.ownership-legend i {
    color: var(--primary);
}

/* Table record cells */
.table-container .user-info,
.destinatarios-table .user-info,
.users-table .user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.table-container .user-avatar,
.destinatarios-table .user-avatar,
.users-table .user-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--info));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 16px;
    flex-shrink: 0;
    border: 2px solid var(--border-subtle);
}

.table-container .user-details,
.destinatarios-table .user-details,
.users-table .user-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.table-container .user-name,
.destinatarios-table .user-name,
.users-table .user-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-dark);
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-id {
    font-size: 12px;
    color: var(--text-gray);
}

.role-badge {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.role-admin { background: #dbeafe; color: #1e40af; }
.role-admon { background: #fef3c7; color: #92400e; }
.role-asistente,
.role-viewer { background: #e0f2fe; color: #0369a1; }

.status-inactive { background: #f1f5f9; color: #64748b; }
.status-danger { background: #fee2e2; color: #991b1b; }

.date-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.date-value {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-dark);
}

.date-ago {
    font-size: 12px;
    color: var(--text-gray);
    font-style: italic;
}

.date-cell { min-width: 170px; }

.date-days {
    font-size: 13px;
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 500;
    display: inline-block;
}

.days-positive { background: #d1fae5; color: #065f46; }
.days-warning { background: #fef3c7; color: #92400e; }
.days-danger { background: #fee2e2; color: #991b1b; }
.days-inactive { background: #f1f5f9; color: #475569; }

/* Service table specifics */
.service-name {
    font-weight: 600;
    font-size: 16px;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.service-description {
    margin-top: 8px;
    color: var(--text-gray);
    font-size: 13px;
    line-height: 1.45;
    max-width: 460px;
}

.service-meta {
    font-size: 13px;
    color: var(--text-gray);
    display: flex;
    align-items: center;
    gap: 10px;
}

.service-meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.ownership-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.ownership-mine { background: #dcfce7; color: #166534; }
.ownership-other { background: #e2e8f0; color: #334155; }

.recordatorios-cell {
    font-size: 13px;
    color: var(--text-dark);
    max-width: 200px;
    line-height: 1.4;
}

.recordatorios-cell.muted {
    color: var(--text-gray);
    font-style: italic;
}

.destinatarios-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 330px;
    max-height: 160px;
    overflow: auto;
    padding-right: 4px;
}

.destinatario-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--surface-muted);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.destinatario-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #6366f1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 12px;
    flex-shrink: 0;
}

.destinatario-info { flex: 1; min-width: 0; }

.destinatario-name {
    font-weight: 500;
    font-size: 13px;
    color: var(--text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.destinatario-email {
    font-size: 12px;
    color: var(--text-gray);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.no-destinatarios {
    color: var(--text-gray);
    font-size: 13px;
    font-style: italic;
    padding: 10px;
    background: var(--surface-muted);
    border-radius: var(--radius);
    text-align: center;
}

.type-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #e0f2fe;
    color: #0369a1;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid #bae6fd;
    max-width: 240px;
}

.type-badge span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Row actions */
.actions-cell { min-width: 210px; }

.actions-container {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.users-table .actions-container {
    justify-content: flex-end;
}

.btn-action {
    padding: 8px 12px;
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    min-height: 34px;
}

.users-table .btn-action {
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
}

.btn-edit { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.btn-edit:hover { background: #dbeafe; color: #1e3a8a; transform: translateY(-1px); }
.btn-deactivate { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.btn-deactivate:hover { background: #fef3c7; color: #78350f; transform: translateY(-1px); }
.btn-activate { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.btn-activate:hover { background: #d1fae5; color: #064e3b; transform: translateY(-1px); }
.btn-delete { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.btn-delete:hover { background: #fee2e2; color: #991b1b; transform: translateY(-1px); }

.users-table .btn-edit { background: var(--primary-light); color: var(--primary); border: none; }
.users-table .btn-edit:hover { background: var(--primary); color: white; box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3); }
.users-table .btn-delete { background: #fee2e2; color: var(--danger); border: none; }
.users-table .btn-delete:hover { background: var(--danger); color: white; box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3); }

.no-permissions {
    color: var(--text-gray);
    font-size: 13px;
    font-style: italic;
    padding: 8px 12px;
    background: var(--surface-muted);
    border-radius: var(--radius-sm);
}

/* Mobile service cards */
.services-mobile-list {
    display: none;
    gap: 14px;
    flex-direction: column;
    margin-top: 12px;
    margin-bottom: var(--space-6);
}

.service-mobile-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px;
    box-shadow: var(--shadow);
}

.service-mobile-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.service-mobile-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.service-mobile-meta {
    font-size: 12px;
    color: var(--text-gray);
}

.service-mobile-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 12px;
}

.mobile-label {
    font-size: 11px;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 4px;
}

.mobile-destinatarios {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.mobile-destinatario-chip {
    background: var(--surface-muted);
    border: 1px solid var(--border);
    color: #334155;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 999px;
}

/* Notificaciones */
.notificaciones-container,
.destinatarios-container {
    max-width: 1400px;
    margin: 0 auto;
}

.destinatarios-container { max-width: 1200px; }

.service-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.service-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), #6366f1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    flex-shrink: 0;
}

.service-details { flex: 1; min-width: 0; }

.user-email {
    font-size: 13px;
    color: var(--text-gray);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.service-type {
    font-size: 12px;
    color: var(--text-gray);
    background: var(--surface-muted);
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
}

.tipo-cell { min-width: 150px; }

.tipo-badge {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.tipo-vencimiento { background: #fee2e2; color: #991b1b; }
.tipo-recordatorio { background: #fef3c7; color: #92400e; }
.tipo-renovacion { background: #d1fae5; color: #065f46; }
.tipo-general { background: #dbeafe; color: #1e40af; }

.date-time {
    font-size: 13px;
    color: var(--text-gray);
    display: flex;
    align-items: center;
    gap: 5px;
}

.id-cell {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: var(--text-gray);
}

.service-extra {
    font-size: 13px;
    color: var(--text-gray);
}

.export-btn {
    background: var(--surface);
    color: var(--primary);
    border: 1px solid var(--border);
    padding: 10px 20px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition-slow);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.export-btn:hover {
    border-color: var(--primary);
    background: var(--surface-elevated);
    transform: translateY(-1px);
}

.header-left h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-left h1 i { color: var(--primary); }

.header-left p {
    color: var(--text-gray);
    font-size: 15px;
}

.stat-card.muted .stat-icon {
    background: linear-gradient(135deg, #64748b, #94a3b8);
}

.hidden { display: none !important; }

.view-toggle {
    display: flex;
    gap: 8px;
    align-items: center;
}

.view-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.view-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.view-btn:hover:not(.active) {
    border-color: var(--primary);
    color: var(--primary);
}

.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-5);
    margin-bottom: var(--space-6);
}

.destinatario-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 25px;
    box-shadow: var(--shadow-md);
    transition: var(--transition-slow);
    border: 1px solid var(--border);
    border-top: 4px solid var(--primary);
    position: relative;
}

.destinatario-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: var(--space-5);
}

.card-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--info));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 20px;
    flex-shrink: 0;
    border: 3px solid var(--border-subtle);
}

.card-info { flex: 1; min-width: 0; }

.card-name {
    font-weight: 700;
    font-size: 18px;
    color: var(--text-dark);
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-email {
    font-size: 14px;
    color: var(--text-gray);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-body { margin-bottom: var(--space-5); }

.card-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-gray);
}

.meta-item i {
    width: 16px;
    color: var(--primary);
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: var(--space-5);
    border-top: 1px solid var(--border);
}

.card-status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.card-actions {
    display: flex;
    gap: 8px;
}

.form-hint-block {
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-gray);
}

.form-link {
    color: var(--primary);
    font-weight: 500;
    text-decoration: none;
}

.form-link:hover { text-decoration: underline; }

.alert-inline-success {
    padding: 14px 16px;
    background: #d1fae5;
    border-radius: 10px;
    color: #065f46;
    font-weight: 500;
}

.validation-message {
    font-size: 12px;
    color: var(--danger);
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.validation-message.show {
    opacity: 1;
}

.preview-card {
    background: var(--surface-muted);
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
    border: 1px dashed var(--border);
    display: none;
}

.preview-card.show {
    display: block;
    animation: slideDown 0.3s ease;
}

.preview-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.preview-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--info));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 16px;
    flex-shrink: 0;
}

.preview-info { flex: 1; }

.preview-name {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 3px;
}

.preview-email {
    font-size: 14px;
    color: var(--text-gray);
}

.preview-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.preview-detail {
    font-size: 14px;
    color: var(--text-gray);
}

.preview-detail i {
    margin-right: 8px;
    color: var(--info);
    width: 16px;
}

.success-state {
    text-align: center;
    padding: 40px 20px;
}

.success-state i {
    font-size: 64px;
    color: var(--success);
    margin-bottom: 20px;
}

.success-state h2 {
    color: var(--success);
    margin-bottom: 10px;
}

.success-state p {
    color: var(--text-gray);
    margin-bottom: 20px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

/* Forms */
.form-container {
    max-width: 800px;
    margin: 0 auto;
}

.form-container--narrow { max-width: 600px; }

.form-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: var(--space-10);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.form-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--success));
}

.form-card-title {
    margin-top: 0;
    margin-bottom: var(--space-5);
    font-size: 1.25rem;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-card-title i { color: var(--primary); }

.form-header {
    margin-bottom: var(--space-6);
    text-align: center;
}

.form-header-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--primary), #6366f1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-5);
    color: white;
    font-size: 28px;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25);
}

.form-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.form-subtitle {
    color: var(--text-gray);
    font-size: 15px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
    margin-bottom: var(--space-6);
}

.form-group { margin-bottom: var(--space-5); }

.form-grid .form-group { margin-bottom: 0; }
.form-group.full-width { grid-column: 1 / -1; }

.form-section-title {
    grid-column: 1 / -1;
    margin: 4px 0 -5px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 14px;
}

.form-label i { color: var(--primary); width: 16px; }
.form-label .required { color: var(--danger); margin-left: 4px; }
.form-label small { font-weight: 400; color: var(--text-gray); }

.form-textarea { min-height: 120px; resize: vertical; }

.form-hint,
.form-group small {
    display: block;
    margin-top: 5px;
    color: var(--text-gray);
    font-size: 13px;
}

.input-with-icon { position: relative; }

.input-with-icon .form-input,
.input-with-icon input {
    padding-right: 44px;
}

.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-gray);
    cursor: pointer;
    font-size: 14px;
    padding: 5px;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
    margin-top: 10px;
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
    background: var(--surface-muted);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.checkbox-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}

.checkbox-item:hover {
    border-color: var(--primary);
    background: #f0f9ff;
}

.checkbox-item input[type="checkbox"] {
    margin-right: 12px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

.checkbox-info { flex: 1; }

.checkbox-name {
    font-weight: 500;
    color: var(--text-dark);
    font-size: 14px;
    margin-bottom: 2px;
}

.checkbox-email { font-size: 12px; color: var(--text-gray); }

.dias-chip-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.dia-chip { position: relative; }
.dia-chip input { position: absolute; opacity: 0; pointer-events: none; }

.dia-chip span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-muted);
    color: var(--text-dark);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.dia-chip input:checked + span {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.dias-extra-input { margin-top: 10px; }

.dias-resumen {
    margin-top: 10px;
    font-size: 13px;
    color: var(--text-gray);
    background: var(--surface-muted);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: var(--space-10);
    padding-top: var(--space-6);
    border-top: 1px solid var(--border);
    justify-content: flex-end;
}

.btn-submit,
.btn-cancel {
    padding: 14px 32px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-slow);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
}

.btn-submit {
    background: linear-gradient(135deg, var(--success), #10b981);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 163, 74, 0.3);
}

.btn-submit:hover {
    background: linear-gradient(135deg, #0da271, #0e9e6e);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 163, 74, 0.4);
}

.btn-submit.primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.btn-submit.primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), #1e40af);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
}

.btn-submit.loading {
    opacity: 0.8;
    pointer-events: none;
}

.btn-submit.loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

.btn-cancel {
    background: var(--surface-muted);
    color: var(--text-dark);
    border: 1px solid var(--border);
}

.btn-cancel:hover {
    background: #e2e8f0;
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}

.date-input-container { position: relative; }

.date-input-container i {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-gray);
    pointer-events: none;
}

.char-counter {
    text-align: right;
    font-size: 12px;
    color: var(--text-gray);
    margin-top: 5px;
}

.char-counter.warning { color: var(--warning); }
.char-counter.danger { color: var(--danger); }

.password-strength {
    margin-top: 8px;
    height: 4px;
    background: var(--border-subtle);
    border-radius: 2px;
    overflow: hidden;
}

.strength-bar {
    height: 100%;
    width: 0;
    transition: width 0.3s ease;
    border-radius: 2px;
}

.strength-weak { background: var(--danger); }
.strength-medium { background: var(--warning); }
.strength-strong { background: var(--success); }

.password-hints {
    margin-top: 10px;
    padding: 10px;
    background: var(--surface-muted);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-gray);
}

.password-hints ul {
    margin: 5px 0 0 20px;
    padding: 0;
}

.password-hints li { margin-bottom: 3px; }

.alert-action {
    margin-left: auto;
    background: var(--success);
    color: white;
    padding: 5px 15px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.text-muted-sm {
    font-size: 13px;
    color: var(--text-gray);
}

.text-muted-sm.italic { font-style: italic; }

.text-dark-sm {
    font-size: 13px;
    color: var(--text-dark);
}

.text-subtle-xs {
    font-size: 11px;
    color: var(--text-gray);
    margin-top: 2px;
}

.icon-primary { color: var(--primary); margin-right: 5px; }
.icon-info { color: var(--info); margin-right: 5px; }

.mb-sm { margin-bottom: 10px; }

/* Empty states */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 2px dashed var(--border);
}

.empty-state i {
    font-size: 64px;
    color: var(--border);
    margin-bottom: var(--space-5);
    opacity: 0.5;
}

.empty-state h3 {
    color: var(--text-gray);
    margin-bottom: 10px;
    font-size: 18px;
}

.empty-state p {
    color: var(--text-gray);
    font-size: 14px;
    max-width: 400px;
    margin: 0 auto 20px;
}

.skeleton-row {
    display: flex;
    padding: 20px;
    border-bottom: 1px solid var(--border);
    gap: 20px;
    align-items: center;
}

.skeleton-cell {
    flex: 1;
    height: 20px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 4px;
}

/* Component responsive */
@media (max-width: 768px) {
    .dashboard-grid,
    .actions-grid { grid-template-columns: 1fr; }

    .stats-grid { grid-template-columns: repeat(2, 1fr); }

    .form-grid { grid-template-columns: 1fr; gap: 20px; }

    .services-desktop-only { display: none; }
    .services-mobile-list { display: flex; }

    .table-filters,
    .filter-bar { flex-direction: column; align-items: stretch; }

    .filter-group { justify-content: center; }
    .search-box { min-width: 100%; }

    .services-table th,
    .services-table td,
    .users-table th,
    .users-table td { padding: 15px; }

    .actions-container {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .btn-action { justify-content: center; width: 100%; }

    .table-container .user-info,
    .users-table .user-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .activity-item { flex-direction: column; align-items: flex-start; gap: 10px; }
}

@media (max-width: 576px) {
    .form-card { padding: 25px; }
    .form-actions { flex-direction: column-reverse; }
    .form-actions a,
    .form-actions button { width: 100%; text-align: center; }
    .checkbox-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .stat-number { font-size: 28px; }
    .actions-container { grid-template-columns: 1fr; }
    .service-meta { flex-direction: column; align-items: flex-start; gap: 5px; }
    .destinatario-item { flex-direction: column; text-align: center; padding: 12px; }
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes panelSlideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .nav-link.active::after,
    .user-menu.open .user-chevron {
        transition: none !important;
    }

    .logout-btn:hover {
        transform: none;
    }

    .btn-ui.primary:hover,
    .btn-ui.success:hover {
        transform: none;
    }

    .toast {
        transition: none;
    }

    .skeleton {
        animation: none;
        background: #e2e8f0;
    }
}

@media (max-width: 1024px) {
    .nav-main {
        gap: 3px;
    }

    .nav-link {
        padding: 10px 14px;
        font-size: 14px;
    }

    .brand-text span:first-child {
        font-size: 20px;
    }
}

@media (max-width: 768px) {
    .navbar {
        flex-wrap: wrap;
    }

    .menu-toggle {
        display: block;
        order: 1;
    }

    .brand {
        order: 0;
        flex: 1;
    }

    .nav-main {
        order: 3;
        flex: 1 0 100%;
        flex-direction: column;
        align-items: stretch;
        background: var(--bg-light);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        padding: 10px;
        margin-top: 15px;
        display: none;
        animation: slideDown 0.3s ease;
        box-shadow: var(--shadow);
    }

    .nav-main.active {
        display: flex;
    }

    .nav-link {
        padding: 12px 15px;
        justify-content: flex-start;
        border-radius: 6px;
        margin-bottom: 5px;
    }

    .nav-link.active::after {
        display: none;
    }

    .nav-link.active {
        background: rgba(37, 99, 235, 0.12);
        color: var(--primary-dark);
    }

    .user-menu {
        order: 2;
        align-items: flex-end;
        width: auto;
    }

    .user-trigger {
        padding: 6px 8px;
    }

    .user-info {
        gap: 8px;
    }

    .user-dropdown {
        right: 0;
        min-width: 220px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 14px;
    }

    .page-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .toast-container {
        left: 16px;
        right: 16px;
        bottom: 16px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    .brand {
        font-size: 18px;
    }

    .brand-logo-wrap {
        width: 36px;
        height: 36px;
    }

    .brand-icon {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }

    .brand-subtitle {
        display: none;
    }

    .page-title {
        font-size: 24px;
    }

    .user-avatar {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .user-details {
        display: none;
    }

    .user-chevron {
        display: inline-block;
    }

    .user-dropdown {
        min-width: 200px;
        right: -6px;
    }
}
