/* =============================================================
   0. Tokens
   ============================================================= */
:root {
  --asphalt: #1b1e24;
  --asphalt-2: #262a33;
  --concrete: #f4f2ed;
  --concrete-2: #eae7df;
  --steel: #5b6472;
  --steel-light: #9aa2ad;
  --amber: #e8912b;
  --amber-dark: #c9781c;
  --route: #3d6b5c;
  --route-bg: #e3ede9;
  --alert: #c1502e;
  --alert-bg: #f5e2da;
  --line: #d8d4c9;

  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Barlow Condensed", var(--sans);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --radius: 6px;
  --radius-lg: 10px;
  --gutter: clamp(1.25rem, 4vw, 3rem);
}

/* =============================================================
   1. Reset
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--asphalt);
  background: var(--concrete);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
input, select, textarea { font: inherit; color: inherit; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { text-wrap: balance; line-height: 1.02; letter-spacing: -0.01em; font-family: var(--display); font-weight: 600; }
table { border-collapse: collapse; width: 100%; }
::selection { background: var(--amber); color: var(--asphalt); }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; border-radius: 3px; }

.skip-link {
  position: fixed; top: -100px; left: 1rem; z-index: 9999;
  padding: .6rem 1rem; background: var(--concrete); color: var(--asphalt);
  border-radius: var(--radius); font-weight: 600;
}
.skip-link:focus { top: 1rem; }

/* =============================================================
   2. Type scale
   ============================================================= */
h1 { font-size: clamp(2.4rem, 5.5vw, 4.4rem); }
h2 { font-size: clamp(1.9rem, 3.6vw, 2.8rem); }
h3 { font-size: clamp(1.25rem, 2vw, 1.5rem); font-family: var(--sans); font-weight: 700; letter-spacing: normal; }
.lede { font-size: clamp(1.05rem, 1.6vw, 1.25rem); color: var(--steel); max-width: 44ch; }
.tabular { font-variant-numeric: tabular-nums; }

/* =============================================================
   3. Layout helpers
   ============================================================= */
.wrap { max-width: 1520px; margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: clamp(3.5rem, 8vw, 6.5rem); }
.section-tight { padding-block: clamp(2.5rem, 5vw, 4rem); }

/* =============================================================
   4. Public header / nav
   ============================================================= */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(244, 242, 237, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 76px; }
.brand { display: flex; align-items: center; gap: .6rem; font-family: var(--display); font-weight: 700; font-size: 1.25rem; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 4px; background: var(--asphalt);
  display: grid; place-items: center; flex-shrink: 0;
}
.brand-mark svg { width: 20px; height: 20px; }
.nav-links { display: none; gap: 2rem; }
.nav-links a { font-weight: 600; font-size: .95rem; color: var(--steel); transition: color .2s var(--ease-out); }
.nav-links a:hover { color: var(--asphalt); }
.header-cta { display: flex; align-items: center; gap: 1rem; }
.login-link { font-weight: 600; font-size: .9rem; color: var(--steel); display: none; }
.login-link:hover { color: var(--asphalt); }

@media (min-width: 780px) {
  .nav-links { display: flex; }
  .login-link { display: inline-block; }
}

/* =============================================================
   5. Buttons
   ============================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .85rem 1.5rem; border-radius: var(--radius); font-weight: 700; font-size: .95rem;
  transition: transform .18s var(--ease-out), background .18s var(--ease-out), border-color .18s var(--ease-out);
  white-space: nowrap;
}
.btn-primary { background: var(--amber); color: var(--asphalt); }
.btn-primary:hover { background: var(--amber-dark); }
.btn-dark { background: var(--asphalt); color: var(--concrete); }
.btn-dark:hover { background: var(--asphalt-2); }
.btn-outline { border: 1.5px solid var(--asphalt); color: var(--asphalt); }
.btn-outline:hover { background: var(--asphalt); color: var(--concrete); }
.btn-sm { padding: .55rem 1rem; font-size: .85rem; }
.btn-block { width: 100%; }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* =============================================================
   6. Hero
   ============================================================= */
.hero { padding-block: clamp(3rem, 9vw, 6rem) clamp(2rem, 6vw, 4rem); }
.hero-grid { display: grid; gap: 2.5rem; align-items: center; }
.hero h1 { margin-bottom: 1.1rem; }
.hero .lede { margin-bottom: 2rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .9rem; margin-bottom: 2.5rem; }
.hero-stats { display: flex; gap: clamp(1.5rem, 4vw, 3rem); flex-wrap: wrap; }
.hero-stat b { display: block; font-family: var(--display); font-size: 2rem; }
.hero-stat span { color: var(--steel); font-size: .88rem; }

.route-viz { width: 100%; }
.route-viz svg { width: 100%; height: auto; }

@media (min-width: 960px) {
  .hero-grid { grid-template-columns: 1.05fr 0.95fr; }
}

/* =============================================================
   7. Servicios (cards, flat, industrial)
   ============================================================= */
.services-grid { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; margin-top: 2.5rem; }
.service-card { background: var(--concrete); padding: 1.75rem; }
.service-card h3 { margin-bottom: .5rem; }
.service-card p { color: var(--steel); font-size: .95rem; }

@media (min-width: 640px) { .services-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .services-grid { grid-template-columns: repeat(4, 1fr); } }

/* =============================================================
   8. Cómo funciona (steps — genuinely sequential)
   ============================================================= */
.steps { margin-top: 2.5rem; }
.step-row {
  display: grid; grid-template-columns: auto 1fr; gap: 1.25rem;
  padding-block: 1.5rem; border-top: 1px solid var(--line);
}
.step-row:last-child { border-bottom: 1px solid var(--line); }
.step-num { font-family: var(--display); font-size: 2rem; color: var(--amber); line-height: 1; }
.step-row h3 { margin-bottom: .3rem; }
.step-row p { color: var(--steel); max-width: 52ch; }

/* =============================================================
   9. Para quién / franja oscura
   ============================================================= */
.band-dark { background: var(--asphalt); color: var(--concrete); }
.band-dark .lede { color: var(--steel-light); }
.check-list { list-style: none; display: grid; gap: .9rem; margin-top: 2rem; }
.check-list li { display: flex; gap: .75rem; align-items: flex-start; }
.check-list svg { flex-shrink: 0; margin-top: .2rem; color: var(--amber); }

/* =============================================================
   10. Contacto / lead form
   ============================================================= */
