:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --primary-subtle: rgba(37, 99, 235, 0.1);
    --cyan: #06b6d4;
    --cyan-glow: rgba(6, 182, 212, 0.25);
    --header-bg: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --bg-page: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --border-focus: #3b82f6;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --success: #10b981;
    --success-light: #ecfdf5;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset y Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Header */
.app-header {
    background: var(--header-bg);
    color: white;
    padding: 1rem 1.25rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.brand-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary) 0%, var(--cyan) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px var(--cyan-glow);
    flex-shrink: 0;
}

.brand-icon svg {
    width: 24px;
    height: 24px;
    color: white;
}

.brand-text h1 {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.brand-text h1 span {
    background: linear-gradient(90deg, #38bdf8, #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-subtitle {
    font-size: 0.75rem;
    color: #94a3b8;
    display: block;
    font-weight: 500;
}

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

/* Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.status-badge.online .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #22c55e;
    box-shadow: 0 0 8px #22c55e;
}

.status-badge.offline .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--danger);
    box-shadow: 0 0 8px var(--danger);
}

/* Botón Instalar en Header */
.btn-install-header {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #2563eb, #0284c7);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.5rem 0.9rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
    transition: var(--transition);
    animation: pulseGlow 2.5s infinite;
}

.btn-install-header:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.5);
}

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

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3); }
    50% { box-shadow: 0 2px 16px rgba(56, 189, 248, 0.6); }
}

/* Modal Prompt de Instalación PWA */
.pwa-install-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 1.25rem;
    animation: fadeIn 0.3s ease;
}

.pwa-install-card {
    background: white;
    width: 100%;
    max-width: 440px;
    border-radius: var(--radius-xl);
    padding: 1.75rem;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(226, 232, 240, 0.8);
    animation: slideUpScale 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-close-pwa {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    background: none;
    border: none;
    font-size: 1.75rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    transition: var(--transition);
}

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

.pwa-card-header {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    margin-bottom: 1.25rem;
}

.pwa-app-icon {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    flex-shrink: 0;
}

.pwa-app-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pwa-card-title h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 0.25rem;
}

