.data-page {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 22px;
}

.table-scroll {
    max-width: 100%;
    overflow-x: auto;
}

.screen-exit-row {
    display: flex;
    justify-content: flex-start;
}

.screen-exit-link {
    display: inline-flex;
    min-height: 32px;
    padding: 0 10px;
    align-items: center;
    border-radius: 6px;
    color: var(--blue-dark);
    font-size: 0.9rem;
    font-weight: 800;
}

.screen-exit-link:hover,
.screen-exit-link:focus {
    background: var(--soft);
    color: var(--orange);
}

.data-page-eyebrow {
    margin: -4px 0 -12px;
    color: var(--orange);
    font-size: 0.82rem;
    font-weight: 900;
    text-transform: uppercase;
}

.data-hero {
    display: grid;
    padding: clamp(22px, 4vw, 34px);
    align-items: flex-start;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 20px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.data-hero-content {
    display: contents;
}

.data-hero h1 {
    margin: 0 0 10px;
    color: var(--blue-dark);
    font-size: clamp(1.8rem, 4vw, 2.55rem);
    line-height: 1.08;
}

.data-hero p:not(.eyebrow) {
    max-width: 760px;
    margin: 0;
    color: var(--muted);
    line-height: 1.7;
}

.data-actions {
    display: flex;
    grid-column: 2;
    grid-row: 1;
    flex: 0 0 auto;
    flex-wrap: wrap;
    gap: 10px;
}

/* Encabezado con muchos botones (ficha de usuario): los botones van debajo del nombre
   para que no lo aplasten. */
.data-hero.data-hero-stacked { grid-template-columns: minmax(0, 1fr); }
.data-hero.data-hero-stacked .data-actions { grid-column: 1; grid-row: auto; align-items: center; }

.participant-identity {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 18px;
}

.participant-identity h1 {
    min-width: 0;
    overflow-wrap: anywhere;
}

.participant-photo-frame {
    position: relative;
    width: 88px;
    height: 88px;
    flex: 0 0 88px;
}

.participant-photo-frame img,
.participant-photo-placeholder,
.participant-photo-editor img {
    display: grid;
    width: 100%;
    height: 100%;
    object-fit: cover;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface-alt);
}

.participant-photo-placeholder {
    color: var(--muted);
    font-size: 2rem;
}

.participant-photo-add {
    position: absolute;
    right: -7px;
    bottom: -7px;
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 2px solid var(--surface);
    border-radius: 50%;
    color: var(--white);
    background: var(--blue);
    font-size: 1.4rem;
    font-weight: 700;
}

.participant-photo-editor {
    display: grid;
    width: min(100%, 480px);
    gap: 20px;
}

.participant-photo-editor img,
.participant-photo-editor .participant-photo-placeholder {
    width: 160px;
    height: 160px;
}

.participant-photo-editor form {
    display: grid;
    gap: 18px;
}

.action-menu-trigger,
.action-dialog-close {
    display: inline-grid;
    width: 44px;
    height: 44px;
    padding: 0;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    background: var(--surface);
    cursor: pointer;
    font-size: 1.7rem;
    line-height: 1;
}

.action-dialog:not([open]) { display: none; }

.action-dialog {
    width: min(380px, calc(100vw - 32px));
    max-width: none;
    padding: 0;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.action-dialog::backdrop { background: rgba(20, 20, 28, 0.64); }

.action-dialog-heading {
    display: flex;
    padding: 18px;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    border-bottom: 1px solid var(--border);
}

.action-dialog-heading h2 { margin: 0; font-size: 1.15rem; }
.action-dialog nav { display: grid; padding: 8px; }
.action-dialog nav a { padding: 13px 12px; border-radius: 4px; font-weight: 700; }
.action-dialog nav a:hover,
.action-dialog nav a:focus { background: var(--surface-alt); }
/* Acciones con formulario o que abren otro dialogo: se ven igual que los enlaces. */
.action-dialog nav form { margin: 0; }
.action-dialog nav button {
    width: 100%;
    padding: 13px 12px;
    border: 0;
    border-radius: 4px;
    color: var(--blue-dark);
    background: transparent;
    font: inherit;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
}
.action-dialog nav button:hover,
.action-dialog nav button:focus { background: var(--surface-alt); }
.action-dialog nav .action-dialog-danger { color: var(--danger); }

.history-search { display: grid; width: min(100%, 520px); gap: 8px; }
.history-search .button-row { margin: 0; }
.history-search input { min-height: 44px; flex: 1; }
.history-table { width: 100%; }
.history-value { max-width: 320px; overflow-wrap: anywhere; white-space: pre-wrap; }

.data-table-card,
.related-section {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 12px 28px rgba(51, 52, 118, 0.08);
}

.detail-item span {
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 800;
    text-transform: uppercase;
}

.data-filter-section {
    display: grid;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 12px 28px rgba(51, 52, 118, 0.06);
}

.data-filters {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) auto;
    align-items: end;
    gap: 14px;
}

