/*
 * The cross-site stock board. Colours, radii and spacing all come from the
 * token layer at the top of styles.css; nothing is defined here.
 *
 * Shapes stay square-cornered on purpose. Every chip in this file uses --r-sm,
 * never a pill, because the matrix is dense and pills turn it into confetti.
 */

/* ─────────────────────────────────── tabs ──────────────────────────────── */

.inv-tabs {
  display: flex; gap: 3px;
  margin-bottom: var(--s4);
  padding: 3px;
  overflow-x: auto;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  scrollbar-width: none;
}
.inv-tabs::-webkit-scrollbar { display: none; }
.inv-tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 13px;
  font: 600 14px/1 var(--font);
  color: var(--muted); background: transparent;
  border: 0; border-radius: var(--r-sm);
  white-space: nowrap; cursor: pointer;
}
.inv-tab:hover { color: var(--text); }
.inv-tab.is-on { color: var(--text); background: var(--surface); box-shadow: var(--shadow-sm); }
.inv-dot {
  min-width: 18px; padding: 1px 5px;
  font: 700 10.5px/1.6 var(--font); font-style: normal;
  color: var(--warn-text); background: var(--warn-bg);
  border: 1px solid var(--warn-line); border-radius: var(--r-sm);
}

/* ─────────────────────────────────── kpis ──────────────────────────────── */

.inv-kpis {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  margin-bottom: var(--s4);
  background: var(--line); border: 1px solid var(--line); border-radius: var(--r-md);
  overflow: hidden;
}
.inv-kpi { display: grid; gap: 2px; padding: 12px 12px; background: var(--surface); }
.inv-kpi b {
  font-size: 22px; font-weight: 750; letter-spacing: -0.02em; line-height: 1.1;
  font-family: var(--font-num); color: var(--text);
}
.inv-kpi span { font-size: 12.5px; color: var(--muted); }
.inv-kpi.is-low { background: var(--warn-bg); }
.inv-kpi.is-low b, .inv-kpi.is-low span { color: var(--warn-text); }
.inv-kpi.is-move { background: var(--accent-soft); }
.inv-kpi.is-move b, .inv-kpi.is-move span { color: var(--accent); }

/* ───────────────────── the transfer panel (the headline) ───────────────── */

.inv-moves {
  margin-bottom: var(--s4); padding: 14px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--r-md);
}
.inv-moves-head { margin-bottom: 10px; }
.inv-moves-head h3 { margin: 0; font-size: 15.5px; font-weight: 650; color: var(--accent); }
.inv-moves-head p { margin: 3px 0 0; font-size: 13px; color: var(--muted); }

.inv-move {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center; gap: 12px;
  padding: 10px 12px; margin-top: 6px;
  background: var(--surface);
  border: 1px solid var(--accent-line);
  border-radius: var(--r-md);
}
.inv-move-qty {
  display: grid; place-items: center;
  min-width: 36px; height: 36px; padding: 0 8px;
  font-size: 16px; font-weight: 700; font-family: var(--font-num);
  color: var(--accent-text); background: var(--accent);
  border-radius: var(--r-sm);
}
.inv-move-what { min-width: 0; display: grid; gap: 3px; }
.inv-move-what b { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-move-what b small { font-weight: 500; color: var(--muted); }
.inv-move-what > small {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--muted);
}
.inv-move-what strong { color: var(--text-2); font-weight: 600; }
.inv-move-what svg { width: 14px; height: 14px; color: var(--accent); }
.inv-tag {
  padding: 1px 6px;
  font-size: 10.5px; font-weight: 700; font-style: normal;
  color: var(--accent); background: var(--accent-soft);
  border: 1px solid var(--accent-line); border-radius: var(--r-sm);
}

/* ────────────────────────────── the matrix ─────────────────────────────── */

/* The table scrolls inside this box, never the page. A wide portfolio must
   not push the whole layout sideways on a phone. */
