/* Component styles. Every color/radius/font here resolves to a token from
   tokens.css (docs/design/REDESIGN_BRIEF.md section 1); the aliases below
   only map the app's older variable names onto those tokens. Values that
   the brief leaves unspecified are the nearest ones in
   docs/design/sputnik-hero.html and are marked "mockup:" inline. */
:root {
  --surface-2: #161821;              /* mockup: .item .c */
  --border: var(--line);
  --search-border: var(--line);
  --muted-2: var(--dim);
  --placeholder: var(--dim);
  --accent-rgb: 94, 106, 210;
  --accent-ink: #ffffff;
  --accent-text: #c3c8f0;            /* brief: active pill text */
  --card-light-bg: #f5f6fa;          /* brief §4.3 */
  --card-light-ink: #0b0c12;
  --card-light-muted: #7a7f8c;       /* mockup: .tn small */
  --radius: var(--r-md);
  --radius-sm: var(--r-sm);
  --radius-lg: var(--r-lg);
  --radius-badge: 999px;
  --font: var(--sans);
  --font-mono: var(--mono);
  --glow: 0 40px 80px -30px rgba(94,106,210,.4);
  --btn-glow: 0 8px 24px -8px rgba(94,106,210,.6);
  --nav-bg: rgba(5,5,7,.6);          /* mockup: .nav */
  --nav-line: rgba(255,255,255,.05);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

/* Platform layer (mobile-native): no grey tap flash, no font inflation in
   landscape, no pull-to-refresh / rubber-band on the page itself (inner
   scrollables opt back in with overscroll-behavior: contain). */
html {
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

button, input, select, textarea { font-family: inherit; }

/* Controls: no 300ms tap delay, no long-press text selection / callout.
   Content (bubbles, tracking numbers, addresses) stays selectable. */
button, a, [role="button"], summary, label.toggle-row,
.tab, .chip, .nav-btn, .ibx-row, .day, .cal-item, .card, .th-back, .category-chip {
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
/* iOS zooms the page into any focused field under 16px and never zooms
   back out; on touch devices every text field is at least 16px. */
@media (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea,
  .cmd-in .search, #shipment-form input, #shipment-form select, #shipment-form textarea,
  .join-space-form input, .search { font-size: 16px; }
}

button:focus-visible, a:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.handle-input input:focus-visible { outline: none; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.icon { width: 16px; height: 16px; flex-shrink: 0; vertical-align: middle; }

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.brand h1 { font-size: 20px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.brand-badge {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.brand-badge img.logo-mark { height: 22px; width: auto; }

/* ---------- Avatar ---------- */
.avatar {
  border-radius: 50%; background: linear-gradient(135deg, var(--accent2), var(--accent));
  color: var(--accent-ink); display: flex; align-items: center; justify-content: center;
  font-weight: 600; flex-shrink: 0;
}
.avatar-sm { width: 34px; height: 34px; font-size: 0.85rem; }
.avatar-lg { width: 52px; height: 52px; font-size: 1.3rem; }

/* Filter / segment pills: active one filled with the accent, the rest muted. */
.tabs { display: flex; gap: 4px; margin: 12px 0; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto; padding: 7px 12px; border: 1px solid transparent; background: transparent; color: var(--muted);
  border-radius: 999px; cursor: pointer; font-weight: 500; font-size: 12.5px; white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
}
@media (hover: hover) and (pointer: fine) { .tab:hover { color: var(--text); border-color: var(--line2); } }
.tab:active { color: var(--text); }
.tab.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.auth-form input, .auth-form textarea, .auth-form select {
  background: var(--bg2); border: 1px solid var(--line); color: var(--text);
  padding: 10px 12px; border-radius: var(--radius-sm); font-size: 16px;
}
.auth-form input::placeholder { color: var(--placeholder); }
.handle-input {
  display: flex; align-items: center; background: var(--bg2);
  border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.handle-input:focus-within {
  border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft);
}
.handle-input span {
  padding: 10px 0 10px 12px; color: var(--muted); font-weight: 500; font-size: 16px;
}
.handle-input input {
  flex: 1; background: none; border: none; color: var(--text);
  padding: 10px 12px 10px 4px; font-size: 16px; outline: none;
}
.handle-input input::placeholder { color: var(--placeholder); }
.hint { font-size: 12px; color: var(--muted); margin-top: 16px; text-align: center; }
.error { color: var(--danger); font-size: 12px; margin: 0; }

/* ---------- Buttons ---------- */
.btn-primary, .btn-secondary, .btn-danger {
  border: 1px solid transparent; border-radius: var(--radius-sm); padding: 11px 18px; font-weight: 500; font-size: 14px; cursor: pointer;
  transition: transform .15s, background .15s, border-color .15s, filter .15s;
}
.btn-primary {
  background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 0 0 1px rgba(255,255,255,.08) inset, var(--btn-glow);
}
.btn-primary:disabled { opacity: .6; transform: none; cursor: default; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--line2); }
.btn-danger { background: rgba(235,87,87,.1); color: var(--danger); border-color: rgba(235,87,87,.3); }
@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover { background: #6b77e0; transform: translateY(-1px); } /* mockup: .btn-p:hover */
  .btn-secondary:hover { border-color: #3a3e4e; background: rgba(255,255,255,.03); } /* mockup: .btn-g:hover */
  .btn-danger:hover { background: rgba(235,87,87,.16); }
}
/* Press feedback lands on pointer-down (touch has no hover to fake it). */
.btn-primary:active:not(:disabled), .btn-secondary:active, .btn-danger:active, .cmd-go:active { transform: scale(.97); transition-duration: .1s; }
.icon-btn:active, .th-back:active, .cmd-refresh:active { background: var(--surface-2); transition-duration: .1s; }
.btn-primary.small, .btn-secondary.small, .btn-danger.small { padding: 8px 14px; font-size: 13px; }

/* ---------- App shell ---------- */
.app {
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
  padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
}

/* Bars paint edge to edge (viewport-fit=cover + black-translucent status
   bar), so their content is padded back out of the notch / home indicator. */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top, 0px)) calc(16px + env(safe-area-inset-right, 0px)) 12px calc(16px + env(safe-area-inset-left, 0px));
  background: var(--nav-bg); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--nav-line);
}
.brand-mini { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; letter-spacing: -0.01em; color: var(--text); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  background: var(--surface); border: 1px solid var(--line); color: var(--muted);
  width: 36px; height: 36px; border-radius: var(--radius-sm); cursor: pointer; position: relative;
  display: flex; align-items: center; justify-content: center;
  transition: color .15s, border-color .15s, background .15s;
}
@media (hover: hover) and (pointer: fine) { .icon-btn:hover { color: var(--text); border-color: var(--line2); } }
.icon-btn svg { width: 18px; height: 18px; }
/* Unread-alerts badge: accent family, not danger - red is reserved for
   shipment exceptions (DESIGN.md: semantic colour only for shipment state). */
.dot { position: absolute; top: 5px; right: 6px; width: 8px; height: 8px; background: var(--accent2); border: 2px solid var(--bg); box-sizing: content-box; border-radius: 50%; }

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: flex; gap: 4px; background: var(--nav-bg); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--nav-line);
  padding: 8px calc(10px + env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) calc(10px + env(safe-area-inset-left, 0px));
}
.nav-btn {
  flex: 1; min-height: 44px; background: transparent; border: none; color: var(--dim);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 6px; border-radius: var(--radius-sm); cursor: pointer;
  transition: color .15s ease, background .15s ease;
}
@media (hover: hover) and (pointer: fine) { .nav-btn:hover { color: var(--muted); } }
.nav-btn:active { color: var(--muted); background: rgba(255,255,255,.03); }
.nav-btn svg { width: 22px; height: 22px; }
.nav-btn span { font-size: 11px; font-weight: 500; }
.nav-btn.active { color: var(--accent2); background: var(--accent-soft); }

