
/* Layout: menú lateral oscuro (colapsable) + área de trabajo clara de ancho fluido. Una sola familia (Inter, cifras tabulares),
   neutros slate de Truffa, un acento azul y colores de estado reservados para estado. Solo tema claro a propósito (herramienta interna). */
:root {
  color-scheme: light;
  /* Arena y petróleo: neutros cálidos (arena), un solo acento petróleo; verde, ámbar y terracota solo para estado */
  --ink: #1f1b16; --ink-2: #3d362d; --muted: #6b645a; --faint: #a39a8c; --line: #ebe5dc; --line-2: #f3eee7;
  --bg: #faf8f5; --card: #ffffff; --hover: #fbf9f6;
  --accent: #0e5e6f; --accent-soft: #e6f0f2; --accent-ink: #0b4d5b;
  --ok: #2f7d4f; --ok-soft: #eaf4ec; --ok-ink: #24603c; --ok-light: #a8d5b5;
  --warn: #b7791f; --warn-soft: #fbf1de; --warn-ink: #8c5a07; --warn-bar: #d89b3a;
  --bad: #b4432c; --bad-soft: #fbebe7; --bad-ink: #a83a24;
  --neutral-bar: #d9d1c4;
  --side: #ffffff; --side-2: #f3eee7; --side-ink: #6b645a;
  --sans: "Inter", -apple-system, "Segoe UI", system-ui, sans-serif;
  --r: 10px;
}
* { box-sizing: border-box }
[hidden] { display: none !important }
html, body { height: 100% }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 var(--sans); font-feature-settings: "tnum" 1, "cv11" 1; -webkit-font-smoothing: antialiased }
.ms { font-family: "Material Symbols Outlined"; font-weight: 300; font-size: 20px; line-height: 1; vertical-align: middle; font-style: normal; user-select: none }
button { font: inherit; color: inherit }
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100% }
.app.collapsed { grid-template-columns: 68px minmax(0, 1fr) }
aside { background: var(--side); color: var(--side-ink); border-right: 1px solid var(--line); padding: 16px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 2px; overflow-y: auto }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 0 18px; color: var(--ink); font-weight: 600; font-size: 15px }
.brand .logo { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; flex: none }
.sidetoggle { width: 40px; height: 36px; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; flex: none }
.sidetoggle:hover { background: var(--side-2); color: var(--ink) }
.collapsed .brand { justify-content: center } .collapsed .brand .logo { display: none }
.mod-h { padding: 14px 10px 6px; font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--faint) }
.nav { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 8px; color: var(--side-ink); text-decoration: none; white-space: nowrap }
.nav:hover { background: var(--side-2); color: var(--ink) }
.nav.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 500 }
.nav.on .ms { color: var(--accent) }
.nav .cnt { margin-left: auto; font-size: 11px; font-weight: 600; background: var(--bad); color: #fff; border-radius: 10px; padding: 1px 7px }
.side-foot { margin-top: auto; padding: 10px; font-size: 12px; color: var(--faint) }
.collapsed .nav span:not(.ms), .collapsed .brand > span, .collapsed .side-foot, .collapsed .mod-h { display: none }
.collapsed .nav { justify-content: center } .collapsed .mod-h + a { margin-top: 10px }
main { min-width: 0; padding-block: 20px 56px; padding-left: max(28px, env(safe-area-inset-left, 0px)); padding-right: max(28px, env(safe-area-inset-right, 0px)) }
.wrap { max-width: 1480px; margin: 0 auto }
.top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 22px }
.iconbtn { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); display: grid; place-items: center; cursor: pointer; color: var(--ink-2) }
.iconbtn:hover { border-color: var(--faint) }
.crumb { font-size: 12px; color: var(--muted) }
h1 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -.015em }
.grow { flex: 1 }
.ctl { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink-2); font-size: 13px; cursor: pointer; white-space: nowrap }
.ctl:hover { border-color: var(--faint) }
.ctl .ms { font-size: 18px; color: var(--muted) }
.src { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px }
.src i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); display: inline-block }
.src.dev i { background: var(--warn) }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px }