.pwa-card-title p {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.pwa-card-features {
    background: var(--bg-page);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border: 1px solid var(--border-color);
}

.pwa-feature-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.pwa-feature-item .feature-icon {
    font-size: 1.1rem;
}

/* Guía iOS */
.ios-install-guide {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    margin-bottom: 1.25rem;
    font-size: 0.85rem;
    color: #1e3a8a;
}

.ios-install-guide ol {
    margin-left: 1.25rem;
    margin-top: 0.4rem;
    line-height: 1.5;
}

.ios-share-icon {
    width: 16px;
    height: 16px;
    vertical-align: middle;
    color: #2563eb;
}

.pwa-card-actions {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.btn-install-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.85rem 1.25rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
    transition: var(--transition);
}

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

.btn-install-primary svg {
    width: 20px;
    height: 20px;
}

.btn-install-secondary {
    width: 100%;
    padding: 0.65rem;
    background: transparent;
    color: var(--text-muted);
    border: none;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-install-secondary:hover {
    color: var(--text-primary);
}

/* Dashboard Container */
.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 3rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Search Panel */
.search-panel {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

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

.panel-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.panel-desc {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.2rem;
}

.records-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.85rem;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.dot-active {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: var(--primary);
}

/* Selector de Modo de Búsqueda */
.search-mode-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    background: #f1f5f9;
    padding: 0.35rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
}

.mode-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.mode-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

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

/* Sección Cédula */
.input-search-wrapper {
    max-width: 600px;
}

.input-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.cedula-input-group {
    display: flex;
    align-items: stretch;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: white;
    transition: var(--transition);
}

.cedula-input-group:focus-within {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 4px var(--primary-subtle);
}

.cedula-prefix {
    background: #f8fafc;
    padding: 0.75rem 1rem;
    font-weight: 700;
    color: var(--text-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    font-size: 1rem;
}

.cedula-input-group input {
    flex: 1;
    border: none;
    padding: 0.75rem 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    outline: none;
    min-width: 0;
}

.btn-search-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.btn-search-action:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn-search-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-search-action svg {
    width: 18px;
    height: 18px;
}

/* Sección Geográfica */
.geo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.select-wrapper {
    position: relative;
}

.select-wrapper select {
    width: 100%;
    appearance: none;
    background: #f8fafc url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat right 0.85rem center;
    border: 1px solid var(--border-color);
    padding: 0.75rem 2.2rem 0.75rem 0.9rem;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    outline: none;
    transition: var(--transition);
}

.select-wrapper select:focus {
    border-color: var(--border-focus);
    background-color: white;
    box-shadow: 0 0 0 3px var(--primary-subtle);
}

.select-wrapper select:disabled {
    background-color: #e2e8f0;
    color: #94a3b8;
    cursor: not-allowed;
    opacity: 0.8;
}

.geo-actions {
    display: flex;
    justify-content: flex-end;
}

.geo-actions .btn-search-action {
    border-radius: var(--radius-md);
}

/* Filtro de Origen */
.origin-filter-container {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.origin-title {
    font-size: 0.825rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.pills-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.pill-item input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.pill-label {
    display: inline-block;
    padding: 0.4rem 0.9rem;
    background: #f1f5f9;
    color: var(--text-secondary);
    border-radius: 9999px;
    font-size: 0.825rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
}

.pill-item input:checked + .pill-label {
    background: var(--primary-light);
    color: var(--primary);
    border-color: rgba(37, 99, 235, 0.3);
}

/* Panel de Resultados */
.results-panel {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.results-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.results-bar h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.results-badge {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: #f1f5f9;
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

/* Tabla Adaptada */
.table-card {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table.modern-table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100% !important;
}

table.modern-table thead th {
    background: #f8fafc;
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1rem 0.85rem;
    border-bottom: 2px solid var(--border-color);
    text-align: left;
}

table.modern-table tbody td {
    padding: 1rem 0.85rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    vertical-align: middle;
}

table.modern-table tbody tr {
    transition: background-color 0.15s;
}

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

/* Badges y Botones de Tabla */
.badge-cedula-cell {
    font-weight: 700;
    color: var(--primary);
    font-family: monospace;
    font-size: 0.95rem;
}

.phone-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.phone-indicator.yes {
    background: var(--success-light);
    color: var(--success);
}

.phone-indicator.no {
    background: #f1f5f9;
    color: var(--text-muted);
}

.btn-view {
    background: white;
    color: var(--primary);
    border: 1.5px solid var(--primary);
    padding: 0.45rem 0.9rem;
    border-radius: var(--radius-sm);
    font-size: 0.825rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.btn-view:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
}

/* DataTables Pagination & Info */
.dataTables_wrapper .dataTables_info {
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding-top: 1rem;
}

.dataTables_wrapper .dataTables_paginate {
    padding-top: 1rem;
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 0.4rem 0.8rem !important;
    border-radius: var(--radius-sm) !important;
    font-size: 0.85rem !important;
    font-weight: 600 !important;
    border: 1px solid var(--border-color) !important;
    background: white !important;
    color: var(--text-secondary) !important;
    cursor: pointer;
    transition: var(--transition);
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--primary-light) !important;
    color: var(--primary) !important;
    border-color: var(--primary) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary) !important;
    color: white !important;
    border-color: var(--primary) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Modal de Perfil */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.25s, visibility 0.25s;
}

.modal.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(6px);
}

.modal-sheet {
    position: relative;
    background: var(--bg-page);
    width: 95%;
    max-width: 860px;
    max-height: 90vh;
    border-radius: var(--radius-xl);
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    z-index: 10;
    animation: scaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sheet-drag-handle {
    display: none;
    width: 40px;
    height: 5px;
    background: #cbd5e1;
    border-radius: 9999px;
    margin: 0.75rem auto 0;
}

.close-modal {
    position: absolute;
    top: 1.25rem;
    right: 1.5rem;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    font-size: 1.75rem;
    line-height: 1;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    transition: var(--transition);
}

.close-modal:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Header del Perfil */
.profile-header-grid {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    padding: 2.25rem 2rem 1.75rem;
    color: white;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    position: relative;
}

.avatar-large {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, #38bdf8 0%, #2563eb 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 800;
    color: white;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.25);
    border: 3px solid rgba(255, 255, 255, 0.2);
}

.profile-title-large {
    flex: 1;
    min-width: 220px;
}

.profile-title-large h2 {
    font-size: 1.65rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 0.4rem;
}

.badge-cedula {
    display: inline-block;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: monospace;
}

.profile-summary {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.summary-chip {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 0.5rem 0.85rem;
    border-radius: var(--radius-md);
    font-size: 0.825rem;
}

.summary-chip .chip-label {
    color: #94a3b8;
    margin-right: 0.35rem;
}

.summary-chip .chip-val {
    color: #38bdf8;
    font-weight: 700;
}

/* Tabs */
.tabs-container {
    padding: 1.5rem;
}

.tabs-scroll-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.tabs-scroll-wrapper::-webkit-scrollbar {
    display: none;
}

.tabs {
    display: flex;
    list-style: none;
    gap: 0.5rem;
    min-width: max-content;
}

.tab-link {
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: var(--transition);
    margin-bottom: -2px;
}

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

.tab-link.current {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.current {
    display: block;
}

/* Detail Cards & Grid */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.25rem;
}

.detail-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.detail-card .card-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1.25rem;
}

.detail-card .card-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

.detail-card .card-icon {
    font-size: 1.3rem;
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 1.5rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: #e2e8f0;
}

.timeline-item {
    position: relative;
    margin-bottom: 1.25rem;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.5rem;
    top: 6px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--primary);
}

.tl-content {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
}

.tl-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.tl-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    line-height: 1.4;
}

.tl-meta {
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Phone Edit Form */
.phone-edit-box {
    background: #eff6ff;
    border: 1.5px dashed #bfdbfe;
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.phone-edit-box h4 {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e40af;
    margin-bottom: 0.75rem;
}

.phone-inputs-row {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.phone-input {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    background: white;
    outline: none;
}

.phone-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-subtle);
}

.btn-save-phone {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-save-phone:hover:not(:disabled) {
    background: var(--primary-hover);
}

/* Toasts */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    background: #0f172a;
    color: white;
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    pointer-events: auto;
    animation: slideInRight 0.3s ease;
    max-width: 360px;
}

.toast.toast-success {
    border-left: 4px solid var(--success);
}

.toast.toast-info {
    border-left: 4px solid var(--cyan);
}

/* Clases de Utilidad */
.hidden {
    display: none !important;
}

/* Animaciones */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUpScale {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

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

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ===================================================
   OPTIMIZACIONES EXCLUSIVAS PARA MÓVIL (VISTA MÓVIL)
   =================================================== */
@media (max-width: 768px) {
    .app-header {
        padding: 0.75rem 1rem;
    }

    .brand-icon {
        width: 38px;
        height: 38px;
    }

    .brand-text h1 {
        font-size: 1.1rem;
    }

    .brand-subtitle {
        display: none;
    }

    .status-badge .status-label {
        display: none;
    }

    .status-badge {
        padding: 0.4rem;
    }

    .btn-install-header span {
        display: none;
    }

    .btn-install-header {
        padding: 0.45rem 0.65rem;
    }

    .dashboard-container {
        padding: 1rem 0.75rem 2.5rem;
        gap: 1rem;
    }

    .search-panel {
        padding: 1.25rem 1rem;
        border-radius: var(--radius-md);
    }

    .panel-header {
        margin-bottom: 1rem;
    }

    .panel-header h2 {
        font-size: 1.2rem;
    }

    .records-pill {
        width: 100%;
        justify-content: center;
    }

    .search-mode-selector {
        margin-bottom: 1.25rem;
    }

    .mode-btn {
        padding: 0.65rem 0.5rem;
        font-size: 0.85rem;
    }

    .cedula-input-group {
        flex-direction: column;
        border: none;
        background: transparent;
        gap: 0.6rem;
    }

    .cedula-input-group > div,
    .cedula-input-group .cedula-prefix,
    .cedula-input-group input {
        border-radius: var(--radius-md);
        border: 2px solid var(--border-color);
    }

    .cedula-prefix {
        display: none;
    }

    .cedula-input-group input {
        background: white;
        padding: 0.85rem 1rem;
        font-size: 1.1rem;
        text-align: center;
    }

    .cedula-input-group .btn-search-action {
        border-radius: var(--radius-md);
        padding: 0.9rem;
        font-size: 1rem;
        width: 100%;
    }

    .geo-grid {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }

    .full-width-mobile {
        width: 100%;
        padding: 0.85rem;
        font-size: 1rem;
    }

    .origin-filter-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.6rem;
    }

    .pills-group {
        width: 100%;
    }

    .pill-label {
        width: 100%;
        text-align: center;
        padding: 0.5rem 0.75rem;
    }

    .results-panel {
        padding: 1.25rem 0.85rem;
        border-radius: var(--radius-md);
    }

    /* Modal tipo Bottom Sheet en Móvil */
    .modal {
        align-items: flex-end;
    }

    .modal-sheet {
        width: 100%;
        max-width: 100%;
        max-height: 92vh;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        border-top-left-radius: var(--radius-xl);
        border-top-right-radius: var(--radius-xl);
        animation: sheetSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .sheet-drag-handle {
        display: block;
    }

    .close-modal {
        top: 0.75rem;
        right: 0.75rem;
        width: 32px;
        height: 32px;
        font-size: 1.4rem;
        background: rgba(0, 0, 0, 0.25);
    }

    .profile-header-grid {
        padding: 1.5rem 1.25rem 1.25rem;
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 0.85rem;
    }

    .avatar-large {
        width: 70px;
        height: 70px;
        font-size: 1.65rem;
    }

    .profile-title-large h2 {
        font-size: 1.35rem;
    }

    .profile-summary {
        justify-content: center;
        width: 100%;
    }

    .tabs-container {
        padding: 1rem;
    }

    .tab-link {
        padding: 0.65rem 0.85rem;
        font-size: 0.825rem;
    }

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

    .phone-inputs-row {
        grid-template-columns: 1fr;
    }

    .btn-save-phone {
        width: 100%;
        padding: 0.8rem;
    }

    .toast-container {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
    }

    .toast {
        max-width: 100%;
    }
}

@keyframes sheetSlideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* ==========================================================================
   MÓDULO DE AUTENTICACIÓN (LOGIN)
   ========================================================================== */
.login-wrapper {
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background: radial-gradient(circle at top center, rgba(37, 99, 235, 0.12) 0%, transparent 70%);
}

.login-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.03);
    width: 100%;
    max-width: 440px;
    padding: 2.5rem 2rem;
    animation: fadeInScale 0.3s ease-out;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.login-brand {
    text-align: center;
    margin-bottom: 2rem;
}

.login-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 10px 25px -5px rgba(37, 99, 235, 0.4);
}

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

.login-brand h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 0.4rem;
    letter-spacing: -0.02em;
}

.login-brand p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

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

.input-with-icon .input-icon {
    position: absolute;
    left: 1rem;
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
    transition: var(--transition);
}

.input-with-icon input {
    width: 100%;
    padding: 0.85rem 1rem 0.85rem 2.75rem;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text-primary);
    background: #f8fafc;
    transition: var(--transition);
}

