:root {
  color-scheme: light;
  --ink: #16201c;
  --muted: #64706a;
  --line: #d9e0dc;
  --panel: #ffffff;
  --page: #f3f6f4;
  --teal: #0f766e;
  --teal-dark: #115e59;
  --amber: #b7791f;
  --rose: #be123c;
  --blue: #2563eb;
  --shadow: 0 12px 30px rgba(19, 32, 28, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.owner-value-field[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 38px;
  border: 1px solid var(--teal);
  border-radius: 6px;
  background: var(--teal);
  color: #fff;
  padding: 0 14px;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: var(--teal-dark);
}

button:disabled {
  border-color: #b8c4be;
  background: #dce4df;
  color: #718078;
  cursor: not-allowed;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

input,
select {
  height: 40px;
  padding: 0 10px;
}

#itemForm input[readonly] {
  background: #eef3f0;
  color: #50605a;
  cursor: not-allowed;
}

.locked-field {
  color: #5b6a64;
}

textarea {
  min-height: 156px;
  resize: vertical;
  padding: 12px;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
}

label {
  display: grid;
  gap: 6px;
  color: #37433e;
  font-size: 13px;
  font-weight: 700;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

body.login-active {
  overflow: hidden;
}

body.login-active .mobile-shellbar,
body.login-active .app-shell {
  filter: blur(2px);
  pointer-events: none;
  user-select: none;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: rgba(12, 24, 20, 0.62);
  padding: 20px;
}

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 20px;
}

.login-brand {
  margin-bottom: 4px;
  color: var(--ink);
}

.login-brand p {
  color: var(--muted);
}

.login-error {
  min-height: 18px;
  margin: 0;
  color: var(--rose);
  font-size: 13px;
  font-weight: 800;
}

.login-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.mobile-shellbar,
.nav-scrim {
  display: none;
}

.mobile-menu-button {
  width: 42px;
  height: 42px;
  min-height: 42px;
  display: grid;
  place-content: center;
  gap: 5px;
  padding: 0;
  border-color: #24463f;
  background: #14231f;
}

.mobile-menu-button span {
  width: 18px;
  height: 2px;
  display: block;
  border-radius: 999px;
  background: #fff;
  transition: transform 160ms ease, opacity 160ms ease;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: #14231f;
  color: #f7fbf8;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #dceee9;
  color: #123a35;
  font-weight: 900;
}

.brand h1 {
  margin: 0;
  font-size: 17px;
}

.brand p {
  margin: 3px 0 0;
  color: #b7c9c3;
  font-size: 13px;
}

nav {
  display: grid;
  gap: 4px;
}

nav a {
  color: #d9e8e2;
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 6px;
}

nav a.active,
nav a:hover {
  background: #203d36;
  color: #fff;
}

.role-panel {
  margin-top: auto;
  display: grid;
  gap: 8px;
}

.role-panel label {
  color: #d9e8e2;
}

.role-panel button {
  width: 100%;
}

main {
  min-width: 0;
  padding: 24px;
}

.topbar,
.workbench,
.grid-two,
.stocktake-layout,
.stocktake-board,
.reorder-layout,
.purchase-layout,
.receiving-layout,
.return-layout,
.label-scan-layout,
.label-history-layout,
.dashboard-layout,
.reports-layout,
.scope-ledger-layout,
.catalog-grid {
  max-width: 1420px;
  margin: 0 auto 18px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

.topbar h2,
.panel h3,
.activity-panel h3 {
  margin: 0;
}

.topbar h2 {
  font-size: 30px;
  line-height: 1.15;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.status-strip,
.scope-list,
.match-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-strip span,
.scope-list span,
.match-strip button,
.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #34423d;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 800;
}

.match-strip button {
  min-height: 32px;
  cursor: pointer;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(260px, 0.8fr);
  gap: 16px;
}

.scan-panel,
.activity-panel,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.scan-panel,
.activity-panel {
  padding: 18px;
}

.scan-panel label {
  margin-bottom: 10px;
  font-size: 15px;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-bottom: 12px;
}

#globalSearch {
  height: 54px;
  font-size: 18px;
  font-weight: 800;
}

.activity-panel p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.grid-two {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.75fr);
  gap: 16px;
}

.stocktake-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 16px;
}

.reorder-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.55fr);
  gap: 16px;
}

.purchase-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.65fr) minmax(0, 1.35fr);
  gap: 16px;
}

.receiving-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 16px;
}

.return-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(0, 1.05fr);
  gap: 16px;
}

.label-scan-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(340px, 0.8fr);
  gap: 16px;
  align-items: start;
}

.label-history-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.8fr);
  gap: 16px;
  align-items: start;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(340px, 0.75fr);
  gap: 16px;
  align-items: start;
}

