/* v35: a single table remains semantic on desktop and becomes labeled cards on mobile. */
.records-workspace{--record-border:#ccdcd4;--record-ink:#173f35;min-width:0;max-width:100%}
.records-toolbar{display:flex;align-items:flex-start;gap:16px;justify-content:space-between;padding:20px;background:#fffef9;border:1px solid var(--record-border);border-radius:20px;box-shadow:0 3px 16px #183e3305}
.records-filter-form{display:flex;align-items:flex-start;flex-wrap:wrap;gap:12px;flex:1;min-width:0}
.records-filter-form>label{flex:1 1 240px}.records-filter-form label{font-size:.85rem;font-weight:700;display:grid;gap:6px;min-width:0;color:var(--record-ink)}
.records-workspace :is(input,select,button,summary),.records-dialog :is(button,input){min-height:44px}
.records-workspace :is(input,select){max-width:100%;min-width:0;width:100%;border:1px solid #9fb4aa;border-radius:11px;background:#fffefb;color:#173f35;padding:10px 12px;font:inherit}
.records-workspace :is(button,summary){font:inherit;font-size:.85rem;font-weight:650;cursor:pointer}
.records-workspace :is(button,input,select,summary):focus-visible,.records-dialog :focus-visible{outline:3px solid #307fbd;outline-offset:3px}
.records-filters{flex:1 1 190px;padding-top:24px}.records-filters summary,.records-preferences summary{display:flex;align-items:center;gap:8px;list-style:none;border:1px solid #adc6bb;border-radius:11px;padding:10px 14px;background:#f1f7f2}
.records-filters summary::after,.records-preferences summary::after{content:'⌄';margin-left:auto}.records-filters[open] summary::after,.records-preferences details[open] summary::after{content:'⌃'}
.records-filters[open]{flex-basis:100%;order:3;padding-top:0}.records-filter-form>button{margin-top:24px}
.records-filter-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,180px),1fr));gap:14px;padding-top:16px}
.records-reference-search{display:flex;flex-wrap:wrap;gap:6px;align-content:end}.records-reference-search input{flex:1 1 120px}
.records-preferences{display:flex;align-items:flex-start;flex-wrap:wrap;gap:10px;margin:16px 0}.records-preferences>select{width:auto;max-width:180px}
.records-preferences details[open]{flex-basis:100%;order:3;border:1px solid var(--record-border);padding:12px;border-radius:12px;background:#fffef9}
.records-view-body,.records-columns{display:flex;flex-wrap:wrap;gap:8px;padding-top:12px}.records-view-body select{width:auto;max-width:100%;flex:1 1 200px}.records-view-body p{flex-basis:100%}
.records-columns label{display:flex;align-items:center;gap:6px;padding:0 12px;background:#f1f7f2;border-radius:8px}
.records-workspace input[type=checkbox],.records-dialog input[type=checkbox]{width:24px;height:24px;min-height:24px;accent-color:#137c62;cursor:pointer;flex-shrink:0}.records-columns label,.review-accept{min-height:44px}
.records-data{border:1px solid var(--record-border);overflow:hidden;box-shadow:0 6px 22px #183e3306}
.records-scroll{overflow:auto;max-height:72vh;isolation:isolate}.records-table{width:100%;border-collapse:separate;border-spacing:0;font-variant-numeric:tabular-nums}
.records-table caption{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
.records-table th{position:sticky;top:0;z-index:1;background:#e7f0e9;color:#244c40;white-space:nowrap;border-bottom:2px solid #bfd3c6;padding:8px 12px}
.records-table th button{background:transparent;border:0;padding:0 4px;color:inherit;font-weight:750;box-shadow:none}
.records-table td{padding:14px 12px;border-bottom:1px solid #e0e9e2;vertical-align:middle;max-width:320px;overflow-wrap:anywhere;color:#294c40;background:#fffefa;transition:background 140ms ease}
.records-table tr:nth-child(even) td{background:#f5f8f3}.records-table tr:hover td{background:#edf5ee}.records-table tr.is-selected td{background:#dff2e8}
.records-table .numeric{text-align:right;white-space:nowrap;font-weight:700}.records-table .record-identity{color:#125d4b;text-align:left;background:transparent;border:0;padding:3px 0;box-shadow:none;font-weight:750;max-width:100%;overflow-wrap:anywhere}
.records-table .badge,.records-table td[data-label="Fecha"],.records-table td[data-label="Reserva"],.records-table td[data-label="Tipo"],.records-table td[data-label="Compra"],.records-table td[data-label="Vencimiento"]{white-space:nowrap;overflow-wrap:normal}
.records-table td:has(.record-identity){min-width:180px}.record-checkbox{display:inline-flex;align-items:center;justify-content:center;min-width:44px;min-height:44px;cursor:pointer}
.records-table .record-identity{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;overflow:hidden}
.records-table .record-identity:hover{text-decoration:underline}.records-table .record-actions{min-width:175px}.record-actions button{margin:2px;padding:8px 10px}.records-table :is(td,th):has(>input[type=checkbox]){min-width:48px;text-align:center}
.records-selection{position:sticky;top:8px;z-index:3;display:flex;align-items:center;flex-wrap:wrap;gap:10px;padding:12px 16px;margin:10px 0;background:#e0f2e8;border:1px solid #61a38a;border-radius:14px;box-shadow:0 4px 15px #0b322015;animation:record-appear 140ms ease}
.records-selection[hidden]{display:none}.records-selection strong{margin-right:auto}.records-updating{position:sticky;top:8px;z-index:4;background:#edf5ef;color:#245b45;border:1px solid #9cbaa9;border-radius:9px;padding:8px 16px;margin:0 0 12px;font-size:.85rem}
.density-compact .records-table td{padding:6px 10px}.records-workspace .pagination{display:flex;flex-wrap:wrap;align-items:center;gap:10px;padding:16px}.records-workspace .pagination span{margin-right:auto}
.records-dialog{width:min(720px,calc(100vw - 32px));max-height:90dvh;overflow:auto;border:1px solid #b8cdc0;border-radius:20px;background:#fffef9;color:#183f33;padding:0;box-shadow:0 24px 80px #0c332e40}
.records-dialog::backdrop{background:#092f2a75;backdrop-filter:blur(2px)}.records-dialog>header{display:flex;align-items:center;gap:16px;justify-content:space-between;padding:20px 24px;position:sticky;top:0;background:#eff6ed;z-index:2;border-bottom:1px solid #d2dfd4}.records-dialog h2{margin:0;font-size:1.4rem}.records-dialog-body{padding:24px;overflow-wrap:anywhere}.records-lead{font-weight:600}.review-records{max-height:220px;overflow:auto;padding-left:24px}.review-records li{padding:5px 0}.review-dependencies,.record-detail{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.5fr);gap:0;margin:18px 0}.record-detail :is(dt,dd),.review-dependencies :is(dt,dd){margin:0;padding:10px;border-bottom:1px solid #dce6dd}.record-detail dt{font-weight:650}.records-warning{background:#fff3d7;color:#745111;border-left:3px solid #c2993a;padding:12px;border-radius:6px}.review-accept{display:flex;align-items:center;gap:12px;padding:14px 0}.records-dialog .form-actions{display:flex;flex-wrap:wrap;gap:10px;justify-content:flex-end}
#editor.record-drawer{position:fixed;inset:0 0 0 auto;margin:0;width:min(850px,85vw);height:100dvh;max-height:100dvh;max-width:100vw;border-radius:20px 0 0 20px;border:0;border-left:1px solid #aec9b9;animation:record-slide 160ms ease;overflow:auto}
#editor.record-drawer>header{position:sticky;top:0;z-index:5;background:#f1f6ec}#editor.record-drawer .form-actions{position:sticky;bottom:0;z-index:3;padding:14px;background:#fffef5f5;border-top:1px solid #d6e1d5;box-shadow:0 -5px 20px #183e3309}
@keyframes record-appear{from{opacity:.4;transform:translateY(-4px)}to{opacity:1;transform:none}}@keyframes record-slide{from{transform:translateX(24px);opacity:.6}to{transform:none;opacity:1}}
@media(max-width:767px){
 .records-toolbar{flex-direction:column;padding:14px}.records-toolbar>button{width:100%}.records-filter-form{width:100%}.records-filter-form>label{flex-basis:100%}.records-filters{padding-top:0;flex-basis:100%}.records-filter-form>button{margin:0;width:100%}.records-preferences>*{flex:1 1 125px}.records-preferences>select{max-width:none}.records-scroll{max-height:none;overflow:visible}.records-table,.records-table tbody{display:block;width:100%}.records-table thead{display:block}.records-table thead tr{display:flex;padding:8px}.records-table thead th{display:none}.records-table thead th:first-child:has(input){display:flex;align-items:center;gap:12px;width:100%;background:transparent;border:0}.records-table thead th:first-child:has(input)::after{content:'Seleccionar esta página';font-size:.85rem;font-weight:600}.records-table tbody tr{position:relative;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);margin:10px;border:1px solid #ccdcd4;border-radius:14px;overflow:hidden;background:#fffefa}.records-table tbody td{display:block;max-width:none;padding:9px 12px!important;border:0;min-width:0}.records-table td::before{content:attr(data-label);display:block;color:#5a7569;font-size:.72rem;font-weight:650;margin-bottom:4px}.records-table td.record-select{grid-column:1/-1;display:flex;align-items:center;border-bottom:1px solid #dce7df;padding:4px 8px!important;min-height:44px}.records-table .record-select::after{content:'Seleccionar registro';font-size:.8rem;margin-left:10px}.records-table td.record-actions{grid-column:1/-1;display:flex;flex-wrap:wrap;border-top:1px solid #dce7df}.records-table td:has(.record-identity){grid-column:1/-1;font-size:1.08rem;min-width:0}.records-table td.numeric{text-align:left;white-space:normal}.records-table .record-actions::before,.records-table .record-select::before{display:none}.records-table .badge{white-space:normal;overflow-wrap:anywhere}.records-selection{top:4px;padding:10px}.records-selection strong{width:100%}.records-selection button{flex:1 1 130px}.records-workspace .pagination{padding:12px}.records-workspace .pagination span{order:-1;width:100%}.records-workspace .pagination button{flex:1 1 120px}.records-dialog{width:100vw;max-width:100vw;max-height:100dvh;border-radius:0}.records-dialog>header,.records-dialog-body{padding:16px}.record-detail{grid-template-columns:1fr}.record-detail dd{padding-top:0}.record-detail dt{border:0}#editor.record-drawer{width:100vw;border-radius:0}#editor.record-drawer .form-actions button{flex:1 1 130px}
}
@media(prefers-reduced-motion:reduce){.records-workspace *,.records-dialog,#editor.record-drawer{animation:none!important;transition:none!important;scroll-behavior:auto!important}}
/* Percent widths exclude the desktop scrollbar; 100vw clipped the mobile drawer by 15px. */
@media(max-width:767px){#editor.record-drawer,.records-dialog{width:100%;max-width:100%;box-sizing:border-box}}
.record-action-group{display:flex;align-items:flex-start;gap:4px;white-space:nowrap}.record-more summary{border:1px solid #a8b9ae;background:#fffef9;border-radius:9px;padding:9px 10px;list-style:none;box-sizing:border-box;margin:2px}.record-more[open]>button{display:block;width:calc(100% - 4px)}
@media(min-width:768px){.records-table td.record-actions{position:sticky;right:0;z-index:1;border-left:1px solid #d4e1d8;box-shadow:-5px 0 10px #173f3508}.records-table:has(.record-actions) th:last-child{right:0;z-index:2;border-left:1px solid #c0d2c5}.record-actions:has(.record-more){min-width:185px}}
@media(max-width:767px){.record-action-group{flex-wrap:wrap;white-space:normal;width:100%}}

/* v38: a compact ledger with clear columns and full size interaction targets. */
.records-table th:not(:last-child),.records-table td:not(:last-child){border-right:1px solid #d9e5db}
.records-table th{font-size:.74rem;letter-spacing:.025em;padding:2px 10px}
.density-compact .records-table td{padding:2px 10px;font-size:.86rem}
.density-comfortable .records-table td{padding:6px 12px}
.records-table :is(button,summary){min-height:44px;box-sizing:border-box}
.records-table .record-actions button{margin:0;padding:5px 9px;font-size:.8rem}
.record-more summary{margin:0;padding:11px 9px;font-size:.8rem}
.record-more[open]{position:relative;z-index:4}
.record-more[open]>button{white-space:normal;min-width:140px}
.records-table :is(button,input,summary):focus-visible{outline:3px solid #987225;outline-offset:2px}
.custody-cell{min-width:116px}.custody-badge{display:inline-flex;align-items:center;gap:5px;padding:3px 7px;border:1px solid #a7c8b6;border-radius:7px;font-size:.72rem;font-weight:700;white-space:nowrap;margin:2px 3px 2px 0;background:#e7f4ec;color:#17533e}
.custody-badge.reinforcement{background:#fff2d9;border-color:#d9bd80;color:#735016}.custody-mark{font-size:.95rem;font-weight:800}
.numeric-input{font-variant-numeric:tabular-nums;text-align:right;letter-spacing:.02em}
html:has(dialog[open]),body:has(dialog[open]){overflow:hidden}
#editor .form-grid>label:has(.numeric-input){align-self:start}
#editor .form-grid>label:focus-within .field-label{color:#12664d}
#editor .form-grid .numeric-input:focus{background:#fffef7;border-color:#40866a;box-shadow:0 0 0 3px #40866a20}
.costs-layout{display:grid;gap:22px}.costs-common-filters{display:flex;flex-wrap:wrap;gap:12px;align-items:end;padding:18px;background:#eff5ed;border:1px solid #c4d7c9;border-radius:16px}
.costs-applied{margin:0;color:#245a43;font-size:.85rem;font-weight:650;background:#e7f0e5;border-left:3px solid #628c6e;padding:9px 12px;border-radius:7px}.costs-layout>.filter-help{margin:0}
.costs-common-filters label{display:grid;gap:6px;flex:1 1 150px;min-width:0;font-size:.8rem;font-weight:700;color:#315948}.costs-common-filters :is(select,input,button){min-height:44px;max-width:100%}
.costs-common-filters :is(select,input){width:100%;min-width:0;box-sizing:border-box}
.cost-group{min-width:0;border:1px solid #cbdace;border-radius:18px;background:#fffef9;padding:14px;box-shadow:0 4px 18px #173c3005}
.cost-group>h2{display:flex;align-items:center;gap:10px;font-size:1.35rem;margin:0 0 14px;color:#204c3a}.cost-group>h2::before{content:'';width:5px;height:24px;background:#257758;border-radius:4px}.cost-group.variable>h2::before{background:#b3842c}
.cost-group .records-toolbar{padding:10px 12px}.cost-group .records-scroll{max-height:65vh}
@media(max-width:767px){.cost-group{padding:9px}.costs-common-filters{padding:12px}.costs-common-filters label{flex-basis:calc(50% - 12px)}.costs-common-filters button{flex:1 1 150px}.cost-group .records-scroll{max-height:none}.records-table td:not(:last-child){border-right:0}.records-table th{padding:8px}.records-table .record-identity{-webkit-line-clamp:unset}.custody-cell{min-width:0}}