/* ---------- Greeting header (Home) ---------- */
.greeting-row {
  position: relative; z-index: 1; display: flex; flex-wrap: wrap;
  align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px;
}
.greeting-with-avatar { display: flex; align-items: center; gap: 12px; min-width: 0; }
.greeting { min-width: 0; }
.greeting h1 {
  font-weight: 600; font-size: 20px; margin: 0 0 2px; line-height: 1.15;
  letter-spacing: -0.01em; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.greeting p { margin: 0; color: var(--muted); font-size: 12px; }
.stat-pill {
  flex-shrink: 0; background: var(--accent-soft); border: 1px solid rgba(94,106,210,.35); border-radius: 999px;
  padding: 5px 12px 5px 6px; display: flex; align-items: center; gap: 8px;
  white-space: nowrap; color: var(--accent-text);
}
.stat-pill-icon {
  width: 24px; height: 24px; border-radius: 50%; background: rgba(94,106,210,.25); color: var(--accent-text);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-pill-icon svg { width: 14px; height: 14px; }
.stat-pill-text { font-size: 12px; font-weight: 500; }
.stat-pill .stat-pill-num { font-family: var(--font-mono); font-weight: 600; }

.content {
  flex: 1; max-width: 720px; width: 100%; margin: 0 auto;
  padding: 16px max(16px, env(safe-area-inset-right, 0px)) 16px max(16px, env(safe-area-inset-left, 0px));
}

.view { display: none; position: relative; }
.view.active { display: block; }

.view-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; gap: 10px; }
.view-header h2 { font-weight: 600; margin: 0; font-size: 20px; letter-spacing: -0.01em; color: var(--text); }

/* Search: surface + line border, dimmed magnifier on the left. */
.search-wrap { position: relative; margin: 10px 0 4px; }
.search-wrap svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--dim); pointer-events: none;
}
.search {
  width: 100%; padding: 11px 14px 11px 40px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--line); color: var(--text); font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
}
.search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.search::placeholder { color: var(--placeholder); }

.cards { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; cursor: pointer;
  transition: transform .15s, border-color .2s;
}
@media (hover: hover) and (pointer: fine) { .card:hover { border-color: var(--line2); } }
.card:active { transform: scale(0.99); }
.card-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card-lead { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.card-body { min-width: 0; }
.card-title { font-weight: 600; font-size: 14px; margin: 0 0 3px; letter-spacing: -0.005em; }
.card-sub { color: var(--muted); font-size: 12px; margin: 0; }
.card-sub .mono { color: var(--muted); }
.card-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.card-checked { margin-left: auto; font-size: 11px; color: var(--dim); white-space: nowrap; }
.card-actions { display: flex; gap: 6px; margin-top: 10px; }
.card-actions button { font-size: 12px; padding: 6px 10px; }

/* ---------- Status pills: one hue per stage of the journey ----------
   created/picked up  -> indigo (accent)        in transit -> indigo, pulsing
   out for delivery   -> violet (accent2)       delivered  -> green (ok)
   delayed            -> amber (warn)           exception  -> red (danger) */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--radius-badge);
  font-size: 11px; font-weight: 500; letter-spacing: 0.01em; line-height: 1.3;
  background: var(--surface); color: var(--muted); border: 1px solid var(--line);
}
.badge.status-label_created, .badge.status-info_received, .badge.status-pending,
.badge.status-picked_up, .badge.status-in_transit, .badge.status-available_for_pickup {
  color: var(--accent-text); background: var(--accent-soft); border-color: rgba(94,106,210,.4);
}
.badge.status-out_for_delivery {
  color: #ddd6ff; background: rgba(139,124,246,.18); border-color: rgba(139,124,246,.45);
}
.badge.status-in_transit::before, .badge.status-out_for_delivery::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent2);
  box-shadow: 0 0 0 0 rgba(139,124,246,.55); animation: pulseDot 2s infinite;
}
.badge.status-delivered { color: var(--ok); background: rgba(62,207,142,.14); border-color: rgba(62,207,142,.35); }
.badge.status-delivered::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.badge.status-exception, .badge.status-failed_attempt { color: var(--danger); background: rgba(235,87,87,.12); border-color: rgba(235,87,87,.35); }
.badge-delay { color: var(--warn); background: rgba(242,180,92,.14); border-color: rgba(242,180,92,.35); }

.carrier-chip {
  font-size: 11px; font-weight: 500; letter-spacing: 0.02em;
  padding: 4px 10px; border-radius: 7px; background: var(--surface); border: 1px solid var(--line); color: var(--muted);
}

.courier-badge {
  width: 36px; height: 36px; border-radius: var(--radius-sm); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}

.empty { text-align: center; color: var(--muted); padding: 40px 10px; }

/* ---------- Shipment detail / map ---------- */
.map {
  position: relative; height: 260px; border-radius: var(--radius-lg); overflow: hidden;
  border: 1px solid var(--line); margin-bottom: 14px; background: #0c0d15; /* mockup: .map */
  box-shadow: var(--glow);
}
/* Vignette toward the edges (brief §2). Sits above tiles/paths but below
   markers (Leaflet marker pane is z-index 600) and controls. */
