/* ==========================================================================
   Arrival Detail — arrival.html (ARR-0223-1, HLBU 902146-3)
   Spec: build/po/pages.md → "10. arrival.html"

   One container from booking to empty return. The shared vocabulary (header,
   fields, path, figure bar, key–value grid, subsections, timeline, documents,
   photos, slab table, fill gauge, vessel chart, two-sided choice) lives in
   purchase-orders.css; this sheet holds only what one page says: the column
   shares of its six tables, the chart beside the milestones, the followers
   matrix, the spread-basis words and the View As switch. Tokens only, no
   hex, radius at most 7px, nothing under 10px, no `style` attribute.
   ========================================================================== */

/* ---------- Header ------------------------------------------------------------
   The h1 carries the box first and its arrival number after it, muted. The
   Export PDF control is a button here (it opens the document-set dialog), so
   the button's own chrome is taken off. */
.arv-title-num { font-weight: 500; color: var(--color-text-muted); }
.arv-export { padding: 0; border: 0; background: none; }
.arv-buyer { align-self: center; font-size: 12px; }

/* ---------- Readings ---------------------------------------------------------- */
.arv-late { color: var(--color-danger-ink); font-weight: 600; }
.arv-muted { font-size: 12px; color: var(--color-text-muted); }

/* ---------- View As Without Cost Permission -----------------------------------
   The gear flips one class on <body>. Without it, the permission sentences are
   not drawn; with it, every buying figure gives way to its sentence. Each
   element keeps its own display otherwise. */
body:not(.arv-noperm) .arv-perm-only { display: none; }
body.arv-noperm .arv-cost-only { display: none; }
.po-stat.arv-perm-only { justify-content: center; gap: 4px; }

/* ---------- Inside the panel ----------------------------------------------------
   Every tab's card has merged into the shell, so a table inside one of its
   subsections already stands off the panel's edge by the shell's own padding
   (memory.md §20): it takes no inset on top. The authored footer under the
   packing list lines up with the headings above it. */
.arv-shell .po-sec > .table-wrap { padding-inline: 0; }
.arv-shell .arv-sec--table { padding-bottom: 12px; }
.arv-shell .card > .card-footer.arv-foot { padding-inline: 0; flex-wrap: wrap; gap: 8px 14px; font-size: 12px; color: var(--color-text-muted); }
.arv-foot a { color: var(--color-primary-600); text-decoration: none; }
.arv-note { margin: 12px 0 0; font-size: 12px; color: var(--color-text-muted); line-height: 1.5; }
.arv-note a { color: var(--color-primary-600); text-decoration: none; }
.arv-note--lead { margin: 0; }
.arv-note--lead .po-reading { font-size: 12px; color: var(--color-text-muted); }
.arv-note--body { margin: 0; font-size: 13px; color: var(--color-text); }
.arv-cols {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 48px; align-items: start;
}

/* ---------- Tracking: the chart beside the milestones ---------------------------
   Two columns from 1200 up, the chart taking the slack; stacked below. The
   chart's labels are written at 14 units so they read at about 11px once the
   900-wide drawing is fitted to its column. */
.arv-track {
  display: grid; grid-template-columns: minmax(0, 1fr) 400px;
  grid-template-areas: 'map miles' 'below miles';
  gap: 0 24px; align-items: start;
}
.arv-track__map { grid-area: map; margin: 0; min-width: 0; }
.arv-track__miles { grid-area: miles; }
.arv-track__below { grid-area: below; min-width: 0; }
/* A heading inside the tracking column: the subsection's own 14px, a muted
   reading after it. */
.arv-sub-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 20px 0 10px; }
.arv-sub-h h4 { margin: 0; font-size: 14px; font-weight: 600; color: var(--color-text); }
.arv-sub-h .subtle { font-size: 12px; }
.arv-track .po-map__label { font-size: 14px; }
.arv-map__sea-label { font-style: italic; fill: var(--color-text-subtle); letter-spacing: .04em; }
.arv-map__strong { font-weight: 600; fill: var(--color-text); }
.arv-track__miles { min-width: 0; }
.arv-etd-eta {
  margin-bottom: 14px; padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
}
.arv-etd-eta .po-eta { font-size: 13px; }

/* ETA Changes: the one change and what it moved, on the control ground — a
   box inside the white panel (memory.md §13). */
