/* 
 * Sistema de Estilos - CrimeLink (Investigación Criminalística)
 * Estética: Tema Oscuro Premium, Maltego Grid, Glassmorphism y Tipografía Outfit.
 */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --bg-main: #070a10;
    --bg-card: rgba(13, 18, 30, 0.8);
    --bg-card-hover: rgba(22, 30, 49, 0.9);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(59, 130, 246, 0.5);
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --accent-blue: #3b82f6;
    --accent-blue-hover: #2563eb;
    --accent-blue-glow: rgba(59, 130, 246, 0.35);
    
    --accent-crimson: #ef4444;
    --accent-crimson-hover: #dc2626;
    --accent-crimson-glow: rgba(239, 68, 68, 0.3);
    
    --accent-emerald: #10b981;
    --accent-emerald-hover: #059669;
    
    --font-sans: 'Outfit', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-premium: 0 10px 40px -10px rgba(0, 0, 0, 0.8);
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    background: rgba(7, 10, 16, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 2rem;
    height: 2rem;
    background: radial-gradient(circle, var(--accent-blue) 0%, rgba(0,0,0,0) 70%);
    border: 2px solid var(--accent-blue);
    border-radius: 50%;
    position: relative;
    box-shadow: 0 0 10px var(--accent-blue-glow);
}

.logo-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0.4rem;
    height: 0.4rem;
    background: var(--accent-crimson);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 8px var(--accent-crimson-glow);
}

.logo-text {
    font-weight: 700;
    font-size: 1.4rem;
    letter-spacing: 0.05em;
    background: linear-gradient(to right, #ffffff, #9ca3af);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-tag {
    font-size: 0.65rem;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--accent-crimson);
    color: #fca5a5;
    padding: 0.1rem 0.4rem;
    border-radius: 9999px;
    font-weight: 600;
    text-transform: uppercase;
}

/* Layout Principal */
.app-container {
    display: flex;
    flex: 1;
    height: calc(100vh - 58px);
    overflow: hidden;
}

/* Panel Lateral (Formularios) */
.sidebar {
    width: 350px;
    min-width: 350px;
    background: rgba(13, 18, 30, 0.7);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-color);
    padding: 1.25rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.sidebar-section {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1.1rem;
}

.sidebar-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 0.4rem;
}

.sidebar-title svg {
    color: var(--accent-blue);
}

/* Main Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Navegación por Pestañas */
.tabs-navigation {
    background: rgba(10, 15, 26, 0.7);
    border-bottom: 1px solid var(--border-color);
    padding: 0.5rem 1.5rem 0;
    display: flex;
    gap: 0.5rem;
}

.tab-btn {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-secondary);
    padding: 0.6rem 1.1rem;
    font-family: var(--font-sans);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    border: 1px solid transparent;
    border-bottom: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all var(--transition-fast);
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.02);
}

.tab-btn.active {
    color: var(--accent-blue);
    background: rgba(13, 18, 30, 0.95);
    border-color: var(--border-color);
    border-bottom: 1px solid #0d121e;
    box-shadow: 0 -4px 10px -5px var(--accent-blue-glow);
}

/* Contenedores de Vista */
.view-container {
    flex: 1;
    display: none;
    overflow: hidden;
    position: relative;
    min-height: 0;
}

.view-container.active {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

/* --- VISTA EXCEL --- */
.excel-view-header {
    padding: 0.75rem 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    gap: 1rem;
}

.search-wrapper {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-input {
    width: 100%;
    padding: 0.5rem 1rem 0.5rem 2.25rem;
    background: rgba(7, 10, 16, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    transition: all var(--transition-fast);
}

.search-input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 8px var(--accent-blue-glow);
    outline: none;
}

.search-icon {
    position: absolute;
    left: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.table-wrapper {
    flex: 1;
    overflow: auto;
    padding: 0.75rem 1.5rem;
}

/* Tabla Estilo Excel */
.excel-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: left;
    background: rgba(13, 18, 30, 0.5);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.excel-table th {
    background: rgba(20, 27, 45, 0.9);
    color: var(--text-primary);
    font-weight: 600;
    padding: 0.6rem 0.75rem;
    border-bottom: 2px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    user-select: none;
}

.excel-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    color: var(--text-secondary);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    max-width: 180px;
}

.excel-table tr {
    transition: background-color var(--transition-fast);
}

.excel-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.01);
}

.excel-table tbody tr:hover {
    background: rgba(59, 130, 246, 0.08);
    cursor: pointer;
}

