/* ========================================
   Sistema de Gestión Entramados
   Estilos CSS Principales
   ======================================== */

/* Variables CSS */
:root {
    /* Colores principales - Branding San Martin + Entramados */
    --primary: #7B2D8E;
    --primary-dark: #5E1A6E;
    --primary-light: #A855C7;
    --secondary: #64748b;
    --accent: #00A89D;
    --accent-light: #00C4B7;
    --san-martin: #00B0F0;
    --san-martin-dark: #0090C8;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    /* Fondos - Tema claro */
    --bg-primary: #f0f2f5;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e5e7eb;
    --bg-card: #ffffff;

    /* Texto */
    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;

    /* Bordes */
    --border-color: #e5e7eb;
    --border-radius: 12px;
    --border-radius-sm: 8px;

    /* Sombras */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);

    /* Transiciones */
    --transition: all 0.3s ease;

    /* Espaciado */
    --sidebar-width: 260px;
    --banner-height: 140px;
}

/* Reset y base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    display: flex;
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

/* ========================================
   INSTITUTIONAL BANNER
   ======================================== */
.institutional-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--banner-height);
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    border-bottom: 3px solid var(--primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 0 2rem;
}

.banner-brand {
    display: flex;
    align-items: center;
    gap: 2.5rem;
    text-decoration: none;
}

.banner-brand:hover {
    opacity: 0.9;
}

.banner-logo {
    width: auto;
    object-fit: contain;
}

/* SM tiene whitespace interno en el JPEG → necesita más height para verse parejo */
.banner-logo-sm {
    height: 130px;
}

.banner-logo-ent {
    height: 110px;
}

.banner-title {
    text-align: center;
}

.banner-title-main {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 0.2em;
}

.banner-title-sub {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    letter-spacing: 0.02em;
}

.banner-right {
    position: absolute;
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.banner-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.banner-user .user-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

.banner-user .btn-admin {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    background: var(--success);
    color: white;
    border-radius: var(--border-radius-sm);
    text-decoration: none;
    font-weight: 600;
}

.banner-user .btn-logout {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    background: #fee2e2;
    color: #991b1b;
    border-radius: var(--border-radius-sm);
    text-decoration: none;
    font-weight: 600;
}

.banner-ver {
    font-size: 0.6rem;
    color: var(--text-muted);
}

/* ========================================
   SIDEBAR
   ======================================== */
.sidebar {
    width: var(--sidebar-width);
    background: #ffffff;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: var(--banner-height);
    height: calc(100vh - var(--banner-height));
    z-index: 100;
}

.sidebar-menu {
    list-style: none;
    padding: 1rem 0;
    flex: 1;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.5rem;
    color: var(--text-secondary);
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.sidebar-menu li a:hover,
.sidebar-menu li a.active {
    background: rgba(123, 45, 142, 0.1);
    color: var(--text-primary);
    border-left-color: var(--primary);
}

.menu-icon {
    font-size: 1.25rem;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
}

.version-info {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ========================================
   MAIN CONTENT
   ======================================== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    margin-top: var(--banner-height);
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--banner-height));
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.page-title h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

/* Breadcrumbs */
.breadcrumbs {
    padding: 0.5rem 2rem;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--text-muted);
}

.breadcrumbs a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.15s;
}

.breadcrumbs a:hover {
    color: var(--primary);
}

.breadcrumbs .bc-separator {
    color: var(--text-muted);
    font-size: 0.7rem;
}

.breadcrumbs .bc-current {
    color: var(--text-primary);
    font-weight: 500;
}

.top-bar-actions {
    display: flex;
    gap: 0.75rem;
}

.content-wrapper {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

/* ========================================
   ALERTAS
   ======================================== */
.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius-sm);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--success);
}

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

.alert-error ul {
    margin-left: 1.5rem;
}

/* ========================================
   BOTONES
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    color: white;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent) 0%, #0891b2 100%);
    color: white;
}

.btn-accent:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-1px);
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

.btn-icon {
    padding: 0.5rem;
    font-size: 1.25rem;
    background: transparent;
    border-radius: 50%;
}

.btn-icon:hover {
    background: var(--bg-tertiary);
}

.btn-search {
    background: var(--primary);
    color: white;
}

/* ========================================
   DASHBOARD
   ======================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
}

.stat-label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.quick-actions {
    margin-bottom: 2rem;
}

.quick-actions h2 {
    margin-bottom: 1rem;
    font-size: 1.125rem;
    color: var(--text-secondary);
}

.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.action-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    text-align: center;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.action-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.action-icon {
    font-size: 2rem;
}

.action-label {
    color: var(--text-primary);
    font-weight: 500;
}

.recent-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.recent-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
}

.recent-panel h3 {
    margin-bottom: 1rem;
    font-size: 1rem;
    color: var(--text-secondary);
}

.recent-list {
    list-style: none;
}

.recent-list li {
    border-bottom: 1px solid var(--border-color);
}

.recent-list li:last-child {
    border-bottom: none;
}

.recent-list li a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    color: var(--text-primary);
}

.recent-list li a:hover {
    color: var(--primary);
}

.item-meta {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.empty-message {
    color: var(--text-muted);
    text-align: center;
    padding: 1rem;
}

/* ========================================
   TABLAS Y LISTAS
   ======================================== */