.input-with-icon input:focus {
    outline: none;
    border-color: var(--primary);
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.input-with-icon input:focus + .input-icon {
    color: var(--primary);
}

.btn-toggle-pass {
    position: absolute;
    right: 0.75rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.35rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.btn-toggle-pass:hover {
    color: var(--text-primary);
}

.btn-toggle-pass svg {
    width: 18px;
    height: 18px;
}

.btn-login-submit {
    width: 100%;
    padding: 0.9rem 1.5rem;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.975rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 8px 20px -4px rgba(37, 99, 235, 0.35);
    margin-top: 0.5rem;
}

.btn-login-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 25px -4px rgba(37, 99, 235, 0.45);
}

.btn-login-submit:active {
    transform: translateY(0);
}

.alert-box {
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: fadeIn 0.2s ease-in-out;
}

.alert-box.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.alert-box.alert-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #15803d;
}

.login-footer {
    margin-top: 1.75rem;
    text-align: center;
    font-size: 0.775rem;
    color: var(--text-muted);
}

/* ==========================================================================
   USUARIO EN HEADER
   ========================================================================== */
.header-user-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.35rem 0.75rem 0.35rem 0.4rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 9999px;
    backdrop-filter: blur(8px);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #38bdf8 0%, #2563eb 100%);
    color: white;
    font-size: 0.8rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.user-meta {
    display: flex;
    flex-direction: column;
    text-align: left;
    line-height: 1.15;
}