.contact-grid { display: grid; gap: 2.5rem; }
.field { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1.1rem; }
.field label { font-weight: 600; font-size: .88rem; }
.field input, .field select, .field textarea {
  padding: .75rem .9rem; border: 1.5px solid var(--line); border-radius: var(--radius);
  background: #fff; transition: border-color .18s var(--ease-out);
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--asphalt); }
.field textarea { min-height: 110px; resize: vertical; }
.field-row { display: grid; gap: 1rem; }
@media (min-width: 560px) { .field-row { grid-template-columns: 1fr 1fr; } .field-row.field-row-addr { grid-template-columns: 2fr 1fr 1fr; } }
.form-note { font-size: .82rem; color: var(--steel); margin-top: .5rem; }
.form-status { font-size: .9rem; font-weight: 600; margin-top: .9rem; display: none; }
.form-status.is-visible { display: block; }
.form-status.ok { color: var(--route); }
.form-status.err { color: var(--alert); }

/* =============================================================
   11. Footer
   ============================================================= */
.site-footer { border-top: 1px solid var(--line); padding-block: 2.5rem; }
.footer-grid { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1.5rem; align-items: center; }
.footer-links { display: flex; gap: 1.5rem; flex-wrap: wrap; font-size: .88rem; color: var(--steel); }
.footer-links a:hover { color: var(--asphalt); }
.footer-fine { font-size: .82rem; color: var(--steel-light); margin-top: 1.5rem; }

/* =============================================================
   12. Auth (login)
   ============================================================= */
.auth-shell { min-height: 100svh; display: grid; place-items: center; padding: var(--gutter); background: var(--asphalt); }
.auth-card { width: 100%; max-width: 380px; background: var(--concrete); border-radius: var(--radius-lg); padding: 2.25rem; }
.auth-card .brand { justify-content: center; margin-bottom: 1.75rem; color: var(--asphalt); }
.auth-error { background: var(--alert-bg); color: var(--alert); padding: .7rem .9rem; border-radius: var(--radius); font-size: .87rem; font-weight: 600; margin-bottom: 1rem; display: none; }
.auth-error.is-visible { display: block; }
.auth-back { display: block; text-align: center; margin-top: 1.5rem; font-size: .87rem; color: var(--steel); }
.auth-back:hover { color: var(--asphalt); }

/* =============================================================
   13. App shell (panel / portal)
   ============================================================= */
.app-shell { display: flex; min-height: 100svh; }
.app-sidebar {
  width: 232px; background: var(--asphalt); color: var(--concrete);
  padding: 1.5rem 1rem; flex-shrink: 0; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100svh;
}
.app-sidebar .brand { color: var(--concrete); font-size: 1.05rem; margin-bottom: 2.25rem; padding-inline: .5rem; }
.app-nav { display: flex; flex-direction: column; gap: .2rem; flex: 1; }
.app-nav a {
  padding: .7rem .85rem; border-radius: var(--radius); font-weight: 600; font-size: .92rem;
  color: var(--steel-light); display: flex; align-items: center; gap: .65rem;
  transition: background .16s var(--ease-out), color .16s var(--ease-out);
}
.app-nav a:hover { background: var(--asphalt-2); color: var(--concrete); }
.app-nav a.is-active { background: var(--amber); color: var(--asphalt); }
.app-nav svg { width: 18px; height: 18px; flex-shrink: 0; }
.app-user { border-top: 1px solid var(--asphalt-2); padding-top: 1rem; margin-top: 1rem; }
.app-user-name { font-weight: 700; font-size: .9rem; }
.app-user-role { color: var(--steel-light); font-size: .8rem; margin-bottom: .8rem; }

.app-main { flex: 1; min-width: 0; }
.app-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem var(--gutter); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--concrete); z-index: 10;
}
.app-content { padding: var(--gutter); max-width: 1600px; margin-inline: auto; }

.sidebar-toggle { display: inline-flex; background: var(--asphalt); color: var(--concrete); padding: .5rem; border-radius: var(--radius); }
@media (min-width: 900px) { .sidebar-toggle { display: none; } }
@media (max-width: 899px) {
  .app-sidebar { position: fixed; left: 0; top: 0; z-index: 50; transform: translateX(-100%); transition: transform .22s var(--ease-out); }
  .app-sidebar.is-open { transform: translateX(0); }
}

/* =============================================================
   14. Stat cards
   ============================================================= */
.stat-grid { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 2rem; }
.stat-card { background: #fff; padding: 1.4rem 1.5rem; }
.stat-card span { font-size: .82rem; color: var(--steel); font-weight: 600; }
.stat-card b { display: block; font-family: var(--display); font-size: 2.1rem; margin-top: .2rem; }
@media (min-width: 640px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }

/* =============================================================
   15. Panels / tables
   ============================================================= */
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 2rem; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.2rem 1.5rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-head h2 { font-size: 1.1rem; font-family: var(--sans); font-weight: 700; }
.table-scroll { overflow-x: auto; }
table.data th, table.data td { padding: .85rem 1.25rem; text-align: left; font-size: .9rem; white-space: nowrap; }
table.data thead th { color: var(--steel); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--line); }
table.data tbody tr { border-bottom: 1px solid var(--line); }
table.data tbody tr:last-child { border-bottom: none; }
table.data tbody tr:hover { background: var(--concrete); }
.empty-row td { text-align: center; color: var(--steel); padding: 2.5rem 1rem; white-space: normal; }

