/* Mockups v2.1 de epzo. Marca Enlace: crema de base, petróleo para la acción, menta para lo que leyó el agente, arcilla solo como acento. */
/* Layout: menú lateral fijo en cuatro bloques; a la derecha, una barra con el rubro y una pantalla por sección. Un solo tema, claro, por decisión de marca. */
:root {
  --cream: #F5F0E7; --surface: #FFFDF8; --ink: #17352F; --petrol: #075E59; --mint: #D4E9DC; --clay: #B84A32;
  --muted: #4F655F; --line: rgba(23, 53, 47, .16); --line2: rgba(23, 53, 47, .09); --wash: rgba(23, 53, 47, .06);
  --ok: #166534; --ok-bg: #E1F0E4; --warn: #92400E; --warn-bg: #FBEFD5; --bad: #B91C1C; --bad-bg: #FBE7E4;
  --paper: #FFFFFF; --paper-ink: #2B2B2B; --paper-muted: #6F6F6F; --chat: #EAE3D5;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif; --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --r: 20px; --r2: 12px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--cream); color: var(--ink); font: 400 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--petrol); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--petrol); outline-offset: 2px; }
h1, h2, h3, p, ul, ol, figure, dl { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }

/* Estructura */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100%; }
.nav { position: sticky; top: 0; align-self: start; height: 100vh; overflow: auto; display: flex; flex-direction: column; gap: 2px; padding: 22px 14px 20px max(18px, env(safe-area-inset-left, 0px)); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 10px; color: var(--ink); font-weight: 600; font-size: 24px; letter-spacing: -.5px; }
.brand:hover { text-decoration: none; }
.nav-g { margin: 16px 10px 6px; font: 500 11px/1 var(--mono); letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted); }
.nav-i { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; color: var(--ink); }
.nav-i:hover { background: var(--wash); text-decoration: none; }
.nav-i.active { background: var(--ink); color: var(--cream); }
.count { min-width: 24px; padding: 4px 8px; border-radius: 999px; background: var(--clay); color: var(--surface); font: 500 12px/1 var(--sans); text-align: center; font-variant-numeric: tabular-nums; }
.nav-foot { margin-top: auto; padding: 18px 10px 0; font-size: 12.5px; color: var(--muted); }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px max(32px, env(safe-area-inset-right, 0px)) 14px 32px; border-bottom: 1px solid var(--line); }
.menu-btn { display: none; }
.rubros { display: flex; gap: 2px; padding: 4px; border-radius: 999px; background: var(--wash); max-width: 100%; overflow-x: auto; }
.rubro { padding: 6px 14px; border-radius: 999px; color: var(--ink); font-weight: 500; font-size: 14px; white-space: nowrap; }
.rubro:hover { text-decoration: none; background: var(--line2); }
.rubro.active { background: var(--surface); box-shadow: 0 1px 2px rgba(23, 53, 47, .14); }
.who { margin-left: auto; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 14px; }
.company { color: var(--muted); }
.demo { padding: 5px 9px; border: 1px dashed rgba(23, 53, 47, .4); border-radius: 999px; font: 500 10.5px/1 var(--mono); letter-spacing: 1px; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.user { display: flex; align-items: center; gap: 8px; }
.user i { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--petrol); color: var(--cream); font-style: normal; font-weight: 500; font-size: 13px; }
.view { width: 100%; max-width: 1180px; padding: 36px max(32px, env(safe-area-inset-right, 0px)) 72px 32px; display: flex; flex-direction: column; gap: 28px; }

/* Texto */
.head { display: flex; flex-direction: column; gap: 8px; }
.eyebrow { font: 500 11.5px/1.2 var(--mono); letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted); }
.eyebrow a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
h1 { max-width: 36ch; font-size: 34px; line-height: 1.14; font-weight: 300; letter-spacing: -.02em; text-wrap: balance; }
h1 span { display: inline-block; }
.sub { max-width: 72ch; color: var(--muted); font-size: 16px; }
h2 { margin-bottom: 10px; font-size: 17px; line-height: 1.3; font-weight: 500; }
h3 { font-size: 18px; line-height: 1.3; font-weight: 500; }
.muted, .hint, .empty { color: var(--muted); }
.muted, .hint { font-size: 13.5px; }
.hint { margin-top: 8px; }
.mono { font-family: var(--mono); font-size: 13px; }
.nowrap { white-space: nowrap; }
.strong { color: var(--ink); font-weight: 500; font-size: 16px; }
.notice { padding: 12px 16px; border-radius: var(--r2); background: var(--mint); font-weight: 500; }
.alert { padding: 12px 16px; border-radius: var(--r2); background: var(--warn-bg); color: var(--warn); }
.alert a { color: inherit; text-decoration: underline; }