.user-name {
    color: #ffffff;
    font-size: 0.825rem;
    font-weight: 700;
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role-badge {
    font-size: 0.675rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.user-role-badge.badge-admin {
    color: #38bdf8;
}

.user-role-badge.badge-operador {
    color: #94a3b8;
}

.btn-header-action {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.825rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
}

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

.btn-manage-users {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-manage-users:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.btn-logout {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-logout:hover {
    background: #ef4444;
    color: #ffffff;
    border-color: #ef4444;
    transform: translateY(-1px);
}

/* ==========================================================================
   MODAL DE GESTIÓN DE USUARIOS
   ========================================================================== */
.modal-sheet-wide {
    max-width: 900px !important;
    width: 95% !important;
}

.users-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 1.75rem;
    border-bottom: 1px solid var(--border-color);
    background: #ffffff;
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
    flex-wrap: wrap;
    gap: 1rem;
}

.users-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.users-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: #eff6ff;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.users-icon svg {
    width: 22px;
    height: 22px;
}

.users-title h2 {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 0.2rem;
}

.users-title p {
    font-size: 0.825rem;
    color: var(--text-secondary);
    margin: 0;
}

.users-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e2e8f0;
    background: #ffffff;
    flex-wrap: wrap;
    gap: 1rem;
}

.users-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-close-clean {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    padding: 0;
}

.btn-close-clean:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #ef4444;
    transform: scale(1.08);
}

