/* Branpaque: pantallas del personal y rastreo publico. Movil primero.
   Tokens en :root, tema oscuro por preferencia del sistema. Sin fuentes
   externas: la CSP solo permite recursos propios y la fuente del sistema
   es la mas rapida en un telefono. */
:root {
  --bg: #f3f5f4; --surface: #ffffff; --surface-2: #eef2f1;
  --ink: #172026; --muted: #5d6b73; --line: #dde3e1; --line-strong: #c3ccc9;
  --brand: #0f6e6b; --brand-ink: #ffffff; --brand-soft: #dcefec; --brand-hover: #0c5b58;
  --ok: #1f8f5f; --ok-soft: #e3f4ec; --warn: #b7791f; --warn-soft: #fbf0da; --bad: #c43d3d; --bad-soft: #fbe6e6;
  --focus: #0f6e6b66;
  --accent: #f26b1d; --accent-ink: #ffffff; --accent-soft: #fde7d9;
  --hero: #0e2a2c; --hero-2: #14393b; --hero-ink: #ffffff; --hero-muted: #a9c4c1;
  --tint-teal: #dcefec; --tint-orange: #fde7d9; --tint-blue: #dfe9fb; --tint-violet: #ece6fb; --tint-red: #fbe3e3;
  --radius: 12px; --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(23,32,38,.06), 0 4px 16px rgba(23,32,38,.06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --tabbar-h: 68px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1416; --surface: #171d20; --surface-2: #1f2629;
    --ink: #e7ecea; --muted: #98a5a2; --line: #2a3336; --line-strong: #3a464a;
    --brand: #4fb3ad; --brand-ink: #0b1a19; --brand-soft: #163a38; --brand-hover: #63c3bd;
    --ok: #4cc38a; --ok-soft: #123626; --warn: #e0a84a; --warn-soft: #3a2c12; --bad: #f06a6a; --bad-soft: #3d1c1c;
    --focus: #4fb3ad66;
    --accent: #ff7d33; --accent-ink: #1b0c02; --accent-soft: #3a2012;
    --hero: #0a1d1f; --hero-2: #10292b; --hero-ink: #ffffff; --hero-muted: #93aeab;
    --tint-teal: #163a38; --tint-orange: #3a2012; --tint-blue: #172a44; --tint-violet: #251d3d; --tint-red: #3d1c1c;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
/* El atributo hidden gana siempre, aunque el elemento tenga display propio. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
body {
  margin: 0; min-height: 100%; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 15px; line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -.01em; text-wrap: balance; }
h2 { font-size: 1.05rem; margin: 0 0 .6rem; }
p { margin: .4rem 0; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.code { font-family: var(--mono); font-size: 1.15rem; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

/* Barra superior */
.appbar {
  position: sticky; top: 0; z-index: 30; background: var(--surface); border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px);
}
.appbar .inner { max-width: 1040px; margin: 0 auto; padding: 0 16px; height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand .logo { width: 28px; height: 28px; border-radius: 8px; background: var(--brand); display: grid; place-items: center; color: var(--brand-ink); font-size: 14px; font-weight: 800; }
.brand .sub { color: var(--muted); font-weight: 500; font-size: .85rem; }
.topnav { display: none; gap: 4px; align-items: center; }
/* Salir en el telefono (la barra de arriba solo aparece desde 900 px). */
.logout-m { margin-left: auto; }
.logout-m button {
  min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer;
}
.topnav a, .topnav button { color: var(--ink); padding: 8px 12px; border-radius: 8px; font-weight: 500; background: none; border: 0; font: inherit; cursor: pointer; }
.topnav a:hover, .topnav button:hover { background: var(--surface-2); text-decoration: none; }
.topnav a.active { background: var(--brand-soft); color: var(--brand); }
.userchip { display: none; align-items: center; gap: 8px; color: var(--muted); font-size: .9rem; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: .85rem; }

/* Barra inferior (movil): 5 pestanas, escanear al centro y destacado */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface);
  border-top: 1px solid var(--line); box-shadow: 0 -6px 24px rgba(15,42,44,.06);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tabbar a { height: var(--tabbar-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: .7rem; font-weight: 600; }
.tabbar a:hover { text-decoration: none; }
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a.active { color: var(--accent); }
.tabbar a.active svg { fill: var(--accent-soft); }
.tabbar a.scan { position: relative; color: var(--ink); }
.tabbar a.scan .fab {
  width: 60px; height: 60px; margin-top: -26px; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; box-shadow: 0 8px 20px rgba(242,107,29,.35); border: 4px solid var(--surface);
}
.tabbar a.scan .fab svg { width: 28px; height: 28px; fill: none; }
.tabbar a.scan.active { color: var(--accent); }

/* Contenido */
.page { max-width: 1040px; margin: 0 auto; padding-inline: 16px; padding-block: 16px calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom, 0px)); }
.page.narrow { max-width: 520px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card + .card, .stack > * + * { margin-top: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 12px; }
.row { display: grid; grid-template-columns: 1fr; gap: 12px; }
.row.two { grid-template-columns: 1fr 1fr; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.actions .btn { flex: 1 1 140px; }
.kv { display: grid; grid-template-columns: 1fr; gap: 10px; }
.kv > div { display: grid; gap: 2px; }
.kv .k { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.kv .v { font-weight: 500; }
hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px;
  border-radius: var(--radius-sm); font: inherit; font-weight: 600; font-size: 1rem; cursor: pointer; text-decoration: none;
  border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink); transition: background .12s, transform .05s;
  -webkit-user-select: none; user-select: none;
}
.btn:hover { background: var(--brand-hover); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: var(--surface); color: var(--brand); }
.btn.secondary:hover { background: var(--brand-soft); }
.btn.ghost { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.block { width: 100%; }
.btn.lg { min-height: 56px; font-size: 1.05rem; }
.btn.icon { min-width: 48px; padding: 0 12px; }
.btn svg { width: 22px; height: 22px; flex: none; }
.btn[disabled] { opacity: .55; cursor: default; }

/* Formularios */
.field { display: grid; gap: 6px; }
.field + .field { margin-top: 12px; }
.row > .field + .field { margin-top: 0; }
.field label, .field .label { font-size: .86rem; font-weight: 600; color: var(--muted); }
.field .help { font-size: .82rem; color: var(--muted); }
input, select, textarea {
  width: 100%; min-height: 48px; padding: 10px 12px; font: inherit; font-size: 16px; /* 16px evita el zoom de iOS */
  color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
}
textarea { min-height: 72px; resize: vertical; }
select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 21px, calc(100% - 13px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--focus); outline: none; }
input[type="checkbox"] { width: 22px; height: 22px; min-height: 0; accent-color: var(--brand); }
.errorlist { color: var(--bad); list-style: none; padding: 0; margin: 4px 0 0; font-size: .88rem; }
.input-group { display: flex; gap: 8px; }
.input-group input { flex: 1; min-width: 0; }
.code-input input { font-family: var(--mono); font-size: 1.2rem; letter-spacing: .06em; text-transform: uppercase; min-height: 56px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 500; }

/* Chips */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.chip.active { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.chip.context { background: var(--brand-soft); border-color: transparent; color: var(--brand); }

/* Estados */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--surface-2); color: var(--ink); white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.badge.ok { background: var(--ok-soft); color: var(--ok); } .badge.ok::before { background: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); } .badge.warn::before { background: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); } .badge.bad::before { background: var(--bad); }

