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

:root {
    --brand-teal:     #0C4566;
    --brand-teal-dim: #F0F5F8;
    --brand-red:      #A61B1B;
    --brand-red-dim:  #FDF2F2;

    --bg:          #F4F6F8;
    --bg-card:     #ffffff;
    --bg-input:    #f8fafc;
    --border:      #E2E8F0;
    --border-dark: #CBD5E1;
    --text-1:      #0F172A;
    --text-2:      #475569;
    --text-3:      #94A3B8;

    --accent:      var(--brand-teal);
    --accent-mid:  #125E85;
    --accent-dim:  var(--brand-teal-dim);

    --red:         var(--brand-red);
    --red-dim:     var(--brand-red-dim);

    --green:       #059669;
    --green-dim:   #ECFDF5;
    --amber:       #D97706;
    --amber-dim:   #FEF3C7;

    --radius:      12px;
    --shadow:      0 1px 3px rgba(0,0,0,0.02), 0 4px 12px rgba(12, 69, 102, 0.05);
    --shadow-md:   0 4px 20px rgba(12, 69, 102, 0.08), 0 1px 4px rgba(0,0,0,0.02);
    --shadow-lg:   0 8px 40px rgba(12, 69, 102, 0.12), 0 2px 8px rgba(0,0,0,0.04);
    --ease-out:    cubic-bezier(0.23, 1, 0.32, 1);
    --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text-1);
    min-height: 100vh;
    line-height: 1.5;
    font-size: 14px;
    background-image: radial-gradient(circle at 1px 1px, rgba(0,0,0,0.035) 1px, transparent 0);
    background-size: 28px 28px;
}

/* ---- Header ---- */
.app-header {
    background: var(--brand-teal);
    padding: 0 32px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(13, 78, 92, 0.15);
}

.header-brand {
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: transform 150ms var(--ease-out);
}
.header-brand:hover { transform: translateY(-0.5px); }

.header-logo { height: 38px; width: auto; display: block; }

.header-divider {
    width: 1px;
    height: 22px;
    background: rgba(255,255,255,0.22);
    margin: 0 16px;
}

.header-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.header-stats { display: flex; gap: 12px; align-items: center; }

