/* ==========================================================================
   NALQIVO ERP — Logistics & Notices app workspaces (2026-10)
   Purpose-built interiors for the two operational apps. Everything here is
   scoped under .appx so the rest of the ERP keeps its own design language.
   ========================================================================== */

.appx { --appx-accent: var(--brand); --appx-accent-soft: var(--brand-50); display: block; }
.appx-notices { --appx-accent: #b45309; --appx-accent-soft: #fff5e6; }
.appx-logistics { --appx-accent: #0f766e; --appx-accent-soft: #e6faf7; }

/* --------------------------------------------------------------------------
   Module rail
   -------------------------------------------------------------------------- */
.appx-nav {
  display: flex; align-items: center; gap: 5px;
  padding: 5px; margin: 0 0 18px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow-xs);
  overflow-x: auto; overscroll-behavior-inline: contain;
  scrollbar-width: none;
}
.appx-nav::-webkit-scrollbar { display: none; }
@media (min-width: 621px) {
  .appx-nav { flex-wrap: wrap; overflow-x: visible; row-gap: 4px; }
  .appx-nav .appx-nav-end { margin-inline-start: auto; }
}
.appx-nav a {
  display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto;
  height: 34px; padding: 0 12px; border-radius: 9px;
  color: var(--muted); font-size: 12px; font-weight: 600; text-decoration: none;
  white-space: nowrap; transition: background 0.15s var(--easing), color 0.15s var(--easing);
}
.appx-nav a svg { flex: 0 0 auto; opacity: 0.85; }
.appx-nav a:hover { background: var(--surface-3); color: var(--ink-2); }
.appx-nav a.active { background: var(--appx-accent); color: #fff; box-shadow: 0 4px 12px rgba(19, 35, 58, 0.16); }
.appx-nav a.active svg { opacity: 1; }
.appx-nav a.nav-primary { color: var(--appx-accent); font-weight: 700; }
.appx-nav a.nav-primary:hover { background: var(--appx-accent-soft); color: var(--appx-accent); }
.appx-nav a.nav-primary.active { color: #fff; }
.appx-nav .appx-nav-end { margin-inline-start: auto; display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto; padding-inline-start: 6px; }
.appx-nav .appx-count {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px;
  display: inline-grid; place-items: center; font-size: 9.5px; font-weight: 700;
  background: var(--surface-3); color: var(--muted);
}
.appx-nav a.active .appx-count { background: rgba(255, 255, 255, 0.22); color: #fff; }

/* --------------------------------------------------------------------------
   Head extras / section rhythm
   -------------------------------------------------------------------------- */
.appx .page-head { margin-bottom: 14px; }
.appx .page-eyebrow { color: var(--appx-accent); }
.appx .page-head h1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.appx-section { margin-top: 16px; }
.appx-section:first-child { margin-top: 0; }
.appx-head-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
/* Fields are column flexboxes; a search-inline inside one must keep its natural
   input height instead of inheriting the toolbar's 280px flex basis. */
.appx .field > .search-inline { flex: 0 0 auto; width: 100%; min-width: 0; }
.appx-muted-link { font-size: 11px; color: var(--muted); text-decoration: none; font-weight: 600; }
.appx-muted-link:hover { color: var(--appx-accent); }

/* KPI boards */
.ops-stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.nw-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.nw-kpis.coverage { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.nw-kpis.secondary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.appx .stat { min-height: 96px; }

/* Watch / alert strip */
.watch-strip {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 14px; padding: 11px 14px;
  border: 1px solid #f3ddb5; border-radius: 12px;
  background: linear-gradient(180deg, #fffaf0, #fffdf8);
  color: #7a4b06; font-size: 12px;
}
.watch-strip .ws-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: #fdeccb; color: #b26a05; flex: 0 0 auto; }
.watch-strip strong { color: #6b3e00; }
.watch-strip .ws-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.watch-strip .ws-link { margin-inline-start: auto; }

/* Toolbar with search + filters */
.appx-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 14px;
}
.appx-toolbar .grow { flex: 1 1 220px; min-width: 0; }
.appx-toolbar .search-inline { width: 100%; }
.appx-toolbar .filters { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.appx-toolbar .filters select,
.appx-toolbar .filters .input { height: 34px; font-size: 11.5px; }
.appx-toolbar .filters .input[type="search"] { width: auto; flex: 1 1 240px; min-width: 220px; max-width: 420px; }
/* Toolbar controls must not inherit the global full-width form sizing. */
.appx-toolbar .filters select,
.appx-toolbar .filters .select { width: auto; min-width: 138px; flex: 0 0 auto; }
.appx-toolbar .filters .cb { width: auto; flex: 1 1 170px; min-width: 138px; }
.appx-toolbar .filters .input[type="date"] { width: auto; min-width: 148px; flex: 0 0 auto; }
.appx-toolbar .filters > label.small { white-space: nowrap; flex: 0 0 auto; }
.appx-toolbar .count-note { color: var(--muted); font-size: 11px; white-space: nowrap; }
.filter-pill {
  display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 11px;
  border: 1px solid var(--line-strong); border-radius: 99px; background: #fff;
  color: var(--muted); font-size: 11px; font-weight: 600; text-decoration: none;
}
.filter-pill:hover { border-color: #b9cbe4; color: var(--ink-2); }
.filter-pill.active { background: var(--appx-accent-soft); border-color: transparent; color: var(--appx-accent); }
.filter-pill .n { background: rgba(19, 35, 58, 0.07); border-radius: 99px; padding: 0 5px; font-size: 9.5px; }
.filter-pill.active .n { background: rgba(255, 255, 255, 0.7); }

/* --------------------------------------------------------------------------
   Voyage / route visuals
   -------------------------------------------------------------------------- */
.voyage {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(90px, 1.5fr) minmax(0, 1fr);
  align-items: center; gap: 14px;
  padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px;
  background: linear-gradient(180deg, #fbfdff, #ffffff);
}
.voyage-port { min-width: 0; }
.voyage-port .k { font-size: 9.5px; letter-spacing: 0.2px; color: var(--muted-2); font-weight: 700; }
.voyage-port .v { font-size: 14px; font-weight: 700; color: var(--ink); margin-top: 2px; overflow-wrap: anywhere; }
.voyage-port .m { font-size: 10.5px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.voyage-port.end { text-align: end; }
.voyage-line { position: relative; height: 2px; background: var(--line-strong); border-radius: 99px; }
.voyage-line .progress { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: 99px; background: var(--appx-accent); }
.voyage-line .ship-mark {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; background: var(--appx-accent); color: #fff;
  box-shadow: 0 0 0 4px var(--appx-accent-soft);
}
[dir="rtl"] .voyage-line .ship-mark { transform: translateY(-50%) scaleX(-1); }
.voyage-line .terminal { position: absolute; top: 50%; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); transform: translateY(-50%); }
.voyage-line .terminal.start { inset-inline-start: -4px; background: var(--green); }
.voyage-line .terminal.end { inset-inline-end: -4px; }
.voyage-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); }
.voyage .voyage-foot { grid-column: 1 / -1; }
.voyage-foot b { color: var(--ink-2); }
.voyage-foot .mini-track { display: inline-flex; vertical-align: middle; margin-top: 0; margin-inline-start: 6px; }

.eta-chip { display: inline-flex; align-items: center; gap: 4px; border-radius: 99px; padding: 2px 8px; font-size: 10px; font-weight: 700; }
.eta-chip.late { background: var(--red-soft); color: #b32e3d; }
.eta-chip.today { background: var(--amber-soft); color: #9c6407; }
.eta-chip.soon { background: var(--brand-50); color: var(--brand-2); }
.eta-chip.ok { background: var(--green-soft); color: #077a63; }
.eta-chip.muted { background: var(--surface-3); color: var(--muted); }

.eta-cell .main { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink-2); }
.eta-cell .sub { margin-top: 3px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; font-size: 10px; color: var(--muted); }

.mini-track { display: flex; align-items: center; gap: 3px; margin-top: 7px; max-width: 110px; }
.mini-track i { height: 3px; flex: 1; border-radius: 99px; background: var(--line); }
.mini-track i.done { background: #7dd3c4; }
.mini-track i.current { background: var(--appx-accent); }
.mini-track i.late { background: var(--red); }
.mini-track i.closed { background: var(--slate); }

.route-mini { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; font-size: 11.5px; color: var(--ink-2); font-weight: 600; }
.route-mini .sep { color: var(--muted-2); font-weight: 400; }
.route-sub { font-size: 10px; color: var(--muted); margin-top: 2px; }
.supplier-cell { display: flex; align-items: center; gap: 8px; min-width: 0; }
.supplier-cell .avatar { flex: 0 0 auto; width: 27px; height: 27px; border-radius: 8px; font-size: 10px; }
.supplier-cell .sc-main { min-width: 0; }
.supplier-cell .sc-main .cell-main { font-size: 11.5px; }

.container-cell .num { font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: 0.2px; }
.container-cell .sub { font-size: 10.5px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.chip-row { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 5px; }

/* --------------------------------------------------------------------------
   Cards / lists used by both apps
   -------------------------------------------------------------------------- */
.appx-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
.appx-grid.wide-main { grid-template-columns: minmax(0, 2.1fr) minmax(260px, 0.9fr); }
.stack { display: grid; gap: 16px; }
.stack-sm { display: grid; gap: 10px; }

.list-card { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.list-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 11px 13px; border-bottom: 1px solid #f0f4f9; text-decoration: none; color: inherit;
}
.list-row:last-child { border-bottom: 0; }
a.list-row:hover { background: var(--surface-2); }
.list-row .lr-main { min-width: 0; flex: 1; }
.list-row .lr-title { font-size: 12px; font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.list-row .lr-sub { font-size: 10.5px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.list-row .lr-side { flex: 0 0 auto; text-align: end; font-size: 10px; color: var(--muted-2); }
.list-row.overdue { background: #fff9f9; }

.follow-date { font-size: 10px; font-weight: 700; color: var(--muted); }
.follow-date.overdue { color: var(--red); }

.pipeline { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
.pipeline a {
  display: flex; flex-direction: column; gap: 2px; padding: 10px 11px;
  border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2);
  color: var(--ink-2); text-decoration: none; min-width: 0;
}
.pipeline a:hover { border-color: var(--appx-accent); background: #fff; }
.pipeline a.active { border-color: var(--appx-accent); background: var(--appx-accent-soft); }
.pipeline .n { font-size: 19px; font-weight: 750; line-height: 1.2; font-variant-numeric: tabular-nums; }
.pipeline .s { font-size: 9.5px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.pipeline .s .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--line-strong); flex: 0 0 auto; }
.pipeline .s .dot.amber { background: var(--amber); }
.pipeline .s .dot.red { background: var(--red); }
.pipeline .s .dot.purple { background: var(--purple); }
.pipeline .s .dot.green { background: var(--green); }
.pipeline .s .dot.slate { background: var(--slate); }
.pipeline .s .dot.blue { background: var(--brand); }

/* Monthly bars */
.nw-chart-wrap { overflow-x: auto; padding-bottom: 2px; }
.nw-chart { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(32px, 1fr); gap: 8px; align-items: end; min-height: 170px; }
.nw-col { display: flex; flex-direction: column; justify-content: flex-end; min-width: 0; }
.nw-bars { display: flex; align-items: flex-end; justify-content: center; gap: 2px; height: 132px; }
.nw-bars span { width: 7px; min-height: 2px; border-radius: 3px 3px 0 0; }
.nw-bars .b-notice { background: #f0b429; }
.nw-bars .b-warning { background: #ea580c; }
.nw-bars .b-term { background: #dc2626; }
.nw-col .m { text-align: center; font-size: 9px; color: var(--muted-2); margin-top: 6px; white-space: nowrap; }
.nw-col .v { text-align: center; font-size: 9px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.legend { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 10.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 8px; height: 8px; border-radius: 3px; display: inline-block; }

/* Severity mix */
.mix-row { display: grid; grid-template-columns: minmax(72px, 130px) minmax(0, 1fr) minmax(86px, auto); align-items: center; gap: 8px; font-size: 10.5px; color: var(--muted); margin-top: 8px; }
.mix-track { height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.mix-track span { display: block; height: 100%; border-radius: 99px; background: var(--appx-accent); }
.mix-row .n { text-align: end; font-variant-numeric: tabular-nums; color: var(--ink-2); font-weight: 600; white-space: nowrap; }

/* --------------------------------------------------------------------------
   Notices case detail
   -------------------------------------------------------------------------- */
.case-hero .detail-title { font-family: var(--mono); letter-spacing: 0; }
.case-hero-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-top: 16px; }
.case-hero-box { border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; background: var(--surface-2); min-width: 0; }
.case-hero-box .k { font-size: 9.5px; color: var(--muted-2); font-weight: 700; letter-spacing: 0.1px; }
.case-hero-box .v { font-size: 12.5px; font-weight: 700; color: var(--ink); margin-top: 3px; overflow-wrap: anywhere; }
.case-hero-box .s { font-size: 10.5px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.case-hero-box a { color: var(--brand); text-decoration: none; }
.case-hero-box a:hover { text-decoration: underline; }

.action-item { border: 1px solid var(--line); border-radius: 12px; padding: 12px 13px; background: var(--surface); margin-top: 10px; }
.action-item:first-child { margin-top: 0; }
.action-item .head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.action-item .no { font-family: var(--mono); font-size: 11.5px; font-weight: 700; color: var(--ink); }
.action-item .body { font-size: 11.5px; color: var(--ink-2); line-height: 1.65; margin-top: 6px; overflow-wrap: anywhere; }
.action-item .meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: 7px; font-size: 10px; color: var(--muted); }
.action-item .acts { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-top: 8px; }
.action-item.cancelled { background: var(--surface-2); opacity: 0.75; }

.evidence-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 9px; }
.evidence-card { border: 1px solid var(--line); border-radius: 11px; padding: 10px 11px; background: var(--surface-2); min-width: 0; }
.evidence-card .k { font-size: 9.5px; color: var(--muted-2); font-weight: 700; }
.evidence-card .t { font-size: 11.5px; font-weight: 600; margin-top: 2px; overflow-wrap: anywhere; }
.evidence-card .t a { color: var(--brand); text-decoration: none; }
.evidence-card .t a:hover { text-decoration: underline; }
.evidence-card .s { font-size: 10px; color: var(--muted); margin-top: 3px; overflow-wrap: anywhere; }

.doc-list { display: flex; flex-wrap: wrap; gap: 6px; }
.doc-chip { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; font-size: 10.5px; color: var(--ink-2); background: #fff; }

.term-card { border: 1px solid var(--line); border-left: 0; border-inline-start: 3px solid var(--amber); border-radius: 10px; padding: 10px 12px; background: var(--surface-2); margin-top: 9px; }
.term-card.decided { border-inline-start-color: var(--green); }

/* Case severity accent on list rows */
.case-no { font-family: var(--mono); font-weight: 700; font-size: 11.5px; }
.case-title { font-size: 11px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.count-chip { display: inline-flex; align-items: center; gap: 3px; font-size: 10px; color: var(--muted); }
.count-chip b { color: var(--ink-2); }

/* --------------------------------------------------------------------------
   Notices form / settings
   -------------------------------------------------------------------------- */
.form-grid.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid.three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.sev-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.sev-option { position: relative; display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; cursor: pointer; font-size: 11.5px; background: #fff; }
.sev-option input { accent-color: var(--appx-accent); }
.sev-option:has(input:checked) { border-color: var(--appx-accent); background: var(--appx-accent-soft); }
.sev-option.low .dot { background: var(--slate); }
.sev-option.medium .dot { background: var(--brand); }
.sev-option.high .dot { background: var(--amber); }
.sev-option.critical .dot { background: var(--red); }
.sev-option .dot { width: 7px; height: 7px; border-radius: 50%; }

/* Escalation order editor */
.esc-steps { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.esc-steps li {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; min-width: 0;
}
.esc-steps .n {
  width: 23px; height: 23px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 11px; font-weight: 750;
  background: var(--appx-accent-soft); color: var(--appx-accent);
}
.esc-steps .t { font-size: 12.5px; font-weight: 650; color: var(--ink); }
.esc-steps .k { margin-inline-start: auto; direction: ltr; font-size: 10px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.esc-steps .acts { display: inline-flex; gap: 3px; flex: 0 0 auto; }
.esc-steps .icon-btn { width: 27px; height: 27px; border-radius: 8px; }
.esc-steps .icon-btn.danger { color: var(--red); }
.esc-steps .icon-btn.danger:hover { background: var(--red-soft); color: #b32e3d; }
.esc-add { display: flex; align-items: center; gap: 8px; margin-top: 2px; flex-wrap: wrap; }
.esc-add select { flex: 1 1 170px; min-width: 0; max-width: 280px; width: auto; }
.esc-add .btn { flex: 0 0 auto; }

.toggle-row { display: flex; align-items: flex-start; gap: 10px; padding: 11px 0; border-bottom: 1px solid #f0f4f9; }
.toggle-row:last-child { border-bottom: 0; }
.toggle-row input { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--appx-accent); flex: 0 0 auto; }
.toggle-row .tr-main { min-width: 0; }
.toggle-row .tr-title { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.toggle-row .tr-sub { font-size: 10.5px; color: var(--muted); margin-top: 2px; }

.preview-panel { border: 1px solid var(--line); border-radius: 13px; background: var(--surface); box-shadow: var(--shadow-xs); overflow: hidden; }
.preview-head { padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.preview-head .t { font-size: 12px; font-weight: 700; }
.preview-body { padding: 13px 14px; }
.preview-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid #f0f4f9; font-size: 11px; }
.preview-row:last-child { border-bottom: 0; }
.preview-row .k { color: var(--muted); }
.preview-row .v { color: var(--ink-2); font-weight: 600; text-align: end; overflow-wrap: anywhere; }

/* Analytics report switch */
.report-switch { display: flex; gap: 6px; flex-wrap: wrap; }
.report-switch a { border: 1px solid var(--line); background: #fff; color: var(--muted); padding: 6px 11px; border-radius: 8px; font-size: 11px; font-weight: 600; text-decoration: none; }
.report-switch a:hover { border-color: #b9cbe4; color: var(--ink-2); }
.report-switch a.active { background: var(--appx-accent); border-color: var(--appx-accent); color: #fff; }

/* Data bars inside analytics tables */
.cell-bar { position: relative; min-width: 90px; }
.cell-bar .bar { display: block; height: 6px; border-radius: 99px; background: var(--appx-accent-soft); margin-top: 4px; overflow: hidden; }
.cell-bar .bar span { display: block; height: 100%; border-radius: 99px; background: var(--appx-accent); }

/* Readable RTL/LTR numeric cells */
.ltr-num { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1280px) {
  .ops-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .appx-grid, .appx-grid.wide-main { grid-template-columns: 1fr; }
  .nw-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nw-kpis.coverage, .nw-kpis.secondary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  /* Keep the stage strip on balanced rows instead of a 7+2 orphan. */
  .pipeline { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .appx .table .hide-sm { display: none; }
  .appx .table.table { min-width: 0; }
  /* Cases list: keep the decision-making columns and fold the reference ones
     (generator, action counts, last update) into the record card below 620px. */
  .appx-notices .table.cases-fit { table-layout: fixed; min-width: 0; }
  .appx-notices .table.cases-fit th:nth-child(1) { width: 30%; }
  .appx-notices .table.cases-fit th:nth-child(2) { width: 18%; }
  .appx-notices .table.cases-fit th:nth-child(4) { width: 17%; }
  .appx-notices .table.cases-fit th:nth-child(5) { width: 14%; }
  .appx-notices .table.cases-fit th:nth-child(7) { width: 17%; }
  .appx-notices .table.cases-fit th:nth-child(9) { width: 4%; }
  /* Keep the severity badge on one line down to the narrowest tablet. */
  .appx-notices .table.cases-fit td:nth-child(5) .badge {
    padding-inline: 6px; font-size: 10px; gap: 4px; white-space: nowrap;
  }
  .appx-notices .table.cases-fit th:nth-child(3),
  .appx-notices .table.cases-fit td:nth-child(3),
  .appx-notices .table.cases-fit th:nth-child(6),
  .appx-notices .table.cases-fit td:nth-child(6),
  .appx-notices .table.cases-fit th:nth-child(8),
  .appx-notices .table.cases-fit td:nth-child(8) { display: none; }
  .appx-notices .table.cases-fit td { overflow: hidden; text-overflow: ellipsis; }
  /* The row chevron sits in a 4% cell; tighter padding keeps the icon whole. */
  .appx-notices .table.cases-fit th:last-child,
  .appx-notices .table.cases-fit td:last-child { padding-inline: 5px; }
  .appx-notices .table.cases-fit td:last-child .cell-actions { justify-content: center; }
  .appx-logistics .table.fit-sm { table-layout: fixed; min-width: 0; }
  /* Column widths belong to the header cells only, so the same classes on
     body cells do not fight the phone card layout. */
  .appx-logistics .table.fit-sm th.col-container { width: 29%; }
  .appx-logistics .table.fit-sm th.col-supplier { width: 22%; }
  .appx-logistics .table.fit-sm th.col-eta { width: 18%; }
  .appx-logistics .table.fit-sm th.col-units { width: 7%; }
  .appx-logistics .table.fit-sm th.col-status { width: 14%; }
  .appx-logistics .table.fit-sm th.col-actions { width: 10%; }
  .appx-logistics .table.fit-sm .container-cell .sub,
  .appx-logistics .table.fit-sm .container-cell .num,
  .appx-logistics .table.fit-sm .cell-main { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .appx-logistics .table.fit-sm .supplier-cell { min-width: 0; }
  /* Status badges keep their full English wording in the tablet table. */
  .appx-notices .table.cases-fit td:nth-child(4) .badge,
  .appx-logistics .table.fit-sm .col-status .badge {
    padding-inline: 6px; font-size: 10px; gap: 4px; white-space: nowrap;
  }
  /* Additional-costs has nine columns — turn it into labelled cards on tablets
     too, so no column is clipped or forced to wrap one word per line. */
  .appx-logistics .table.costs-cards {
    display: block; width: 100%; min-width: 0 !important;
    border-collapse: initial; font-size: 12.5px;
  }
  .appx-logistics .table.costs-cards thead { display: none; }
  .appx-logistics .table.costs-cards tbody { display: block; }
  .appx-logistics .table.costs-cards tr {
    display: block; margin-bottom: 9px; overflow: hidden;
    border: 1px solid var(--line); border-radius: 12px;
    background: var(--surface); box-shadow: var(--shadow-xs);
  }
  .appx-logistics .table.costs-cards tbody tr:last-child { margin-bottom: 0; }
  .appx-logistics .table.costs-cards td {
    position: relative; display: flex; flex-wrap: wrap; align-items: flex-start;
    gap: 2px 10px; width: 100%; text-align: start;
    white-space: normal; overflow-wrap: anywhere; vertical-align: top;
    padding: 8px 10px; border: 0; border-bottom: 1px solid #f1f5fa;
  }
  .appx-logistics .table.costs-cards tbody tr:last-child td { border-bottom: 0; }
  .appx-logistics .table.costs-cards td::before {
    content: attr(data-label); flex: 0 0 30%; min-width: 0;
    font-size: 10.5px; font-weight: 700; color: var(--muted); line-height: 1.5;
    overflow-wrap: anywhere;
  }
  .appx-logistics .table.costs-cards td:first-child { display: block; padding: 9px 10px 8px; }
  .appx-logistics .table.costs-cards td:first-child::before { display: block; width: auto; margin-bottom: 3px; }
  .appx-logistics .table.costs-cards td[data-label=""] { justify-content: flex-end; }
  .appx-logistics .table.costs-cards td[data-label=""]::before { display: none; }
  .appx-logistics .table.costs-cards .cell-actions { flex-wrap: wrap; gap: 6px; }
}
@media (max-width: 760px) {
  .nw-kpis.coverage, .nw-kpis.secondary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid.two, .form-grid.three { grid-template-columns: 1fr; }
  .sev-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .voyage { grid-template-columns: 1fr; gap: 10px; }
  .voyage-line { display: none; }
  .voyage-port.end { text-align: start; }
  .appx-toolbar .grow { flex: 1 1 100%; }
  .appx-toolbar .filters { width: 100%; }
  .appx-toolbar .filters select,
  .appx-toolbar .filters .cb { flex: 1 1 130px; min-width: 0; width: auto; }
  .appx-toolbar .count-note { margin-inline-start: auto; }
  .case-hero-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .ops-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .nw-kpis, .nw-kpis.coverage, .nw-kpis.secondary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .appx-nav { margin-bottom: 14px; }
  .appx-nav a { height: 36px; padding: 0 11px; }
  .appx .page-head h1 { font-size: 22px; }
  .appx .stat { min-height: 88px; }
  .pipeline { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .esc-steps .k { display: none; }
  /* Phone card mode shows every field again with its label. */
  .appx-notices .table.cases-fit td:nth-child(3),
  .appx-notices .table.cases-fit td:nth-child(6),
  .appx-notices .table.cases-fit td:nth-child(8) { display: flex; }
  /* Logistics container cards: the route and approval columns fold back in. */
  .appx-logistics .table.table-cards td.hide-sm { display: flex; }
  .nw-chart { grid-auto-columns: minmax(30px, 1fr); }
  .list-row .lr-side { font-size: 9.5px; }
  .evidence-grid { grid-template-columns: 1fr; }
  .watch-strip { font-size: 11px; padding: 10px 11px; }
  .watch-strip .ws-link { margin-inline-start: 0; }
  .mix-row { grid-template-columns: 60px minmax(0, 1fr) 28px; }
}
@media (max-width: 400px) {
  .nw-kpis, .nw-kpis.coverage, .nw-kpis.secondary, .ops-stats { grid-template-columns: 1fr 1fr; }
  .sev-options { grid-template-columns: 1fr 1fr; }
  .appx-toolbar .filters select,
  .appx-toolbar .filters .cb { flex: 1 1 100%; }
}

/* --------------------------------------------------------------------------
   Logistics hub — journey, timeline, alerts, queues and photo strip
   -------------------------------------------------------------------------- */
.logi-journey { position: relative; display: flex; align-items: flex-start; gap: 0; list-style: none; margin: 14px 0 0; padding: 4px 0 0; }
.logi-journey::before { content: ''; position: absolute; top: 12px; inset-inline: 5%; height: 2px; background: var(--line); }
.logi-journey.cancelled { padding: 10px 12px; border: 1px solid #f1c7c7; border-radius: 10px; background: #fff5f5; }
.logi-journey.cancelled::before { display: none; }
.logi-step { position: relative; flex: 1 1 0; min-width: 84px; display: flex; flex-direction: column; align-items: center; gap: 7px; text-align: center; }
.logi-dot { position: relative; z-index: 1; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--line); color: var(--muted); font-size: 9px; font-weight: 700; }
.logi-dot i { font-style: normal; }
.logi-label { font-size: 10.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.logi-step.done .logi-dot { background: var(--appx-accent); border-color: var(--appx-accent); color: #fff; }
.logi-step.done .logi-label { color: var(--ink-2); }
.logi-step.current .logi-dot { background: #fff; border-color: var(--appx-accent); color: var(--appx-accent); box-shadow: 0 0 0 3px var(--appx-accent-soft); }
.logi-step.current .logi-label { color: var(--appx-accent); font-weight: 700; }

.logi-timeline { list-style: none; margin: 0; padding: 4px 0; display: grid; gap: 2px; }
.logi-event { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px; position: relative; padding: 6px 0; }
.logi-event::before { content: ''; position: absolute; top: 32px; bottom: -6px; inset-inline-start: 12px; width: 1px; background: var(--line); }
.logi-event:last-child::before { display: none; }
.le-dot { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); }
.logi-event.warning .le-dot { background: #fff5e6; color: #b45309; }
.logi-event.critical .le-dot { background: #fdecec; color: #b91c1c; }
.le-body { min-width: 0; padding-top: 1px; }
.le-title { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.le-text { font-size: 11.5px; color: var(--muted); margin-top: 2px; line-height: 1.6; }
.le-meta { font-size: 10px; color: var(--muted); margin-top: 3px; }

.logi-alerts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; margin-top: 14px; }
.logi-alert { display: flex; align-items: center; gap: 8px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink-2); text-decoration: none; font-size: 11.5px; }
.logi-alert:hover { border-color: var(--appx-accent); }
.logi-alert .la-icon { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); flex: 0 0 auto; }
.logi-alert .la-text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logi-alert .la-count { min-width: 22px; height: 20px; padding: 0 6px; border-radius: 99px; display: inline-grid; place-items: center; background: var(--surface-3); font-weight: 700; font-size: 10.5px; }
.logi-alert.critical { border-color: #f1c7c7; background: #fff8f8; }
.logi-alert.critical .la-icon { background: #fdecec; color: #b91c1c; }
.logi-alert.warning { border-color: #f3ddb5; background: #fffaf0; }
.logi-alert.warning .la-icon { background: #fdeccb; color: #b45309; }

.logi-cols { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 12px; margin-top: 14px; }
.logi-cols.ops-wide { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.5fr); }
.logi-cols > .card { margin: 0; }

.logi-list { display: grid; gap: 1px; }
.logi-list-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 14px; text-decoration: none; color: var(--ink-2); border-bottom: 1px solid var(--line); }
.logi-list-row:last-child { border-bottom: 0; }
.logi-list-row:hover { background: var(--surface-3); }
.logi-list-row .lr-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.logi-list-row .lr-side { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; }

.logi-queue { display: flex; align-items: center; gap: 9px; padding: 8px 2px; text-decoration: none; color: var(--ink-2); border-bottom: 1px dashed var(--line); }
.logi-queue:last-child { border-bottom: 0; }
.logi-queue:hover .lq-label { color: var(--appx-accent); }
.lq-icon { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--appx-accent-soft); color: var(--appx-accent); flex: 0 0 auto; }
.lq-label { flex: 1 1 auto; font-size: 11.5px; font-weight: 600; }
.lq-count { min-width: 22px; height: 20px; padding: 0 6px; border-radius: 99px; display: inline-grid; place-items: center; background: var(--surface-3); font-size: 10.5px; font-weight: 700; }

.logi-stage-log { list-style: none; margin: 0; padding: 2px 0; display: grid; gap: 0; }
.logi-stage-log li { position: relative; display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 9px; padding: 6px 0; font-size: 11.5px; color: var(--muted); }
.logi-stage-log .sl-dot { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); }
.logi-stage-log strong { color: var(--ink-2); font-weight: 600; }

.logi-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 9px; }
.logi-photo { margin: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.logi-photo .lp-icon { height: 72px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); }
.logi-photo figcaption { display: flex; flex-direction: column; gap: 3px; padding: 8px 9px; font-size: 10.5px; }

.detail-grid { display: grid; grid-template-columns: minmax(96px, auto) minmax(0, 1fr); gap: 7px 12px; margin: 0; font-size: 11.5px; }
.detail-grid dt { color: var(--muted); font-weight: 500; }
.detail-grid dd { margin: 0; color: var(--ink-2); font-weight: 600; }

.logi-actions { display: flex; flex-direction: column; gap: 7px; align-items: flex-start; }
.logi-actions .btn { justify-content: flex-start; }

.error-text { color: #b91c1c; font-size: 11.5px; font-weight: 600; }
.ok-text { color: #15803d; }

@media (max-width: 900px) {
  .logi-cols { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .logi-step { min-width: 74px; }
  .logi-label { font-size: 9.5px; }
  .logi-journey { overflow-x: auto; padding-bottom: 4px; }
}