.map::after {
  content: ""; position: absolute; inset: 0; z-index: 450; pointer-events: none;
  background: radial-gradient(ellipse at 60% 40%, transparent 40%, rgba(7,8,12,.5) 100%);
}
.leaflet-container { background: #0c0d15; font-family: var(--font); }
.leaflet-control-zoom { border: 1px solid var(--line2) !important; border-radius: var(--radius-sm) !important; overflow: hidden; }
.leaflet-control-zoom a {
  background: rgba(7,8,12,.85) !important; color: var(--text) !important; border-bottom-color: var(--line) !important;
  backdrop-filter: blur(8px);
}
@media (hover: hover) and (pointer: fine) { .leaflet-control-zoom a:hover { background: var(--surface-2) !important; } }
.leaflet-control-attribution {
  background: rgba(7,8,12,.7) !important; color: var(--dim) !important; font-family: var(--font-mono); font-size: 9px !important;
  border-top-left-radius: 8px;
}
.leaflet-control-attribution a { color: var(--muted) !important; }
.leaflet-popup-content-wrapper { background: var(--surface); color: var(--text); border: 1px solid var(--line2); border-radius: var(--radius-sm); box-shadow: 0 20px 40px -16px rgba(0,0,0,.9); }
.leaflet-popup-tip { background: var(--surface); }
.leaflet-popup-content { font-size: 12px; margin: 10px 12px; }
.leaflet-popup-close-button { color: var(--muted) !important; }
.map-route-pending { stroke-dasharray: 6 7; animation: routeDash 4s linear infinite; }

.shipment-hero {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 18px; margin: 0 0 18px;
}
.shipment-hero .hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.shipment-hero h2 { font-weight: 600; margin: 0 0 4px; font-size: 20px; letter-spacing: -0.01em; }
.hero-tags { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

/* Light tracking card on the dark hero (brief §4.3). */
.data-strip {
  background: var(--card-light-bg); color: var(--card-light-ink);
  border-radius: var(--radius); padding: 14px 16px; margin: 14px 0 2px;
  display: flex; flex-direction: column; gap: 12px;
}
.data-strip .data-row + .data-row { padding-top: 12px; border-top: 1px solid rgba(11,12,18,.1); }
.data-strip .data-label {
  display: block; font-family: var(--font-mono); font-size: 10px; font-weight: 500; color: var(--card-light-muted);
  text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 3px;
}
.data-strip .data-eta { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.data-strip .data-eta .data-value { font-family: var(--font-mono); font-weight: 600; }
.data-strip .tn { font-family: var(--font-mono); font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: 0.04em; word-break: break-all; }
.last-checked { margin: 10px 0 0; font-size: 12px; color: var(--dim); }
.last-checked-value { font-family: var(--font-mono); }

/* Status timeline: filled = done, pulsing ring = current, hollow = pending. */
.status-timeline { display: flex; flex-direction: column; margin: 14px 2px 0; }
.status-timeline-step {
  display: flex; align-items: center; gap: 10px; padding: 7px 0 7px 18px;
  border-left: 1.5px solid var(--line); margin-left: 5px; position: relative; font-size: 13px; color: var(--muted);
}
.status-timeline-step:last-child { border-left-color: transparent; }
.status-timeline-dot {
  position: absolute; left: -5px; width: 8px; height: 8px; border-radius: 50%;
  background: transparent; border: 1.5px solid var(--dim); box-sizing: border-box;
}
.status-timeline-step.done .status-timeline-dot { background: var(--ok); border-color: var(--ok); } /* mockup: .tl div i */
.status-timeline-step.current .status-timeline-dot {
  background: var(--accent); border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(94,106,210,.2); animation: ringPulse 2s infinite;
}
.status-timeline-step.current.step-out_for_delivery .status-timeline-dot { background: var(--accent2); border-color: var(--accent2); }
.status-timeline-step.current.step-delivered .status-timeline-dot { background: var(--ok); border-color: var(--ok); box-shadow: 0 0 0 4px rgba(62,207,142,.2); animation: none; }
.status-timeline-step.current.step-delivered { color: var(--ok); }
.status-timeline-step.done { color: var(--muted); }
.status-timeline-step.current { color: var(--text); font-weight: 500; }
.status-timeline-step.pending { color: var(--dim); }
.status-timeline-time { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--dim); font-weight: 400; }

.hero-actions { display: flex; justify-content: flex-start; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.checkpoints { display: flex; flex-direction: column; gap: 0; padding: 0 4px; }
.checkpoint-more-btn { margin-top: 8px; }
.checkpoint {
  display: flex; gap: 12px; padding: 10px 0; border-left: 1.5px solid var(--line); margin-left: 6px; padding-left: 16px; position: relative;
}
.checkpoint::before {
  content: ""; position: absolute; left: -5px; top: 15px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok); /* mockup: past signals are green */
}
.checkpoint.latest::before {
  background: var(--accent); box-shadow: 0 0 0 4px rgba(94,106,210,.2); animation: ringPulse 2s infinite;
}
.checkpoint.latest .checkpoint-label { color: var(--text); }
.checkpoints.ship-out_for_delivery .checkpoint.latest::before { background: var(--accent2); }
.checkpoints.ship-delivered .checkpoint.latest::before { background: var(--ok); box-shadow: 0 0 0 4px rgba(62,207,142,.2); animation: none; }
.checkpoints.ship-delivered .checkpoint.latest .checkpoint-label { color: var(--ok); }
.checkpoints.ship-exception .checkpoint.latest::before { background: var(--danger); box-shadow: 0 0 0 4px rgba(235,87,87,.2); }
.checkpoint.cp-exception::before, .checkpoint.cp-failed_attempt::before { background: var(--danger); }
.checkpoint:last-child { border-left-color: transparent; }
.checkpoint-time { font-size: 11px; color: var(--dim); font-family: var(--font-mono); }
.checkpoint-label { font-weight: 500; font-size: 14px; color: var(--text); }

/* ---------- Notifications ---------- */
.notif-card { display: flex; gap: 10px; align-items: flex-start; }
.notif-card.unread { border-color: rgba(94,106,210,.5); }
.notif-dotmark { width: 8px; height: 8px; border-radius: 50%; background: var(--accent2); margin-top: 6px; flex-shrink: 0; }
.notif-dotmark.read { background: transparent; }
.notif-time { margin: 4px 0 0; font-family: var(--font-mono); font-size: 11px; color: var(--dim); }

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(5,5,7,.7); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: flex-end; justify-content: center; z-index: 50;
}
.modal-card {
  background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px)); width: 100%; max-width: 480px;
  max-height: 88vh; max-height: 88dvh; overflow-y: auto; overscroll-behavior: contain;
  box-shadow: 0 -30px 80px -30px rgba(0,0,0,.8);
}
@media (min-width: 640px) {
  .modal { align-items: center; }
  .modal-card { border-radius: var(--radius-lg); }
}
.modal-card h3 { margin-top: 0; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
#change-password-form, #regen-recovery-form, #delete-account-form, #join-space-form {
  display: flex; flex-direction: column; gap: 12px;
}
#change-password-form label, #regen-recovery-form label, #delete-account-form label {
  display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted);
}
#change-password-form input, #regen-recovery-form input, #delete-account-form input {
  background: var(--surface); border: 1px solid var(--line); color: var(--text);
  padding: 10px 12px; border-radius: var(--radius-sm); font-size: 16px;
}
#contact-form { display: flex; flex-direction: column; gap: 12px; }
#contact-form label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
#contact-form input, #contact-form textarea, #contact-form select {
  background: var(--surface); border: 1px solid var(--line); color: var(--text);
  padding: 10px 12px; border-radius: var(--radius-sm); font-size: 16px;
}
#contact-form input::placeholder, #contact-form textarea::placeholder { color: var(--placeholder); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.field-hint { font-size: 0.75rem; color: var(--accent2); min-height: 1em; }

/* New shipment form (brief §6.2): every field is its own surface card,
   small dim label on top, technical values in mono. */
#shipment-form { display: flex; flex-direction: column; gap: 8px; }
#shipment-form > label, #shipment-form .field-row > label, .scan-contact-block > label {
  display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--dim);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 12px 8px;
  transition: border-color .15s, box-shadow .15s;
}
#shipment-form > label:focus-within, #shipment-form .field-row > label:focus-within, .scan-contact-block > label:focus-within {
  border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft);
}
#shipment-form input, #shipment-form select, #shipment-form textarea {
  background: transparent; border: none; color: var(--text); padding: 2px 0; font-size: 15px; outline: none; width: 100%;
}
#shipment-form select { appearance: none; -webkit-appearance: none; padding-right: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239a9fac' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 2px center;
}
#shipment-form select option { background: var(--surface); color: var(--text); }
#shipment-form input::placeholder, #shipment-form textarea::placeholder { color: var(--dim); }
#shipment-form input.mono { font-family: var(--font-mono); letter-spacing: .04em; }
#shipment-form .icon-field { background: transparent; border: none; padding: 0; gap: 8px; }
#shipment-form .icon-field:focus-within { box-shadow: none; }
#shipment-form .icon-field-textarea { padding: 0; }
#shipment-form .field-hint { margin-top: 2px; }
#shipment-form .modal-actions { margin-top: 8px; }
.form-label-text { display: flex; align-items: center; gap: 6px; }

/* ---------- Contact modal ---------- */
.contact-modal-header { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.contact-modal-header h3 { margin: 0; }
.avatar.avatar-empty { background: var(--surface-2); color: var(--muted); }
.avatar-lg svg.icon { width: 24px; height: 24px; }

.icon-field {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 0 12px; transition: border-color 0.15s, box-shadow 0.15s;
}
.icon-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.icon-field svg.icon { color: var(--dim); flex-shrink: 0; }
.icon-field input, .icon-field textarea {
  flex: 1; background: none; border: none; padding: 10px 0; font-size: 16px; color: var(--text); outline: none;
}
.icon-field-textarea { align-items: flex-start; padding: 10px 12px; }
.icon-field-textarea svg.icon { margin-top: 2px; }
.icon-field-textarea textarea { padding: 0; resize: vertical; min-height: 40px; }

.field-row { display: flex; gap: 8px; }

/* ---------- Category chips ---------- */
.category-chips { display: flex; gap: 6px; overflow-x: auto; overscroll-behavior-x: contain; padding: 4px 0 2px; scrollbar-width: none; }
.category-chips::-webkit-scrollbar { display: none; }
.category-chip {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0;
  background: var(--bg2); border: 1px solid var(--line); color: var(--muted);
  border-radius: 999px; padding: 6px 11px; font-size: 12px; font-weight: 500; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.category-chip svg.icon { width: 14px; height: 14px; }
.category-chip.active { background: var(--accent-soft); border-color: rgba(94,106,210,.5); color: var(--accent-text); }

/* ---------- Photo attachment ---------- */
.photo-preview { position: relative; width: 96px; margin-top: 10px; }
.photo-preview img { width: 96px; height: 96px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line2); display: block; }
.photo-preview-remove {
  position: absolute; top: -7px; right: -7px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--danger); color: #fff; border: 2px solid var(--bg2); display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.photo-preview-remove svg { width: 12px; height: 12px; }
.shipment-photo { width: 100%; max-width: 220px; border-radius: var(--radius-sm); border: 1px solid var(--line); display: block; margin-top: 12px; }

/* ---------- Shipment card lead icon ---------- */
.card.archived { opacity: 0.55; }
.card-category-icon, .card-following-icon {
  width: 32px; height: 32px; border-radius: 8px; background: var(--surface-2); color: var(--muted);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.card-category-icon svg.icon, .card-following-icon svg { width: 16px; height: 16px; }
.card-following-icon { color: var(--accent2); }
.card.status-delivered .card-category-icon { color: var(--ok); background: rgba(62,207,142,.12); }
.cal-item .p.done { background: rgba(62,207,142,.14); color: var(--ok); }

/* ---------- Per-shipment chat ---------- */
.chat-section { margin-top: 22px; }
.chat-heading { font-size: 15px; font-weight: 600; margin: 0 0 10px; color: var(--text); letter-spacing: -0.01em; }
.chat-messages { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; max-height: 380px; overflow-y: auto; overscroll-behavior: contain; padding: 2px; }
.chat-msg {
  align-self: flex-start; max-width: 82%; border-radius: var(--radius); border-bottom-left-radius: 4px;
  padding: 9px 12px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; line-height: 1.4;
}
.chat-msg.mine {
  align-self: flex-end; background: var(--accent); border-color: var(--accent); color: #fff;
  border-radius: var(--radius); border-bottom-right-radius: 4px;
}
.chat-msg.has-photo { width: 82%; padding: 0; overflow: hidden; border-color: rgba(94,106,210,.5); }
.chat-msg.has-photo .chat-msg-text { padding: 9px 12px 0; }
.chat-msg.has-photo .chat-msg-meta { padding: 0 12px 8px; }
.chat-msg.has-photo .chat-msg-text + .chat-msg-meta { padding-top: 2px; }
.chat-msg-text { color: inherit; word-break: break-word; }
.chat-msg-meta { display: block; font-size: 10px; color: var(--dim); margin-top: 3px; font-family: var(--font-mono); }
.chat-msg.mine .chat-msg-meta { color: rgba(255,255,255,.7); }
.chat-msg-photo-wrap { position: relative; background: #101219; } /* mockup: .pkg */
.chat-msg-photo { display: block; width: 100%; max-height: 260px; object-fit: cover; }
.chat-msg-photo-badge {
  position: absolute; top: 8px; left: 8px; display: inline-flex; align-items: center; gap: 5px;
  background: rgba(7,8,12,.8); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(62,207,142,.45); color: var(--ok);
  font-size: 10px; font-weight: 600; padding: 4px 9px 4px 7px; border-radius: 999px;
}
.chat-msg-photo-badge svg { width: 10px; height: 10px; flex-shrink: 0; }
.chat-msg-system {
  align-self: center; display: flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 10px;
  color: var(--dim); text-align: center; padding: 2px 8px; margin-block: 2px;
}
.chat-msg-system::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--ok); flex: none;
  background: radial-gradient(circle, var(--ok) 0 2px, transparent 2.5px);
}
.chat-closed-note { text-align: center; font-size: 12px; color: var(--dim); margin: 4px 0 0; }
.chat-form {
  display: flex; gap: 8px; position: sticky; z-index: 5;
  bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  background: var(--bg); padding: 8px 0 4px;
}
body.chat-input-focused .bottom-nav { display: none; }
body.chat-input-focused .app { padding-bottom: 0; }
body.chat-input-focused .chat-form { bottom: 0; padding-bottom: max(8px, env(safe-area-inset-bottom, 0px)); }
.chat-form input {
  flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--line2); color: var(--text);
  padding: 10px 12px; border-radius: var(--radius-sm); font-size: 16px;
}
.chat-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.chat-form input::placeholder { color: var(--placeholder); }
.chat-form button { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex-shrink: 0; padding: 0; }
.chat-form button svg { width: 18px; height: 18px; }
.chat-form .icon-btn { width: 44px; height: 44px; }