.data-filters select {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
}

.data-filters select:focus {
    border-color: var(--blue-secondary);
    outline: 3px solid var(--focus);
}

.filter-actions {
    display: flex;
    align-items: end;
    gap: 10px;
}

.active-filter-count {
    display: inline-grid;
    min-width: 24px;
    height: 24px;
    margin-left: 8px;
    padding: 0 6px;
    color: var(--white);
    border-radius: 999px;
    place-items: center;
    background: var(--blue);
    font-size: 0.78rem;
    font-weight: 900;
}

.field-filter-dialog:not([open]) {
    display: none;
}

.field-filter-dialog {
    width: min(560px, calc(100vw - 32px));
    max-width: none;
    max-height: calc(100vh - 48px);
    padding: 0;
    overflow: hidden;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    box-shadow: 0 24px 70px rgba(51, 52, 118, 0.28);
}

.field-filter-dialog::backdrop {
    background: rgba(42, 42, 42, 0.58);
}

.field-filter-modal {
    display: grid;
    max-height: calc(100vh - 50px);
    grid-template-rows: auto minmax(0, 1fr) auto;
    background: var(--surface);
}

.field-filter-heading {
    display: flex;
    padding: 20px 22px;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    border-bottom: 1px solid var(--border);
}

.field-filter-heading > div {
    display: grid;
    gap: 5px;
}

.field-filter-heading h2 {
    margin: 0;
    color: var(--blue-dark);
    font-size: 1.35rem;
}

.field-filter-heading span {
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 800;
}

.field-filter-close {
    display: inline-grid;
    width: 40px;
    height: 40px;
    padding: 0;
    flex: 0 0 auto;
    color: var(--blue-dark);
    border: 1px solid var(--border);
    border-radius: 8px;
    place-items: center;
    background: var(--surface-alt);
    cursor: pointer;
    font-weight: 900;
}

.field-filter-close:hover,
.field-filter-close:focus {
    border-color: var(--blue-secondary);
    background: var(--blue-soft);
}

.field-filter-scroll {
    display: grid;
    overflow-y: auto;
    padding: 18px 22px;
    align-content: start;
    gap: 14px;
}

.field-filter-view {
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.record-filter-types {
    display: grid;
    padding-bottom: 16px;
    gap: 14px;
    border-bottom: 1px solid var(--border);
}

.record-filter-types label {
    color: var(--blue-dark);
    font-weight: 800;
}

.record-filter-types select {
    width: 100%;
    min-height: 44px;
    padding: 9px 11px;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    font: inherit;
}

.record-filter-types select:focus {
    border-color: var(--blue-secondary);
    outline: 3px solid var(--focus);
}

.field-filter-fields {
    display: grid;
    gap: 14px;
}

.field-filter-fields[aria-busy="true"],
.field-filter-scroll[aria-busy="true"] .field-filter-fields {
    opacity: 0.55;
}

.field-filter-note,
.field-filter-loading {
    margin: 0;
    color: var(--muted);
    font-size: 0.85rem;
}

.field-filter-item[hidden] {
    display: none;
}

.field-filter-state {
    flex: 0 0 auto;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--blue-dark);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 800;
}

.field-filter-range {
    display: grid;
    margin: 0;
    padding: 0;
    gap: 8px;
    border: 0;
}