/* tarjetas y secciones */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r) }
.sec { margin-top: 28px }
.sec-h { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap }
.sec-h h2 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -.005em }
.sec-h .meta { font-size: 12px; color: var(--muted) }
.info { position: relative; display: inline-grid; place-items: center; width: 18px; height: 18px; color: var(--faint); cursor: help }
.info .ms { font-size: 17px }
.info:hover { color: var(--muted) }
.info:hover::after, .info:focus::after { content: attr(data-tip); position: absolute; z-index: 30; top: 24px; left: -10px; width: 300px; padding: 10px 12px; border-radius: 8px; background: var(--ink); color: #faf8f5; font-size: 12px; line-height: 1.5; font-weight: 400; text-transform: none; letter-spacing: 0; white-space: normal; text-align: left }
.info.right:hover::after, .info.right:focus::after { left: auto; right: -10px }
.cols2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px }
@media (max-width: 1100px) { .cols2 { grid-template-columns: minmax(0, 1fr) } }

/* tarjetas de resumen */
.sum { padding: 20px 22px }
.sum .lbl { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px }
.sum .big { font-size: 34px; font-weight: 600; letter-spacing: -.025em; line-height: 1.15; margin-top: 4px }
.sum .big small { font-size: 15px; font-weight: 400; color: var(--muted); letter-spacing: 0; margin-left: 6px }
.sum .sub { font-size: 13px; color: var(--muted); margin-top: 2px }
.sum .sub b { color: var(--ink-2); font-weight: 600 }
.sum .bigbar { height: 8px; border-radius: 4px; background: var(--line-2); margin: 12px 0 4px; overflow: hidden }
.sum .bigbar span { display: block; height: 100% }
.sum .q { margin: 18px 0 4px; font-size: 13px; font-weight: 600; color: var(--ink-2) }
.why-r { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 10px; align-items: baseline; padding: 9px 0; border-top: 1px solid var(--line-2) }
.why-r .sw { width: 10px; height: 10px; border-radius: 3px; transform: translateY(1px) }
.why-r .t { font-weight: 500; color: var(--ink) }
.why-r .s { font-size: 12px; color: var(--muted) }
.why-r .n { font-weight: 600; font-size: 17px; text-align: right }
.why-r.k { padding-left: 22px } .why-r.k .t { font-weight: 400; color: var(--ink-2) } .why-r.k .n { font-size: 14px; color: var(--muted); font-weight: 500 }

/* tablas */
.tbl-tools { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line) }
.search { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); min-width: 240px; color: var(--muted) }
.search input { border: 0; outline: 0; font: inherit; color: var(--ink); width: 100%; background: transparent }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft) }
.tw { overflow-x: auto }
table { width: 100%; border-collapse: collapse; font-size: 13px }
thead th { position: sticky; top: 0; background: var(--card); z-index: 2 }
th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: bottom }
th .thl { display: inline-flex; align-items: center; gap: 4px }
th.sortable { cursor: pointer } th.sortable:hover { color: var(--ink-2) }
th .arrow { font-size: 16px; color: var(--faint) } th.sorted .arrow { color: var(--accent) }
th.grp { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); padding-top: 12px; padding-bottom: 6px; border-bottom: 0 }
th .thsub { display: block; font-weight: 400; color: var(--faint); font-size: 11px }
td { padding: 11px 14px; border-top: 1px solid var(--line-2); vertical-align: middle }
tbody tr:hover td { background: var(--hover) }
.r { text-align: right } th.r .thl { justify-content: flex-end }
.sep { border-left: 1px solid var(--line) }
.strong { font-weight: 500; color: var(--ink) }
.dim { color: var(--faint) }
.cellsub { display: block; font-size: 12px; color: var(--muted); margin-top: 1px }
.mcell { min-width: 170px; max-width: 260px }
.mcell .mt { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 6px }
.mcell .mt b { font-weight: 600; color: var(--ink) }
.mcell .mt span { font-size: 12px; color: var(--muted) }
.track { height: 6px; border-radius: 3px; background: var(--line-2); overflow: hidden }
.track span { display: block; height: 100%; border-radius: 3px }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted) }
.pager .btns { display: flex; gap: 6px }
.pg { height: 30px; min-width: 30px; padding: 0 8px; border: 1px solid var(--line); background: var(--card); border-radius: 7px; cursor: pointer; display: inline-grid; place-items: center }
.pg:hover:not([disabled]) { border-color: var(--faint) } .pg[disabled] { color: var(--line); cursor: default }
.empty { padding: 28px; text-align: center; color: var(--muted) }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap }
.c-bad { background: var(--bad-soft); color: var(--bad-ink) } .c-warn { background: var(--warn-soft); color: var(--warn-ink) }
.c-ok { background: var(--ok-soft); color: var(--ok-ink) } .c-ink { background: var(--ink); color: #fff } .c-acc { background: var(--accent-soft); color: var(--accent-ink) }
.c-mute { background: var(--line-2); color: var(--muted) }
.seg3 { display: flex; height: 10px; border-radius: 5px; overflow: hidden; gap: 2px; min-width: 180px }
.seg3 i { display: block; height: 100% }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--muted) }
.legend span { display: inline-flex; align-items: center; gap: 6px }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block }
.legend i.line { height: 3px; border-radius: 2px; width: 14px }