.scan-label-btn { width: 100%; margin-bottom: 14px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.scan-contact-block {
  background: var(--bg2); border: 1px dashed var(--line2); border-radius: var(--radius);
  padding: 10px; display: flex; flex-direction: column; gap: 8px;
}
.checkbox-label {
  display: flex !important; flex-direction: row !important; align-items: center; gap: 8px;
  font-size: 13px !important; color: var(--text) !important; background: transparent !important; border: none !important; padding: 2px 0 !important;
}
.checkbox-label input[type="checkbox"] { width: 17px !important; height: 17px; accent-color: var(--accent); }
.checkbox-label span { font-weight: 500; }

/* ---------- Shared shipment view (public, no account) ---------- */
.shared-view { min-height: 100vh; min-height: 100dvh; }
.shared-cta { margin: 20px 0 0; }
.shared-auth-card { max-width: 420px; margin: 0 auto; padding: 22px; }

/* ---------- Live camera scan (brief §6.1) ---------- */
.scan-camera-view {
  position: fixed; inset: 0; z-index: 60; background: #000;
}
.scan-video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.scan-overlay {
  position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column;
  background: linear-gradient(to bottom, rgba(5,5,7,.7) 0%, transparent 20%, transparent 70%, rgba(5,5,7,.75) 100%);
}
.scan-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top)) 16px 10px;
}
.scan-close-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line2); cursor: pointer;
  background: rgba(7,8,12,.8); color: var(--text);
  display: flex; align-items: center; justify-content: center;
}
.scan-close-btn svg { width: 16px; height: 16px; }
.scan-status-pill {
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(7,8,12,.8); backdrop-filter: blur(8px); border: 1px solid var(--line2); color: var(--text);
  padding: 6px 12px 6px 9px; border-radius: 999px; font-size: 12px; font-weight: 500;
}
.scan-status-pill::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 0 0 rgba(62,207,142,.55); animation: pulseDot 2s infinite;
}
.scan-frame {
  position: relative; margin: auto; width: 78%; max-width: 340px; aspect-ratio: 0.68; overflow: hidden;
}
.scan-frame-corner {
  position: absolute; width: 28px; height: 28px; border: 3px solid var(--accent);
}
.scan-frame-corner.tl { top: 0; left: 0; border-right: none; border-bottom: none; border-radius: 9px 0 0 0; }
.scan-frame-corner.tr { top: 0; right: 0; border-left: none; border-bottom: none; border-radius: 0 9px 0 0; }
.scan-frame-corner.bl { bottom: 0; left: 0; border-right: none; border-top: none; border-radius: 0 0 0 9px; }
.scan-frame-corner.br { bottom: 0; right: 0; border-left: none; border-top: none; border-radius: 0 0 9px 0; }
.scan-line {
  position: absolute; left: 8px; right: 8px; height: 2px; background: var(--accent);
  box-shadow: 0 0 14px 3px rgba(94,106,210,.7); animation: scanSweep 2.4s ease-in-out infinite;
}
.scan-bottom {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 10px 20px calc(22px + env(safe-area-inset-bottom));
}
.scan-hint {
  color: var(--text); font-size: 12px; text-align: center; margin: 0;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}
.scan-camera-view.scan-success .scan-frame-corner { border-color: var(--ok); }
.scan-camera-view.scan-success .scan-line { display: none; }
.scan-flash {
  position: absolute; inset: 0; z-index: 2; background: var(--accent);
  opacity: 0; pointer-events: none;
  animation: scanFlash 0.5s ease-out;
}

/* ---------- Map: pulsing "current position" pin ---------- */
.map-pulse-marker { position: relative; width: 22px; height: 22px; }
.map-pulse-marker .map-pulse-dot {
  position: absolute; top: 5px; left: 5px; width: 12px; height: 12px;
  border-radius: 50%; background: #fff; border: 3px solid var(--accent); box-sizing: border-box;
}
.map-pulse-marker .map-pulse-ring {
  position: absolute; top: 0; left: 0; width: 22px; height: 22px;
  border-radius: 50%; background: rgba(94,106,210,.5);
  transform-origin: center; animation: ping 2.2s ease-out infinite;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: calc(90px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%);
  max-width: calc(100vw - 32px); text-align: center;
  background: rgba(22,24,33,.92); backdrop-filter: blur(12px); border: 1px solid var(--line2); color: var(--text);
  padding: 10px 16px; border-radius: var(--radius); font-size: 12px; z-index: 100;
  box-shadow: 0 20px 40px -16px rgba(0,0,0,.9);
}

