/* RAPIDOGS LA 35 — herramienta financiera.
   Dirección: verde y amarillo de la marca como acentos sobre neutros con leve sesgo verde;
   tablas densas y legibles, números tabulares. Layout: cabecera fija + módulo en columna. */
:root {
  --bg: #f4f6f1;
  --surface: #ffffff;
  --surface-2: #f8faf6;
  --ink: #16201a;
  --ink-2: #4b574f;
  --muted: #748077;
  --line: #e1e6dd;
  --brand: #1f8a3e;
  --brand-2: #17702f;
  --brand-ink: #ffffff;
  --accent: #ffe600;
  --ok: #1d7a3a; --ok-bg: #e5f4e9;
  --warn: #9a5b00; --warn-bg: #fff1d6;
  --crit: #c0262d; --crit-bg: #fde7e7;
  --info: #2763a8; --info-bg: #e5eef9;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4;
  --font-display: 'Archivo', 'Arial Narrow', Arial, sans-serif;
  --font-body: 'Source Sans 3', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --r: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1410; --surface: #171f19; --surface-2: #1c251e; --ink: #ecf1ea; --ink-2: #b7c2b9; --muted: #8b968d; --line: #2a352d;
    --brand: #39a85a; --brand-2: #4cbc6c; --brand-ink: #08140c; --accent: #ffe14d;
    --ok: #63c983; --ok-bg: #173322; --warn: #f0b34d; --warn-bg: #3a2b10; --crit: #f07a7a; --crit-bg: #3d1a1b; --info: #7fb2ef; --info-bg: #182b42;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181;
    color-scheme: dark;
  }
  :root:not([data-theme="light"]) .operador .logo-claro { display: none; }
  :root:not([data-theme="light"]) .operador .logo-oscuro { display: block; }
}
:root[data-theme="dark"] {
  --bg: #0e1410; --surface: #171f19; --surface-2: #1c251e; --ink: #ecf1ea; --ink-2: #b7c2b9; --muted: #8b968d; --line: #2a352d;
  --brand: #39a85a; --brand-2: #4cbc6c; --brand-ink: #08140c; --accent: #ffe14d;
  --ok: #63c983; --ok-bg: #173322; --warn: #f0b34d; --warn-bg: #3a2b10; --crit: #f07a7a; --crit-bg: #3d1a1b; --info: #7fb2ef; --info-bg: #182b42;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181;
  color-scheme: dark;
}
:root[data-theme="dark"] .operador .logo-claro { display: none; }
:root[data-theme="dark"] .operador .logo-oscuro { display: block; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 var(--font-body); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 1.02rem; font-weight: 800; }
h3 { font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-2); }
a { color: var(--brand); }
small { display: block; color: var(--muted); font-size: 0.8rem; line-height: 1.3; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.strong { font-weight: 700; }
.neg { color: var(--crit) !important; }
.muted { color: var(--muted); margin: 0; }
.small { font-size: 0.84rem; }
.grow { flex: 1; }
.wrap { max-width: 1320px; margin: 0 auto; padding: 0 20px; }
:focus-visible { outline: 3px solid var(--s1); outline-offset: 2px; border-radius: 4px; }

/* Cabecera */
.top { background: var(--surface); border-top: 5px solid var(--accent); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.top-in { max-width: 1320px; margin: 0 auto; padding: 10px 20px 6px; display: flex; align-items: center; gap: 16px; }
.brand img { display: block; height: 46px; width: auto; }
.brand-txt { display: flex; flex-direction: column; line-height: 1.15; }
.brand-txt strong { font-family: var(--font-display); font-style: italic; font-weight: 800; font-size: 1.15rem; color: var(--brand); letter-spacing: 0.01em; }
.brand-txt span { color: var(--ink-2); font-size: 0.9rem; }
.operador { display: flex; align-items: center; gap: 8px; font-size: 0.72rem; color: var(--muted); line-height: 1.2; }
.operador img { height: 30px; width: auto; }
.operador .logo-oscuro { display: none; }
.operador strong { color: var(--ink-2); letter-spacing: 0.03em; }
.nav { max-width: 1320px; margin: 0 auto; padding: 0 14px; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.nav a { padding: 9px 12px 10px; color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: 0.93rem; white-space: nowrap; border-bottom: 3px solid transparent; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--brand); border-bottom-color: var(--brand); }

.banner { background: var(--warn-bg); color: var(--warn); text-align: center; padding: 8px 16px; font-size: 0.9rem; display: flex; gap: 12px; justify-content: center; align-items: center; flex-wrap: wrap; }
.banner[hidden] { display: none; }
.foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 0.8rem; padding-top: 24px; padding-bottom: 32px; }
.loading { padding: 60px 0; text-align: center; color: var(--muted); }

/* Estructura */
.view { display: flex; flex-direction: column; gap: 18px; padding: 20px 0 8px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.span-2 { grid-column: 1 / -1; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card.flush { padding: 0; gap: 0; }
.card-h { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.card-h .link { margin-left: auto; font-size: 0.88rem; font-weight: 600; }
.pad { padding: 14px 18px; }
p.pad { padding: 10px 18px 14px; margin: 0; }
.row-gap { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row-gap.end { justify-content: flex-end; grid-column: 1 / -1; }
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.toolbar > p { max-width: 70ch; }
.seg { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.mes-title { font-family: var(--font-display); font-weight: 800; min-width: 150px; text-align: center; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.kpis.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kpi .big { font: 800 1.45rem/1.15 var(--font-display); margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi .sub { margin: 0; font-size: 0.8rem; color: var(--muted); }
.kpi.alert { border-color: var(--crit); box-shadow: inset 4px 0 0 var(--crit); }

/* Botones y controles */
.btn { font: 600 0.9rem var(--font-body); border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 7px 13px; border-radius: 8px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; line-height: 1.2; }
.btn:hover { border-color: var(--ink-2); }
.btn:disabled { opacity: 0.5; cursor: progress; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: var(--brand-2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.danger { color: var(--crit); border-color: var(--crit); background: transparent; }
.btn.danger.ghost { border-color: transparent; }
.btn.sm { padding: 4px 9px; font-size: 0.82rem; }
.file-btn { position: relative; }
.icon-btn { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 4px 6px; border-radius: 6px; font-size: 0.9rem; }
.icon-btn:hover { background: var(--surface-2); color: var(--crit); }
.link { background: none; border: 0; color: var(--brand); cursor: pointer; padding: 0; font: inherit; text-decoration: underline; }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); border-radius: 999px; padding: 5px 12px; font: 600 0.86rem var(--font-body); cursor: pointer; }
.chip b { font-weight: 700; color: var(--muted); margin-left: 2px; }
.chip.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.chip.on b { color: inherit; opacity: 0.7; }
input, select, textarea { font: 0.95rem var(--font-body); color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; min-width: 0; width: 100%; }
input:focus, select:focus { border-color: var(--brand); outline: 2px solid color-mix(in srgb, var(--brand) 25%, transparent); outline-offset: 0; }
input.num { text-align: right; }
input.w-sm { width: 90px; }
input.w-md { width: 130px; }
textarea { resize: vertical; line-height: 1.45; font-size: 0.9rem; }
a.btn.disabled { opacity: 0.45; pointer-events: none; }
.toolbar select, .toolbar input[type="search"] { width: auto; min-width: 200px; }
label.inline { display: inline-flex; align-items: center; gap: 6px; font-size: 0.86rem; color: var(--ink-2); flex-wrap: wrap; }
label.inline input { width: auto; padding: 5px 8px; }
.check { display: inline-flex; gap: 8px; align-items: center; font-size: 0.9rem; color: var(--ink-2); cursor: pointer; }
.check input { width: auto; accent-color: var(--brand); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid.one { grid-template-columns: 1fr; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 0.84rem; color: var(--ink-2); font-weight: 600; }
.field small { font-weight: 400; }
.total-line { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: baseline; padding: 10px 12px; background: var(--surface-2); border-radius: 8px; border: 1px dashed var(--line); }
.total-line strong { font: 800 1.2rem var(--font-display); }
.note { margin: 0; padding: 8px 12px; border-radius: 8px; font-size: 0.86rem; }
.note.warn { background: var(--warn-bg); color: var(--warn); }
.note.ok { background: var(--ok-bg); color: var(--ok); }
.kpi.warnk { border-color: var(--warn); box-shadow: inset 4px 0 0 var(--warn); }

/* Píldoras de estado */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 0.76rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.crit { background: var(--crit-bg); color: var(--crit); }
.pill.info { background: var(--info-bg); color: var(--info); }
.pill.neutral { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.tag { display: inline-block; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; color: var(--ink-2); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 7px; vertical-align: 0; }

/* Tablas */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.tbl th { text-align: left; font-weight: 700; font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.tbl th.num { text-align: right; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl tfoot td { font-weight: 700; background: var(--surface-2); border-bottom: 0; }
.tbl.compact td { padding: 6px 12px; }
.tbl td.actions { white-space: nowrap; text-align: right; }
.tbl tr.click { cursor: pointer; }
.tbl tr.sel td { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); }
.tbl tr.row-err td { color: var(--crit); }
.pnl th[scope="row"] { text-transform: none; letter-spacing: 0; font-size: 0.9rem; color: var(--ink); background: var(--surface); position: sticky; left: 0; z-index: 1; min-width: 220px; border-right: 1px solid var(--line); }
.pnl tr.sub th[scope="row"] { font-weight: 400; color: var(--ink-2); padding-left: 22px; }
.pnl tr.sub td { color: var(--ink-2); }
.pnl tr.strong td, .pnl tr.strong th { font-weight: 700; }
.pnl tr.res td, .pnl tr.res th { background: var(--surface-2); }
.pnl tr.big td, .pnl tr.big th { font-size: 1rem; border-top: 2px solid var(--ink-2); }
.pnl tr.pct td { color: var(--muted); font-size: 0.84rem; }
.pnl td.tot, .pnl th.tot { border-left: 1px solid var(--line); font-weight: 700; }
.pnl th.proy, .pnl th small { text-transform: none; }
.pnl th.proy { color: var(--info); }

/* Listas */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.list li { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list li > div:first-child { min-width: 0; }
.list .r { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

/* Calendario */
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) clamp(280px, 28vw, 380px); gap: 16px; align-items: start; }
.cal { padding: 12px; }
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-head span { text-align: center; font-size: 0.74rem; font-weight: 700; text-transform: uppercase; color: var(--muted); padding: 4px 0; }
.cal-cell { min-height: 88px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 6px 7px; text-align: left; display: flex; flex-direction: column; gap: 2px; cursor: pointer; font: inherit; color: inherit; position: relative; overflow: hidden; }
.cal-cell.out { background: transparent; border-style: dashed; cursor: default; }
.cal-cell:hover:not(.out) { border-color: var(--ink-2); }
.cal-cell.sel { outline: 2px solid var(--ink); outline-offset: -1px; }
.cal-cell.today .cal-n { background: var(--accent); color: #16201a; border-radius: 999px; padding: 0 7px; }
.cal-n { font-weight: 700; font-size: 0.86rem; align-self: flex-start; }
.cal-total { font-weight: 700; font-size: 0.86rem; text-align: left; }
.cal-items { display: flex; flex-direction: column; font-size: 0.72rem; color: var(--ink-2); line-height: 1.25; }
.cal-items i { font-style: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-items i.more { color: var(--muted); }
.cal-cell.st-vencida { box-shadow: inset 0 4px 0 var(--crit); background: color-mix(in srgb, var(--crit-bg) 60%, var(--surface)); }
.cal-cell.st-proxima { box-shadow: inset 0 4px 0 var(--warn); }
.cal-cell.st-pendiente, .cal-cell.st-parcial { box-shadow: inset 0 4px 0 var(--info); }
.cal-cell.st-pagada { box-shadow: inset 0 4px 0 var(--ok); }
.cal-cell.st-avisar { box-shadow: inset 0 4px 0 var(--ok); }
.cal-paid { font-size: 0.76rem; font-weight: 700; color: var(--ok); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-paid.warn { color: var(--warn); }
.lg.st-avisar::before { background: var(--warn); height: 8px; border-radius: 50%; width: 8px; }
.legend-row { display: flex; gap: 16px; flex-wrap: wrap; padding: 10px 4px 2px; font-size: 0.8rem; color: var(--ink-2); }
.lg::before { content: ''; display: inline-block; width: 14px; height: 4px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.lg.st-vencida::before { background: var(--crit); } .lg.st-proxima::before { background: var(--warn); }
.lg.st-pendiente::before { background: var(--info); } .lg.st-pagada::before { background: var(--ok); }
.day-panel { position: sticky; top: 130px; max-height: calc(100vh - 150px); overflow: auto; }

/* Importación */
.drop { border: 2px dashed color-mix(in srgb, var(--brand) 45%, var(--line)); background: color-mix(in srgb, var(--brand) 5%, var(--surface)); border-radius: var(--r); padding: 18px 20px; display: flex; gap: 18px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.drop p { margin: 4px 0 0; color: var(--ink-2); max-width: 75ch; font-size: 0.92rem; }
.drop.over { border-color: var(--brand); background: color-mix(in srgb, var(--accent) 25%, var(--surface)); }

.subtabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.subtabs button { border: 0; background: none; font: 700 0.94rem var(--font-body); color: var(--ink-2); padding: 8px 14px 10px; border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap; }
.subtabs button.on { color: var(--ink); border-bottom-color: var(--accent); }
.cierre { align-items: start; }
.chart-box { position: relative; height: 280px; }
.empty { text-align: center; padding: 48px 20px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r); display: flex; flex-direction: column; gap: 10px; align-items: center; }
.empty p { color: var(--ink-2); max-width: 60ch; margin: 0; }
h3.mini { margin-top: 8px; }
.login { max-width: 380px; margin: 40px auto; }

/* Modal y avisos */
.modal-wrap { position: fixed; inset: 0; background: rgba(10, 16, 12, 0.5); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow: auto; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); display: flex; flex-direction: column; max-height: 88vh; }
.modal header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 8px; gap: 10px; }
.modal-body { padding: 8px 20px 12px; overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.modal footer .danger { margin-right: auto; }
.toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; max-width: min(420px, calc(100vw - 36px)); }
.toast { background: var(--ink); color: var(--surface); padding: 10px 14px; border-radius: 10px; font-size: 0.9rem; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2); border-left: 4px solid var(--brand); }
.toast.error { border-left-color: var(--crit); }
.toast.info { border-left-color: var(--s1); }

@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cal-layout { gap: 12px; }
}
@media (max-width: 760px) {
  .wrap, .top-in { padding-left: 16px; padding-right: 16px; }
  .grid-2, .form-grid { grid-template-columns: 1fr; }
  .kpis, .kpis.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .operador { display: none; }
  .cal-cell { min-height: 60px; padding: 4px; }
  .cal-items { display: none; }
  .cal-total { font-size: 0.72rem; }
  .top { position: static; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.pnl tr.sep th { background: var(--surface-2); color: var(--muted); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.04em; padding-top: 14px; position: static; border-right: 0; }
.sm-select { display: block; margin-top: 4px; font-size: 0.78rem; padding: 3px 6px; max-width: 260px; }

/* Resumen del periodo y vista semanal del calendario */
.period-sum { display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: baseline; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 16px; font-size: 0.9rem; color: var(--ink-2); }
.period-sum b { color: var(--ink); }
.period-sum small { display: inline; }
.period-sum .neg b { color: var(--crit); }
.toolbar select#cal-mes, .toolbar select#cal-sem { min-width: 170px; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; padding: 10px; }
.week-day { display: flex; flex-direction: column; gap: 6px; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: var(--surface); min-height: 220px; }
.week-day.today { border-color: var(--ink); }
.week-day header { display: flex; align-items: baseline; gap: 6px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.week-day header span:first-child { font-size: 0.74rem; font-weight: 700; text-transform: uppercase; color: var(--muted); }
.week-day header b { font: 800 1.05rem var(--font-display); }
.week-day header b.hoy { background: var(--accent); color: #16201a; border-radius: 999px; padding: 0 7px; }
.week-day header .num { margin-left: auto; font-size: 0.82rem; }
.week-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.week-list li { display: flex; flex-direction: column; gap: 4px; padding: 6px 7px; border-radius: 6px; background: var(--surface-2); border-left: 3px solid var(--info); font-size: 0.82rem; }
.week-list li strong { font-size: 0.82rem; overflow-wrap: anywhere; }
.week-list li .r { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; justify-content: flex-start; }
.week-list li .pill { font-size: 0.7rem; }
.week-list li.st-vencida { border-left-color: var(--crit); }
.week-list li.st-proxima { border-left-color: var(--warn); }
.week-list li.st-pagada { border-left-color: var(--ok); opacity: 0.85; }
.week-list li.st-avisar { border-left-color: var(--warn); }
@media (max-width: 1100px) { .week { grid-template-columns: repeat(2, minmax(0, 1fr)); } .week-day { min-height: 0; } }
@media (max-width: 560px) { .week { grid-template-columns: 1fr; } }

@media (max-width: 860px) {
  .cal-layout { grid-template-columns: 1fr; }
  .day-panel { position: static; max-height: none; }
}
.day-panel .list li { flex-wrap: wrap; }
.day-panel .list .r { justify-content: flex-start; }
.day-panel .hint { margin-top: -6px; }
.arrastrable { cursor: grab; }
.arrastrable:active { cursor: grabbing; }
.arrastrando [data-drop] { outline: 1px dashed var(--line); }
.drop-on { outline: 2px dashed var(--brand) !important; outline-offset: -2px; background: color-mix(in srgb, var(--accent) 25%, var(--surface)) !important; }
small.reprog { color: var(--info); }
.rp-atajos { margin-top: 6px; }

.cal-count i { font-weight: 600; color: var(--ink-2); }
.cal-count i.neg { color: var(--crit); }
.cal-count i.ok { color: var(--ok); font-weight: 600; }

/* Facturas del mismo proveedor en el mismo día */
.list li.grupo, .week-list li.grupo { display: flex; flex-direction: column; align-items: stretch; gap: 6px; }
.list li.grupo { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin: 6px 0; }
.grupo-h { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: center; }
.grupo-h .r { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.grupo-det { list-style: none; margin: 0; padding: 0 0 0 10px; border-left: 2px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.grupo-det li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; align-items: center; padding: 4px 0; border-bottom: 1px dashed var(--line); font-size: 0.86rem; background: none !important; border-left: 0 !important; }
.grupo-det li:last-child { border-bottom: 0; }
.grupo-det .acc { grid-column: 1 / -1; display: flex; gap: 4px; }
.grupo-det .acc .btn { padding: 2px 7px; font-size: 0.76rem; }
.grupo-det .pill { grid-column: 2; justify-self: end; }

/* Plazo editable en la tabla de proveedores */
td.plazo { white-space: nowrap; }
.plazo-in { display: inline-flex; align-items: baseline; gap: 6px; }
.plazo-in input { width: 64px; text-align: right; font: 800 1.05rem var(--font-display); padding: 3px 6px; font-variant-numeric: tabular-nums; }
.plazo-in span { font-weight: 600; color: var(--ink-2); font-size: 0.86rem; }

/* Valores completos en las celdas del calendario */
.cal-total { font-size: clamp(0.72rem, 0.95vw, 0.9rem); letter-spacing: -0.01em; white-space: nowrap; }
.cal-paid { font-size: clamp(0.66rem, 0.82vw, 0.76rem); }
.week-day header { flex-wrap: wrap; }
.week-day header .num { font-size: clamp(0.7rem, 0.85vw, 0.82rem); }
.cal-paid { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; line-height: 1.2; }
.cal-count i { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.2; }
.cal-cell { min-height: 92px; }
.cal-paid { text-align: left; }
.cal-paid em { display: block; font-style: normal; font-weight: 600; font-size: 0.7rem; }

fieldset.opciones { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; margin: 0; }
fieldset.opciones legend { font-weight: 700; font-size: 0.86rem; padding: 0 4px; }
fieldset.opciones input[type="date"] { width: auto; padding: 3px 6px; margin-left: 4px; }
.plazo-nuevo { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 0.8rem; font-weight: 600; color: var(--ink-2); flex-wrap: wrap; }
.plazo-nuevo input { width: 64px; padding: 3px 6px; text-align: right; }
.plazo-nuevo small { display: inline; font-weight: 400; }

small.nc { color: var(--ok); }
.favor { color: var(--info); font-weight: 700; }



/* Día totalmente pagado y festivos */
.cal-cell.todo-pagado { background: color-mix(in srgb, var(--ok-bg) 85%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); box-shadow: inset 0 4px 0 var(--ok); }
.cal-cell.todo-pagado .cal-paid { color: var(--ok); }
.cal-cell.festivo .cal-n::after { content: ' · festivo'; font-weight: 600; font-size: 0.68rem; color: var(--muted); }
/* Selección para el archivo de pago */
.lote-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; padding: 8px 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; }
.sel-pago { width: auto; accent-color: var(--brand); margin: 3px 8px 0 0; flex: none; align-self: flex-start; }
.list li > .sel-pago { order: -1; }
.grupo-h { align-items: flex-start; }
.grupo-det li { grid-template-columns: auto minmax(0, 1fr) auto; }
.grupo-det li .sel-pago.sub { grid-row: span 2; }
.grupo-det .acc { grid-column: 2 / -1; }
.list li > .sel-pago + div, .grupo-h > .sel-pago + div { flex: 1; min-width: 0; text-align: left; }
.day-panel .list li:has(> .sel-pago) { justify-content: flex-start; }

/* Filtro por proveedor del calendario */
.prov-filtro select { max-width: 320px; }
.prov-filtro select.on { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); font-weight: 600; }

/* Reporte de pagos por lote */
.rep-lista { display: grid; gap: 12px; max-height: 60vh; overflow: auto; padding-right: 4px; }
.rep-pago { border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: grid; gap: 8px; }
.rep-pago header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.rep-pago header .num { margin-left: auto; }
.rep-pago textarea { width: 100%; font: inherit; font-size: 13px; }
.rep-pago .row-gap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rep-pago .row-gap .check { margin-left: auto; }

/* ---------- Pantalla de acceso ---------- */
body.sin-sesion > header.top, body.sin-sesion > #banner, body.sin-sesion > main#main, body.sin-sesion > footer.foot { display: none !important; }
.acceso { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(320px, 46%) 1fr; background: var(--bg); }
.acc-marca {
  position: relative; overflow: hidden; color: #fff; padding: clamp(32px, 6vw, 72px);
  display: flex; flex-direction: column; justify-content: center; gap: 28px;
  background: radial-gradient(120% 90% at 0% 0%, #2aa04d 0%, #1f8a3e 38%, #13612a 100%);
}
.acc-marca::after { /* trama sutil */
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .08;
  background-image: radial-gradient(#fff 1px, transparent 1.4px); background-size: 18px 18px;
}
.acc-franja { position: absolute; left: 0; right: 0; top: 0; height: 8px; background: var(--accent); }
.acc-logo { width: min(240px, 60%); height: auto; filter: drop-shadow(0 6px 18px rgba(0,0,0,.25)); position: relative; z-index: 1; }
.acc-marca h1 { position: relative; z-index: 1; margin: 0; font-family: var(--font-display); font-weight: 800; font-size: clamp(30px, 3.4vw, 46px); line-height: 1.02; letter-spacing: -.01em; }
.acc-marca h1 span { color: var(--accent); font-style: italic; }
.acc-puntos { position: relative; z-index: 1; list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; max-width: 440px; }
.acc-puntos li { position: relative; padding-left: 30px; font-size: 16px; line-height: 1.4; color: rgba(255,255,255,.88); }
.acc-puntos li::before { content: ''; position: absolute; left: 0; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2313612a' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center/12px no-repeat; }
.acc-puntos b { color: #fff; font-weight: 700; }

.acc-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 24px; gap: 28px; }
.acc-caja { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: clamp(24px, 4vw, 40px); box-shadow: 0 1px 2px rgba(16,32,20,.04), 0 12px 40px -12px rgba(16,32,20,.18); animation: acc-in .35s ease-out both; }
@keyframes acc-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .acc-caja { animation: none; } }
.acc-caja h2 { margin: 0 0 6px; font-family: var(--font-display); font-size: 26px; font-weight: 800; color: var(--ink); }
.acc-sub { margin: 0 0 24px; color: var(--ink-2); font-size: 15px; line-height: 1.45; }
.acc-caja form { display: grid; gap: 16px; }
.acc-field { display: grid; gap: 6px; }
.acc-field > span { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.acc-field input { width: 100%; height: 48px; padding: 0 14px; font: inherit; font-size: 16px; color: var(--ink); background: var(--surface); border: 1.5px solid var(--line); border-radius: 10px; transition: border-color .15s, box-shadow .15s; }
.acc-field input::placeholder { color: var(--muted); }
.acc-field input:hover { border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); }
.acc-field input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
.acc-pass { position: relative; }
.acc-pass input { padding-right: 48px; }
.acc-ojo { position: absolute; right: 4px; top: 4px; width: 40px; height: 40px; display: grid; place-items: center; border: 0; background: none; border-radius: 8px; color: var(--muted); cursor: pointer; }
.acc-ojo:hover { color: var(--ink); background: var(--surface-2); }
.acc-ojo:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.acc-ojo svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.acc-err { min-height: 0; color: var(--crit); font-size: 14px; font-weight: 600; }
.acc-err:empty { display: none; }
.acc-err:not(:empty) { background: var(--crit-bg); padding: 10px 12px; border-radius: 8px; }
.acc-btn { position: relative; height: 50px; width: 100%; border: 0; border-radius: 10px; background: var(--brand); color: var(--brand-ink); font: inherit; font-size: 16px; font-weight: 700; cursor: pointer; transition: background .15s, transform .05s; }
.acc-btn:hover { background: var(--brand-2); }
.acc-btn:active { transform: translateY(1px); }
.acc-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.acc-btn.sec { background: var(--surface-2); color: var(--ink); border: 1.5px solid var(--line); margin-top: 8px; }
.acc-btn.cargando span { visibility: hidden; }
.acc-btn.cargando::after { content: ''; position: absolute; inset: 0; margin: auto; width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: acc-gira .7s linear infinite; }
@keyframes acc-gira { to { transform: rotate(360deg); } }
.acc-link { display: block; margin: 18px auto 0; border: 0; background: none; color: var(--brand); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; padding: 6px 8px; border-radius: 6px; }
.acc-link:hover { text-decoration: underline; }
.acc-ok { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--ok-bg); color: var(--ok); font-size: 26px; font-weight: 800; margin-bottom: 14px; }
.acc-pie { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.acc-pie strong { color: var(--ink-2); }
.acc-pie .logo-oscuro { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .acc-pie .logo-claro { display: none; } :root:not([data-theme="light"]) .acc-pie .logo-oscuro { display: block; } }

@media (max-width: 820px) {
  .acceso { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .acc-marca { padding: 36px 24px 28px; gap: 14px; align-items: flex-start; }
  .acc-logo { width: 150px; }
  .acc-marca h1 { font-size: 26px; }
  .acc-puntos { display: none; }
  .acc-panel { justify-content: flex-start; padding-top: 28px; }
}