/* Piezas */
.tag { display: inline-block; padding: 4px 7px; border-radius: 6px; background: var(--wash); font: 500 10.5px/1 var(--mono); letter-spacing: 1px; text-transform: uppercase; white-space: nowrap; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--wash); font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.mint { background: var(--mint); }
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 9px 18px; border: 1.5px solid var(--ink); border-radius: 999px; background: transparent; color: var(--ink); font-weight: 500; font-size: 14px; cursor: pointer; white-space: nowrap; }
.btn:hover { text-decoration: none; background: var(--wash); }
.btn.primary { border-color: var(--petrol); background: var(--petrol); color: var(--surface); }
.btn.primary:hover { background: var(--ink); border-color: var(--ink); }
.btn.ghost { border-color: rgba(23, 53, 47, .32); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 6px 12px; border: 1px solid rgba(23, 53, 47, .28); border-radius: 999px; background: transparent; font-size: 13.5px; cursor: pointer; }
.chip:hover { background: var(--wash); }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--cream); }
input, select, textarea { padding: 9px 12px; border: 1px solid rgba(23, 53, 47, .28); border-radius: var(--r2); background: var(--surface); font-size: 14px; }
textarea { width: 100%; resize: vertical; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
#q { width: min(300px, 100%); }
.block { padding: 22px; border-radius: var(--r); background: var(--surface); }
.block.mint { background: var(--mint); }
.block-h { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.block-h p { max-width: 60ch; }
.plain { padding-left: 18px; list-style: disc; }
.plain li { margin: 4px 0; }
.plain + p, .plain + h2 { margin-top: 14px; }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; }

/* Tablas */
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.scroll table { min-width: 620px; }
th { padding: 8px 10px; text-align: left; font: 500 10.5px/1.2 var(--mono); letter-spacing: 1px; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
td { padding: 10px; border-top: 1px solid var(--line2); vertical-align: top; }
.block.mint td { border-color: rgba(23, 53, 47, .14); }
td small { display: block; color: var(--muted); font-size: 12.5px; }
td time, .log time { font: 400 12.5px/1.6 var(--mono); color: var(--muted); }
.short { width: 120px; }

/* Dashboard */
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.kpi { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 18px; border-radius: var(--r); background: var(--surface); color: var(--ink); }
.kpi:hover { text-decoration: none; background: var(--mint); }
.kpi b { font-size: 32px; line-height: 1.1; font-weight: 300; font-variant-numeric: tabular-nums; }
.kpi span { font-weight: 500; font-size: 14px; }
.kpi small { color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.kpi em { position: absolute; top: 16px; right: 16px; font: 500 9.5px/1 var(--mono); letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.phases { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.ph { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border: 0; border-right: 1px solid var(--line2); background: transparent; text-align: left; cursor: pointer; }
.ph:hover { background: var(--mint); }
.ph b { font-size: 26px; line-height: 1.1; font-weight: 300; font-variant-numeric: tabular-nums; }
.ph span { font-size: 13px; color: var(--muted); }
.rows li a { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line2); color: var(--ink); }
.rows li a > span:not(.tag):not(.pill):not(.muted) { flex: 1; min-width: 0; }
.log li { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line2); }
.log + p { margin-top: 12px; }

/* Aprobaciones y revisión */
.ap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.ap-main { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.ap-main p { color: var(--muted); font-size: 13.5px; }
.ap-side { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.due { color: var(--warn); font-size: 13.5px; font-weight: 500; }
.steps { display: flex; }
.steps li { flex: 1; padding-top: 10px; border-top: 3px solid var(--line); font-size: 13px; color: var(--muted); }
.steps .done { border-color: var(--petrol); color: var(--ink); }
.steps .now { border-color: var(--ink); color: var(--ink); font-weight: 500; }
.review { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 36px; align-items: start; }
.paper { padding: 22px; border-radius: 6px; background: var(--paper); color: var(--paper-ink); font: 400 13px/1.4 var(--mono); box-shadow: 0 12px 32px rgba(23, 53, 47, .14); transform: rotate(-.5deg); }
.paper header { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 2px solid var(--paper-ink); }
.p-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 6px; border-bottom: 1px dashed rgba(0, 0, 0, .18); border-radius: 4px; cursor: pointer; }
.p-row span { color: var(--paper-muted); }
.p-row em { font-style: normal; font-weight: 500; text-align: right; }
.p-row.duda em { filter: blur(.7px); opacity: .75; }
.p-row.mal em { width: 96px; height: 15px; border-radius: 3px; background: rgba(0, 0, 0, .28); filter: blur(3px); }
.paper footer { display: flex; align-items: flex-end; gap: 10px; margin-top: 20px; color: var(--paper-muted); }
.paper footer i { width: 110px; height: 22px; border-bottom: 1.5px solid var(--paper-ink); }
.paper figcaption { margin-top: 16px; font: 400 12px/1.4 var(--sans); color: var(--paper-muted); }
.fields { display: flex; flex-direction: column; gap: 8px; }
.field { padding: 12px 14px; border-radius: var(--r2); background: var(--surface); cursor: pointer; }
.field.duda { background: var(--warn-bg); }
.field.mal { background: var(--bad-bg); }
.field.hot, .p-row.hot { outline: 2px solid var(--petrol); outline-offset: 1px; }
.p-row.hot { background: var(--mint); }
.f-main { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.f-k { color: var(--muted); font-size: 13px; }
.f-v { font-weight: 500; text-align: right; }
.f-conf { margin-top: 4px; font-size: 13px; color: var(--muted); }
.f-conf b { font-weight: 500; color: var(--ok); }
.f-conf b::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: currentColor; }
.duda .f-conf, .duda .f-conf b { color: var(--warn); }
.mal .f-conf, .mal .f-conf b { color: var(--bad); }
.f-fix { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.f-fix input { flex: 1; min-width: 140px; }
.reject { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }

/* Excepciones, agente e integraciones */
.excs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 16px; }
.exc, .integ { display: flex; flex-direction: column; gap: 8px; padding: 20px; border-radius: var(--r); background: var(--surface); }
.exc-h { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 13.5px; }
.proposes { padding: 10px 12px; border-radius: var(--r2); background: var(--mint); }
.exc .actions, .integ .actions { margin-top: auto; padding-top: 8px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tab { padding: 10px 14px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--muted); }
.tab:hover { text-decoration: none; color: var(--ink); }
.tab.on { border-color: var(--ink); color: var(--ink); font-weight: 500; }
.talk { display: flex; flex-direction: column; gap: 10px; min-height: 96px; }
.bubble { max-width: min(560px, 90%); padding: 10px 14px; border-radius: 16px; }
.bubble.me { align-self: flex-end; background: var(--ink); color: var(--cream); }
.bubble.bot { align-self: flex-start; background: var(--mint); }
.bubble.bot a { text-decoration: underline; }
.bubble.bot ul { padding-left: 18px; margin-top: 6px; list-style: disc; }
.ask { display: flex; gap: 10px; }
.ask input { flex: 1; min-width: 0; }
.tpls { display: grid; gap: 14px; margin-top: 14px; }
.tpl { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.tpl label { font-weight: 500; }
.integs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(196px, 100%), 1fr)); gap: 14px; }
.integ.falla { box-shadow: inset 0 0 0 1.5px var(--bad); }
.integ .demo { margin-left: auto; }
.phone { display: flex; flex-direction: column; gap: 10px; max-width: 360px; padding: 18px; border-radius: 26px; background: var(--chat); }
.phone-h { font-weight: 500; }
.bubble.in { align-self: flex-start; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; background: var(--surface); }
.bubble.out { align-self: flex-end; display: flex; flex-direction: column; gap: 4px; background: var(--mint); }
.bubble time { align-self: flex-end; font: 400 11px/1 var(--mono); color: var(--muted); }
.thumb { display: block; width: 150px; padding: 10px; border-radius: 6px; background: var(--paper); color: var(--paper-ink); box-shadow: 0 4px 12px rgba(23, 53, 47, .14); }
.thumb b { font: 500 10px/1 var(--mono); }
.thumb i { display: block; height: 5px; margin-top: 7px; border-radius: 3px; background: rgba(0, 0, 0, .16); }

/* Fichas */
.facts > div { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line2); }
.facts dt { color: var(--muted); font-size: 13.5px; }
.facts dd { margin: 0; }
.phases-v { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.phases-v li { display: flex; flex-direction: column; gap: 6px; padding-top: 12px; border-top: 4px solid var(--line); }
.phases-v b { font-weight: 500; font-size: 14px; color: var(--muted); }
.phases-v .done { border-color: var(--petrol); }
.phases-v .now { border-color: var(--clay); }
.phases-v .done b, .phases-v .now b { color: var(--ink); }
.doc-chip { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 8px 10px; border-radius: 10px; background: var(--surface); color: var(--ink); font-size: 13px; }

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .nav { display: none; position: static; height: auto; padding: 16px max(16px, env(safe-area-inset-right, 0px)) 12px max(16px, env(safe-area-inset-left, 0px)); border-right: 0; border-bottom: 1px solid var(--line); }
  .nav.open { display: flex; }
  .menu-btn { display: inline-flex; padding: 7px 14px; border: 1.5px solid var(--ink); border-radius: 999px; background: transparent; font-weight: 500; cursor: pointer; }
  .top { padding: 12px max(16px, env(safe-area-inset-right, 0px)) 12px max(16px, env(safe-area-inset-left, 0px)); }
  .who { margin-left: 0; }
  .company { display: none; }
  .view { padding: 24px max(16px, env(safe-area-inset-right, 0px)) 56px max(16px, env(safe-area-inset-left, 0px)); gap: 24px; }
  h1 { font-size: 26px; }
  .cols, .review { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .phases { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ph { border-bottom: 1px solid var(--line2); }
  .phases-v { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .facts > div { grid-template-columns: 110px minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scroll table.cfg { min-width: 0; }
  .cfg tr { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line2); }
  .cfg td { padding: 0; border: 0; }
  .paper { transform: none; }
}
@media (prefers-reduced-motion: no-preference) { .btn, .chip, .nav-i, .kpi, .ph { transition: background-color .15s ease; } }

/* Línea de tiempo del viaje */
.tl { position: relative; display: flex; flex-direction: column; }
.tl li { position: relative; display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 14px; padding: 0 0 18px 22px; }
.tl li::before { content: ""; position: absolute; left: 5px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); box-shadow: inset 0 0 0 2px var(--line); }
.tl li::after { content: ""; position: absolute; left: 9.5px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.tl li:last-child::after { display: none; }
.tl time { font: 400 12.5px/1.6 var(--mono); color: var(--muted); }
.tl b { font-weight: 500; }
.tl .done::before { background: var(--petrol); box-shadow: none; }
.tl .now::before { background: var(--clay); box-shadow: 0 0 0 4px rgba(184, 74, 50, .18); }
.tl .wait::before { background: var(--warn-bg); box-shadow: inset 0 0 0 2px var(--warn); }
.tl .next b, .tl .next time { color: var(--muted); font-weight: 400; }
.tl-docs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
h2.gap { margin-top: 24px; }

/* WhatsApp del chofer */
.wa { max-width: 380px; border-radius: 30px; overflow: hidden; background: var(--chat); box-shadow: 0 0 0 8px var(--ink), 0 18px 40px rgba(23, 53, 47, .2); }
.wa-h { display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: var(--petrol); color: var(--surface); }
.wa-h i { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--surface); color: var(--petrol); font-style: normal; font-weight: 600; }
.wa-h b { display: block; font-weight: 500; font-size: 14px; }
.wa-h small { font-size: 12px; opacity: .8; }
.wa-body { display: flex; flex-direction: column; gap: 8px; min-height: 380px; padding: 14px; }
.wa-day { align-self: center; padding: 3px 10px; border-radius: 8px; background: var(--surface); font-size: 12px; color: var(--muted); }
.wa .bubble { max-width: 85%; }
.wa-f { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 14px 16px; }
.wa-f > span { flex: 1; min-width: 80px; padding: 8px 14px; border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 13px; }
.wa-steps { counter-reset: s; display: flex; flex-direction: column; gap: 12px; }
.wa-steps li { counter-increment: s; position: relative; padding-left: 34px; color: var(--muted); }
.wa-steps li::before { content: counter(s); position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--wash); font-size: 12px; font-weight: 500; }
.wa-steps li.done { color: var(--ink); }
.wa-steps li.done::before { background: var(--petrol); color: var(--surface); }
@media (max-width: 900px) { .tl li { grid-template-columns: 80px minmax(0, 1fr); } }

.liq td { white-space: nowrap; }
.liq td:nth-child(2) { white-space: normal; min-width: 150px; }
.liq { min-width: 860px; }