/* ---------- Contact card ---------- */
.contact-card-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.contact-methods { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.contact-method {
  display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.contact-method .icon { color: var(--dim); }

/* ---------- Link-style button ---------- */
.link-btn {
  background: none; border: none; color: var(--accent2); font-size: 12px; font-weight: 500;
  cursor: pointer; padding: 4px 0; text-align: center; width: 100%;
}

/* ---------- Account view ---------- */
.account-block {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; display: flex; flex-direction: column; gap: 10px; margin-bottom: 6px;
}
.account-block .btn-secondary { width: 100%; }
.co-owners-list { display: flex; flex-wrap: wrap; gap: 8px; }
.co-owners-list:empty::before {
  content: "Just you, for now."; color: var(--muted); font-size: 12px;
}
.co-owner-chip {
  display: flex; align-items: center; gap: 6px; background: var(--bg2);
  border: 1px solid var(--line); border-radius: 999px; padding: 5px 10px 5px 5px;
  font-size: 12px; font-weight: 500;
}
.co-owner-chip .avatar { width: 20px; height: 20px; font-size: 10px; }
.account-row-buttons { display: flex; gap: 8px; }
.account-row-buttons .btn-secondary { flex: 1; }
.join-space-form { display: flex; gap: 8px; }
.join-space-form input {
  flex: 1; background: var(--bg2); border: 1px solid var(--line); color: var(--text);
  padding: 8px 12px; border-radius: var(--radius-sm); font-size: 13px; font-family: var(--font-mono);
}
.join-space-form input::placeholder { color: var(--placeholder); font-family: var(--font); }

/* ---------- Passport ---------- */
.pp-hero {
  background: var(--card-light-bg); color: var(--card-light-ink); border-radius: var(--radius-lg);
  padding: 18px; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between;
}
.pp-hero-num { font-family: var(--font-mono); font-size: 36px; font-weight: 600; letter-spacing: -0.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.pp-hero-label { font-family: var(--font-mono); font-size: 10px; font-weight: 500; color: var(--card-light-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 6px; }
.pp-hero-icon {
  width: 44px; height: 44px; border-radius: 50%; background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--accent);
}
.pp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 6px; }
.pp-stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.pp-stat-num { font-family: var(--font-mono); font-size: 20px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; color: var(--accent2); }
.pp-stat-label { font-size: 12px; color: var(--muted); margin-top: 2px; }
.pp-section-title { font-family: var(--font-mono); font-size: 11px; font-weight: 500; color: var(--accent2); text-transform: uppercase; letter-spacing: 0.1em; margin: 20px 0 10px; }
.pp-couriers { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.pp-couriers:empty { display: none; }
.pp-courier-row { display: flex; align-items: center; gap: 10px; }
.pp-courier-badge {
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 700;
}
.pp-courier-name { font-size: 13px; font-weight: 500; width: 46px; flex-shrink: 0; }
.pp-courier-bar-track { flex: 1; height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.pp-courier-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent2), var(--accent)); border-radius: 3px; }
.pp-courier-count { font-family: var(--font-mono); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; width: 18px; text-align: right; }
.pp-milestone { text-align: center; color: var(--dim); font-size: 12px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.pp-milestone b { color: var(--muted); font-weight: 500; }

/* ---------- Toggle switch ---------- */
.toggle-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 4px 0; font-size: 14px; color: var(--text); cursor: pointer;
}
.toggle-row + .toggle-row { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.toggle-switch { position: relative; width: 42px; height: 24px; flex-shrink: 0; }
.toggle-switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.toggle-slider {
  position: absolute; inset: 0; background: var(--bg2); border: 1px solid var(--line2);
  border-radius: 999px; transition: background-color 0.15s, border-color 0.15s;
}
.toggle-slider::before {
  content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--muted); transition: transform 0.15s, background-color 0.15s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--accent-soft); border-color: var(--accent); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); background: var(--accent); }

/* ---------- QR modal ---------- */
.qr-box { display: flex; justify-content: center; padding: 16px; background: var(--card-light-bg); border-radius: var(--radius); margin: 14px 0; }
.qr-box img { width: 220px; height: 220px; display: block; }

/* ---------- Calendar (brief §5: week strip, today filled, dots, banner) ---------- */
.cal-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin: 4px 0 6px; }
.cal-month { font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.cal-today { font-size: 18px; font-weight: 600; margin-top: 2px; letter-spacing: -0.01em; }
.calendar-nav { display: flex; align-items: center; gap: 6px; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; padding: 10px 0 4px; }
.day {
  display: grid; justify-items: center; gap: 8px; font-size: 10px; color: var(--dim); font-family: var(--font-mono);
  background: none; border: none; padding: 6px 0 8px; border-radius: var(--radius-sm); cursor: pointer;
  transition: background .15s;
}
@media (hover: hover) and (pointer: fine) { .day:hover { background: var(--surface); } }
.day:active { background: var(--surface); }
.day b {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font-size: 13px; font-weight: 500; color: var(--muted); position: relative; font-family: var(--font);
  transition: background .15s, color .15s;
}
.day b::after { content: ""; position: absolute; bottom: -6px; width: 4px; height: 4px; border-radius: 50%; background: transparent; }
.day.has b::after { background: var(--accent2); }
.day.has.delay b::after { background: var(--warn); }
.day.selected b { box-shadow: 0 0 0 1.5px var(--line2); color: var(--text); }
.day.today b { background: var(--accent); color: #fff; font-weight: 600; box-shadow: none; }
.day.today b::after { background: #fff; }
.cal-alert {
  margin: 12px 0 0; display: flex; align-items: center; gap: 9px;
  background: var(--accent-soft); border: 1px solid rgba(94,106,210,.4); border-radius: 11px;
  padding: 10px 12px; font-size: 13px; font-weight: 500; color: var(--accent-text);
}
.cal-alert i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent2); box-shadow: 0 0 0 0 rgba(139,124,246,.55); animation: pulseDot 2s infinite; flex: none; }
.cal-list { display: grid; gap: 8px; margin-top: 12px; }
.cal-item {
  display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 11px; padding: 10px 11px; cursor: pointer; transition: border-color .2s, transform .15s;
}
@media (hover: hover) and (pointer: fine) { .cal-item:hover { border-color: var(--line2); } }
.cal-item:active { transform: scale(.99); }
.cal-item .c {
  width: 34px; height: 34px; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 9px; font-weight: 600; color: var(--muted); flex: none; letter-spacing: .04em;
}
.cal-item .t { flex: 1; min-width: 0; }
.cal-item .t b { display: block; font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-item .t span { font-size: 11px; color: var(--dim); font-family: var(--font-mono); }

/* ---------- Motion (brief §7) ---------- */
.rv { opacity: 0; transform: translateY(12px); transition: opacity .4s ease, transform .4s ease; }
.rv.in { opacity: 1; transform: none; }

/* Entrances (DESIGN.md §Motion): transform/opacity only, strong ease-out,
   nothing over 260ms. Inbox rows stagger 20ms each on arrival (the .enter
   class is set by the app only when the inbox comes on screen, not while
   typing in search); in a thread only nodes marked .is-new animate, so
   the 8-second poll re-render stays still. The highlighted milestone card
   fades in once, on open or when its status changes. */
.inbox.enter .ibx-row { animation: rowIn .2s cubic-bezier(.23, 1, .32, 1) both; animation-delay: calc(var(--i, 0) * 20ms); }
.thread-msgs > .chat-msg.is-new, .thread-msgs > .th-sys.is-new { animation: msgIn .18s cubic-bezier(.23, 1, .32, 1) both; }
.th-card.hl.is-new { animation: cardIn .26s cubic-bezier(.23, 1, .32, 1) both; }
@keyframes rowIn { from { opacity: 0; transform: translateY(8px); } }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } }
@keyframes cardIn { from { opacity: 0; } }

@keyframes pulseDot { 0% { box-shadow: 0 0 0 0 rgba(139,124,246,.55); } 70% { box-shadow: 0 0 0 8px rgba(139,124,246,0); } 100% { box-shadow: 0 0 0 0 rgba(139,124,246,0); } }
@keyframes ringPulse { 0% { box-shadow: 0 0 0 4px rgba(94,106,210,.2); } 70% { box-shadow: 0 0 0 9px rgba(94,106,210,0); } 100% { box-shadow: 0 0 0 4px rgba(94,106,210,0); } }
@keyframes ping { 0% { opacity: .8; transform: scale(.6); } 100% { opacity: 0; transform: scale(2.4); } }
@keyframes routeDash { to { stroke-dashoffset: -26; } }
@keyframes scanSweep { 0%, 100% { top: 6px; } 50% { top: calc(100% - 8px); } }
@keyframes scanFlash { 0% { opacity: 0.55; } 100% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .rv { opacity: 1; transform: none; }
  .map-pulse-marker .map-pulse-ring { opacity: .35; transform: none; }
  .scan-line { display: none; }
}

