/* Tipografías propias (Archivo variable condensable + IBM Plex Mono): no dependen de internet */
@font-face { font-family: 'Archivo'; src: url('/fonts/archivo-wdth.woff2') format('woff2'); font-weight: 100 900; font-stretch: 62% 125%; font-style: normal; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('/fonts/plex-mono-400.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('/fonts/plex-mono-500.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
:root {
  /* OSO BACKOFFICE — paleta "Pacífico" */
  --paper: #0B1626;        /* fondo general */
  --surface: #12213A;      /* tarjetas, paneles, sidebar, modales */
  --surface2: #172946;     /* hover de filas, inputs activos */
  --ink: #EEF1F4;          /* texto principal ("papel") */
  --text2: #C3CEDB;
  --muted: #A3B1C2;
  --muted2: #7D8CA3;
  --faint: #4A5A70;
  --rule: #22334F;         /* bordes de 1 px */
  --rule-soft: #1B2B46;
  --line2: #2E4262;        /* bordes de inputs y botones */
  --teal: #7FB3D5;         /* acento "cielo" */
  --teal-dark: #A9CBE4;
  --teal-wash: rgba(127, 179, 213, .12);
  --accent-ink: #0B1626;   /* texto sobre el acento */
  --hielo: #CFE3F3;
  --danger: #E58A8A;
  --warn: #E6C17A;
  --ok: #7FC8A9;
  --reserved: rgba(207, 227, 243, .07);
  --head: 'Archivo', 'Arial Narrow', system-ui, sans-serif;
  --body: 'Archivo', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 15px/1.45 var(--body); }
h1, h2, h3 { font-family: var(--head); font-weight: 600; margin: 0; letter-spacing: .01em; }
h1 { font-size: 30px; line-height: 1.1; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
a { color: var(--teal); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.boot { padding: 40px; color: var(--muted); }
.muted { color: var(--muted); }
.r { text-align: right; }
.num, .r, td.money { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

/* Pantallas de acceso */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.gate-box { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--rule); }
.slate-band { height: 26px; background: repeating-linear-gradient(-45deg, var(--ink) 0 14px, #fff 14px 28px); border-bottom: 1px solid var(--ink); }
.gate-inner { padding: 28px 28px 30px; display: grid; gap: 16px; }
.gate-inner p { margin: 0; }

/* Estructura */
.layout { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100vh; align-items: start; }
.rail { background: var(--ink); color: #DCE4E8; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.rail .slate-band { height: 14px; border-bottom: 0; background: repeating-linear-gradient(-45deg, #fff 0 10px, var(--ink) 10px 20px); }
.brand { padding: 16px 20px 12px; display: block; text-decoration: none; }
.brand img { display: block; width: 100%; max-width: 150px; height: auto; }
.gate-logo { display: block; width: 170px; height: auto; margin: 0 auto 10px; }
.rail nav { display: grid; padding: 6px 0 12px; }
.rail a.nav, .rail span.nav { padding: 9px 20px; color: #DCE4E8; text-decoration: none; display: flex; justify-content: space-between; gap: 8px; border-left: 3px solid transparent; }
.rail a.nav:hover { background: rgba(255,255,255,.07); }
.rail a.nav[aria-current="page"] { border-left-color: #6FD0D4; background: rgba(255,255,255,.1); color: #fff; }
.rail span.nav { color: #7F909B; cursor: default; }
.rail .soon { font-size: 12px; color: #7F909B; }
.rail .who { margin-top: auto; padding: 14px 20px; border-top: 1px solid rgba(255,255,255,.14); font-size: 14px; }
.rail .who button { background: none; border: 0; color: #9FD7DA; padding: 4px 0; cursor: pointer; text-decoration: underline; margin-right: 12px; }
.main { padding: 26px 24px 60px; max-width: 1280px; width: 100%; }
.topline { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.topline .sub { color: var(--muted); margin-top: 4px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Controles */
.btn { border: 1px solid var(--ink); background: var(--surface); padding: 7px 14px; cursor: pointer; border-radius: 3px; font-weight: 500; text-decoration: none; display: inline-block; line-height: 1.3; }
.btn:hover { background: #F3F6F7; }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.primary:hover { background: var(--teal-dark); }
.btn.small { padding: 3px 9px; font-size: 13px; }
.btn.link { border: 0; background: none; padding: 3px 6px; color: var(--teal); text-decoration: underline; }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.danger.link { border: 0; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.field { display: grid; gap: 5px; margin-bottom: 14px; }
.field label, .field .lbl { font-weight: 600; font-size: 14px; }
.field small { color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=file], input[type=date], input[type=search], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #9DAAB3; background: #fff; border-radius: 3px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.error { color: var(--danger); font-weight: 500; min-height: 1.4em; }
.notice { border-left: 3px solid var(--teal); background: var(--teal-wash); padding: 10px 14px; margin: 0 0 18px; }
.notice.warn { border-left-color: var(--warn); background: #FBF1DF; }
.chip { display: inline-block; padding: 1px 8px; border-radius: 10px; background: var(--reserved); font-size: 12px; font-weight: 600; color: #4E3B73; }
.chip.on { background: var(--teal-wash); color: var(--teal-dark); }

/* Resumen */
.summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--rule); margin-bottom: 22px; }
.summary > div { padding: 14px 18px; border-left: 1px solid var(--rule); }
.summary > div:first-child { border-left: 0; }
.summary .k { color: var(--muted); font-size: 13px; }
.summary .v { font-family: var(--head); font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.15; }
.summary .d { font-size: 13px; color: var(--muted); }
.params { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; background: var(--surface); border: 1px solid var(--rule); padding: 12px 16px; margin-bottom: 22px; }
.params .field { margin: 0; min-width: 140px; }
.params .stat { min-width: 140px; }
.params .stat b { display: block; font-size: 18px; }

/* Tablas */
.tablewrap { background: var(--surface); border: 1px solid var(--rule); overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th { text-align: left; font-weight: 600; font-size: 13px; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--ink); white-space: nowrap; background: #F8F9FA; }
th.r { text-align: right; }
td { padding: 8px 12px; border-bottom: 1px solid var(--rule-soft); vertical-align: middle; }
td.money { text-align: right; white-space: nowrap; }
tr.chapter { cursor: pointer; }
tr.chapter:hover td { background: #F6F9F9; }
tr.chapter td.cnum { width: 64px; font-family: var(--head); font-weight: 700; font-size: 30px; line-height: 1; color: var(--ink); padding-right: 0; }
tr.chapter td.cname { font-weight: 600; }
tr.chapter.reserved td { background: var(--reserved); }
.pos { color: var(--warn); } .neg { color: var(--ok); }
.weight { width: 140px; }
.weight i { display: block; height: 8px; background: var(--rule-soft); position: relative; }
.weight i b { position: absolute; inset: 0 auto 0 0; background: var(--teal); }
tr.total td { font-weight: 700; border-top: 2px solid var(--ink); border-bottom: 0; background: #F8F9FA; }
tr.group td { background: #F1F4F5; font-weight: 600; border-top: 1px solid var(--rule); }
tr.group.reserved td, tr.line.reserved td { background: var(--reserved); }
tr.line td.code { color: var(--muted); white-space: nowrap; width: 80px; }
.cell { width: 100%; border: 1px solid transparent; background: transparent; padding: 5px 6px; border-radius: 3px; }
.cell:hover { border-color: var(--rule); background: #fff; }
.cell:focus { border-color: var(--teal); background: #fff; }
.cell[disabled] { color: var(--muted); }
.cell.num { text-align: right; font-variant-numeric: tabular-nums; }
.qtycell { display: flex; gap: 4px; align-items: center; }
.qtycell select { width: auto; padding: 4px 4px; font-size: 13px; border-color: var(--rule); }
.actions { white-space: nowrap; text-align: right; }
.chaphead { display: flex; align-items: baseline; gap: 16px; }
.chaphead .cnum { font-family: var(--head); font-weight: 700; font-size: 54px; line-height: 1; }
.back { display: inline-block; margin-bottom: 10px; }
.legend { color: var(--muted); font-size: 13px; margin: 8px 0 0; }

table.lines { min-width: 960px; }
table.lines th, table.lines td { padding: 6px 8px; }
table.lines td:nth-child(2) { min-width: 220px; }
table.lines td:nth-child(3) { min-width: 92px; }
table.lines td:nth-child(5) { min-width: 120px; }
table.lines td.actions { min-width: 150px; }
.qtycell { min-width: 150px; }
.qtycell input { width: 62px; }

/* Equipo */
.permgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 24px; }
.permgrid fieldset { border: 1px solid var(--rule); padding: 8px 12px 10px; margin: 0; }
.permgrid legend { font-weight: 600; padding: 0 6px; }
.check { display: flex; gap: 8px; align-items: flex-start; padding: 3px 0; }
.check input { margin-top: 4px; }
.chlist { columns: 2; column-gap: 24px; }

/* Diálogos */
dialog { border: 1px solid var(--ink); padding: 0; width: min(720px, calc(100vw - 24px)); max-height: 92vh; overflow: auto; background: var(--surface); color: var(--ink); }
dialog::backdrop { background: rgba(22,34,44,.45); }
dialog .dhead { padding: 16px 22px 0; }
dialog .dbody { padding: 14px 22px 6px; }
dialog .dfoot { padding: 12px 22px 18px; display: flex; gap: 8px; justify-content: flex-end; }
#toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 3px; opacity: 0; pointer-events: none; transition: opacity .15s; max-width: 90vw; z-index: 50; }
.rail .who .ver { margin-top: 6px; font-size: 11px; opacity: .65; letter-spacing: .02em; }
#toast.show { opacity: 1; }
#toast.bad { background: var(--danger); }

.avail { padding: 14px 16px; border-left: 4px solid var(--rule); background: var(--surface); margin-top: 14px; font-weight: 600; font-size: 17px; }
.avail.yes { border-left-color: var(--ok); color: var(--ok); }
.avail.no { border-left-color: var(--danger); color: var(--danger); }
.empty { padding: 28px; text-align: center; color: var(--muted); }

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; height: auto; overflow: visible; }
  .rail nav { grid-auto-flow: column; overflow-x: auto; padding: 0; }
  .rail a.nav, .rail span.nav { white-space: nowrap; border-left: 0; border-bottom: 3px solid transparent; }
  .rail a.nav[aria-current="page"] { border-bottom-color: #6FD0D4; }
  .rail .who { display: flex; justify-content: space-between; margin-top: 0; }
  .main { padding: 18px 14px 50px; }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary .v { font-size: 22px; }
  .summary > div:nth-child(3) { border-left: 0; }
  .summary > div:nth-child(n+3) { border-top: 1px solid var(--rule); }
  .row2, .permgrid { grid-template-columns: 1fr; }
  .chlist { columns: 1; }
}
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }

/* Proveedores */
.sup-bar { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.sup-bar input[type=search] { min-width: 260px; flex: 1 1 260px; max-width: 420px; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 3px; background: var(--surface); }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab { border: 1px solid var(--rule); background: var(--surface); padding: 5px 11px; border-radius: 3px; cursor: pointer; }
.tab.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.tab.on .muted { color: #C9D3D8; }
.small { font-size: 13px; }
.pad { padding: 18px 20px; }
.chip.s-verified { background: #DDF1E6; color: var(--ok); }
.chip.s-pending { background: #FBF1DF; color: var(--warn); }
.chip.s-incomplete { background: #E9EDEF; color: var(--muted); }
.chip.s-observed { background: #F8DEDC; color: var(--danger); }
.chip.s-inactive { background: #E9EDEF; color: #7B8791; text-decoration: line-through; }
.chip.s-issue { background: #F8DEDC; color: var(--danger); }
.sup-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.kvlist { margin: 12px 0 0; display: grid; gap: 8px; }
.kvlist.tight { gap: 4px; margin: 8px 0 12px; }
.kv { display: grid; grid-template-columns: minmax(120px, 190px) 1fr; gap: 10px; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.checks, .events { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.chk { display: grid; grid-template-columns: 22px 1fr; gap: 8px; align-items: start; }
.chk small { display: block; color: var(--muted); }
.chk .ic { font-weight: 700; text-align: center; }
.chk.ok .ic { color: var(--ok); } .chk.fail .ic { color: var(--danger); } .chk.fail { color: var(--danger); } .chk.pending .ic { color: var(--warn); }
.docgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.doc { background: var(--surface); border: 1px solid var(--rule); padding: 16px 18px; }
.doc.missing { border-style: dashed; background: transparent; }
.doc p { margin: 8px 0; }
.events li { padding: 6px 0; border-bottom: 1px solid var(--rule-soft); }
textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 3px; }
@media (max-width: 760px) { .sup-grid { grid-template-columns: minmax(0, 1fr); } .kv { grid-template-columns: 1fr; gap: 2px; } .docgrid { grid-template-columns: minmax(0, 1fr); } }

.auto { background: #E4F3EE !important; border-color: var(--ok) !important; }
[data-read] a { margin-left: 6px; }

/* Órdenes de compra: formulario con panel de presupuesto */
.oc-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 1000px) { .oc-grid { grid-template-columns: minmax(0, 1fr); } }
.oc-form { padding: 20px; }
.oc-h { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; }
.oc-sep { border: 0; border-top: 1px solid var(--rule-soft); margin: 18px 0; }
.oc-combo { position: relative; }
.oc-res { position: absolute; z-index: 20; left: 0; right: 0; top: 100%; background: var(--surface); border: 1px solid var(--rule); box-shadow: 0 8px 24px rgba(22, 34, 44, .15); max-height: 320px; overflow: auto; }
.oc-res[hidden] { display: none; }
.oc-res button { display: block; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--rule-soft); padding: 9px 12px; cursor: pointer; font: inherit; color: var(--ink); }
.oc-res button:hover, .oc-res button:focus { background: var(--teal-wash); outline: 0; }
.oc-res small { display: block; color: var(--muted); }
.oc-card { border: 1px solid var(--rule-soft); background: #F8FAFA; padding: 10px 14px; margin-bottom: 12px; }
.oc-kv { display: grid; grid-template-columns: 170px 1fr; gap: 8px; padding: 4px 0; font-size: 14px; }
.oc-kv span { color: var(--muted); }
.oc-kv b { font-weight: 600; overflow-wrap: anywhere; }
.oc-empty { margin: 0 0 12px; }
.oc-panel { padding: 16px 0 0; position: sticky; top: 12px; }
.oc-panel-head { padding: 0 16px 10px; }
.oc-list { max-height: 620px; overflow: auto; border-top: 1px solid var(--rule-soft); }
.oc-row { display: grid; grid-template-columns: 78px 1fr auto; gap: 10px; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--rule-soft); padding: 9px 16px; cursor: pointer; font: inherit; color: var(--ink); }
.oc-row[hidden] { display: none; }
.oc-row:hover { background: var(--teal-wash); }
.oc-row.on { background: var(--teal-wash); box-shadow: inset 3px 0 0 var(--teal); }
.oc-code { font-variant-numeric: tabular-nums; font-weight: 600; }
.oc-desc small, .oc-num small { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.oc-num { text-align: right; font-variant-numeric: tabular-nums; }

.oc-item { border: 1px solid var(--rule-soft); border-left: 3px solid var(--rule); padding: 12px 14px 4px; margin-bottom: 12px; background: var(--surface); }
.oc-item.on { border-left-color: var(--teal); box-shadow: 0 0 0 2px var(--teal-wash); }
.oc-item-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.oc-total { text-align: right; font-size: 17px; margin: 4px 0 6px; }
.oc-ro { border-collapse: collapse; width: 100%; }
.oc-ro td { padding: 3px 10px 3px 0; border: 0; vertical-align: top; }

.oc-avail { border-top: 1px dashed var(--rule-soft); margin-top: 6px; padding-top: 6px; }
.oc-big { font-size: 18px; color: #0B6E73; }

.lockbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 14px; border: 1px solid var(--rule-soft); background: #F8FAFA; }
.lockbar.mine { background: #E4F3EE; border-color: #8CC9B5; }
.lockbar.other { background: #FDF1E3; border-color: #E5B97A; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #B7C1C7; vertical-align: middle; }
.dot.on { background: #1FA971; box-shadow: 0 0 0 3px rgba(31,169,113,.2); }

/* Marca del cliente: logo en mosaico de fondo */
body.branded { background-color: var(--brand-bg, #ECEFF1); }
body.branded::before { content: ''; position: fixed; inset: 0; background-image: var(--brand-tile); background-size: 240px 240px; opacity: .16; pointer-events: none; z-index: 0; }
body.branded .layout { position: relative; z-index: 1; }
body.branded .main { background: transparent; }
.srcbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 14px; font-size: 14px; }
body.branded.bgdark .main { background: rgba(244,246,247,.88); margin: 16px; width: auto; border-radius: 10px; min-height: calc(100vh - 32px); }
body.branded.bgdark::before { opacity: .38; }

/* ---------- Aprobador móvil ---------- */
.ap { max-width: 560px; margin: 0 auto; padding: 12px 14px 60px; }
.ap-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.ap-hello { flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
.ap-hello span { color: var(--muted, #5b6b75); font-size: 14px; }
.ap-links { display: flex; gap: 12px; align-items: center; font-size: 14px; }
.ap-links button { font-size: 22px; background: none; border: 0; cursor: pointer; padding: 6px; }
.ap-card { background: #fff; border: 1px solid #d5dde2; border-radius: 12px; padding: 16px; margin-bottom: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.06); transition: opacity .25s, transform .25s; }
.ap-card.gone { opacity: 0; transform: translateX(40px); }
.ap-card.urgent { border-color: #b3261e; border-width: 2px; }
.ap-urg { background: #F8DEDC; color: #8c1d18; font-weight: 700; font-size: 13px; padding: 6px 10px; border-radius: 6px; margin-bottom: 10px; }
.ap-urg span { font-weight: 400; }
.ap-who { font-size: 18px; font-weight: 600; }
.ap-amount { font-size: 30px; font-weight: 700; margin: 2px 0 4px; font-family: 'Barlow Condensed', 'Barlow', sans-serif; }
.ap-meta { color: #5b6b75; font-size: 14px; }
.ap-more { background: none; border: 0; color: var(--teal-dark, #0f6a6b); font-size: 14px; padding: 10px 0; cursor: pointer; }
.ap-detail { border-top: 1px solid #e3e8eb; padding-top: 8px; font-size: 14px; }
.ap-detail table { width: 100%; } .ap-detail td:last-child { text-align: right; }
.ap-warn { color: #b3261e; font-size: 14px; margin: 8px 0 0; }
.ap-actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.ap-ask { width: 100%; margin: 0 0 2px; font-size: 16px; }
.ap-btn { flex: 1; min-height: 56px; font-size: 18px; font-weight: 700; border-radius: 10px; border: 2px solid; cursor: pointer; font-family: inherit; }
.ap-btn.yes { background: #1f7a4d; border-color: #1f7a4d; color: #fff; }
.ap-btn.no { background: #fff; border-color: #aab6bd; color: #16232b; }
.ap-btn.deny { background: #b3261e; border-color: #b3261e; color: #fff; }
.ap-btn:disabled { opacity: .5; }
.ap-input { width: 100%; font-size: 16px; padding: 14px; border: 2px solid #aab6bd; border-radius: 10px; }
.ap-empty { text-align: center; padding: 60px 10px; }
.ap-check { width: 84px; height: 84px; line-height: 84px; border-radius: 50%; background: #DDF1E6; color: #1f7a4d; font-size: 46px; margin: 0 auto 14px; }

/* ---------- Reportes ---------- */
.rp-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.rp-tile { background: var(--surface); border: 1px solid var(--rule); padding: 14px 16px; min-width: 0; }
.rp-tile .k { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.rp-tile .v { font-family: var(--head); font-size: 22px; font-weight: 600; line-height: 1.15; margin-top: 2px; overflow-wrap: anywhere; }
.rp-tile .v.neg { color: var(--danger); } .rp-tile .v.warn { color: var(--warn); }
.rp-tile .d { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.rp-card { background: var(--surface); border: 1px solid var(--rule); padding: 16px 18px; margin-bottom: 16px; min-width: 0; }
.rp-card h2, .rp-card h3 { margin: 0 0 10px; font-size: 15px; }
.rp-h { margin: 28px 0 12px; font-size: 20px; }
.rp-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.rp-grid2 > .rp-card { margin-bottom: 0; }
.rp-grid2 { margin-bottom: 16px; }
@media (max-width: 900px) { .rp-grid2 { grid-template-columns: minmax(0, 1fr); } }
.rp-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; align-items: center; gap: 12px; margin: 8px 0; font-size: 14px; }
.rp-prog { height: 10px; background: #e6eaec; border-radius: 5px; overflow: hidden; min-width: 60px; }
.rp-prog b { display: block; height: 100%; border-radius: 5px; }
.rp-svg { width: 100%; height: auto; display: block; overflow: visible; }
.rp-svg text { font-family: var(--body); }
.rp-lab { font-size: 14px; fill: #3b4a54; } .rp-val { font-size: 14px; fill: #16222C; font-weight: 600; }
.rp-ax { font-size: 11px; fill: #6b7780; }
.rp-grid { stroke: #e1e0d9; stroke-width: 1; } .rp-base { stroke: #c3c2b7; stroke-width: 1; }
.rp-xh { stroke: #52514e; stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }
.rp-hov { cursor: default; outline: none; } .rp-hov:hover, .rp-hov:focus { filter: brightness(1.08); }
.rp-hit { cursor: crosshair; }
.rp-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 0; margin: 0 0 10px; font-size: 13px; color: #3b4a54; }
.rp-legend li { display: flex; align-items: center; gap: 6px; } .rp-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.rp-donut { display: grid; grid-template-columns: minmax(150px, 210px) minmax(0, 1fr); gap: 18px; align-items: center; }
@media (max-width: 560px) { .rp-donut { grid-template-columns: minmax(0, 1fr); } .rp-donut svg { max-width: 220px; margin: 0 auto; } }
.rp-donut svg { width: 100%; height: auto; }
.rp-ctop { font-family: var(--head); font-size: 22px; font-weight: 600; fill: #16222C; } .rp-cbot { font-size: 11px; fill: #6b7780; }
.rp-dleg { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.rp-dleg li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto 48px; gap: 8px; align-items: center; padding: 4px 0; border-bottom: 1px solid var(--rule-soft); }
.rp-dleg i { width: 12px; height: 12px; border-radius: 3px; } .rp-dname { overflow-wrap: anywhere; }
.rp-dval { color: #3b4a54; text-align: right; } .rp-dpct { text-align: right; font-weight: 600; }
.rp-alerts { list-style: none; padding: 0; margin: 0; } .rp-alerts li { padding: 8px 0; border-bottom: 1px solid var(--rule-soft); font-size: 14px; }
.rp-table summary { cursor: pointer; margin: 12px 0 8px; font-size: 13px; color: var(--teal-dark); }
.rp-empty { padding: 18px 0; text-align: center; }
.rp-tooltip { position: fixed; z-index: 90; pointer-events: none; background: #16222C; color: #fff; padding: 8px 11px; border-radius: 6px; font-size: 12.5px; line-height: 1.45; max-width: 320px; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.rp-tooltip b { display: block; font-size: 13px; margin-bottom: 2px; } .rp-tooltip div { color: #dbe3e8; }
.filters { margin: 0 0 12px; display: flex; gap: 8px; align-items: center; }
@media print {
  .rail, .rp-noprint, .toolbar, .btn { display: none !important; } .layout { display: block !important; }
  .rp-card, .rp-tile { break-inside: avoid; } .main { margin: 0 !important; padding: 0 !important; }
  .rp-tooltip { display: none !important; } body { background: #fff !important; }
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; } @media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }


/* =====================================================================
   OSO BACKOFFICE — identidad nueva (modo oscuro, paleta Pacífico)
   ===================================================================== */
html { color-scheme: dark; }
body { background: var(--paper); color: var(--ink); font: 400 15px/1.5 var(--body); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--head); font-stretch: 68%; font-weight: 800; text-transform: uppercase; letter-spacing: .01em; line-height: .98; }
h1 { font-size: 40px; } h2 { font-size: 28px; } h3 { font-size: 21px; }
a { color: var(--teal); } a:hover { color: var(--hielo); }
::selection { background: rgba(127, 179, 213, .35); color: var(--ink); }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.boot { color: var(--muted2); font-family: var(--mono); letter-spacing: .12em; text-transform: uppercase; font-size: 12px; }
.slate-band { display: none; }
.num, td.money, .summary .v, .rp-tile .v { font-variant-numeric: tabular-nums; }
td.money, td.num, .cell.num { font-family: var(--mono); font-size: 13px; }

/* Acceso */
.gate-box { background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; }
.gate-inner { padding: 34px 32px 34px; }
.gate-logo { display: block; width: 150px; height: auto; margin: 0 auto 14px; }
.gate-inner h1 { font-size: 34px; text-align: center; }
.gate-inner > .muted, .gate-inner p.muted { text-align: center; }

/* Barra lateral */
.rail { background: var(--surface); color: var(--text2); border-right: 1px solid var(--rule); }
.brand { padding: 22px 20px 14px; }
.brand img { width: 100%; max-width: 190px; }
.rail nav { padding: 8px 0 14px; }
.rail a.nav, .rail span.nav { color: var(--text2); font-family: var(--mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; padding: 11px 20px; border-left: 2px solid transparent; }
.rail a.nav:hover { background: var(--surface2); color: var(--ink); }
.rail a.nav[aria-current="page"] { border-left-color: var(--teal); background: var(--surface2); color: var(--ink); }
.rail span.nav, .rail .soon { color: var(--faint); }
.rail .who { border-top: 1px solid var(--rule); font-size: 14px; color: var(--text2); }
.rail .who button { color: var(--teal); font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; text-decoration: none; border-bottom: 1px solid var(--line2); padding: 4px 0 2px; }
.rail .who button:hover { color: var(--hielo); }
.main { padding: 32px 32px 64px; }
.topline .sub { color: var(--muted); }
.topline h1 { margin-bottom: 2px; }

/* Botones (píldora, texto mono en mayúsculas) */
.btn { font-family: var(--mono); font-weight: 500; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; border: 1px solid var(--line2); background: transparent; color: var(--ink); border-radius: 999px; padding: 10px 18px; line-height: 1.2; }
.btn:hover { background: var(--surface2); border-color: var(--muted2); }
.btn.primary { background: var(--teal); border-color: var(--teal); color: var(--accent-ink); }
.btn.primary:hover { background: var(--hielo); border-color: var(--hielo); }
.btn.small { padding: 6px 12px; font-size: 11px; }
.btn.link { border: 0; background: none; color: var(--teal); text-decoration: none; padding: 4px 6px; border-radius: 4px; letter-spacing: .08em; }
.btn.link:hover { background: none; color: var(--hielo); text-decoration: underline; }
.btn.danger { color: var(--danger); border-color: rgba(229, 138, 138, .5); }
.btn.danger:hover { background: rgba(229, 138, 138, .1); border-color: var(--danger); }
.btn.danger.link { border: 0; }
.btn.primary.danger { background: var(--danger); border-color: var(--danger); color: var(--accent-ink); }

/* Formularios */
.field label, .field .lbl { font-family: var(--mono); font-weight: 500; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted2); }
.field small { color: var(--muted2); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=file], input[type=date], input[type=month], input[type=search], input[type=tel], input[type=url], select, textarea {
  background: var(--paper); border: 1px solid var(--line2); color: var(--ink); border-radius: 4px; padding: 10px 12px; }
input::placeholder, textarea::placeholder { color: var(--muted2); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal); outline-offset: 1px; border-color: var(--teal); }
input[disabled], select[disabled], textarea[disabled] { color: var(--faint); background: var(--surface); }
input[type=file]::file-selector-button { background: transparent; color: var(--ink); border: 1px solid var(--line2); border-radius: 999px; padding: 5px 12px; margin-right: 10px; font: 500 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; cursor: pointer; }
input[type=checkbox], input[type=radio] { accent-color: var(--teal); }
input[type=color] { background: var(--paper); border: 1px solid var(--line2); }
select option { background: var(--surface); color: var(--ink); }
.error { color: var(--danger); }
.notice { background: var(--teal-wash); border-left: 2px solid var(--teal); color: var(--text2); border-radius: 0 4px 4px 0; }
.notice.warn { background: rgba(230, 193, 122, .1); border-left-color: var(--warn); }
.notice b, .notice strong { color: var(--ink); }

/* Chips de estado */
.chip { background: var(--surface2); color: var(--hielo); border: 1px solid var(--line2); border-radius: 999px; padding: 2px 10px; font-family: var(--mono); font-weight: 500; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; }
.chip.on { background: var(--teal-wash); color: var(--teal); border-color: rgba(127, 179, 213, .5); }
.chip.s-verified { background: rgba(127, 200, 169, .12); color: var(--ok); border-color: rgba(127, 200, 169, .45); }
.chip.s-pending { background: rgba(230, 193, 122, .1); color: var(--warn); border-color: rgba(230, 193, 122, .45); }
.chip.s-incomplete { background: var(--surface2); color: var(--muted); }
.chip.s-observed, .chip.s-issue { background: rgba(229, 138, 138, .1); color: var(--danger); border-color: rgba(229, 138, 138, .45); }
.chip.s-inactive { background: transparent; color: var(--muted2); text-decoration: line-through; }

/* Resumen y tarjetas */
.summary, .params, .tablewrap, .doc, .rp-tile, .rp-card, .oc-form, .oc-panel, .oc-item, .gate-box { background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; }
.summary > div { border-left-color: var(--rule); }
.summary > div:nth-child(n+3) { border-top-color: var(--rule); }
.summary .k, .rp-tile .k { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted2); }
.summary .v { font-family: var(--head); font-stretch: 68%; font-weight: 800; font-size: 36px; line-height: 1; margin-top: 4px; }
.rp-tile .v { font-family: var(--head); font-stretch: 68%; font-weight: 800; font-size: 32px; line-height: 1; margin-top: 6px; }
.rp-tile .v.neg { color: var(--danger); } .rp-tile .v.warn { color: var(--warn); }
.summary .d, .rp-tile .d { color: var(--muted); }
.params .stat b { font-family: var(--mono); font-weight: 500; }
.doc.missing { background: transparent; border-color: var(--line2); }
.rp-card h2, .rp-card h3 { font-family: var(--mono); font-stretch: 100%; font-weight: 500; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted2); margin-bottom: 14px; line-height: 1.3; }
.rp-h { font-size: 26px; }
.oc-h { font-family: var(--mono); letter-spacing: .14em; color: var(--muted2); font-size: 11px; }

/* Tablas */
.tablewrap { background: var(--surface); }
th { font-family: var(--mono); font-weight: 500; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted2); background: transparent; border-bottom: 1px solid var(--line2); padding: 12px 14px; }
td { border-bottom: 1px solid var(--rule); padding: 11px 14px; color: var(--text2); }
tbody tr:hover td { background: var(--surface2); }
tbody tr:last-child td { border-bottom: 0; }
tr.chapter:hover td { background: var(--surface2); }
tr.chapter td.cnum, .chaphead .cnum { font-family: var(--head); font-stretch: 68%; font-weight: 800; color: var(--teal); }
tr.chapter td.cname { color: var(--ink); }
tr.chapter.reserved td, tr.group.reserved td, tr.line.reserved td { background: var(--reserved); }
tr.total td { background: transparent; border-top: 1px solid var(--line2); color: var(--ink); }
tr.group td { background: rgba(23, 41, 70, .6); color: var(--ink); border-top: 1px solid var(--rule); }
tr.line td.code { color: var(--muted2); font-family: var(--mono); font-size: 12px; }
.weight i { background: var(--rule); }
.cell { color: var(--ink); }
.cell:hover { border-color: var(--line2); background: var(--paper); }
.cell:focus { border-color: var(--teal); background: var(--paper); }
.cell[disabled] { color: var(--muted2); background: transparent; }
.pos { color: var(--warn); } .neg { color: var(--ok); }
.qtycell select { border-color: var(--line2); }
.legend { color: var(--muted2); }

/* Pestañas y filtros */
.tab { background: transparent; border: 1px solid var(--line2); color: var(--text2); border-radius: 999px; padding: 6px 14px; font-family: var(--mono); font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; text-decoration: none; }
.tab:hover { background: var(--surface2); color: var(--ink); }
.tab.on { background: var(--teal); border-color: var(--teal); color: var(--accent-ink); }
.tab.on .muted { color: var(--accent-ink); opacity: .7; }
.sup-bar input[type=search] { background: var(--paper); border-color: var(--line2); }

/* Diálogos y avisos */
dialog { background: var(--surface); color: var(--ink); border: 1px solid var(--line2); border-radius: 6px; box-shadow: 0 24px 60px rgba(0, 0, 0, .55); }
dialog::backdrop { background: rgba(5, 11, 20, .78); }
dialog .dhead h2 { font-size: 30px; }
dialog .dfoot { border-top: 1px solid var(--rule); margin-top: 8px; padding-top: 14px; }
#toast { background: var(--surface2); color: var(--ink); border: 1px solid var(--line2); border-radius: 6px; font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
#toast.bad { background: #3a1f2b; border-color: var(--danger); color: #F7D4D4; }
.avail { background: var(--surface); border-left-color: var(--line2); }
.empty { color: var(--muted2); }
.permgrid fieldset { border-color: var(--rule); border-radius: 4px; }
.permgrid legend { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.kv dt { color: var(--muted2); font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.chk small, .chk .ic { color: var(--muted); }
.events li { border-bottom-color: var(--rule); }
.auto { background: rgba(127, 200, 169, .12) !important; border-color: var(--ok) !important; }

/* Órdenes de compra */
.oc-res { background: var(--surface2); border: 1px solid var(--line2); box-shadow: 0 12px 30px rgba(0, 0, 0, .5); }
.oc-res button { color: var(--ink); border-bottom-color: var(--rule); }
.oc-res button:hover, .oc-res button:focus { background: var(--teal-wash); }
.oc-card { background: var(--paper); border-color: var(--rule); }
.oc-row { color: var(--ink); border-bottom-color: var(--rule); }
.oc-row:hover { background: var(--surface2); }
.oc-row.on { background: var(--teal-wash); box-shadow: inset 2px 0 0 var(--teal); }
.oc-list { border-top-color: var(--rule); }
.oc-item { border-left: 2px solid var(--line2); }
.oc-item.on { border-left-color: var(--teal); box-shadow: none; }
.oc-big { color: var(--teal); font-family: var(--mono); }
.oc-sep { border-top-color: var(--rule); }
.oc-avail { border-top-color: var(--line2); }
.lockbar { background: var(--surface); border-color: var(--rule); border-radius: 4px; }
.lockbar.mine { background: rgba(127, 200, 169, .1); border-color: rgba(127, 200, 169, .5); }
.lockbar.other { background: rgba(230, 193, 122, .1); border-color: rgba(230, 193, 122, .5); }
.dot { background: var(--faint); }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(127, 200, 169, .2); }

/* Marca del cliente por proyecto: el contenido siempre sobre panel oscuro */
body.branded { background-color: var(--brand-bg, var(--paper)); }
body.branded .main, body.branded.bgdark .main { background: rgba(11, 22, 38, .93); margin: 16px; width: auto; border-radius: 6px; border: 1px solid var(--rule); min-height: calc(100vh - 32px); }
body.branded::before { opacity: .2; } body.branded.bgdark::before { opacity: .35; }
.srcbar { color: var(--text2); }

/* Aprobador móvil */
.ap-hello span, .ap-meta { color: var(--muted); }
.ap-card { background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; box-shadow: none; }
.ap-card.urgent { border-color: var(--danger); border-width: 1px; box-shadow: inset 0 0 0 1px var(--danger); }
.ap-urg { background: rgba(229, 138, 138, .12); color: var(--danger); border-radius: 4px; }
.ap-who { font-weight: 600; }
.ap-amount { font-family: var(--head); font-stretch: 68%; font-weight: 800; font-size: 40px; line-height: 1; }
.ap-more { color: var(--teal); font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.ap-detail { border-top-color: var(--rule); }
.ap-warn { color: var(--danger); }
.ap-btn { font-family: var(--mono); font-size: 14px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; border-radius: 999px; border-width: 1px; }
.ap-btn.yes { background: var(--teal); border-color: var(--teal); color: var(--accent-ink); }
.ap-btn.no { background: transparent; border-color: var(--line2); color: var(--ink); }
.ap-btn.deny { background: transparent; border-color: var(--danger); color: var(--danger); }
.ap-input { background: var(--paper); border: 1px solid var(--line2); color: var(--ink); border-radius: 8px; }
.ap-check { background: rgba(127, 200, 169, .15); color: var(--ok); }
.ap-links button { color: var(--ink); }

/* Reportes y gráficas */
.rp-prog { background: var(--rule); }
.rp-lab { fill: var(--text2); font-size: 13.5px; } .rp-val { fill: var(--ink); font-family: var(--mono); font-weight: 500; font-size: 12.5px; }
.rp-ax { fill: var(--muted2); font-family: var(--mono); }
.rp-grid { stroke: var(--rule); } .rp-base { stroke: var(--line2); }
.rp-xh { stroke: var(--muted); }
.rp-legend { color: var(--text2); }
.rp-ctop { fill: var(--ink); font-family: var(--head); font-stretch: 68%; font-weight: 800; font-size: 26px; } .rp-cbot { fill: var(--muted2); font-family: var(--mono); }
.rp-dval { color: var(--text2); font-family: var(--mono); font-size: 12px; } .rp-dpct { font-family: var(--mono); font-size: 12px; }
.rp-dleg li, .rp-alerts li { border-bottom-color: var(--rule); }
.rp-table summary { color: var(--teal); font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.rp-tooltip { background: var(--surface2); color: var(--ink); border: 1px solid var(--line2); border-radius: 6px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
.rp-tooltip div { color: var(--text2); }
.rp-svg text { font-family: var(--body); }
.rp-svg .rp-val, .rp-svg .rp-ax, .rp-svg .rp-cbot { font-family: var(--mono); }

@media (max-width: 900px) {
  .main { padding: 20px 14px 56px; }
  h1 { font-size: 32px; }
  .rail { border-right: 0; border-bottom: 1px solid var(--rule); }
  .rail a.nav, .rail span.nav { padding: 12px 14px; border-left: 0; border-bottom: 2px solid transparent; }
  .rail a.nav[aria-current="page"] { border-bottom-color: var(--teal); }
  .brand { padding: 14px 16px 6px; } .brand img { max-width: 170px; }
  body.branded .main, body.branded.bgdark .main { margin: 8px; }
  .summary .v { font-size: 25px; } .rp-tile .v { font-size: 26px; }
}
.summary > div, .rp-tile { min-width: 0; overflow-wrap: anywhere; }

/* Impresión: papel claro */
@media print {
  html { color-scheme: light; }
  body, .main, body.branded .main { background: #fff !important; color: #0B1626 !important; border: 0 !important; }
  h1, h2, h3, td, th, .rp-tile .v, .rp-lab, .rp-val, .rp-ctop { color: #0B1626 !important; fill: #0B1626 !important; }
  .tablewrap, .rp-card, .rp-tile, .summary { background: #fff !important; border-color: #CBD6E2 !important; }
  td, th { border-color: #CBD6E2 !important; } .rp-lab, .rp-dval, .rp-legend { fill: #22334F !important; color: #22334F !important; } .rp-grid { stroke: #CBD6E2 !important; }
}

/* Pagos: botones del lote (PAB) en varias líneas */
td.py-act { white-space: normal; min-width: 260px; }
td.py-act .btn { margin: 2px 0 2px 4px; }

/* =====================================================================
   Tema claro (entrega AB): contenido claro, barra lateral y acceso en azul oscuro
   ===================================================================== */
:root {
  --paper: #F3F6FA; --surface: #FFFFFF; --surface2: #E9F0F7;
  --ink: #14233A; --text2: #2E4059; --muted: #55677F; --muted2: #5F7189; --faint: #9AA9BB;
  --rule: #D5DFEA; --rule-soft: #E3EAF2; --line2: #B8C7D8;
  --teal: #2B6CA3; --teal-dark: #1F5280; --teal-wash: rgba(43, 108, 163, .10);
  --accent-ink: #FFFFFF; --hielo: #1F5280;
  --danger: #B3303A; --warn: #8A5A00; --ok: #1F7A52; --reserved: rgba(43, 108, 163, .06);
}
html { color-scheme: light; }
.rail, .gate-box {
  --paper: #0B1626; --surface: #12213A; --surface2: #172946;
  --ink: #EEF1F4; --text2: #C3CEDB; --muted: #A3B1C2; --muted2: #8E9DB3; --faint: #5E6F86;
  --rule: #22334F; --rule-soft: #1B2B46; --line2: #2E4262;
  --teal: #7FB3D5; --teal-dark: #A9CBE4; --teal-wash: rgba(127, 179, 213, .12);
  --accent-ink: #0B1626; --hielo: #CFE3F3; --danger: #E58A8A; --warn: #E6C17A; --ok: #7FC8A9;
  color-scheme: dark;
}
.gate { background: #0B1626; }
.gate-box { color: var(--ink); }
tr.group td { background: rgba(43, 108, 163, .07); }
.chip.on { border-color: rgba(43, 108, 163, .45); }
.chip.s-pending { background: rgba(197, 138, 27, .12); border-color: rgba(197, 138, 27, .5); }
.chip.s-verified { background: rgba(31, 122, 82, .10); border-color: rgba(31, 122, 82, .4); }
.chip.s-observed, .chip.s-issue { background: rgba(179, 48, 58, .08); border-color: rgba(179, 48, 58, .4); }
.btn.danger { border-color: rgba(179, 48, 58, .5); }
.btn.danger:hover { background: rgba(179, 48, 58, .08); }
.notice.warn { background: rgba(197, 138, 27, .12); }
.lockbar.mine { background: rgba(31, 122, 82, .08); border-color: rgba(31, 122, 82, .4); }
.lockbar.other { background: rgba(197, 138, 27, .1); border-color: rgba(197, 138, 27, .45); }
.auto { background: rgba(31, 122, 82, .08) !important; }
.dot.on { box-shadow: 0 0 0 3px rgba(31, 122, 82, .2); }
dialog { box-shadow: 0 24px 60px rgba(20, 35, 58, .28); }
dialog::backdrop { background: rgba(20, 35, 58, .55); }
#toast { background: #14233A; color: #fff; border-color: #14233A; box-shadow: 0 10px 30px rgba(20, 35, 58, .3); }
#toast.bad { background: #8F1F2B; border-color: #8F1F2B; color: #fff; }
.oc-res, .rp-tooltip { box-shadow: 0 12px 30px rgba(20, 35, 58, .18); }
.ap-urg { background: rgba(179, 48, 58, .08); }
.ap-check { background: rgba(31, 122, 82, .12); }
.ap-head { background: #0B1626; padding: 10px 14px; border-radius: 6px; --ink: #EEF1F4; --muted: #A3B1C2; color: #EEF1F4; }
body.branded .main, body.branded.bgdark .main { background: rgba(255, 255, 255, .95); }
.summary { box-shadow: 0 1px 2px rgba(20, 35, 58, .05); }
.tablewrap, .rp-card, .rp-tile, .params { box-shadow: 0 1px 2px rgba(20, 35, 58, .05); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=month], input[type=search], input[type=tel], input[type=url], select, textarea { background: #fff; }
.gate-box input[type=text], .gate-box input[type=email], .gate-box input[type=password], .gate-box input[type=number] { background: var(--paper); }
.ap-head a, .ap-head button { color: #7FB3D5; }

/* Expediente del proveedor */
.exp { margin: 0 0 18px; }
.exp-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.exp-group { margin-top: 12px; }
.exp-group h3 { font-family: var(--mono); font-stretch: 100%; font-weight: 500; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted2); margin: 0 0 6px; line-height: 1.3; }
.exp-list { list-style: none; margin: 0; padding: 0; }
.exp-list li { padding: 7px 0; border-bottom: 1px solid var(--rule); }
.exp-list li:last-child { border-bottom: 0; }
.exp-proj { display: inline-block; margin-left: 6px; padding: 1px 8px; border: 1px solid var(--line2); border-radius: 999px; font-size: 12px; color: var(--text2); }

/* Usuarios: botones de la fila en varias líneas si no caben */
td.ua{min-width:240px}
.ua-box{display:flex;flex-wrap:wrap;gap:6px}

/* Seguimiento de órdenes */
.trk-pipe{padding:8px 0;border-top:1px solid var(--line,#dfe6ee)}.trk-pipe:first-child{border-top:0;padding-top:0}
.trk-head{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.trk-dots{display:inline-flex;gap:3px;margin-left:2px}.trk-dots i{width:10px;height:10px;border-radius:50%;background:#d5dfea;display:inline-block}.trk-dots i.on{background:#2B6CA3}
.trk-bl{list-style:none;margin:8px 0 0;padding:0;display:flex;flex-direction:column;gap:6px}
.trk-bl li{display:flex;gap:10px;align-items:center;justify-content:space-between;flex-wrap:wrap;font-size:14px;padding:6px 10px;border-left:3px solid #C84F4F;background:rgba(200,79,79,.07);border-radius:2px}
.trk-bl li.soon{border-left-color:#C58A1B;background:rgba(197,138,27,.08)}
.trk-legend{margin:0 0 12px;line-height:1.7}
table.trk td{vertical-align:top}
table.trk td:first-child{white-space:nowrap}

/* Orden de compra anulada: roja, grande y tachada */
.chip.oc-anul { background: #b3261e; color: #fff; font-size: 14px; font-weight: 800; letter-spacing: .06em; padding: 4px 12px; text-decoration: none; }
tr.oc-annulled td { color: #b3261e; text-decoration: line-through; text-decoration-thickness: 2px; }
tr.oc-annulled td:last-child { text-decoration: none; }
tr.oc-annulled a, tr.oc-annulled b { color: #b3261e; }
.oc-anul-banner { color: #b3261e; border: 4px solid #b3261e; border-radius: 8px; font-size: 44px; font-weight: 900; letter-spacing: .12em; text-align: center; padding: 6px 12px; margin: 0 0 14px; max-width: 760px; text-transform: uppercase; transform: rotate(-1.5deg); }
.oc-annulled-doc dd, .oc-annulled-doc td { color: #b3261e; text-decoration: line-through; text-decoration-thickness: 2px; }
.oc-annulled-doc dt { color: #b3261e; }

/* Flujo de caja */
table.cf tr.cf-row { cursor: pointer; }
table.cf tr.cf-row:hover td { background: rgba(15,106,107,.06); }
table.cf tr.cf-row.neg td { background: rgba(179,38,30,.06); }
table.cf tr.cf-det td { background: rgba(0,0,0,.025); padding: 10px 16px 14px; }
.cf-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.cf-it { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 1px dotted rgba(120,130,140,.35); }
.params .stat.neg b { color: #b3261e; }
@media (max-width: 700px) { .cf-cols { grid-template-columns: 1fr; } }

/* Relación de gastos (caja menor) */
dialog.gx-dlg { width: min(980px, calc(100vw - 20px)); max-height: calc(100vh - 20px); }
dialog.gx-dlg .dbody { max-height: calc(100vh - 190px); overflow: auto; }
.gx-sum { margin-bottom: 12px; }
.gx-nums { display: flex; gap: 28px; flex-wrap: wrap; margin-bottom: 8px; }
.gx-nums > div { display: flex; flex-direction: column; }
.gx-nums b { font-size: 1.25rem; }
.gx-nums b.warn { color: #b45309; } .gx-nums b.neg { color: #b3261e; }
.gx-bar { height: 8px; background: var(--line2, #d6dde2); border-radius: 4px; overflow: hidden; }
.gx-bar i { display: block; height: 100%; background: var(--teal, #0f6a6b); }
.gx-t td { vertical-align: top; }
.gx-t .gx-acts { white-space: nowrap; text-align: right; }
.gx-t tr.gx-refund td { background: rgba(180, 83, 9, .06); }
.gx-form .gx-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 14px; }
.gx-files { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.gx-prev { display: block; max-width: 220px; max-height: 200px; margin-top: 8px; border: 1px solid var(--line2, #d6dde2); border-radius: 4px; }
.gx-ocr summary { cursor: pointer; font-size: .85rem; margin-top: 8px; }
.gx-ocr pre { white-space: pre-wrap; background: var(--surface2, #f1f5f8); padding: 8px; max-height: 160px; overflow: auto; font-size: .8rem; }

/* El botón de enviar de cualquier cuadro queda siempre visible, aunque el contenido sea largo (ej. lista de errores de una factura). */
dialog .dfoot { position: sticky; bottom: 0; background: var(--surface); z-index: 2; }

/* Disponible de la cuenta, debajo de la casilla del valor al crear una orden */
.oc-under { margin-top: 6px; font-size: 14px; }
.oc-under-box { border: 1px solid var(--rule, #c9d3d8); border-left: 4px solid var(--accent, #0f6a6b); padding: 8px 10px; background: var(--surface); }
.oc-under-box.over { border-left-color: #b3261e; }
.oc-under-bad { color: #b3261e; font-weight: bold; margin-top: 3px; }

/* Nombre del proyecto en cada pantalla del proyecto */
.projbar { display: flex; align-items: baseline; gap: 8px; margin: 0 0 12px; padding: 7px 12px; border-left: 3px solid var(--teal); background: var(--teal-wash); font-size: 14px; }
.projbar span { text-transform: uppercase; letter-spacing: .08em; font-size: 11px; color: var(--muted); }
.projbar a { color: var(--ink); text-decoration: none; }
.projbar small { color: var(--muted); }

/* =====================================================================
   Rediseño (entrega BI): más aire, esquinas redondeadas, etiquetas legibles,
   movimiento con resortes, modo oscuro automático y móvil con zonas táctiles de 44 px.
   La identidad se mantiene: logo, azul Pacífico, titulares condensados y cifras grandes.
   ===================================================================== */
:root {
  --r-sm: 8px; --r-md: 12px; --r-lg: 18px;
  --sh-1: 0 1px 2px rgba(20, 35, 58, .06), 0 1px 1px rgba(20, 35, 58, .04);
  --sh-2: 0 6px 20px rgba(20, 35, 58, .10), 0 2px 6px rgba(20, 35, 58, .06);
  --sh-3: 0 24px 64px rgba(20, 35, 58, .30), 0 4px 12px rgba(20, 35, 58, .12);
  /* Resorte: sale rápido, rebasa un poco y se asienta (equivale a damping ~0.8) */
  --spring: linear(0, .22 8%, .62 18%, .92 29%, 1.04 38%, 1.05 46%, 1.02 58%, 1 72%, 1);
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --head-w: 74%;
}
body { font-size: 15px; line-height: 1.5; text-rendering: optimizeLegibility; }
h1, h2, h3 { font-stretch: var(--head-w); }
h1 { font-size: clamp(30px, 4.2vw, 42px); letter-spacing: -.005em; line-height: 1; }
h2 { font-size: 24px; text-transform: none; letter-spacing: 0; line-height: 1.1; font-weight: 700; }
h3 { font-size: 18px; text-transform: none; letter-spacing: 0; line-height: 1.15; font-weight: 700; }
.gate-inner h1 { text-transform: uppercase; }
.rp-card h2, .rp-card h3, .exp-group h3 { font-family: var(--body); font-stretch: 100%; font-size: 12.5px; font-weight: 600; letter-spacing: .02em; text-transform: none; color: var(--muted); }
.main { padding: 32px 36px 72px; }
.topline { margin-bottom: 24px; }
.topline .sub { max-width: 68ch; font-size: 15px; margin-top: 8px; }

/* Barra lateral: grupos claros, elemento activo en cápsula */
.rail { border-right: 1px solid rgba(255, 255, 255, .06); background: linear-gradient(180deg, #0F1D33 0%, #0B1626 100%); }
.rail nav { padding: 6px 10px 14px; gap: 2px; }
.rail a.nav, .rail span.nav { font-family: var(--body); font-size: 14.5px; font-weight: 500; letter-spacing: 0; text-transform: none; padding: 10px 12px; border-left: 0; border-radius: var(--r-sm); min-height: 40px; align-items: center;
  transition: background-color .18s var(--ease-out), color .18s var(--ease-out), transform .18s var(--ease-out); }
.rail a.nav:hover { background: rgba(255, 255, 255, .07); }
.rail a.nav:active { transform: scale(.98); }
.rail a.nav[aria-current="page"] { background: rgba(127, 179, 213, .18); color: #fff; box-shadow: inset 0 0 0 1px rgba(127, 179, 213, .28); }
.rail .navgroup { margin: 14px 12px 4px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .10); font-size: 12px; font-weight: 600; letter-spacing: .04em; color: #8FA3BC; display: grid; gap: 2px; }
.rail .navgroup b { font-family: var(--head); font-stretch: 74%; font-size: 19px; font-weight: 800; letter-spacing: .01em; text-transform: uppercase; color: #EEF1F4; line-height: 1.05; }
.rail .who { padding: 14px 18px 18px; border-top: 1px solid rgba(255, 255, 255, .10); }
.rail .who button { font-family: var(--body); font-size: 13px; letter-spacing: 0; text-transform: none; border-bottom: 0; text-decoration: underline; text-underline-offset: 3px; }

/* Botones */
.btn { font-family: var(--body); font-size: 14px; font-weight: 600; letter-spacing: 0; text-transform: none; padding: 9px 18px; min-height: 38px; border-radius: 999px;
  transition: transform .16s var(--ease-out), background-color .16s var(--ease-out), border-color .16s var(--ease-out), box-shadow .16s var(--ease-out); }
.btn:active { transform: scale(.96); transition-duration: .06s; }
.btn.primary { box-shadow: 0 1px 2px rgba(31, 82, 128, .35), inset 0 1px 0 rgba(255, 255, 255, .18); }
.btn.primary:hover { box-shadow: 0 4px 12px rgba(31, 82, 128, .30), inset 0 1px 0 rgba(255, 255, 255, .18); }
.btn.small { font-size: 13px; padding: 5px 13px; min-height: 32px; }
.btn.link { min-height: 0; padding: 4px 8px; font-weight: 600; }
.btn.link:active { transform: none; }

/* Formularios */
.field { margin-bottom: 16px; gap: 6px; }
.field label, .field .lbl { font-family: var(--body); font-size: 13px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--text2); }
.field small { font-size: 12.5px; line-height: 1.4; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=file], input[type=date], input[type=month], input[type=search], input[type=tel], input[type=url], select, textarea {
  border-radius: var(--r-md); min-height: 42px; padding: 9px 13px; transition: border-color .16s var(--ease-out), box-shadow .16s var(--ease-out), background-color .16s var(--ease-out); }
textarea { min-height: 84px; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--teal); box-shadow: 0 0 0 4px rgba(43, 108, 163, .18); }
.gate-box input:focus { box-shadow: 0 0 0 4px rgba(127, 179, 213, .22); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; }
input[type=file]::file-selector-button { font: 600 13px var(--body); letter-spacing: 0; text-transform: none; padding: 6px 14px; }

/* Tarjetas, resumen y tablas */
.tablewrap, .summary, .params, .rp-card, .rp-tile, .oc-card, .gate-box { border-radius: var(--r-lg); border-color: var(--rule); box-shadow: var(--sh-1); }
.tablewrap { overflow-x: auto; }
.summary { margin-bottom: 24px; }
.summary > div { padding: 18px 22px; }
.summary .k, .rp-tile .k { font-family: var(--body); font-size: 13px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--muted); }
.summary .v { font-size: 32px; letter-spacing: -.005em; }
th { font-family: var(--body); font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 11px 14px; background: var(--surface); border-bottom: 1px solid var(--rule); }
td { padding: 11px 14px; }
tbody tr { transition: background-color .14s var(--ease-out); }
tbody tr:not(.total):hover td { background: var(--teal-wash); }
tbody tr:last-child td { border-bottom: 0; }
td:first-child a, td.nowrap { white-space: nowrap; }
td.money, td.num, .cell.num { font-size: 13.5px; }
.kv dt, .permgrid legend { font-family: var(--body); font-size: 12.5px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--muted); }
.oc-h, .boot { font-family: var(--body); letter-spacing: 0; text-transform: none; }
.rp-svg .rp-ax, .rp-svg .rp-cbot, .rp-ax, .rp-cbot { font-size: 12px; }

/* Etiquetas de estado: una sola línea, con punto de color (no solo color) */
.chip { font-family: var(--body); font-size: 12.5px; font-weight: 600; letter-spacing: 0; text-transform: none; white-space: nowrap; padding: 3px 11px 3px 9px; display: inline-flex; align-items: center; gap: 6px; }
.chip::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .85; flex: none; }
.chip.oc-anul::before, .exp-proj::before { display: none; }
td .chip + .chip { margin-top: 4px; }
.exp-proj { border-radius: 999px; }

/* Pestañas como control segmentado */
.tabs { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--surface2); border-radius: 14px; max-width: 100%; }
.tab { font-family: var(--body); font-size: 13.5px; font-weight: 600; letter-spacing: 0; text-transform: none; border: 0; border-radius: 11px; padding: 7px 14px; min-height: 34px; color: var(--text2); background: transparent;
  transition: background-color .2s var(--ease-out), color .2s var(--ease-out), box-shadow .2s var(--ease-out), transform .12s var(--ease-out); }
.tab:hover { color: var(--ink); background: rgba(43, 108, 163, .08); }
.tab:active { transform: scale(.97); }
.tab.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(20, 35, 58, .16), 0 0 0 .5px rgba(20, 35, 58, .06); }
.tab .muted { font-variant-numeric: tabular-nums; }
.subnav { margin-bottom: 16px; }

/* Aviso, barra del proyecto */
.projbar { border-left: 0; border-radius: var(--r-md); padding: 9px 14px; background: var(--teal-wash); box-shadow: inset 0 0 0 1px rgba(43, 108, 163, .16); }
.projbar span { font-size: 12px; letter-spacing: .03em; text-transform: none; font-weight: 600; }
.projbar a, .projbar b { font-weight: 700; }
.notice { border-left: 0; border-radius: var(--r-md); padding: 12px 16px; box-shadow: inset 0 0 0 1px rgba(43, 108, 163, .18); }
.notice.warn { box-shadow: inset 0 0 0 1px rgba(197, 138, 27, .35); }
.empty { padding: 44px 24px; font-size: 15px; }

/* Cuadros de diálogo y avisos: entran con resorte */
dialog { border: 1px solid var(--rule); border-radius: var(--r-lg); box-shadow: var(--sh-3); }
dialog[open] { animation: dlg-in .42s var(--spring) both; }
dialog[open]::backdrop { animation: veil-in .25s var(--ease-out) both; backdrop-filter: blur(6px) saturate(120%); }
dialog .dhead { padding: 22px 26px 0; }
dialog .dbody { padding: 16px 26px 8px; }
dialog .dfoot { padding: 14px 26px 22px; border-top: 1px solid var(--rule-soft); background: var(--surface); }
#toast { border-radius: 14px; padding: 12px 20px; box-shadow: var(--sh-2); transform: translate(-50%, 16px) scale(.96); transition: opacity .2s var(--ease-out), transform .45s var(--spring); backdrop-filter: blur(14px); font-weight: 500; }
#toast.show { transform: translate(-50%, 0) scale(1); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes veil-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes page-in { from { opacity: .55; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.main { animation: page-in .38s var(--ease-out) both; }

/* Acceso */
.gate-box { border-radius: 22px; box-shadow: var(--sh-3); border-color: rgba(255, 255, 255, .08); }
.gate-inner { gap: 18px; }
.gate-inner .btn.primary { width: 100%; min-height: 46px; font-size: 15px; }
.gate-inner label { font-size: 13px; }
.gate { background: radial-gradient(1200px 700px at 50% -10%, #17315A 0%, #0B1626 60%); }

/* Aprobar pagos y otros: botones grandes ya en píldora */
.ap-btn { font-family: var(--body); letter-spacing: 0; text-transform: none; font-size: 16px; font-weight: 600; min-height: 48px; }
.ap-more, .rp-table summary { font-family: var(--body); letter-spacing: 0; text-transform: none; font-size: 13px; font-weight: 600; }

/* Zonas con borde de desplazamiento: sombra suave cuando una tabla se puede mover */
.tablewrap { background-image: linear-gradient(to right, var(--surface), var(--surface)), linear-gradient(to right, var(--surface), var(--surface)), linear-gradient(to right, rgba(20, 35, 58, .14), rgba(20, 35, 58, 0)), linear-gradient(to left, rgba(20, 35, 58, .14), rgba(20, 35, 58, 0));
  background-position: left center, right center, left center, right center; background-repeat: no-repeat; background-size: 24px 100%, 24px 100%, 14px 100%, 14px 100%; background-attachment: local, local, scroll, scroll; background-color: var(--surface); }

/* Móvil: cabecera compacta, menú que se desliza con borde difuminado, zonas táctiles de 44 px */
@media (max-width: 900px) {
  .rail { position: sticky; top: 0; z-index: 30; height: auto; background: rgba(11, 22, 38, .88); backdrop-filter: blur(18px) saturate(160%); -webkit-backdrop-filter: blur(18px) saturate(160%); border-right: 0; border-bottom: 1px solid rgba(255, 255, 255, .08); display: grid; grid-template-columns: 1fr auto; align-items: center; }
  .brand { padding: 10px 14px 6px; grid-column: 1; } .brand img { max-width: 118px; }
  .rail .who { grid-column: 2; grid-row: 1; padding: 6px 14px 0 0; border: 0; display: flex; gap: 12px; align-items: center; margin: 0; }
  .rail .who > :first-child { display: none; }
  .rail nav { grid-column: 1 / -1; display: flex; gap: 4px; overflow-x: auto; padding: 4px 10px 10px; scrollbar-width: none; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); }
  .rail nav::-webkit-scrollbar { display: none; }
  .rail a.nav, .rail span.nav { white-space: nowrap; min-height: 44px; border-bottom: 0; padding: 10px 14px; }
  .rail a.nav[aria-current="page"] { border-bottom: 0; }
  .rail .navgroup { display: none; }
  .main { padding: 18px 16px 56px; animation-duration: .3s; }
  h1 { font-size: 30px; }
  .summary > div { padding: 14px 16px; } .summary .v { font-size: 24px; }
  .btn, .tab { min-height: 44px; } .btn.small { min-height: 40px; padding: 7px 14px; } .btn.link { min-height: 40px; }
  input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], input[type=tel], select { min-height: 46px; font-size: 16px; }
  dialog { width: calc(100vw - 16px); max-height: calc(100vh - 16px); border-radius: 20px; }
  dialog .dhead, dialog .dbody, dialog .dfoot { padding-left: 18px; padding-right: 18px; }
  .tabs { display: flex; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; } .tabs::-webkit-scrollbar { display: none; } .tab { white-space: nowrap; }
}

/* Modo oscuro automático (según el celular o el computador). Se respeta si hay un proyecto con marca. */
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0B1626; --surface: #12213A; --surface2: #1A2E4D;
    --ink: #EEF1F4; --text2: #C3CEDB; --muted: #A3B1C2; --muted2: #8E9DB3; --faint: #5E6F86;
    --rule: #25385A; --rule-soft: #1B2B46; --line2: #34496C;
    --teal: #7FB3D5; --teal-dark: #A9CBE4; --teal-wash: rgba(127, 179, 213, .12);
    --accent-ink: #0B1626; --hielo: #CFE3F3;
    --danger: #E58A8A; --warn: #E6C17A; --ok: #7FC8A9; --reserved: rgba(127, 179, 213, .08);
    --sh-1: 0 1px 2px rgba(0, 0, 0, .35); --sh-2: 0 8px 24px rgba(0, 0, 0, .45); --sh-3: 0 24px 64px rgba(0, 0, 0, .6);
  }
  html { color-scheme: dark; }
  body, .gate { background: var(--paper); }
  .gate { background: radial-gradient(1200px 700px at 50% -10%, #17315A 0%, #0B1626 60%); }
  input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=month], input[type=search], input[type=tel], input[type=url], select, textarea { background: var(--paper); }
  th, tr.total td, tr.group td { background: var(--surface); }
  tr.group td { background: rgba(127, 179, 213, .08); }
  tr.chapter:hover td, tbody tr:not(.total):hover td { background: rgba(127, 179, 213, .08); }
  .cell:hover, .cell:focus { background: var(--paper); }
  .btn.primary { color: var(--accent-ink); }
  .tab.on { background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .5), 0 0 0 .5px rgba(255, 255, 255, .08); }
  .tab:hover { background: rgba(127, 179, 213, .1); }
  .chip.s-pending { color: var(--warn); } .chip.s-verified { color: var(--ok); } .chip.s-observed, .chip.s-issue { color: var(--danger); }
  .notice.warn { color: var(--ink); }
  #toast { background: rgba(238, 241, 244, .96); color: #0B1626; }
  dialog::backdrop { background: rgba(0, 0, 0, .6); }
  .tablewrap { background-image: linear-gradient(to right, var(--surface), var(--surface)), linear-gradient(to right, var(--surface), var(--surface)), linear-gradient(to right, rgba(0, 0, 0, .35), rgba(0, 0, 0, 0)), linear-gradient(to left, rgba(0, 0, 0, .35), rgba(0, 0, 0, 0)); }
  .rail { background: linear-gradient(180deg, #0D1B31 0%, #091322 100%); }
  .projbar { box-shadow: inset 0 0 0 1px rgba(127, 179, 213, .22); }
  body.branded .main, body.branded.bgdark .main { background: rgba(11, 22, 38, .94); }
  .rp-lab, .rp-val { fill: var(--ink); }
}

/* Accesibilidad: respetar movimiento reducido, transparencia reducida y alto contraste */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  dialog[open], .main { animation: none; }
  .btn:active, .tab:active, .rail a.nav:active { transform: none; }
  #toast, #toast.show { transform: translate(-50%, 0); }
}
@media (prefers-reduced-transparency: reduce) {
  .rail { background: #0B1626 !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
  #toast, dialog::backdrop { backdrop-filter: none !important; }
}
@media (prefers-contrast: more) {
  :root { --rule: #8CA0B8; --line2: #6B819C; --muted: #3B4D66; --muted2: #3B4D66; }
  .tablewrap, .summary, .params, .rp-card, .rp-tile, .oc-card, dialog { border-color: var(--line2); }
  .btn { border-width: 2px; }
}

/* Ajustes finos del rediseño */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-align: center; }
.btn.link { display: inline; }
td a:not(.btn), .tablewrap a:not(.btn) { text-decoration: none; font-weight: 600; }
td a:not(.btn):hover, .tablewrap a:not(.btn):hover { text-decoration: underline; text-underline-offset: 3px; }
.main input[type=search], .sup-bar input[type=search], .oc-search, .main input.search { border-radius: 999px; padding-left: 16px; }
.lockbar, .lockbar.mine, .lockbar.other { border-radius: var(--r-md); }
.back { font-weight: 600; text-decoration: none; display: inline-flex; gap: 4px; margin-bottom: 14px; }
.back:hover { text-decoration: underline; text-underline-offset: 3px; }
td a:not(.btn), .tablewrap a:not(.btn) { font-stretch: 100%; }
@media (prefers-color-scheme: dark) {
  .tabs { background: rgba(255, 255, 255, .07); }
  .tab.on { background: #2B4770; color: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .5), inset 0 0 0 .5px rgba(255, 255, 255, .14); }
}
@media (max-width: 900px) { td.muted, td.num, td.money { white-space: nowrap; } }

/* Revisión pantalla por pantalla */
.btn.link, .btn.link:hover { letter-spacing: 0; font-size: 14px; }
.h2-note { font-family: var(--body); font-stretch: 100%; font-size: 12.5px; font-weight: 500; color: var(--muted); letter-spacing: 0; text-transform: none; margin-left: 8px; }
#sup-projects { margin-bottom: 20px; }
#sup-projects .toolbar { align-items: center; }
#sup-projects select { width: auto; min-width: 260px; flex: 0 1 320px; }
.sup-grid { gap: 20px; }
.empty::before { content: ''; display: block; width: 44px; height: 44px; margin: 0 auto 12px; border-radius: 50%; background: var(--teal-wash); box-shadow: inset 0 0 0 1px rgba(43, 108, 163, .2); }
.trk-bl li { border-left: 0; border-radius: var(--r-sm); padding: 8px 12px; box-shadow: inset 3px 0 0 #C84F4F; }
.trk-bl li.soon { box-shadow: inset 3px 0 0 #C58A1B; }
.trk-dots i { width: 9px; height: 9px; }
.field small .btn { margin: 4px 6px 4px 0; vertical-align: middle; }
.rp-grid, .rp-tiles { gap: 14px; }
body.branded .main, body.branded.bgdark .main { border-radius: var(--r-lg); }
.oc-h, h3.oc-h, .oc-h h3 { font-family: var(--body); font-stretch: 100%; font-size: 12.5px; font-weight: 600; letter-spacing: .02em; text-transform: none; color: var(--muted); line-height: 1.3; }
.tabs { display: flex; width: fit-content; }
.kv { align-items: baseline; }

/* Revisión móvil (entrega BJ) */
@media (max-width: 900px) {
  .layout { grid-template-rows: auto 1fr; }
  .empty, td.empty, td[colspan] { white-space: normal; overflow-wrap: anywhere; }
  td[colspan] { min-width: 0; }
}
@media (max-width: 900px) { tr:has(> td.empty) { display: block; } td.empty { display: block; box-sizing: border-box; width: calc(100vw - 30px); padding: 28px 16px; text-align: center; } }

/* Librería de contratos y editor de texto (entrega BK) */
.ed-doc { display: grid; gap: 8px; margin: 12px 0 16px; padding: 18px 16px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-md); max-height: min(58vh, 560px); overflow-y: auto; }
.ed-p { position: relative; display: grid; grid-template-columns: 1fr; gap: 4px; }
.ed-p.li { grid-template-columns: 22px 1fr; padding-left: 8px; }
.ed-p.li .ed-ctl { grid-column: 2; }
.ed-mark { color: var(--muted); padding-top: 9px; text-align: right; }
.ed-p textarea { width: 100%; box-sizing: border-box; resize: none; overflow: hidden; min-height: 38px; padding: 8px 10px; font: 14.5px/1.5 var(--body); border: 1px solid transparent; border-radius: var(--r-sm); background: transparent; color: var(--ink); transition: border-color .15s, background .15s; }
.ed-p textarea:hover { border-color: var(--rule); }
.ed-p textarea:focus { border-color: var(--teal); background: var(--bg, #fff); outline: none; box-shadow: 0 0 0 3px rgba(42, 106, 161, .15); }
.ed-p.h0 textarea { font-weight: 800; font-size: 18px; text-align: center; }
.ed-p.h1 textarea { font-weight: 700; font-size: 15.5px; }
.ed-p.ctr textarea { text-align: center; }
.ed-p textarea.ed-warn { border-color: var(--danger, #b3261e); background: rgba(179, 38, 30, .06); }
.ed-ctl { display: flex; gap: 10px; opacity: .0; transition: opacity .15s; padding-left: 6px; }
.ed-p:hover .ed-ctl, .ed-p:focus-within .ed-ctl { opacity: 1; }
@media (hover: none) { .ed-ctl { opacity: 1; } }
.ed-tbl table { width: 100%; }
.ed-tbl td { vertical-align: top; padding: 4px; }
.ed-bar { position: sticky; top: 0; z-index: 2; }
@media (max-width: 900px) { .ed-doc { padding: 10px 8px; max-height: 52vh; } .ed-p.li { grid-template-columns: 16px 1fr; padding-left: 0; } }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ed-p textarea:focus { background: rgba(255, 255, 255, .04); } }
.ed-p { padding-top: 2px; }
.ed-ctl { position: absolute; right: 4px; top: -12px; z-index: 1; padding: 2px 8px; background: var(--surface); border: 1px solid var(--rule); border-radius: 999px; box-shadow: var(--sh-1); }
.ed-p.li .ed-ctl { grid-column: auto; }
@media (hover: none) { .ed-ctl { position: static; border: 0; box-shadow: none; background: none; } }
#lib-proj { max-width: 340px; } .toolbar #lib-q { max-width: 260px; }
@media (max-width: 900px) { .tplt td:first-child, #lib-body td:first-child { min-width: 190px; } }

/* Ayuda guiada (entrega BL) */
#help-fab { position: fixed; right: 18px; bottom: 18px; z-index: 40; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px 0 8px; border: 0; border-radius: 999px; background: var(--teal, #2A6AA1); color: #fff; font: 600 14px var(--body); cursor: pointer; box-shadow: var(--sh-3, 0 8px 24px rgba(15, 29, 51, .28)); transition: transform .2s var(--ease-out, ease), box-shadow .2s; }
#help-fab span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: rgba(255, 255, 255, .22); font-weight: 800; font-size: 16px; }
#help-fab:hover { transform: translateY(-2px); }
#help-fab:active { transform: scale(.97); }
#help-root.open #help-fab { display: none; }
#help-panel { position: fixed; right: 18px; bottom: 18px; z-index: 45; width: min(390px, calc(100vw - 24px)); height: min(620px, calc(100vh - 36px)); display: flex; flex-direction: column; background: var(--surface, #fff); border: 1px solid var(--rule); border-radius: 18px; box-shadow: var(--sh-3, 0 16px 48px rgba(15, 29, 51, .3)); overflow: hidden; animation: hp-in .22s var(--ease-out, ease) both; }
#help-panel[hidden] { display: none; }
@keyframes hp-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
#help-panel > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; background: linear-gradient(180deg, #0F1D33, #0B1626); color: #fff; }
#help-panel > header b { display: block; font-size: 16px; }
#help-panel > header small { color: #9DB4CE; font-size: 12.5px; }
.hp-x { border: 0; background: rgba(255, 255, 255, .12); color: #fff; width: 36px; height: 36px; border-radius: 50%; font-size: 22px; line-height: 1; cursor: pointer; }
.hp-x:hover { background: rgba(255, 255, 255, .22); }
#help-log { flex: 1; overflow-y: auto; padding: 14px 14px 6px; display: flex; flex-direction: column; gap: 8px; background: var(--bg, #F3F6FB); overscroll-behavior: contain; }
.hp-b { max-width: 92%; padding: 10px 13px; border-radius: 14px; font-size: 14px; line-height: 1.5; color: var(--ink); animation: hp-pop .25s var(--ease-out, ease) both; }
@keyframes hp-pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.hp-bot { align-self: flex-start; background: var(--surface, #fff); border: 1px solid var(--rule); border-bottom-left-radius: 4px; }
.hp-me { align-self: flex-end; background: var(--teal, #2A6AA1); color: #fff; border-bottom-right-radius: 4px; }
.hp-steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.hp-tip { margin: 10px 0 0; padding: 8px 10px; background: var(--teal-wash, #E6EEF8); border-radius: 10px; font-size: 13px; }
.hp-choices { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 4px; animation: hp-pop .25s var(--ease-out, ease) both; }
.hp-choices.col { flex-direction: column; align-items: stretch; }
.hp-ch { text-align: left; padding: 9px 13px; min-height: 40px; border: 1px solid var(--teal, #2A6AA1); background: var(--surface, #fff); color: var(--teal-dark, #1F5584); border-radius: 999px; font: 600 13.5px var(--body); cursor: pointer; transition: background .15s, transform .12s; }
.hp-choices.col .hp-ch { border-radius: 14px; }
.hp-ch:hover:not(:disabled) { background: var(--teal-wash, #E6EEF8); }
.hp-ch:active:not(:disabled) { transform: scale(.98); }
.hp-ch.ghost { border-color: var(--rule); color: var(--muted); font-weight: 500; }
.hp-ch:disabled { opacity: .55; cursor: default; }
.hp-ch.on { background: var(--teal, #2A6AA1); color: #fff; opacity: 1; }
.hp-ask { display: grid; gap: 8px; padding: 12px; background: var(--surface, #fff); border: 1px solid var(--rule); border-radius: 14px; }
.hp-ask textarea, .hp-ask input { width: 100%; box-sizing: border-box; font: 14px var(--body); padding: 9px 11px; border: 1px solid var(--rule); border-radius: 10px; background: var(--bg, #fff); color: var(--ink); }
.hp-row { display: flex; gap: 8px; }
.hp-err { margin: 0; color: var(--danger, #b3261e); font-size: 13px; min-height: 0; }
#help-search { display: flex; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid var(--rule); background: var(--surface, #fff); }
#help-search input { flex: 1; min-width: 0; font: 14px var(--body); padding: 9px 12px; border: 1px solid var(--rule); border-radius: 999px; background: var(--bg, #fff); color: var(--ink); }
@media (max-width: 900px) {
  #help-fab { right: 12px; bottom: 12px; }
  #help-panel { right: 0; bottom: 0; width: 100vw; height: min(86vh, 100%); border-radius: 18px 18px 0 0; }
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) #help-log { background: #0C1624; } :root:not([data-theme="light"]) .hp-bot { background: #14233A; } }
@media (prefers-reduced-motion: reduce) { #help-panel, .hp-b, .hp-choices { animation: none; } }
@media print { #help-root { display: none; } }
@media (max-width: 900px) { .gate { padding-bottom: 84px; } }

/* Chat de ayuda: botón de WhatsApp (entrega BS) */
.hp-ch.hp-wa { display: inline-flex; align-items: center; text-decoration: none; background: #1f8f4e; border-color: #1f8f4e; color: #fff; }
.hp-ch.hp-wa:hover { background: #187a42; }

/* Invitar desde Excel: filtro por proyecto en la lista */
.sup-bar select#sup-proj { max-width: 240px; padding: 8px 12px; }

/* Lista de proveedores: todos los proyectos, una etiqueta por línea (entrega CA) */
.proj-list { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; max-width: 250px; }
.proj-tag { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 3px 9px; border-radius: 6px; background: var(--teal-wash); border: 1px solid rgba(43, 108, 163, .30); color: var(--teal-dark); font-size: 12.5px; font-weight: 600; }

/* Prenómina: casilla de selección en la lista de órdenes */
.pn-sel { width: 34px; text-align: center; }
.pn-sel input { width: 17px; height: 17px; cursor: pointer; }

/* Usuarios: grupos por proyecto y ventanas de consulta */
.ugroup { border: 1px solid var(--rule); background: var(--surface); margin: 0 0 8px; }
.ugroup > summary { cursor: pointer; padding: 12px 16px; list-style: revert; }
.ugroup[open] > summary { border-bottom: 1px solid var(--rule); }
.ugroup .tablewrap { margin: 0; border: 0; }
.ubuttons { display: flex; flex-wrap: wrap; gap: 8px; margin: 28px 0 8px; padding-top: 18px; border-top: 1px solid var(--rule); }
dialog.vpanel { width: min(1000px, calc(100vw - 24px)); }
.vp-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--rule); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.vp-head h2 { margin: 0; }
.vp-x { border: 0; background: none; font-size: 28px; line-height: 1; cursor: pointer; color: var(--ink); padding: 0 4px; }
.vp-x:hover { color: var(--accent, var(--ink)); }
dialog.vpanel .dbody { padding-bottom: 20px; }
