/* Stock: godowns, stacks (khamal), items and the ledger.
   Builds on app.css; only what the stock pages need on top. */

.stock-code { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; padding: 1px 8px; border-radius: 6px; background: var(--btn-bg, var(--ink)); color: var(--btn-ink, #FFFFFF); font-family: var(--mono); font-weight: 600; font-size: 13px; letter-spacing: .02em; }
.stock-unit { font-size: 15px; font-weight: 600; color: var(--muted); }
.stock-kpi-icon { width: 16px; height: 16px; vertical-align: -3px; margin-right: 6px; color: var(--accent); }
.stock-legal .kpi-sub { flex: none; }
.stock-head-right { display: inline-flex; align-items: center; gap: 8px; }

/* Breadcrumbs */
.stock-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; }
.stock-crumbs a { text-decoration: none; }
.stock-crumbs a:hover { text-decoration: underline; }

/* Godown cards on the overview */
.stock-godowns { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.stock-godown-card { display: flex; flex-direction: column; gap: 8px; padding: 16px; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius); background: var(--glass, #FFFFFF); color: var(--ink); text-decoration: none; transition: box-shadow .15s, border-color .15s; }
.stock-godown-card:hover { border-color: #B9C9E6; box-shadow: var(--shadow-hover); color: var(--ink); }
.stock-godown-card.is-off { border-left-color: var(--line-strong); opacity: .75; }
.stock-godown-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stock-godown-figure { font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums; }
.stock-godown-figure strong { font-size: 22px; color: var(--ink); }

/* Stack cards on the godown page */
.stock-stack-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.stock-stack { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--glass, #FFFFFF); box-shadow: var(--shadow); }
.stock-stack.is-empty { background: var(--sunk); box-shadow: none; border-style: dashed; }
.stock-stack.is-loose { border-left: 4px solid var(--gold); }
.stock-stack-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.stock-stack-code { font-family: var(--mono); font-weight: 700; font-size: 17px; letter-spacing: .03em; }
.stock-stack.is-loose .stock-stack-code { font-family: var(--font); font-size: 15px; }
.stock-stack-lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.stock-stack-lines li { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.stock-stack-lines a { font-weight: 600; text-decoration: none; }
.stock-stack-lines .num { color: var(--ink-2); }
.stock-stack-foot { margin-top: auto; padding-top: 4px; border-top: 1px solid var(--sunk); }

/* Ledger */
.stock-qty { font-weight: 600; white-space: nowrap; }
.stock-qty.is-in { color: var(--ok); }
.stock-qty.is-out { color: var(--bad); }
.stock-row-empty td { color: var(--muted); }
.stock-filters .form-grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.stock-pager { display: flex; justify-content: center; align-items: center; gap: 12px; padding-top: 14px; }

/* Movement form */
.stock-type-switch { flex-wrap: wrap; }
.stock-type-switch a.seg { display: inline-flex; align-items: center; text-decoration: none; }
.stock-type-switch a.seg.is-on { background: var(--glass, #FFFFFF); color: var(--ink); box-shadow: var(--shadow); }
.stock-mon-box { justify-content: flex-start; }
.stock-mon { display: flex; align-items: center; min-height: 42px; padding: 0 12px; border-radius: 10px; background: var(--sunk); font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
[data-code-input] { font-family: var(--mono); font-weight: 600; text-transform: uppercase; }

/* Count approval */
.stock-decide { display: flex; flex-direction: column; gap: 6px; min-width: 210px; }
.stock-decide input { min-height: 34px; padding: 4px 10px; border: 1px solid var(--line-strong); border-radius: 8px; font: inherit; font-size: 13px; }
.stock-decide-buttons { display: flex; gap: 6px; }

@media (max-width: 640px) {
  .stock-stack-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .stock-godown-figure strong { font-size: 19px; }
}

/* Five figures on the overview sit in one row on wide screens */
.stock-kpis { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.stock-stack, .stock-godown-card { -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.stock-decide input { background: var(--glass-soft, transparent); color: var(--ink); }

/* ---------- Pictures first (StockVisuals): hero panel, silos, map, codes ---------- */
.stock-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 18px 26px; align-items: start; }
.stock-hero-rings { display: flex; flex-wrap: wrap; gap: 16px 22px; align-items: flex-start; }
.stock-hero-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px; flex: 1 1 300px; min-width: 0; align-content: start; }
.stock-hero-bars { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.stock-hero-bars .pill { align-self: flex-start; }
.stock-silos { align-items: end; }
.stock-item-code, .stock-slip-code { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.stock-codeblock { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px; border-radius: 10px; background: #FFFFFF; color: #1D1D1F; }
.stock-codeblock .stock-qr { width: 88px; height: 88px; image-rendering: pixelated; }
.stock-codeblock .stock-barcode { max-width: 100%; height: auto; }
.stock-code-search { max-width: 560px; }
.stock-code-search input { font-family: var(--mono); font-weight: 600; }
.stock-scan-hint { margin: 0; }
.stock-stack-foot { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.stock-stack-foot .mono { margin-left: auto; }
.stock-stack:target { outline: 3px solid var(--accent); outline-offset: 2px; }
select.scan-filled { animation: scan-filled 1s ease-out; }

/* Label sheets */
.stock-label-kinds { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.stock-label-godowns { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-left: 10px; }
.stock-label { text-align: center; }
.stock-label .stock-codeblock { flex-direction: column; padding: 0; background: transparent; }
.stock-label .stock-qr { width: 130px; height: 130px; }
.stock-label-kind { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #6E6E73; }
.stock-label-big { font-family: var(--mono); font-size: 34px; font-weight: 800; line-height: 1.05; letter-spacing: .02em; }
.stock-label-name { font-size: 16px; font-weight: 700; }
.stock-item-sheet { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.stock-item-sheet .stock-qr { width: 100px; height: 100px; }

@media (max-width: 1180px) {
  .stock-hero { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 480px) {
  .stock-hero-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stock-codeblock .stock-qr { width: 72px; height: 72px; }
  .stock-label-godowns { margin-left: 0; }
}
@media print {
  .stock-hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); break-inside: avoid; }
  .stock-label-sheet { gap: 8px; }
  .stock-label { box-shadow: none; border: 1px solid #C7C7CC; }
}