/* ---------- Landing hero + auth (docs/design/sputnik-hero.html) ---------- */
.auth-screen {
  position: relative; min-height: 100vh; min-height: 100svh; isolation: isolate; overflow: hidden;
  display: flex; flex-direction: column; background: var(--bg);
}
.hero-bg { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.hero-grid {
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 72px 72px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 62% 45%, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 60% at 62% 45%, #000 20%, transparent 75%);
}
.hero-glow1 {
  position: absolute; width: 900px; height: 900px; right: -160px; top: -260px; border-radius: 50%;
  background: radial-gradient(circle, rgba(94,106,210,.28) 0%, rgba(139,124,246,.12) 35%, transparent 70%); filter: blur(30px);
}
.hero-glow2 {
  position: absolute; width: 700px; height: 700px; left: -260px; bottom: -320px; border-radius: 50%;
  background: radial-gradient(circle, rgba(139,124,246,.14) 0%, transparent 65%); filter: blur(30px);
}
.hero-route { position: absolute; inset: 0; width: 100%; height: 100%; }
.route-dash { stroke-dasharray: 6 7; animation: routeDash 4s linear infinite; }
.route-fill { stroke-dasharray: 520; stroke-dashoffset: 520; animation: routeDraw 3.2s cubic-bezier(.4,0,.2,1) 1.1s forwards; }
.pin-ping { transform-origin: center; transform-box: fill-box; animation: ping 2.2s ease-out infinite; }

.hero-nav {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  min-height: 64px; padding: env(safe-area-inset-top, 0px) clamp(16px, 4vw, 56px) 0;
  background: var(--nav-bg); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--nav-line);
}
.hero-nav .brand-mini { font-size: 17px; }
.hero-nav-cta { text-decoration: none; display: inline-flex; align-items: center; }

.hero {
  width: 100%; max-width: 1360px; margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: clamp(32px, 5vw, 72px); align-items: center;
  padding: clamp(40px, 7vh, 88px) clamp(16px, 4vw, 56px) 0;
}
.hero-copy { min-width: 0; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--accent-text); background: var(--accent-soft); border: 1px solid rgba(94,106,210,.35); padding: 6px 12px; border-radius: 999px;
}
.eyebrow-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(62,207,142,.6); animation: pulseDotOk 2s infinite; }
.hero-h1 {
  margin: 22px 0 0; font-size: clamp(40px, 5.6vw, 76px); line-height: .98; font-weight: 600; letter-spacing: -.04em; text-wrap: balance; color: var(--text);
}
.hero-h1 em {
  font-style: normal; background: linear-gradient(90deg, #c7ccff, #8b7cf6 60%, #5e6ad2);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-lede { margin: 20px 0 0; font-size: clamp(16px, 1.3vw, 19px); line-height: 1.55; color: var(--muted); max-width: 36ch; }

.auth-card {
  margin-top: 28px; width: 100%; max-width: 440px;
  background: rgba(15,16,23,.85); border: 1px solid var(--line2); border-radius: var(--radius-lg);
  padding: 20px 20px 16px; box-shadow: 0 30px 80px -30px rgba(0,0,0,.8), 0 0 0 1px rgba(255,255,255,.02) inset;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.auth-card .tabs { background: var(--bg2); border: 1px solid var(--line); border-radius: 999px; padding: 4px; margin: 0 0 14px; }
.auth-card .hint { margin-top: 12px; }

.carriers {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 28px;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: .04em; color: var(--dim);
}
.carriers b { font-weight: 600; color: #7d8291; }

/* Phone stage */
.hero-stage { position: relative; display: flex; justify-content: center; align-items: flex-end; min-height: 620px; }
.hero-halo {
  position: absolute; inset: auto 0 -120px; height: 560px; border-radius: 50%; z-index: 0;
  background: radial-gradient(ellipse at center, rgba(94,106,210,.35), rgba(139,124,246,.12) 45%, transparent 70%); filter: blur(40px);
}
.hero-phone {
  position: relative; z-index: 2; width: min(400px, 100%); background: #0a0b10; border: 1px solid #262937; border-radius: 44px; padding: 12px; margin-bottom: -70px;
  box-shadow: 0 0 0 1px rgba(255,255,255,.04) inset, 0 80px 140px -50px rgba(94,106,210,.55), 0 30px 60px -20px rgba(0,0,0,.9);
  animation: heroRise 1.1s cubic-bezier(.2,.7,.2,1) both;
}
.hero-screen { background: #07080c; border-radius: 34px; overflow: hidden; position: relative; }
.hero-notch { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); width: 110px; height: 28px; border-radius: 999px; background: #000; z-index: 5; }
.hero-sbar { display: flex; justify-content: space-between; padding: 14px 26px 0; font-size: 12px; font-weight: 600; font-family: var(--font-mono); }
.hero-apphead { display: flex; align-items: center; justify-content: space-between; padding: 22px 20px 12px; }
.hero-apphead .t { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); font-family: var(--font-mono); }
.hero-apphead .n { font-size: 18px; font-weight: 600; letter-spacing: -.01em; margin-top: 2px; }
.hero-map { position: relative; height: 250px; background: #0c0d15; overflow: hidden; border-block: 1px solid var(--line); }
.hero-map svg { width: 100%; height: 100%; display: block; }
.hero-mapcanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hero-map::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at 60% 40%, transparent 40%, rgba(7,8,12,.55) 100%); pointer-events: none; }
.hero-chip {
  position: absolute; left: 14px; top: 14px; z-index: 2; display: flex; align-items: center; gap: 7px;
  background: rgba(7,8,12,.8); backdrop-filter: blur(8px); border: 1px solid var(--line2); border-radius: 999px; padding: 6px 11px 6px 8px; font-size: 11px; font-weight: 500;
}
.hero-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); animation: pulseDotOk 2s infinite; }
.hero-eta {
  position: absolute; right: 14px; bottom: 14px; z-index: 2; background: rgba(7,8,12,.85); backdrop-filter: blur(8px);
  border: 1px solid var(--line2); border-radius: 10px; padding: 8px 11px; font-family: var(--font-mono); font-size: 11px; line-height: 1.35;
}
.hero-eta b { display: block; color: var(--text); font-size: 13px; }
.hero-eta span { color: var(--dim); }
.hero-meta { padding: 16px 20px 22px; display: grid; gap: 12px; }
.hero-meta .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hero-tl { display: grid; gap: 10px; font-size: 12.5px; }
.hero-tl div { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.hero-tl div i { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--ok); }
.hero-tl div.cur i { background: var(--accent); box-shadow: 0 0 0 4px rgba(94,106,210,.2); animation: ringPulse 2s infinite; }
.hero-tl div.cur { color: var(--text); font-weight: 500; }
.hero-tl div.next i { background: transparent; border: 1.5px solid var(--dim); }
.hero-tl div.next { color: var(--dim); }
.hero-tl div em { margin-left: auto; font-style: normal; font-family: var(--font-mono); font-size: 11px; color: var(--dim); }
.hero-meta .chat-msg { max-width: 92%; }

.hero-float {
  position: absolute; z-index: 3; background: rgba(15,16,23,.86); backdrop-filter: blur(10px); border: 1px solid var(--line2); border-radius: 12px;
  padding: 10px 13px; font-size: 12px; box-shadow: 0 20px 50px -20px rgba(0,0,0,.9); display: flex; align-items: center; gap: 10px; animation: floaty 6s ease-in-out infinite;
}
.hero-float .ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); flex: none; }
.hero-float b { display: block; font-weight: 600; font-size: 12.5px; }
.hero-float span { color: var(--muted); font-family: var(--font-mono); font-size: 11px; }
.hero-float.f1 { left: -14%; top: 1%; animation-delay: -1s; }
.hero-float.f2 { right: -10%; top: 36%; animation-delay: -3s; }
.hero-float.f3 { left: -12%; bottom: 14%; animation-delay: -5s; }

@keyframes heroRise { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: none; } }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes routeDraw { to { stroke-dashoffset: 0; } }
@keyframes pulseDotOk { 0% { box-shadow: 0 0 0 0 rgba(62,207,142,.55); } 70% { box-shadow: 0 0 0 8px rgba(62,207,142,0); } 100% { box-shadow: 0 0 0 0 rgba(62,207,142,0); } }