.field-filter-range legend {
    padding: 0;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.field-filter-range-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.field-filter-range-fields > div {
    display: grid;
    gap: 5px;
}

.field-filter-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.field-filter-search {
    display: grid;
    gap: 7px;
}

.field-filter-search > label {
    color: var(--blue-dark);
    font-weight: 800;
}

.field-filter-search-control {
    position: relative;
}

.field-filter-search-control span {
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    pointer-events: none;
}

.field-filter-search-control input {
    width: 100%;
    min-height: 44px;
    padding: 9px 12px 9px 42px;
}

.field-filter-item {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}

.field-filter-item summary {
    display: flex;
    min-height: 46px;
    padding: 10px 14px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--blue-dark);
    cursor: pointer;
    font-weight: 900;
    line-height: 1.25;
}

.field-filter-item[open] summary {
    border-bottom: 1px solid var(--border);
    background: var(--soft);
}

.field-filter-item[open] {
    position: relative;
    z-index: 20;
    overflow: visible;
}

.field-filter-body {
    display: grid;
    padding: 12px 14px 14px;
    gap: 7px;
}

.field-filter-body label {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.field-filter-body input,
.field-filter-body select {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
}

.field-filter-body input:focus,
.field-filter-body select:focus {
    border-color: var(--blue-secondary);
    outline: 3px solid var(--focus);
}

.field-filter-control {
    min-width: 0;
}

.field-filter-control > label {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.field-filter-actions {
    display: flex;
    padding: 16px 22px 20px;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid var(--border);
    background: var(--surface-alt);
}

.data-table-card {
    overflow: hidden;
}

.data-table {
    min-width: 860px;
}

.data-table th {
    white-space: nowrap;
}

.data-table td {
    color: var(--text);
    font-size: 0.94rem;
}

.navigable-row {
    cursor: pointer;
}

.navigable-row:hover td,
.navigable-row:focus td {
    background: var(--blue-soft);
}

.navigable-row:focus {
    outline: 3px solid var(--blue-secondary);
    outline-offset: -3px;
}

.open-cell {
    width: 64px;
    text-align: center;
}

.panel-open-btn {
    display: inline-grid;
    width: 34px;
    height: 34px;
    color: var(--white);
    border-radius: 8px;
    place-items: center;
    background: var(--blue);
    font-weight: 900;
}

.panel-open-btn:hover,
.panel-open-btn:focus {
    color: var(--brand-charcoal);
    background: var(--orange);
}

.related-open-btn {
    display: inline-flex;
    min-height: 32px;
    padding: 0 10px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--blue);
    color: var(--white);
    font-size: 0.82rem;
    font-weight: 900;
}

.related-open-btn:hover,
.related-open-btn:focus {
    background: var(--orange);
    color: var(--brand-charcoal);
}

.pagination-bar {
    display: flex;
    padding: 14px 16px;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-weight: 700;
}

.pagination-bar--superior {
    border-top: 0;
    border-bottom: 1px solid var(--border);
}

.pagination-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.pagination-actions a,
.pagination-actions .page-disabled,
.page-jump-form button {
    display: inline-flex;
    min-height: 36px;
    padding: 0 12px;
    align-items: center;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    font-weight: 800;
}

.pagination-actions a:hover,
.page-jump-form button:hover {
    border-color: var(--blue);
}

.page-disabled {
    opacity: 0.54;
}

.page-jump-form {
    display: flex;
    align-items: center;
    gap: 7px;
}

.page-jump-form select {
    min-height: 36px;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: inherit;
}

.page-jump-form input {
    width: 72px;
    min-height: 36px;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.detail-grid {
    display: grid;
    margin: 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.program-profile {
    display: grid;
    min-width: 0;
    grid-template-columns: minmax(200px, 250px) minmax(0, 1fr);
    gap: 28px;
    align-items: start;
}

.program-profile-summary {
    border-right: 1px solid var(--border);
    padding-right: 20px;
}

.program-profile-summary dl,
.program-session-detail dl { margin: 0; }
.program-profile-summary dl > div,
.program-session-detail dl > div { padding: 10px 0; border-bottom: 1px solid var(--border); }
.program-profile-summary dt,
.program-session-detail dt { color: var(--muted); font-weight: 700; }
.program-profile-summary dd,
.program-session-detail dd { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.program-profile-main { min-width: 0; }
.program-profile-main > section + section { margin-top: 28px; }
.program-field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.program-field-wide { grid-column: 1 / -1; }
.program-session-detail { border-top: 1px solid var(--border); padding: 14px 0; }
.program-original-activities { margin-top: 18px; }
.program-original-activities > div { white-space: pre-wrap; overflow-wrap: anywhere; padding: 12px 0; }
.program-sessions { min-width: 0; margin: 24px 0; padding: 18px; border: 1px solid var(--border); }
.program-sessions > legend { font-weight: 800; }
.program-session { min-width: 0; display: grid; gap: 12px; margin: 14px 0; padding: 18px; border: 1px solid var(--border); }
.program-session legend { font-weight: 700; }
.program-session textarea { width: 100%; }

@media (max-width: 760px) {
    .program-profile { grid-template-columns: minmax(0, 1fr); }
    .program-profile-summary { border-right: 0; border-bottom: 1px solid var(--border); padding: 0 0 12px; }
    .program-profile .program-field-grid { grid-template-columns: minmax(0, 1fr); }
}

.detail-item {
    display: grid;
    min-height: 96px;
    padding: 16px;
    align-content: start;
    gap: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 12px 28px rgba(51, 52, 118, 0.06);
}

.detail-item dd {
    margin: 0;
    color: var(--text);
    font-size: 0.97rem;
    font-weight: 700;
    line-height: 1.55;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

/* Adjuntos en la ficha: sin el pre-wrap del valor (dejaba saltos y sangrías de Blade). */
.detail-attachment-list {
    display: grid;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
    white-space: normal;
}

.detail-attachment-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 8px;
}

.detail-attachment-list a {
    color: var(--primary, #333476);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.detail-item .detail-attachment-size {
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: none;
}

.detail-item dt {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
}

.detail-grid--vertical {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}

.detail-grid--vertical .detail-item {
    grid-template-columns: minmax(190px, 30%) minmax(0, 1fr);
    min-height: 0;
    padding: 14px 16px;
    align-items: start;
    border: 0;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    box-shadow: none;
}

.detail-grid--vertical .detail-item:last-child {
    border-bottom: 0;
}

.participant-tab-panel:focus {
    outline: 3px solid var(--orange);
    outline-offset: -3px;
}

.related-section {
    padding: clamp(18px, 4vw, 26px);
}

.participant-data-tabs {
    display: grid;
    gap: 0;
    min-width: 0;
}

.participant-tab-list {
    display: flex;
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    border: 1px solid var(--border);
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
    background: var(--surface-alt);
    scrollbar-width: thin;
}

.participant-tab-button {
    display: inline-flex;
    flex: 0 0 auto;
    max-width: 178px;
    min-width: 92px;
    min-height: 42px;
    padding: 0 16px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-right: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 800;
    line-height: 1.2;
    overflow: hidden;
    white-space: nowrap;
}

.participant-tab-button span {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.participant-tab-button[aria-selected="true"] {
    background: var(--surface);
    color: var(--blue-dark);
    box-shadow: inset 0 3px 0 var(--orange);
}

.participant-tab-button:hover,
.participant-tab-button:focus {
    color: var(--blue-dark);
    outline: none;
}

.participant-tab-button:focus-visible {
    box-shadow: inset 0 3px 0 var(--orange), 0 0 0 3px var(--focus);
}

.participant-tab-add {
    display: inline-flex;
    flex: 0 0 auto;
    min-width: 46px;
    min-height: 42px;
    padding: 0 14px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-right: 1px solid var(--border);
    background: var(--surface);
    color: var(--blue-dark);
    cursor: pointer;
    font: inherit;
    font-size: 1.4rem;
    font-weight: 900;
    line-height: 1;
}

.participant-tab-add:hover,
.participant-tab-add:focus {
    color: var(--orange);
    outline: none;
}

.participant-tab-add:focus-visible {
    box-shadow: inset 0 3px 0 var(--orange), 0 0 0 3px var(--focus);
}

.participant-tab-panel {
    border-radius: 0 0 8px 8px;
    border-top: 1px solid var(--border);
}

.participant-tab-panel[hidden] {
    display: none;
}

.participant-tab-summary-layout {
    display: block;
    width: 100%;
}

.followup-modal:not([open]) {
    display: none;
}

.followup-modal {
    width: min(460px, calc(100% - 36px));
    max-width: none;
    padding: 0;
    border: 0;
    background: transparent;
}

.followup-modal::backdrop {
    background: rgba(51, 52, 118, 0.36);
}

.followup-modal-card {
    width: 100%;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 24px 60px rgba(51, 52, 118, 0.24);
}

.followup-modal-header {
    display: flex;
    min-height: 56px;
    padding: 0 18px;
    align-items: center;
    justify-content: space-between;
    background: var(--surface-alt);
}

.followup-modal-header h2 {
    margin: 0;
    color: var(--blue-dark);
    font-size: 1.05rem;
}

.followup-modal-header button {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 1.6rem;
    font-weight: 900;
    line-height: 1;
}

.followup-modal-header button:hover,
.followup-modal-header button:focus {
    color: var(--blue-dark);
    outline: none;
}

.followup-modal form {
    display: grid;
    padding: 18px;
    gap: 18px;
}

.data-form select {
    overflow: hidden;
    text-overflow: ellipsis;
}

.advanced-fields {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--soft);
}

.advanced-fields summary {
    cursor: pointer;
    color: var(--blue-dark);
    font-weight: 900;
}

.advanced-fields .form-grid {
    margin-top: 16px;
}

.participant-page-panel {
    padding: clamp(18px, 3vw, 28px);
}

.participant-edit-layout {
    display: grid;
    align-items: start;
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
    gap: 18px;
}

.participant-summary-card {
    position: sticky;
    top: 18px;
    display: grid;
    padding: 18px;
    gap: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--soft);
}

.participant-summary-card h2 {
    margin: 0;
    color: var(--blue-dark);
    font-size: 1rem;
    line-height: 1.35;
}

.participant-summary-card dl {
    display: grid;
    margin: 0;
    gap: 12px;
}

.participant-summary-card dt {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.participant-summary-card dd {
    margin: 2px 0 0;
    color: var(--blue-dark);
    font-size: 0.9rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.participant-detail-summary {
    position: static;
    width: 100%;
    max-width: none;
    padding: 0;
    border: 0;
    background: transparent;
}

.participant-detail-summary dl {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0 28px;
}

.participant-summary-field {
    min-width: 0;
    padding: 14px 0;
    border-top: 1px solid var(--border);
}

.participant-inline-summary {
    display: grid;
    width: 100%;
    margin: 0;
    grid-column: 1 / -1;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0 28px;
}

.participant-inline-summary dt {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.participant-inline-summary dd {
    margin: 3px 0 0;
    color: var(--blue-dark);
    font-size: 0.92rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.participant-full-record {
    display: grid;
    gap: 18px;
}

.participant-record-form {
    display: grid;
    grid-template-columns: 1fr;
}

.participant-form-section {
    display: grid;
    padding: 18px;
    grid-template-columns: 1fr;
    gap: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}

.participant-form-section h2 {
    margin: 0 0 4px;
    color: var(--blue-dark);
    font-size: 1rem;
}

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

.record-context-note {
    margin: -4px 0 16px;
    color: var(--muted);
    font-weight: 800;
}

.record-form-section {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.record-form-section[hidden] {
    display: none;
}

.record-form-section h2,
.record-options-help,
.record-dynamic-fields {
    grid-column: 1 / -1;
}

.record-options-help {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 600;
}

.record-dynamic-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.record-option-group {
    display: grid;
    gap: 8px;
}

.linked-context-card {
    display: grid;
    min-height: 54px;
    padding: 12px 14px;
    align-content: center;
    gap: 4px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--soft);
}

.linked-context-card span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.linked-context-card strong {
    color: var(--blue-dark);
    font-size: 0.95rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.record-check-option {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    color: var(--blue-dark);
    font-weight: 700;
    line-height: 1.35;
}

.record-check-option input {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    min-height: 16px;
    accent-color: var(--blue);
}

.record-check-option span {
    overflow-wrap: anywhere;
}

.session-form-panel {
    width: min(100%, 920px);
    margin-inline: auto;
}

.session-participant-name {
    color: var(--blue-dark) !important;
    font-size: 1rem;
    font-weight: 800;
}

.session-form {
    display: grid;
    margin-top: 24px;
    gap: 4px;
}

.session-field-list {
    display: grid;
    gap: 20px;
}

.accessible-datetime,
.record-date-time-fields {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(150px, 0.65fr);
    gap: 12px;
}

.record-date-time-fields > .field-group {
    min-width: 0;
}

.record-date-time-fields > .field-group:only-child {
    grid-column: 1 / -1;
}

.session-field-list > .field-group {
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.session-field-list > .field-group:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.session-attendance {
    display: grid;
    margin: 8px 0 20px;
    padding: 0;
    gap: 12px;
    border: 0;
}

.session-attendance legend {
    margin-bottom: 10px;
    color: var(--blue-dark);
    font-weight: 800;
}

.session-attendance-list {
    display: grid;
    gap: 12px;
}

.session-attendance-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(210px, 0.45fr);
    align-items: center;
    gap: 14px;
}

.session-attendance-row label {
    overflow-wrap: anywhere;
}

.session-attendance-row select {
    width: 100%;
}

@media (max-width: 680px) {
    .accessible-datetime,
    .record-date-time-fields {
        grid-template-columns: 1fr;
    }

    .session-attendance-row {
        grid-template-columns: 1fr;
        gap: 7px;
    }
}

.dynamic-field-description {
    margin: -3px 0 1px !important;
    color: var(--muted);
    font-size: 0.86rem;
}

.dynamic-field-attachments ul,
.dynamic-file-selection {
    display: grid;
    gap: 6px;
    margin: 6px 0 0;
    padding: 0;
    list-style: none;
}

.dynamic-file-selection[hidden],
.dynamic-file-clear[hidden] {
    display: none;
}

/* «Quitar» dentro del mismo recuadro del campo de archivos. */
.dynamic-file-input {
    position: relative;
}

.dynamic-file-input.tiene-archivos input[type="file"] {
    padding-right: 140px;
}

.dynamic-file-input .dynamic-file-clear {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
}

.dynamic-file-selection li,
.dynamic-field-attachments li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 16px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.92rem;
    overflow-wrap: anywhere;
}

.dynamic-file-selection li > span,
.dynamic-field-attachments li > span {
    flex: 1 1 12rem;
    min-width: 0;
}

.dynamic-file-input .dynamic-attachment-remove,
.dynamic-file-selection .dynamic-attachment-remove,
.dynamic-field-attachments .dynamic-attachment-remove {
    flex: none;
    min-height: 0;
    padding: 6px 14px;
    font-size: 0.85rem;
}

.dynamic-form-label {
    display: grid;
    gap: 4px;
}

.dynamic-form-label h2 {
    margin: 0;
    color: var(--blue-dark);
    font-size: 1.05rem;
}

.dynamic-form-label p {
    margin: 0;
}

.stacked-options {
    display: grid;
    gap: 7px;
}

.stacked-options label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-weight: 600;
}

.stacked-options input {
    width: 16px;
    height: 16px;
    accent-color: var(--blue);
}

.section-heading-with-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.section-heading-with-action .button {
    flex: 0 0 auto;
}

.searchable-selector {
    position: relative;
    display: grid;
    min-width: 0;
    gap: 10px;
}

.searchable-selected {
    display: flex;
    min-height: 42px;
    padding: 7px;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--soft);
    overflow: hidden;
}

.searchable-empty {
    padding: 0 4px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 700;
}

.searchable-chip {
    display: inline-flex;
    min-width: 0;
    min-height: 30px;
    padding: 4px 6px 4px 10px;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--blue-dark);
    font-size: 0.88rem;
    font-weight: 800;
    line-height: 1.2;
}

.searchable-chip span {
    overflow-wrap: anywhere;
}

.searchable-chip button {
    display: inline-grid;
    width: 22px;
    height: 22px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 8px;
    background: var(--soft);
    color: var(--muted);
    cursor: pointer;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 900;
    line-height: 1;
}

.searchable-chip button:hover,
.searchable-chip button:focus {
    background: var(--orange);
    color: var(--white);
    outline: none;
}

.searchable-search-row {
    display: grid;
    min-width: 0;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.searchable-search-row input {
    width: 100%;
    padding-right: 40px;
    cursor: pointer;
    /* Flecha de desplegable: al hacer clic se abre la lista. */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath d='M2 5l5 5 5-5' fill='none' stroke='%23555' stroke-width='2'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}

.searchable-search-row input:focus {
    cursor: text;
}

.searchable-clear {
    min-height: 48px;
}

.searchable-results {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    left: 0;
    z-index: 30;
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 18px 40px rgba(51, 52, 118, 0.16);
}

.searchable-result,
.searchable-result-empty {
    width: 100%;
    min-height: 38px;
    padding: 9px 12px;
    border: 0;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 0.9rem;
    line-height: 1.25;
    text-align: left;
    overflow-wrap: anywhere;
}

.searchable-result {
    cursor: pointer;
}

.searchable-result:hover,
.searchable-result:focus {
    background: var(--soft);
    color: var(--blue-dark);
    outline: none;
}

.searchable-result[aria-selected="true"] {
    background: var(--blue-soft);
    color: var(--blue-dark);
    box-shadow: inset 5px 0 0 var(--blue);
    font-weight: 800;
    outline: 2px solid transparent;
    outline-offset: -2px;
}

html[data-theme="dark"] .searchable-result[aria-selected="true"] {
    background: var(--blue-soft);
    color: var(--text);
    box-shadow: inset 5px 0 0 var(--yellow);
}

.searchable-result-empty {
    color: var(--muted);
    font-weight: 700;
}

@media (max-width: 980px) {
    .data-hero {
        grid-template-columns: 1fr;
    }

    .data-actions {
        grid-column: 1;
        grid-row: auto;
    }

    .pagination-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .detail-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .data-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .participant-edit-layout {
        grid-template-columns: 1fr;
    }

    .record-form-section,
    .record-dynamic-fields {
        grid-template-columns: 1fr;
    }

    .participant-summary-card {
        position: static;
    }

}

@media (max-width: 760px) {
    .detail-grid,
    .data-filters {
        grid-template-columns: 1fr;
    }

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

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

    .filter-actions,
    .field-filter-actions,
    .data-actions,
    .section-heading-with-action,
    .searchable-search-row {
        flex-direction: column;
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .filter-actions .button,
    .field-filter-actions .button,
    .data-actions .button,
    .section-heading-with-action .button,
    .searchable-clear {
        width: 100%;
    }
}

.record-origin-page {
    width: min(920px, 100%);
    max-width: 920px;
    margin-inline: auto;
}

.record-origin-selector {
    display: grid;
    max-width: 720px;
    margin: 26px auto 0;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    gap: 18px;
}

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

.record-origin-intro {
    max-width: 720px;
    margin: 10px 0 24px;
    color: var(--muted);
    line-height: 1.6;
}

.record-origin-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 24px;
    border-top: 1px solid var(--border);
}

.record-origin-link {
    display: flex;
    min-width: 0;
    padding: 18px 4px;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    color: var(--blue-dark);
    border-bottom: 1px solid var(--border);
}

.record-origin-link > span:first-child {
    display: grid;
    min-width: 0;
    gap: 5px;
}

.record-origin-link strong {
    font-size: 1rem;
}

.record-origin-link small {
    color: var(--muted);
    line-height: 1.45;
}

.record-origin-link > span:last-child {
    color: var(--orange);
    font-weight: 900;
}

.record-origin-link:hover,
.record-origin-link:focus {
    padding-right: 10px;
    color: var(--orange);
    background: var(--soft);
    outline: none;
}

.record-origin-link.is-selected {
    color: var(--orange);
    background: var(--soft);
}

.record-target-section {
    display: grid;
    max-width: 720px;
    margin-inline: auto;
    margin-top: 28px;
    padding-top: 24px;
    gap: 16px;
    border-top: 2px solid var(--orange);
}

.record-target-section h2 {
    margin: 0;
    color: var(--blue-dark);
    font-size: 1.25rem;
}

.record-context-line {
    display: flex;
    margin: 0;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--muted);
    font-weight: 700;
}

.record-context-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 12px;
}

.record-target-form {
    display: grid;
    gap: 14px;
}

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

@media (max-width: 600px) {
    .record-origin-list,
    .record-context-form {
        grid-template-columns: 1fr;
    }

    .record-origin-link {
        align-items: flex-start;
    }

    .record-target-actions .button {
        width: 100%;
    }

    .record-origin-selector {
        padding: 16px;
    }

    .record-origin-actions .button {
        width: 100%;
    }
}
