/* KoaSync · capa de diseño. Orden de carga: components.css, app.css, dashboards.css.
 * Este archivo manda sobre components.css: aquí viven los colores, la tipografía,
 * la navegación y el tratamiento visual de los componentes compartidos.
 *
 * Tipografía: Montserrat es la fuente corporativa (la misma que ventadecolchones.com)
 * y se reserva para marca y titulares; Inter lleva todo el dato -tablas, formularios,
 * cifras- porque es la que mejor se lee en pantallas llenas de números. */
:root {
  color-scheme: light;
  --bg: #f6f6f5;
  --surface: #fff;
  --surface-2: #f5f5f4;
  --surface-3: #faf9f8;
  --ink: #2a2c29;
  --ink-2: #4d5049;
  --muted: #6b6d69;
  --rule: #e7e7e5;
  --rule-strong: #dadbd8;
  --accent: #e4452b;
  --accent-deep: #a8321f;
  --accent-hover: #c9381f;
  --accent-ink: #fff;
  --accent-soft: #fdf0ea;
  --ok: #2e7d5b;
  --ok-soft: #eaf6f0;
  --warn: #976612;
  --warn-soft: #fdf3e1;
  --danger: #bf2836;
  --danger-soft: #fdecec;
  --info: #3472a0;
  --info-soft: #eaf2f8;
  --beige: #fcdab4;
  --beige-soft: #fef6ea;

  /* Sidebar oscuro: el ancla visual de la aplicación. */
  --sidebar-w: 244px;
  --sidebar-bg: #373a36;
  --sidebar-bg-2: #31332f;
  --sidebar-ink: #fff;
  --sidebar-ink-2: #a8aaa4;
  --sidebar-rule: #4a4d47;
  --sidebar-hover: #ffffff0f;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px #2a2c290a;
  --shadow: 0 4px 16px #2a2c2914;
  --font-ui: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-brand: Montserrat, Inter, ui-sans-serif, system-ui, sans-serif;
  --type-body: 14px;
  --type-secondary: 12px;
  --type-caption: 11px;
  --type-micro: 10px;
  --type-control: 12px;

  /* Alias de los tokens KoaSync (mismos valores, nombrados como en el brief de marca). */
  --koa-primary: var(--accent);
  --koa-primary-hover: var(--accent-hover);
  --koa-dark: #373a36;
  --koa-beige: var(--beige);
  --koa-background: var(--bg);
  --koa-surface: var(--surface);
  --koa-border: var(--rule);
  --koa-text: var(--ink);
  --koa-text-secondary: var(--muted);
  --koa-success: var(--ok);
  --koa-warning: var(--warn);
  --koa-danger: var(--danger);
  --koa-info: var(--info);
  --koa-radius-sm: 6px;
  --koa-radius-md: var(--radius-sm);
  --koa-radius-lg: var(--radius);
}
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--type-body);
  font-feature-settings: "cv05" 1, "ss01" 1;
  letter-spacing: -.006em;
}
h1, h2, h3, .brand-name { font-family: var(--font-brand); letter-spacing: -.02em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: #fdd9d1; color: var(--ink); }
[hidden] { display: none !important; }
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100dvh; }
.main { display: flex; flex-direction: column; min-width: 0; }
.content { width: 100%; min-width: 0; padding: 20px 26px 28px; }
.content > * { min-width: 0; }
.content > script, .content > style { display: none; }

/* ── Navegación ────────────────────────────────────────────────────────────
   El sidebar es la única zona oscura de la aplicación: ancla la vista, separa
   "dónde estoy" de "qué estoy mirando" y deja que el naranja resalte sin
   competir con el contenido. */