@media (max-width: 1024px) {
  .hero { grid-template-columns: 1fr; padding-bottom: 0; }
  .hero-stage { min-height: 0; margin-top: 8px; }
  .hero-phone { margin-bottom: -50px; }
  .hero-float.f1 { left: 0; } .hero-float.f2 { right: 0; } .hero-float.f3 { left: 2%; }
}
@media (max-width: 640px) {
  .hero-float { display: none; }
  .hero-phone { width: 100%; border-radius: 36px; padding: 9px; }
  .hero-screen { border-radius: 28px; }
  .hero-h1 { font-size: 38px; }
  .eyebrow-more { display: none; }
  .hero-nav-cta { display: none; }
  .auth-card { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  .route-fill { stroke-dashoffset: 0; }
  .hero-phone, .hero-float, .pin-ping, .route-dash { animation: none; }
}

/* ======================================================================
   App UI pass: Home command bar, section eyebrows, card progress, map
   chips. Same tokens as the landing hero (docs/design/sputnik-hero.html).
   ====================================================================== */

/* App ground: the hero's atmosphere, much quieter */
.app {
  background:
    radial-gradient(ellipse 90% 36% at 50% -8%, rgba(94,106,210,.16), transparent 70%),
    var(--bg);
}
.topbar .brand-badge { background: var(--surface); }
.topbar .brand-badge img.logo-mark { height: 20px; }

/* Greeting: bigger name, mono sub-line */
.greeting h1 { font-size: 24px; letter-spacing: -0.02em; }
.greeting p { font-family: var(--font-mono); font-size: 11.5px; color: var(--dim); letter-spacing: .02em; }

/* Section eyebrow (mockup .k / .stxt .k) */
.section-row { display: flex; align-items: center; justify-content: space-between; margin: 18px 0 4px; }
.section-k { font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent2); }
.view-header h2 { font-size: 24px; letter-spacing: -0.02em; }
.hero-top .section-k { margin-bottom: 4px; }
.shipment-hero h2 { font-size: 22px; letter-spacing: -0.02em; }

/* Command bar (mockup .cmd): search + refresh + new, one object */
.cmd {
  margin: 14px 0 0; background: rgba(15,16,23,.85); border: 1px solid var(--line2); border-radius: var(--radius);
  box-shadow: 0 30px 80px -30px rgba(0,0,0,.8), 0 0 0 1px rgba(255,255,255,.02) inset; overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.cmd:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft), 0 30px 80px -30px rgba(0,0,0,.8); }
.cmd-in { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; }
.cmd-in > svg { width: 18px; height: 18px; flex: none; color: var(--dim); }
.cmd-in .search {
  flex: 1; min-width: 0; background: transparent; border: 0; padding: 12px 0; border-radius: 0;
  font-family: var(--font-mono); font-size: 14px; letter-spacing: .04em; color: var(--text);
  text-overflow: ellipsis;
}
.cmd-in .search:focus { box-shadow: none; }
.cmd-in .search::-webkit-search-cancel-button { -webkit-appearance: none; }
.cmd-refresh {
  flex: none; width: 40px; height: 40px; border-radius: var(--radius-sm); background: transparent; border: 1px solid transparent;
  color: var(--dim); display: grid; place-items: center; cursor: pointer; transition: color .15s, border-color .15s, background .15s;
}
@media (hover: hover) and (pointer: fine) { .cmd-refresh:hover { color: var(--text); border-color: var(--line2); background: rgba(255,255,255,.03); } }
.cmd-refresh svg { width: 16px; height: 16px; }
.cmd-refresh.spinning svg { animation: spin 1s linear infinite; }
.cmd-go {
  flex: none; height: 40px; padding: 0 14px 0 10px; border-radius: var(--radius-sm); background: var(--accent); color: #fff; border: 0;
  display: inline-flex; align-items: center; gap: 6px; font-weight: 500; font-size: 13px; cursor: pointer;
  box-shadow: 0 0 0 1px rgba(255,255,255,.08) inset, var(--btn-glow); transition: background .15s, transform .15s;
}
@media (hover: hover) and (pointer: fine) { .cmd-go:hover { background: #6b77e0; transform: translateY(-1px); } }
.cmd-go svg { width: 16px; height: 16px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Shipment cards: progress track + ETA */
.card { padding: 14px 14px 0; overflow: hidden; }
.card .card-foot { margin-bottom: 12px; }
.card-progress { height: 3px; margin: 0 -14px; background: var(--surface-2); }
.card-progress i {
  display: block; height: 100%; width: 0; border-radius: 0 2px 2px 0;
  background: linear-gradient(90deg, var(--accent2), var(--accent)); transition: width .6s cubic-bezier(.4,0,.2,1);
}
.card.status-delivered .card-progress i { background: var(--ok); }
.card.status-out_for_delivery .card-progress i { background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.card.status-exception .card-progress i, .card.status-failed_attempt .card-progress i { background: var(--danger); }
.card-checked { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .02em; }
.card-title { font-size: 15px; }
.contact-card, .notif-card, .card.account-card { padding-bottom: 14px; }
.contact-card .card-progress, .notif-card .card-progress { display: none; }

/* Chips over the shipment map (mockup .chip / .eta) */
.map-overlay { position: absolute; inset: 0; z-index: 460; pointer-events: none; }
.map-chip {
  position: absolute; left: 12px; top: 12px; display: inline-flex; align-items: center; gap: 7px;
  background: rgba(7,8,12,.8); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--line2); border-radius: 999px; padding: 6px 11px 6px 8px; font-size: 11px; font-weight: 500; color: var(--text);
}
.map-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent2); box-shadow: 0 0 0 0 rgba(139,124,246,.55); animation: pulseDot 2s infinite; }
.map-chip.status-delivered i { background: var(--ok); animation: none; }
.map-chip.status-exception i, .map-chip.status-failed_attempt i { background: var(--danger); animation: none; }
.map-eta {
  position: absolute; right: 12px; bottom: 26px; background: rgba(7,8,12,.85); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--line2); border-radius: 10px; padding: 8px 11px; font-family: var(--font-mono); font-size: 10px; line-height: 1.35;
}
.map-eta span { color: var(--dim); letter-spacing: .08em; text-transform: uppercase; }
.map-eta b { display: block; color: var(--text); font-size: 12.5px; font-weight: 600; }
.leaflet-control-zoom { z-index: 470 !important; }
.map .leaflet-top.leaflet-left { top: 48px; }

/* Filter pills sit closer to the section eyebrow */
#shipment-filter-tabs { margin: 8px 0 10px; }

@media (max-width: 640px) {
  .cmd-go span { display: none; }
  .cmd-go { padding: 0 11px; }
}

