/* Inventory dashboard layout: left sidebar, summary strip with a stock bar,
   labeled filter row, clean table with row actions. Builds on inventory.css
   (palette, table, gauge, drawer) and auth.css (buttons, session). */

.dash { max-width: 1400px; width: 100%; padding: 20px 28px 48px; }
.dash-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 16px; margin-bottom: 16px; }
.dash-head h1 { margin: 0; font: 700 28px/1.2 var(--font-head); }
.dash-sub { margin: 0; font-size: 13px; color: var(--muted); }

/* ---------- Summary strip ---------- */
.dash-summary {
  background: var(--sand); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 4px 4px 14px; margin-bottom: 18px;
}
.dash-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.dash-stats .tally { border-radius: 6px; padding: 12px 14px 8px; }
.dash-stats .tally[aria-pressed="true"] { box-shadow: inset 0 -3px 0 var(--channel); }
.dash-stats .tally-low[aria-pressed="true"] { box-shadow: inset 0 -3px 0 var(--low-fill); }
.dash-stats .tally-out[aria-pressed="true"] { box-shadow: inset 0 -3px 0 var(--out); }
.tally-sync .tally-num { font-size: 22px; line-height: 1.4; }
.tally-sync .sync-note { color: var(--muted); font-size: 12px; }
.tally-sync .sync-note.warn { color: var(--low); }
.tally-sync .sync-retry {
  margin-top: 4px; padding: 2px 10px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--sand); color: var(--channel); font-size: 12px; cursor: pointer;
}

.stockbar { display: flex; gap: 3px; height: 26px; margin: 10px 14px 0; }
.stockbar-seg {
  flex: 0 1 0; min-width: 34px; border: 0; border-radius: 4px; cursor: pointer;
  color: #fff; font: 700 12px/26px var(--font); text-align: left; padding: 0 8px;
  transition: filter .15s, box-shadow .15s;
}
.stockbar-seg:hover { filter: brightness(1.08); }
.stockbar-seg[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--sand), 0 0 0 4px var(--laguna); }
.seg-ok  { background: var(--channel); }
.seg-low { background: var(--low-fill); color: #3b2500; }
.seg-out { background: var(--out); }
.stockbar-key { display: flex; gap: 16px; margin: 8px 14px 0; font-size: 12px; color: var(--muted); }
.stockbar-key i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.key-ok { background: var(--channel); }
.key-low { background: var(--low-fill); }
.key-out { background: var(--out); }

/* ---------- Filter row ---------- */
.dash-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; margin-bottom: 10px; }
.dash-field { display: flex; flex-direction: column; gap: 4px; }
.dash-field > label { font-size: 13px; color: var(--muted); }
.dash-field select {
  height: 42px; min-width: 170px; padding: 0 10px;
  background: var(--sand); border: 1px solid var(--line); border-radius: var(--radius);
}
.dash-field select:focus { border-color: var(--channel); }
.dash-field-search { flex: 1 1 300px; max-width: 440px; }
.dash-field-search .search { max-width: none; flex: none; } /* .search is a flex item elsewhere; here its column would stretch */
.dash-clear { margin-bottom: 11px; }
.dash-actions { margin-left: auto; display: flex; gap: 8px; }
.btn-quiet-sm {
  height: 42px; padding: 0 16px; border: 1px solid var(--channel); border-radius: var(--radius);
  background: var(--sand); color: var(--channel); font-weight: 600; cursor: pointer;
}
.btn-quiet-sm:hover { background: var(--shallows); }
.dash .result-count { margin: 0 0 8px; }

/* ---------- Table ---------- */
.dash .inv td { vertical-align: middle; }
.inv .col-actions { text-align: right; white-space: nowrap; width: 1%; padding-left: 8px; }
.dash .gauge { min-width: 170px; }
.row-act {
  border: 0; background: none; padding: 4px 2px; cursor: pointer;
  color: var(--channel); font-weight: 600;
}
.row-act:hover { text-decoration: underline; }
.row-sep { color: var(--line); margin: 0 6px; }

/* ---------- Smaller screens ---------- */
/* With the sidebar, laptop screens can't fit every column: UPC goes first
   (still searchable, scannable, in the item panel and the CSV export). */
@media (max-width: 1480px) {
  .dash .inv th:nth-child(3), .dash .inv td:nth-child(3) { display: none; }
}
@media (max-width: 1100px) {
  .dash-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .dash { padding: 16px 16px 40px; }
}
@media (max-width: 600px) {
  .dash-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tally-sync { grid-column: 1 / -1; }
  .dash-field, .dash-field-search { flex: 1 1 100%; max-width: none; }
  .dash-field select { width: 100%; }
  .dash-actions { margin-left: 0; width: 100%; }
  .btn-quiet-sm { flex: 1; }
}

/* ---------- Admin catalog tools (INV-6) ---------- */
.dash-check { display: flex; align-items: center; gap: 6px; margin-bottom: 11px; font-size: 14px; color: var(--muted); cursor: pointer; }
.inv tr.is-inactive td { color: #8a9a9d; background: #f6f7f7; }
.inv tr.is-inactive .prod-name::after { content: " (off)"; font-weight: 400; }
.details-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.details-grid .span-2 { grid-column: 1 / -1; }
.details-grid input { width: 100%; min-width: 0; }
.details-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.details-actions .btn-primary { margin-top: 0; }
.edits-head { margin: 14px 0 4px; font-size: 13px; color: var(--muted); font-weight: 600; }
.edits { list-style: none; margin: 0; padding: 0; font-size: 13px; color: var(--muted); }
.edits li { padding: 4px 0; border-top: 1px solid #e6eeec; }
.edits li strong { color: var(--laguna); font-weight: 600; }
dialog.modal.add-dialog { width: min(560px, calc(100vw - 32px)); }
.add-hint { margin: 0; font-size: 13px; }
@media (max-width: 560px) {
  .details-grid { grid-template-columns: 1fr; }
  .add-dialog .form-actions { flex-direction: column-reverse; align-items: stretch; }
}
