/* SIDOME — estilos base. Sencillo, luminoso y tranquilo. */
:root {
  --green: #16834A;
  --green-dark: #0F5732;
  --green-light: #EAF7EF;
  --white: #FFFFFF;
  --text: #26352D;
  --muted: #5B6B62;
  --bg: #F4F7F5;
  --border: #DCE6E0;
  --warn: #8A5A00;
  --warn-bg: #FFF5DB;
  --danger: #B42318;
  --danger-bg: #FDEDEB;
  --info-bg: #EEF2F0;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 87, 50, 0.05);
  --focus: 0 0 0 3px rgba(22, 131, 74, 0.35);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --sidebar: 232px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
}
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; color: var(--text); }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.2rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0 0 .75rem; }
a { color: var(--green-dark); }
a:hover { color: var(--green); }
small, .muted { color: var(--muted); }
.muted { font-size: .92rem; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }

.skip-link { position: absolute; left: -999px; top: 8px; background: var(--white); padding: .5rem 1rem; z-index: 50; }
.skip-link:focus { left: 8px; }

/* ---------- Estructura de la aplicación ---------- */
.app { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar);
  background: var(--white); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 1.25rem .9rem;
}
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 750; font-size: 1.15rem; color: var(--green-dark); text-decoration: none; padding: .25rem .5rem 1.25rem; letter-spacing: .02em; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--green); display: grid; place-items: center; color: var(--white); }
.brand-mark svg { width: 16px; height: 16px; }
.brand-logo-sidebar { height: 48px; width: auto; max-width: 100%; object-fit: contain; }
.nav { display: flex; flex-direction: column; gap: .15rem; }
.nav a {
  display: flex; align-items: center; gap: .65rem; padding: .6rem .7rem; border-radius: var(--radius-sm);
  color: var(--text); text-decoration: none; font-size: .95rem;
  transition: background-color .15s ease;
}
.nav a:hover { background: var(--bg); color: var(--text); }
.nav a[aria-current="page"] { background: var(--green-light); color: var(--green-dark); font-weight: 600; }
.nav svg { width: 18px; height: 18px; flex: none; }
.sidebar-footer { margin-top: auto; border-top: 1px solid var(--border); padding-top: .9rem; font-size: .88rem; }
.sidebar-footer .user-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 .5rem; }
.linklike { background: none; border: 0; padding: .4rem .5rem; color: var(--green-dark); font: inherit; cursor: pointer; text-decoration: underline; }

.main { margin-left: var(--sidebar); padding: 2rem 2.25rem 3rem; }
.container { max-width: 1040px; margin: 0 auto; }
.narrow { max-width: 640px; margin: 0 auto; }

.topbar, .bottom-nav { display: none; }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-head p { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; }