/* ---------- Inbox (home): every shipment is a thread ---------- */
.ibx-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 4px 2px 14px; }
.ibx-title h1 { margin: 2px 0 0; font-size: 22px; font-weight: 600; letter-spacing: -.03em; line-height: 1.1; }
.ibx-sub { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.tabs.chips { gap: 6px; background: transparent; border: 0; padding: 0 0 10px; }
.tabs.chips .tab { border-radius: 999px; padding: 6px 12px; font-size: 12.5px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); }
.tabs.chips .tab.active { background: var(--accent); border-color: transparent; color: #fff; }

.inbox { display: block; }
.ibx-sec { display: flex; align-items: center; justify-content: space-between; padding: 14px 4px 6px; font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); }
.ibx-sec em { font-style: normal; color: var(--ok); }
.ibx-row { display: flex; gap: 12px; align-items: center; padding: 11px 6px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background .15s ease, opacity .15s ease; border-radius: 10px; }
@media (hover: hover) and (pointer: fine) {
  .ibx-row:hover { background: rgba(255,255,255,.025); }
  .ibx-row.done:hover { opacity: .85; }
}
.ibx-row:active { background: rgba(255,255,255,.04); }
.ibx-row:focus-visible { background: rgba(255,255,255,.025); outline: none; box-shadow: 0 0 0 2px var(--accent-soft); }
.ibx-row.done { opacity: .55; }
.ibx-pk { position: relative; width: 44px; height: 44px; border-radius: 13px; background: #141622; border: 1px solid var(--line2); display: grid; place-items: center; flex: none; color: var(--muted); }
.ibx-pk .icon, .ibx-pk svg { width: 19px; height: 19px; }
.ibx-chip { position: absolute; left: -5px; top: -5px; font-family: var(--mono); font-size: 8px; font-weight: 600; padding: 2px 4px; border-radius: 5px; border: 1.5px solid var(--bg); background: var(--accent); color: #fff; letter-spacing: 0; }
.ibx-chip.c-fedex { background: #4D148C; }
.ibx-chip.c-ups { background: #150400; color: #fbbd00; }
.ibx-chip.c-dhl { background: #FFCC00; color: #D40511; }
.ibx-chip.c-usps { background: #333366; }
.ibx-chip.c-air_cargo { background: #5e6ad2; }
.ibx-chip.c-ocean_cargo { background: #1f8a6f; }
.ibx-dot { position: absolute; right: -4px; bottom: -4px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--bg); background: var(--accent); }
.ibx-dot.acc { background: var(--accent); }
.ibx-dot.vio { background: var(--accent2); }
.ibx-dot.ok { background: var(--ok); }
.ibx-dot.warn { background: var(--warn); }
.ibx-dot.danger { background: var(--danger); }
.ibx-row:not(.done) .ibx-dot.acc, .ibx-row:not(.done) .ibx-dot.vio { animation: pulseDot 2s infinite; }
.ibx-body { flex: 1; min-width: 0; }
.ibx-l1 { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.ibx-l1 b { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.02em; }
.ibx-l1 b .ibx-sub { display: inline; font-weight: 400; color: var(--dim); font-size: 12.5px; }
.ibx-l1 time { font-family: var(--mono); font-size: 11px; color: var(--dim); flex: none; }
.ibx-row.unread .ibx-l1 time { color: var(--accent-text); }
.ibx-l2 { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-top: 2px; }
.ibx-last { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ibx-last.sys { color: var(--accent-text); }
.ibx-last.sys.vio { color: #ddd6ff; }
.ibx-last.sys.ok { color: var(--ok); }
.ibx-last.sys.warn { color: var(--warn); }
.ibx-last.sys.danger { color: var(--danger); }
.ibx-row.unread .ibx-last.human { color: var(--text); }
.ibx-un { flex: none; min-width: 18px; height: 18px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 600; display: grid; place-items: center; padding-inline: 5px; }
.ibx-un.ok { background: var(--ok); color: #052e1e; }
.ibx-tag { flex: none; font-family: var(--mono); font-size: 10px; color: var(--dim); border: 1px solid var(--line); border-radius: 999px; padding: 2px 7px; }
@media (prefers-reduced-motion: reduce) { .ibx-dot { animation: none !important; } }

/* ---------- Thread (shipment detail as a conversation) ---------- */
.thread .th-head { display: flex; align-items: center; gap: 10px; padding: 2px 0 12px; }
.th-back { width: 36px; height: 36px; flex: none; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.th-back svg { width: 16px; height: 16px; }
.th-title { flex: 1; min-width: 0; }
.th-title b { display: block; font-size: 15px; font-weight: 600; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.th-title span { display: block; font-family: var(--mono); font-size: 11px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.th-pill { flex: none; }

.live-card { border: 1px solid var(--line2); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); box-shadow: var(--glow); margin-bottom: 8px; }
.live-card .map { height: 180px; border: 0; border-radius: 0; margin: 0; box-shadow: none; }
/* The live card's map is a glance strip: on touch, pinch and drag already
   work, so the desktop +/- control only covers the route. */
@media (pointer: coarse) { .live-card .leaflet-control-zoom { display: none; } }
.live-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); }
.live-row .k { display: block; font-family: var(--mono); font-size: 10.5px; color: var(--dim); letter-spacing: .04em; text-transform: uppercase; }
.live-row b { display: block; font-size: 15px; font-weight: 600; letter-spacing: -.01em; margin-top: 1px; }
.live-row .tn { font-family: var(--mono); font-size: 11.5px; color: var(--muted); text-align: right; }

.chat-messages.thread-msgs { max-height: none; overflow: visible; gap: 10px; padding: 8px 0 12px; }
.th-day { align-self: center; font-family: var(--mono); font-size: 10.5px; color: var(--dim); letter-spacing: .06em; text-transform: uppercase; margin-top: 6px; }
.th-sys { align-self: center; display: inline-flex; align-items: center; gap: 7px; max-width: 100%; font-family: var(--mono); font-size: 11px; line-height: 1.4; color: var(--muted); background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; padding: 5px 11px; }
.th-sys i { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); flex: none; }
.th-sys time { flex: none; white-space: nowrap; }
.th-sys i.acc { background: var(--accent); } .th-sys i.vio { background: var(--accent2); } .th-sys i.warn { background: var(--warn); } .th-sys i.danger { background: var(--danger); }
.th-sys.warn { color: var(--warn); border-color: rgba(242,180,92,.3); }
.th-sys time { color: var(--dim); margin-left: 2px; }
.th-sys a { color: var(--accent-text); }

.th-card { align-self: stretch; background: var(--surface); border: 1px solid var(--line2); border-radius: var(--radius-md); padding: 12px 14px; display: grid; gap: 6px; margin-top: 4px; }
.th-card.hl { border-color: rgba(139,124,246,.5); background: linear-gradient(180deg, rgba(139,124,246,.12), rgba(94,106,210,.04)); }
.th-card.ok { border-color: rgba(62,207,142,.35); background: linear-gradient(180deg, rgba(62,207,142,.1), transparent); }
.th-card.warn { border-color: rgba(242,180,92,.4); background: linear-gradient(180deg, rgba(242,180,92,.1), transparent); }
.th-card .h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.th-card .h b { font-size: 14px; font-weight: 600; }
.th-card .h time { font-family: var(--mono); font-size: 10.5px; color: var(--dim); }
.th-card p { margin: 0; font-size: 13px; color: var(--muted); }
.th-card .eta { display: flex; align-items: baseline; gap: 8px; }
.th-card .eta b { font-size: 19px; letter-spacing: -.02em; font-weight: 600; }
.th-card .eta span { font-family: var(--mono); font-size: 11px; color: var(--dim); }
.th-card .act { display: flex; gap: 8px; margin-top: 4px; }

.th-more { border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--bg2); margin: 4px 0 14px; }
.th-more summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; padding: 11px 14px; font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); }
.th-more summary::-webkit-details-marker { display: none; }
.th-more summary svg { width: 14px; height: 14px; transition: transform .15s ease; }
.th-more[open] summary svg { transform: rotate(180deg); }
.th-more[open] summary { border-bottom: 1px solid var(--line); }
.th-more .shipment-hero { padding: 12px 14px 4px; }
.th-more .checkpoints { padding: 0 14px 12px; }
.thread .chat-form input { font-size: 16px; }

/* ---------- Invitation (/s/:token) ---------- */
.content.invite { max-width: 520px; padding-bottom: 40px; }
.inv-from { display: grid; gap: 12px; padding: 8px 0 16px; }
.inv-who { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.inv-who .avatar { width: 34px; height: 34px; font-size: 13px; }
.inv-who b { display: block; color: var(--text); font-size: 15px; font-weight: 600; }
.inv-h { margin: 0; font-size: clamp(24px, 6.5vw, 30px); line-height: 1.05; letter-spacing: -.03em; font-weight: 600; text-wrap: balance; }
.inv-h em { font-style: normal; color: var(--accent2); }
.invite .live-card { margin-bottom: 14px; }
.invite .live-card .map { height: 170px; }
.invite .live-row .k { text-transform: none; letter-spacing: 0; font-family: var(--font); font-size: 12.5px; color: var(--muted); }
.inv-steps { display: grid; gap: 8px; margin: 2px 0 14px; }
.inv-steps div { display: flex; gap: 10px; align-items: center; font-size: 13.5px; color: var(--muted); text-wrap: pretty; }
.inv-steps i { width: 22px; height: 22px; border-radius: 50%; background: rgba(62,207,142,.14); color: var(--ok); display: grid; place-items: center; flex: none; }
.inv-steps i svg { width: 11px; height: 11px; }
.inv-cta { display: grid; gap: 8px; margin-bottom: 14px; }
.inv-cta .btn-primary { width: 100%; padding: 13px; font-size: 15px; border-radius: 12px; }
.inv-hint { text-align: center; font-family: var(--mono); font-size: 10.5px; color: var(--dim); }
.shared-auth-card { margin: 0 0 14px; }
.inv-install { display: grid; gap: 4px; padding: 12px 14px; border: 1px dashed var(--line2); border-radius: var(--radius-md); font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.inv-install b { color: var(--text); font-weight: 600; }
.inv-install svg { width: 13px; height: 13px; vertical-align: -2px; margin: 0 2px; }
.inv-install em { font-style: normal; color: var(--accent-text); }
.inv-foot { text-align: center; font-family: var(--mono); font-size: 10.5px; color: var(--dim); margin: 6px 0 0; }

/* Signup honeypot (see routes/auth.js): present in the form so bots fill
   it, but off-screen, untabbable and hidden from assistive tech, so no
   person ever does. */
.hp-field {
  position: absolute !important; left: -10000px !important; top: auto !important;
  width: 1px !important; height: 1px !important; overflow: hidden !important;
  opacity: 0 !important; pointer-events: none !important;
}