/* Mensajes y resultado */
.messages { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
.messages li, .result { padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); border-left-width: 5px; border-left-color: var(--brand); }
.messages li.success, .result.ok { border-left-color: var(--ok); background: var(--ok-soft); }
.messages li.error, .result.bad { border-left-color: var(--bad); background: var(--bad-soft); }
.messages li.warning, .result.warn { border-left-color: var(--warn); background: var(--warn-soft); }
.result { display: grid; gap: 4px; margin-bottom: 12px; }
.result .title { font-weight: 700; font-size: 1.05rem; }
.result[hidden] { display: none; }

/* Listas de registros */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list a.rowlink { display: flex; align-items: center; gap: 12px; flex: 1; color: inherit; min-width: 0; }
.list a.rowlink:hover { text-decoration: none; }
.list .main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.list .main .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .main .s { color: var(--muted); font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--muted); }
.list .dot.ok { background: var(--ok); } .list .dot.bad { background: var(--bad); }
.chev { color: var(--muted); flex: none; }

/* Linea de tiempo */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; border-left: 2px solid var(--line); margin-left: 6px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--brand); border: 2px solid var(--surface); }
.timeline .when { font-size: .8rem; color: var(--muted); }
.timeline .mono { white-space: nowrap; }

/* Tablas (escritorio) */
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
.table-wrap { overflow-x: auto; }