.btn-close-clean svg {
    width: 18px;
    height: 18px;
    stroke-width: 2.2;
}

.btn-primary-action {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.65rem 1.25rem;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.28);
}

.btn-primary-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.38);
}

.btn-primary-action svg {
    width: 16px;
    height: 16px;
}

.users-table-wrapper {
    padding: 1.25rem 1.75rem;
    max-height: 60vh;
    overflow-x: auto;
    overflow-y: auto;
}

.users-data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.875rem;
}

.users-data-table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    padding: 0.85rem 1rem;
    border-bottom: 2px solid #e2e8f0;
    text-align: left;
    white-space: nowrap;
}

.users-data-table th:nth-child(1) { min-width: 110px; } /* Cédula */
.users-data-table th:nth-child(2) { min-width: 180px; } /* Nombre */
.users-data-table th:nth-child(3) { min-width: 110px; } /* Usuario */
.users-data-table th:nth-child(4) { min-width: 115px; } /* Rol */
.users-data-table th:nth-child(5) { min-width: 145px; } /* Estado Asignado */
.users-data-table th:nth-child(6) { min-width: 110px; } /* Estado Cuenta */
.users-data-table th:nth-child(7) { min-width: 115px; } /* Último Acceso */
.users-data-table th:nth-child(8) { min-width: 140px; } /* Acciones */

.users-data-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-primary);
    vertical-align: middle;
}

.users-data-table tr:hover td {
    background: #f8fafc;
}

/* Badges de Tabla de Usuarios */
.cedula-badge-pill {
    display: inline-block;
    background: #eff6ff;
    color: #1d4ed8;
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 700;
    font-family: 'Inter', monospace;
    font-size: 0.82rem;
    border: 1px solid #dbeafe;
    white-space: nowrap;
}