.search-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
}

.search-form {
    display: flex;
    gap: 0.5rem;
    flex: 1;
}

.search-input {
    flex: 1;
    max-width: 400px;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(123, 45, 142, 0.2);
}

.search-results-count {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.data-table tr:hover {
    background: rgba(123, 45, 142, 0.05);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.name-link {
    font-weight: 500;
}

.actions-cell {
    display: flex;
    gap: 0.25rem;
}

.text-muted {
    color: var(--text-muted);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.empty-state h3 {
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.empty-state-small {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

/* ========================================
   FORMULARIOS
   ======================================== */
.form-page {
    max-width: 900px;
}

.main-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0;
    overflow: hidden;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: var(--bg-tertiary);
    cursor: pointer;
    user-select: none;
    transition: var(--transition);
    font-weight: 600;
    border: none;
}

.section-header:hover {
    background: var(--border-color);
}

.section-icon {
    font-size: 1.25rem;
}

.toggle-icon {
    margin-left: auto;
    color: var(--text-muted);
}

.form-section.collapsed .form-grid {
    display: none;
}

.form-section.expanded .form-grid {
    display: grid;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    padding: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group.full-width {
    grid-column: span 2;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.75rem 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: inherit;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(123, 45, 142, 0.2);
}

.form-group input[readonly] {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group select {
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: 1rem;
    padding-top: 1rem;
}

/* ========================================
   DETALLE
   ======================================== */
.detail-page {
    max-width: 900px;
}

.profile-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    color: white;
}

.intervention-avatar {
    background: rgba(255, 255, 255, 0.2);
    font-size: 2.5rem;
}

.profile-info h2 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.profile-subtitle {
    opacity: 0.9;
}

.detail-sections {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.detail-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
}

.detail-section h3 {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.detail-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.detail-value {
    font-weight: 500;
}

.detail-text {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.detail-text p {
    margin-top: 0.5rem;
    color: var(--text-secondary);
}

.detail-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Timeline */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.timeline-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: var(--border-radius-sm);
}

.timeline-date {
    flex-shrink: 0;
    width: 100px;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.timeline-content h4 {
    margin-bottom: 0.25rem;
}

.timeline-content p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.timeline-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ========================================
   EXPEDIENTE
   ======================================== */
.expediente-page {
    max-width: 800px;
}

.expediente-preview {
    background: white;
    color: #1a1a1a;
    padding: 3rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
}

.expediente-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #333;
}

.expediente-logos {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    margin-bottom: 1rem;
}

.expediente-logos img {
    height: 130px;
    width: auto;
    object-fit: contain;
}

.expediente-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.expediente-header h2 {
    font-size: 1.25rem;
    font-weight: 400;
}

.expediente-section {
    margin-bottom: 2rem;
}

.expediente-section h3 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #ddd;
}

.expediente-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.expediente-table td {
    padding: 0.5rem;
    border: 1px solid #ddd;
}

.expediente-table td:first-child {
    width: 200px;
    background: #f5f5f5;
}

.expediente-text {
    margin-top: 1rem;
}

.expediente-text h4 {
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.expediente-timeline {
    margin-top: 1rem;
}

.expediente-entry {
    margin-bottom: 1rem;
}

.entry-date {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.entry-type {
    font-weight: 400;
    color: #666;
}

.entry-meta {
    font-size: 0.875rem;
    color: #666;
    font-style: italic;
}

.entry-separator {
    border: none;
    border-top: 1px dashed #ccc;
    margin: 1rem 0;
}

.expediente-footer {
    text-align: right;
    color: #666;
    font-size: 0.875rem;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #ddd;
}

.download-float {
    position: sticky;
    bottom: 2rem;
    text-align: center;
    margin-top: 2rem;
}

/* ========================================
   VALIDACIÓN DE CAMPOS
   ======================================== */

/* Campos obligatorios */
.required-field input:not(:placeholder-shown):invalid,
.required-field select:invalid,
.required-field textarea:not(:placeholder-shown):invalid {
    border-color: #ef4444;
    border-width: 2px;
}

.required-field input:valid,
.required-field select:valid,
.required-field textarea:valid {
    border-color: #10b981;
}

.required-field label::after {
    content: ' *';
    color: #ef4444;
    font-weight: bold;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 600;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.intervention-title {
    font-weight: 500;
}

.intervention-subtitle {
    font-size: 0.85em;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Grilla de Participantes por Edades */
.grilla-edades {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5rem;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
}

.grilla-edades th,
.grilla-edades td {
    padding: 0.75rem 0.5rem;
    text-align: center;
    border: 1px solid var(--border-color);
}

.grilla-edades th {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.85rem;
}

.grilla-edades td.fila-label {
    text-align: left;
    font-weight: 500;
    padding-left: 1rem;
    min-width: 150px;
    background: var(--bg-secondary);
}

.grilla-edades td.fila-label small {
    color: var(--text-muted);
    font-weight: 400;
}

.grilla-edades input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

.grilla-edades tr:hover {
    background: rgba(123, 45, 142, 0.1);
}

.hint-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

/* (Sidebar logos removed - now using institutional banner) */

.logo-text-container {
    text-align: center;
}

.logo-subtitle {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Login logos */
.login-logos {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.login-logos img {
    height: 55px;
    width: auto;
    object-fit: contain;
}

/* ========================================
   SVG MENU ICONS
   ======================================== */
.menu-icon {
    font-size: 1.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.menu-icon svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon-inline {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}

.icon-inline svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ========================================
   SELECTOR NNoA CON CHIPS
   ======================================== */
.ninxs-selector {
    position: relative;
}

.ninxs-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    padding: 0.5rem;
    min-height: 42px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    cursor: text;
    align-items: center;
}

.ninxs-chips:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(123, 45, 142, 0.2);
}

.ninx-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: var(--primary);
    color: white;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
}

.chip-remove {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    font-size: 1rem;
    padding: 0 0.125rem;
    line-height: 1;
}

.chip-remove:hover {
    color: white;
}

.ninxs-input {
    border: none !important;
    outline: none !important;
    background: transparent !important;
    flex: 1;
    min-width: 150px;
    padding: 0.25rem !important;
    font-size: 0.875rem;
    color: var(--text-primary);
    box-shadow: none !important;
}

.ninxs-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    margin-top: 0.25rem;
    z-index: 50;
    box-shadow: var(--shadow-lg);
}

.ninxs-dropdown-item {
    padding: 0.625rem 0.75rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.15s;
    font-size: 0.875rem;
}

.ninxs-dropdown-item:hover {
    background: var(--bg-tertiary);
}

.ninxs-dropdown-item.already-selected {
    opacity: 0.4;
    pointer-events: none;
}

.form-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.375rem;
    display: block;
}

/* ========================================
   HAMBURGER MENU (MOBILE)
   ======================================== */
.hamburger-btn {
    display: none;
    position: fixed;
    top: calc(var(--banner-height) + 0.75rem);
    left: 1rem;
    z-index: 150;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem;
    cursor: pointer;
    flex-direction: column;
    gap: 4px;
}

.hamburger-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    transition: var(--transition);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

.sidebar-overlay.active {
    display: block;
}

/* Observaciones box en NNoA form */
.observaciones-box {
    background-color: rgba(123, 45, 142, 0.08);
    padding: 20px;
    border-radius: 8px;
    border-left: 5px solid var(--primary);
    margin-top: 20px;
    grid-column: 1 / -1;
}

.observaciones-box label {
    font-weight: bold;
    font-size: 1.1em;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.observaciones-box .obs-hint {
    font-size: 0.9em;
    color: var(--text-muted);
    margin-bottom: 10px;
    font-style: italic;
}

.observaciones-box textarea {
    width: 100%;
    border: 1px solid var(--primary);
    padding: 10px;
    font-family: monospace;
    font-size: 14px;
}

/* User menu in topbar */
.user-menu {
    margin-left: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 500;
}

.btn-admin {
    font-size: 0.8rem;
    padding: 0.2rem 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-secondary);
    text-decoration: none;
}

.btn-logout {
    font-size: 0.8rem;
    padding: 0.2rem 0.5rem;
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-radius: 4px;
    text-decoration: none;
}

/* ========================================
   RESPONSIVE (UPDATED)
   ======================================== */
@media (max-width: 768px) {
    :root {
        --banner-height: 60px;
    }

    .institutional-banner {
        padding: 0 1rem;
    }

    .banner-logo-sm {
        height: 50px;
    }

    .banner-logo-ent {
        height: 42px;
    }

    .banner-title-main {
        font-size: 1.1rem;
    }

    .banner-title-sub {
        display: none;
    }

    .banner-right {
        display: none;
    }

    .hamburger-btn {
        display: flex;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .top-bar {
        padding-left: 3.5rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-group.full-width {
        grid-column: span 1;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .profile-header {
        flex-direction: column;
        text-align: center;
    }

    .detail-actions {
        flex-direction: column;
    }

    .search-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-form {
        flex-direction: column;
    }

    .search-input {
        max-width: 100%;
    }
}