.excel-table td.alias-col {
    font-family: var(--font-mono);
    color: #fca5a5;
    font-weight: 500;
}

.excel-table td.id-col {
    color: var(--accent-blue);
    font-weight: 600;
}

.table-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    background: #1e293b;
    border: 1px solid var(--border-color);
    vertical-align: middle;
    margin-right: 0.5rem;
}

/* --- VISTA GRAFO --- */
#view-graph.active,
#view-map.active {
    position: relative;
    display: flex;
    flex-direction: column;
}

.view-filters-bar {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(10, 15, 26, 0.9);
    z-index: 5;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 180px;
    flex: 1;
    max-width: 280px;
}

.filter-field label {
    font-size: 0.7rem;
    margin: 0;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

    .multi-filter {
    min-height: 5.5rem;
    max-height: 8rem;
    width: 100%;
    background: rgba(7, 10, 16, 0.9);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.8rem;
    padding: 0.25rem;
}

.filter-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
    align-self: center;
}

.graph-container {
    position: relative;
    flex: 1;
    min-height: 0;
    width: 100%;
    background-color: #080b11;
    /* Grid de Maltego */
    background-image: 
        radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 20px 20px, 100px 100px, 100px 100px;
    overflow: hidden;
    box-shadow: inset 0 0 100px 30px rgba(0,0,0,0.8);
}

.graph-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    outline: none;
    overflow: hidden;
}

.graph-canvas .vis-network {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
}

/* Controles de navegación Vis.js sobre fondo oscuro */
.vis-network .vis-navigation {
    position: absolute !important;
    right: 15px !important;
    bottom: 15px !important;
}

.vis-network .vis-navigation .vis-button {
    background-color: rgba(13, 18, 30, 0.92) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5) !important;
}

.graph-empty-state {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: var(--text-secondary);
    z-index: 5;
    pointer-events: none;
    text-align: center;
    padding: 2rem;
}

.graph-empty-state[hidden] {
    display: none !important;
}

.graph-empty-state strong {
    color: var(--text-primary);
    font-size: 1.05rem;
    font-weight: 600;
}

.graph-empty-state span {
    font-size: 0.85rem;
    max-width: 320px;
    line-height: 1.45;
}

/* Tooltip personalizado de Vis.js (Estilo Maltego) */
div.vis-tooltip {
    position: absolute;
    visibility: hidden;
    padding: 8px 12px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.8rem;
    color: #e5e7eb;
    background: rgba(13, 18, 30, 0.95);
    border: 1px solid var(--accent-blue);
    border-radius: 4px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    pointer-events: none;
    z-index: 9999;
    white-space: nowrap;
}

.graph-legend {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    background: rgba(10, 15, 26, 0.9);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    border-radius: 6px;
    padding: 0.6rem 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    z-index: 20;
    pointer-events: none;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.legend-color {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

/* Mapa Global */
.map-view-container {
    position: relative;
    flex: 1;
    min-height: 0;
    width: 100%;
    overflow: hidden;
}

.global-map {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#map-empty-state {
    z-index: 2;
}

.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse at top, rgba(59,130,246,0.15), transparent 50%),
        var(--bg-main);
}

.login-shell {
    width: min(420px, 92vw);
}

.login-card {
    background: rgba(13, 18, 30, 0.95);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-premium);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.login-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.login-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    margin-bottom: 0.85rem;
}

.login-note {
    margin-top: 1rem;
    font-size: 0.72rem;
    color: var(--text-muted);
    text-align: center;
}

.export-modal-box {
    width: min(480px, 94vw);
    background: rgba(13, 18, 30, 0.98);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--shadow-premium);
    overflow: hidden;
}

.export-modal-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Grupos */
.grupos-layout {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 1rem;
    padding: 1rem 1.5rem;
    overflow: hidden;
}

.grupo-form-box {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
    overflow-y: auto;
    height: fit-content;
    max-height: 100%;
}

.grupos-list {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 0;
}

.grupo-card {
    background: rgba(13, 18, 30, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.85rem 1rem;
}

.grupo-card-header {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: flex-start;
    margin-bottom: 0.4rem;
}

.grupo-title-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.grupo-color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.grupo-actions {
    display: flex;
    gap: 0.35rem;
}

.grupo-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.6rem;
}