.arv-change {
  padding: 10px 12px;
  background: var(--color-control); border: 1px solid var(--color-control-border);
  border-radius: var(--radius);
}
.arv-change__head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: 13px; }
.arv-change__head .po-reading { font-size: 12px; color: var(--color-text-muted); }
.arv-moved { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.arv-moved li { display: flex; align-items: baseline; gap: 8px; }
.arv-moved li > svg { width: 14px; height: 14px; flex: none; color: var(--color-text-muted); align-self: center; }
.arv-moved a { color: var(--color-primary-600); text-decoration: none; }
.arv-moved .po-reading { font-size: 13px; }

/* Legs */
.arv-legs { min-width: 760px; }
.arv-legs th.col-leg { width: 11%; }
.arv-legs th.col-route { width: 21%; }
.arv-legs th.col-carrier { width: 19%; }
.arv-legs th.col-dates { width: 18%; }
.arv-legs th.col-note { width: 19%; }
.arv-legs th.col-state { width: 12%; }
.arv-legs td.col-note { font-size: 12px; color: var(--color-text-muted); }

/* Followers & Alerts: who, then the four events as switches, switch first
   (memory.md §5), each row reading left to right with nothing pushed to the
   far edge (§16). */
.arv-follow { display: flex; flex-direction: column; }
.arv-follow__row {
  display: grid; grid-template-columns: 280px minmax(0, 1fr);
  gap: 8px 16px; align-items: center;
  padding: 9px 0; border-bottom: 1px solid var(--color-border);
}
.arv-follow__row:first-child { padding-top: 0; }
.arv-follow__events { display: flex; flex-wrap: wrap; gap: 8px 26px; }
.arv-follow__events .switch-field { font-size: 13px; color: var(--color-text); }

/* ---------- Documents -------------------------------------------------------------- */
.arv-docs-sub {
  margin: 14px 0 2px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em; color: var(--color-text-subtle);
}
.po-sec__h + .arv-docs-sub { margin-top: 0; }
.arv-shell .po-doc > .cell-stack { flex: 1 1 260px; min-width: 0; }
.arv-shell .po-doc .po-doc__ver { white-space: normal; }
.arv-shell .po-doc .po-doc__ver a { color: var(--color-primary-600); text-decoration: none; }
.arv-doc-thumb { object-fit: cover; border-radius: 3px; }
.arv-inbox { display: inline-flex; align-items: center; gap: 4px; color: var(--color-success-ink); }
.arv-inbox svg { width: 12px; height: 12px; flex: none; }
.arv-btn-img { height: 16px; width: auto; }
/* Every row's actions stand in the same right-hand slot, one action or two. */
.arv-shell .po-doc__vis { min-width: 92px; }
.arv-shell .po-doc__acts { min-width: 72px; justify-content: flex-end; }

/* ---------- Packing list ---------------------------------------------------------------
   Eleven columns, so the table keeps a floor and scrolls inside its wrap on a
   narrow screen rather than crushing a slab number. */
.arv-pl { min-width: 1080px; }
.arv-pl th.col-n { width: 4%; }
.arv-pl th.col-ref { width: 12%; }
.arv-pl th.col-slab { width: 7%; }
.arv-pl th.col-mat { width: 14%; }
.arv-pl th.col-dims { width: 10%; }
.arv-pl th.col-area { width: 5%; }
.arv-pl th.col-kg { width: 5%; }
.arv-pl th.col-grade { width: 7%; }
.arv-pl th.col-line { width: 5%; }
.arv-pl th.col-sold { width: 14%; }
.arv-pl th.col-result { width: 17%; }
/* A row number and a supplier reference are one token each: never broken
   across two lines. */
.arv-pl td.col-n,
.arv-pl td.col-ref { white-space: nowrap; }
.arv-pl td.col-ref,
.arv-pl td.col-n { color: var(--color-text-muted); }
.arv-pl td a { color: var(--color-primary-600); text-decoration: none; }
/* A group row spans the table, so it is also its last cell: it reads from the
   left like the rows under it, not from the right edge. */
.arv-shell .data-table tbody tr.po-group-row td:last-child { text-align: left; }

/* ---------- Receiving -------------------------------------------------------------------- */
.arv-results { min-width: 720px; }
.arv-results th.col-result { width: 16%; }
.arv-results th.col-units { width: 32%; }
.arv-results th.col-trigger { width: 38%; }
.arv-results th.col-count { width: 14%; }
.arv-results td { vertical-align: top; }
.arv-results td a { color: var(--color-primary-600); text-decoration: none; }
.arv-claim { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 14px; }
.arv-claim .po-reading { font-size: 13px; }
.arv-claim a { color: var(--color-primary-600); text-decoration: none; font-weight: 600; }
.arv-shell .po-kv a { color: var(--color-primary-600); text-decoration: none; }

/* ---------- Landed cost ---------------------------------------------------------------------
   The spread basis: four words, the one in force in the text ink at 600,
   never boxed or underlined. Choosing one lights its row in the preview and
   offers Apply; the figures above do not move on their own. */
.arv-basis { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px; }
.arv-basis__lead { display: inline-flex; align-items: center; font-size: 12px; color: var(--color-text-muted); }
.arv-basis__opt {
  display: inline-flex; align-items: baseline; gap: 6px;
  padding: 2px 0; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 500; color: var(--color-text-muted);
}
.arv-basis__opt:hover { color: var(--color-text); }
.arv-basis__opt.is-active { color: var(--color-text); font-weight: 600; }
.arv-basis__sub { font-size: 11px; font-weight: 400; color: var(--color-success-ink); }
.arv-basis__apply[hidden] { display: none; }

.arv-costs { min-width: 900px; }
.arv-costs th.col-type { width: 16%; }
.arv-costs th.col-vendor { width: 15%; }
.arv-costs th.col-entry { width: 13%; }
.arv-costs th.col-cap { width: 9%; }
.arv-costs th.col-bill { width: 16%; }
.arv-costs th.col-state { width: 10%; }
.arv-costs th.col-est { width: 9%; }
.arv-costs th.col-act { width: 12%; }
.arv-costs td a { color: var(--color-primary-600); text-decoration: none; }
.arv-costs td.col-entry { font-size: 12px; }
.arv-costs .po-cost__total .cell-stack .main { font-weight: 600; }

.arv-landed { min-width: 600px; }
.arv-landed th.col-mat { width: 30%; }
.arv-landed th.col-goods { width: 15%; }
.arv-landed th.col-added { width: 13%; }
.arv-landed th.col-landed { width: 15%; }
.arv-landed th.col-sqft { width: 27%; }

.arv-preview { min-width: 560px; }
.arv-preview th.col-basis { width: 28%; }
.arv-preview th.col-sa,
.arv-preview th.col-cv,
.arv-preview th.col-tile { width: 24%; }
.arv-preview tbody tr.is-pick td { background: var(--color-control); }
.arv-preview tbody tr.is-pick .cell-stack .main { font-weight: 600; }
/* The warning spans the three material columns and is also the row's last
   cell, which app.css right-aligns: it reads from the left like a sentence. */
.arv-preview tbody td.arv-warn-cell { text-align: left; }
.arv-preview tbody td.arv-warn-cell::after { background: var(--row-mark-left); }
.arv-preview .po-reading { font-size: 12px; }

/* ---------- Dialogs -----------------------------------------------------------------------------
   Controls sized to what they hold (memory.md §9). */
.arv-w-sm { width: 150px; max-width: 100%; }
.arv-w-md { width: 260px; max-width: 100%; }
.arv-w-lg { width: 360px; max-width: 100%; }
.arv-gap-top { margin-top: 14px; }
.arv-switch-col { display: flex; flex-direction: column; gap: 10px; }
.arv-switch-grid { display: grid; grid-template-columns: repeat(2, max-content); gap: 10px 32px; }
.arv-link-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.arv-link-row code {
  font-family: inherit; font-size: 12px; padding: 4px 8px;
  background: var(--color-control); border: 1px solid var(--color-control-border);
  border-radius: var(--radius); color: var(--color-text);
}
.arv-drop {
  padding: 22px 16px; text-align: center; font-size: 13px; color: var(--color-text-muted);
  background: var(--color-control); border: 1px dashed var(--color-control-border);
  border-radius: var(--radius);
}
.arv-drop svg { width: 20px; height: 20px; display: block; margin: 0 auto 6px; color: var(--color-text-subtle); }

/* ---------- Narrow screens ---------------------------------------------------------------------- */
@media (max-width: 1200px) {
  .arv-track { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'map' 'miles' 'below'; }
  .arv-track__miles { margin-top: 18px; }
}
@media (max-width: 768px) {
  .arv-cols { grid-template-columns: minmax(0, 1fr); }
  .arv-follow__row { grid-template-columns: minmax(0, 1fr); }
  /* The chart keeps a readable scale and scrolls sideways inside its frame. */
  .arv-track .po-map { overflow-x: auto; overflow-y: hidden; }
  .arv-track .po-map svg { width: 660px; max-width: none; }
  .arv-basis__opt { min-height: 36px; }
}
@media (max-width: 480px) {
  .arv-switch-grid { grid-template-columns: minmax(0, 1fr); }
  /* A document keeps its mark beside its name; who sent it and its actions
     share the line under them, rather than each taking a line of its own. */
  .arv-shell .po-doc > .cell-stack { flex: 1 1 calc(100% - 34px); }
  .arv-shell .po-doc__vis { min-width: 0; margin-left: 34px; }
  .arv-shell .po-doc__acts { flex-basis: auto; margin-left: auto; }
  /* Two variance photos to a row, square, filling the column. */
  .arv-shell .po-photos--lg { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .arv-shell .po-photos--lg img,
  .arv-shell .po-photos--lg .po-photos__none { width: 100%; height: auto; aspect-ratio: 1; }
  .arv-follow__events { gap: 10px 18px; }
  .arv-change__head { gap: 4px 10px; }
}