.badge { display: inline-flex; align-items: center; padding: .3rem .65rem; border-radius: 100px; font-size: .78rem; font-weight: 700; }
.badge-pendiente { background: var(--concrete-2); color: var(--steel); }
.badge-reservada { background: #fdf0dd; color: var(--amber-dark); }
.badge-en_transito { background: #e3edf5; color: #3a6ea5; }
.badge-entregada { background: var(--route-bg); color: var(--route); }
.badge-facturada { background: #ece4f7; color: #6b4c9a; }
.badge-pagada { background: var(--route-bg); color: var(--route); }
.badge-cancelada { background: var(--alert-bg); color: var(--alert); }

.row-actions { display: flex; gap: .5rem; }
.icon-btn { padding: .4rem; border-radius: var(--radius); color: var(--steel); }
.icon-btn:hover { background: var(--concrete-2); color: var(--asphalt); }
.icon-btn svg { width: 17px; height: 17px; }

/* =============================================================
   15b. Tabs (Contabilidad) y checklist de cargas
   ============================================================= */
.tab-switch { display: flex; gap: .4rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--line); }
.tab-btn { padding: .7rem 1rem; font-weight: 600; font-size: .9rem; color: var(--steel); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab-btn:hover { color: var(--asphalt); }
.tab-btn.is-active { color: var(--asphalt); border-bottom-color: var(--amber); }

.check-cargas { display: flex; flex-direction: column; gap: .5rem; max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem; }
.check-carga-row { display: flex; align-items: flex-start; gap: .6rem; font-size: .88rem; }
.check-carga-row input { margin-top: .2rem; }
.check-carga-row .muted { color: var(--steel); font-size: .8rem; }

/* El atributo hidden siempre debe ocultar, aunque la clase del elemento defina display. */
[hidden] { display: none !important; }
.field, .field-row > * { min-width: 0; }
.field input[type="file"] { width: 100%; max-width: 100%; font-size: .82rem; padding: .45rem; }

/* ---------- Selector de idioma ES | EN ---------- */
.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 100px; overflow: hidden; font-size: .72rem; font-weight: 700; flex-shrink: 0; background: transparent; }
.lang-switch button { padding: .28rem .6rem; color: var(--steel); background: transparent; letter-spacing: .05em; line-height: 1.4; cursor: pointer; }
.lang-switch button:hover { color: var(--asphalt); }
.lang-switch button.is-active { background: var(--asphalt); color: var(--concrete); }
.lang-switch-dark { border-color: var(--asphalt-2); margin: 0 0 .9rem; }
.lang-switch-dark button { color: var(--steel-light); }
.lang-switch-dark button:hover { color: var(--concrete); }
.lang-switch-dark button.is-active { background: var(--amber); color: var(--asphalt); }
.lang-switch-corner { position: absolute; top: 1rem; right: 1rem; }
.lang-switch-float { position: fixed; right: 1rem; bottom: 1rem; z-index: 50; background: #fff; }
.auth-card { position: relative; }

/* ---------- Ganancia real / gastos de viaje ---------- */
.modal-wide { max-width: 760px; max-height: 92vh; overflow-y: auto; }
.nav-badge { margin-left: auto; background: var(--alert); color: #fff; border-radius: 100px; font-size: .7rem; font-weight: 700; padding: .05rem .5rem; line-height: 1.5; }
.app-nav a.is-active .nav-badge { background: var(--asphalt); }
table.data.data-compact th, table.data.data-compact td { padding: .7rem .36rem; font-size: .83rem; }
table.data.data-compact th:first-child, table.data.data-compact td:first-child { padding-left: 1rem; }
table.data.data-compact th:last-child, table.data.data-compact td:last-child { padding-right: 1rem; }
table.data.data-compact th { white-space: normal; letter-spacing: .02em; font-size: .72rem; }
table.data.data-compact td { white-space: normal; }
table.data.data-compact td:nth-child(2), table.data.data-compact td:nth-child(3), table.data.data-compact td:nth-child(8) { min-width: 7rem; }
table.data.data-compact td:nth-child(5), table.data.data-compact td:nth-child(6), table.data.data-compact td:nth-child(11) { white-space: nowrap; }
table.data tr.row-alert td { background: var(--alert-bg); }
.alert-banner { background: var(--alert-bg); color: var(--alert); border: 1px solid #e6bfae; border-radius: var(--radius); padding: .8rem 1rem; font-size: .9rem; font-weight: 600; margin-bottom: 1.25rem; }
.gan-pos { color: var(--route); font-weight: 700; }
.gan-neg { color: var(--alert); font-weight: 700; }

/* ---------- Tablero de carga (portal de chofer) ---------- */
.board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.board-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.25rem; display: flex; flex-direction: column; gap: .7rem; }
.board-card-route { font-weight: 700; font-size: 1.02rem; }
.board-card-company { color: var(--steel); font-size: .85rem; }
.board-card-rate { font-family: var(--display); font-size: 1.7rem; font-weight: 700; color: var(--amber-dark); }
.board-card-meta { display: flex; flex-direction: column; gap: .2rem; font-size: .85rem; color: var(--steel); }
.board-card-actions { display: flex; gap: .5rem; margin-top: .4rem; flex-wrap: wrap; }
.board-card-actions .btn { flex: 1; }
.board-card-status { font-size: .82rem; font-weight: 600; padding: .5rem .7rem; border-radius: var(--radius); background: var(--concrete-2); color: var(--steel); }

/* ---------- Calendario en cuadrícula ---------- */
.cal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--line); }
.cal-weekdays span { padding: .6rem .4rem; text-align: center; font-size: .75rem; font-weight: 700; color: var(--steel); text-transform: uppercase; letter-spacing: .03em; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-day {
  min-height: 96px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: .4rem; display: flex; flex-direction: column; gap: .25rem; cursor: pointer; transition: background .15s var(--ease-out);
}
.cal-day:nth-child(7n) { border-right: none; }
.cal-day:hover { background: var(--concrete-2); }
.cal-day.is-empty { cursor: default; background: var(--concrete-2); opacity: .5; }
.cal-day.is-empty:hover { background: var(--concrete-2); }
.cal-day.is-today { background: #fdf0dd; }
.cal-day-num { font-size: .82rem; font-weight: 700; color: var(--asphalt); }
.cal-chip {
  font-size: .72rem; padding: .15rem .4rem; border-radius: 100px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; font-weight: 600;
}
.cal-chip-recogida { background: #e3edf5; color: #3a6ea5; }
.cal-chip-entrega { background: var(--route-bg); color: var(--route); }
.cal-chip-recordatorio { background: var(--concrete-2); color: var(--steel); }
.cal-more { font-size: .72rem; color: var(--steel); font-weight: 600; }
@media (max-width: 720px) {
  .cal-weekdays span { font-size: .62rem; padding: .4rem .1rem; }
  .cal-day { min-height: 64px; padding: .25rem; }
  .cal-chip { display: none; }
}

/* =============================================================
   15c. Factura imprimible
   ============================================================= */
.invoice-shell { background: var(--concrete-2); min-height: 100svh; padding: clamp(1.5rem, 4vw, 3.5rem) 1rem; }
.invoice-toolbar { max-width: 8.5in; margin-inline: auto; display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.invoice-doc { max-width: 8.5in; margin-inline: auto; background: #fff; border-radius: var(--radius-lg); padding: clamp(1.75rem, 5vw, 3rem); border: 1px solid var(--line); }
#invoice-doc.invoice-doc { padding: 0; overflow: hidden; box-shadow: 0 10px 30px rgba(27,30,36,.08); }
.invoice-doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 2rem; flex-wrap: wrap; }
.invoice-doc-head h1 { font-size: 1.6rem; }
.invoice-meta { text-align: right; font-size: .9rem; color: var(--steel); }
.invoice-meta b { display: block; color: var(--asphalt); font-size: 1.05rem; }
.invoice-parties { display: grid; gap: 1.5rem; margin-bottom: 2rem; }
.invoice-parties h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--steel); margin-bottom: .4rem; }
.invoice-total-row td { font-weight: 700; font-size: 1.05rem; border-top: 2px solid var(--asphalt) !important; }
@media (min-width: 560px) { .invoice-parties { grid-template-columns: 1fr 1fr; } }
@media print {
  .no-print { display: none !important; }
  .invoice-shell { background: #fff; padding: 0; }
  .invoice-doc { border: none; padding: 0; max-width: none; }
}

/* =============================================================
   16. Modal
   ============================================================= */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(27, 30, 36, .55); backdrop-filter: blur(2px);
  display: none; align-items: flex-start; justify-content: center; padding: 5vh 1.25rem; z-index: 100; overflow-y: auto;
}
.modal-backdrop.is-open { display: flex; }
.modal { background: #fff; border-radius: var(--radius-lg); width: 100%; max-width: 520px; padding: 2rem; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }
.modal-head h3 { font-size: 1.15rem; }
.modal-close { padding: .3rem; border-radius: var(--radius); color: var(--steel); }
.modal-close:hover { background: var(--concrete-2); }
.modal-actions { display: flex; justify-content: flex-end; gap: .75rem; margin-top: 1.5rem; }

/* =============================================================
   17. Utility text
   ============================================================= */
.text-steel { color: var(--steel); }
.text-sm { font-size: .87rem; }
.mt-0 { margin-top: 0; }

/* =============================================================
   18. Reduced motion
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .app-sidebar { transition: none; }
}

/* =============================================================
   Perfil de chofer (admin y portal del chofer)
   ============================================================= */
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--route); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.avatar-lg { width: 76px; height: 76px; font-size: 1.7rem; }
.avatar-xl { width: 92px; height: 92px; font-size: 2rem; }
.person-cell { display: flex; align-items: center; gap: .75rem; }
.person-cell a { font-weight: 700; color: inherit; }
.person-cell a:hover { text-decoration: underline; }

.profile-head { display: flex; align-items: center; justify-content: space-between; gap: 1.25rem; flex-wrap: wrap; padding: 1.5rem; }
.profile-id { display: flex; align-items: center; gap: 1.1rem; min-width: 0; }
.profile-id h2 { font-family: var(--sans); font-size: 1.4rem; margin-bottom: .35rem; }
.profile-meta { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; color: var(--steel); font-size: .9rem; }
.profile-photo-actions { display: flex; gap: .5rem; margin-top: .6rem; flex-wrap: wrap; }
.profile-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.link-btn { background: none; border: none; padding: 0; color: var(--route); font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer; text-decoration: underline; }
.link-btn.danger { color: var(--alert); }

.info-grid { display: grid; gap: 1.25rem; margin-bottom: 2rem; }
@media (min-width: 720px) { .info-grid { grid-template-columns: repeat(3, 1fr); } }
.info-grid .panel { margin-bottom: 0; }
.info-card-title { padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); font-size: .95rem; font-weight: 700; font-family: var(--sans); color: var(--route); }
.info-row { display: flex; justify-content: space-between; gap: 1rem; padding: .65rem 1.25rem; border-bottom: 1px solid var(--concrete-2); font-size: .9rem; }
.info-row:last-child { border-bottom: none; }
.info-row .label { color: var(--steel); }
.info-row .value { font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.info-row .value.is-warn { color: var(--alert); }

.alert-banner.alert-list { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1.25rem; }

.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1rem; padding: 1.25rem 1.5rem 0; }
.doc-card { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: .6rem; display: flex; flex-direction: column; gap: .4rem; background: #fff; }
.doc-thumb { height: 96px; border-radius: 6px; background: var(--concrete); display: flex; align-items: center; justify-content: center; color: var(--steel); font-weight: 700; overflow: hidden; }
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.doc-card .doc-label { font-weight: 600; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-card .doc-date { font-size: .75rem; color: var(--steel); }
/* Accesos a plataformas de cargas (formulario del cliente y perfil) */
.acceso-fila { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .6rem; align-items: center; }
.acceso-fila input { flex: 1 1 9rem; min-width: 0; }
.acceso-fila .icon-btn { flex: 0 0 auto; }
.acceso-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); gap: .75rem; padding: 1.25rem 1.5rem; align-items: end; border-top: 1px solid var(--line); }
.acceso-form .field { margin-bottom: 0; }
.ac-clave { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .02em; }
.doc-upload { display: grid; gap: .75rem; padding: 1.25rem 1.5rem; align-items: end; }
@media (min-width: 720px) { .doc-upload { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); } }
.doc-upload .row-actions { align-self: end; flex-wrap: wrap; }
.doc-upload .field { margin-bottom: 0; }
.pay-chip { display: inline-block; font-weight: 700; font-size: .8rem; padding: .2rem .55rem; border-radius: 100px; background: var(--concrete-2); color: var(--steel); }
.badge-warn { background: var(--alert-bg); color: var(--alert); }
.filter-bar { display: flex; gap: .75rem; flex-wrap: wrap; padding: 1rem 1.5rem; border-bottom: 1px solid var(--line); }
.filter-bar input, .filter-bar select { padding: .5rem .75rem; border: 1px solid var(--line); border-radius: var(--radius); font: inherit; font-size: .9rem; background: #fff; }
.filter-bar input { flex: 1; min-width: 180px; }

/* Barra inferior del portal del chofer (móvil) */
.driver-tabbar { display: none; }
@media (max-width: 899px) {
  body.has-tabbar { padding-bottom: 72px; }
  .driver-tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -2px 10px rgba(0,0,0,.07); padding-bottom: env(safe-area-inset-bottom, 0); }
  .driver-tabbar a { flex: 1; text-align: center; padding: .6rem .2rem .5rem; font-size: .7rem; font-weight: 600; color: var(--steel); }
  .driver-tabbar a svg { display: block; margin: 0 auto .2rem; width: 21px; height: 21px; }
  .driver-tabbar a.is-active { color: var(--route); }
}
.form-section { font-family: var(--sans); font-size: .85rem; font-weight: 700; color: var(--route); text-transform: uppercase; letter-spacing: .05em; margin: 1.25rem 0 .75rem; padding-top: .9rem; border-top: 1px solid var(--line); }
.form-section:first-of-type { border-top: none; margin-top: 0; padding-top: 0; }

/* =============================================================
   Tablero de cargas del chofer (tabla estilo load board)
   ============================================================= */
.ts-board { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.ts-toolbar { background: var(--asphalt); color: #fff; padding: .85rem 1rem; display: flex; flex-direction: column; gap: .75rem; }
.ts-title { display: flex; align-items: baseline; gap: .75rem; }
.ts-title b { font-size: 1.05rem; }
.ts-title span { background: var(--amber); color: var(--asphalt); font-weight: 800; font-size: .78rem; padding: .15rem .55rem; border-radius: 100px; }
.ts-filters { display: flex; gap: .5rem; flex-wrap: wrap; }
.ts-filters input, .ts-filters select { flex: 1 1 150px; min-width: 0; padding: .5rem .7rem; border: 1px solid #3a404c; border-radius: var(--radius); background: #fff; color: var(--asphalt); font: inherit; font-size: .88rem; }
.ts-reset { background: transparent; border: 1px solid #5b6472; color: #fff; border-radius: var(--radius); padding: .5rem .9rem; font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; }
.ts-reset:hover { background: #fff; color: var(--asphalt); }
.ts-scroll { overflow-x: auto; }
.ts-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.ts-table thead th { position: sticky; top: 0; background: var(--concrete-2); color: var(--steel); font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; text-align: left; padding: .6rem .45rem; border-bottom: 1px solid var(--line); white-space: nowrap; cursor: pointer; user-select: none; }
.ts-table thead th[data-sort]:hover { color: var(--asphalt); }
.ts-table thead th.is-sorted { color: var(--asphalt); }
.ts-table thead th.is-sorted::after { content: " " attr(data-arrow); font-size: .62rem; }
.ts-row { border-bottom: 1px solid var(--concrete-2); cursor: pointer; }
.ts-row:nth-child(4n+1) { background: #fafaf7; }
.ts-row:hover { background: #eef4f1; }
.ts-row td { padding: .55rem .45rem; vertical-align: middle; white-space: nowrap; }
.ts-row td:first-child, .ts-table thead th:first-child { padding-left: .9rem; }
.ts-row td:last-child, .ts-table thead th:last-child { padding-right: .9rem; }
.ts-row .c-age { font-weight: 700; color: var(--steel); }
.ts-row .c-age.is-new { color: var(--route); }
.ts-row .c-origin b, .ts-row .c-dest b { font-weight: 700; color: var(--asphalt); }
.ts-st { color: var(--steel); font-weight: 600; }
.ts-chip { display: inline-block; background: var(--concrete-2); color: var(--asphalt); font-weight: 600; font-size: .76rem; padding: .15rem .5rem; border-radius: 100px; }
.ts-row .c-co { color: var(--steel); white-space: normal; min-width: 90px; max-width: 120px; line-height: 1.2; }
.ts-row .c-rate { font-weight: 800; font-size: 1rem; color: var(--route); }
.ts-row .c-pm { font-weight: 700; color: var(--route); }
.ts-row .c-pm small { font-weight: 600; color: var(--steel); }
.ts-actions { display: flex; gap: .35rem; align-items: center; }
.ts-btn { border: 1px solid var(--line); background: #fff; color: var(--asphalt); border-radius: var(--radius); padding: .38rem .6rem; font: inherit; font-size: .8rem; font-weight: 700; cursor: pointer; }
.ts-btn:hover { border-color: var(--asphalt); }
.ts-btn-book { background: var(--route); border-color: var(--route); color: #fff; }
.ts-btn-book:hover { background: #2f564a; border-color: #2f564a; }
.ts-btn-pass { color: var(--alert); padding-inline: .55rem; }
.ts-status { font-size: .78rem; font-weight: 600; color: var(--steel); background: var(--concrete-2); padding: .3rem .6rem; border-radius: var(--radius); white-space: normal; display: inline-block; }
.ts-row.is-passed { opacity: .55; }
.ts-row.is-open { background: #eef4f1; }
.ts-detail td { background: #f4f8f6; padding: .9rem 1.1rem 1.1rem; border-bottom: 1px solid var(--line); }
.ts-detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .9rem 1.5rem; }
.ts-detail-grid span, .ts-notes span { display: block; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--steel); }
.ts-detail-grid b { font-size: .95rem; }
.ts-notes { margin-top: .9rem; font-size: .9rem; }
.ts-empty td { text-align: center; color: var(--steel); padding: 2.5rem 1rem; }

/* En pantallas medianas la empresa pasa al detalle para que la tabla no necesite barra de desplazamiento. */
@media (min-width: 900px) and (max-width: 1500px) {
  .ts-table th[data-sort="empresa"], .ts-row .c-co { display: none; }
}

@media (max-width: 899px) {
  .ts-table, .ts-table tbody { display: block; }
  .ts-table thead { display: none; }
  .ts-row { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .6rem; padding: .85rem 1rem; }
  .ts-row td { padding: 0; }
  .ts-row .c-origin { order: 1; flex: 1 1 60%; font-size: 1rem; }
  .ts-row .c-rate { order: 2; margin-left: auto; font-size: 1.25rem; }
  .ts-row .c-dest { order: 3; flex: 1 1 60%; font-size: 1rem; }
  .ts-row .c-pm { order: 4; margin-left: auto; font-size: .8rem; }
  .ts-row .c-age, .ts-row .c-pick, .ts-row .c-trip, .ts-row .c-equip, .ts-row .c-size, .ts-row .c-co { order: 5; font-size: .78rem; color: var(--steel); }
  .ts-row .c-co { max-width: none; }
  .ts-row .c-act { order: 9; flex: 1 1 100%; margin-top: .5rem; }
  .ts-actions { width: 100%; }
  .ts-actions .ts-btn-book, .ts-actions .ts-btn:not(.ts-btn-pass) { flex: 1; padding-block: .6rem; }
  .ts-row:nth-child(4n+1) { background: #fff; }
  .ts-detail { display: block; }
  .ts-detail[hidden] { display: none; }
  .ts-detail td { display: block; }
}

.input-action { display: flex; gap: .5rem; align-items: stretch; }
.input-action input { flex: 1; min-width: 0; }
.input-action .btn { white-space: nowrap; }

@media (min-width: 960px) { .stat-grid.stat-grid-5 { grid-template-columns: repeat(5, 1fr); } }
.stat-grid.stat-grid-5 .stat-card b { font-size: 1.8rem; }

/* Zona de limpieza de datos de prueba */
.danger-zone { border-color: #e6bfae; }
.danger-zone .panel-head h2 { color: var(--alert); }
.limpiar-lista { display: grid; gap: .5rem; }
.limpiar-item { display: flex; gap: .75rem; align-items: flex-start; padding: .7rem .9rem; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.limpiar-item input { margin-top: .25rem; width: 18px; height: 18px; flex: none; }
.limpiar-item.is-empty { opacity: .5; cursor: default; }
.btn-danger { background: var(--alert); color: #fff; border: 1px solid var(--alert); }
.btn-danger:hover:not(:disabled) { background: #a8431f; }
.btn-danger:disabled { opacity: .45; cursor: not-allowed; }

/* Visitas al sitio (Resumen del panel) */
.vis-chart { display: flex; align-items: flex-end; gap: 3px; height: 90px; padding-bottom: .25rem; border-bottom: 1px solid var(--line); }
.vis-bar { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.vis-bar i { display: block; width: 100%; min-height: 2px; background: var(--route); border-radius: 2px 2px 0 0; opacity: .85; }
.vis-bar:hover i { opacity: 1; background: var(--amber-dark); }
.vis-cols { display: grid; gap: 1.5rem; margin-top: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.vis-cols h4 { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--steel); margin-bottom: .5rem; }
.vis-list { list-style: none; padding: 0; display: grid; gap: .3rem; font-size: .9rem; }
.vis-list li { display: flex; justify-content: space-between; gap: .75rem; }

/* Selector de idioma de la barra del contrato */
.lang-pick { border: 1px solid var(--line); border-radius: var(--radius); padding: .38rem .6rem; font: inherit; font-size: .85rem; background: #fff; }

/* Factura (pantalla e impresión) */
.inv { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.inv-band { background: #0a1626; color: #fff; display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; flex-wrap: wrap; padding: 2rem clamp(1.25rem, 4vw, 2.75rem); border-bottom: 4px solid var(--amber); }
.inv-brand { display: flex; align-items: center; gap: 1rem; }
.inv-mark { background: var(--amber); color: #0a1626; font-family: var(--display); font-weight: 700; font-size: 1.45rem; letter-spacing: .02em; width: 54px; height: 54px; display: grid; place-items: center; border-radius: 4px; }
.inv-brand b { display: block; font-family: var(--display); font-size: 1.45rem; letter-spacing: .04em; line-height: 1.1; }
.inv-brand div span { display: block; font-size: .74rem; letter-spacing: .08em; color: #bdc6d3; line-height: 1.5; }
.inv-title { text-align: right; }
.inv-title b { display: block; font-family: var(--display); font-size: clamp(2rem, 6vw, 2.9rem); letter-spacing: .06em; color: var(--amber); line-height: 1; }
.inv-title span { font-size: .95rem; color: #fff; }
.inv-body { padding: clamp(1.5rem, 4vw, 2.5rem) clamp(1.25rem, 4vw, 2.75rem) clamp(1.25rem, 3vw, 2rem); }
.inv-parties { display: grid; gap: 1.75rem; margin-bottom: 2rem; }
@media (min-width: 640px) { .inv-parties { grid-template-columns: repeat(3, 1fr); } }
.inv-parties h4 { font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; color: var(--steel); margin-bottom: .75rem; padding-bottom: .4rem; position: relative; }
.inv-parties h4::after { content: ""; position: absolute; left: 0; bottom: 0; width: 28px; height: 2px; background: var(--amber); }
.inv-parties p { font-size: .88rem; color: var(--steel); line-height: 1.55; overflow-wrap: anywhere; }
.inv-parties p strong { display: block; color: var(--asphalt); font-size: 1rem; margin-bottom: .15rem; }
.inv-dl { display: grid; gap: .45rem; font-size: .88rem; }
.inv-dl > div { display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
.inv-dl dt { color: var(--steel); }
.inv-dl dd { margin: 0; font-weight: 700; text-align: right; }
.inv-chip { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: .28rem .7rem; border-radius: 3px; color: #fff; }
.inv-chip.is-pending { background: var(--amber); }
.inv-chip.is-paid { background: var(--route); }
.inv-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.inv-table thead th { border: 0; background: #0a1626; color: #fff; font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; text-align: left; padding: .8rem .9rem; font-weight: 700; }
.inv-table td { padding: .7rem .9rem; border: 0; border-bottom: 1px solid var(--line); vertical-align: top; height: auto; }
.inv-table tbody tr:nth-child(even) td { background: #f6f5f1; }
.inv-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.inv-ref { display: block; font-size: .72rem; color: var(--steel-light); font-weight: 400; margin-top: .1rem; }
.inv-bottom { display: grid; gap: 1.5rem; margin-top: 1.75rem; align-items: start; }
@media (min-width: 640px) { .inv-bottom { grid-template-columns: 1fr 1fr; } }
.inv-pay { background: #f6f5f1; border-left: 3px solid var(--amber); padding: 1rem 1.15rem; font-size: .86rem; }
.inv-pay h4 { font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; color: var(--steel); margin-bottom: .5rem; }
.inv-pay p + p { margin-top: .3rem; }
.inv-sub { display: flex; justify-content: space-between; color: var(--steel); font-size: .9rem; padding: 0 .25rem .6rem; }
.inv-sub b { color: var(--asphalt); }
.inv-due { background: #0a1626; color: #fff; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1.1rem 1.3rem; }
.inv-due span:first-child, .inv-due div span { display: block; font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: #bdc6d3; }
.inv-due div b { display: block; font-family: var(--display); font-size: 2.2rem; color: var(--amber); line-height: 1.1; }
.inv-foot { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--line); font-size: .78rem; color: var(--steel); }
.inv-foot p + p { margin-top: .15rem; }
@media (max-width: 559px) {
  .inv-title { text-align: left; }
  .inv-table thead { display: none; }
  .inv-table, .inv-table tbody, .inv-table tr, .inv-table td { display: block; width: 100%; }
  .inv-table tr { padding: .6rem 0; border-bottom: 1px solid var(--line); }
  .inv-table td { border: 0; padding: .2rem .5rem; display: flex; justify-content: space-between; gap: 1rem; background: none !important; }
  .inv-table td::before { content: attr(data-label); color: var(--steel); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; }
  .inv-table td:first-child { display: block; }
  .inv-table td:first-child::before { display: none; }
}
@media print {
  #invoice-doc.invoice-doc { box-shadow: none; border-radius: 0; }
  .inv-band { padding: 1.5rem 2rem; }
  @page { margin: 0; }
  .inv-body { padding: 1.5rem 2rem; }
}

/* Documentos en tamaño carta (8.5 x 11 in): la hoja se ve completa aunque tenga una sola línea */
@page { size: letter; margin: .5in; }
@page factura { size: letter; margin: 0; }
@media (min-width: 900px) {
  .invoice-doc { min-height: 11in; }
  #invoice-doc.invoice-doc { display: flex; flex-direction: column; }
  #invoice-doc .inv { flex: 1; display: flex; flex-direction: column; }
  #invoice-doc .inv-body { flex: 1; display: flex; flex-direction: column; }
  #invoice-doc .inv-foot { margin-top: auto; }
}
@media print {
  .inv { page: factura; }
  .invoice-doc { min-height: 0; }
  #invoice-doc.invoice-doc { display: flex; flex-direction: column; width: 8.5in; max-width: none; min-height: calc(11in - 2px); }
  #invoice-doc .inv { flex: 1; display: flex; flex-direction: column; }
  #invoice-doc .inv-body { flex: 1; display: flex; flex-direction: column; }
  #invoice-doc .inv-foot { margin-top: auto; }
  html, body { background: #fff; }
}

/* Pagar una factura */
.pay-summary { display: flex; gap: 2rem; flex-wrap: wrap; background: #0a1626; color: #fff; padding: 1rem 1.25rem; border-radius: var(--radius); margin-bottom: 1.25rem; }
.pay-summary span { display: block; font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: #bdc6d3; }
.pay-summary b { font-family: var(--display); font-size: 1.8rem; line-height: 1.1; }
.pay-summary div:first-child b { color: var(--amber); }
.pay-opt { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1rem; }
.pay-opt h4 { font-size: .95rem; margin-bottom: .5rem; }
.pay-instr { background: #f6f5f1; border-left: 3px solid var(--amber); padding: .7rem 1rem; margin: .5rem 0; font-size: .9rem; white-space: pre-line; }
.pay-ok { background: var(--route-bg); color: var(--route); font-weight: 600; padding: .9rem 1.1rem; border-radius: var(--radius); }
.pay-review { background: #fff7e8; border-left: 3px solid var(--amber); padding: 1rem 1.25rem; }
.pay-review p { margin: .4rem 0 .8rem; }

/* Guía de tarifa por milla (nueva carga y portal del cliente) */
.rate-guide { border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; margin-bottom: 1rem; background: #fbfaf7; }
.rate-guide-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem 1.25rem; margin-bottom: .75rem; }
.rate-guide-grid span { display: block; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--steel); }
.rate-chip { font-size: .86rem; font-weight: 600; padding: .55rem .8rem; border-radius: var(--radius); }
.rate-chip.is-ok { background: var(--route-bg); color: var(--route); }
.rate-chip.is-bad { background: var(--alert-bg); color: var(--alert); }
.rate-chip.is-info { background: #eef0f3; color: var(--steel); font-weight: 500; }
.pm-bajo { color: var(--alert); font-weight: 700; }

/* Lectura de documentos con IA */
.ia-box { border: 1px dashed var(--amber); background: #fff9ef; border-radius: var(--radius); padding: .85rem 1rem; margin-bottom: 1.1rem; display: grid; gap: .5rem; }
.ia-box .form-note { margin: 0; }
.ia-box .input-action { flex-wrap: wrap; }
.ia-box .input-action input[type=file] { flex: 1 1 12rem; min-width: 0; max-width: 100%; }

/* Casilla con su texto en una línea (Ajustes → documentos de los choferes) */
.check-row { display: flex; align-items: center; gap: .5rem; font-weight: 500; cursor: pointer; }
.check-row input[type="checkbox"] { width: auto; min-width: 0; margin: 0; flex: none; }

/* Paquete de registro de transportista (solicitud.html) y su revisión en el panel */
.pk-shell { max-width: 880px; margin: 0 auto; padding: 1.25rem var(--gutter) 4rem; }
.pk-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.pk-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: clamp(1.1rem, 3vw, 2.25rem); }
.pk-steps { display: flex; gap: .4rem; list-style: none; padding: 0; margin: 0 0 1.75rem; flex-wrap: wrap; }
.pk-steps li { flex: 1 1 100px; border-top: 3px solid var(--line); padding-top: .45rem; font-size: .72rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--steel-light); }
.pk-steps li.is-active { color: var(--asphalt); border-color: var(--amber); }
.pk-steps li.is-done { color: var(--route); border-color: var(--route); }
.pk-h { font-size: 1.55rem; margin-bottom: .35rem; }
.pk-lead { color: var(--steel); font-size: .95rem; margin-bottom: 1.5rem; }
.pk-sec { font-family: var(--sans); font-size: .76rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--steel); margin: 1.5rem 0 .85rem; padding-bottom: .35rem; border-bottom: 1px solid var(--line); }
.pk-grid3 { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.pk-yn { display: flex; gap: 1.25rem; padding-top: .15rem; }
.pk-states { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .45rem .9rem; font-size: .88rem; }
.pk-terms { display: grid; gap: .25rem; background: var(--concrete); border-left: 3px solid var(--amber); border-radius: var(--radius); padding: .85rem 1.1rem; margin-bottom: 1.4rem; font-size: .92rem; }
.pk-doc { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; margin-bottom: .75rem; }
.pk-doc input[type="file"] { max-width: 260px; font-size: .82rem; }
.pk-contract { max-height: 340px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; background: var(--concrete); font-size: .86rem; line-height: 1.55; }
.pk-contract h4 { font-size: .8rem; margin: .9rem 0 .2rem; }
.pk-contract h4:first-child { margin-top: 0; }
.pk-sig { width: 100%; max-width: 420px; height: 150px; border: 1.5px solid var(--line); border-radius: var(--radius); background: #fff; touch-action: none; cursor: crosshair; }
.pk-nav { display: flex; justify-content: space-between; gap: .75rem; margin-top: 1.75rem; flex-wrap: wrap; }
.pk-err { background: var(--alert-bg); color: var(--alert); font-weight: 600; font-size: .9rem; padding: .75rem 1rem; border-radius: var(--radius); margin-top: 1.25rem; }
.pk-warn { background: #fff7e8; border-left: 3px solid var(--amber); padding: .85rem 1.1rem; border-radius: var(--radius); margin-bottom: 1.25rem; font-size: .92rem; white-space: pre-line; }
.pk-final { text-align: center; padding: 2rem 0; }
.pk-final .pk-lead { max-width: 480px; margin: 0 auto 1.5rem; }
.pk-ico { width: 56px; height: 56px; border-radius: 50%; background: var(--route-bg); color: var(--route); font-size: 1.8rem; font-weight: 700; display: grid; place-items: center; margin: 0 auto 1rem; }
.pk-resumen { display: grid; gap: .15rem 1.5rem; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin-bottom: 1rem; }
.pk-resumen > div { padding: .35rem 0; border-bottom: 1px solid var(--concrete-2); }
.pk-resumen span { display: block; font-size: .68rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--steel); }
.pk-resumen b { font-weight: 600; font-size: .92rem; overflow-wrap: anywhere; }
.modal.pk-modal-wide { max-width: 820px; }

/* Ventana de lead: ancha, con el mensaje largo desplazable y botones que no se salen */
.modal.lead-modal { max-width: 760px; }
.lead-modal .lead-mensaje { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 28vh; overflow-y: auto; background: var(--concrete-2); border-radius: var(--radius); padding: .75rem 1rem; line-height: 1.55; }
.lead-modal .modal-actions { flex-wrap: wrap; }
.lead-modal .modal-actions .row-actions { display: flex; flex-wrap: wrap; gap: .75rem; }
@media (max-width: 600px) {
  .lead-modal { padding: 1.25rem; }
  .lead-modal .modal-actions, .lead-modal .modal-actions .row-actions { flex-direction: column; align-items: stretch; }
}

/* Paquetes de servicio: tarjeta por paquete en Ajustes y formulario de envío en la solicitud */
.pk-plan { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1rem .75rem; margin-bottom: .75rem; background: var(--concrete); }
.pk-plan .field-row { grid-template-columns: 2fr 1fr 1fr 1fr; }
.pk-form-paquete { background: var(--concrete); border-radius: var(--radius); padding: .25rem 1rem 1rem; margin-bottom: 1rem; }
.pk-form-paquete .field-row { grid-template-columns: repeat(3, 1fr); }
.pk-form-paquete .field-row:last-of-type { grid-template-columns: 1fr 1fr; }
.pk-cambiar { margin: .75rem 0 1rem; }
.pk-cambiar summary { cursor: pointer; font-weight: 600; font-size: .92rem; color: var(--steel); }
@media (max-width: 600px) { .pk-plan .field-row, .pk-form-paquete .field-row, .pk-form-paquete .field-row:last-of-type { grid-template-columns: 1fr; } }

.pk-persona { border: 1px solid var(--line); border-radius: var(--radius, 8px); padding: 1rem; margin-bottom: 1rem; background: var(--surface, #fff); }
.pk-persona-top { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .75rem; }

/* =============================================================
   Prospectos (captación por correo)
   ============================================================= */
.po-barra { padding: 0 1.5rem 1rem; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1.5rem; }
.po-barra .form-note { margin: 0; }
.po-filtros { display: flex; flex-wrap: wrap; gap: .6rem; }
.po-filtros select, .po-filtros input { padding: .55rem .75rem; border: 1.5px solid var(--line); border-radius: var(--radius); background: #fff; font-size: .9rem; }
.po-filtros input { min-width: 17rem; }
#po-aviso { margin: 0 1.5rem 1rem; }
.po-dots { display: inline-flex; gap: 4px; vertical-align: middle; }
.po-dot { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--steel-light); }
.po-dot.is-on { background: var(--route); border-color: var(--route); }
.po-hist { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .45rem; }
.po-hist li { padding: .5rem .75rem; border-left: 3px solid var(--line); background: var(--concrete); border-radius: 0 var(--radius) var(--radius) 0; font-size: .92rem; overflow-wrap: anywhere; }
.po-hist li .text-sm { display: block; }
.po-plantilla { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.po-plantilla > b { display: block; margin-bottom: .75rem; }
.po-plantilla textarea { width: 100%; min-height: 12rem; }
.po-prev { white-space: pre-wrap; font: inherit; font-size: .9rem; background: var(--concrete); padding: .85rem 1rem; border-radius: var(--radius); overflow-wrap: anywhere; margin: 0 0 1rem; }
.panel-head .row-actions { flex-wrap: wrap; }
@media (max-width: 640px) {
  .po-filtros, .po-filtros select, .po-filtros input { width: 100%; min-width: 0; }
  #po-aviso { margin-inline: 1rem; }
  .po-barra { padding-inline: 1rem; }
}
.po-enviar-a { padding: .5rem .75rem; border: 1.5px solid var(--asphalt); border-radius: var(--radius); background: #fff; font: inherit; font-size: .85rem; font-weight: 600; }
.po-lbl { align-self: center; font-size: .85rem; font-weight: 600; color: var(--steel); }

/* Página pública de paquetes (paquetes.html) */
.pq-shell { max-width: 1040px; }
.pq-head { text-align: center; margin: 1.5rem 0 1.75rem; }
.pq-head .pk-lead { max-width: 560px; margin: 0 auto; }
.pq-grid { display: grid; gap: 1rem; margin-bottom: 1.25rem; }
@media (min-width: 820px) { .pq-grid { grid-template-columns: repeat(3, 1fr); align-items: stretch; } }
.pq-card { position: relative; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.6rem 1.4rem 1.4rem; }
.pq-card.is-top { border: 2px solid var(--amber); box-shadow: 0 8px 28px rgba(0,0,0,.08); }
.pq-flag { position: absolute; top: -.7rem; left: 1.4rem; background: var(--amber); color: #fff; font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding: .2rem .65rem; border-radius: 999px; }
.pq-name { font-size: 1.35rem; margin-bottom: .35rem; }
.pq-price { display: flex; flex-direction: column; margin-bottom: 1rem; }
.pq-price b { font-family: "Barlow Condensed", var(--sans); font-size: 2.6rem; line-height: 1; color: var(--route); }
.pq-price span { color: var(--steel); font-size: .85rem; }
.pq-list { list-style: none; margin: 0 0 1.4rem; padding: 0; display: grid; gap: .55rem; align-content: start; font-size: .92rem; flex: 1; }
.pq-list li { position: relative; padding-left: 1.4rem; }
.pq-list li::before { content: "✓"; position: absolute; left: 0; color: var(--amber-dark, var(--amber)); font-weight: 700; }
.pq-list-plain { margin-bottom: 0; }
.pq-card .btn { width: 100%; justify-content: center; }
.pq-pago { margin-bottom: 1rem; }
.pq-foot { text-align: center; color: var(--steel); font-size: .88rem; margin: 1.25rem 0 1.5rem; }
.pq-form-wrap { margin-top: 1rem; }
.pq-form { max-width: 640px; margin: 0 auto; }
.pq-pay { font-size: .85rem; font-weight: 600; color: var(--route); margin: -.4rem 0 .9rem; }