.inv-scroll {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

.inv-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.inv-table th, .inv-table td { text-align: left; }

.inv-table thead th {
  position: sticky; top: 0; z-index: 2;
  padding: 8px 12px;
  font-size: 10.5px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.inv-table thead th.inv-sticky { z-index: 3; }
.inv-col { text-align: center !important; }
.inv-col-status { text-align: right !important; }

/* The item name stays put while the site columns scroll under it. */
.inv-sticky {
  position: sticky; left: 0; z-index: 1;
  min-width: 180px; max-width: 260px;
  padding: 10px 12px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.inv-row .inv-sticky { font-weight: 400; }
.inv-row .inv-sticky b {
  display: block; font-weight: 600; font-size: 14.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.inv-row .inv-sticky small { font-size: 12.5px; color: var(--muted); }

.inv-row td { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.inv-row .inv-sticky { border-bottom: 1px solid var(--line); }
.inv-row:last-child td, .inv-row:last-child .inv-sticky { border-bottom: 0; }
.inv-row.is-buy .inv-sticky { box-shadow: inset 3px 0 0 var(--warn-line); }
.inv-row.is-covered .inv-sticky { box-shadow: inset 3px 0 0 var(--accent); }

.inv-cell { text-align: center; white-space: nowrap; }
.inv-cell.is-absent { color: var(--faint); }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.inv-qty { font-weight: 700; font-size: 14.5px; }
.inv-par { font-size: 12.5px; color: var(--muted); margin-left: 2px; }
.inv-flag {
  display: inline-block; margin-left: 6px; padding: 1px 5px;
  font-size: 10.5px; font-weight: 700; font-style: normal;
  color: var(--warn-text); background: var(--warn-bg);
  border: 1px solid var(--warn-line); border-radius: var(--r-sm);
}
.inv-flag.is-spare { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line); }
.inv-cell.is-short { background: var(--warn-bg); }
.inv-cell.is-spare { background: var(--accent-soft); }
.inv-total { border-left: 1px solid var(--line); }
.inv-status { text-align: right; }

.inv-state {
  display: inline-block; margin-left: 5px; padding: 3px 8px;
  font-size: 11.5px; font-weight: 700; border-radius: var(--r-sm); white-space: nowrap;
}
.inv-state.is-ok { color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); }
.inv-state.is-buy { color: var(--warn-text); background: var(--warn-bg); border: 1px solid var(--warn-line); }
.inv-state.is-move { color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent-line); }

.inv-legend {
  display: flex; flex-wrap: wrap; gap: 16px;
  margin: 10px 0 0; padding: 0 2px;
  font-size: 12.5px; color: var(--muted);
}
.inv-legend span { display: inline-flex; align-items: center; gap: 6px; }
.key {
  width: 11px; height: 11px; border-radius: var(--r-sm); display: inline-block;
  background: var(--warn-bg); border: 1px solid var(--warn-line);
}
.key.is-spare { background: var(--accent-soft); border-color: var(--accent-line); }

/* ───────────────────────── one site's shelf ────────────────────────────── */

.inv-group { margin-bottom: var(--s4); }
.inv-group-head {
  margin: 0 0 8px;
  font-size: 10.5px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
}
.inv-group-head.is-short { color: var(--warn-text); }

.inv-line {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center; gap: 12px;
  padding: 10px 12px; margin-bottom: 6px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.inv-line.is-short { background: var(--warn-bg); border-color: var(--warn-line); }
.inv-line-main { min-width: 0; display: grid; gap: 3px; }
.inv-line-main b { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-line-main b small { font-weight: 500; color: var(--muted); }
.inv-line-main > small { font-size: 12.5px; color: var(--muted); }
.inv-line.is-short .inv-line-main > small { color: var(--warn-text); }
.inv-spare-note { color: var(--accent); font-weight: 600; }
.inv-source { margin-top: 2px; font-size: 12.5px; color: var(--accent); }
.inv-source strong { font-weight: 700; }
.inv-need { font-size: 16px; font-weight: 700; color: var(--warn-text); }
.inv-allgood {
  margin: 0 0 var(--s4); padding: 18px;
  font-size: 14px; color: var(--accent); text-align: center;
  background: var(--accent-soft); border: 1px solid var(--accent-line);
  border-radius: var(--r-md);
}
.inv-empty { padding: 36px 16px; text-align: center; color: var(--muted); font-size: 14px; }

/* ─────────────────────────────────── phone ─────────────────────────────── */

@media (max-width: 720px) {
  .inv-kpis { grid-template-columns: 1fr 1fr; }
  .inv-sticky { min-width: 150px; }
  .inv-move { grid-template-columns: auto minmax(0, 1fr); row-gap: 10px; }
  .inv-move .btn { grid-column: 1 / -1; justify-content: center; }
  .inv-line { grid-template-columns: minmax(0, 1fr) auto; }
  .inv-line .btn { grid-column: 1 / -1; justify-content: center; }
}