.command-panel {
  grid-column: 1 / -1;
}

.reports-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.75fr) minmax(0, 1.25fr);
  gap: 16px;
  align-items: start;
}

.report-infographic-panel {
  grid-column: 1 / -1;
}

.scope-ledger-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.scope-summary-panel {
  grid-column: 1 / -1;
}

.scope-totals {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.scope-totals span,
.scope-status,
.scope-row-id {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #34423d;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 900;
}

.scope-ledger-list {
  display: grid;
  gap: 10px;
}

.scope-ledger-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.scope-ledger-card > div:first-child {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.scope-ledger-card h4,
.scope-ledger-card p,
.scope-ledger-card dl {
  margin: 0;
}

.scope-ledger-card p {
  color: #31403a;
  font-weight: 700;
  line-height: 1.4;
}

.scope-ledger-card dl {
  display: grid;
  gap: 8px;
}

.scope-ledger-card dt {
  color: var(--teal);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.scope-ledger-card dd {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.analytics-panel {
  grid-column: 1 / -1;
}

.panel {
  padding: 18px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  margin-bottom: 16px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.form-grid.compact {
  grid-template-columns: 1fr;
}

.span-2 {
  grid-column: span 2;
}

.scope-list {
  margin-top: 18px;
}

.import-panel {
  max-width: 1420px;
  margin: 0 auto 18px;
}

.preview-summary {
  min-height: 22px;
  margin: 12px 0;
  color: var(--muted);
  font-weight: 700;
}

.catalog-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.75fr);
  gap: 16px;
  align-items: start;
}

.table-shell {
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  background: #fff;
}

.valuation-panel table,
.analytics-panel table {
  min-width: 600px;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  position: sticky;
  top: 0;
  background: #eef4f1;
  color: #3f4d48;
  font-size: 12px;
  text-transform: uppercase;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr.selected {
  background: #eef9f5;
}

.status-ready {
  color: var(--teal);
  font-weight: 900;
}

.status-blocked {
  color: var(--rose);
  font-weight: 900;
}

.status-committed {
  color: var(--blue);
  font-weight: 900;
}

.detail-panel {
  position: sticky;
  top: 18px;
}

.detail-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 18px;
}

.detail-meta div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfdfc;
}

.detail-meta dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-meta dd {
  margin: 4px 0 0;
  font-weight: 900;
}

.movement-list,
.audit-list,
.stocktake-session-list,
.supplier-list,
.purchase-order-list,
.receiving-list,
.vendor-return-list,
.label-job-list,
.scan-event-list,
.dashboard-drilldown-list,
.report-export-list,
.movement-trend-bars {
  display: grid;
  gap: 10px;
}

.movement-card,
.audit-card,
.receiving-card,
.vendor-return-card,
.label-job-card,
.scan-event-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.movement-card strong,
.audit-card strong,
.receiving-card strong,
.vendor-return-card strong,
.label-job-card strong,
.scan-event-card strong {
  display: block;
  margin-bottom: 4px;
  text-transform: capitalize;
}

.movement-card span,
.audit-card span,
.audit-card small,
.receiving-card span,
.receiving-card small,
.vendor-return-card span,
.vendor-return-card small,
.label-job-card span,
.label-job-card small,
.scan-event-card span,
.scan-event-card small {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.audit-card small,
.receiving-card small,
.vendor-return-card small,
.label-job-card small,
.scan-event-card small {
  margin-top: 5px;
  color: #78857f;
}

.stocktake-session {
  width: 100%;
  min-height: 0;
  display: grid;
  gap: 4px;
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
  padding: 11px;
  text-align: left;
}

.stocktake-session:hover,
.stocktake-session.active {
  border-color: var(--teal);
  background: #eef9f5;
  color: var(--ink);
}

.stocktake-session span,
.stocktake-session small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.stocktake-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.stocktake-summary span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fbfdfc;
  color: #34423d;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 800;
}

.scan-count-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(110px, 0.25fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.scan-workflow-grid {
  display: grid;
  grid-template-columns: minmax(120px, 0.5fr) minmax(0, 1fr) minmax(90px, 0.25fr);
  gap: 10px;
  align-items: end;
}

.count-input {
  min-width: 96px;
}

.variance-up {
  color: var(--blue);
  font-weight: 900;
}

.variance-down,
.variance-missing {
  color: var(--rose);
  font-weight: 900;
}

.variance-flat {
  color: var(--teal);
  font-weight: 900;
}

.supplier-card,
.purchase-order-card {
  width: 100%;
  min-height: 0;
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 11px;
  text-align: left;
}

.purchase-order-card {
  cursor: pointer;
}

.purchase-order-card:hover,
.purchase-order-card.active {
  border-color: var(--teal);
  background: #eef9f5;
}

.supplier-card span,
.supplier-card small,
.purchase-order-card span,
.purchase-order-card small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.low-stock-check {
  width: 18px;
  height: 18px;
}

.receive-qty {
  min-width: 92px;
}

.activity-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.activity-columns h4 {
  margin: 0 0 10px;
  font-size: 14px;
}

.vendor-return-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.label-job-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.return-export {
  min-height: 34px;
  padding: 0 10px;
}

.label-download {
  min-height: 34px;
  padding: 0 10px;
}

.label-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  max-height: 420px;
  overflow: auto;
}

.label-preview-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  padding: 10px;
}

.label-preview-card strong,
.label-preview-card span,
.label-preview-card small {
  display: block;
}

.label-preview-card span,
.label-preview-card small {
  color: var(--muted);
  font-size: 12px;
}

.mini-barcode {
  display: flex;
  height: 36px;
  max-width: 100%;
  margin: 9px 0;
  overflow: hidden;
  border: 1px solid #17201c;
  background: #fff;
}

.mini-barcode span {
  display: block;
  height: 100%;
}

.scan-event-unknown {
  border-color: #f3b6c5;
  background: #fff7f9;
}

.command-widget-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.infographic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.infographic-grid-compact {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin: 0 0 14px;
}

.infographic-card {
  display: grid;
  gap: 10px;
  min-height: 136px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.infographic-card h4,
.infographic-card p {
  margin: 0;
}

.infographic-card h4 {
  color: #34423d;
  font-size: 13px;
  font-weight: 900;
}

.infographic-card strong {
  display: block;
  font-size: 24px;
  line-height: 1.1;
}

.infographic-card p,
.infographic-card small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.infographic-muted {
  border-color: #d8c4a2;
  background: #fffaf1;
}

.infographic-bar-set,
.infographic-flow {
  display: grid;
  gap: 8px;
}

.infographic-bar-row {
  display: grid;
  gap: 5px;
}

.infographic-bar-row > span,
.infographic-flow span {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: #34423d;
  font-size: 12px;
  font-weight: 800;
}

.infographic-bar-row em {
  color: var(--muted);
  font-style: normal;
}

.infographic-bar,
.infographic-stack {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eee9;
}

.infographic-stack {
  display: flex;
}

.infographic-fill,
.infographic-segment {
  display: block;
  height: 100%;
}

.infographic-fill.teal,
.infographic-segment.teal {
  background: var(--teal);
}

.infographic-fill.amber,
.infographic-segment.amber {
  background: var(--amber);
}

.infographic-fill.rose,
.infographic-segment.rose {
  background: var(--rose);
}

.infographic-fill.blue,
.infographic-segment.blue {
  background: var(--blue);
}

.infographic-fill.neutral,
.infographic-segment.neutral {
  background: #8a9791;
}

.infographic-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.infographic-kpis span {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  padding: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.infographic-kpis b {
  display: block;
  margin-bottom: 3px;
  color: var(--ink);
  font-size: 18px;
}

.infographic-flow {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.infographic-flow span {
  min-height: 54px;
  display: grid;
  align-content: space-between;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  padding: 8px;
}

.infographic-flow b {
  color: var(--ink);
  font-size: 17px;
}

.summary-card,
.command-widget,
.dashboard-row-card {
  min-height: 0;
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 12px;
  text-align: left;
}

.summary-card {
  min-height: 118px;
  align-content: space-between;
}

.command-widget {
  cursor: pointer;
}

.command-widget:hover,
.command-widget.active {
  border-color: var(--teal);
  background: #eef9f5;
}

.summary-card.restricted,
.command-widget.restricted {
  border-color: #d8c4a2;
  background: #fffaf1;
}

.summary-card span,
.command-widget span,
.dashboard-row-card span,
.report-export-card span,
.trend-row small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.summary-card strong,
.command-widget strong {
  font-size: 24px;
  line-height: 1.1;
}

.summary-card small,
.command-widget small,
.dashboard-row-card small {
  color: #78857f;
  font-size: 12px;
  font-weight: 700;
}

.dashboard-row-card {
  width: 100%;
}

.dashboard-row-card em {
  color: var(--teal);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
  text-transform: uppercase;
}

.dashboard-row-card:disabled {
  cursor: default;
}

.report-export-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.report-export-card.restricted {
  background: #fffaf1;
}

.report-export-card strong {
  display: block;
  margin-bottom: 4px;
}

.trend-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 120px;
  gap: 10px;
  align-items: center;
}

.trend-row > span {
  font-size: 13px;
  font-weight: 800;
}

.trend-bars {
  display: grid;
  gap: 4px;
}

.trend-bars i {
  display: block;
  height: 8px;
  border-radius: 999px;
}

.trend-inbound {
  background: var(--teal);
}

.trend-outbound {
  background: var(--amber);
}

#toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: min(420px, calc(100vw - 40px));
  padding: 13px 15px;
  border-radius: 8px;
  background: #14231f;
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

#toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 980px) {
  body.nav-open {
    overflow: hidden;
  }

  .mobile-shellbar {
    position: sticky;
    top: 0;
    z-index: 60;
    min-height: 64px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #1e3c35;
    background: #14231f;
    color: #f7fbf8;
    padding: 10px 16px;
  }

  .mobile-shellbar strong,
  .mobile-shellbar span {
    display: block;
  }

  .mobile-shellbar strong {
    font-size: 15px;
  }

  .mobile-shellbar span {
    color: #b7c9c3;
    font-size: 12px;
    font-weight: 700;
  }

  body.nav-open .mobile-menu-button span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  body.nav-open .mobile-menu-button span:nth-child(2) {
    opacity: 0;
  }

  body.nav-open .mobile-menu-button span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .nav-scrim {
    position: fixed;
    inset: 0;
    z-index: 70;
    background: rgba(6, 17, 14, 0.48);
  }

  .nav-scrim:not([hidden]) {
    display: block;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 80;
    width: min(312px, calc(100vw - 54px));
    height: 100dvh;
    padding: 18px;
    gap: 14px;
    box-shadow: 20px 0 50px rgba(5, 16, 13, 0.28);
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  nav {
    display: grid;
    gap: 5px;
    overflow-x: visible;
    padding-bottom: 0;
  }

  nav a {
    flex: none;
    white-space: normal;
  }

  .role-panel {
    margin-top: auto;
  }

  .workbench,
  .grid-two,
  .stocktake-layout,
  .reorder-layout,
  .purchase-layout,
  .receiving-layout,
  .return-layout,
  .label-scan-layout,
  .label-history-layout,
  .dashboard-layout,
  .reports-layout,
  .scope-ledger-layout,
  .catalog-grid {
    grid-template-columns: 1fr;
  }

  .command-panel,
  .analytics-panel {
    grid-column: auto;
  }

  .detail-panel {
    position: static;
  }
}

@media (max-width: 680px) {
  main {
    padding: 16px;
  }

  .sidebar {
    padding: 16px;
    gap: 12px;
  }

  .brand {
    gap: 8px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .brand h1 {
    font-size: 15px;
  }

  .brand p {
    display: none;
  }

  nav {
    display: grid;
    grid-template-columns: 1fr;
    gap: 5px;
    overflow-x: visible;
    padding-bottom: 0;
  }

  nav a {
    min-width: 0;
    padding: 8px 10px;
    font-size: 13px;
    text-align: left;
  }

  .role-panel {
    gap: 8px;
  }

  .topbar h2 {
    font-size: 24px;
  }

  .status-strip {
    gap: 6px;
  }

  .status-strip span {
    padding: 6px 8px;
    font-size: 12px;
  }

  .topbar,
  .panel-heading,
  .search-row,
  .scan-count-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .form-grid,
  .filter-grid,
  .detail-meta,
  .infographic-flow,
  .scan-workflow-grid,
  .scope-totals,
  .activity-columns,
  .vendor-return-card,
  .label-job-card,
  .report-export-card,
  .trend-row {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: span 1;
  }

  .button-row {
    justify-content: stretch;
  }

  .button-row button,
  .panel-heading button {
    width: 100%;
  }

  .stocktake-board .table-shell {
    overflow: visible;
    border: 0;
  }

  .stocktake-board table,
  .stocktake-board tbody,
  .stocktake-board tr,
  .stocktake-board td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .stocktake-board table {
    background: transparent;
  }

  .stocktake-board thead {
    display: none;
  }

  .stocktake-board tbody {
    display: grid;
    gap: 10px;
  }

  .stocktake-board tbody tr {
    display: grid;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
  }

  .stocktake-board td {
    display: grid;
    grid-template-columns: 86px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    padding: 0;
    border: 0;
  }

  .stocktake-board td::before {
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
  }

  .stocktake-board td:nth-child(1)::before {
    content: "SKU";
  }

  .stocktake-board td:nth-child(2)::before {
    content: "Item";
  }

  .stocktake-board td:nth-child(3)::before {
    content: "Expected";
  }

  .stocktake-board td:nth-child(4)::before {
    content: "Counted";
  }

  .stocktake-board td:nth-child(5)::before {
    content: "Variance";
  }

  .stocktake-board td:nth-child(6)::before {
    content: "Method";
  }

  .stocktake-board td:nth-child(7)::before {
    content: "Action";
  }

  .stocktake-board .count-input,
  .stocktake-board td button {
    width: 100%;
  }
}
