/* ============================================================
   PepRecon Vial Inventory

   Built on the shared primitives (.calc-shell, .calc-card, .field,
   .field-row, .btn, .btn-row). The reference-section styling comes from
   shared.css and must NOT be copied here; see scripts/check_reference_css.py.
   ============================================================ */

/* Wider than a single calculator: the vial cards read two-up on a desktop. */
.calc-shell--inventory {
  max-width: 900px;
}

.inv-intro {
  margin: 14px 0 0;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Stacked cards are spaced 18px across the tools. */
.inv-next,
.inv-list-wrap,
.inv-form-card,
.inv-data {
  margin-top: 18px;
}

.inv-h {
  margin: 0 0 12px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

/* ---------- The recommendation ----------
   The single most useful output on the page, so it leads and is the only
   accent-bordered block. */
.inv-next {
  border-left: 3px solid var(--accent);
}

.inv-next h2 {
  margin: 0 0 8px;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-ink);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.inv-next__name {
  margin: 0 0 6px;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
}

.inv-next__why {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text-muted);
}

/* ---------- Vial cards ---------- */
.inv-list {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  align-items: start;
}

.inv-empty {
  margin: 0;
  padding: 20px;
  background: var(--bg-elevated);
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.inv-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

/* Status is carried by the left edge as well as the chip, so the list can be
   scanned without reading every chip. */
.inv-card--soon    { border-left-color: var(--accent); }
.inv-card--expired { border-left-color: var(--danger); }
.inv-card--empty   { border-left-color: var(--border); opacity: 0.72; }
.inv-card--open    { border-left-color: var(--success); }

.inv-card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.inv-card__name {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  min-width: 0;
  overflow-wrap: anywhere;
}

.inv-chip {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text-muted);
  background: var(--bg-subtle);
}
.inv-chip--open    { color: var(--success); border-color: var(--success); background: var(--success-soft); }
.inv-chip--soon    { color: var(--accent-ink); border-color: var(--accent); background: var(--accent-soft); }
.inv-chip--expired { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }

.inv-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 9px;
  overflow: hidden;
}

.inv-fact {
  padding: 8px 10px;
  background: var(--bg-subtle);
  min-width: 0;
}

.inv-fact__k {
  display: block;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.64rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 2px;
}

.inv-fact__v {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
}

.inv-warn {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-left: 3px solid var(--danger);
  border-radius: 0 8px 8px 0;
  background: var(--danger-soft);
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text);
}

.inv-notes {
  margin: 12px 0 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.inv-card__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

/* ---------- Form ---------- */
.inv-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0 16px;
}

.inv-form-grid__wide { grid-column: 1 / -1; }

.inv-form-card h2,
.inv-data h2 {
  margin: 0 0 14px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

/* ---------- Data controls ---------- */
.inv-data__note {
  margin: 0 0 14px;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--text-muted);
}

/* A file input styled as a button; the input itself is hidden. */
.inv-import {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.inv-status {
  margin: 12px 0 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.inv-status--error { color: var(--danger); }

@media (max-width: 720px) {
  .calc-shell--inventory { padding: 0 16px; }
  .inv-list { grid-template-columns: 1fr; }
  .inv-form-grid { grid-template-columns: 1fr; }
}

@media print {
  .inv-card__actions,
  .inv-form-card,
  .inv-data { display: none; }
  .inv-list { grid-template-columns: 1fr 1fr; }
  .inv-card { break-inside: avoid; box-shadow: none; }
}