.badge-user-me {
    display: inline-block;
    background: #dbeafe;
    color: #1e40af;
    font-size: 0.68rem;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.username-badge {
    background: #f1f5f9;
    color: #475569;
    padding: 2px 7px;
    border-radius: 5px;
    font-size: 0.8rem;
    font-family: monospace;
    border: 1px solid #e2e8f0;
}

.badge-role {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

.badge-role.role-admin {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.badge-role.role-operador {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

.badge-status.status-activo {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.badge-status.status-inactivo {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.status-indicator-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
}

.status-indicator-dot.online {
    background: #22c55e;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
}

.status-indicator-dot.offline {
    background: #ef4444;
}

.badge-estado-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}

.badge-estado-pill.pill-todos {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fde68a;
}

.badge-estado-pill.pill-assigned {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.actions-cell {
    display: flex;
    gap: 0.5rem;
    white-space: nowrap;
}

.btn-action-table {
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-sm);
    font-size: 0.775rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.btn-action-edit {
    background: #eff6ff;
    color: var(--primary);
    border: 1px solid #bfdbfe;
}

.btn-action-edit:hover {
    background: var(--primary);
    color: #ffffff;
}

.btn-action-delete {
    background: #fef2f2;
    color: #ef4444;
    border: 1px solid #fecaca;
}

.btn-action-delete:hover {
    background: #ef4444;
    color: #ffffff;
}

/* ==========================================================================
   MODAL CARD DIALOG (FORMULARIO USUARIO MODERNO)
   ========================================================================== */
.modal-card-dialog {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 540px;
    padding: 1.75rem 2rem;
    position: relative;
    z-index: 1001;
    animation: fadeInScale 0.25s ease-out;
}

.modal-card-userform {
    max-width: 560px;
}

.dialog-header-enhanced {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #f1f5f9;
}

.dialog-title-wrapper {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.dialog-title-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: #eff6ff;
    color: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dialog-title-icon svg {
    width: 22px;
    height: 22px;
}

.dialog-title-wrapper h3 {
    font-size: 1.25rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0;
}

.dialog-subtitle {
    margin: 2px 0 0 0;
    font-size: 0.8rem;
    color: #64748b;
}

/* Formulario moderno */
.modern-modal-form {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
}

.form-group-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-group-field label {
    font-size: 0.835rem;
    font-weight: 700;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 4px;
}

.req-star {
    color: #ef4444;
    font-weight: 800;
}

.lbl-opt {
    font-weight: normal;
    color: #94a3b8;
    font-size: 0.775rem;
}

.modal-input {
    width: 100%;
    padding: 0.725rem 0.95rem;
    background: #f8fafc;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.92rem;
    font-weight: 500;
    color: #0f172a;
    transition: all 0.2s ease;
    outline: none;
    box-sizing: border-box;
}

.modal-input:focus {
    border-color: #2563eb;
    background: #ffffff;
    box-shadow: 0 0 0 3.5px rgba(37, 99, 235, 0.12);
}

.input-icon-wrapper {
    display: flex;
    align-items: stretch;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    overflow: hidden;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.input-icon-wrapper:focus-within {
    border-color: #2563eb;
    background: #ffffff;
    box-shadow: 0 0 0 3.5px rgba(37, 99, 235, 0.12);
}

.input-icon-wrapper .modal-input {
    border: none;
    background: transparent;
    border-radius: 0;
}

.input-icon-wrapper .modal-input:focus {
    box-shadow: none;
    background: transparent;
}

.input-side-badge {
    background: #f1f5f9;
    padding: 0.725rem 0.85rem;
    font-weight: 800;
    font-size: 0.9rem;
    color: #475569;
    border-right: 1.5px solid #cbd5e1;
    display: flex;
    align-items: center;
    user-select: none;
}

.field-help-text {
    font-size: 0.725rem;
    color: #64748b;
    font-weight: 500;
    margin-top: 1px;
}

.modal-select-wrapper {
    position: relative;
    width: 100%;
}

.modal-select {
    width: 100%;
    padding: 0.725rem 2.5rem 0.725rem 0.95rem;
    background: #f8fafc url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat right 0.85rem center;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #0f172a;
    appearance: none;
    outline: none;
    cursor: pointer;
    transition: all 0.2s;
    box-sizing: border-box;
}

.modal-select:focus {
    border-color: #2563eb;
    background-color: #ffffff;
    box-shadow: 0 0 0 3.5px rgba(37, 99, 235, 0.12);
}

.modal-select:disabled {
    background-color: #e2e8f0;
    color: #94a3b8;
    cursor: not-allowed;
    opacity: 0.75;
}

/* Aviso de restricción territorial */
.territorial-warning-card {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background: #fffbeb;
    border: 1px solid #fef3c7;
    border-left: 4px solid #f59e0b;
    padding: 0.85rem 1rem;
    border-radius: 8px;
    margin-top: 0.65rem;
}

.warning-icon-badge {
    font-size: 1.15rem;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 2px;
}

.warning-content strong {
    font-size: 0.82rem;
    color: #78350f;
    display: block;
    margin-bottom: 2px;
}

.warning-content p {
    margin: 0;
    font-size: 0.775rem;
    color: #92400e;
    line-height: 1.4;
}

/* Acciones del formulario */
.dialog-actions-modern {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid #f1f5f9;
}

.btn-modal-cancel {
    padding: 0.7rem 1.35rem;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-modal-cancel:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.btn-modal-save {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.5rem;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-modal-save:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.42);
}

.btn-modal-save svg {
    width: 16px;
    height: 16px;
}

/* Spinner en botón */
.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Adaptación Móvil */
@media (max-width: 768px) {
    .header-user-section {
        gap: 0.5rem;
    }
    
    .user-pill {
        padding: 0.25rem;
    }

    .user-meta {
        display: none;
    }

    .btn-header-action span {
        display: none;
    }

    .btn-header-action {
        padding: 0.45rem;
    }

    .form-row-2 {
        grid-template-columns: 1fr;
    }

    .users-header-bar {
        padding: 1.25rem 1rem;
    }

    .users-table-wrapper {
        padding: 1rem 0.5rem;
    }

    .users-data-table th,
    .users-data-table td {
        padding: 0.65rem 0.5rem;
        font-size: 0.775rem;
    }
}