.grupo-members {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.grupo-member-row {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    text-align: left;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 6px;
    padding: 0.45rem 0.6rem;
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 0.82rem;
}

.grupo-member-row:hover {
    border-color: var(--accent-blue);
}

.grupo-member-row .muted {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.btn-xs {
    width: auto !important;
    padding: 0.25rem 0.55rem !important;
    font-size: 0.72rem !important;
}

.empty-hint {
    color: var(--text-muted);
    font-size: 0.8rem;
    text-align: center;
    padding: 0.75rem;
}

/* Settings modal */
.settings-modal-box {
    width: min(860px, 96vw);
    max-height: 90vh;
    background: rgba(13, 18, 30, 0.98);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--shadow-premium);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.settings-modal-body {
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.settings-section h4 {
    margin-bottom: 0.35rem;
    font-size: 0.95rem;
}

.settings-help {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.settings-row {
    display: grid;
    grid-template-columns: 1.4fr 0.9fr auto auto;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.45rem;
}

.settings-check {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: 0;
}

.settings-add-field {
    display: grid;
    grid-template-columns: 1.4fr 0.9fr auto;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.settings-dd-block {
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
}

.settings-dd-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--accent-blue);
    margin-bottom: 0.5rem;
}

@media (max-width: 900px) {
    .grupos-layout {
        grid-template-columns: 1fr;
        overflow-y: auto;
    }
    .settings-row,
    .settings-add-field {
        grid-template-columns: 1fr;
    }
}

/* Formularios */
.form-group {
    margin-bottom: 0.75rem;
}

.form-row {
    display: flex;
    gap: 0.75rem;
}

.form-row .form-group {
    flex: 1;
}

label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 0.3rem;
    color: var(--text-secondary);
}

input[type="text"],
input[type="date"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 0.5rem 0.65rem;
    background: rgba(7, 10, 16, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    transition: all var(--transition-fast);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent-blue);
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

textarea {
    resize: vertical;
    min-height: 70px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
    width: 100%;
}

.btn-primary {
    background: var(--accent-blue);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-blue-hover);
    box-shadow: 0 0 10px var(--accent-blue-glow);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
}

.btn-danger {
    background: var(--accent-crimson);
    color: white;
}

.btn-danger:hover {
    background: var(--accent-crimson-hover);
    box-shadow: 0 0 10px var(--accent-crimson-glow);
}

/* --- PANEL DE DETALLE (SLIDING DRAWER) --- */
.detail-drawer {
    position: fixed;
    top: 0;
    right: -550px;
    width: 550px;
    height: 100vh;
    background: rgba(10, 15, 26, 0.95);
    backdrop-filter: blur(24px);
    border-left: 1px solid var(--border-color);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.9);
    z-index: 1000;
    transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}

.detail-drawer.open {
    right: 0;
}

.drawer-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.25);
}

.drawer-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.4rem;
    cursor: pointer;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.drawer-close:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Ficha del Perfil Detallado */
.profile-card {
    display: flex;
    gap: 1.25rem;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: 10px;
}

.profile-pic-container {
    position: relative;
    width: 90px;
    height: 90px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-premium);
}

.profile-pic-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #151d30;
}

.profile-pic-upload {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    font-size: 0.65rem;
    text-align: center;
    padding: 0.25rem 0;
    cursor: pointer;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.profile-pic-container:hover .profile-pic-upload {
    opacity: 1;
}

.profile-pic-upload input {
    display: none;
}

.profile-info {
    flex: 1;
}

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

.profile-alias {
    font-family: var(--font-mono);
    color: var(--accent-crimson);
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.4rem;
}

.profile-meta-chips {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.chip {
    font-size: 0.7rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    color: var(--text-secondary);
}

/* Tabs Internos de Ficha */
.detail-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.75rem;
    gap: 0.25rem;
    overflow-x: auto;
}

.detail-tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.4rem 0.75rem;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.detail-tab-btn.active {
    color: var(--accent-blue);
    border-bottom-color: var(--accent-blue);
}

.detail-tab-panel {
    display: none;
}

.detail-tab-panel.active {
    display: block;
}

/* Grid de datos */
.data-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.data-item {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    padding: 0.6rem;
    border-radius: 6px;
}

.data-item-full {
    grid-column: span 2;
}

.data-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.2rem;
}

.data-value {
    font-size: 0.85rem;
    color: var(--text-primary);
}

/* Inputs editables en ficha */
.ficha-form-grid .data-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.ficha-input,
.ficha-form-grid input,
.ficha-form-grid select,
.ficha-form-grid textarea,
.profile-info input {
    width: 100%;
    background: rgba(7, 10, 16, 0.85);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    padding: 0.4rem 0.5rem;
}