.stat-badge {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.65);
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.1);
    padding: 5px 14px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.15);
}
.stat-badge .num { color: #fff; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---- Layout ---- */
.container { max-width: 1400px; margin: 0 auto; padding: 28px 32px; }

/* ---- Card ---- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: visible;
    margin-bottom: 20px;
    animation: card-in 350ms var(--ease-out) both;
}
.card + .card { animation-delay: 60ms; }

@keyframes card-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.card-header {
    padding: 13px 20px;
    background: linear-gradient(90deg, var(--brand-teal), #125E85);
    color: #ffffff;
    font-weight: 600;
    font-size: 0.82rem;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
}

.card-body { padding: 24px; }

/* ---- Form Grid ---- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
}
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.span-2 { grid-column: span 2; }
.form-group.span-3 { grid-column: span 3; }

.form-group label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.form-group input,
.form-group textarea,
.form-group select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 12px;
    color: var(--text-1);
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    transition: border-color 150ms ease-out, box-shadow 150ms ease-out, background 150ms ease-out;
    outline: none;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--accent);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.1);
}
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--text-3); }
.form-group input[readonly] {
    background: #f1f3f6;
    color: var(--text-2);
    cursor: default;
    border-color: var(--border);
}
.form-group textarea { resize: vertical; min-height: 60px; }

/* ---- Section Titles ---- */
.section-title {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-bottom: 12px;
    margin-top: 22px;
    padding-left: 9px;
    border-left: 3px solid var(--accent-mid);
    line-height: 1.3;
}
.section-title:first-child { margin-top: 0; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform 160ms ease-out, background 150ms ease-out, box-shadow 150ms ease-out,
                border-color 150ms ease-out, color 150ms ease-out;
    text-decoration: none;
    white-space: nowrap;
    will-change: transform;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    box-shadow: 0 1px 4px rgba(12,69,102,0.25);
}
@media (hover: hover) and (pointer: fine) {
    .btn-primary:hover { background: #072C41; border-color: #072C41; box-shadow: 0 3px 10px rgba(12,69,102,0.4); }
}

.btn-danger { background: var(--red-dim); color: var(--red); border-color: #fca5a5; }
@media (hover: hover) and (pointer: fine) { .btn-danger:hover { background: #fee2e2; } }

.btn-warning { background: var(--accent-dim); color: var(--accent); border-color: #a5d2db; }
@media (hover: hover) and (pointer: fine) { .btn-warning:hover { background: #e0ecef; } }

.btn-success { background: var(--green-dim); color: var(--green); border-color: #86efac; }
@media (hover: hover) and (pointer: fine) { .btn-success:hover { background: #dcfce7; } }

.btn-edit { background: #f8f9fb; color: var(--text-2); border-color: var(--border); }
@media (hover: hover) and (pointer: fine) {
    .btn-edit:hover { background: var(--accent-dim); color: var(--accent); border-color: #a5d2db; }
}

.btn-excel { background: #f0fdf4; color: #15803d; border-color: #86efac; }
@media (hover: hover) and (pointer: fine) { .btn-excel:hover { background: #dcfce7; border-color: #4ade80; } }

.btn-pdf { background: #fef2f2; color: #b91c1c; border-color: #fca5a5; }
@media (hover: hover) and (pointer: fine) { .btn-pdf:hover { background: #fee2e2; border-color: #f87171; } }

.btn-deactivate { background: #fffbeb; color: #92400e; border: 1px solid #fcd34d; }
@media (hover: hover) and (pointer: fine) { .btn-deactivate:hover { background: #fef3c7; } }

.btn-sm { padding: 5px 12px; font-size: 0.75rem; }

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 24px;
    justify-content: flex-end;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* ---- Alerts ---- */
.alert-container { margin-bottom: 16px; }
.alert {
    padding: 11px 16px;
    border-radius: var(--radius);
    font-size: 0.82rem;
    margin-bottom: 8px;
    border: 1px solid;
    line-height: 1.5;
    animation: alert-in 300ms var(--ease-out) both;
}
@keyframes alert-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.alert-warning  { background: var(--amber-dim); border-color: #fcd34d; color: var(--amber); }
.alert-danger   { background: var(--red-dim);   border-color: #fca5a5; color: var(--red);   }
.alert-info     { background: var(--accent-dim); border-color: #93c5fd; color: #1d4ed8;     }
.alert-success  { background: var(--green-dim); border-color: #86efac; color: var(--green); }

/* ---- Data Table ---- */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }

thead th {
    background: linear-gradient(135deg, var(--brand-teal), #125E85);
    color: #e6f3f5;
    font-weight: 500;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    padding: 11px 14px;
    text-align: left;
    white-space: nowrap;
}

tbody tr {
    transition: background 120ms ease-out;
    animation: row-in 280ms var(--ease-out) both;
}
tbody tr:nth-child(1)  { animation-delay:   0ms; }
tbody tr:nth-child(2)  { animation-delay:  30ms; }
tbody tr:nth-child(3)  { animation-delay:  55ms; }
tbody tr:nth-child(4)  { animation-delay:  80ms; }
tbody tr:nth-child(5)  { animation-delay: 105ms; }
tbody tr:nth-child(6)  { animation-delay: 125ms; }
tbody tr:nth-child(7)  { animation-delay: 145ms; }
tbody tr:nth-child(8)  { animation-delay: 160ms; }
tbody tr:nth-child(9)  { animation-delay: 175ms; }
tbody tr:nth-child(10) { animation-delay: 190ms; }

@keyframes row-in {
    from { opacity: 0; transform: translateY(5px); }
    to   { opacity: 1; transform: translateY(0); }
}

tbody tr:nth-child(even) { background: #fafafa; }
@media (hover: hover) and (pointer: fine) { tbody tr:hover { background: #eff4ff; } }

tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid #edf0f4;
    color: var(--text-1);
    white-space: nowrap;
}
.actions-cell { display: flex; gap: 5px; }
.td-user { font-size: 0.78rem; color: var(--text-2); white-space: nowrap; }
.td-editado { color: var(--text-3); font-style: italic; }

/* ---- Filtros ---- */
.filtros-form {
    margin-bottom: 14px;
    padding: 14px 16px;
    background: #f8f9fb;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.filtros-row { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.filtro-group { display: flex; flex-direction: column; gap: 4px; }
.filtro-group label {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.filtro-group input,
.filtro-group select {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 7px 12px;
    color: var(--text-1);
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 150ms ease-out, box-shadow 150ms ease-out;
    height: 34px;
}
.filtro-group input:focus,
.filtro-group select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.08); }
.filtro-search { flex: 1; min-width: 240px; }
.filtro-search input { width: 100%; }
.filtro-actions { display: flex; gap: 8px; align-items: center; padding-top: 18px; }

.resultados-info { font-size: 0.78rem; color: var(--text-3); margin-bottom: 12px; }

/* ---- Pagination ---- */
.pagination { display: flex; align-items: center; gap: 4px; margin-top: 16px; flex-wrap: wrap; }
.page-btn {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    font-size: 0.78rem;
    font-weight: 500;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    color: var(--text-2);
    text-decoration: none;
    transition: transform 160ms ease-out, background 150ms ease-out,
                border-color 150ms ease-out, color 150ms ease-out;
    cursor: pointer;
}
.page-btn:not(.page-disabled):not(.page-active):active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) {
    .page-btn:not(.page-disabled):not(.page-active):hover {
        background: var(--accent-dim); border-color: #bfdbfe; color: var(--accent);
    }
}
.page-active  { background: var(--accent); border-color: var(--accent); color: #fff; cursor: default; }
.page-disabled { color: var(--text-3); cursor: default; background: #f8f9fb; }
.page-ellipsis { padding: 6px 4px; color: var(--text-3); font-size: 0.82rem; }

/* ---- Empty State ---- */
.empty-state { text-align: center; padding: 64px 20px; color: var(--text-3); }
.empty-state::before {
    content: '';
    display: block;
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent-dim), #dbeafe);
    border: 1px solid #bfdbfe;
}
.empty-state p { font-size: 0.9rem; color: var(--text-2); margin-bottom: 16px; }

/* ---- Form select arrow ---- */
.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234b5563' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* ---- Modal ---- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.55);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
    animation: overlay-in 200ms ease-out both;
}
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 520px;
    max-height: 80vh;
    overflow-y: auto;
    border: 1px solid var(--border);
    animation: modal-in 250ms var(--ease-out) both;
}
@keyframes modal-in {
    from { opacity: 0; transform: scale(0.95) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
    padding: 16px 20px;
    background: linear-gradient(90deg, var(--brand-teal), #125E85);
    color: #ffffff;
    border-radius: var(--radius) var(--radius) 0 0;
}
.modal-header h2 { font-size: 0.9rem; font-weight: 600; margin: 0; text-transform: uppercase; }
.modal-body { padding: 20px; }
.modal-body .alert { margin-bottom: 8px; font-size: 0.82rem; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ---- Header buttons ---- */
.btn-header {
    font-size: 0.75rem;
    color: #fff;
    text-decoration: none;
    padding: 5px 12px;
    border-radius: 6px;
    transition: background 150ms ease-out, transform 120ms ease-out, border-color 150ms ease-out;
    font-weight: 500;
    border: 1px solid rgba(255,255,255,0.2);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.btn-header-purple { background: rgba(167, 139, 250, 0.15); border-color: rgba(167, 139, 250, 0.35); color: #e9e3ff !important; }
@media (hover: hover) and (pointer: fine) {
    .btn-header-purple:hover { background: rgba(167, 139, 250, 0.3); border-color: rgba(167, 139, 250, 0.6); color: #fff !important; }
}
.btn-header-teal { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.25); color: #e0f0ff !important; }
@media (hover: hover) and (pointer: fine) {
    .btn-header-teal:hover { background: rgba(255,255,255,0.22); border-color: rgba(255,255,255,0.5); color: #fff !important; }
}
.btn-header-amber { background: rgba(245, 158, 11, 0.15); border-color: rgba(245, 158, 11, 0.35); color: #ffeccf !important; }
@media (hover: hover) and (pointer: fine) {
    .btn-header-amber:hover { background: rgba(245, 158, 11, 0.3); border-color: rgba(245, 158, 11, 0.6); color: #fff !important; }
}

.btn-logout {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    padding: 5px 12px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 6px;
    transition: background 150ms ease-out, color 150ms ease-out;
    font-weight: 500;
}
@media (hover: hover) and (pointer: fine) {
    .btn-logout:hover { background: rgba(255,255,255,0.15); color: #fff; }
}

.header-user-icon { color: #86efac; font-size: 0.55rem; vertical-align: middle; }

/* ---- Login ---- */
.login-body {
    background-image:
        radial-gradient(circle at 1px 1px, rgba(255,255,255,0.04) 1px, transparent 0),
        linear-gradient(135deg, #062329 0%, #0d4e5c 50%, #177184 100%);
    background-size: 28px 28px, 100% 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-wrapper {
    width: 100%;
    max-width: 440px;
    padding: 20px;
    animation: login-in 500ms var(--ease-out) both;
}
@keyframes login-in {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}
.login-box {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(6, 35, 41, 0.4), 0 4px 16px rgba(0,0,0,0.08);
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.1);
}
.login-header {
    background: #ffffff;
    padding: 40px 32px 20px;
    text-align: center;
    color: var(--text-1);
    border-bottom: 1px solid var(--border);
}
.login-logo { display: flex; align-items: center; justify-content: center; margin: 0 auto 24px; }
.login-logo img { height: 72px; width: auto; }
.login-header h1 { font-size: 1.25rem; font-weight: 700; color: var(--brand-teal); margin-bottom: 6px; }
.login-header p  { font-size: 0.85rem; color: var(--text-2); }
.login-body-inner { padding: 28px; }
.login-btn { width: 100%; justify-content: center; margin-top: 20px; padding: 11px; font-size: 0.875rem; }

/* ---- Archivos adjuntos ---- */
.archivos-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }

.archivo-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #f8f9fb;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    gap: 12px;
    transition: border-color 150ms ease-out, background 150ms ease-out;
}
@media (hover: hover) and (pointer: fine) {
    .archivo-item:hover { background: #fff; border-color: var(--border-dark); }
}
.archivo-info { display: flex; align-items: center; gap: 12px; min-width: 0; }

.archivo-ext {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    flex-shrink: 0;
    background: var(--accent-dim);
    color: var(--accent);
    border: 1px solid #bfdbfe;
}
.archivo-ext-pdf  { background: #fef2f2; color: var(--red);   border-color: #fca5a5; }
.archivo-ext-doc,
.archivo-ext-docx { background: #eff6ff; color: #1d4ed8;      border-color: #93c5fd; }
.archivo-ext-xls,
.archivo-ext-xlsx { background: #f0fdf4; color: var(--green);  border-color: #86efac; }
.archivo-ext-jpg,
.archivo-ext-jpeg,
.archivo-ext-png  { background: #fdf4ff; color: #7c3aed;      border-color: #d8b4fe; }

.archivo-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.archivo-nombre { font-size: 0.85rem; font-weight: 500; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.archivo-detalle { font-size: 0.72rem; color: var(--text-3); }
.archivo-acciones { display: flex; gap: 6px; flex-shrink: 0; }
.archivos-empty { font-size: 0.82rem; color: var(--text-3); margin-bottom: 14px; padding: 12px 0; }

.upload-form {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--accent-dim);
    border: 1px dashed #93c5fd;
    border-radius: var(--radius);
    flex-wrap: wrap;
    transition: border-color 150ms ease-out, background 150ms ease-out;
}
@media (hover: hover) and (pointer: fine) {
    .upload-form:hover { background: #dbeafe; border-color: var(--accent); }
}
.upload-input { font-size: 0.82rem; color: var(--text-2); flex: 1; min-width: 200px; }
.upload-hint  { font-size: 0.72rem; color: var(--text-3); white-space: nowrap; }

/* ---- Thumbnail de imagen ---- */
.archivo-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border);
    cursor: zoom-in;
    transition: transform 200ms var(--ease-out), border-color 150ms ease-out;
    flex-shrink: 0;
}
@media (hover: hover) and (pointer: fine) {
    .archivo-thumb:hover { transform: scale(1.1); border-color: var(--accent); }
}

/* ---- Modal imagen ---- */
.img-modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(10, 15, 30, 0.82);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    cursor: zoom-out;
    animation: overlay-in 200ms ease-out both;
}
.img-modal-box {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    cursor: default;
    animation: modal-in 250ms var(--ease-out) both;
}
.img-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: linear-gradient(90deg, var(--brand-teal), #125E85);
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 500;
    gap: 16px;
}
.img-modal-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 150ms ease-out;
}
@media (hover: hover) and (pointer: fine) { .img-modal-close:hover { opacity: 1; } }
.img-modal-img { max-width: 90vw; max-height: calc(90vh - 44px); object-fit: contain; display: block; }

/* ---- Collapse chevron ---- */
.collapse-chevron {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.7);
    margin-left: 8px;
    font-weight: 700;
    transition: transform 200ms var(--ease-out);
}

/* ---- Afiliado dropdown autocomplete ---- */
.afiliado-dropdown {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--border-dark);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    z-index: 200;
    overflow: hidden;
    animation: card-in 150ms var(--ease-out) both;
}
.afiliado-opt {
    padding: 9px 14px;
    font-size: 0.82rem;
    color: var(--text-1);
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 100ms ease-out;
}
.afiliado-opt:last-child { border-bottom: none; }
@media (hover: hover) and (pointer: fine) {
    .afiliado-opt:hover { background: var(--accent-dim); }
}

/* ---- Link expediente ---- */
.link-expediente {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: color 150ms ease-out;
}
@media (hover: hover) and (pointer: fine) {
    .link-expediente:hover { color: #1e40af; text-decoration: underline; }
}

/* ---- Row desactivada ---- */
tbody tr.row-desactivada { opacity: 0.5; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #c8cdd8; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-dark); }

/* ---- Spinner ---- */
.spinner {
    display: inline-block;
    width: 13px; height: 13px;
    border: 2px solid #c7d2fe;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.5s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .app-header { padding: 0 16px; }
    .container  { padding: 16px; }
    .form-grid  { grid-template-columns: 1fr; }
    .form-group.span-2,
    .form-group.span-3 { grid-column: span 1; }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
