
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1.0625rem/1.5 var(--body); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p, ol, ul, dl, dd, fieldset { margin: 0; padding: 0; }
ol, ul { list-style: none; }
fieldset { border: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--ultra); outline-offset: 2px; }
.side :focus-visible { outline-color: var(--ultra); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.sprite { position: absolute; width: 0; height: 0; }

h1, h2, h3 { font-family: var(--display); font-weight: 800; line-height: 1; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.strong { font-weight: 700; }
.muted { color: var(--steel); font-weight: 400; font-size: .9375rem; }

/* Estructura */
#app { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100svh; }
.side {
  background: var(--white); color: var(--ink); box-shadow: 1px 0 0 var(--line); padding: 24px 16px;
  display: flex; flex-direction: column; gap: 28px;
  position: sticky; top: 0; height: 100svh;
}
.brand { font: 800 2rem/1 var(--stencil); text-decoration: none; padding-inline: 12px; }
.side nav { display: grid; gap: 2px; }
.side nav a {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: 3px; font-weight: 600; text-decoration: none;
}
.side nav a:hover { background: var(--paper); }
.side nav a[aria-current="page"] { background: var(--vis); color: var(--ink); }
.badge { background: var(--ultra); color: var(--white); font-size: .875rem; font-weight: 700; min-width: 24px; text-align: center; border-radius: 12px; padding: 0 7px; }
.side-foot { margin-top: auto; display: grid; gap: 10px; }
.who { padding-inline: 12px; font-size: .9375rem; line-height: 1.25; }
.role { display: flex; background: var(--paper); border-radius: 3px; padding: 3px; gap: 3px; }
.role button { flex: 1; border: 0; background: none; color: var(--ink); padding: 7px 2px; font-size: .9375rem; font-weight: 600; border-radius: 2px; }
.role button[aria-pressed="true"] { background: var(--ultra); color: var(--white); }

.content { min-width: 0; }
.demo-bar { background: #DBEAFE; color: var(--ink); padding: 6px clamp(16px, 3vw, 40px); font-size: .9375rem; display: flex; justify-content: space-between; align-items: center; gap: 16px; position: relative; z-index: 20; }
.bell { flex: none; position: relative; }
.bell summary { cursor: pointer; font-weight: 700; display: flex; align-items: center; gap: 6px; list-style: none; }
.bell summary::-webkit-details-marker { display: none; }
.bell-panel {
  position: absolute; right: 0; top: calc(100% + 10px); width: min(340px, calc(100vw - 32px)); background: var(--white); color: var(--ink);
  border-radius: 4px; box-shadow: 0 14px 34px rgb(15 23 42 / .3); max-height: 380px; overflow-y: auto;
}
.bell-panel a { display: block; padding: 11px 14px; text-decoration: none; border-bottom: 1px solid var(--line); line-height: 1.3; }
.bell-panel a:hover { background: var(--paper); }
.bell-panel span { display: block; font-size: 1rem; }
.bell-panel small { color: var(--steel); }
.bell-panel p { padding: 16px; color: var(--steel); }
main { padding: clamp(20px, 3vw, 40px); max-width: 1320px; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 24px; }
.page-head h1 { font: 900 clamp(2.75rem, 5vw, 4.5rem)/.98 var(--display); }
.page-head p { margin-top: 8px; color: var(--steel); max-width: 44em; }
.page-head .btn { flex: none; }

.btn {
  display: inline-block; border: 0; border-radius: 3px; background: var(--ultra); color: var(--white);
  padding: 11px 20px; font-weight: 700; text-decoration: none; text-align: center;
}
.btn:hover { background: var(--ink); }
.btn.small { padding: 7px 14px; font-size: 1rem; }
.btn.wide { width: 100%; padding-block: 13px; }
.btn.vis { background: var(--vis); color: var(--ink); }
.btn.vis:hover { background: var(--white); }
.btn.ghost { background: none; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.btn.ghost:hover { background: var(--ink); color: var(--white); }
.link { border: 0; background: none; padding: 2px 0; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

.flash { background: var(--vis); padding: 12px 16px; font-weight: 600; margin-bottom: 20px; border-radius: 3px; }
.empty { padding: 28px 0; color: var(--steel); }
.empty .btn { margin-top: 12px; }
.sec { font-size: 2.25rem; margin: 36px 0 14px; }

/* Indicadores */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--white); color: var(--ink); border-radius: 4px; box-shadow: 0 0 0 1px var(--line), 0 1px 3px rgb(15 23 42 / .08); }
.kpis > div { padding: 22px clamp(16px, 2vw, 28px); border-left: 1.5px solid var(--line); }
.kpis > div:first-child { border-left: 0; }
.kpis dd { font: 900 clamp(2.25rem, 3.3vw, 3.5rem)/1 var(--display); color: var(--ultra); font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpis dt { margin-top: 6px; font-size: 1rem; }

.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-top: 20px; align-items: start; }
.cols.wide-left { grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); }
.cols > div { display: grid; gap: 20px; }
.panel { background: var(--white); border-radius: 4px; padding: clamp(16px, 2vw, 26px); margin-top: 20px; }
.cols .panel { margin-top: 0; }
.panel h2 { font-size: 1.875rem; margin-bottom: 14px; }
.panel p + .btn, .panel p + a.btn { margin-top: 14px; }
.stack { display: grid; gap: 14px; justify-items: start; }
.stack .f { width: 100%; }
.stack h2 { margin-bottom: 0; }
.premium { background: var(--ink); color: var(--white); }
.price { font: 900 3.25rem/1 var(--display); color: var(--vis); margin-bottom: 8px; }
.price small { font: 400 1.0625rem var(--body); color: var(--white); }

.mini { display: flex; align-items: center; gap: 12px; padding-block: 12px; border-top: 1px solid var(--line); }
.mini:first-of-type { border-top: 0; padding-top: 0; }
.mini p { color: var(--steel); font-size: 1rem; line-height: 1.3; }
.mini .num { display: grid; justify-items: end; }
.grow { flex: 1; min-width: 0; }

/* Identidad de empresa: un contenedor pequeño */
.tile {
  display: grid; place-items: center; flex: none; width: 58px; height: 58px; border-radius: 3px;
  font: 800 1.625rem/1 var(--stencil);
  background-image: repeating-linear-gradient(90deg, rgb(17 24 39 / .13) 0 3px, transparent 3px 9px);
}
.t0 { background-color: #0870E8; color: var(--white); }
.t1 { background-color: #DBEAFE; color: var(--ink); }
.t2 { background-color: #0EA5E9; color: var(--ink); }
.t3 { background-color: #E5E7EB; color: var(--ink); }
.t4 { background-color: var(--ink); color: var(--white); }

/* Marketplace */
.legs-tabs { display: flex; flex-wrap: wrap; gap: 3px; background: var(--white); border-radius: 3px; padding: 3px; margin-bottom: 20px; }
.legs-tabs button { flex: 1 1 auto; border: 0; background: none; padding: 11px 12px; font-weight: 700; border-radius: 2px; }
.legs-tabs button:hover { background: var(--paper); }
.legs-tabs button[aria-pressed="true"] { background: var(--ultra); color: var(--white); }
.legs-tabs.small { background: var(--paper); margin-bottom: 14px; }
.legs-tabs.small button { padding: 7px 10px; }
.legs-tabs.small button:hover { background: var(--line); }
main > .legs-tabs.small { background: var(--white); }

.market { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 24px; align-items: start; }
.filters { background: var(--white); border-radius: 4px; padding: 20px; display: grid; gap: 18px; position: sticky; top: 20px; justify-items: start; }
.filters .f { width: 100%; }
.f label, .f legend { display: block; font-weight: 600; margin-bottom: 5px; padding: 0; }
.f input:not([type="checkbox"]):not([type="range"]), .f select, .res-bar select, td select {
  width: 100%; height: 44px; padding: 0 10px; background: var(--white);
  border: 1.5px solid var(--steel); border-radius: 3px;
}
.f input[type="range"] { width: 100%; accent-color: var(--ultra); }
.f input[aria-invalid="true"] { border-color: var(--error); }
.f .check { display: flex; align-items: center; gap: 8px; font-weight: 400; margin-bottom: 4px; cursor: pointer; }
.check input { width: 17px; height: 17px; margin: 0; accent-color: var(--ultra); }
.f output { font-weight: 700; }
.err { color: var(--error); font-size: .9375rem; line-height: 1.25; margin-top: 3px; }
.err:empty { display: none; }

.res-bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 10px; }
.res-bar p { font: 800 1.5rem/1 var(--display); }
.res-bar label { display: flex; align-items: center; gap: 8px; color: var(--steel); white-space: nowrap; }
.res-bar select { width: auto; color: var(--ink); }


/* Perfil */
.back { display: inline-block; font-weight: 600; margin-bottom: 14px; }
.profile-band {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; border-radius: 4px 4px 0 0;
  padding: clamp(24px, 4vw, 48px) clamp(18px, 3vw, 36px);
  background-image: repeating-linear-gradient(90deg, rgb(17 24 39 / .1) 0 6px, transparent 6px 24px);
}
.profile-band h1 { font: 800 clamp(3rem, 7vw, 6rem)/.95 var(--stencil); }
.profile-band p { margin-top: 10px; max-width: 34em; font-weight: 500; }
.verified { font-weight: 700; margin: 0 !important; background: var(--white); color: var(--ink); padding: 5px 12px; border-radius: 2px; text-align: center; }
.band-side { display: grid; gap: 8px; flex: none; }
.ghost-light { background: var(--white); color: var(--ink); padding: 7px 14px; }
.ghost-light:hover { background: var(--ink); color: var(--white); }
.ghost-light[aria-pressed="true"] { background: var(--ink); color: var(--white); }
.head-acts { display: flex; flex-wrap: wrap; gap: 8px; flex: none; }
.facts { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); background: var(--white); border-radius: 0 0 4px 4px; }
.facts > div { padding: 16px clamp(14px, 2vw, 26px); border-left: 1px solid var(--line); }
.facts > div:first-child { border-left: 0; }
.facts dd { font: 900 2.5rem/1 var(--display); }
.facts dt { font-size: .9375rem; color: var(--steel); }
.profile { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: clamp(20px, 3vw, 40px); margin-top: 28px; align-items: start; }
.profile h2 { font-size: 2.25rem; margin: 28px 0 10px; }
.profile > div > h2:first-child { margin-top: 0; }
.quote-form { background: var(--white); border-radius: 4px; padding: 22px; display: grid; gap: 14px; position: sticky; top: 20px; }
.quote-form h2 { margin: 0; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.estimate { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; border-top: 1.5px solid var(--ink); padding-top: 12px; }
.estimate b { font: 900 2rem/1 var(--display); color: var(--ultra); }
.hint { font-size: .9375rem; color: var(--steel); line-height: 1.3; }

/* Tablas */
.t { width: 100%; border-collapse: collapse; background: var(--white); border-radius: 4px; overflow: hidden; }
.t th { text-align: left; font-size: .9375rem; font-weight: 600; color: var(--steel); padding: 11px 14px; border-bottom: 1.5px solid var(--ink); }
.t th.num { text-align: right; }
.t td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t small { display: block; color: var(--steel); font-size: .9375rem; }
.panel .t th, .panel .t td { padding-inline: 4px; }
td[data-l="Retiro"] { white-space: nowrap; }
.acts { white-space: nowrap; text-align: right; }
.acts .link { margin-left: 12px; }
td select { min-width: 140px; height: 38px; }

.status { display: inline-block; font-size: .9375rem; font-weight: 700; padding: 2px 9px; border-radius: 2px; white-space: nowrap; }
.s-revision { background: var(--paper); color: var(--steel); }
.s-cotizada { background: var(--vis); color: var(--ink); }
.s-aceptada { background: var(--ultra); color: var(--white); }
.s-rechazada { background: none; color: var(--steel); text-decoration: line-through; }

/* Envíos */
.ship { background: var(--white); border-radius: 4px; padding: clamp(16px, 2vw, 24px); margin-bottom: 14px; }
.ship-top { display: flex; justify-content: space-between; gap: 16px; }
.ship h3 { font-size: 2rem; }
.ship-top p { color: var(--steel); font-size: 1rem; }
.ship-side { display: grid; justify-items: end; gap: 6px; align-content: start; flex: none; }
.ship-side b { font: 900 2rem/1 var(--display); color: var(--ultra); }
.ship-road { margin-top: 12px; }
.ship-lane { position: relative; height: 46px; border-bottom: 10px solid var(--ink); }
.ship-lane::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -7px; height: 3px;
  background: repeating-linear-gradient(90deg, var(--vis) 0 24px, transparent 24px 42px);
}
.ship-lane svg { position: absolute; bottom: -2px; width: 132px; display: block; left: calc(var(--p) * (100% - 132px)); }
.ship-stops { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 7px; font-size: .9375rem; color: var(--steel); }
.ship-stops li:nth-child(2) { text-align: center; transform: translateX(-16%); }
.ship-stops li:nth-child(3) { text-align: center; transform: translateX(16%); }
.ship-stops li:nth-child(4) { text-align: right; }
.ship-stops .on { color: var(--ink); font-weight: 700; }
.ship-log { margin-top: 10px; }
.ship-log summary { cursor: pointer; font-weight: 600; font-size: 1rem; }
.ship-log ol { margin-top: 8px; display: grid; gap: 4px; }
.ship-log li { display: flex; justify-content: space-between; gap: 16px; font-size: 1rem; border-top: 1px solid var(--line); padding-top: 4px; }

/* Solicitudes y flota */
.req { display: flex; justify-content: space-between; gap: 24px; background: var(--white); border-radius: 4px; padding: 20px; margin-bottom: 12px; align-items: center; }
.req h3 { font-size: 2rem; }
.req-main p { color: var(--steel); font-size: 1rem; }
.req-form { display: flex; align-items: flex-end; gap: 14px; flex: none; }
.req-form .f { width: 130px; }
.req-total { font-size: .9375rem; color: var(--steel); }
.req-total b { display: block; font: 900 1.75rem/1 var(--display); color: var(--ultra); }
.req-form .link { margin-bottom: 8px; }
.inline-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; gap: 12px; background: var(--white); border-radius: 4px; padding: 20px; margin-top: 20px; align-items: start; }
.inline-form h2 { grid-column: 1 / -1; font-size: 1.875rem; }
.inline-form .btn { margin-top: 30px; height: 44px; padding-block: 0; }

.s-best { background: var(--ink); color: var(--vis); }
.rate { display: flex; align-items: center; gap: 2px; margin-top: 10px; }
.rate span { font-weight: 600; font-size: 1rem; margin-right: 8px; }
.rate button { border: 0; background: none; font-size: 1.625rem; line-height: 1; padding: 2px; color: var(--line); }
.rate button:hover, .rate button.on { color: var(--blue); }

/* Direcciones y mapa */
.route-fields { display: grid; gap: 10px; }
.place { position: relative; }
.suggest {
  position: absolute; z-index: 40; left: 0; right: 0; top: 74px; background: var(--white);
  border: 1.5px solid var(--ink); border-radius: 3px; box-shadow: 0 12px 26px rgb(15 23 42 / .22); max-height: 270px; overflow-y: auto;
}
.suggest li { padding: 9px 12px; cursor: pointer; font-size: 1rem; line-height: 1.3; border-bottom: 1px solid var(--line); }
.suggest li:hover, .suggest li[aria-selected="true"] { background: var(--vis); }
.presets { display: flex; flex-wrap: wrap; gap: 5px; margin-top: -4px; }
.presets button { border: 1.5px solid var(--line); background: none; border-radius: 2px; padding: 3px 8px; font-size: .9375rem; font-weight: 600; }
.presets button:hover { border-color: var(--ink); background: var(--paper); }
.route-status { font-weight: 600; font-size: 1rem; color: var(--ultra); line-height: 1.3; }
.route-status:empty { display: none; }
.cot { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 20px; align-items: stretch; }
.cot .panel { margin-top: 0; }
.cot-fields { display: grid; gap: 12px; align-content: start; }
.cot-map { padding: 0; overflow: hidden; display: flex; min-height: 420px; }
.map { position: relative; z-index: 0; width: 100%; min-height: 420px; background: var(--line); }
.map.small { min-height: 300px; height: 300px; margin-block: 10px 6px; display: grid; place-items: center; color: var(--steel); }
.map-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--steel); font-weight: 600; padding: 24px; text-align: center; }
.ship-map .map.small.leaflet-container { display: block; }

/* Mensajes */
.chat { display: grid; grid-template-columns: 300px minmax(0, 1fr); background: var(--white); border-radius: 4px; overflow: hidden; min-height: 560px; }
.threads { border-right: 1px solid var(--line); }
.threads a { display: block; position: relative; padding: 14px 42px 14px 16px; text-decoration: none; border-bottom: 1px solid var(--line); }
.threads a:hover { background: var(--paper); }
.threads a[aria-current] { box-shadow: inset 5px 0 0 var(--ultra); background: var(--paper); }
.threads b { display: block; }
.threads span { display: block; color: var(--steel); font-size: .9375rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.threads .badge { position: absolute; right: 12px; top: 16px; font-style: normal; }
.conv { display: flex; flex-direction: column; padding: 18px 20px; min-width: 0; }
.conv h2 { font-size: 2rem; padding-bottom: 12px; border-bottom: 1.5px solid var(--ink); }
.msgs { flex: 1; overflow-y: auto; max-height: 480px; display: flex; flex-direction: column; gap: 10px; padding-block: 16px; }
.msgs li { align-self: flex-start; max-width: 75%; }
.msgs p { background: var(--paper); padding: 9px 13px; border-radius: 3px; overflow-wrap: anywhere; }
.msgs small { color: var(--steel); font-size: .875rem; }
.msgs .mine { align-self: flex-end; text-align: right; }
.msgs .mine p { background: var(--ultra); color: var(--white); text-align: left; }
.msgs .none { color: var(--steel); align-self: center; margin-block: auto; }
.send { display: flex; gap: 8px; }
.send input { flex: 1; min-width: 0; height: 46px; padding: 0 12px; border: 1.5px solid var(--steel); border-radius: 3px; }
.conv .hint { margin-top: 8px; }

/* Superficies blancas sobre el fondo gris claro */
.panel, .filters, .ship, .req, .quote-form, .chat, .inline-form, .facts, #results, main > .t, .profile .t, main > .legs-tabs {
  box-shadow: 0 0 0 1px var(--line), 0 1px 3px rgb(15 23 42 / .08);
}
#results { border-radius: 4px; }

/* Gráficos */
.plot { width: 100%; }
.plot svg { display: block; max-width: 100%; height: auto; }
.grid { stroke: var(--line); stroke-width: 1; }
.axis { font: 400 13px var(--body); fill: var(--steel); }
.end { font: 600 13px var(--body); fill: var(--ink); }
.bar { fill: #0870E8; }
.hit { fill: transparent; }
.hit:hover + * { opacity: 1; }
.cross { stroke: var(--steel); stroke-width: 1; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-bottom: 10px; font-size: 1rem; }
.legend li { display: flex; align-items: center; gap: 7px; }
.legend i, .tip i { width: 12px; height: 12px; border-radius: 2px; display: inline-block; flex: none; }
.chart-table { margin-top: 8px; font-size: 1rem; }
.chart-table summary { cursor: pointer; color: var(--steel); font-weight: 600; }
.chart-table td, .chart-table th { padding-block: 5px; }
.tip { position: fixed; z-index: 30; pointer-events: none; background: var(--ink); color: var(--white); font-size: .9375rem; line-height: 1.35; padding: 7px 10px; border-radius: 3px; white-space: nowrap; }
.tip span { display: block; color: #BFDBFE; }
.tip .tr { display: flex; align-items: center; gap: 6px; }
.tip b { margin-left: auto; padding-left: 12px; font-variant-numeric: tabular-nums; }

.hbars { display: grid; gap: 10px; }
.hbar { display: grid; grid-template-columns: 124px minmax(0, 1fr); column-gap: 10px; align-items: center; position: relative; padding-right: 76px; }
.hbar i { height: 14px; background: #0870E8; border-radius: 0 4px 4px 0; display: block; }
.hbar b { position: absolute; right: 0; font-variant-numeric: tabular-nums; }

@media (max-width: 1180px) {
  .market { grid-template-columns: minmax(0, 1fr); }
  .filters { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile { grid-template-columns: minmax(0, 1fr); }
  .quote-form { position: static; }
  .cols, .cols.wide-left { grid-template-columns: minmax(0, 1fr); }
  .cot { grid-template-columns: minmax(0, 1fr); }
  .cot-map, .map { min-height: 320px; }
}

@media (max-width: 860px) {
  #app { display: block; }
  .side { position: static; height: auto; padding: 14px 16px; gap: 12px; }
  .brand { padding: 0; }
  .side nav { display: flex; overflow-x: auto; gap: 4px; margin-inline: -4px; padding: 2px 4px; }
  .side nav a { flex: none; padding: 8px 12px; }
  .side-foot { margin: 0; grid-template-columns: minmax(0, 1fr) 200px; align-items: center; }
  .who { padding: 0; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis dd { font-size: clamp(1.75rem, 7.8vw, 3rem); }
  .kpis > div:nth-child(3) { border-left: 0; }
  .kpis > div:nth-child(n+3) { border-top: 1.5px solid var(--line); }
  .facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .inline-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inline-form .btn { grid-column: 1 / -1; margin-top: 0; }
  .req { flex-direction: column; align-items: stretch; }
  .req-form { flex-wrap: wrap; }
}

@media (max-width: 640px) {
  .page-head { flex-direction: column; align-items: stretch; }
  .head-acts > * { flex: 1; }
  .demo-bar p { font-size: .875rem; line-height: 1.25; }
  .chat { grid-template-columns: minmax(0, 1fr); }
  .threads { border-right: 0; max-height: 230px; overflow-y: auto; }
  .msgs { max-height: 340px; }
  .band-side { width: 100%; }
  .filters { grid-template-columns: minmax(0, 1fr); }
  .profile-band { flex-direction: column; align-items: flex-start; }
  .res-bar { flex-wrap: wrap; }
  .side-foot { grid-template-columns: minmax(0, 1fr); }
  .ship-top { flex-direction: column; }
  .ship-side { justify-items: start; }
  .ship-stops { font-size: .8125rem; }
  .ship-lane svg { width: 104px; left: calc(var(--p) * (100% - 104px)); }
  .two { grid-template-columns: minmax(0, 1fr); }

  .inline-form { grid-template-columns: minmax(0, 1fr); }
  .hbar { grid-template-columns: 100px minmax(0, 1fr); font-size: 1rem; }
}

/* Barra lateral azul marino */
.side { background: var(--navy); color: var(--white); box-shadow: none; }
.side nav a:hover { background: rgb(255 255 255 / .1); }
.side nav a[aria-current="page"] { background: var(--blue); color: var(--white); }
.side nav a[aria-current="page"] .badge { background: var(--white); color: var(--blue); }
.side :focus-visible { outline-color: var(--blue-2); }
.role { background: rgb(255 255 255 / .1); }
.role button { color: var(--white); }
.role button[aria-pressed="true"] { background: var(--white); color: var(--navy); }
.skip { position: absolute; left: 12px; top: -60px; z-index: 60; background: var(--blue); color: var(--white); padding: 8px 14px; font-weight: 700; border-radius: var(--radius); }
.skip:focus { top: 10px; }

/* Superficies y controles */
h1, h2, h3 { color: var(--navy); }
.side h1, .premium h2 { color: var(--white); }
.btn { border-radius: var(--radius); transition: background var(--ease), color var(--ease); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn.outline { background: var(--white); color: var(--blue); box-shadow: inset 0 0 0 1.5px var(--blue); }
.btn.outline:hover { background: var(--blue); color: var(--white); }
.panel, .filters, .ship, .req, .quote-form, .chat, .inline-form, .facts, main > .t, .profile .t, main > .legs-tabs { border-radius: var(--radius); }
.err:not(:empty) { font-weight: 600; }
.err:not(:empty)::before { content: "!"; display: inline-grid; place-items: center; width: 16px; height: 16px; margin-right: 6px; border-radius: 50%; background: var(--navy); color: var(--white); font-size: .75rem; font-weight: 800; }
.f input[aria-invalid="true"], .f select[aria-invalid="true"], .f textarea[aria-invalid="true"] { border-color: var(--navy); border-width: 2px; }
.f textarea { width: 100%; min-height: 96px; padding: 10px; font: inherit; border: 1.5px solid var(--steel); border-radius: 3px; background: var(--white); }
.fav.on, .rate button:hover, .rate button.on { color: var(--blue); }
.notice { background: var(--blue-light); padding: 10px 14px; border-radius: var(--radius); font-size: 1rem; line-height: 1.35; }
.tag-demo { display: inline-block; font: 600 .875rem/1.3 var(--body); color: var(--muted); background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); padding: 2px 8px; border-radius: 3px; vertical-align: middle; margin-left: 8px; }

/* Estados de cotización */
.status { border-radius: 3px; }
.s-pendiente { background: var(--white); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--blue-2); }
.s-revision { background: var(--blue-light); color: var(--navy); }
.s-cotizada { background: var(--blue); color: var(--white); }
.s-aceptada { background: var(--navy); color: var(--white); }
.s-rechazada { background: var(--line); color: var(--ink); text-decoration: none; }
.s-cancelada { background: none; color: var(--muted); box-shadow: inset 0 0 0 1px var(--muted); text-decoration: line-through; }
.s-vencida { background: var(--bg); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); font-style: italic; }
.s-best { background: var(--sky); color: var(--navy); }

/* Tarjeta de empresa */
.co-card {
  display: grid; grid-template-columns: minmax(0, 1fr) 236px; gap: 12px 24px; background: var(--white);
  padding: 18px 20px; border-radius: var(--radius); box-shadow: var(--shadow-sm); margin-bottom: 12px; position: relative;
  transition: box-shadow var(--ease);
}
.co-card:hover { box-shadow: 0 0 0 1px var(--blue-pastel), 0 8px 22px rgb(15 23 42 / .1); }
.co-card.is-ad, .co-card.best { box-shadow: inset 4px 0 0 var(--blue), var(--shadow-sm); }
.co-head { display: flex; gap: 14px; align-items: flex-start; }
.co-pick { display: flex; align-items: center; padding-top: 19px; }
.co-pick input { width: 20px; height: 20px; margin: 0; accent-color: var(--blue); }
.co-name { flex: 1; min-width: 0; }
.co-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.co-title h3 { font-size: 1.875rem; }
.co-title h3 a { text-decoration: none; }
.co-title h3 a:hover { color: var(--blue); }
.co-name > p { color: var(--muted); font-size: 1rem; line-height: 1.3; margin-top: 2px; }
.fav { border: 0; background: none; font-size: 1.5rem; line-height: 1; padding: 4px 6px; color: var(--line); }
.fav:hover { color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.tags li { background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); font-size: .875rem; font-weight: 600; padding: 2px 8px; border-radius: 3px; }
.tags .ad { background: var(--blue-light); box-shadow: none; }
.tags .plain { color: var(--muted); font-weight: 500; }
.avail { flex: none; font-size: .9375rem; font-weight: 700; padding: 2px 9px; border-radius: 3px; white-space: nowrap; }
.a-disponible { background: var(--blue); color: var(--white); }
.a-limitada { background: var(--blue-light); color: var(--navy); }
.a-sin { background: var(--line); color: var(--ink); }
.co-metrics { grid-column: 1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.co-metrics dt { color: var(--muted); font-size: .875rem; line-height: 1.25; }
.co-metrics dd { font-weight: 700; line-height: 1.25; font-variant-numeric: tabular-nums; }
.co-metrics small { display: block; font-weight: 400; color: var(--muted); font-size: .875rem; }
.co-price { grid-column: 2; grid-row: 1 / span 2; text-align: right; display: flex; flex-direction: column; border-left: 1px solid var(--line); padding-left: 20px; }
.co-price .per { font-size: .9375rem; color: var(--muted); }
.co-price .total { font: 900 2.5rem/1 var(--display); color: var(--blue); font-variant-numeric: tabular-nums; margin-top: 6px; }
.co-price .need { font-weight: 600; color: var(--ink); margin-top: 6px; line-height: 1.25; }
.co-price .tax { font-size: .875rem; color: var(--muted); line-height: 1.3; margin-top: 4px; }
.co-actions { display: grid; gap: 6px; margin-top: auto; padding-top: 12px; }
.co-actions .btn { padding: 8px 10px; font-size: 1rem; }

.route-panel { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 16px 18px; margin-bottom: 16px; }
.route-fields.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.route-fields.compact .route-status { grid-column: 1 / -1; }
.res-note { color: var(--muted); font-size: 1rem; margin-bottom: 10px; }

/* Cotizador por etapas */
.stepper { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin-bottom: 20px; counter-reset: paso; }
.stepper li { position: relative; }
.stepper li::after { content: ""; position: absolute; left: 44px; right: 8px; top: 16px; height: 3px; background: var(--line); }
.stepper li:last-child::after { display: none; }
.stepper li.done::after { background: var(--blue); }
.stepper button, .stepper span.st { display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 0; font-weight: 700; text-align: left; color: var(--muted); }
.stepper button { cursor: pointer; color: var(--navy); }
.stepper i { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; font-style: normal; flex: none; background: var(--line); color: var(--muted); position: relative; z-index: 1; }
.stepper .done i, .stepper .now i { background: var(--blue); color: var(--white); }
.stepper .now { color: var(--navy); }
.stepper b { display: block; margin-top: 40px; position: absolute; font-weight: 700; font-size: 1rem; }
.stepper li { min-height: 66px; }
.stepper .now b, .stepper .done b { color: var(--navy); }
.stepper li b { color: var(--muted); left: 0; top: 0; }
.wiz { display: grid; gap: 14px; }
.wiz-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.wiz-three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.wiz-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 16px; }
.wiz-nav .wiz-msg { flex: 1; font-weight: 600; }
.wiz-strip { display: flex; flex-wrap: wrap; gap: 4px 20px; background: var(--blue-light); padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; font-size: 1rem; }
.wiz-strip b { font-weight: 700; }
.bar-tools { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.bar-tools label { display: flex; gap: 8px; align-items: center; color: var(--muted); }
.bar-tools select { height: 42px; padding: 0 8px; border: 1.5px solid var(--steel); border-radius: 3px; background: var(--white); color: var(--ink); }
.review { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; }
.review > div { display: flex; justify-content: space-between; gap: 16px; padding-block: 9px; border-bottom: 1px solid var(--line); }
.review dt { color: var(--muted); flex: none; }
.review dd { font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.review-list { display: grid; gap: 0; margin-top: 6px; }
.review-list li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-block: 10px; border-bottom: 1px solid var(--line); }
.review-list small { color: var(--muted); display: block; }
.review-list b { font: 800 1.625rem/1 var(--display); color: var(--blue); white-space: nowrap; }

/* Operación y documentos */
.checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 14px; }
.op-rates { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.mini-list { display: grid; gap: 0; }
.mini-list li { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding-block: 8px; border-bottom: 1px solid var(--line); }
.add-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; margin-top: 12px; }
.add-row select { height: 44px; width: 100%; padding: 0 8px; border: 1.5px solid var(--steel); border-radius: 3px; background: var(--white); }
.doc-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-block: 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.doc-row small { display: block; color: var(--muted); }
.doc-row input[type="file"] { font-size: .9375rem; max-width: 260px; }
.order { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: clamp(18px, 3vw, 36px); max-width: 820px; }
.order header { display: flex; justify-content: space-between; align-items: center; gap: 16px; border-bottom: 2px solid var(--navy); padding-bottom: 12px; margin-bottom: 14px; }
.order .brand-print { font: 800 2rem/1 var(--stencil); color: var(--navy); }
.stats-note { color: var(--muted); font-size: 1rem; margin-top: 8px; }

@media (max-width: 1180px) {
  .co-card { grid-template-columns: minmax(0, 1fr) 210px; }
  .co-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .co-card { grid-template-columns: minmax(0, 1fr); }
  .co-metrics, .co-price { grid-column: 1; grid-row: auto; }
  .co-price { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 12px; text-align: left; }
  .co-actions { grid-template-columns: 1fr 1fr; }
  .stepper b { font-size: .875rem; }
  .route-fields.compact, .review, .wiz-grid, .wiz-three, .op-rates { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 480px) {
  .stepper li::after { left: 40px; right: 4px; }
  .co-head { flex-wrap: wrap; }
  .checks, .add-row { grid-template-columns: minmax(0, 1fr); }
  .wiz-nav { flex-wrap: wrap; }
  .wiz-nav .wiz-msg { flex-basis: 100%; order: -1; }
}

@media (prefers-reduced-motion: reduce) {
  .co-card, .btn { transition: none; }
}

@media print {
  .side, .demo-bar, .no-print, .page-head { display: none !important; }
  #app { display: block; }
  body { background: var(--white); }
  main { padding: 0; }
  .order { box-shadow: none; max-width: none; }
}

.ship-doc { margin-top: 8px; font-size: 1rem; font-weight: 600; }
.legend-line { font-weight: 600; margin-bottom: 6px; padding: 0; }

/* Tablas y tarjetas en pantallas angostas */
@media (max-width: 1180px) {
  .t th, .t td { padding-inline: 8px; }
  .acts { white-space: normal; }
  .acts .btn, .acts .link { display: block; margin: 4px 0 0 auto; }
}

@media (max-width: 860px) {
  table.t:not(.plain), .t:not(.plain) tbody, .t:not(.plain) tr, .t:not(.plain) td { display: block; }
  .t:not(.plain) thead { display: none; }
  .t:not(.plain) tr { padding: 10px 14px; border-bottom: 1px solid var(--line); }
  .t:not(.plain) tr:last-child { border-bottom: 0; }
  .t:not(.plain) td { display: flex; justify-content: space-between; gap: 16px; padding: 4px 0; border: 0; text-align: right; }
  .t:not(.plain) td[data-l]::before { content: attr(data-l); color: var(--steel); text-align: left; flex: none; font-weight: 400; }
  .t:not(.plain) td[data-l="Ruta"] { flex-wrap: wrap; }
  .t:not(.plain) td small { flex-basis: 100%; text-align: right; }
  .t:not(.plain) .acts { justify-content: flex-end; align-items: center; padding-top: 8px; }
  .t:not(.plain) .acts:empty { display: none; }
  .panel .t:not(.plain) tr { padding-inline: 0; }
  .acts .btn, .acts .link { display: inline-block; margin: 0 0 0 10px; }
}

@media (max-width: 760px) {
  .co-head { flex-wrap: wrap; }
  .co-name { flex: 1 1 190px; }
  .avail { order: 3; }
}

.stepper li:not(.now):not(.done) i { color: var(--ink); }

@media (max-width: 480px) {
  .res-bar label { flex-wrap: wrap; white-space: normal; width: 100%; }
  .res-bar select { width: 100%; min-width: 0; }
}

.brand img { display: block; height: 38px; width: auto; }
.order .brand-print { display: block; height: 48px; width: auto; }
@media (max-width: 860px) { .brand img { height: 34px; } }

main:focus { outline: none; }