/* gráficas */
.chart { padding: 16px 18px }
.chart .legend { margin-bottom: 10px }
.chart svg { display: block; width: 100%; height: auto; overflow: visible }
.ax { font: 11px var(--sans); fill: var(--muted) }
.gridl { stroke: var(--line-2) }
.heat-wrap { max-height: 560px; overflow: auto; border-top: 1px solid var(--line) }
.heat { display: grid; font-size: 12px }
.heat .hd { position: sticky; top: 0; background: var(--card); z-index: 2; color: var(--muted); font-size: 12px; text-align: center; padding: 10px 0 8px; border-bottom: 1px solid var(--line) }
.heat .nm { position: sticky; left: 0; background: var(--card); z-index: 1; padding: 0 14px; display: flex; align-items: center; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.heat .cell { margin: 2px; height: 30px; border-radius: 6px; display: grid; place-items: center; font-weight: 500; font-size: 11px }
.heat .cell.na { background: transparent; border: 1px dashed var(--line) }
.heat-legend { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); padding: 12px 14px 0 }
.heat-legend .ramp { width: 140px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, #f3eee7, #2f7d4f) }
.tooltip { position: fixed; z-index: 50; pointer-events: none; background: var(--ink); color: #faf8f5; font-size: 12px; line-height: 1.5; padding: 8px 10px; border-radius: 8px; max-width: 280px; white-space: pre-line }

/* alertas */
.banner { display: flex; align-items: center; gap: 14px; padding: 16px 20px; border-radius: var(--r); background: var(--bad-soft); color: var(--bad-ink); border: 1px solid #f3cfc6 }
.banner .big { font-size: 22px; font-weight: 600 }
.ah { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line) }
.ah .ic { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center }
.ah .t { font-size: 15px; font-weight: 600 } .ah .s { font-size: 13px; color: var(--muted) }
.ah .tot { text-align: right } .ah .tot b { display: block; font-size: 20px; font-weight: 600 } .ah .tot span { font-size: 12px; color: var(--muted) }
details.acc { border-top: 1px solid var(--line-2) } details.acc:first-of-type { border-top: 0 }
details.acc summary { list-style: none; cursor: pointer } details.acc summary::-webkit-details-marker { display: none }
.arow { display: grid; grid-template-columns: 22px minmax(0, 2.4fr) minmax(0, 1.6fr) 150px 120px; gap: 12px; align-items: center; padding: 11px 18px; font-size: 13px }
.arow.h { font-size: 12px; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--line) }
details.acc summary:hover .arow { background: var(--hover) }
.arow .car { color: var(--faint); transition: transform .15s; font-size: 18px }
details.acc[open] .car { transform: rotate(90deg) }
.arow.k { background: var(--bg); border-top: 1px solid var(--line-2); padding-left: 52px; grid-template-columns: minmax(0, 2.4fr) minmax(0, 1.6fr) 150px 120px }
.chips { display: flex; gap: 6px; flex-wrap: wrap }
.ellip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap }

/* metas / solicitudes */
.seg { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--line-2); gap: 2px }
.seg button { border: 0; background: none; height: 30px; padding: 0 14px; border-radius: 7px; font-size: 13px; color: var(--muted); cursor: pointer }
.seg button.on { background: var(--card); color: var(--ink); font-weight: 500; box-shadow: 0 1px 2px rgba(31, 27, 22, .10) }
.btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); font-size: 13px; cursor: pointer; color: var(--ink-2) }
.btn:hover { border-color: var(--faint) } .btn .ms { font-size: 18px }
.btn.pri { background: var(--accent); border-color: var(--accent); color: #fff } .btn.pri:hover { background: var(--accent-ink) }
input.money { width: 140px; height: 32px; text-align: right; border: 1px solid var(--line); border-radius: 7px; padding: 0 10px; font: inherit; color: var(--ink); background: var(--card) }
input.money:hover { border-color: var(--faint) } input.money:focus { border-color: var(--accent); outline: 0; box-shadow: 0 0 0 3px var(--accent-soft) }
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px }
.kpi { padding: 16px 18px } .kpi .v { font-size: 26px; font-weight: 600; letter-spacing: -.02em } .kpi .l { font-size: 13px; color: var(--muted) }
.note { font-size: 12px; color: var(--muted) }
.switch { width: 36px; height: 20px; border-radius: 20px; background: var(--neutral-bar); position: relative; border: 0; cursor: pointer; vertical-align: middle }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s }
.switch.on { background: var(--ok) } .switch.on::after { left: 18px }
.people { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 18px }
.person { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px 0 4px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px }
.person b { width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); font-size: 10px; font-weight: 600; display: grid; place-items: center }
.atiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-top: 16px }
@media (max-width: 1280px) { .atiles { grid-template-columns: repeat(2, minmax(0, 1fr)) } }
.atile { text-align: left; padding: 16px 18px; cursor: pointer; display: flex; flex-direction: column; gap: 10px; font: inherit; color: inherit }
.atile:hover { border-color: var(--faint) } .atile.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft) }
.at-h { display: flex; align-items: center; gap: 10px; min-height: 40px } .at-h .ic { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; flex: none }
.at-t { font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 4px }
.at-n b { font-size: 28px; font-weight: 600; letter-spacing: -.02em } .at-n span { color: var(--muted) } .at-n em { font-style: normal; display: block; color: var(--bad-ink); font-weight: 500; font-size: 13px }
.at-top { border-top: 1px solid var(--line-2); padding-top: 8px; display: grid; gap: 6px; font-size: 12px }
.at-top > div { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; color: var(--ink-2) }
.at-more { margin-top: auto; color: var(--accent-ink); font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 2px }
.at-more .ms { font-size: 18px }
.crumbs { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; font-size: 14px }
.crumbs button { border: 0; background: none; padding: 4px 6px; border-radius: 6px; cursor: pointer; color: var(--accent-ink); font-weight: 500 }
.crumbs button:last-child { color: var(--ink); cursor: default } .crumbs button:hover:not(:last-child) { background: var(--accent-soft) }
.crumbs .ms { font-size: 18px; color: var(--faint) }
tr.drill { cursor: pointer }
.pcols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; padding: 16px 18px }
.ph { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .05em }
.btn.more { height: 32px; font-size: 12px } .btn.more .ms { font-size: 17px }
.hotlist { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px }
.hl-h { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); margin-right: 4px; width: 100%; margin-bottom: 2px }
.hl-h .sw, .lbl .sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block }
.fgrid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(220px, 1fr); gap: 16px }
.fstep { display: grid; grid-template-columns: 190px minmax(0, 1fr) 170px; gap: 14px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line-2) }
.fstep:first-child { border-top: 0 }
.fl { font-weight: 500 } .fb { height: 22px; background: var(--line-2); border-radius: 6px; overflow: hidden } .fb span { display: block; height: 100%; border-radius: 6px }
.fv b { font-size: 18px; font-weight: 600 } .fv span { display: block; font-size: 12px; color: var(--muted) }
.fside .lbl { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px } .fside .big { font-size: 26px; font-weight: 600; letter-spacing: -.02em } .fside .sub { font-size: 12px; color: var(--muted) }
@media (prefers-reduced-motion: reduce) { * { transition: none !important } }

/* acceso y formularios de la app */
.login { min-height: 100vh; display: grid; place-items: center; background: var(--bg) }
.login form { width: 340px; padding: 28px; display: flex; flex-direction: column; gap: 14px }
.login h2 { margin: 0; font-size: 18px; font-weight: 600 } .login p { margin: 0; color: var(--muted); font-size: 13px }
.login input { height: 40px; border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; font: inherit }
.login input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft) }
.err { color: var(--bad-ink); font-size: 13px }
.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap }
.filters input[type=date], .filters select { height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; font: inherit; color: var(--ink-2); background: var(--card) }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 60; background: var(--ink); color: #faf8f5; padding: 10px 14px; border-radius: 8px; font-size: 13px }
.chip.pick { cursor: pointer; border: 1px solid transparent } .chip.pick.off { background: var(--card); color: var(--muted); border-color: var(--line) }
.loading-bar { height: 2px; background: linear-gradient(90deg, transparent, var(--accent), transparent); background-size: 200% 100%; animation: lb 1.2s linear infinite; border-radius: 2px }
@keyframes lb { from { background-position: 200% 0 } to { background-position: -200% 0 } }
