:root {
  --red:#1569a9; --red2:#0e568e; --ink:#14243a; --muted:#53677e;
  --bg:#f1f5fa; --line:#e0e9f3; --shadow:0 8px 22px #173b6512;
  --blue:#0f4d83; --azure:#1684cf; --green:#067455;
}
body { font-family:"Segoe UI",system-ui,sans-serif; color:var(--ink); background:var(--bg); }
.sidebar { background:linear-gradient(165deg,#10365c 0%,#13548d 58%,#146399 100%) !important; box-shadow:5px 0 18px #12335418; }
.sidebar .brand { background:#fff1; border:1px solid #ffffff24; border-radius:12px; }
.sidebar .tab { border-radius:8px; color:#e9f6ff; }
.sidebar .tab.active { background:#237ec0 !important; color:#fff !important; }
.sidebar .tab:hover { background:#ffffff21; }
.sidefoot { color:#e1f1ff; }
.top { background:#fff; border-bottom:1px solid var(--line); }
.top .eyebrow { color:#12598d; }
.app main { background:var(--bg); max-width:1700px; margin:auto; }
button, input, select { font:inherit; }
button { cursor:pointer; }
[hidden] { display:none !important; }
.primary { background:#1269aa !important; border-color:#1269aa !important; color:#fff !important; }
.primary:hover { background:#0c5289 !important; }
.secondary { color:#164871 !important; border-color:#d8e5ef !important; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible { outline:3px solid #2397df; outline-offset:2px; }
article,.card,.invoiceStat,.invoiceFilters,.kpi { box-shadow:var(--shadow) !important; border-color:var(--line) !important; }
.view article { border-radius:14px; }
.executiveBanner { display:block!important; min-height:0!important; margin-bottom:20px!important; padding:22px!important; border-radius:17px!important;
  color:#fff; background:radial-gradient(ellipse at 105% -30%,#3b9fda 0%,transparent 64%),linear-gradient(114deg,#164773,#1266a1 69%,#13517e)!important; }
.bannerTop { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin-bottom:16px; }
.bannerTop h2 { margin:3px 0 6px; font-size:clamp(24px,3vw,36px); }
.bannerTop p { margin:0; color:#def3ff; }
.bannerTop button { align-self:flex-start; border:1px solid #ffffff57; background:#ffffff13; color:#fff; border-radius:8px; padding:8px 13px; }
.bannerEyebrow { color:#deefff!important; }
.overviewKpis { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; }
.overviewCard { text-align:left; display:flex; flex-direction:column; gap:6px; border:1px solid #ffffff34; background:#ffffff17; color:#fff; border-radius:12px; padding:12px 14px; min-width:0; }
.overviewCard:hover { background:#ffffff30; }
.overviewCard > span:nth-child(2) { color:#ecf6ff; font-weight:600; }
.overviewCard strong { font-size:clamp(17px,2.4vw,27px); white-space:nowrap; letter-spacing:-.02em; }
.overviewCard small { text-transform:none; letter-spacing:0; color:#e2f0ff; font-weight:400; }
.overviewIcon { display:grid; place-items:center; width:27px; height:27px; border-radius:7px; background:#ffffff25; font-weight:750; }
.dashboardGrid { display:grid; grid-template-columns:minmax(0,1.35fr) minmax(0,1fr); gap:18px; }
.dashboardGrid article { padding:17px 18px; }
.dashboardGrid .head { align-items:center; gap:8px; }
.dashboardGrid .head h2 { margin:0; }
.cashBar { display:grid; grid-template-columns:minmax(76px,auto) 1fr minmax(85px,auto); align-items:center; gap:10px; padding:12px 0; font-size:13px; }
.cashBar strong { text-align:right; }
.barTrack { background:#edf3f9; height:13px; border-radius:20px; overflow:hidden; }
.barTrack div { height:100%; border-radius:20px; }
.barPositive { background:linear-gradient(90deg,#1175b8,#2e96d3); }
.barNegative { background:linear-gradient(90deg,#c44435,#e66d5d); }
.negative { color:#a92f28 !important; }
.alertHeading { margin:10px 0 4px; }
.dueShortcut { display:flex; width:100%; justify-content:space-between; align-items:center; text-align:left; gap:12px; padding:8px 0; background:none; border:0; color:var(--ink); }
.dueShortcut + .dueShortcut { border-top:1px solid #edf2fa; }
.dueShortcut small { display:block; color:var(--muted); letter-spacing:0; font-weight:400; margin-top:3px; }
.dueShortcut strong { white-space:nowrap; }
#calendarAction { margin-top:10px; }
.dashboardLinks { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:13px; margin-top:18px; }
.dashboardLinks button { display:flex; justify-content:flex-start; align-items:center; gap:9px; min-height:62px; text-align:left; padding:9px 12px; background:#fff; color:var(--ink); border:1px solid var(--line); border-radius:12px; box-shadow:var(--shadow); }
.dashboardLinks button span:last-child { margin-left:auto; color:#155b90; }
.quickIcon { display:grid; place-items:center; width:30px; height:30px; border-radius:8px; color:#16629c; background:#e7f3fb; flex-shrink:0; }
.dashboardLinks button:nth-child(2) .quickIcon { color:#6a34a2; background:#f2e9fe; }
.dashboardLinks button:nth-child(3) .quickIcon { color:#00705a; background:#e3f8f1; }
.dashboardLinks button:nth-child(4) .quickIcon { color:#8b5500; background:#fff1d8; }
.flag { display:inline-block; border-radius:7px; padding:4px 8px; font-size:12px; font-weight:650; background:#e5f2fc; color:#134f7a; }
.flag.warn { background:#fff0eb; color:#9e3324; }
.flag.good { background:#e6f6ee; color:#075d41; }
.projectionPanel { margin:0 0 15px; }
.projectionControls,.importControls { display:flex; align-items:flex-end; flex-wrap:wrap; gap:12px; }
.projectionControls label,.importControls label { margin:0; }
.metricCards { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; margin:14px 0; }
.metricCards .kpi { background:#f5f9fd; box-shadow:none!important; }
.metricCards .kpi strong { font-size:clamp(15px,2vw,23px); }
.importActions { margin-top:14px; justify-content:flex-end; }
.wideDialog { width:min(950px,96vw); }
.importRows { max-height:55vh; overflow:auto; }
#importType,#intakeAccount { min-width:180px; }
#legacyForecast { margin:18px 0; }
#legacyForecast summary { cursor:pointer; margin-bottom:10px; }
#invoices .invoiceWeekGroup td { background:#195981!important; border-top-color:var(--bg)!important; }
#invoices .invoiceStat::before { background:#2382b7!important; }
#invoices .invoiceMode button.active { background:#185987!important; color:#fff!important; }
#invoices .invoiceFilters { background:#fff!important; }
.thinFilters { display:flex; align-items:center; gap:8px; }
@media(max-width:1100px) {
  .overviewKpis,.dashboardLinks { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media(max-width:780px) {
  .dashboardGrid { grid-template-columns:1fr; }
  .metricCards { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .bankEdit { display:flex!important; flex-wrap:wrap; }
}
@media(max-width:430px) {
  .overviewKpis,.dashboardLinks { grid-template-columns:1fr; }
  .bannerTop { flex-wrap:wrap; }
}
#invoices .invoiceWeekGroup td { color:white; padding:13px 16px; border-top:10px solid var(--bg); }
#invoices .invoiceWeekGroup strong { font-size:15px; }
#invoices .invoiceWeekGroup small { display:block; color:#e3f1fc; margin-top:3px; }
#invoices .invoiceWeekGroup .weekSubtotal { text-align:right; font-weight:750; color:white; }
#invoices .invoiceWeekGroup+tr td { border-top:0; }
@media(max-width:760px) {
  .top { flex-wrap:wrap; }
  .top .actions { flex-wrap:wrap; }
  .sidebar nav { overflow:auto; scrollbar-width:thin; }
  .sidebar .tab span { display:inline; font-size:11px; }
  .sidebar .tab { white-space:nowrap; min-width:max-content; }
  .kpis.compact { grid-template-columns:repeat(2,minmax(0,1fr)); }
}

/* V50 · Identidad corporativa LOS PETOS y jerarquia visual */
:root{--red:#d71920;--red2:#a90f17;--ink:#1a2029;--muted:#68717e;--bg:#f3f5f8;--line:#e3e7ed;--blue:#272c35;--azure:#d71920;--shadow:0 9px 26px rgba(20,25,33,.055)}
body{color:var(--ink);background:var(--bg)}
.sidebar{background:linear-gradient(180deg,#171a20,#242833)!important;box-shadow:5px 0 22px #1118271c}
.sidebar .brand{background:#101217;border-color:#333944}
.sidebar .tab{color:#d4d7df}
.sidebar .tab.active{background:#d71920!important;color:#fff!important;border-color:#d71920!important}
.sidebar .tab:hover{background:#ffffff17}
.sidefoot{color:#adb2be}
.top .eyebrow{color:#d71920}
.primary{background:#d71920!important;border-color:#d71920!important}
.primary:hover{background:#aa1117!important}
.secondary{color:#303845!important;border-color:#dce1e7!important}
a:focus-visible,button:focus-visible,input:focus-visible,select:focus-visible{outline-color:#d71920}
.executiveBanner{background:radial-gradient(ellipse at 105% -30%,#d94b50 0%,transparent 58%),linear-gradient(115deg,#20242c,#343b47 73%,#641c25)!important}
.bannerTop p,.bannerEyebrow{color:#e6e8ee!important}
.overviewCard{transition:transform .18s ease,background .18s ease}
.overviewCard:hover{transform:translateY(-3px);background:#ffffff2a}
.barPositive{background:linear-gradient(90deg,#a8141c,#e53b42)}
.flag{background:#f5e8e9;color:#8e1720}
.dashboardLinks button span:last-child{color:#c31721}
.quickIcon{background:#fce9ea;color:#bf1720}
.dashboardLinks button:nth-child(2) .quickIcon{background:#f2f3f6;color:#363b45}
.dashboardLinks button:nth-child(3) .quickIcon{background:#e9f6f0;color:#086b4b}
.dashboardLinks button:nth-child(4) .quickIcon{background:#fff0e5;color:#9b4b14}
#invoices .invoiceWeekGroup td{background:#262b34!important;color:#fff!important;border-top:12px solid var(--bg)!important}
#invoices .invoiceWeekGroup small{color:#cfd5df}
#invoices .invoiceWeekGroup .weekSubtotal{color:#fff}
#invoices .invoiceStat::before{background:#d71920!important}
#invoices .invoiceMode button.active{background:#d71920!important;color:#fff!important}
.invoiceIntro{margin:0 0 12px;color:#66707d;font-size:13px}
#invoices .invoiceWeekGroup strong{font-size:16px}
#invoices .invoiceWeekGroup .weekSubtotal{font-size:16px}
#invoices tbody tr:not(.invoiceWeekGroup):hover{background:#fff5f5}
#invoices .invoiceFilters{border-radius:14px}
#invoices .invoiceStat{border-radius:14px}
@media(max-width:760px){#invoices .invoiceOverview{grid-template-columns:repeat(2,minmax(0,1fr))}}

/* V51: semanas plegables y detalle consultivo */
.invoiceWeekToggle{cursor:pointer;user-select:none}.invoiceWeekToggle:hover{filter:brightness(1.13)}.invoiceWeekToggle:focus-visible{outline:3px solid #ef4444;outline-offset:-3px}.weekChevron{display:inline-block;width:18px}.invoiceDetailLink{border:0;background:transparent;color:#a7131a;font:inherit;font-weight:750;text-decoration:underline;text-underline-offset:3px;cursor:pointer;padding:3px 0}.invoiceDetailLink:hover{color:#e51b23}.invoiceDetailContent{padding:24px}.invoiceDetailGrid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-top:18px}.invoiceDetailGrid>div{padding:12px;border:1px solid #e7e9ed;border-radius:12px;overflow-wrap:anywhere}.invoiceDetailGrid small{display:block;color:#737985;margin-bottom:5px}.invoiceDetailGrid strong{font-size:15px}@media(max-width:550px){.invoiceDetailGrid{grid-template-columns:1fr}}

/* V52: read-only financial overviews */
.legacyBar{display:grid;grid-template-columns:minmax(110px,1fr) minmax(70px,2fr) auto;align-items:center;gap:12px;margin:15px 0;font-size:13px}.legacyBar strong{white-space:nowrap}.legacyTrack{height:9px;background:#eff0f3;border-radius:20px;overflow:hidden}.legacyTrack i{display:block;height:100%;background:#dc1820;border-radius:20px}.supplierDetailLink{border:0;background:none;color:inherit;font:inherit;font-weight:700;cursor:pointer;text-align:left;text-decoration:underline;text-decoration-color:#c8cbd0;text-underline-offset:3px}.supplierDetailLink:hover{color:#d51620}#supplierDetailDialog{width:min(940px,95vw);max-height:90vh;border:0;border-radius:18px;padding:25px;box-shadow:0 30px 90px #0004}#supplierDetailDialog::backdrop{background:#0b1017a8}@media(max-width:780px){.legacyBar{grid-template-columns:1fr auto}.legacyTrack{grid-column:1/-1;grid-row:2}}

@media (min-width: 761px) {
  .sidebar { overflow-y: auto; scrollbar-width: thin; }
}
#dueReview { margin: 12px 0; padding: 12px; background: white; border-radius: 12px; }
#dueReview summary { cursor: pointer; font-weight: 700; }
#movements dialog select { width: 100%; }
