@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #d20a14;
    --primary-dark: #a00812;
    --primary-light: #ff1a26;
    --success: #10b981;
    --success-dark: #059669;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --border: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --radius: 12px;
    --radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body { overflow-x: hidden; }
@supports (overflow: clip) {
  html, body { overflow-x: clip; }
}

body { 
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 50%, #fecaca 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-primary);
    line-height: 1.6;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(210, 10, 20, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(210, 10, 20, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.container { 
    max-width: 1400px;
    margin: 0 auto;
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    position: relative;
    z-index: 1;
    backdrop-filter: blur(10px);
}

.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 16px 32px;
    color: white;
    position: relative;
    overflow: visible;
    top: 0;
    z-index: 9000;
}

.header::before {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    right: 0;
    top: -50%;
    transform: translateX(60%);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    position: relative;
    z-index: 1;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 0 0 auto;
}

.header-icon {
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    flex-shrink: 0;
}

.header-title-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.header h1 { 
    font-size: 1.35em;
    font-weight: 700;
    letter-spacing: -0.025em;
    margin: 0;
    line-height: 1.2;
}

.header-subtitle {
    font-size: 0.75em;
    opacity: 0.8;
    font-weight: 400;
}

.header-center {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    justify-content: center;
}

.header-info-compact {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 0.8em;
    opacity: 0.95;
}

.header-info-item {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.header-info-icon {
    font-size: 1em;
    opacity: 0.85;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}

.header-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.header-buttons .btn {
    padding: 10px 16px;
    font-size: 0.85em;
    white-space: nowrap;
}

.header-buttons .btn .btn-icon {
    font-size: 1.1em;
}

.header-user-menu {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-left: 16px;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
}

.user-menu-button {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: white;
    font-size: 0.85em;
    font-weight: 600;
    padding: 10px 18px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
}

.user-menu-button:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.user-menu-button .user-icon {
    font-size: 1.1em;
}

.user-menu-button .dropdown-arrow {
    font-size: 0.8em;
    transition: transform 0.3s ease;
}

.user-menu-button.active .dropdown-arrow {
    transform: rotate(180deg);
}

.user-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    min-width: 200px;
    z-index: 20000;
    border: 1px solid var(--border);
}

.user-dropdown.show {
    display: block;
    animation: dropdownFadeIn 0.3s ease;
}

@keyframes dropdownFadeIn {
    from { 
        opacity: 0; 
        transform: translateY(-10px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

.user-dropdown a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    padding: 14px 18px;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 500;
    border-bottom: 1px solid var(--border);
    transition: all 0.2s ease;
}

.user-dropdown a:last-child {
    border-bottom: none;
}

.user-dropdown a:hover {
    background: linear-gradient(135deg, rgba(210, 10, 20, 0.08) 0%, rgba(210, 10, 20, 0.05) 100%);
    color: var(--primary);
    padding-left: 22px;
}

.user-dropdown a .menu-icon {
    font-size: 1.1em;
}

.badge {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 0.8em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: var(--transition);
}

.badge:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

.badge-icon {
    font-size: 1.1em;
}

.tabs-container {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    overflow-x: auto;
    display: flex;
    gap: 4px;
    scrollbar-width: thin;
}

.tabs-container::-webkit-scrollbar {
    height: 4px;
}

.tabs-container::-webkit-scrollbar-track {
    background: transparent;
}

.tabs-container::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.tab {
    padding: 18px 24px;
    cursor: pointer;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.875em;
    position: relative;
    transition: var(--transition);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: var(--radius) var(--radius) 0 0;
    margin-bottom: -1px;
}

.tab:hover {
    color: var(--primary);
    background: rgba(210, 10, 20, 0.05);
}

.tab.active {
    color: var(--primary);
    background: var(--bg-primary);
    border-bottom: 3px solid var(--primary);
}

.tab-icon {
    font-size: 1.25em;
    transition: var(--transition);
}

.tab.completed .tab-icon {
    color: var(--success);
}

.tab.active .tab-icon {
    transform: scale(1.1);
}

.progress-container {
    background: var(--bg-secondary);
    padding: 16px 40px;
    border-bottom: 1px solid var(--border);
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 50px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 50px;
    transition: width 0.5s ease;
    width: 0%;
}

.progress-text {
    text-align: center;
    margin-top: 8px;
    font-size: 0.8em;
    color: var(--text-secondary);
    font-weight: 500;
}

.content-wrapper {
    padding: 15px;
    min-height: 350px;
    background: var(--bg-primary);
}

.tab-content {
    display: none;
    animation: fadeInUp 0.5s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeInUp {
    from { 
        opacity: 0; 
        transform: translateY(20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

h2 { 
    color: var(--text-primary);
    font-size: 1.5em;
    font-weight: 700;
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

h2::before {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 80px;
    height: 2px;
    background: linear-gradient(90deg, var(--primary) 0%, transparent 100%);
}

h2 .section-icon {
    font-size: 1.2em;
}

.form-group {
    position: relative;
    z-index: 1;
    margin-bottom: 20px;
}

.form-row { 
    display: grid;
    gap: 20px;
    margin-bottom: 20px;
}

.form-row.two-cols { 
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); 
}

.form-row.three-cols { 
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); 
}

.form-row.four-cols { 
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); 
}

label { 
    font-weight: 600;
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 0.9em;
    letter-spacing: 0.01em;
}

label.required::after {
    content: ' *';
    color: var(--danger);
}

input[type="text"], 
input[type="date"], 
input[type="time"], 
input[type="number"],
textarea, 
input[type="email"],
select { 
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95em;
    transition: var(--transition);
    font-family: inherit;
    background: var(--bg-primary);
    color: var(--text-primary);
}

input[type="text"]:focus, 
input[type="date"]:focus, 
input[type="time"]:focus, 
input[type="number"]:focus,
textarea:focus, 
input[type="email"]:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(210, 10, 20, 0.08);
    transform: translateY(-1px);
}

input:disabled {
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: not-allowed;
    opacity: 0.6;
}

textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
}

/* EDITORES QUILL - TAMAÑO REDUCIDO */
.editor-container { 
    min-height: 200px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.ql-container {
    min-height: 150px;
    max-height: 300px;
    overflow-y: auto;
}

.ql-editor {
    min-height: 150px;
    font-family: 'Lato', sans-serif !important;
    font-size: 18px;
    line-height: 1.8;
}

/* Referencias: editor más bajo */
.editor-referencias .ql-container {
    min-height: 80px;
    max-height: 120px;
}

.editor-referencias .ql-editor {
    min-height: 80px;
}

.radio-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.radio-group label {
    display: inline-flex;
    align-items: center;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 0;
    padding: 12px 20px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    transition: var(--transition);
    background: var(--bg-primary);
}

.radio-group label:hover {
    border-color: var(--primary);
    background: rgba(210, 10, 20, 0.03);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.radio-group input[type="radio"]:checked + span {
    color: var(--primary);
}

.radio-group input[type="radio"] {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    accent-color: var(--primary);
    cursor: pointer;
}

.table-wrapper {
    overflow-x: auto;
    margin-bottom: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-primary);
}

table { 
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

table thead {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    position: sticky;
    top: 0;
    z-index: 10;
}

table th { 
    color: white;
    padding: 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.875em;
    letter-spacing: 0.025em;
    text-transform: uppercase;
}

table td { 
    border-bottom: 1px solid var(--border);
    padding: 14px 16px;
    background: var(--bg-primary);
    font-size: 0.9em;
}

table tbody tr {
    transition: var(--transition);
}

table tbody tr:hover {
    background-color: var(--bg-secondary);
}

table tbody tr:last-child td {
    border-bottom: none;
}

table input { 
    border: 1px solid var(--border);
    padding: 8px 12px;
    border-radius: 8px;
    width: 100%;
    transition: var(--transition);
    font-size: 0.9em;
}

table input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(210, 10, 20, 0.08);
}

.btn {
    padding: 12px 28px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95em;
    transition: var(--transition);
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: var(--shadow);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, var(--success-dark) 100%);
    color: white;
    box-shadow: var(--shadow);
}

.btn-success:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: white;
    box-shadow: var(--shadow);
}

.btn-secondary:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.btn-info {
    background: linear-gradient(135deg, var(--info) 0%, #2563eb 100%);
    color: white;
    box-shadow: var(--shadow);
}

.btn-info:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.btn-delete {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
    color: white;
    padding: 8px 16px;
    font-size: 0.85em;
}

.btn-delete:hover {
    transform: scale(1.05);
}

.btn-action {
    background: linear-gradient(135deg, var(--info) 0%, #2563eb 100%);
    color: white;
    padding: 8px 16px;
    font-size: 0.85em;
    margin-right: 6px;
}

.btn-action:hover {
    transform: scale(1.05);
}

.btn:active {
    transform: translateY(0) !important;
}

.btn-full {
    width: 100%;
    justify-content: center;
    padding: 16px;
    font-size: 1.05em;
    margin-top: 12px;
}

.btn-icon {
    font-size: 1.2em;
}

.tab-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
    padding-top: 32px;
    border-top: 2px solid var(--border);
    gap: 16px;
}

.dashboard-section {
    margin-top: 40px;
    padding-top: 40px;
    border-top: 3px dashed var(--border);
    animation: fadeInUp 0.5s ease;
}

.dashboard-hidden {
    display: none;
}

.dashboard-actions {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.info-note {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border-left: 4px solid var(--primary);
    padding: 18px 24px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    color: #991b1b;
    font-size: 0.9em;
    display: flex;
    align-items: start;
    gap: 16px;
    box-shadow: var(--shadow-sm);
}

.info-note::before {
    content: 'ℹ️';
    font-size: 1.5em;
    flex-shrink: 0;
}

.auto-save-indicator {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: white;
    color: var(--text-primary);
    padding: 16px 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-xl);
    display: none;
    animation: slideInUp 0.4s ease;
    z-index: 1000;
    border: 1px solid var(--border);
    min-width: 280px;
}

@keyframes slideInUp {
    from { 
        opacity: 0; 
        transform: translateY(20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

.save-indicator-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.save-indicator-icon {
    font-size: 1.5em;
}

.save-indicator-text {
    flex: 1;
}

.save-indicator-time {
    font-size: 0.85em;
    color: var(--text-secondary);
    margin-top: 4px;
}

.mensaje-borradores {
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 16px;
    text-align: center;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
}

/* PERSONAS DAMNIFICADAS Y AGRESORES - DISEÑO MEJORADO */
.persona-card {
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    position: relative;
    transition: var(--transition);
}

.persona-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.persona-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
}

.persona-card-title {
    font-size: 1.1em;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.persona-number {
    background: var(--primary);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9em;
}

.btn-remove-persona {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85em;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.btn-remove-persona:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.loading {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.connection-status {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 0.85em;
    font-weight: 600;
    display: none;
    align-items: center;
    gap: 8px;
    z-index: 1001;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-lg);
}

.connection-status.online {
    background: rgba(16, 185, 129, 0.9);
    color: white;
}

.connection-status.offline {
    background: rgba(239, 68, 68, 0.9);
    color: white;
}

/* SUMMARY BAR */
.summary-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 10px 40px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    font-size: 0.8em;
    color: var(--text-secondary);
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.summary-label {
    font-weight: 600;
}

.summary-value {
    color: var(--text-primary);
}

.summary-value.editando {
    color: var(--warning);
    font-weight: 700;
    animation: pulseEdit 2s ease-in-out infinite;
}

@keyframes pulseEdit {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* AUTOCOMPLETE DERIVACIÓN - MEJORADO */
.autocomplete-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border: 2px solid var(--primary);
    border-radius: var(--radius);
    max-height: 240px;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    padding: 4px 0;
    animation: fadeInAutocomplete 0.15s ease-out;
}

.autocomplete-item {
    padding: 12px 16px;
    cursor: pointer;
    font-size: 0.9em;
    border-bottom: 1px solid var(--border);
    background: var(--bg-primary);
    transition: all 0.15s ease;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background-color: rgba(210, 10, 20, 0.05);
}

.autocomplete-item.selected {
    background-color: rgba(210, 10, 20, 0.1);
    font-weight: 600;
    color: var(--primary);
    border-left: 4px solid var(--primary);
    padding-left: 12px;
}

.autocomplete-suggestions::-webkit-scrollbar {
    width: 6px;
}

.autocomplete-suggestions::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 6px;
}

@keyframes fadeInAutocomplete {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* PANEL DE VERSIONES */
.version-panel {
    position: fixed;
    bottom: 15px;
    right: 15px;
    background: rgba(255,255,255,0.95);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 12px 18px;
    font-size: 0.85em;
    z-index: 9999;
    backdrop-filter: blur(4px);
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.version-panel button {
    margin-top: 8px;
    padding: 6px 10px;
    border: none;
    background: var(--primary);
    color: white;
    border-radius: var(--radius);
    cursor: pointer;
    width: 100%;
    font-size: 0.8em;
}

.version-panel button:hover {
    background: var(--primary-dark);
}

.version-hidden {
    display: block !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateY(10px) !important;
}

.version-panel.version-visible {
    display: block !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: translateY(0) !important;
}

/* RESPONSIVE DESIGN */
@media (max-width: 1400px) {
    .header-buttons .btn span:not(.btn-icon) {
        display: none;
    }
    
    .header-buttons .btn {
        padding: 10px 12px;
    }
    
    .header-buttons .btn .btn-icon {
        margin: 0;
        font-size: 1.3em;
    }
}

/* RESPONSIVE DESIGN */
@media (max-width: 1200px) {
    .header-content {
        flex-wrap: wrap;
    }
    
    .header-center {
        order: 3;
        flex-basis: 100%;
        justify-content: flex-start;
        margin-top: 8px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 0;
    }
    
    .container {
        border-radius: 0;
    }
    
    .header {
        padding: 16px 20px;
    }
    
    .header-content {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .header-left {
        justify-content: center;
    }
    
    .header-title-group {
        text-align: center;
    }
    
    .header h1 {
        font-size: 1.2em;
    }
    
    .header-subtitle {
        font-size: 0.7em;
    }
    
    .header-center {
        justify-content: center;
    }
    
    .header-info-compact {
        flex-direction: column;
        gap: 8px;
        align-items: center;
    }
    
    .header-right {
        flex-direction: column;
        gap: 10px;
    }
    
    .header-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .header-user-menu {
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
        padding-left: 0;
        padding-top: 12px;
        justify-content: center;
        width: 100%;
    }
    
    .user-menu-button {
        width: 100%;
        justify-content: center;
    }
    
    .user-dropdown {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        min-width: 220px;
    }
    
    .user-dropdown.show {
        transform: translateX(-50%) translateY(0);
    }
    
    .tabs-container {
        padding: 0 12px;
    }
    
    .tab {
        padding: 14px 16px;
        font-size: 0.8em;
    }
    
    .tab-text {
        display: none;
    }
    
    .tab-icon {
        font-size: 1.4em;
    }
    
    .content-wrapper {
        padding: 20px 15px;
    }
    
    .form-row,
    .form-row.two-cols,
    .form-row.three-cols,
    .form-row.four-cols {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .radio-group {
        flex-direction: column;
        gap: 12px;
    }
    
    .tab-navigation,
    .dashboard-actions {
        flex-direction: column;
        gap: 12px;
    }
    
    .progress-container {
        padding: 12px 20px;
    }
    
    .auto-save-indicator {
        left: 12px;
        right: 12px;
        bottom: 12px;
        min-width: auto;
    }
    
    h2 {
        font-size: 1.25em;
    }

    .persona-card {
        padding: 16px;
    }

    .persona-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .btn-remove-persona {
        width: 100%;
        justify-content: center;
    }
    
    .summary-bar {
        padding: 8px 20px;
        gap: 8px;
        font-size: 0.75em;
    }
}

/* Ajuste: en tarjetas de Personas Damnificadas / Agresores, permitir columnas más angostas */
.persona-card .form-row.two-cols {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.persona-card .form-row.three-cols {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.persona-card .form-row.four-cols {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

/* Ocultar el contenedor cuando está vacío (evita el recuadro en blanco) */
.autocomplete-suggestions:empty {
  display: none;
  padding: 0;
  border: none;
  box-shadow: none;
}

/* Cuando un campo tiene foco (o algo dentro), lo traemos al frente */
.form-group:focus-within {
  z-index: 5000;
}

/* Localidades: ítems "especiales" */
.autocomplete-item.other {
  font-style: italic;
  opacity: 0.85;
}



/* ---------------------------------------------------------
   COT: Botón discreto + modal de pegado de reportes
--------------------------------------------------------- */

.btn-cot-inline{
  padding: 8px 14px;
  font-size: 0.88em;
  border-radius: 10px;
  gap: 8px;
  opacity: .92;
}

.btn-cot-inline:hover{ opacity: 1; transform: translateY(-1px); }

.cot-inline-actions{
  margin-top: 10px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.cot-inline-hint{
  font-size: 0.85em;
  color: var(--text-secondary);
  max-width: 680px;
}

.cot-modal-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 9999;
}

.cot-modal-overlay.is-open{ display: flex; }

.cot-modal{
  width: min(760px, 96vw);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 22px 60px rgba(0,0,0,0.25);
  overflow: hidden;
}

.cot-modal-header{
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.cot-modal-header h3{
  margin: 0;
  font-size: 1.05em;
}

.cot-modal-sub{
  margin: 4px 0 0 0;
  font-size: 0.88em;
  color: var(--text-secondary);
}

.cot-modal-close{
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1.1em;
  padding: 6px 10px;
  border-radius: 10px;
}

.cot-modal-close:hover{ background: var(--bg-tertiary); }

.cot-modal-body{
  padding: 16px 18px;
}

.cot-modal-label{
  display:block;
  font-weight: 600;
  margin-bottom: 8px;
}

.cot-modal-textarea{
  width: 100%;
  min-height: 220px;
  resize: vertical;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 12px 12px;
  font-family: inherit;
  line-height: 1.35;
}

.cot-modal-footer{
  display:flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 18px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
}

.cot-parse-msg{
  margin-top: 10px;
  font-size: 0.9em;
}

.cot-parse-msg .ok{
  color: #065f46;
  background: rgba(16,185,129,0.12);
  padding: 8px 10px;
  border-radius: 10px;
  margin-top: 6px;
}

.cot-parse-msg .warn{
  color: #92400e;
  background: rgba(245,158,11,0.14);
  padding: 8px 10px;
  border-radius: 10px;
  margin-top: 6px;
}

/* ---------------------------------------------------------
   ADMIN USUARIOS: Modal Editar Usuario
--------------------------------------------------------- */
#modalEditarUsuario.modal-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: none;                /* se muestra con JS */
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 20000;               /* arriba del header (tu header llega a 9000) */
}

/* Cuando lo abrís con JS (display:flex), esto asegura el layout */
#modalEditarUsuario.modal-overlay[style*="display: flex"],
#modalEditarUsuario.modal-overlay.is-open{
  display: flex;
}

/* Opcional: si querés blur suave */
#modalEditarUsuario.modal-overlay{
  backdrop-filter: blur(2px);
}

/* ---------------------------------------------------------
   ADMIN USUARIOS - MODAL EDITAR USUARIO
--------------------------------------------------------- */
#modalEditarUsuario {
  /* el overlay ya lo tenés inline, pero lo reforzamos por si cambia */
  background: rgba(0,0,0,0.55) !important;
}

#modalEditarUsuario .login-container{
  background: #ffffff;
  border-radius: 16px;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  overflow: hidden; /* para que el header redondeado quede prolijo */
}

#modalEditarUsuario .login-header{
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}

#modalEditarUsuario .login-header h1{
  margin: 0;
  font-size: 1.1em;
  font-weight: 700;
}

#modalEditarUsuario .login-icon{
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
}

#modalEditarUsuario .login-body{
  background: var(--bg-primary);
  padding: 18px;
}

/* ============================================
   LOADER INICIAL
   ============================================ */
.app-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    gap: 1.5rem;
}

.app-loader p {
    color: white;
    font-size: 1.1rem;
    font-weight: 500;
    margin: 0;
    animation: pulse 1.5s ease-in-out infinite;
}

.loader-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Estado de edición en resumen */
.summary-value.editando {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-weight: 600;
}

/* Mejora del dropdown del usuario */
.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.user-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: #333;
    text-decoration: none;
    transition: background 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

.user-dropdown a:last-child {
    border-bottom: none;
}

.user-dropdown a:hover {
    background: #f8f9fa;
}

.user-dropdown .menu-icon {
    font-size: 1.2rem;
}

/* --------------------------------------------
   MODAL ENVIAR MAIL (inputs)
-------------------------------------------- */
.mail-input{
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 10px 12px;
  font-family: inherit;
}

.mail-status{
  margin-top: 10px;
  font-size: 0.92em;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  line-height: 1.35;
}
.mail-status.ok{
  border-color: rgba(16,185,129,0.35);
  background: rgba(16,185,129,0.10);
}
.mail-status.err{
  border-color: rgba(239,68,68,0.35);
  background: rgba(239,68,68,0.10);
}


/* Responsive */
@media (max-width: 768px) {
    .loader-spinner {
        width: 50px;
        height: 50px;
    }
    
    .app-loader p {
        font-size: 1rem;
    }
}

/* ============================
   MODAL MAIL + CHIPS (Gmail-ish)
============================ */
.mail-modal-overlay{
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.45);
  z-index: 9999;
}
.mail-modal-overlay.is-open{ display:flex; }

.mail-modal{
  width: min(820px, 92vw);
  max-height: 90vh;
  overflow: auto;
  background: var(--bg-primary);
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0,0,0,.25);
  border: 1px solid var(--border);
}

.mail-modal-header{
  display:flex;
  align-items:flex-start;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.mail-modal-header h3{ margin:0; font-size: 18px; }
.mail-modal-sub{ margin:6px 0 0 0; color: var(--text-secondary); font-size: 13px; }

.mail-modal-close{
  border: none;
  background: transparent;
  font-size: 18px;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
}
.mail-modal-close:hover{ background: var(--bg-tertiary); }

.mail-modal-body{ padding: 14px 18px; }
.mail-modal-footer{
  display:flex;
  justify-content:flex-end;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
}

.mail-row{ display:grid; grid-template-columns: 70px 1fr; gap: 10px; margin-bottom: 10px; align-items:start; }
.mail-label{ padding-top: 9px; color: var(--text-secondary); font-size: 13px; }

.mail-input{
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-primary);
}

.mail-textarea{
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-primary);
  resize: vertical;
}

/* Chips */
.chipbox{
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--bg-primary);
}
.chips{
  display:flex;
  flex-wrap:wrap;
  gap: 6px;
  margin-bottom: 6px;
}
.chip{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  font-size: 12px;
}
.chip-label{ color: var(--text-primary); }
.chip-tag{
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(59,130,246,.12);
  border: 1px solid rgba(59,130,246,.25);
  color: var(--text-primary);
}
.chip-x{
  border:none;
  background: transparent;
  cursor:pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  border-radius: 8px;
}
.chip-x:hover{ background: rgba(0,0,0,.06); }

.chip-input{
  width: 100%;
  border: none;
  outline: none;
  padding: 6px 2px;
  background: transparent;
}

/* Sugerencias */
.mail-suggest{
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-primary);
}
.mail-suggest-item{
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.mail-suggest-item:last-child{ border-bottom:none; }
.mail-suggest-item:hover{ background: var(--bg-tertiary); }

.mail-error{
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(239,68,68,.25);
  background: rgba(239,68,68,.08);
  color: var(--text-primary);
  font-size: 13px;
}

.auto-suggest {
  position: absolute;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0,0,0,.12);
  max-height: 240px;
  overflow: auto;
  z-index: 99999;
}

.auto-suggest .item {
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  gap: 10px;
  align-items: center;
}

.auto-suggest .item:hover,
.auto-suggest .item.is-active {
  background: #f3f4f6;
}

.auto-suggest .muted {
  color: #6b7280;
  font-size: 12px;
}
