/* ============================================================
   ATLAS LOGISTICS - platform chrome (shared components)
   Loaded AFTER style.css on every page. Only NEW components live
   here - nothing in this file restyles existing page content.
   Reuses the :root tokens defined in style.css (--bg, --panel,
   --line, --steel, --ink, --cyan, --green, --red, --mono, --sans,
   --ease). Palette + type scale match the base sheet exactly.
   ============================================================ */

/* ---------- header additions: platform nav items + RFQ badge ---------- */

/* Defensive: a button carrying a .btn-style class sets an explicit
   `display`, which (as an author rule) overrides the UA `[hidden]`
   rule - so `hidden` buttons stay visible/clickable. Force them
   hidden. Scoped to buttons so the intentional `.tabpanel[hidden]`
   mobile-accordion override (higher specificity) is untouched. */
button[hidden] { display: none !important; }

/* A small pill link (Portal / RFQ) that sits inside the nav list.
   Uses the same mono/uppercase treatment as .nav-link so it reads
   as part of the existing header, not a bolt-on. */
.nav-cta {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; margin-left: 4px;
  font: 500 12px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase;
  color: var(--cyan);
  border: 1px solid var(--line);
  background: transparent;
  transition: border-color 150ms var(--ease), color 150ms var(--ease), background 150ms var(--ease);
}
.nav-cta:hover { border-color: var(--cyan); color: var(--cyan); background: rgba(34, 211, 238, .06); }
.nav-cta[aria-current="page"] { border-color: var(--cyan); color: var(--cyan); }

.rfq-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  font: 500 11px/1 var(--mono); letter-spacing: 0;
  color: #06202A; background: var(--cyan);
  border-radius: 9px;
}
.rfq-badge[hidden] { display: none; }

/* On mobile the nav collapses (style.css @940px). Keep the two new
   CTAs full-width and reachable inside the open panel; the badge
   stays visible beside its label. */
@media (max-width: 940px) {
  .js .nav-list .nav-cta {
    margin-left: 0; width: 100%;
    justify-content: flex-start;
    padding: 12px 4px; border: 0;
    border-bottom: 1px solid var(--line);
  }
  .js .nav-list .nav-cta:hover { background: transparent; }
}

/* ---------- KPI tiles (portal dashboard) ---------- */

.kpi-grid {
  display: grid; gap: 1px; background: var(--line);
  border: 1px solid var(--line);
  grid-template-columns: 1fr;
}
@media (min-width: 520px) { .kpi-grid.k-2, .kpi-grid.k-3, .kpi-grid.k-4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 860px) {
  .kpi-grid.k-3 { grid-template-columns: repeat(3, 1fr); }
  .kpi-grid.k-4 { grid-template-columns: repeat(4, 1fr); }
}
.kpi {
  background: var(--panel); padding: 16px; min-width: 0;
  display: flex; flex-direction: column; gap: 6px;
}
.kpi .lbl { margin: 0; }
.kpi b {
  font: 500 clamp(20px, 2.6vw, 26px)/1.15 var(--mono);
  color: var(--ink); font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.kpi b.data { color: var(--cyan); }
.kpi b.ok { color: var(--green); }
.kpi .sub { font: 400 12px/1.5 var(--mono); color: var(--steel); }

/* ---------- tabs ---------- */

.tabs { border: 1px solid var(--line); }
.tablist {
  display: flex; flex-wrap: wrap; gap: 0;
  background: var(--panel-deep); border-bottom: 1px solid var(--line);
}
.tab {
  appearance: none; background: none; border: 0; cursor: pointer;
  padding: 12px 16px; border-right: 1px solid var(--line);
  font: 500 11px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase;
  color: var(--steel);
  transition: color 150ms var(--ease), box-shadow 150ms var(--ease);
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--cyan); box-shadow: inset 0 -2px 0 var(--cyan); }
.tabpanel { padding: 22px 16px; }
@media (min-width: 720px) { .tabpanel { padding: 28px 22px; } }
.tabpanel[hidden] { display: none; }

/* ---------- pills / chips ---------- */

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  font: 500 11px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase;
  color: var(--steel); border: 1px solid var(--line); background: transparent;
}
.pill.is-cyan { color: var(--cyan); border-color: var(--cyan); }
.pill.is-green { color: var(--green); border-color: var(--green); }
.pill.is-red { color: var(--red); border-color: var(--red); }

.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 6px 6px 12px;
  font: 500 11px/1 var(--mono); letter-spacing: .08em;
  color: var(--ink); border: 1px solid var(--line); background: var(--panel-deep);
}
.chip .chip-x {
  appearance: none; border: 0; cursor: pointer;
  width: 22px; height: 22px; line-height: 1;
  color: var(--steel); background: transparent;
  font: 500 14px/1 var(--mono);
  transition: color 150ms var(--ease);
}
.chip .chip-x:hover { color: var(--red); }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- reusable horizontal-scroll wrapper for wide widgets/tables ---------- */

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll > table { min-width: 560px; }

/* ---------- toast ---------- */

.atlas-toast-host {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px;
  width: max-content; max-width: calc(100vw - 32px); pointer-events: none;
}
.atlas-toast {
  pointer-events: auto;
  background: var(--panel); color: var(--ink);
  border: 1px solid var(--cyan);
  padding: 12px 16px;
  font: 500 12px/1.5 var(--mono); letter-spacing: .04em;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .45);
  opacity: 0; transform: translateY(8px);
  transition: opacity 220ms var(--ease), transform 220ms var(--ease);
}
.atlas-toast.show { opacity: 1; transform: none; }

/* ---------- helpers used across platform pages ---------- */

.empty-state {
  border: 1px dashed var(--line); padding: 28px 20px; text-align: center;
  color: var(--steel); font: 400 13px/1.6 var(--mono);
}
.result-live[aria-busy="true"] { opacity: .6; }

/* small utility echoing style.css tone, for platform pages only */
.muted { color: var(--steel); }
.hairline { border-top: 1px solid var(--line); margin-block: 20px; }

/* ---------- motion discipline (mirror base sheet; no rAF here) ---------- */

@media (prefers-reduced-motion: reduce) {
  .nav-cta, .tab, .chip .chip-x, .atlas-toast {
    transition-duration: 0.01ms !important;
  }
  .atlas-toast { opacity: 1; transform: none; }
}

/* ---------- print ---------- */

@media print {
  .site-head, .ticker, .nav, .nav-cta, .atlas-toast-host,
  .site-foot, .skip-link, .btn-row, .tablist { display: none !important; }
  body { background: #fff; color: #000; }
  .module, .kpi-grid, .tabs, .board { border-color: #999; }
  .tabpanel[hidden] { display: block !important; }
  a[href]::after { content: ""; }
}
