:root {
  --ink: #17302f;
  --muted: #667a76;
  --paper: #f4f1e9;
  --surface: #fffdf8;
  --surface-2: #f1f4ef;
  --line: #d9dfd8;
  --green: #176e63;
  --green-dark: #153d3a;
  --green-soft: #dcece6;
  --blue: #42738a;
  --blue-soft: #e1edf1;
  --amber: #bd772d;
  --amber-soft: #f7e9d4;
  --red: #a84d45;
  --red-soft: #f5dfdc;
  --shadow: 0 12px 35px rgba(24, 55, 52, .07);
  --radius: 16px;
  --sidebar: 226px;
  font-family: Inter, Aptos, "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { min-height: 100vh; margin: 0; background: var(--paper); color: var(--ink); }
.projection-dialog { width: min(1220px, 96vw); max-width: 96vw; }
.deviation-panel { margin-bottom: 1.5rem; overflow: hidden; }
.planning-insight { padding: 0; border-color: #cfdad4; background: linear-gradient(135deg, #fffdf8 0%, #f4f8f5 100%); }
.planning-insight-head { padding: 1.25rem 1.35rem 1rem; display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--line); }
.planning-insight-head h2 { font-size: 1.3rem; }
.planning-insight-head p:not(.eyebrow) { margin: .3rem 0 0; color: var(--muted); font-size: .82rem; }
.deviation-kpi-grid { padding: 1rem 1.35rem; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.deviation-kpi { position: relative; overflow: hidden; min-height: 122px; padding: 1rem 1.1rem; border: 1px solid #c9ddd6; border-radius: 14px; background: #f6fbf8; }
.deviation-kpi::after { content: ""; position: absolute; width: 90px; height: 90px; right: -38px; bottom: -45px; border-radius: 50%; background: rgba(23,110,99,.08); }
.deviation-kpi.cumulative { border-color: #d8d0e3; background: #faf7fc; }
.deviation-kpi.cumulative::after { background: rgba(125,74,158,.09); }
.deviation-kpi > span { display: block; margin-bottom: .55rem; color: var(--muted); font-size: .68rem; font-weight: 850; letter-spacing: .055em; text-transform: uppercase; }
.deviation-kpi-values { position: relative; z-index: 1; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .45rem 1rem; }
.deviation-kpi-values > strong { display: block; font-size: clamp(1.45rem, 3vw, 2.1rem); font-variant-numeric: tabular-nums; }
.deviation-kpi-values > b { padding: .22rem .48rem; border-radius: 99px; background: rgba(255,255,255,.8); color: var(--muted); font-size: .78rem; font-variant-numeric: tabular-nums; }
.deviation-kpi > small { position: relative; z-index: 1; display: block; margin-top: .45rem; color: var(--muted); font-size: .72rem; }
.operational-kpis { margin: 0 0 .8rem; padding: 0; }
.operational-kpis .deviation-kpi { min-height: 104px; padding: .8rem 1rem; }
.operational-kpis .deviation-kpi-values > strong { font-size: clamp(1.2rem, 2.2vw, 1.65rem); }
.view-top-tools { margin-bottom: .55rem; display: flex; justify-content: flex-end; }
.planning-controls { padding: 0 1.35rem; display: grid; grid-template-columns: repeat(2, minmax(0, 260px)); gap: .7rem; }
.planning-controls label { display: grid; gap: .35rem; color: var(--muted); font-size: .72rem; font-weight: 760; }
.planning-status { margin: .9rem 1.35rem; padding: .75rem .85rem; border-left: 3px solid var(--green); border-radius: 0 9px 9px 0; background: rgba(220,236,230,.55); color: var(--muted); font-size: .78rem; line-height: 1.45; }
.deviation-panel #deviation-results { padding: 0 1.35rem 1.2rem; }
.deviation-detail-grid { margin-top: .9rem; }
.deviation-panel p, .deviation-panel summary { font-size: .875rem; line-height: 1.5; }
.deviation-panel label, .deviation-panel th, .deviation-panel td { font-size: .8rem; }
.deviation-panel .summary-card p { white-space: normal; font-size: .72rem; }
.deviation-panel .deviation-card span, .deviation-panel .deviation-card small { display: block; margin-top: .45rem; font-size: .74rem; line-height: 1.4; }
.deviation-card .deviation-good, .deviation-good { color: #116d4c; }
.deviation-card .deviation-bad, .deviation-bad { color: #aa2c33; }
.deviation-panel details { margin-top: 1rem; }
.deviation-panel summary { cursor: pointer; padding: .75rem 0; font-weight: 700; }
.deviation-panel .table-wrap { max-height: 55vh; margin-top: 1rem; }
.projection-dialog .dialog-form { min-width: 0; }
.projection-dialog p { font-size: 1rem; line-height: 1.55; }
.projection-dialog th, .projection-dialog td { font-size: .875rem; }
.projection-dialog .table-wrap { max-height: 58vh; }
.projection-register { margin-top: 20px; }
.decision-memory { padding: 1.2rem 1.3rem; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; border-color: #c8d8d2; background: linear-gradient(110deg, #153d3a 0%, #1d5d54 64%, #296e63 100%); color: white; }
.decision-memory-copy { min-width: 0; display: flex; align-items: flex-start; gap: 1rem; }
.decision-memory-icon { width: 46px; height: 46px; flex: 0 0 46px; display: grid; place-items: center; border-radius: 13px; background: rgba(255,255,255,.12); color: #d9eee7; font-size: 1.4rem; }
.decision-memory .eyebrow { color: #a8d6ca; }
.decision-memory h2 { margin-bottom: .35rem; font-size: 1.15rem; }
.decision-memory p { max-width: 780px; margin-bottom: .35rem; color: #d1e1dc; font-size: .78rem; line-height: 1.5; }
.decision-memory .decision-memory-status { color: #a8d6ca; font-size: .68rem; }
.decision-memory .primary-button { flex: 0 0 auto; background: #f1c477; color: var(--green-dark); }
.projection-register progress { width: min(100%, 420px); accent-color: #f1c477; }
.projection-filters { display: flex; align-items: end; flex-wrap: wrap; gap: 16px; margin: 18px 0; }
.projection-filters > label { flex: 1 1 180px; min-width: 0; font-size: .875rem; }
.projection-filters select { width: 100%; min-width: 0; }
.projection-filters .projection-snapshot-select { flex: 3 1 360px; }
.projection-month-link { padding: 5px 0; border: 0; background: none; color: var(--green); text-align: left; text-decoration: underline; text-underline-offset: 3px; font-weight: 750; cursor: pointer; }
.projection-clickable { cursor: pointer; }
.projection-pies { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 24px; }
.projection-pies > article { min-width: 0; border: 1px solid var(--line); border-radius: 12px; padding: 18px; background: var(--surface); }
.projection-pie-layout { display: grid; grid-template-columns: minmax(120px,.75fr) minmax(0,1.25fr); gap: 14px; align-items: start; }
.projection-pie-layout > svg { width: 100%; max-width: 260px; height: auto; }
.projection-pie-legend { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow: auto; }
.projection-pie-legend li { display: grid; grid-template-columns: 12px minmax(0,1fr); gap: 5px 8px; margin: 0 0 12px; font-size: .875rem; }
.projection-pie-legend li > svg { width: 12px; height: 12px; margin-top: 4px; }
.projection-pie-legend strong { grid-column: 2; font-variant-numeric: tabular-nums; }
.projection-pie-legend small { color: var(--muted); font-weight: 500; }
.projection-warning { display: block; color: var(--red); font-size: .875rem; }
.projection-comparison-chart { overflow-x: auto; }
.projection-comparison-chart svg { display: block; width: 100%; min-width: 620px; }
.projection-comparison-chart text { fill: var(--muted); font: 14px system-ui; }
.projection-comparison-legend { display: flex; flex-wrap: wrap; gap: 20px; margin: 12px 0; font-size: .875rem; }
.projection-comparison-legend span:nth-child(1) { color: #79589e; }
.projection-comparison-legend span:nth-child(2) { color: #42738a; }
.projection-comparison-legend span:nth-child(3) { color: #176e63; }
@media (max-width: 850px) { .projection-pies { grid-template-columns: minmax(0,1fr); } }
@media (max-width: 420px) { .projection-pie-layout { grid-template-columns: minmax(0,1fr); } .projection-pie-layout > svg { max-width: 210px; justify-self: center; } }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(23, 110, 99, .2); outline-offset: 2px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: .25rem; font-size: clamp(1.6rem, 2.5vw, 2.15rem); line-height: 1.1; letter-spacing: -.035em; }
h2 { margin-bottom: .25rem; font-size: 1.05rem; letter-spacing: -.015em; }
h3 { margin-bottom: .35rem; font-size: .9rem; }
p { line-height: 1.55; }
small, .muted { color: var(--muted); }
[hidden] { display: none !important; }

.eyebrow { margin-bottom: .28rem; color: var(--green); font-size: .63rem; font-weight: 850; letter-spacing: .105em; text-transform: uppercase; }
.brand-mark { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 15px; background: var(--green); color: white; font-weight: 900; letter-spacing: -.04em; box-shadow: 0 8px 20px rgba(23,110,99,.22); }
.brand-mark.small { width: 36px; height: 36px; border-radius: 10px; box-shadow: none; }

.login-view { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(440px, .75fr); }
.login-brand { position: relative; overflow: hidden; padding: clamp(3rem, 8vw, 8rem); display: flex; flex-direction: column; justify-content: center; background: var(--green-dark); color: #f8f4eb; }
.login-brand::after { content: ""; position: absolute; width: 540px; height: 540px; right: -210px; bottom: -300px; border: 1px solid rgba(229,240,234,.18); border-radius: 50%; box-shadow: 0 0 0 65px rgba(229,240,234,.035), 0 0 0 130px rgba(229,240,234,.025); }
.login-brand .brand-mark { margin-bottom: 2rem; background: #e8b86d; color: var(--green-dark); }
.login-brand .eyebrow { color: #9ed2c3; }
.login-brand h1 { max-width: 770px; margin-bottom: 1.5rem; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.3rem, 4.4vw, 4.2rem); font-weight: 500; line-height: 1.02; letter-spacing: -.04em; }
.login-copy { max-width: 610px; color: #c9d8d3; font-size: 1rem; }
.welcome-illustration { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: contain; border-radius: 16px; margin: 1.4rem 0; position: relative; z-index: 1; }
.login-brand:has(.welcome-illustration) { padding: clamp(1.5rem, 4vw, 4rem); }
.login-brand:has(.welcome-illustration) .brand-mark { margin-bottom: .8rem; }
.sidebar { overflow-y: auto; }
.extra-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 310px), 1fr)); gap: 1rem; }
.extra-card { padding: 1.2rem; border: 1px solid var(--line, #d6dfda); border-radius: 14px; min-width: 0; }
.extra-card h3 { font-size: 1.15rem; margin: .7rem 0; overflow-wrap: anywhere; }
.extra-card p { font-size: 1rem; line-height: 1.5; }
.extra-card .extra-money, .extra-count { font-size: 1.6rem; font-weight: 700; }
.extra-card .context-box { margin: .8rem 0; font-size: .95rem; line-height: 1.6; }
.extra-details { margin-top: 1rem; }
.extra-content-panel { margin-bottom: 1rem; padding: 1.2rem; }
.extra-distribution-panel { margin-bottom: 1rem; padding: 1.2rem; }
.extra-distribution-panel > p { margin: -.35rem 0 1rem; color: var(--muted); font-size: .9rem; line-height: 1.55; }
.inline-count-control { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .5rem; }
.inline-count-control .secondary-button { white-space: nowrap; }
.distribution-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 1.1rem 0 .7rem; }
.distribution-head h3 { margin: .15rem 0 0; }
.distribution-rows { display: grid; gap: .65rem; }
.extra-distribution-row { display: grid; grid-template-columns: 34px minmax(220px, 1.35fr) minmax(145px, .65fr) minmax(155px, .7fr) 38px; gap: .65rem; align-items: end; padding: .8rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.extra-distribution-row label { min-width: 0; }
.distribution-index { align-self: center; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--green-soft); color: var(--green); font-size: .72rem; font-weight: 850; }
.distribution-remove { margin-bottom: 1px; }
.distribution-history-card { padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.distribution-history-card .panel-head { margin-bottom: .6rem; }
.distribution-history-card h3 { margin: 0 0 .2rem; font-size: 1rem; }
.distribution-history-card .extra-money { margin: .35rem 0 .6rem; font-size: 1.35rem; font-weight: 800; }
.distribution-history-row { display: grid; grid-template-columns: 100px minmax(0, 1fr) auto; gap: .8rem; align-items: center; padding: .45rem 0; border-top: 1px solid var(--line); font-size: .78rem; }
.distribution-history-row strong { min-width: 0; overflow-wrap: anywhere; }
.distribution-history-card .extra-money small { display: inline; margin-left: .3rem; color: var(--muted); font-size: .65rem; font-weight: 650; }
.flow-builder-dialog { width: min(1380px, calc(100% - 2rem)); }
.flow-builder-dialog form { min-width: 0; }
.flow-builder-settings { margin-bottom: 1rem; }
.composite-flow-stages { display: grid; gap: .55rem; }
.composite-flow-stage { min-width: 0; padding: .9rem; border: 1px solid var(--line); border-radius: 14px; background: #f8faf7; }
.composite-stage-head { margin-bottom: .7rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.composite-stage-head > div { display: flex; align-items: center; gap: .7rem; }
.composite-stage-head h3, .composite-stage-head p { margin: 0; }
.flow-stage-number { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--green); color: white; font-size: .78rem; font-weight: 900; }
.composite-stage-head .inline-count-control { grid-template-columns: 72px auto auto; }
.composite-stage-head input { min-height: 36px; }
.composite-flow-rows { display: grid; gap: .55rem; }
.composite-flow-row { min-width: 0; display: grid; grid-template-columns: 28px minmax(180px, 1.2fr) minmax(170px, 1fr) 20px minmax(170px, 1fr) minmax(120px, .65fr) minmax(140px, .7fr) 38px; gap: .5rem; align-items: end; padding: .65rem; border: 1px solid #dde4de; border-radius: 11px; background: white; }
.flow-builder-field { min-width: 0; }
.flow-field-label { display: block; margin-bottom: .38rem; color: var(--muted); font-size: .72rem; font-weight: 760; }
.composite-flow-row select, .composite-flow-row input { min-height: 36px; padding: .45rem .5rem; font-size: .75rem; }
.flow-visual-select { min-width: 0; display: grid; grid-template-columns: 30px minmax(0, 1fr); align-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: white; }
.flow-visual-select.has-create { grid-template-columns: 30px minmax(0, 1fr) auto; }
.flow-visual-select select { min-width: 0; border: 0; border-radius: 0; background-image: none; }
.flow-select-icon { width: 30px; height: 34px; display: grid; place-items: center; }
.flow-account-icon { display: grid; place-items: center; }
.flow-account-icon .account-logo, .flow-account-icon .account-monogram { width: 22px; height: 22px; flex-basis: 22px; border-radius: 6px; }
.flow-account-icon .account-monogram { font-size: .48rem; }
.flow-concept-icon { width: 22px; height: 22px; display: inline-grid; place-items: center; border-radius: 7px; background: #eff3f0; color: #5f6d68; font-size: .7rem; font-weight: 950; }
.flow-concept-icon.type-ingreso, .flow-concept-icon.type-reembolso, .flow-concept-icon.type-rentabilidad { background: var(--green-soft); color: var(--green); }
.flow-concept-icon.type-egreso { background: #fbede5; color: var(--amber); }
.flow-concept-icon.type-transferencia { background: #f1ebf7; color: #7655a3; }
.flow-create-concept { height: 28px; margin-right: .25rem; padding: .25rem .42rem; color: var(--green); font-size: .58rem; }
.flow-route-index { align-self: center; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--blue-soft); color: var(--blue); font-size: .65rem; font-weight: 900; }
.flow-row-arrow { align-self: center; color: var(--green); font-size: 1.15rem; font-weight: 900; text-align: center; }
.composite-stage-connector { height: 32px; display: flex; align-items: center; justify-content: center; gap: .55rem; color: var(--muted); }
.composite-stage-connector span { color: var(--green); font-size: 1.15rem; }
.composite-stage-connector small { font-size: .62rem; }
.flow-mini-section { margin-top: 1rem; padding-top: .15rem; }
.flow-mini-map { overflow-x: auto; display: flex; align-items: stretch; gap: .55rem; padding: .75rem; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(#fbfcf9ee,#fbfcf9ee),radial-gradient(circle,#cfd8d4 1px,transparent 1px); background-size: auto,18px 18px; }
.flow-mini-stage { min-width: 230px; max-width: 290px; flex: 1 0 230px; overflow: hidden; border: 1px solid #cbdad4; border-radius: 12px; background: rgba(255,255,255,.96); box-shadow: 0 5px 16px rgba(22,55,51,.05); }
.flow-mini-stage header { padding: .65rem .7rem; display: grid; grid-template-columns: 28px minmax(0,1fr) auto; align-items: center; gap: .45rem; border-bottom: 1px solid var(--line); background: #eef6f2; }
.flow-mini-stage header > span { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; background: var(--green); color: white; font-size: .65rem; font-weight: 900; }
.flow-mini-stage header strong { font-size: .75rem; }
.flow-mini-stage header small { font-size: .58rem; }
.flow-mini-route { display: grid; grid-template-columns: minmax(0,1fr) 16px minmax(0,1fr); gap: .25rem; padding: .55rem .65rem; border-bottom: 1px solid #e7ebe7; font-size: .66rem; }
.flow-mini-route > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flow-mini-route b { color: var(--green); text-align: center; }
.flow-mini-route small { grid-column: 1 / -1; color: var(--muted); font-size: .57rem; line-height: 1.35; }
.flow-mini-node { display: flex !important; align-items: center; gap: .32rem; }
.flow-mini-node > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.flow-mini-route .flow-account-icon .account-logo, .flow-mini-route .flow-account-icon .account-monogram { width: 18px; height: 18px; flex-basis: 18px; }
.flow-mini-concept { display: inline-flex; align-items: center; gap: .25rem; }
.flow-mini-concept .flow-concept-icon { width: 17px; height: 17px; border-radius: 5px; font-size: .55rem; }
.flow-mini-stage footer { padding: .5rem .65rem; color: var(--green-dark); font-size: .62rem; font-weight: 850; }
.flow-mini-arrow { align-self: center; color: var(--green); font-size: 1.35rem; font-weight: 900; }
.flow-warning { color: var(--amber); }
#view-extraordinarios > .extra-details { padding: 1.2rem; }
#extra-summary.summary-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
#extra-summary .summary-card p { white-space: normal; font-size: .875rem; letter-spacing: 0; text-transform: none; }
#view-extraordinarios .section-intro p:not(.eyebrow), #view-extraordinarios .empty-state { font-size: 1rem; }
#view-extraordinarios .filters label, #view-extraordinarios form label { font-size: .875rem; }
#view-extraordinarios input, #view-extraordinarios select, #view-extraordinarios button { font-size: .875rem; }
#view-extraordinarios .extra-template-grid button { min-height: 44px; overflow-wrap: anywhere; }
#view-extraordinarios .row-actions { flex-wrap: wrap; }
.extra-details summary { cursor: pointer; font-size: 1.05rem; font-weight: 700; padding: .2rem 0; }
.extra-details p { margin: 1rem 0; font-size: 1rem; }
.extra-template-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: .6rem; }
.extra-payroll-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(160px, .65fr); gap: 1rem; padding: 1rem 0; align-items: center; border-bottom: 1px solid var(--line, #d6dfda); }
.extra-payroll-row input[type="checkbox"] { width: auto; display: inline; margin-right: .5rem; accent-color: var(--green, #196d64); }
.extra-payroll-row small { display: block; margin-top: .5rem; font-size: .875rem; }
#extra-fields label, #payroll-form label { font-size: .9rem; }
#extra-fields input, #extra-fields select, #extra-fields textarea, #payroll-form input, #payroll-form select { font-size: 1rem; }
#payroll-bonuses { margin: 1rem 0; }
#extra-dialog .context-box, #payroll-dialog .context-box { font-size: .95rem; line-height: 1.5; }
@media (max-width: 840px) { .extra-distribution-row { grid-template-columns: 34px 1fr 1fr; } .extra-distribution-row label:first-of-type { grid-column: 2 / -1; } .distribution-remove { grid-column: 3; justify-self: end; } }
@media (max-width: 640px) { .extra-payroll-row { grid-template-columns: 1fr; } .extra-grid { grid-template-columns: 1fr; } .distribution-head { align-items: stretch; flex-direction: column; } .extra-distribution-row { grid-template-columns: 30px 1fr 36px; } .extra-distribution-row label, .extra-distribution-row label:first-of-type { grid-column: 1 / -1; } .distribution-index { grid-column: 1; grid-row: 1; } .distribution-remove { grid-column: 3; grid-row: 1; } .distribution-history-row { grid-template-columns: 1fr; gap: .2rem; } }
.login-points { z-index: 1; margin-top: 2rem; display: flex; flex-wrap: wrap; gap: .55rem; }
.login-points span { padding: .45rem .75rem; border: 1px solid rgba(233,243,238,.18); border-radius: 99px; color: #dbe9e4; font-size: .7rem; }
.login-panel { padding: clamp(2rem, 7vw, 7rem); display: flex; flex-direction: column; justify-content: center; gap: 2rem; background: var(--surface); }
.login-panel h2 { font-family: Georgia, "Times New Roman", serif; font-size: 2.5rem; font-weight: 500; }
.login-panel p { color: var(--muted); }
.login-panel form { display: grid; gap: 1rem; }
.login-panel > small { font-size: .68rem; }
.password-field { display: flex; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: white; }
.password-field input { flex: 1; border: 0; border-radius: 0; }
.password-field button { padding: 0 .85rem; border: 0; background: transparent; color: var(--green); font-size: .72rem; font-weight: 800; }

form label, .filters label, .inline-filters label { display: grid; gap: .38rem; color: var(--muted); font-size: .68rem; font-weight: 760; }
input, select, textarea { width: 100%; min-width: 0; max-width: 100%; min-height: 39px; padding: .58rem .68rem; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--ink); }
textarea { resize: vertical; }
input[readonly] { background: var(--surface-2); color: var(--muted); }

.primary-button, .secondary-button, .text-button, .icon-button, .mini-button { border: 0; border-radius: 9px; font-size: .72rem; font-weight: 800; transition: transform .15s ease, background .15s ease, opacity .15s ease; }
.primary-button { min-height: 40px; padding: .65rem 1rem; background: var(--green); color: white; }
.secondary-button { min-height: 38px; padding: .58rem .9rem; border: 1px solid var(--line); background: white; }
.text-button { padding: .35rem .25rem; background: transparent; color: var(--green); }
.bulk-actions a.text-button { display: inline-flex; align-items: center; text-decoration: none; }
.text-button.danger { color: var(--red); }
.secondary-button.danger-button { border-color: #d7aaa0; color: var(--red); background: #fff8f6; }
.secondary-button.danger-button:hover { background: #fcebe7; }
.icon-button { width: 38px; height: 38px; display: grid; place-items: center; background: var(--surface-2); font-size: 1rem; }
.mini-button { padding: .4rem .55rem; border: 1px solid var(--line); background: white; white-space: nowrap; }
.primary-button:hover, .secondary-button:hover, .mini-button:hover { transform: translateY(-1px); }
button:disabled { cursor: not-allowed; opacity: .45; transform: none; }

.app-view { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 1.15rem .8rem; display: flex; flex-direction: column; background: var(--green-dark); color: #e8f0ed; }
.sidebar-brand { margin: 0 .35rem 1.5rem; display: flex; align-items: center; gap: .7rem; }
.sidebar-brand strong, .sidebar-brand small { display: block; }
.sidebar-brand small { margin-top: .15rem; color: #91aaa5; font-size: .58rem; }
.sidebar nav { display: grid; gap: .2rem; }
.nav-item { width: 100%; padding: .7rem .75rem; display: flex; align-items: center; gap: .7rem; border: 0; border-radius: 9px; background: transparent; color: #aec1bd; font-size: .73rem; font-weight: 720; text-align: left; }
.nav-item > span { width: 24px; color: #6f918a; font-size: .57rem; font-weight: 900; letter-spacing: .06em; }
.nav-item:hover, .nav-item.active { background: rgba(255,255,255,.09); color: white; }
.nav-item.active > span { color: #e8b86d; }
.nav-badge { min-width: 20px; margin-left: auto; padding: .15rem .35rem; border-radius: 99px; background: var(--amber); color: white; font-size: .58rem; text-align: center; }
.nav-badge.subtle { background: rgba(255,255,255,.12); color: #d8e6e2; }
.sidebar-foot { margin-top: auto; padding: .8rem .6rem 0; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar-foot p { margin-bottom: .35rem; color: #98afa9; font-size: .65rem; }
.sidebar-foot p small { margin-top: .15rem; display: block; color: #76918b; font-size: .52rem; letter-spacing: .035em; }
.sidebar-foot .text-button { color: #d9e5e1; }

.workspace { min-width: 0; --workspace-gutter: clamp(1rem, 2.4vw, 2rem); }
.topbar { min-height: 78px; padding: 1rem var(--workspace-gutter); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--line); background: rgba(244,241,233,.92); backdrop-filter: blur(12px); }
.topbar h1 { margin: 0; font-size: 1.55rem; }
.top-actions, .intro-actions, .chart-actions, .series-buttons, .dialog-actions { display: flex; align-items: center; gap: .55rem; }
.top-actions .muted { font-size: .65rem; }
main { width: 100%; min-width: 0; margin: 0; padding: var(--workspace-gutter); }
.view { display: none; min-width: 0; max-width: 100%; }
.view > *, .form-grid > *, .section-intro > *, .topbar > * { min-width: 0; }
.intro-actions, .top-actions { flex-wrap: wrap; max-width: 100%; }
.intro-actions > * { max-width: 100%; }
.view.active-view { display: block; animation: reveal .2s ease; }
@keyframes reveal { from { opacity: 0; transform: translateY(3px); } }

.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 2px 16px rgba(22,55,51,.025); }
.panel-head { min-height: 42px; margin-bottom: .75rem; display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.panel-head h2 { margin: 0; }
.summary-grid { margin-bottom: .8rem; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .7rem; }
.summary-grid.compact-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.summary-card { min-width: 0; padding: 1rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.summary-card.primary { border-color: transparent; background: var(--green); color: white; box-shadow: var(--shadow); }
.summary-card p { margin-bottom: .75rem; overflow: hidden; color: var(--muted); font-size: .6rem; font-weight: 850; letter-spacing: .05em; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.summary-card.primary p, .summary-card.primary small { color: #cce1db; }
.summary-card strong { display: block; font-size: clamp(1.1rem, 2vw, 1.65rem); font-variant-numeric: tabular-nums; }
.summary-card small { font-size: .62rem; }

.home-grid { margin-bottom: .8rem; display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, .72fr); gap: .8rem; }
.action-panel, .balances-panel, .chart-panel, .cash-panel, .data-panel, .two-column-grid > .panel, .flow-panel { padding: 1.05rem; }
.action-list, .balance-list, .cash-list, .stack-list { display: grid; gap: .5rem; }
.action-item { padding: .7rem; display: grid; grid-template-columns: 78px minmax(0, 1fr) auto; align-items: center; gap: .75rem; border: 1px solid var(--line); border-radius: 11px; background: white; }
.action-date { color: var(--green); font-size: .62rem; font-weight: 850; }
.action-copy strong, .action-copy small { display: block; }
.action-copy small { margin-top: .15rem; font-size: .6rem; }
.movement-group + .movement-group { margin-top: .7rem; }
.movement-group-title { margin: .25rem 0 .35rem; display: flex; align-items: center; justify-content: space-between; gap: .5rem; color: var(--ink); font-size: .62rem; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; }
.movement-group-title small { color: var(--muted); font-size: .56rem; }
.movement-group-title.stage-income { color: var(--green); }
.movement-group-title.stage-funding { color: #315f7a; }
.movement-group-title.stage-transfer { color: #7655a3; }
.movement-group-title.stage-expense { color: #a8552f; }
.movement-group-title.stage-adjustment { color: #6f6870; }
.movement-section-row th { padding: .62rem .7rem .38rem; border-top: 8px solid var(--surface); border-bottom: 2px solid currentColor; background: #f7f8f6; color: var(--ink); font-size: .62rem; letter-spacing: .045em; text-align: left; text-transform: uppercase; }
.movement-section-row:first-child th { border-top: 0; }
.movement-section-row th span { float: right; color: var(--muted); font-size: .57rem; letter-spacing: 0; text-transform: none; }
.movement-section-row.stage-income th { color: var(--green); background: #edf6f2; }
.movement-section-row.stage-funding th { color: #315f7a; background: #edf4f8; }
.movement-section-row.stage-transfer th { color: #7655a3; background: #f4eff9; }
.movement-section-row.stage-expense th { color: #a8552f; background: #fbf0e8; }
.movement-section-row.stage-adjustment th { color: #6f6870; background: #f2eff1; }
.balance-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .55rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.balance-row:last-child { border: 0; }
.balance-row span, .balance-row small { display: block; }
.balance-row small { margin-top: .12rem; font-size: .58rem; }
.balance-row strong { font-size: .75rem; font-variant-numeric: tabular-nums; }
.account-identity { min-width: 0; display: flex; align-items: center; gap: .6rem; }
.account-logo, .account-monogram { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 9px; object-fit: cover; background: white; box-shadow: 0 0 0 1px rgba(23,48,47,.08); }
.account-monogram { display: grid !important; place-items: center; background: var(--green-soft); color: var(--green); font-size: .58rem; font-weight: 900; }
select.account-select { min-width: 210px; padding-left: 3.75rem; background-repeat: no-repeat; background-position: .9rem center; background-size: 23px 23px; }
select.account-logo-santander { background-image: url("assets/accounts/santander.png"); }
select.account-logo-mercado-pago { background-image: url("assets/accounts/mercado-pago.webp"); }
select.account-logo-tenpo { background-image: url("assets/accounts/tenpo.webp"); }
select.account-logo-mach { background-image: url("assets/accounts/mach.webp"); }
select.account-logo-bancoestado { background-image: url("assets/accounts/bancoestado.webp"); }
select.account-logo-copec { background-image: url("assets/accounts/copec.webp"); }

.income-expense-grid { margin-bottom: .8rem; display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.income-panel { border-top: 4px solid var(--green); }
.expense-panel { border-top: 4px solid var(--amber); }
.inline-filters { margin-bottom: .65rem; display: grid; grid-template-columns: 1fr 1.4fr; gap: .5rem; }
.inline-filters select { min-height: 34px; padding: .4rem .5rem; font-size: .65rem; }
.cash-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cash-item { min-width: 0; padding: .65rem; border-radius: 10px; background: var(--surface-2); }
.cash-item span, .cash-item small { display: block; overflow: hidden; color: var(--muted); font-size: .6rem; text-overflow: ellipsis; white-space: nowrap; }
.cash-item strong { display: block; margin: .18rem 0; font-size: .78rem; font-variant-numeric: tabular-nums; }

.canvas-wrap { position: relative; height: 270px; }
.canvas-wrap.large { height: 390px; }
canvas { width: 100%; height: 100%; }
.chart-actions { align-items: flex-start; }
.chart-actions select { width: auto; min-height: 32px; padding: .38rem .5rem; font-size: .65rem; }
.series-buttons { flex-wrap: wrap; }
.series-buttons button, .segmented button { padding: .38rem .55rem; border: 1px solid var(--line); border-radius: 99px; background: white; color: var(--muted); font-size: .62rem; font-weight: 800; }
.series-buttons button::before { content: ""; width: 7px; height: 7px; margin-right: .35rem; display: inline-block; border-radius: 50%; background: currentColor; }
.series-buttons .income { color: var(--green); }
.series-buttons .expense { color: var(--amber); }
.series-buttons .transfer { color: #42738a; }
.series-buttons .reimbursement { color: #7655a3; }
.series-buttons .yield { color: #4f8b4f; }
.series-buttons .adjustment { color: #8a6872; }
.series-buttons .liquidity { color: #176e63; }
.series-buttons .reserve { color: #bd772d; }
.series-buttons .crypto { color: #7655a3; }
.series-buttons .balance { color: var(--blue); }
.series-buttons button:not(.active) { opacity: .35; }
.chart-tooltip { position: absolute; top: 12px; right: 12px; z-index: 4; min-width: 145px; padding: .6rem; pointer-events: none; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,253,248,.97); box-shadow: var(--shadow); font-size: .62rem; }
.chart-tooltip strong, .chart-tooltip span { display: block; }
.chart-tooltip span { margin-top: .2rem; color: var(--muted); }

.section-intro { margin-bottom: .8rem; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; }
.section-intro > div:first-child { flex: 1 1 420px; }
.section-intro > .intro-actions { flex: 0 1 auto; }
.section-intro p:not(.eyebrow) { margin: .35rem 0 0; color: var(--muted); font-size: .75rem; }
.section-intro h2 { font-size: 1.25rem; }
.link-button { display: inline-flex; align-items: center; justify-content: center; color: var(--ink); text-decoration: none; }
.toolbar { margin-bottom: .8rem; padding: .8rem; }
.filters { display: flex; flex-wrap: wrap; gap: .55rem; }
.filters label { min-width: 145px; flex: 1 1 145px; }
.filters input, .filters select { min-height: 36px; padding: .45rem .52rem; font-size: .66rem; }
.filters .check-filter { min-height: 36px; display: flex; align-items: center; align-self: end; gap: .5rem; padding: .45rem .65rem; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--ink); }
.check-filter input { width: 16px; min-height: 16px; margin: 0; }
.data-panel { overflow: hidden; }
.table-wrap { overflow: auto; }
.table-wrap.compact { max-height: 360px; }
table { width: 100%; border-collapse: collapse; font-size: .69rem; }
th { position: sticky; top: 0; z-index: 1; padding: .65rem .55rem; border-bottom: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: .58rem; letter-spacing: .04em; text-align: left; text-transform: uppercase; }
td { padding: .62rem .55rem; border-bottom: 1px solid #e7ebe5; vertical-align: middle; }
.source-label { display: block; margin-top: .2rem; color: var(--muted); font-size: .56rem; line-height: 1.25; }
.schedule-range { display: block; margin-top: .35rem; padding: .25rem .4rem; border-radius: 6px; background: var(--surface-2); color: var(--muted); font-size: .56rem; line-height: 1.3; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(231,239,234,.42); }
.numeric { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-actions { display: flex; justify-content: flex-end; gap: .35rem; }
.mini-button.danger { color: var(--red); }
.count-pill { min-width: 28px; padding: .23rem .45rem; border-radius: 99px; background: var(--surface-2); color: var(--green); font-size: .65rem; font-weight: 850; text-align: center; }
.status { display: inline-block; padding: .23rem .4rem; border-radius: 99px; background: var(--surface-2); color: var(--muted); font-size: .57rem; font-weight: 850; text-transform: capitalize; }
.status.realizado { background: var(--green-soft); color: var(--green); }
.status.pendiente, .status.pospuesto { background: var(--amber-soft); color: var(--amber); }
.status.cancelado, .status.no-aplica { background: var(--red-soft); color: var(--red); }
.status.referencia { background: #edf1f2; color: #52656b; }
.source-chip { display: inline-flex; padding: .28rem .45rem; border-radius: 99px; background: #edf1f2; color: #52656b; font-size: .54rem; font-weight: 800; white-space: nowrap; }
.source-chip.synced { background: var(--green-soft); color: var(--green); }
.warning-card { border-color: #e6c38e; background: #fffaf1; }
.baseline-row td { background: #f2f6f4; color: var(--muted); }
.centered { margin: .8rem auto 0; display: block; }

#view-reservas .section-intro { margin-bottom: .6rem; }
.reserve-workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(235px, 270px); align-items: start; gap: .75rem; }
.reserve-main-column { min-width: 0; display: grid; gap: .6rem; }
.reserve-main-column .summary-grid { margin-bottom: 0; gap: .5rem; }
.summary-grid.reserve-liquidity-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.reserve-total-card { padding: .72rem .78rem; border-top: 3px solid var(--green-dark); }
.reserve-total-card p { margin-bottom: .48rem; font-size: .55rem; }
.reserve-total-card strong { font-size: clamp(1rem, 1.7vw, 1.35rem); }
.reserve-total-card small { font-size: .54rem; }
.reserve-total-card.liquid { border-top-color: var(--green); background: linear-gradient(180deg, rgba(224,240,232,.72), var(--surface) 54%); }
.reserve-total-card.separated { border-top-color: var(--amber); background: linear-gradient(180deg, rgba(250,235,211,.72), var(--surface) 54%); }
.reserve-horizon-panel { margin-bottom: 0; padding: .72rem; }
.reserve-horizon-panel .panel-head { min-height: 0; margin-bottom: .5rem; }
.reserve-horizon-panel .panel-head h2 { font-size: .92rem; }
.reserve-horizon-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .4rem; }
.reserve-horizon-total { min-width: 0; padding: .5rem .55rem; display: flex; align-items: center; justify-content: space-between; gap: .4rem; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); }
.reserve-horizon-total span, .reserve-horizon-total small { display: block; }
.reserve-horizon-total span { color: var(--ink); font-size: .61rem; font-weight: 850; }
.reserve-horizon-total small { margin-top: .08rem; font-size: .45rem; }
.reserve-horizon-total strong { flex: 0 0 auto; font-size: .67rem; font-variant-numeric: tabular-nums; }
.reserve-tree { position: relative; margin-bottom: 0; padding: 0; }
.reserve-card { min-width: 0; padding: .56rem .62rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.reserve-card.base { background: var(--green-dark); color: white; }
.reserve-card small, .reserve-card span { display: block; color: var(--muted); }
.reserve-card.base small, .reserve-card.base span { color: #adc4bf; }
.reserve-card-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.reserve-card strong { flex: 0 0 auto; display: block; font-size: .84rem; font-variant-numeric: tabular-nums; }
.reserve-card h3 { margin: .08rem 0 0; font-size: .7rem; }
.reserve-card .yield-note { margin-top: .25rem; font-size: .47rem; }
.reserve-identity { align-items: center; }
.reserve-card .account-logo, .reserve-card .account-monogram { width: 26px; height: 26px; flex-basis: 26px; }
.reserve-meta { margin-top: .38rem; display: flex; flex-wrap: wrap; gap: .25rem; }
.reserve-meta span { padding: .16rem .32rem; border-radius: 99px; background: var(--surface-2); color: var(--muted); font-size: .47rem; font-weight: 800; }
.reserve-meta span.liquid { background: var(--green-soft); color: var(--green); }
.reserve-meta span.separated { background: var(--amber-soft); color: var(--amber); }
.reserve-card.base .reserve-meta span { background: rgba(255,255,255,.1); color: #d5e4df; }
.reserve-card-foot { min-width: 0; margin-top: .38rem; padding-top: .34rem; display: flex; align-items: center; justify-content: space-between; gap: .35rem; border-top: 1px solid var(--line); }
.reserve-card.base .reserve-card-foot { border-top-color: rgba(255,255,255,.14); }
.reserve-card-foot small { overflow: hidden; font-size: .49rem; text-overflow: ellipsis; white-space: nowrap; }
.reserve-card-foot .mini-button { padding: .22rem .34rem; font-size: .5rem; }
.reserve-card.base .mini-button { border-color: rgba(255,255,255,.2); background: rgba(255,255,255,.1); color: white; }
.reserve-card.base .account-logo { box-shadow: 0 0 0 1px rgba(255,255,255,.2); }
.reserve-root-card { position: relative; z-index: 2; width: min(430px, 100%); margin: 0 auto; box-shadow: 0 8px 20px rgba(21,61,58,.11); }
.reserve-tree-branches { position: relative; padding-top: 1.65rem; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: .62rem; }
.reserve-tree-branches::before { content: ""; position: absolute; z-index: 0; top: .78rem; left: 25%; right: 25%; border-top: 1px solid #bccbc6; }
.reserve-tree-branches::after { content: ""; position: absolute; z-index: 0; top: 0; left: 50%; height: .78rem; border-left: 1px solid #bccbc6; }
.reserve-branch { position: relative; min-width: 0; padding: .52rem; border: 1px solid var(--line); border-top: 3px solid var(--green); border-radius: 11px; background: rgba(255,255,255,.58); box-shadow: 0 5px 16px rgba(28,59,56,.045); }
.reserve-branch::before { content: ""; position: absolute; top: -.88rem; left: 50%; height: .88rem; border-left: 1px solid #bccbc6; }
.reserve-branch.separated { border-top-color: var(--amber); }
.reserve-branch-head { min-width: 0; padding: .08rem .05rem .48rem; display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: .45rem; border-bottom: 1px solid var(--line); }
.reserve-branch-head .eyebrow { margin: 0; }
.reserve-branch-head h3 { margin: .08rem 0; font-size: .68rem; }
.reserve-branch-head small { display: block; font-size: .46rem; }
.reserve-branch-head > strong { font-size: .73rem; font-variant-numeric: tabular-nums; }
.reserve-branch-mark { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: var(--green-soft); color: var(--green); font-size: .62rem; font-weight: 900; }
.reserve-branch.separated .reserve-branch-mark { background: var(--amber-soft); color: var(--amber); }
.reserve-horizon-list { position: relative; padding: .5rem 0 0 .9rem; }
.reserve-horizon-list::before { content: ""; position: absolute; top: .5rem; bottom: .7rem; left: .28rem; border-left: 1px solid #cbd5d1; }
.reserve-horizon-node { position: relative; margin-bottom: .5rem; }
.reserve-horizon-node:last-child { margin-bottom: 0; }
.reserve-horizon-node::before { content: ""; position: absolute; top: .5rem; left: -.62rem; width: .62rem; border-top: 1px solid #cbd5d1; }
.reserve-horizon-node > header { min-width: 0; margin-bottom: .3rem; padding: .3rem .4rem; display: flex; align-items: center; justify-content: space-between; gap: .4rem; border-radius: 8px; background: var(--surface-2); }
.reserve-horizon-node > header span, .reserve-horizon-node > header small { display: block; }
.reserve-horizon-node > header span { color: var(--ink); font-size: .56rem; font-weight: 850; }
.reserve-horizon-node > header small { margin-top: .06rem; font-size: .44rem; }
.reserve-horizon-node > header strong { flex: 0 0 auto; font-size: .61rem; font-variant-numeric: tabular-nums; }
.reserve-card-stack { display: grid; gap: .34rem; }
.reserve-leaf { border-left: 3px solid var(--green); box-shadow: 0 4px 12px rgba(28,59,56,.045); }
.reserve-branch.separated .reserve-leaf { border-left-color: var(--amber); }
.reserve-branch-empty { padding: .62rem; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); font-size: .55rem; text-align: center; }
.reserve-transfer-panel { padding: .8rem; }
.reserve-transfer-panel .panel-head { min-height: 0; margin-bottom: .45rem; }
.reserve-transfer-panel .panel-head h2 { font-size: .92rem; }
.reserve-transfer-panel .compact-form { gap: .5rem; }
.reserve-side-column { min-width: 0; align-self: stretch; }
.reserve-reconciliation-panel { position: sticky; top: 94px; padding: .8rem; }
.reserve-reconciliation-panel .panel-head { min-height: 0; margin-bottom: .55rem; }
.reserve-reconciliation-panel .panel-head h2 { font-size: .94rem; }
.reserve-reconciliation-panel .panel-head p:not(.eyebrow) { margin: .25rem 0 0; color: var(--muted); font-size: .58rem; line-height: 1.45; }
.reserve-reconcile-button { width: 100%; margin-bottom: .6rem; }
.reserve-reconciliation-panel .stack-list { gap: .4rem; }
.reserve-reconciliation-panel .stack-item { padding: .55rem; }
.two-column-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
.form-grid .full, .form-grid button.full { grid-column: 1 / -1; }
.compact-form { padding-top: .25rem; }
.stack-item { padding: .7rem; border: 1px solid var(--line); border-radius: 10px; background: white; }
.stack-item strong, .stack-item small { display: block; }
.stack-item small { margin-top: .2rem; font-size: .59rem; }

.segmented { padding: .18rem; display: inline-flex; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); }
.segmented button { border: 0; background: transparent; }
.segmented button.active { background: var(--green); color: white; }
.breakdown-list { display: grid; gap: .62rem; }
.breakdown-row { display: grid; grid-template-columns: minmax(90px, 1fr) minmax(100px, 2fr) auto; align-items: center; gap: .6rem; font-size: .67rem; }
.breakdown-track { height: 8px; overflow: hidden; border-radius: 99px; background: var(--surface-2); }
.breakdown-progress { width: 100%; height: 100%; display: block; overflow: hidden; border: 0; border-radius: inherit; appearance: none; background: transparent; }
.breakdown-progress::-webkit-progress-bar { border-radius: inherit; background: transparent; }
.breakdown-progress::-webkit-progress-value { border-radius: inherit; background: var(--amber); }
.breakdown-progress::-moz-progress-bar { border-radius: inherit; background: var(--amber); }

.flow-panel { overflow: hidden; }
.flow-toolbar { display: grid; gap: .75rem; }
.flow-display-options { padding-top: .65rem; display: flex; flex-wrap: wrap; gap: .55rem 1rem; border-top: 1px solid var(--line); }
.flow-display-options label { display: inline-flex; align-items: center; gap: .38rem; color: var(--ink); font-size: .63rem; font-weight: 750; }
.flow-display-options input { width: 15px; height: 15px; margin: 0; accent-color: var(--green); }
.flow-legend { margin: -.1rem 0 .65rem; padding: .65rem .75rem; display: flex; flex-wrap: wrap; align-items: center; gap: .55rem 1.35rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.flow-legend-group { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem .75rem; color: var(--muted); font-size: .61rem; }
.flow-legend-group strong { color: var(--ink); font-size: .59rem; letter-spacing: .055em; text-transform: uppercase; }
.flow-legend-group span { display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; }
.flow-zoom-controls { margin-left: auto; display: flex; align-items: center; gap: .35rem; }
.flow-zoom-controls .icon-button { width: 30px; height: 30px; border: 1px solid var(--line); background: white; color: var(--ink); }
.flow-zoom-controls span { min-width: 42px; color: var(--ink); font-size: .6rem; font-weight: 850; text-align: center; }
.flow-zoom-controls .text-button { padding: .3rem .45rem; font-size: .56rem; }
.flow-play-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; min-width: 0; }
.flow-play-controls .primary-button { min-height: 38px; padding: .45rem .8rem; font-size: .875rem; }
.flow-play-controls .muted { max-width: 380px; overflow-wrap: anywhere; font-size: .8125rem; }
.flow-speed-label { display: flex; align-items: center; gap: .4rem; font-size: .875rem; white-space: nowrap; }
.flow-speed-label select { width: 90px; min-height: 38px; padding: .35rem .5rem; font-size: .875rem; }
.flow-zoom-controls .text-button, .flow-zoom-controls span { font-size: .8125rem; }
.legend-color { width: 11px; height: 11px; display: inline-block; border-radius: 50%; background: #7a827e; }
.legend-color.ingreso { background: #2a7d65; }
.legend-color.egreso { background: #c56f3d; }
.legend-color.transferencia { background: #3f6f91; }
.legend-color.reembolso { background: #7c5aa6; }
.legend-color.ajuste { background: #7a827e; }
.legend-stroke { width: 24px; height: 0; display: inline-block; border-top: 3px solid #65736f; }
.legend-stroke.pendiente { border-top-style: dashed; }
.legend-stroke.pospuesto { border-top-style: dotted; }
.account-flow { width: 100%; min-width: 0; min-height: min(560px, 60vh); max-height: 74vh; overflow: auto; overscroll-behavior: contain; overflow-anchor: none; touch-action: none; cursor: grab; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(#fffdf9ee, #fffdf9ee), radial-gradient(circle, #cfd8d4 1px, transparent 1px); background-size: auto, 18px 18px; }
.account-flow > svg { min-width: 100%; max-width: none; display: block; }
.account-flow:not(.original-mode) svg { min-width: 0; }
.flow-navigation { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem 1rem; margin-bottom: .75rem; }
.flow-interaction { flex-wrap: wrap; border-radius: 12px; }
.flow-interaction button { min-height: 40px; font-size: .875rem; }
.flow-navigation p { flex: 1 1 270px; margin: 0; font-size: .875rem; color: var(--muted); }
.account-flow.pan-mode { cursor: grab; touch-action: none; }
.account-flow.pan-mode .flow-node { cursor: inherit; }
.account-flow.is-panning, .account-flow.is-panning * { cursor: grabbing !important; user-select: none; }
.account-flow:focus-visible { outline: 3px solid var(--green); outline-offset: 3px; }
.flow-node { cursor: grab; touch-action: none; }
.flow-node.dragging { cursor: grabbing; }
.flow-node.dragging rect { stroke: var(--green); stroke-width: 3; }
.flow-node-body { transform-box: fill-box; transform-origin: center; transition: transform .38s ease; }
.flow-node-body rect { transition: fill .38s ease, stroke .38s ease, stroke-width .38s ease; }
.flow-node.play-ready .flow-node-body, .flow-node.play-outgoing .flow-node-body, .flow-node.play-incoming .flow-node-body { transform: scale(1.055); }
.flow-node.play-ready .flow-node-body rect { stroke: #b78b32; stroke-width: 2.5; }
.flow-node.play-outgoing .flow-node-body rect { fill: #fff0ee; stroke: #bc6c65; stroke-width: 2.5; }
.flow-node.play-incoming .flow-node-body rect { fill: #e5f5eb; stroke: #388461; stroke-width: 2.5; }
.flow-node.play-outgoing .flow-secondary { fill: #963d36; }
.flow-node.play-incoming .flow-secondary { fill: #216446; }
.flow-balance-status { margin: .5rem 0 .75rem; padding: .7rem .85rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--ink); font-size: .875rem; }
.flow-node rect { fill: white; stroke: var(--line); stroke-width: 1.5; }
.flow-node text { pointer-events: none; fill: var(--ink); font-size: 14px; font-weight: 750; }
.flow-node .flow-secondary { fill: var(--muted); font-size: 13px; font-weight: 600; }
.flow-node image { clip-path: inset(0 round 8px); }
.flow-node.active rect { fill: var(--green-soft); stroke: var(--green); stroke-width: 2.5; }
.flow-node.entity-source rect { fill: #eff9f5; stroke: #70a995; }
.flow-node.entity-target rect { fill: #fff6ec; stroke: #c99862; }
.flow-link { fill: none; stroke: #7a827e; stroke-linecap: round; stroke-opacity: .68; transition: stroke-opacity .15s, filter .15s; }
.flow-link.flow-ingreso { stroke: #2a7d65; }
.flow-link.flow-egreso { stroke: #c56f3d; }
.flow-link.flow-transferencia { stroke: #3f6f91; }
.flow-link.flow-reembolso { stroke: #7c5aa6; }
.flow-link.status-pendiente { stroke-dasharray: 10 7; }
.flow-link.status-pospuesto { stroke-dasharray: 2 7; }
.flow-link.active { stroke-opacity: .96; filter: drop-shadow(0 1px 1px rgba(23,48,47,.18)); }
.flow-edge.play-active .flow-link { stroke-opacity: 1; filter: drop-shadow(0 0 5px #d89a27); }
.flow-edge-label.play-active .flow-label-box { stroke-width: 3; fill: #fff6d9; }
.flow-playhead { pointer-events: none; }
.flow-banknotes { font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; font-size: 25px; }
.flow-travel-card { box-sizing: border-box; display: flex; flex-direction: column; width: 100%; height: 100%; max-height: 100%; overflow: hidden; pointer-events: auto; touch-action: pan-y; cursor: auto; border: 1.5px solid #707878; border-radius: 10px; background: rgba(128, 128, 128, .20); backdrop-filter: blur(6px); color: #142527; font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.flow-actor-heading { fill: none; stroke: #185d53; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.flow-rpg-popup { font-size: 23px; font-weight: 900; font-variant-numeric: tabular-nums; paint-order: stroke; stroke: #fffdf9; stroke-width: 4px; stroke-linejoin: round; }
.flow-rpg-popup.is-receive { fill: #148348; }
.flow-rpg-popup.is-deliver { fill: #c13636; }
.flow-heart { fill: #ca4375; font-size: 19px; }
.flow-travel-tether { fill: none; stroke: #657574; stroke-width: 1.5; stroke-dasharray: 3 5; opacity: .6; }
.flow-travel-details { min-height: 0; flex: 1 1 auto; padding: 12px 14px; overflow: auto; overscroll-behavior: contain; }
.flow-travel-content > strong { display: block; font-size: 16px; font-weight: 850; }
.flow-travel-card .flow-travel-concept { margin-bottom: 5px; color: #293d3e; font-size: 14px; font-weight: 750; }
.flow-travel-card .flow-travel-date { display: block; margin-top: 2px; color: #4e5e58; font-size: 14px; font-weight: 650; }
.flow-travel-route { display: grid; grid-template-columns: 44px minmax(0, 1fr); align-items: start; gap: 8px; margin-top: 7px; }
.flow-travel-route > span { color: #66736c; font-weight: 600; }
.flow-travel-route > strong { font-size: 14px; font-weight: 750; }
.flow-playback-monitor { display: grid; grid-template-columns: minmax(0,.7fr) minmax(0,1fr) minmax(0,1.6fr); gap: 18px; align-items: center; margin: 0 0 12px; padding: 14px 18px; border: 1px solid var(--line); border-radius: 12px; background: #eef2f1; }
.flow-playback-monitor[hidden] { display: none; }
.flow-monitor-label { display: block; font-size: 14px; color: #4c6460; margin-bottom: 4px; }
.flow-route-monitor > strong { display: block; font-size: 16px; }
.flow-route-monitor progress { display: inline-block; vertical-align: middle; width: calc(100% - 50px); height: 8px; accent-color: var(--green); }
.flow-route-monitor > span:not(.flow-monitor-label) { font-size: 14px; margin-left: 6px; }
.flow-playback-monitor small { display: block; font-size: 12px; line-height: 1.45; color: #516562; }
.flow-liquidity-monitor > strong { display: block; font-size: clamp(21px,2vw,28px); font-variant-numeric: tabular-nums; white-space: nowrap; }
.flow-liquidity-monitor > span:not(.flow-monitor-label) { display: block; font-size: 14px; }
.flow-liquidity-monitor .negative { color: #a13f3b; }
.flow-liquidity-plot { position: relative; padding-left: 100px; min-width: 0; }
.flow-liquidity-plot svg { display: block; width: 100%; height: 96px; overflow: visible; }
.flow-plot-scale { position: absolute; left: 0; top: 8px; height: 80px; display: flex; flex-direction: column; justify-content: space-between; font-size: 12px; color: #516562; }
.flow-liquidity-grid { fill: none; stroke: #d1dcda; stroke-width: 1; vector-effect: non-scaling-stroke; }
.flow-liquidity-line { fill: none; stroke: #176e65; stroke-width: 2.5; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.flow-liquidity-dot { fill: #176e65; stroke: #fff; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
@media (max-width: 1050px) { .flow-playback-monitor { grid-template-columns: 1fr 1fr; } .flow-liquidity-plot { grid-column: 1 / -1; } }
@media (max-width: 520px) { .flow-playback-monitor { grid-template-columns: minmax(0,1fr); gap: 10px; padding: 12px; } .flow-liquidity-plot { grid-column: auto; padding-left: 88px; } }
@media (prefers-reduced-motion: reduce) {
  .flow-node-body, .flow-node-body rect { transition: none; }
  .flow-node.play-ready .flow-node-body, .flow-node.play-outgoing .flow-node-body, .flow-node.play-incoming .flow-node-body { transform: none; }
}
@keyframes flowPulse { from { stroke-width: inherit; } to { stroke-width: 11px; } }
.flow-label-box { fill: #fffdf8; stroke: #7a827e; stroke-width: 1.2; filter: drop-shadow(0 2px 4px rgba(23,48,47,.12)); }
.flow-label-box.flow-ingreso { stroke: #2a7d65; }
.flow-label-box.flow-egreso { stroke: #c56f3d; }
.flow-label-box.flow-transferencia { stroke: #3f6f91; }
.flow-label-box.flow-reembolso { stroke: #7c5aa6; }
.flow-label-box.flow-ajuste { stroke: #7a827e; }
.flow-label-leader { stroke: #7a827e; stroke-width: 1; stroke-dasharray: 3 3; }
.flow-label-leader.flow-egreso { stroke: #c56f3d; }
.flow-label-leader.flow-reembolso { stroke: #7c5aa6; }
.flow-label-divider { stroke: var(--line); stroke-width: 1; }
.flow-label { fill: var(--ink); font-size: 14px; font-weight: 800; text-anchor: middle; }
.flow-label .flow-date { fill: var(--muted); font-size: 13px; font-weight: 650; }
.flow-band-title { fill: #67807a; font-size: 13px; font-weight: 900; letter-spacing: 1.4px; }
.flow-band-line { stroke: #dfe6e2; stroke-width: 1; stroke-dasharray: 5 7; }
.flow-detail { margin: .45rem 0 0; color: var(--muted); font-size: .67rem; }
.account-flow.original-mode svg { width: 100%; min-width: 900px; }
.flow-original-link { fill: none; stroke: #7399a7; stroke-linecap: round; stroke-opacity: .46; }
.flow-original-link.active { stroke: var(--green); stroke-opacity: .9; }
.flow-original-box { fill: var(--surface); stroke: var(--line); stroke-width: 1; filter: drop-shadow(0 2px 4px rgba(23,48,47,.1)); }
.flow-original-label { fill: var(--ink); font-size: 9px; font-weight: 800; text-anchor: middle; }
.flow-original-label .flow-date { fill: var(--muted); font-size: 8px; font-weight: 650; }
.crypto-layout { align-items: stretch; }
.soft-divider { margin: 1rem 0; border: 0; border-top: 1px solid var(--line); }
.inline-rate-form { display: flex; align-items: end; gap: .6rem; }
.inline-rate-form label { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .35rem; color: var(--muted); font-size: .61rem; }
.inline-rate-form label input { grid-column: 1; }
.inline-rate-form label span { grid-column: 2; }
.inline-rate-form button { flex: 0 0 auto; }

.shared-connection { margin-bottom: .8rem; padding: .85rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.shared-connection > div { min-width: 0; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: .12rem .55rem; }
.shared-connection strong { overflow: hidden; font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.shared-connection small { grid-column: 2; font-size: .58rem; }
.connection-dot { width: 9px; height: 9px; grid-row: 1 / 3; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 4px var(--amber-soft); }
.connection-dot.connected { background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.shared-expenses-panel { margin-bottom: .8rem; }
.shared-closures-panel { margin-bottom: .8rem; }
.surplus-panel { margin-bottom: .8rem; padding: 1rem; display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; }
.surplus-panel p:not(.eyebrow) { margin: .25rem 0 0; color: var(--muted); font-size: .68rem; }
.surplus-actions { display: flex; align-items: flex-end; gap: .55rem; }
.surplus-actions label { min-width: 220px; }

.alert-summary { margin-bottom: .8rem; display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; }
.alert-stat { padding: .9rem 1rem; }
.alert-stat span { color: var(--muted); font-size: .63rem; }
.alert-stat strong { display: block; margin-top: .25rem; font-size: 1.4rem; }
.alert-stat.alta { border-top: 3px solid var(--red); }
.alert-stat.media { border-top: 3px solid var(--amber); }
.alert-stat.baja { border-top: 3px solid var(--blue); }
.alert-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
.alert-card { padding: .9rem; border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: 12px; background: var(--surface); }
.alert-card.alta { border-left-color: var(--red); }
.alert-card.media { border-left-color: var(--amber); }
.alert-card-head { margin-bottom: .55rem; display: flex; justify-content: space-between; gap: .5rem; }
.alert-card p { margin-bottom: .55rem; color: var(--muted); font-size: .68rem; }
.alert-meta { display: flex; justify-content: space-between; gap: .6rem; color: var(--muted); font-size: .58rem; }

.tab-bar { margin-bottom: .8rem; display: flex; gap: .35rem; overflow-x: auto; }
.tab-button { padding: .55rem .75rem; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--muted); font-size: .66rem; font-weight: 800; white-space: nowrap; }
.tab-button.active { border-color: var(--green); background: var(--green-soft); color: var(--green); }

dialog { width: min(720px, calc(100% - 2rem)); max-height: calc(100vh - 2rem); padding: 0; overflow: auto; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px rgba(18,48,45,.25); }
dialog::backdrop { background: rgba(14,35,34,.48); backdrop-filter: blur(3px); }
dialog form { padding: 1.2rem; }
.dialog-form { padding: 1.2rem; }
.wide-dialog { width: min(1100px, calc(100% - 2rem)); }
.dialog-copy { margin: -.35rem 0 1rem; color: var(--muted); font-size: .7rem; }
.bulk-actions { margin: .7rem 0; display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.bulk-summary { margin-bottom: .7rem; }
.bulk-summary .success-note, .bulk-summary .error-note { padding: .7rem; border-radius: 9px; font-size: .67rem; }
.bulk-summary .success-note { background: var(--green-soft); color: var(--green); }
.bulk-summary .error-note { background: var(--red-soft); color: var(--red); }
.bulk-preview { max-height: 330px; border: 1px solid var(--line); border-radius: 10px; }
.bulk-preview td { min-width: 90px; }
.bulk-preview .invalid-row { background: var(--red-soft); }
.dialog-head { margin-bottom: 1rem; display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.dialog-actions { margin-top: 1rem; justify-content: flex-end; }
.context-box, .difference-preview { margin-bottom: .8rem; padding: .75rem; border-radius: 10px; background: var(--surface-2); color: var(--muted); font-size: .67rem; }
.difference-preview strong { color: var(--ink); }
.form-error, .form-warning { min-height: 1em; margin: .5rem 0 0; color: var(--red); font-size: .65rem; }
.form-warning { color: var(--amber); }

.toast { position: fixed; z-index: 30; right: 1rem; bottom: 1rem; max-width: 380px; padding: .75rem 1rem; border-radius: 10px; background: var(--green-dark); color: white; box-shadow: var(--shadow); font-size: .7rem; opacity: 0; pointer-events: none; transform: translateY(8px); transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--red); }
.busy { position: fixed; z-index: 40; inset: 0; display: grid; place-content: center; background: rgba(244,241,233,.76); color: var(--green-dark); backdrop-filter: blur(3px); }
.busy-card { width: min(420px, calc(100vw - 2rem)); padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.busy-card > span { display: block; font-size: .76rem; font-weight: 850; }
.busy-card small { display: block; margin-top: .45rem; font-size: .58rem; }
.progress-track { height: 8px; margin-top: .75rem; overflow: hidden; border-radius: 99px; background: var(--green-soft); }
.progress-track span { width: 38%; height: 100%; display: block; border-radius: inherit; background: linear-gradient(90deg, var(--green), #55a390); animation: progress-slide 1.15s ease-in-out infinite; }
@keyframes progress-slide { from { transform: translateX(-110%); } to { transform: translateX(300%); } }
.empty-state { padding: 1rem; color: var(--muted); font-size: .68rem; text-align: center; }
.mobile-only { display: none; }

@media (max-width: 1120px) {
  :root { --sidebar: 205px; }
  .summary-grid { grid-template-columns: repeat(3, 1fr); }
  .cash-list { grid-template-columns: repeat(2, 1fr); }
  .reserve-horizon-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .composite-flow-row { grid-template-columns: 28px minmax(180px, 1.25fr) minmax(170px, 1fr) 20px minmax(170px, 1fr) 38px; }
  .composite-flow-row > .flow-builder-field:nth-of-type(4), .composite-flow-row > .flow-builder-field:nth-of-type(5) { grid-row: 2; }
  .composite-flow-row > .flow-builder-field:nth-of-type(4) { grid-column: 2 / 4; }
  .composite-flow-row > .flow-builder-field:nth-of-type(5) { grid-column: 4 / 6; }
  .composite-flow-row .distribution-remove { grid-column: 6; grid-row: 1 / 3; align-self: center; }
}

@media (max-width: 820px) {
  .login-view { grid-template-columns: 1fr; }
  .login-brand { min-height: 44vh; padding: 2.5rem 1.5rem; }
  .login-brand h1 { font-size: clamp(2.7rem, 13vw, 4.6rem); }
  .login-panel { padding: 2.2rem 1.5rem; }
  .app-view { display: block; }
  .sidebar { position: fixed; z-index: 20; width: 240px; left: -255px; transition: left .2s ease; box-shadow: var(--shadow); }
  .sidebar.open { left: 0; }
  .mobile-only { display: grid; }
  .topbar { position: sticky; z-index: 10; top: 0; }
  .top-actions .muted { display: none; }
  .home-grid, .income-expense-grid, .two-column-grid { grid-template-columns: 1fr; }
  .summary-grid, .summary-grid.compact-summary { grid-template-columns: repeat(2, 1fr); }
  .section-intro { align-items: flex-start; flex-direction: column; }
  .section-intro > div:first-child { flex-basis: auto; }
  .surplus-panel, .surplus-actions { align-items: stretch; flex-direction: column; }
  .action-item { grid-template-columns: 72px minmax(0, 1fr); }
  .action-item .mini-button { grid-column: 1 / -1; }
  .alert-grid { grid-template-columns: 1fr; }
  .flow-zoom-controls { margin-left: 0; }
  .planning-insight-head { align-items: stretch; flex-direction: column; }
  .planning-insight-head .secondary-button { align-self: flex-start; }
  .planning-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .decision-memory { align-items: stretch; flex-direction: column; }
  .decision-memory > .primary-button { align-self: flex-start; }
  .reserve-workspace { grid-template-columns: 1fr; }
  .reserve-reconciliation-panel { position: static; }
  .reserve-tree-branches { padding-top: 1.2rem; grid-template-columns: 1fr; }
  .reserve-tree-branches::before { display: none; }
  .reserve-tree-branches::after { height: 1.2rem; }
  .reserve-branch::before { display: none; }
  .composite-stage-head { align-items: stretch; flex-direction: column; }
  .composite-stage-head .inline-count-control { grid-template-columns: 68px 1fr auto; }
  .composite-flow-row { grid-template-columns: 28px minmax(0, 1fr) 20px minmax(0, 1fr) 38px; }
  .composite-flow-row > .flow-builder-field:nth-of-type(1) { grid-column: 2 / 5; }
  .composite-flow-row > .flow-builder-field:nth-of-type(2) { grid-column: 2; grid-row: 2; }
  .composite-flow-row .flow-row-arrow { grid-column: 3; grid-row: 2; }
  .composite-flow-row > .flow-builder-field:nth-of-type(3) { grid-column: 4; grid-row: 2; }
  .composite-flow-row > .flow-builder-field:nth-of-type(4) { grid-column: 2 / 4; grid-row: 3; }
  .composite-flow-row > .flow-builder-field:nth-of-type(5) { grid-column: 4 / 6; grid-row: 3; }
  .composite-flow-row .distribution-remove { grid-column: 5; grid-row: 1; align-self: center; }
}

@media (max-width: 520px) {
  main { padding: .75rem; }
  .topbar { padding: .75rem; }
  .topbar h1 { font-size: 1.25rem; }
  .top-actions { gap: .3rem; }
  .top-actions .secondary-button { padding: .5rem .6rem; font-size: .62rem; }
  .summary-grid, .summary-grid.compact-summary, .reserve-liquidity-summary, .reserve-horizon-summary, .alert-summary { grid-template-columns: 1fr; }
  .cash-list { grid-template-columns: 1fr; }
  .inline-filters, .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .panel-head { align-items: flex-start; flex-direction: column; }
  .chart-actions { width: 100%; flex-direction: column; }
  .series-buttons { width: 100%; }
  .canvas-wrap { height: 235px; }
  .intro-actions, .dialog-actions { width: 100%; align-items: stretch; flex-direction: column; }
  .intro-actions > *, .dialog-actions > * { width: 100%; }
  .flow-legend, .inline-rate-form { align-items: stretch; flex-direction: column; }
  .flow-play-controls { align-items: flex-start; flex-direction: column; }
  .deviation-kpi-grid, .planning-controls { grid-template-columns: 1fr; }
  .decision-memory-copy { flex-direction: column; }
  .decision-memory > .primary-button { width: 100%; }
  .reserve-branch-head { grid-template-columns: 30px minmax(0, 1fr); }
  .reserve-branch-head > strong { grid-column: 2; }
  .composite-stage-head .inline-count-control { grid-template-columns: 1fr; }
  .composite-flow-row { grid-template-columns: 26px minmax(0, 1fr) 36px; }
  .composite-flow-row > .flow-builder-field, .composite-flow-row > .flow-builder-field:nth-of-type(1), .composite-flow-row > .flow-builder-field:nth-of-type(2), .composite-flow-row > .flow-builder-field:nth-of-type(3), .composite-flow-row > .flow-builder-field:nth-of-type(4), .composite-flow-row > .flow-builder-field:nth-of-type(5) { grid-column: 1 / -1; grid-row: auto; }
  .composite-flow-row .flow-route-index { grid-column: 1; grid-row: 1; }
  .composite-flow-row .flow-row-arrow { display: none; }
  .composite-flow-row .distribution-remove { grid-column: 3; grid-row: 1; }
}

/* Independent DEV environment marker. */
.environment-badge{display:inline-flex;align-items:center;vertical-align:middle;margin-inline-start:.4rem;padding:.13rem .4rem;border:1px solid #b56a15;border-radius:5px;background:#fff4db;color:#805000;font-size:.65rem;font-weight:800;line-height:1.2;letter-spacing:.08em;white-space:nowrap}
.shared-sync-warning{margin:0 0 1rem;padding:.85rem 1rem;border:1px solid #d6a654;border-left-width:4px;border-radius:10px;background:#fff4db;color:#705019;font-size:.85rem;font-weight:650;line-height:1.5}
.shared-sync-warning[hidden]{display:none}