/* Bultos en recepcion */
.parcel { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; background: var(--surface-2); position: relative; }
.parcel + .parcel { margin-top: 10px; }
.parcel .head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-weight: 600; }
.parcel .remove { background: none; border: 0; color: var(--bad); font: inherit; font-weight: 600; cursor: pointer; padding: 6px; }
.parcel.removed { display: none; }
.sticky-actions { position: sticky; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 1px solid var(--line); margin: 16px -16px -16px; padding: 12px 16px calc(12px + 0px); display: flex; gap: 10px; align-items: center; z-index: 5; }
.sticky-actions .sum { flex: 1; font-size: .9rem; color: var(--muted); }

/* Hoja de camara */
.sheet { position: fixed; inset: 0; z-index: 100; background: #000; color: #fff; display: flex; flex-direction: column; }
.sheet[hidden] { display: none; }
.sheet .bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 10px; background: rgba(0,0,0,.6); }
.sheet .bar .title { font-weight: 600; }
.sheet .bar button { background: rgba(255,255,255,.14); border: 0; color: #fff; min-width: 44px; min-height: 44px; border-radius: 10px; font: inherit; font-weight: 600; padding: 0 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.sheet .bar button.on { background: var(--brand); }
.sheet .view { flex: 1; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.sheet .view video { width: 100% !important; height: 100% !important; object-fit: cover; }
#camera-view { width: 100%; height: 100%; }
#camera-view img[alt="Info icon"], #camera-view img[alt="Camera based scan"] { display: none; }
.sheet .frame { position: absolute; left: 50%; top: 50%; width: min(86vw, 380px); height: min(40vw, 200px); transform: translate(-50%, -50%); border: 3px solid rgba(255,255,255,.85); border-radius: 12px; box-shadow: 0 0 0 200vmax rgba(0,0,0,.35); pointer-events: none; transition: border-color .15s; }
.sheet.flash .frame { border-color: var(--ok); box-shadow: 0 0 0 200vmax rgba(31,143,95,.35); }
.sheet .foot { padding: 12px 16px calc(14px + env(safe-area-inset-bottom, 0px)); background: rgba(0,0,0,.7); display: grid; gap: 8px; }
.sheet .status { font-size: .95rem; color: #d6dedc; text-align: center; min-height: 1.4em; }
.sheet .toast { border-radius: 10px; padding: 10px 12px; background: #1f2a2e; border-left: 5px solid var(--brand); }
.sheet .toast.ok { border-left-color: var(--ok); } .sheet .toast.bad { border-left-color: var(--bad); }
.sheet .toast .t { font-weight: 700; }
.sheet .toast[hidden] { display: none; }
.sheet .check { color: #fff; }

/* Acciones rapidas de inicio */
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.quick a { display: grid; gap: 8px; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); color: var(--ink); box-shadow: var(--shadow); min-height: 104px; }
.quick a:hover { text-decoration: none; border-color: var(--brand); }
.quick a.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.quick svg { width: 28px; height: 28px; }
.quick .t { font-weight: 700; }
.quick .s { font-size: .85rem; opacity: .85; }

/* Portada publica */
.hero { text-align: center; padding: 24px 0 8px; }
.hero h1 { font-size: 1.7rem; }
.search { display: flex; gap: 8px; }
.search input { flex: 1; min-height: 56px; font-family: var(--mono); font-size: 1.1rem; letter-spacing: .05em; text-transform: uppercase; }
.search .btn { min-height: 56px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Escritorio y tabletas grandes */
@media (min-width: 900px) {
  .tabbar { display: none; }
  .topnav, .userchip { display: flex; }
  .logout-m { display: none; }
  .page { padding-block: 24px 40px; }
  .grid2 { grid-template-columns: 1fr 1fr; }
  .row { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
  .kv { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
  .actions .btn { flex: 0 1 auto; }
  .sticky-actions { position: static; margin: 16px 0 0; border-top: 0; padding: 0; background: none; }
  .quick { grid-template-columns: repeat(4, 1fr); }
  h1 { font-size: 1.7rem; }
}

/* ---------- Inicio del personal: compacto, todo a la vista en 390 px ---------- */
.greet { display: flex; align-items: center; gap: 12px; margin: 2px 0 14px; }
.greet .avatar { width: 44px; height: 44px; font-size: 1.05rem; flex: none; }
.greet .who { display: grid; min-width: 0; flex: 1; line-height: 1.25; }
.greet .hello { font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.greet .scope { font-size: .82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.greet .today { flex: none; font-size: .78rem; font-weight: 600; color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: 6px 10px; text-transform: capitalize; }

.searchbar { position: relative; }
.searchbar form { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 6px 6px 6px 14px; box-shadow: var(--shadow); }
.searchbar svg.lead { width: 20px; height: 20px; color: var(--muted); flex: none; }
.searchbar input { border: 0; box-shadow: none; min-height: 44px; padding: 0 4px; background: transparent; }
.searchbar input:focus { box-shadow: none; }
.searchbar .go { flex: none; width: 44px; height: 44px; border-radius: 12px; border: 0; background: var(--surface-2); color: var(--ink); display: grid; place-items: center; cursor: pointer; }
.searchbar .go svg { width: 20px; height: 20px; }

.alert-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: var(--bad-soft); color: var(--bad); font-weight: 700; }
.alert-row:hover { text-decoration: none; }
.alert-row svg { width: 20px; height: 20px; flex: none; }
.alert-row span { flex: 1; }

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.kpi { display: flex; align-items: center; gap: 10px; min-height: 72px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; color: var(--ink); box-shadow: var(--shadow); }
.kpi:hover { text-decoration: none; border-color: var(--brand); }
.kpi .ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.kpi .ico svg { width: 22px; height: 22px; }
.kpi .txt { display: grid; min-width: 0; line-height: 1.15; }
.kpi .n { font-size: 1.45rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .t { font-size: .78rem; color: var(--muted); font-weight: 600; line-height: 1.2; }
.kpi.zero .n { color: var(--muted); }

/* Tintes de iconos del inicio (acotados: no son utilidades globales). */
:is(.kpi .ico, .shortcuts .tile).teal { background: var(--tint-teal); color: var(--brand); }
:is(.kpi .ico, .shortcuts .tile).orange { background: var(--tint-orange); color: var(--accent); }
:is(.kpi .ico, .shortcuts .tile).blue { background: var(--tint-blue); color: #2f6fd6; }
:is(.kpi .ico, .shortcuts .tile).violet { background: var(--tint-violet); color: #7250d8; }
:is(.kpi .ico, .shortcuts .tile).green { background: var(--ok-soft); color: var(--ok); }

.shortcuts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 16px; }
.shortcuts a { display: grid; justify-items: center; gap: 6px; color: var(--ink); font-size: .76rem; font-weight: 600; text-align: center; min-height: 48px; }
.shortcuts a:hover { text-decoration: none; }
.shortcuts .tile { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; }
.shortcuts .tile svg { width: 26px; height: 26px; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 20px 0 10px; }
.section-head h2 { margin: 0; font-size: 1.05rem; }
.section-head a { font-size: .86rem; font-weight: 600; color: var(--muted); }

.shipcards { display: grid; gap: 10px; }
.shipcard { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px; color: var(--ink); box-shadow: var(--shadow); }
.shipcard:hover { text-decoration: none; border-color: var(--brand); }
.shipcard .ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--tint-teal); color: var(--brand); }
.shipcard .ico svg { width: 22px; height: 22px; }
.shipcard .ico.ok { background: var(--ok-soft); color: var(--ok); } .shipcard .ico.warn { background: var(--warn-soft); color: var(--warn); } .shipcard .ico.bad { background: var(--bad-soft); color: var(--bad); }
.shipcard .main { min-width: 0; display: grid; gap: 2px; }
.shipcard .t { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shipcard .s { color: var(--muted); font-size: .84rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shipcard .code { font-family: var(--mono); font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shipcard .side .badge { white-space: nowrap; }
.shipcard .when { font-size: .76rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.shipcard .side { display: grid; justify-items: end; gap: 6px; }
.shipcard .go { width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; }
.shipcard .go svg { width: 16px; height: 16px; }
.empty { text-align: center; padding: 28px 16px; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: 16px; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }

/* Manifiestos */
.shipcard .s.wrap { white-space: normal; }
.chip .count { font-size: .78rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.chip.active .count { background: rgba(255,255,255,.22); color: inherit; }
.route { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.route > div { display: grid; gap: 2px; min-width: 0; }
.route .k { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.route strong { line-height: 1.25; overflow-wrap: anywhere; }
.route svg { width: 20px; height: 20px; color: var(--muted); }
.facts { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; color: var(--muted); font-size: .9rem; }
.facts strong { color: var(--ink); }
.progress { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: 14px 0 6px; }
.progress span { display: block; height: 100%; background: var(--ok); border-radius: inherit; }

/* Entrega con comprobante */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.photo-pick { display: grid; justify-items: center; gap: 8px; padding: 18px; border: 2px dashed var(--line-strong); border-radius: 16px; color: var(--muted); text-align: center; cursor: pointer; font-weight: 600; }
.photo-pick svg { width: 32px; height: 32px; color: var(--brand); }
.photo-pick img { max-width: 100%; max-height: 240px; border-radius: 12px; }
.photo-pick.done { border-style: solid; border-color: var(--ok); color: var(--ok); }
.photo-pick.done svg { display: none; }
.proof { display: grid; gap: 12px; }
.proof + .proof { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.proof img { width: 100%; max-height: 320px; object-fit: cover; border-radius: 12px; background: var(--surface-2); }

/* Escaneo: en el telefono la camara es la accion principal */
.camera-cta { display: none; }
@media (pointer: coarse), (max-width: 640px) {
  .camera-cta { display: flex; align-items: center; gap: 14px; width: 100%; margin-bottom: 14px; padding: 16px; border-radius: 16px; border: 0; cursor: pointer;
    background: radial-gradient(120% 120% at 100% 0%, var(--hero-2), var(--hero)); color: var(--hero-ink); font: inherit; text-align: left; }
  .camera-cta .ring { width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex: none; box-shadow: 0 6px 16px rgba(242,107,29,.35); }
  .camera-cta .ring svg { width: 26px; height: 26px; }
  .camera-cta .t { font-weight: 800; font-size: 1.05rem; display: block; }
  .camera-cta .s { color: var(--hero-muted); font-size: .86rem; }
}

@media (min-width: 900px) {
  .searchbar { max-width: 720px; }
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .shortcuts { grid-template-columns: repeat(4, 96px); justify-content: start; }
  .shipcards { grid-template-columns: 1fr 1fr; }
}

/* Formulario enviandose (data-once en app.js): el boton no admite otro toque. */
form[aria-busy="true"] button[type="submit"] { opacity: .6; pointer-events: none; }

/* Recibir: buscador de clientes (combobox) y destinatarios del cliente */
.picker .combo { position: relative; }
.picker .options { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow); max-height: 320px; overflow: auto; }
.picker .options li { display: grid; gap: 2px; padding: 10px 12px; min-height: 48px; border-radius: 6px; cursor: pointer; }
.picker .options li small { color: var(--muted); font-size: .82rem; }
.picker .options li[aria-selected="true"], .picker .options li:hover { background: var(--brand-soft); }
.picker .chosen { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--brand); border-radius: var(--radius-sm); background: var(--brand-soft); }
.picker .chosen .who { display: grid; flex: 1; min-width: 0; }
.picker .chosen .who small { color: var(--muted); font-size: .82rem; }
.choices { display: grid; gap: 8px; margin-top: 6px; }
.choice { display: flex; align-items: center; gap: 10px; padding: 10px 12px; min-height: 48px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; }
.choice span { display: grid; min-width: 0; }
.choice small { color: var(--muted); font-size: .82rem; }
.choice input { width: 22px; height: 22px; min-height: 0; accent-color: var(--brand); }
.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.choice:has(input:disabled) { opacity: .55; }