.ficha-input:focus,
.profile-info input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px var(--accent-blue-glow);
}

.geo-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.geo-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.55rem 0.7rem;
}

.evidence-grid {
    align-items: stretch;
}

.evidence-card {
    position: relative;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 110px;
}

.evidence-preview {
    flex: 1;
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.02);
}

.evidence-preview img {
    width: 100%;
    height: 100px;
    object-fit: cover;
}

.evidence-meta {
    font-size: 0.68rem;
    color: var(--text-secondary);
    padding: 0.35rem 0.45rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-top: 1px solid var(--border-color);
}

.evidence-icon-badge {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--accent-blue);
    border: 1px solid var(--accent-blue);
    border-radius: 4px;
    padding: 0.45rem 0.6rem;
    background: rgba(59, 130, 246, 0.1);
}

.evidence-icon-badge.large {
    font-size: 1rem;
    padding: 0.8rem 1.1rem;
}

.evidence-viewer-box {
    width: min(920px, 94vw);
    max-height: 90vh;
    background: rgba(13, 18, 30, 0.98);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--shadow-premium);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.evidence-viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.25);
}

.evidence-viewer-body {
    padding: 1rem;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 280px;
}

.evidence-fallback {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
}

/* Historial de trabajos en ficha */
.job-item {
    border-left: 2px solid var(--accent-blue);
    padding-left: 0.75rem;
    margin-bottom: 0.75rem;
    position: relative;
}

.job-item::before {
    content: '';
    position: absolute;
    left: -5px;
    top: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-blue);
}

.job-period {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent-blue);
    font-weight: 500;
}

.job-company {
    font-weight: 600;
    font-size: 0.85rem;
}

.job-role {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Editor de trabajos dinámicos dentro de la Ficha */
.job-adder-box {
    background: rgba(0,0,0,0.15);
    border: 1px solid var(--border-color);
    padding: 0.75rem;
    border-radius: 6px;
    margin-top: 1rem;
}

/* Galería de capturas */
.screenshots-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.screenshot-thumbnail {
    position: relative;
    aspect-ratio: 16/9;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: rgba(0,0,0,0.3);
}

.screenshot-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-fast);
}

.screenshot-thumbnail:hover img {
    transform: scale(1.05);
}

.screenshot-delete-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(239, 68, 68, 0.9);
    border: none;
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.screenshot-thumbnail:hover .screenshot-delete-btn {
    opacity: 1;
}

.detail-map {
    width: 100%;
    height: 180px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: #0d1117;
    margin-top: 0.4rem;
}

/* Vínculos Directos */
.relations-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.relation-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-color);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
}

.relation-person-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
}

.relation-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    background: #1e293b;
    border: 1px solid var(--border-color);
}

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

.relation-name {
    font-size: 0.8rem;
    font-weight: 600;
}

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

.relation-type-badge {
    font-size: 0.65rem;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-weight: 600;
    text-transform: uppercase;
}

.relation-type-badge.familiar {
    background: rgba(59, 130, 246, 0.12);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.25);
}

.relation-type-badge.amigo {
    background: rgba(16, 185, 129, 0.12);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.relation-type-badge.socio {
    background: rgba(245, 158, 11, 0.12);
    color: #fde047;
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.relation-type-badge.otro {
    background: rgba(156, 163, 175, 0.12);
    color: #d1d5db;
    border: 1px solid rgba(156, 163, 175, 0.25);
}

.delete-relation-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.delete-relation-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-crimson);
}

/* Drawer overlays */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
}

.drawer-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Lightbox de captura grande */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.lightbox.active {
    display: flex;
    opacity: 1;
}

.lightbox img {
    max-width: 90%;
    max-height: 85%;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: white;
    font-size: 1.8rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.18);
}

/* --- MODAL DE EDICIÓN COMPLETO (UX POPUP) --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    z-index: 1200;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.edit-modal-box {
    background: rgba(13, 18, 30, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    box-shadow: var(--shadow-premium);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.edit-modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
}

.edit-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.edit-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 3000;
}

.toast {
    background: rgba(13, 18, 30, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    padding: 0.6rem 1.1rem;
    border-radius: 6px;
    box-shadow: var(--shadow-premium);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-primary);
    transform: translateY(50px);
    opacity: 0;
    animation: slideIn 0.3s forwards cubic-bezier(0.16, 1, 0.3, 1);
    font-size: 0.8rem;
}

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

.toast.error {
    border-left: 4px solid var(--accent-crimson);
}

@keyframes slideIn {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.18);
}