/* ---------- Tarjetas ---------- */
.card {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.4rem;
}
.card + .card, .stack > * + * { margin-top: 1.25rem; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.card-head h2 { margin: 0; }

.section-tag {
  display: inline-flex; align-items: center; gap: .35rem; font-size: .78rem; font-weight: 650;
  text-transform: uppercase; letter-spacing: .05em; color: var(--green-dark);
  background: var(--green-light); border-radius: 999px; padding: .2rem .65rem;
}
.section-tag svg { width: 14px; height: 14px; }
.section-tag.ai { background: #EEF0FA; color: #3B3F8C; }

/* ---------- Indicadores ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; }
.kpi {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}
.kpi .label { font-size: .85rem; color: var(--muted); margin-bottom: .3rem; }
.kpi .value { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; word-break: break-word; }
.kpi .value.na { font-size: 1rem; font-weight: 600; color: var(--muted); }
.kpi .hint { font-size: .82rem; color: var(--muted); margin-top: .25rem; }
.kpi details { margin-top: .5rem; font-size: .85rem; }
.kpi summary { cursor: pointer; color: var(--green-dark); }
.kpi details p { margin: .4rem 0 0; color: var(--muted); }

/* ---------- Estados (siempre icono + texto) ---------- */
.badge {
  display: inline-flex; align-items: center; gap: .35rem; font-size: .85rem; font-weight: 650;
  border-radius: 999px; padding: .25rem .7rem; border: 1px solid transparent; white-space: nowrap;
}
.badge svg { width: 15px; height: 15px; flex: none; }
.badge.ok { background: var(--green-light); color: var(--green-dark); border-color: #BFE3CD; }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: #F2DDA4; }
.badge.danger { background: var(--danger-bg); color: var(--danger); border-color: #F5C2BC; }
.badge.info { background: var(--info-bg); color: var(--muted); border-color: var(--border); }

.alert {
  display: flex; gap: .7rem; align-items: flex-start; border-radius: var(--radius-sm);
  padding: .85rem 1rem; font-size: .95rem; border: 1px solid var(--border); background: var(--info-bg);
}
.alert svg { width: 20px; height: 20px; flex: none; margin-top: .1rem; }
.alert p { margin: 0; }
.alert.ok { background: var(--green-light); border-color: #BFE3CD; color: var(--green-dark); }
.alert.warn { background: var(--warn-bg); border-color: #F2DDA4; color: #5E3E00; }
.alert.danger { background: var(--danger-bg); border-color: #F5C2BC; color: #7A1A12; }
.alert + .alert { margin-top: .75rem; }

.findings { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.findings li { display: flex; gap: .75rem; align-items: flex-start; }
.findings .badge { flex: none; margin-top: .05rem; }
.plain-list { margin: 0; padding-left: 1.2rem; }
.plain-list li + li { margin-top: .35rem; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 42px;
  padding: .55rem 1.05rem; border-radius: var(--radius-sm); border: 1px solid var(--green);
  background: var(--green); color: var(--white); font: inherit; font-weight: 600; font-size: .95rem;
  text-decoration: none; cursor: pointer; transition: background-color .15s ease, border-color .15s ease;
}
.btn:hover { background: var(--green-dark); border-color: var(--green-dark); color: var(--white); }
.btn svg { width: 18px; height: 18px; }
.btn.secondary { background: var(--white); color: var(--green-dark); border-color: #B9D8C5; }
.btn.secondary:hover { background: var(--green-light); color: var(--green-dark); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--green-dark); }
.btn.ghost:hover { background: var(--green-light); }
.btn.danger { background: var(--white); color: var(--danger); border-color: #F0B8B1; }
.btn.danger:hover { background: var(--danger-bg); }
.btn.big { min-height: 48px; padding: .7rem 1.4rem; font-size: 1rem; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn.block { width: 100%; }

/* ---------- Formularios ---------- */
.form-grid { display: grid; gap: 1rem; }
.form-grid.two { grid-template-columns: 1fr 1fr; }
fieldset { border: 0; padding: 0; margin: 0 0 1.5rem; }
legend { font-weight: 650; font-size: 1.05rem; margin-bottom: .25rem; padding: 0; }
.legend-hint { color: var(--muted); font-size: .9rem; margin-bottom: .9rem; }
.field label { display: block; font-weight: 600; font-size: .93rem; margin-bottom: .3rem; }
.field .hint { font-size: .84rem; color: var(--muted); margin-top: .25rem; }
.field .error { font-size: .85rem; color: var(--danger); margin-top: .3rem; display: flex; gap: .3rem; align-items: center; }
.field .error:empty { display: none; }
.field .error::before { content: "⚠"; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--white);
  border: 1px solid #C9D6CF; border-radius: var(--radius-sm); padding: .6rem .75rem; min-height: 44px;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green); box-shadow: var(--focus); }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); }
.input-prefix { position: relative; }
.input-prefix span { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .85rem; pointer-events: none; }
.input-prefix input { padding-left: 3.4rem; text-align: right; font-variant-numeric: tabular-nums; }
.total-line {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; background: var(--green-light);
  border-radius: var(--radius-sm); padding: .6rem .85rem; font-size: .95rem; margin-top: .25rem;
}
.total-line strong { font-variant-numeric: tabular-nums; }
.checkbox { display: flex; gap: .6rem; align-items: flex-start; font-size: .95rem; }
.checkbox input { width: 20px; height: 20px; min-height: 0; margin-top: .15rem; accent-color: var(--green); flex: none; }
.form-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.25rem; }

/* ---------- Tablas y listas ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .94rem; }
th, td { text-align: left; padding: .65rem .6rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .82rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.summary-table td:last-child { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

.report-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; }
.report-item {
  display: grid; grid-template-columns: 1fr auto; gap: .5rem 1rem; align-items: center;
  border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; background: var(--white);
}
.report-item h3 { margin: 0 0 .2rem; }
.report-item .meta { font-size: .86rem; color: var(--muted); }
.report-item .row-actions { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: flex-end; }

/* ---------- IA ---------- */
.ai-card { border-left: 4px solid #6A70C9; }
.reco { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .8rem .95rem; }
.reco + .reco { margin-top: .6rem; }
.reco .why { color: var(--muted); font-size: .9rem; margin: .3rem 0 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.usage { font-size: .88rem; color: var(--muted); }

/* ---------- Diálogos ---------- */
dialog {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 0; max-width: 560px; width: calc(100% - 32px);
  color: var(--text); box-shadow: 0 12px 40px rgba(15, 40, 25, .18);
}
dialog::backdrop { background: rgba(20, 35, 27, .45); }
.dialog-body { padding: 1.4rem; max-height: min(80vh, 720px); overflow-y: auto; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: flex-end; padding: 1rem 1.4rem; border-top: 1px solid var(--border); background: var(--bg); border-radius: 0 0 var(--radius) var(--radius); }
pre.preview { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .75rem; font-size: .78rem; overflow: auto; max-height: 220px; white-space: pre-wrap; word-break: break-word; }

/* ---------- Gráficos ---------- */
.chart-box { position: relative; height: 260px; }

/* ---------- Páginas públicas ---------- */
.public { min-height: 100vh; display: flex; flex-direction: column; }
.public-header { display: flex; justify-content: space-between; align-items: center; padding: 1.1rem 1.5rem; max-width: 1100px; width: 100%; margin: 0 auto; }
.public-header .brand { display: flex; align-items: center; gap: 1rem; padding: 0; text-decoration: none; color: var(--text); font-size: 1rem; font-weight: 600; }
.brand-logo { height: 48px; width: auto; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; gap: 0.1rem; }
.brand-sub { font-size: 0.75rem; color: var(--muted); font-weight: 400; }
.public-main { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 1rem 1.5rem 3rem; }
.hero { display: grid; grid-template-columns: 1.15fr .85fr; gap: 2.5rem; align-items: center; padding: 2.5rem 0 2rem; }
.hero h1 { font-size: 2.3rem; letter-spacing: -.01em; }
.hero .lead { font-size: 1.1rem; color: var(--muted); max-width: 34rem; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: .9rem; counter-reset: step; }
.steps li { display: flex; gap: .9rem; align-items: flex-start; }
.steps li::before {
  counter-increment: step; content: counter(step); flex: none; width: 30px; height: 30px; border-radius: 50%;
  background: var(--green-light); color: var(--green-dark); font-weight: 700; display: grid; place-items: center; font-size: .9rem;
}
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 1.5rem; }
.auth-card { max-width: 440px; margin: 2rem auto; }
.public-footer { text-align: center; font-size: .85rem; color: var(--muted); padding: 1.5rem; }
.footer-content { max-width: 1100px; margin: 0 auto; }
.footer-logos { margin-top: 1rem; display: flex; justify-content: center; gap: 1rem; }
.footer-logo { height: 32px; width: auto; object-fit: contain; opacity: 0.7; }

.empty { text-align: center; padding: 2.2rem 1rem; }
.empty svg { width: 40px; height: 40px; color: var(--green); margin-bottom: .5rem; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60;
  background: var(--text); color: var(--white); padding: .7rem 1.1rem; border-radius: var(--radius-sm);
  font-size: .93rem; box-shadow: 0 6px 20px rgba(0, 0, 0, .18); max-width: calc(100% - 32px);
}

.spinner { width: 18px; height: 18px; border: 2px solid rgba(255, 255, 255, .45); border-top-color: currentColor; border-radius: 50%; animation: spin .8s linear infinite; }
.btn.secondary .spinner { border-color: rgba(22, 131, 74, .25); border-top-color: var(--green); }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { color: var(--muted); padding: 2rem 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: .01ms !important; }
}

/* ---------- Tabletas y móviles ---------- */
@media (max-width: 960px) {
  .grid-2 { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; gap: 1.5rem; padding-top: 1rem; }
  .features { grid-template-columns: 1fr; }
}

@media (max-width: 800px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 1rem 16px 6rem; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; gap: .75rem;
    position: sticky; top: 0; z-index: 20; background: var(--white); border-bottom: 1px solid var(--border); padding: .55rem 16px;
  }
  .topbar .brand { padding: 0; font-size: 1.05rem; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    background: var(--white); border-top: 1px solid var(--border); padding: .3rem .25rem calc(.3rem + env(safe-area-inset-bottom));
  }
  .bottom-nav a {
    display: flex; flex-direction: column; align-items: center; gap: .1rem; font-size: .72rem; color: var(--muted);
    text-decoration: none; padding: .35rem .2rem; border-radius: var(--radius-sm);
  }
  .bottom-nav a[aria-current="page"] { color: var(--green-dark); background: var(--green-light); font-weight: 600; }
  .bottom-nav svg { width: 20px; height: 20px; }
  h1 { font-size: 1.35rem; }
  .card { padding: 1.1rem; }
  .form-grid.two { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: .7rem; }
  .kpi .value { font-size: 1.1rem; }
  .report-item { grid-template-columns: 1fr; }
  .report-item .row-actions { justify-content: flex-start; }
  .page-head .actions { width: 100%; }
  .hero h1 { font-size: 1.75rem; }
  .public-header, .public-main { padding-left: 16px; padding-right: 16px; }
  .chart-box { height: 220px; }
}

@media (max-width: 340px) {
  .kpi-grid { grid-template-columns: 1fr; }
}

/* Utilidades de espaciado (la CSP no permite estilos en línea). */
.mt-sm { margin-top: 1rem; }
.mt-md { margin-top: 1.25rem; }
.mt-lg { margin-top: 1.5rem; }
.grid-2 > .card + .card { margin-top: 0; }
[id="basic"], [id="ai"] { scroll-margin-top: 72px; }

/* ---------- Carga de datos: elegir modo ---------- */
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
.choice {
  display: flex; gap: .8rem; align-items: flex-start; text-align: left; width: 100%;
  background: var(--white); border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 1rem 1.1rem; font: inherit; color: var(--text); cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}
.choice:hover { border-color: #B9D8C5; }
.choice[aria-pressed="true"] { border-color: var(--green); background: var(--green-light); }
.choice svg { width: 26px; height: 26px; color: var(--green); flex: none; margin-top: .1rem; }
.choice strong { display: block; margin-bottom: .15rem; }
.choice span { font-size: .88rem; color: var(--muted); }

/* ---------- Subida de estados de cuenta ---------- */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem; text-align: center;
  border: 2px dashed #B9D8C5; border-radius: var(--radius); padding: 1.6rem 1rem; background: var(--bg);
  cursor: pointer; transition: border-color .15s ease, background-color .15s ease;
}
.dropzone:hover, .dropzone.over { border-color: var(--green); background: var(--green-light); }
.dropzone:focus-within { box-shadow: var(--focus); }
.dropzone svg { width: 34px; height: 34px; color: var(--green); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone .muted { margin: 0; }
.file-list { list-style: none; margin: .9rem 0 0; padding: 0; display: grid; gap: .45rem; }
.file-list li {
  display: flex; align-items: center; gap: .6rem; justify-content: space-between;
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .5rem .7rem; background: var(--white); font-size: .92rem;
}
.file-list .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.file-list .status { font-size: .85rem; color: var(--muted); flex: 0 1 auto; min-width: 0; text-align: right; }
.file-list .name { flex: 1 0 40%; }
.file-list li.error { border-color: #F5C2BC; background: var(--danger-bg); }
.file-list li.ok { border-color: #BFE3CD; }
.btn.small { min-height: 34px; padding: .3rem .7rem; font-size: .85rem; }

.summary-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .7rem; margin-top: 1rem; }

.movements { max-height: 380px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-top: .6rem; }
.movements table { font-size: .88rem; }
.movements th { position: sticky; top: 0; background: var(--bg); z-index: 1; }
.movements td.desc { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.movements select { min-height: 34px; padding: .2rem .4rem; font-size: .85rem; width: auto; }
.movements tr.excluded td { color: var(--muted); text-decoration: line-through; }
.movements tr.excluded td:last-child { text-decoration: none; }

.from-statement svg { width: 12px; height: 12px; flex: none; }
.from-statement { white-space: nowrap; display: inline-flex; align-items: center; gap: .3rem; font-size: .78rem; font-weight: 600; color: var(--green-dark); background: var(--green-light); border-radius: 999px; padding: .05rem .5rem; margin-left: .4rem; vertical-align: middle; }
.optional { font-weight: 400; color: var(--muted); font-size: .85rem; }
.period-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.period-grid .pair { display: grid; grid-template-columns: 1.4fr 1fr; gap: .5rem; }

@media (max-width: 800px) {
  .choice-grid, .period-grid { grid-template-columns: 1fr; }
  .movements td.desc { max-width: 140px; }
  .summary-strip { grid-template-columns: 1fr 1fr; }
  .summary-strip .value { font-size: 1rem; }
  /* Movimientos como tarjetas compactas: sin desplazamiento lateral. */
  .movements thead { display: none; }
  .movements table, .movements tbody { display: block; }
  .movements tr { display: grid; grid-template-columns: 1fr auto; gap: .15rem .5rem; padding: .55rem .7rem; border-bottom: 1px solid var(--border); }
  .movements td { border: 0; padding: 0; }
  .movements td:nth-child(1) { grid-column: 1; grid-row: 1; color: var(--muted); }
  .movements td:nth-child(3) { grid-column: 2; grid-row: 1; font-weight: 600; }
  .movements td.desc { grid-column: 1 / -1; grid-row: 2; max-width: none; white-space: normal; }
  .movements td:nth-child(4) { grid-column: 1 / -1; grid-row: 3; }
  .movements.groups td.desc { grid-row: 1; grid-column: 1 / -1; font-weight: 600; }
  .movements.groups td:nth-child(2) { grid-row: 2; grid-column: 1; color: var(--muted); font-weight: 400; }
  .movements.groups td:nth-child(3) { grid-row: 2; grid-column: 2; color: var(--muted); font-weight: 400; }
  .movements.groups td:nth-child(4) { grid-row: 3; grid-column: 1; font-weight: 600; }
  .movements.groups td:nth-child(5) { grid-row: 3; grid-column: 2; }
}

/* ---------- Costos mensuales ---------- */
.cost-list { display: grid; gap: .5rem; }
.cost-list:empty { display: none; }
.cost-row { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.5fr) minmax(0, 1fr) auto; gap: .5rem; align-items: center; }
.cost-row select, .cost-row input { min-width: 0; }
.cost-row [aria-invalid] { border-color: var(--danger); }
.cost-table td.num { white-space: nowrap; }
.cost-table tr.group-row td { background: var(--bg); }
.cost-table td.indent { padding-left: 1.4rem; }
@media (max-width: 800px) {
  .cost-row { grid-template-columns: 1fr auto; padding: .6rem; border: 1px solid var(--border); border-radius: var(--radius-sm); }
  .cost-row select, .cost-row .cost-desc { grid-column: 1 / -1; }
  .cost-row .input-prefix { grid-column: 1; }
}

/* Resumen por concepto: la descripción se ajusta en varias líneas para que la columna «Contar como» quede siempre visible. */
.movements.groups td.desc { white-space: normal; max-width: none; min-width: 9rem; }
.movements.groups td, .movements.groups th { padding-left: .5rem; padding-right: .5rem; }
.movements.groups td.num { white-space: nowrap; }
.summary-strip .value { font-size: 1.15rem; }