.sidebar { position: sticky; top: 0; z-index: 30; display: flex; flex-direction: column; height: 100dvh; overflow-y: auto; overflow-x: hidden; background: var(--sidebar-bg); color: var(--sidebar-ink); scrollbar-width: thin; scrollbar-color: #ffffff26 transparent; }
.brand { position: relative; display: flex; align-items: center; gap: 11px; padding: 18px 14px; border-bottom: 1px solid var(--sidebar-rule); }
.brand-mark { display: grid; place-items: center; flex: 0 0 34px; height: 34px; padding: 3px; border-radius: 9px; overflow: hidden; background: #fff; }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.brand-text { min-width: 0; }
.brand-name { display: block; font-size: 16px; font-weight: 700; color: #fff; line-height: 1.2; }
.brand-sub { display: block; margin-top: 1px; color: var(--sidebar-ink-2); font-size: 10.5px; letter-spacing: .02em; }
.nav-compact { display: grid; place-items: center; flex: 0 0 26px; height: 26px; margin-left: auto; padding: 4px; border: 0; border-radius: 6px; color: var(--sidebar-ink-2); background: transparent; cursor: pointer; transition: .15s; }
.nav-compact:hover { background: var(--sidebar-hover); color: #fff; }
.nav-compact .icon { width: 15px; height: 15px; }
.nav-tools { padding: 13px 12px 0; }
.nav-search-trigger { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 36px; padding: 7px 10px; border: 1px solid transparent; border-radius: 9px; background: #ffffff12; color: var(--sidebar-ink-2); font: inherit; font-size: 12.5px; text-align: left; cursor: pointer; transition: .15s; }
.nav-search-trigger:hover { background: #ffffff1c; color: #fff; }
.nav-search-trigger .icon { width: 15px; height: 15px; }
.nav-search-trigger>span { flex: 1; }
.nav-search-trigger kbd { border: 0; border-radius: 4px; padding: 2px 5px; background: #ffffff1a; color: var(--sidebar-ink-2); font: inherit; font-size: 10px; }
.nav { flex: 1; padding: 14px 12px; }
.nav-group + .nav-group { margin-top: 10px; }
.nav-group-toggle { display: flex; align-items: center; gap: 7px; width: 100%; min-height: 28px; padding: 6px 10px; border: 0; background: transparent; color: #8d8f89; font: inherit; font-size: 11px; font-weight: 600; letter-spacing: .02em; text-transform: none; cursor: pointer; transition: .15s; }
.nav-group-toggle>span:first-child { flex: 1; text-align: left; }
.nav-group-toggle .icon { width: 13px; height: 13px; opacity: .7; }
.nav-group.is-collapsed .nav-group-toggle .icon { transform: rotate(-90deg); }
.nav-group.is-current .nav-group-toggle { color: #c3c5bf; }
.nav-group-toggle:hover { color: #fff; }
.nav-group-count { padding: 1px 6px; border-radius: 20px; background: #ffffff14; color: #8d8f89; font-size: 10px; font-weight: 600; }
.nav-subgroup { color: #82847e; font: 600 10px/1.4 var(--font-ui); letter-spacing: .06em; }
.nav-item { position: relative; display: flex; align-items: center; gap: 11px; min-height: 36px; padding: 8px 10px; margin: 1px 0; border: 0; border-radius: 9px; color: #c9cbc5; font-size: 13px; font-weight: 500; transition: .15s; }
.nav-item .icon { flex: 0 0 17px; width: 17px; height: 17px; opacity: .8; }
.nav-item .label { flex: 1; min-width: 0; }
.nav-item:hover { color: #fff; background: var(--sidebar-hover); }
.nav-item:hover .icon { opacity: 1; }
.nav-item.is-active { color: #fff; background: #e4452b26; font-weight: 600; }
.nav-item.is-active .icon { color: var(--accent); opacity: 1; }
.nav-item.is-active::after { content: ''; position: absolute; left: -12px; top: 50%; transform: translateY(-50%); width: 3px; height: 20px; border-radius: 0 3px 3px 0; background: var(--accent); }
.sidebar-foot { margin: 0 14px 14px; padding: 12px 2px 0; border-top: 1px solid var(--sidebar-rule); color: #82847e; font-size: 11px; }
.sidebar-docs { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 6px; color: var(--sidebar-ink-2); }
.sidebar-docs:hover { color: #fff; }
.sidebar-docs .icon { width: 13px; height: 13px; }
.sidebar-session { display: none; }
.nav-toggle, .nav-close, .nav-scrim { display: none; }

/* ── Cabecera ──────────────────────────────────────────────────────────────
   Baja y tranquila: el título manda, las acciones acompañan. */
.topbar { position: relative; z-index: 12; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; min-height: 68px; padding: 16px 26px 12px; }
.page-title { flex: 1 1 180px; min-width: 0; }
.page-heading-row { display: flex; align-items: center; gap: 8px; }
.topbar h1 { margin: 0; font-size: clamp(20px, 1.9vw, 25px); font-weight: 700; letter-spacing: -.024em; line-height: 1.2; color: var(--ink); }
.topbar-actions, .page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.topbar-actions { margin-left: auto; max-width: 100%; }
.page-actions:empty { display: none; }
.user-chip, .user-logout { display: inline-flex; align-items: center; gap: 6px; }
.user-chip .icon, .user-logout .icon { width: 14px; height: 14px; }
.user-chip { max-width: 180px; }
.user-chip>span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-help { position: relative; flex: 0 0 auto; }
.page-help summary { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; list-style: none; color: var(--muted); cursor: pointer; transition: .15s; }
.page-help summary::-webkit-details-marker { display: none; }
.page-help summary:hover { background: var(--accent-soft); color: var(--accent); }
.page-help .icon { width: 17px; height: 17px; }
.page-help>div { position: absolute; top: 35px; left: 0; z-index: 40; width: min(340px, 75vw); padding: 15px; border: 1px solid var(--rule); border-radius: var(--radius); background: #fff; color: var(--ink-2); box-shadow: var(--shadow); font-size: 12.5px; line-height: 1.6; }
.global-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; padding: 6px 9px; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: #fff; }
.global-filters label { display: grid; gap: 2px; }
.global-filters label>span { color: var(--muted); font-size: 10.5px; font-weight: 500; }
.global-filters input { min-height: 30px; padding: 4px 8px; max-width: 150px; }

/* ── Navegación contextual ─────────────────────────────────────────────── */
.context-nav { position: relative; z-index: 9; display: flex; flex-wrap: wrap; align-items: center; gap: 0; min-width: 0; margin: 0 26px; padding: 0; border: 1px solid var(--rule); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow-sm); }
.carrier-tabs { display: flex; flex: 1 1 540px; align-items: center; min-width: 0; padding: 7px 10px; }
.carrier-tabs-label, .context-nav-label, .carrier-tab-active { display: none; }
.carrier-tabs-list { display: flex; gap: 6px; max-width: 100%; min-width: 0; padding: 3px; overflow-x: auto; scrollbar-width: thin; }
.carrier-tab { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; min-height: 36px; padding: 5px 10px 5px 6px; border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; color: var(--muted); font: inherit; cursor: pointer; transition: .15s; }
.carrier-tab:hover { background: var(--surface-2); color: var(--ink); }
.carrier-tab-code { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--surface-2); color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .02em; }
.carrier-tab-name strong { font-size: 12px; font-weight: 600; }
.carrier-tab-name small { display: none; }
.carrier-tab.is-active { background: var(--accent-soft); border-color: transparent; color: var(--accent-deep); }
.carrier-tab.is-active .carrier-tab-code { background: var(--accent); color: #fff; }
.context-nav-items { align-self: stretch; display: flex; flex: 1 1 auto; flex-wrap: wrap; align-items: stretch; gap: 0 16px; min-width: 0; padding: 0 14px; border-top: 1px solid var(--rule); }
.context-nav-item { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 7px; min-height: 42px; padding: 8px 2px; border: 0; border-bottom: 2px solid transparent; color: var(--muted); background: transparent; font-size: 13px; transition: .15s; }
.context-nav-item:hover { color: var(--ink); }
.context-nav-item .icon { width: 15px; height: 15px; }
.context-nav-copy strong { font-size: 13px; font-weight: 550; }
.context-nav-copy small { display: none; }
.context-nav-item.is-active { border-bottom-color: var(--accent); color: var(--accent); }
.context-nav-item.is-active .context-nav-copy strong { font-weight: 650; }

/* ── Ritmo visual compartido ───────────────────────────────────────────────
   Superficies planas, bordes suaves y sombras casi imperceptibles: el dato es
   lo que tiene que destacar, no el contenedor que lo envuelve. */
.panel, .billing-overview, .tariff-workspace, .contract-card { border: 1px solid var(--rule); border-radius: var(--radius-lg); background: #fff; box-shadow: var(--shadow-sm); }
.panel-head { padding: 15px 18px; min-height: 52px; border-bottom: 1px solid var(--rule); background: #fff; flex-wrap: wrap; }
.panel-head h2 { font-family: var(--font-brand); font-size: 14.5px; font-weight: 650; letter-spacing: -.015em; color: var(--ink); }
.panel-head>.icon { width: 30px !important; height: 30px !important; padding: 6px; border-radius: 8px; color: var(--accent); background: var(--accent-soft); }
.panel-body { padding: 18px; }
.panel-note { padding: 12px 18px; border-top: 1px solid var(--rule); background: var(--surface-3); color: var(--muted); font-size: 12px; }

/* Tarjetas de cifra: sin adornos, el número es el protagonista. */
.kpis { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi { min-height: 104px; padding: 16px 18px; border: 1px solid var(--rule); border-radius: var(--radius-lg); background: #fff; box-shadow: var(--shadow-sm); transition: .18s ease; }
.kpi:after { display: none; }
.kpi:hover { transform: none; border-color: var(--rule-strong); box-shadow: var(--shadow); }
.kpi.is-emphasis { border-color: #f3c9be; background: var(--accent-soft); }
.kpi-label { color: var(--muted); font-size: 12px; font-weight: 550; letter-spacing: 0; text-transform: none; }
.kpi-value { margin: 10px 0 2px; color: var(--ink); font-size: clamp(28px, 2.5vw, 36px); font-weight: 680; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.kpi-hint { margin-top: 5px; color: var(--muted); font-size: 12px; letter-spacing: 0; }

/* ── Botones ───────────────────────────────────────────────────────────── */
.btn, .filter, .sync-button { min-height: 38px; padding: 8px 14px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 550; box-shadow: none; transition: .15s; }
.btn:hover, .filter:not(.is-disabled):hover { transform: none; box-shadow: none; border-color: var(--rule-strong); background: var(--surface-2); color: var(--ink); }
.btn-primary, .primary-filter, .topbar-primary, .filter.is-primary, .sync-button { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; box-shadow: none; }
.btn-primary:hover, .primary-filter:hover, .filter.is-primary:hover, .sync-button:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-danger, .filter.is-danger { border-color: var(--danger); background: var(--danger); color: #fff; }
.btn-danger:hover, .filter.is-danger:hover { background: #c23c3c; border-color: #c23c3c; color: #fff; }
.filter .icon, .btn .icon, .sync-button .icon { width: 15px; height: 15px; }

/* ── Formularios ───────────────────────────────────────────────────────── */
input, select, textarea { accent-color: var(--accent); }
input[type=search], input[type=text], input[type=number], input[type=date], input[type=password], select, textarea, .field-control {
  min-height: 40px; border-radius: var(--radius-sm); border-color: var(--rule-strong); font-size: 13.5px;
}
input:focus, select:focus, textarea:focus, .field-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #e4452b1f; }
.field-label { font-size: 12.5px; font-weight: 550; color: var(--ink-2); }
.ui-control { min-height: 38px; padding: 8px 11px; border: 1px solid var(--rule-strong); border-radius: var(--radius-sm); background: #fff; color: var(--ink); font: inherit; font-size: 13px; }
.ui-control:focus { border-color: var(--accent); background: #fff; }

/* ── Tablas ────────────────────────────────────────────────────────────────
   Sin rejilla ni mayúsculas: cabecera legible, filas cómodas y una división
   discreta. Es la pantalla donde más horas se pasan. */
.tw { position: relative; max-width: 100%; overflow: auto; overscroll-behavior-inline: contain; scrollbar-width: thin; }
table { font-size: 13px; }
.tw th { position: sticky; top: 0; z-index: 2; background: var(--surface-3); box-shadow: inset 0 -1px var(--rule); }
th { color: var(--muted); background: var(--surface-3); font-size: 12px; font-weight: 600; text-transform: none; letter-spacing: 0; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--rule); }
tbody tr { transition: background-color .12s; }
tbody tr:hover { background: var(--surface-3); }
.table-action { min-height: 32px; }
.sub-dato { font-size: 12px; color: var(--muted); }

/* ── Badges y chips ────────────────────────────────────────────────────────
   Legibles de un vistazo: sin mayúsculas forzadas ni tracking exagerado. */
.badge { padding: 4px 10px; font-size: 12px; font-weight: 600; letter-spacing: 0; text-transform: none; }
.chip { border-radius: 20px; padding: 6px 13px; font-size: 13px; font-weight: 550; }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: #f3c9be; color: var(--accent-deep); }
.etapa { font-size: 14px; font-weight: 550; }
.etapa[aria-current="page"] { color: var(--accent-deep); font-weight: 650; }
.etapa-n { background: var(--surface-2); font-size: 12px; font-weight: 600; }

/* ── Avisos, modales y superposiciones ─────────────────────────────────── */
.help-note { margin: 0 0 16px; padding: 12px 16px; border: 1px solid var(--rule); border-radius: var(--radius); background: #fff; color: var(--ink-2); font-size: 13px; }
.help-note summary { color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer; }
.help-note[open] summary { margin-bottom: 8px; color: var(--accent); }
.help-note p { max-width: 95ch; }
.note { border-radius: var(--radius); font-size: 13px; }
.modal-card, .nav-command-dialog { border-color: var(--rule); border-radius: var(--radius-lg); }
.modal-head { background: #fff; }
.modal-card { max-width: calc(100vw - 28px); }
.nav-command-result.is-current { background: var(--accent-soft); }
.contract-tabs { flex-wrap: wrap; overflow: visible; }
.billing-metric, .tariff-stat, .command-figure { min-width: 0; }
.billing-metric.is-main, .tariff-stat.is-primary, .command-figure.is-main { background: var(--accent-soft); color: var(--ink); }
.billing-metric>strong, .tariff-stat>strong, .command-figure>strong { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.billing-metric.is-main>strong, .billing-metric.is-main .billing-metric-label { color: var(--ink); }
.billing-metric small { color: var(--muted); }
.billing-metric-icon { background: var(--accent-soft); color: var(--accent); }
.promise-command, .command-strip, .tariff-overview { box-shadow: none; }
.promise-hero, .command-screen, .delivery-map-screen, .settings-screen { min-width: 0; }

/* The page stays still on desktop; long work areas scroll without clipping data. */
@media (min-width: 1100px) and (min-height: 650px) {
  .app, .main { height: 100dvh; min-height: 0; }
  .topbar, .context-nav { flex-shrink: 0; }
  .content { flex: 1; min-height: 0; overflow: auto; scrollbar-width: thin; scrollbar-gutter: stable; }
  .tw { max-height: min(58dvh, 680px); }
}
@media (min-width: 821px) {
  body.is-nav-compact { --sidebar-w: 78px; }
  .is-nav-compact .brand { flex-direction: column; padding-inline: 8px; gap: 8px; }
  .is-nav-compact .brand-text, .is-nav-compact .nav-search-trigger>span, .is-nav-compact .nav-search-trigger kbd, .is-nav-compact .nav-group-toggle, .is-nav-compact .nav-item .label, .is-nav-compact .sidebar-foot, .is-nav-compact .nav-subgroup { display: none; }
  .is-nav-compact .nav-compact { margin: 0; }
  .is-nav-compact .nav-item, .is-nav-compact .nav-search-trigger { justify-content: center; }
  .is-nav-compact .nav-item.is-active::after { left: -12px; }
  .is-nav-compact .nav-group + .nav-group { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--sidebar-rule); }
}
@media (min-width: 1500px) {
  .context-nav-items { flex: 0 1 auto; border-top: 0; border-left: 1px solid var(--rule); }
}
@media (max-width: 1099px) {
  .topbar-actions { flex-wrap: wrap; }
  .carrier-tabs { flex-basis: 100%; }
  .context-nav-items { flex-basis: 100%; }
  .page-help>div { position: fixed; top: 75px; left: 14px; width: min(400px, calc(100vw - 28px)); }
}
@media (max-width: 820px) {
  .app { display: block; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(280px, 86vw); transform: translateX(-102%); visibility: hidden; }
  .nav-open .sidebar { transform: none; visibility: visible; box-shadow: var(--shadow); }
  body.nav-open { overflow: hidden; }
  .nav-scrim { position: fixed; inset: 0; z-index: 25; background: #2a2c2966; }
  .nav-open .nav-scrim { display: block; }
  .nav-toggle { display: grid; gap: 4px; flex: 0 0 38px; height: 38px; padding: 10px; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: #fff; cursor: pointer; }
  .nav-toggle span { display: block; height: 2px; border-radius: 2px; background: var(--ink); }
  .nav-close { display: block; margin-left: auto; border: 0; background: none; color: #fff; font-size: 24px; cursor: pointer; }
  .nav-compact { display: none; }
  .topbar { padding: 14px; min-height: 62px; }
  .page-title { flex: 1; }
  .topbar-actions { flex-basis: 100%; margin-left: 0; }
  .content { padding: 16px 14px 20px; }
  .context-nav { margin-inline: 14px; }
  .user-chip { margin-left: auto; }
  .global-filters { flex-basis: 100%; }
  .global-filters input { max-width: 100%; }
  .carrier-tabs { padding: 5px; }
  .carrier-tab-name { display: block; }
  .context-nav-items { gap: 0 12px; padding-inline: 10px; }
  .context-nav-item, .context-nav-copy strong { font-size: 12px; }
  .tw { max-height: 65dvh; }
}
@media (max-width: 480px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { padding: 14px; }
  .user-chip { max-width: 120px; }
  .global-filters label { flex: 1 1 110px; min-width: 0; }
  .global-filters input { min-width: 0; width: 100%; }
  .panel-head { padding: 14px; }
}

/* ── Login ─────────────────────────────────────────────────────────────── */
.login-page { background: var(--bg); }
.login-brand h1 { font-family: var(--font-brand); font-size: 23px; font-weight: 700; }
.login-panel { border-color: var(--rule); border-radius: var(--radius-lg); box-shadow: 0 6px 24px #2a2c2914; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation-duration: .01ms !important; }
}
@media print {
  .sidebar, .topbar, .context-nav, .nav-scrim, .sync-toast, .nav-command { display: none !important; }
  .app, .main { display: block; height: auto; }
  .content { overflow: visible; padding: 0; }
  .tw { max-height: none; overflow: visible; }
  .tw th { position: static; }
  .help-note { break-inside: avoid; }
}

/* ── Expediciones: etapa (pestañas) y condicion (filtros rapidos) ───────────
   Son dos ejes distintos y por eso se ven distintos: la pestaña dice DONDE
   esta el envio y es excluyente; el chip dice QUE le pasa y se acumula. */
.etapas { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--rule); margin-bottom: 16px; }
.etapa { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px 12px; border-radius: 8px 8px 0 0; color: var(--muted); text-decoration: none; }
.etapa:hover { color: var(--ink-2); background: var(--surface-3); }
.etapa[aria-current="page"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--accent); border-radius: 2px 2px 0 0; }
.etapa[aria-current="page"] .etapa-n { background: var(--accent-soft); color: var(--accent-deep); }
.filtros-rapidos { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.filtros-rotulo { font-size: 12.5px; color: var(--muted); }
.chip-n { color: var(--muted); font-weight: 650; font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] .chip-n { color: var(--accent-deep); }
.chip-alerta[aria-pressed="true"] { background: var(--warn-soft); border-color: #ecd6a5; color: #9a6a12; }
.chip-alerta[aria-pressed="true"] .chip-n { color: #9a6a12; }
.chip-limpiar { font-size: 12.5px; color: var(--muted); text-decoration: underline; }

/* ── Tarifas · tarjeta del contrato activo ─────────────────────────────────
   Venía del tema verde: la etiqueta pesaba más que el nombre del contrato y
   cuatro verdes heredados caían sobre naranja saturado (contraste 2.2).
   Beige corporativo con texto oscuro: mantiene el énfasis de "tarjeta
   destacada" y devuelve la jerarquía -manda el nombre del contrato-. */
.tariff-contract-card { background: var(--beige); color: var(--ink); }
.tariff-contract-card small { color: #6b5740; font-size: 11.5px; font-weight: 600; letter-spacing: .01em; }
.tariff-contract-card strong { margin: 3px 0 1px; color: var(--ink); font-size: 15px; font-weight: 650; }
.tariff-contract-card>div>span { color: #6d5a42; font-size: 12px; }
.tariff-contract-card>a { margin-top: 8px; color: var(--accent-deep); font-size: 12.5px; font-weight: 600; }
.tariff-contract-card>a:hover { color: var(--accent); text-decoration: underline; }
.tariff-contract-icon { background: #ffffff8c; color: var(--accent-deep); }

/* Las cifras de al lado viven en tarjeta blanca: la misma regla las pintaba
   con el color pensado para el fondo de color. */
.tariff-stat>span, .tariff-coverage small { color: var(--muted); font-size: 12px; font-weight: 550; letter-spacing: 0; }
.tariff-stat>strong { color: var(--ink); font-size: 20px; font-weight: 680; letter-spacing: -.02em; }

/* ── Azulejos de icono y notas tintadas ────────────────────────────────────
   Venían del tema verde con icono y fondo del mismo tono, así que el icono
   desaparecía sobre su propia pastilla. Todos al mismo patrón del sistema:
   pastilla en naranja muy claro, icono en naranja de marca. */
.zone-map-empty-icon, .invoice-document-icon, .tariff-contract-icon,
.zone-map-prefix, .promise-flow-icon, .work-tab-icon, .invoice-next-icon {
  background: var(--accent-soft);
  color: var(--accent-deep);
}
.province-inspector-note { color: var(--ink-2); }

/* Tarjeta del documento de factura: misma herencia rota que la del contrato
   -texto verde sobre naranja saturado-. */
.invoice-document-card { background: var(--beige); color: var(--ink); }
.invoice-document-card dt { color: #6b5740; font-weight: 600; }
.invoice-document-card dd, .invoice-document-card>div>span { color: var(--ink); }

/* Ningún texto por debajo del gris de marca sobre superficie clara. */
.zone-map-choice, .zone-map-choice small, .accounting-balance small { color: var(--muted); }

/* ── Paneles que antes eran oscuros ────────────────────────────────────────
   El inspector de provincia, el editor de zonas y el progreso de facturacion
   se dibujaban sobre un fondo oscuro: texto en #fff y separadores en blanco
   translucido. Al unificar `.panel` con fondo blanco, ese texto blanco quedo
   sobre blanco -invisible- y por eso el panel del mapa salia con los rotulos
   puestos y los valores en blanco. Se pasan al tratamiento de panel claro. */
.province-inspector, .zone-map-editor, .billing-progress-panel, .zone-map-score,
.zone-map-selection h2 { color: var(--ink); }
.province-inspector-head, .zone-map-selection>header { border-bottom-color: var(--rule); }
.zone-map-selection>footer { border-top-color: var(--rule); }
.province-detail-grid, .province-detail-grid>div { border-color: var(--rule); }
.province-detail-grid strong, .province-detail-primary strong { color: var(--ink); }
.province-detail-primary span, .province-detail-grid span { color: var(--muted); font-weight: 550; }
.province-inspector-note { border-left-color: var(--accent); background: var(--accent-soft); color: var(--ink-2); }

/* Selector de zonas: la pastilla de la zona actual y las opciones. */
.zone-map-current, .zone-map-choice { background: var(--surface-3); border-color: var(--rule); color: var(--ink); }
.zone-map-choice:hover { background: var(--surface-2); border-color: var(--rule-strong); color: var(--ink); }
.zone-map-choice small { background: var(--surface-2); color: var(--muted); }
.zone-map-choice.is-current { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-deep); }
.zone-map-choice.is-current small { background: #fff; color: var(--accent-deep); }
.zone-map-empty-icon { border-color: var(--rule); }
.billing-progress-head a:hover { background: var(--surface-2); color: var(--ink); }

/* ── Mapa de plazos · comparativa entre transportistas ─────────────────────
   El color deja de ser una escala y pasa a ser identidad, asi que la leyenda
   son muestras y no un degradado. Cada fila lleva ademas el nombre y los dias:
   con cuatro transportistas el color solo no basta para distinguirlos. */
.map-carrier-legend {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 8px 18px; padding: 12px 16px; border-top: 1px solid var(--rule);
  font-size: 12.5px; color: var(--ink-2);
}
.map-carrier-legend span { display: inline-flex; align-items: center; gap: 7px; }
.map-carrier-legend span.is-muted { color: var(--muted); font-size: 11.5px; }
.map-carrier-legend i { width: 11px; height: 11px; border-radius: 3px; flex: 0 0 11px; }

.province-carriers { display: grid; gap: 8px; padding: 16px; }
.province-carrier {
  display: grid; grid-template-columns: 11px minmax(0, 1fr) auto; align-items: center;
  gap: 4px 11px; padding: 11px 13px;
  border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--surface-3);
}
.province-carrier.is-best { border-color: var(--accent); background: var(--accent-soft); }
.province-carrier i { width: 11px; height: 11px; border-radius: 3px; }
.province-carrier strong { display: block; font-size: 13.5px; font-weight: 600; color: var(--ink); }
.province-carrier small { display: block; margin-top: 2px; font-size: 11.5px; color: var(--muted); }
.province-carrier b { font-size: 17px; font-weight: 680; color: var(--ink); font-variant-numeric: tabular-nums; }
.province-carrier em {
  grid-column: 3; font-size: 11px; font-style: normal; font-weight: 600;
  color: var(--muted); text-align: right;
}
.province-carrier.is-best em { color: var(--accent-deep); }
.map-tooltip i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; }
