/* Hallmark · macrostructure: Workbench · genre: modern-minimal · design-system: design.md · designed-as-app */
@import url("./tokens.css");
:root {
  color-scheme: light;

  --bg: #faf9f6;
  --panel: #ffffff;
  --sidebar: #f2f0e9;
  --border: #e4e0d4;
  --border-strong: #d6d1c1;
  --text: #191a16;
  --muted: #6f6c60;

  --accent: #0f6e63;
  --accent-strong: #0a4f47;
  --accent-rgb: 15, 110, 99;
  --accent-soft: rgba(15, 110, 99, 0.1);
  --accent-soft-strong: rgba(15, 110, 99, 0.18);
  --on-accent: #f6fbf9;

  --danger: #a4271c;
  --danger-bg: #fbe8e4;
  --success: #1f7a3d;
  --success-bg: #e2f3e4;
  --warn: #93540a;
  --warn-bg: #fbedd6;

  --overlay: rgba(24, 21, 14, 0.44);
  --shadow-sm: 0 1px 2px rgba(24, 21, 14, 0.06);
  --shadow-md: 0 6px 20px rgba(24, 21, 14, 0.1);
  --shadow-lg: 0 20px 48px rgba(24, 21, 14, 0.22);
  --thumb-bg: #ece8dc;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Roboto Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --bg: #16171a;
    --panel: #1d1e22;
    --sidebar: #1a1b1e;
    --border: #2d2e33;
    --border-strong: #3a3b41;
    --text: #eeece4;
    --muted: #9a988e;

    --accent: #3fb3a3;
    --accent-strong: #6fcabc;
    --accent-rgb: 63, 179, 163;
    --accent-soft: rgba(63, 179, 163, 0.14);
    --accent-soft-strong: rgba(63, 179, 163, 0.24);
    --on-accent: #06120f;

    --danger: #e6786a;
    --danger-bg: rgba(230, 120, 106, 0.14);
    --success: #6bc98a;
    --success-bg: rgba(107, 201, 138, 0.14);
    --warn: #e0a94e;
    --warn-bg: rgba(224, 169, 78, 0.14);

    --overlay: rgba(6, 6, 8, 0.6);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 24px 56px rgba(0, 0, 0, 0.55);
    --thumb-bg: #2a2b2f;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #16171a;
  --panel: #1d1e22;
  --sidebar: #1a1b1e;
  --border: #2d2e33;
  --border-strong: #3a3b41;
  --text: #eeece4;
  --muted: #9a988e;

  --accent: #3fb3a3;
  --accent-strong: #6fcabc;
  --accent-rgb: 63, 179, 163;
  --accent-soft: rgba(63, 179, 163, 0.14);
  --accent-soft-strong: rgba(63, 179, 163, 0.24);
  --on-accent: #06120f;

  --danger: #e6786a;
  --danger-bg: rgba(230, 120, 106, 0.14);
  --success: #6bc98a;
  --success-bg: rgba(107, 201, 138, 0.14);
  --warn: #e0a94e;
  --warn-bg: rgba(224, 169, 78, 0.14);

  --overlay: rgba(6, 6, 8, 0.6);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 24px 56px rgba(0, 0, 0, 0.55);
  --thumb-bg: #2a2b2f;
}

:root[data-theme="light"] {
  color-scheme: light;
}

* { box-sizing: border-box; }

button:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.45;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Shell ---------- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 280px;
  flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
}

.sidebar-header {
  padding: 22px 18px 16px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.sidebar h1 {
  margin: 0 0 5px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar h1::before {
  content: '';
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  flex-shrink: 0;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

#synced-at {
  font-variant-numeric: tabular-nums;
}

.user-session-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 10px;
}

.logout-form {
  display: inline;
}

.logout-btn {
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.logout-btn:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.theme-toggle {
  position: absolute;
  top: 20px;
  right: 16px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  transition: border-color 120ms ease, color 120ms ease, background-color 120ms ease;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.lang-toggle-form {
  display: inline;
}

.lang-toggle {
  right: 52px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

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

.auth-topbar .lang-toggle-form {
  display: inline-flex;
}

.auth-topbar .lang-toggle {
  position: static;
}

/* ---------- Buttons ---------- */

.btn-primary {
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--on-accent);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: background-color 120ms ease, border-color 120ms ease, transform 60ms ease;
}

.btn-primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: default;
  transform: none;
}

.sidebar-header .btn-primary {
  width: 100%;
  margin-top: 12px;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 120ms ease, color 120ms ease, background-color 120ms ease;
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

/* ---------- Sidebar navigation ---------- */

.sidebar-section {
  padding-top: 14px;
}

.sidebar-section-title {
  margin: 0;
  padding: 0 14px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.07em;
}

.sidebar-list {
  display: flex;
  flex-direction: column;
  padding: 8px 10px;
  gap: 2px;
}

.sidebar-section-bordered {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  padding-bottom: 6px;
}

.sidebar-section-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
}

.tab {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  border-left: 3px solid transparent;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  text-align: left;
  width: 100%;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.tab:hover {
  background: var(--panel);
  border-left-color: var(--border-strong);
}

.tab.active {
  background: var(--accent-soft);
  border-left-color: var(--accent);
  color: var(--accent-strong);
  font-weight: 600;
}

.tab-standalone {
  border-color: var(--border);
  border-left: 3px solid transparent;
}

.tab-standalone.active {
  border-left-color: var(--accent);
}

.tab-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab-count {
  color: inherit;
  opacity: 0.65;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  flex-shrink: 0;
  background: rgba(var(--accent-rgb), 0.1);
  border-radius: 999px;
  padding: 1px 7px;
}

.tab.active .tab-count {
  background: rgba(var(--accent-rgb), 0.2);
}

.warehouse-group {
  display: flex;
  flex-direction: column;
}

.warehouse-subnav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 3px 0 8px 18px;
}

.subtab {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  text-align: left;
  transition: background-color 120ms ease, color 120ms ease;
}

.subtab:hover {
  background: var(--panel);
  color: var(--text);
}

.subtab.active {
  background: var(--accent-soft-strong);
  color: var(--accent-strong);
  font-weight: 600;
}

.sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 10px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

/* ---------- Inline forms ---------- */

.form-row {
  display: flex;
  gap: 8px;
}

.form-row > button {
  flex: 1;
}

.inline-form-vertical {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 12px 10px;
  border-top: 1px solid var(--border);
  background: var(--panel);
}

.inline-form-vertical input[type="text"] {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  width: 100%;
}

.inline-form-vertical input[type="text"]:focus-visible {
  border-color: var(--accent);
}

.field-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.warn {
  color: var(--warn);
}

.form-status {
  font-size: 12px;
  color: var(--muted);
  margin: 4px 0 0;
}

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

/* ---------- Main content ---------- */

.content {
  flex: 1;
  min-width: 0;
  max-width: 1440px;
  padding: 28px 32px 48px;
}

.notice {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  background: var(--panel);
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.stock-active-label {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--text);
}

.stock-active-label strong {
  color: var(--accent-strong);
}

.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.filter-tab {
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 120ms ease, color 120ms ease, background-color 120ms ease;
}

.filter-tab:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.filter-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

#search,
#stock-search,
#po-search {
  flex: 1;
  max-width: 420px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
}

#search:focus-visible,
#stock-search:focus-visible,
#po-search:focus-visible {
  border-color: var(--accent);
}

#category-filter,
#sort {
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
}

/* ---------- Tables ---------- */

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

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

th {
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  background: var(--sidebar);
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr {
  transition: background-color 100ms ease;
}

tbody tr:hover {
  background: var(--accent-soft);
}

.po-item-total,
.po-total-row strong {
  font-variant-numeric: tabular-nums;
}

#product-table td:nth-child(5),
#product-table td:nth-child(6),
#product-table td:nth-child(7) {
  font-variant-numeric: tabular-nums;
}

#product-table td:nth-child(3),
#product-table td:nth-child(8),
#stock-table td:nth-child(3),
#stock-table td:nth-child(4),
#po-table td:nth-child(1) {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

img.thumb {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--thumb-bg);
  border: 1px solid var(--border);
}

.thumb-wrap {
  position: relative;
  width: 32px;
  height: 32px;
}

.thumb-upload-btn {
  position: absolute;
  bottom: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  line-height: 1;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  transition: color 120ms ease, border-color 120ms ease;
}

.thumb-upload-btn:hover {
  color: var(--accent-strong);
  border-color: var(--accent);
}

.row-actions {
  display: flex;
  gap: 6px;
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover {
  background: var(--accent-soft);
}

.empty-state td {
  text-align: center;
  color: var(--muted);
  padding: 32px 12px;
  font-size: 13px;
}

.pagination {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
}

.pagination button {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 120ms ease, color 120ms ease;
}

.pagination button:not(:disabled):hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.pagination button:disabled {
  opacity: 0.45;
  cursor: default;
}

.pagination .muted {
  font-variant-numeric: tabular-nums;
}

/* ---------- Badges ---------- */

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.badge.active { background: var(--success-bg); color: var(--success); }
.badge.inactive { background: var(--danger-bg); color: var(--danger); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.mode { background: var(--accent-soft); color: var(--accent-strong); }

/* ---------- Editable name cell ---------- */

.name-cell {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  min-height: 28px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  border-radius: var(--radius-sm);
  transition: background-color 120ms ease, color 120ms ease;
}

.icon-btn:hover {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.name-edit-input {
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  width: 160px;
}

/* ---------- Logs ---------- */

.stock-log-panel {
  margin-top: 28px;
}

.stock-log-panel h2 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 0 0 12px;
}

.stock-log-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stock-log-row {
  display: grid;
  grid-template-columns: 90px 1fr 140px 120px auto;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  font-size: 13px;
}

.stock-log-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pending-transfer-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  font-size: 13px;
}

.pending-transfer-row .stock-log-name {
  flex: 1 1 160px;
}

.pending-transfer-row .row-actions {
  margin-left: auto;
}

.pending-transfer-batch {
  flex-direction: column;
  align-items: stretch;
}

.transfer-batch-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.transfer-batch-route {
  font-weight: 600;
}

.pending-batch-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pending-batch-items[hidden] {
  display: none;
}

.pending-batch-item {
  display: flex;
  gap: 8px;
  align-items: baseline;
  cursor: pointer;
}

.pending-batch-item input[type='checkbox'] {
  margin: 0;
}

.pending-item-qty {
  width: 64px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
}

.pending-item-qty:focus-visible {
  border-color: var(--accent);
}

.pending-item-max {
  white-space: nowrap;
}

.pending-batch-photos {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pending-batch-photos[hidden] {
  display: none;
}

.history-photo-toggle {
  margin-left: auto;
}

.transfer-txn-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.history-items-toggle {
  padding: 4px 10px;
  font-size: 12px;
}

.pending-batch-photos-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pending-batch-photo {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}

.pending-batch-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
}

.photo-lightbox-modal {
  width: auto;
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 48px);
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  position: relative;
  display: flex;
}

.photo-lightbox-modal img {
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 48px);
  display: block;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.photo-lightbox-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
}

.pending-batch-photo-remove {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 16px;
  height: 16px;
  line-height: 14px;
  font-size: 11px;
  border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--border);
  cursor: pointer;
  padding: 0;
}

.pending-batch-photos-actions {
  display: flex;
  align-items: center;
}

.transfer-log-day {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.transfer-log-day + .transfer-log-day {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.transfer-log-day-heading {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.activity-log-row {
  grid-template-columns: 84px 170px 1fr 150px 160px;
}

.activity-log-type {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ---------- Auth page ---------- */

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 360px;
  max-width: 100%;
}

.auth-card h1 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-card h1::before {
  content: '';
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  flex-shrink: 0;
}

.auth-card p.muted {
  margin: 0 0 18px;
}

.auth-card .btn-primary {
  width: 100%;
  margin-top: 4px;
}

.auth-card .form-status.error {
  margin-bottom: 12px;
}

.auth-remember {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  margin: -4px 0 16px;
}

/* ---------- Modals ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(1px);
}

.modal {
  width: 380px;
  max-width: calc(100vw - 32px);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-lg);
}

.modal h3 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.stock-current-row {
  margin: 12px 0;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.modal-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
}

.modal-label input,
.modal-label select {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

.modal-label input:focus-visible,
.modal-label select:focus-visible {
  border-color: var(--accent);
}

.modal-lg {
  width: 660px;
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  overflow-x: hidden;
}

.bulk-transfer-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 12px;
}

.bulk-transfer-item {
  display: grid;
  grid-template-columns: 1fr 110px 90px 110px;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
}

.bulk-transfer-item-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.bulk-transfer-item input[type="number"] {
  width: 100%;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
}

.bulk-transfer-item .item-status {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}

.modal-full {
  width: calc(100vw - 48px);
  max-width: 1400px;
  height: calc(100vh - 48px);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-full-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
}

.modal-full-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.po-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  margin-top: 14px;
}

.po-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
  margin: 14px 0;
}

.po-detail-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.po-detail-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.po-detail-value {
  font-size: 14px;
  color: var(--text);
}

.po-items-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 6px;
  border-radius: var(--radius-sm);
}

.po-items-table {
  width: 100%;
  min-width: 480px;
  margin-top: 0;
  overflow: visible;
  box-shadow: none;
}

.po-items-table th,
.po-items-table td {
  padding: 6px;
}

.po-items-table input {
  width: 100%;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
}

.po-items-table input[type="number"] {
  width: 90px;
  font-variant-numeric: tabular-nums;
}

/**
 * Shared "card" treatment for the PO detail popup's logistics sections
 * (tracking, documents, distribute-to-warehouse, split-into-shipments) —
 * boxes them individually instead of a flat scroll of top-bordered blocks,
 * so each concern reads as its own self-contained step for someone who
 * isn't a regular computer user.
 */
.po-section-card {
  margin: 12px 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--panel);
}

.po-section-head {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 10px;
}

.po-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.po-section-desc {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
}

/** A plain-language "1 → 2 → 3" walkthrough for the download/fill-in/upload sheet flows. */
.po-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.po-step {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--sidebar);
  font-size: 12.5px;
  color: var(--muted);
}

.po-step-num {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 11px;
  font-weight: 700;
}

.po-distribution-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.po-shipment-plan-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.po-remaining-export-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.po-shipment-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.po-shipment-card {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 150px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--sidebar);
}

.po-shipment-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.po-shipment-card-meta {
  font-size: 11.5px;
}

/** Compact per-shipment breakdown chips shown in the items table's Shipments column, replacing one wide column per shipment slot. */
.po-shipment-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.po-shipment-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.po-tracking-input {
  width: 100%;
  min-width: 120px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
}


.po-tracking-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px 0;
}

.po-tracking-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel);
}

.po-tracking-number {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}

.po-tracking-add-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.po-tracking-add-row .po-tracking-input {
  flex: 1;
  min-width: 160px;
}

.po-tracking-mode-select {
  flex: none;
  width: auto;
  min-width: 90px;
}

.btn-icon {
  margin-left: auto;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  transition: border-color 120ms ease, color 120ms ease;
}

.btn-icon:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.po-autocomplete {
  position: relative;
}

.po-suggestions {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 20;
  margin-top: 4px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  max-height: 180px;
  overflow-y: auto;
}

.po-suggestion {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  cursor: pointer;
}

.po-suggestion:hover,
.po-suggestion.active {
  background: var(--accent-soft);
}

.po-suggestion .thumb {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
}

.po-suggestion-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.po-suggestion-name {
  font-size: 12px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.po-suggestion-sku {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--font-mono);
}

.po-item-total {
  font-size: 13px;
  white-space: nowrap;
}

.po-total-row {
  margin: 16px 0 6px;
  text-align: right;
  font-size: 14px;
}

.po-total-row strong {
  color: var(--accent-strong);
  font-size: 16px;
}

.po-documents-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px 0;
}

.po-document-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel);
}

.po-document-name {
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.po-document-name:hover {
  text-decoration: underline;
}

.po-document-meta {
  font-size: 12px;
  white-space: nowrap;
}

.po-documents-add-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.po-documents-hint {
  font-size: 12px;
}

/* ---------- Mobile navigation ---------- */

/* Both are desktop-hidden and switched on inside the ≤860px block. */
.mobile-bar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 50;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--sidebar);
  border-bottom: 1px solid var(--border);
}

.mobile-bar-title {
  font-size: 14px;
  font-weight: 600;
}

.mobile-bar-context {
  margin-left: auto;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  font-size: 18px;
  line-height: 1;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}

.nav-toggle:hover {
  border-color: var(--accent);
}

.nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgb(0 0 0 / 0.5);
}

.nav-backdrop[hidden] {
  display: none;
}

/* ---------- Loading feedback ---------- */

/* A table mid-refresh stays readable but visibly stale, so a slow reply
   never looks like a finished one. */
[aria-busy="true"] .table-body-busy,
tbody[aria-busy="true"] {
  opacity: 0.45;
  transition: opacity 0.12s ease;
}

.skeleton-cell span {
  display: block;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--border) 25%, var(--border-strong) 37%, var(--border) 63%);
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
}

@keyframes skeleton-shimmer {
  from { background-position: 100% 50%; }
  to { background-position: 0 50%; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar,
  .skeleton-cell span {
    transition: none;
    animation: none;
  }
}

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .mobile-bar {
    display: flex;
  }

  .app-shell {
    flex-direction: column;
  }

  /* The sidebar used to stack above the content at 45vh — on a 375px phone
     that spent 45% of the viewport on navigation before a single row of data,
     and its 671px of content still had to scroll inside that box. It is a
     drawer now, so the content owns the whole screen. */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 60;
    width: 84vw;
    max-width: 320px;
    height: 100vh;
    max-height: none;
    border-right: 1px solid var(--border);
    border-bottom: none;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: 0 0 40px rgb(0 0 0 / 0.35);
  }

  .sidebar.is-open {
    transform: none;
  }

  .nav-backdrop {
    display: block;
  }

  .content {
    padding: 16px 16px 40px;
  }

  .toolbar {
    flex-wrap: wrap;
  }

  main.content section {
    overflow-x: auto;
  }

  #product-table,
  #stock-table,
  #po-table,
  #hot-stock-table {
    min-width: 560px;
  }

  /* Keep column context while scrolling a long table on a small screen. */
  main.content thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--panel);
  }
}

@media (max-width: 640px) {
  .stock-log-row,
  .activity-log-row {
    grid-template-columns: 1fr;
    gap: 2px;
    align-items: start;
  }

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

  .modal,
  .modal-lg {
    width: 100%;
    padding: 18px;
  }

  .po-suggestion-name,
  .stock-log-name {
    white-space: normal;
  }

  /* Column priority: hide the decorative/secondary columns rather than
     making every table a 700px sideways scroll. Full detail stays one tap
     away in each row's modal. */
  #product-table th:nth-child(1),
  #product-table td:nth-child(1),
  #product-table th:nth-child(4),
  #product-table td:nth-child(4),
  #product-table th:nth-child(7),
  #product-table td:nth-child(7),
  #product-table th:nth-child(8),
  #product-table td:nth-child(8),
  #stock-table th:nth-child(2),
  #stock-table td:nth-child(2),
  #stock-table th:nth-child(5),
  #stock-table td:nth-child(5),
  #hot-stock-table th:nth-child(1),
  #hot-stock-table td:nth-child(1),
  #hot-stock-table th:nth-child(5),
  #hot-stock-table td:nth-child(5),
  #hot-stock-table th:nth-child(6),
  #hot-stock-table td:nth-child(6),
  #po-table th:nth-child(3),
  #po-table td:nth-child(3),
  #po-table th:nth-child(6),
  #po-table td:nth-child(6),
  #po-table th:nth-child(8),
  #po-table td:nth-child(8) {
    display: none;
  }

  #product-table,
  #stock-table,
  #po-table,
  #hot-stock-table {
    min-width: 0;
  }

  /* Desktop's 12px side padding costs 120px across five columns — more than
     the 50px the table was overflowing by. Tighter cells let the whole row
     fit a 375px screen with no sideways scroll at all. */
  main.content th,
  main.content td {
    padding: 10px 7px;
  }

  /* Comfortable thumb targets on the controls people tap most. */
  .filter-tab,
  .tab,
  .subtab,
  .tab-standalone {
    min-height: 40px;
  }

  .toolbar input[type="search"],
  .toolbar select {
    min-height: 40px;
  }
}

/* Hallmark · Workbench refinement · pre-emit critique: P4 H4 E4 S4 R5 V4 */
:root {
  --bg: var(--color-paper);
  --sidebar: var(--color-paper-2);
  --text: var(--color-ink);
  --muted: var(--color-ink-2);
  --border: var(--color-rule);
  --accent: var(--color-accent);
  --on-accent: var(--color-accent-ink);
}
/* Keep the established dark palette when selected explicitly or by the OS. */
:root[data-theme="dark"] {
  --bg: oklch(20% 0.009 175);
  --sidebar: oklch(22% 0.009 175);
  --text: oklch(94% 0.008 175);
  --muted: oklch(71% 0.012 175);
  --border: oklch(32% 0.012 175);
  --accent: oklch(72% 0.095 178);
  --on-accent: oklch(19% 0.019 175);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: oklch(20% 0.009 175);
    --sidebar: oklch(22% 0.009 175);
    --text: oklch(94% 0.008 175);
    --muted: oklch(71% 0.012 175);
    --border: oklch(32% 0.012 175);
    --accent: oklch(72% 0.095 178);
    --on-accent: oklch(19% 0.019 175);
  }
}
html, body { overflow-x: clip; }
body { font-family: var(--font-body); }
button, input, select, textarea { font-family: inherit; }
button { white-space: nowrap; }
button, input, select, textarea, summary, a { -webkit-tap-highlight-color: var(--accent-soft); }
button:disabled { opacity: .5; cursor: not-allowed; transform: none; }
button:active:not(:disabled) { transform: translateY(1px); }
button, tbody tr { transition: none; }
a:focus-visible, summary:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, h3 { font-style: normal; min-width: 0; overflow-wrap: anywhere; }
[hidden] { display: none !important; }
.skip-link { position: fixed; top: var(--space-2xs); left: var(--space-2xs); padding: var(--space-xs) var(--space-sm); z-index: 200; background: var(--panel); color: var(--accent); transform: translateY(-150%); }
.skip-link:focus { transform: none; }
.sidebar { width: 252px; }
.sidebar-header { padding: var(--space-md) var(--space-sm) var(--space-sm); }
.brand-name, .auth-brand { font-family: var(--font-display); font-weight: 800; font-size: var(--text-xl); letter-spacing: -.04em; }
.brand-name span, .auth-brand span { font-weight: 500; letter-spacing: -.02em; }
.brand-name { padding-right: var(--space-lg); font-size: 18px; }
.brand-caption { color: var(--muted); font-size: var(--text-xs); margin: var(--space-3xs) 0 var(--space-sm); }
.theme-toggle { top: var(--space-md); right: var(--space-xs); width: 28px; height: 28px; }
.lang-toggle { right: calc(var(--space-xs) + 34px); }
#synced-at { font-size: 11px; margin: var(--space-xs) 0 0; line-height: 1.6; }
.sidebar-header .btn-primary { margin-top: var(--space-xs); }
.sidebar-section { padding-top: var(--space-md); }
.sidebar-section-title { font-size: 11px; letter-spacing: .04em; font-weight: 600; padding-inline: var(--space-sm); }
.sidebar-section-bordered { padding-top: var(--space-sm); border-top: 0; }
.sidebar-section-body, .sidebar-list { padding: var(--space-2xs); gap: var(--space-3xs); }
.sidebar-section-body .tab-standalone { border: 1px solid transparent; padding: var(--space-xs); }
.sidebar-section-body .tab-standalone.active { border-color: var(--border); background: var(--panel); color: var(--accent-strong); box-shadow: var(--shadow-sm); }
.tab { min-height: 40px; }
.warehouse-subnav { margin-left: var(--space-md); padding: var(--space-3xs) 0 var(--space-2xs) var(--space-2xs); border-left: 1px solid var(--border-strong); }
.subtab { min-height: 36px; }
.sidebar-actions { border-top: 0; padding: var(--space-sm) var(--space-xs); }
.sidebar-actions .btn-secondary { font-size: var(--text-xs); }
.sidebar-account { display: flex; align-items: center; gap: var(--space-2xs); padding: var(--space-sm) var(--space-xs); border-top: 1px solid var(--border); }
.account-avatar { flex: 0 0 32px; height: 32px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; border-radius: var(--radius-input); }
.account-details { display: flex; flex: 1; min-width: 0; flex-direction: column; font-size: var(--text-xs); }
.account-details strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-details span { color: var(--muted); font-size: 11px; text-transform: capitalize; }
.logout-btn { min-height: 32px; }
.content { padding: var(--space-lg) var(--space-lg) var(--space-xl); max-width: none; }
.workspace-header { display: flex; justify-content: space-between; align-items: center; gap: var(--space-md); padding-bottom: var(--space-md); margin-bottom: var(--space-md); border-bottom: 1px solid var(--border); }
.workspace-header h1 { font-family: var(--font-display); font-size: var(--text-display); font-weight: 650; letter-spacing: -.035em; line-height: 1.2; margin: 0; }
.workspace-header p { color: var(--muted); font-size: var(--text-md); margin: var(--space-2xs) 0 0; }
.warehouse-context { flex-shrink: 0; max-width: 35%; display: flex; flex-direction: column; gap: var(--space-3xs); text-align: right; }
.warehouse-context span { color: var(--muted); font-size: var(--text-xs); }
.warehouse-context strong { font-size: var(--text-sm); overflow-wrap: anywhere; }
.notice { border: 0; border-radius: 0; border-bottom: 1px solid var(--border); background: transparent; padding: 0 0 var(--space-sm); margin-bottom: var(--space-md); font-size: var(--text-xs); }
.notice summary { cursor: pointer; padding-block: var(--space-3xs); }
.notice p { margin: var(--space-2xs) 0 0; max-width: 75ch; }
.snapshot-notice { display: flex; align-items: flex-start; gap: var(--space-2xs); }
.snapshot-dot { width: 6px; height: 6px; margin-top: 6px; flex-shrink: 0; border-radius: var(--radius-pill); background: var(--muted); }
.notice-detail { margin-left: var(--space-xs); }
.section-actions { display: flex; justify-content: flex-end; gap: var(--space-2xs); margin-bottom: var(--space-sm); }
.filter-tabs { gap: var(--space-3xs); padding-bottom: var(--space-2xs); border-bottom: 1px solid var(--border); margin-bottom: var(--space-sm); }
.filter-tab { min-height: 36px; border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; padding: var(--space-2xs) var(--space-xs); font-size: var(--text-sm); }
.filter-tab.active { background: var(--accent-soft); color: var(--accent-strong); border-color: transparent; font-weight: 650; }
.filter-tab:hover { background: var(--accent-soft); border-color: transparent; }
.toolbar { flex-wrap: wrap; gap: var(--space-2xs); padding: 0; margin-bottom: var(--space-sm); }
.toolbar input[type="search"] { flex: 1 1 260px; min-width: 0; max-width: none; }
.toolbar input[type="search"], .toolbar select { height: 42px; border-radius: var(--radius-input); }
.toolbar select { max-width: 100%; min-width: 0; }
.toolbar .muted { margin-left: auto; white-space: nowrap; font-size: var(--text-xs); }
.table-scroll { max-width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--panel); }
.table-scroll table { border: 0; border-radius: 0; box-shadow: none; }
th { background: var(--sidebar); font-size: var(--text-xs); font-weight: 600; text-transform: none; letter-spacing: 0; white-space: nowrap; padding: var(--space-xs) var(--space-sm); }
td { padding: var(--space-sm); line-height: 1.5; }
#product-table .name-cell { min-width: 180px; font-weight: 550; }
#product-table th:nth-child(5), #product-table th:nth-child(6), #product-table th:nth-child(7),
#product-table td:nth-child(5), #product-table td:nth-child(6), #product-table td:nth-child(7) { text-align: right; }
.stock-quantity { font-weight: 650; font-variant-numeric: tabular-nums; }
.stock-empty { display: inline-block; color: var(--danger); background: var(--danger-bg); border-radius: var(--radius-sm); padding: 0 var(--space-2xs); }
.empty-state td { padding: var(--space-xl) var(--space-md); text-align: center; color: var(--muted); }
.pagination { padding-block: var(--space-sm); }
.btn-primary, .btn-secondary { min-height: 40px; border-radius: var(--radius-input); }
.modal { border-radius: var(--radius-card); }
.modal-overlay { padding-block: var(--space-sm); overflow-y: auto; }
.modal-label input, .modal-label select { min-height: 42px; }
.auth-shell { padding: var(--space-md); }
.auth-card { width: 440px; padding: var(--space-lg); border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--panel); box-shadow: var(--shadow-md); }
.auth-brand { color: var(--accent-strong); font-size: var(--text-xl); margin-bottom: var(--space-xl); }
.auth-heading { margin-bottom: var(--space-lg); }
.auth-card h1 { font-family: var(--font-display); font-size: 30px; font-weight: 650; letter-spacing: -.035em; margin: 0 0 var(--space-2xs); }
.auth-card h1::before { display: none; }
.auth-card p.muted { margin: 0; font-size: var(--text-md); }
.auth-card .modal-label { margin-bottom: var(--space-md); color: var(--text); font-size: var(--text-sm); font-weight: 550; }
.auth-card .modal-label input { background: var(--bg); height: 46px; }
.auth-remember { margin: 0 0 var(--space-md); font-size: var(--text-sm); min-height: 24px; }
.auth-card .btn-primary { min-height: 46px; font-size: var(--text-md); }
.auth-footer { color: var(--muted); font-size: var(--text-xs); line-height: 1.7; border-top: 1px solid var(--border); padding-top: var(--space-md); margin: var(--space-lg) 0 0; }
@media (max-width: 1100px) {
  .content { padding-inline: var(--space-md); }
  .notice-detail { display: block; margin: var(--space-3xs) 0 0; }
}
@media (max-width: 860px) {
  .sidebar { width: min(300px, 88vw); transition: transform var(--dur-short) var(--ease-out); }
  .content { padding: var(--space-md) var(--space-sm) var(--space-xl); }
  main.content section { overflow-x: visible; }
  .workspace-header { align-items: flex-start; }
  .workspace-header p { max-width: 45ch; }
  .table-scroll { overscroll-behavior-x: contain; }
  .mobile-bar { border-bottom: 1px solid var(--border); box-shadow: none; }
  .mobile-bar-title { font-size: var(--text-sm); }
}
@media (max-width: 640px) {
  .workspace-header { flex-direction: column; gap: var(--space-sm); margin-bottom: var(--space-sm); padding-bottom: var(--space-sm); }
  .warehouse-context { max-width: 100%; flex-direction: row; align-items: baseline; gap: var(--space-2xs); text-align: left; }
  .workspace-header h1 { font-size: 28px; }
  .workspace-header p { font-size: var(--text-sm); }
  .toolbar input[type="search"] { flex-basis: 100%; }
  .toolbar select { flex: 1 1 130px; width: 0; }
  .toolbar .muted { flex-basis: 100%; }
  .filter-tabs { gap: 0; }
  .filter-tab { padding-inline: var(--space-2xs); font-size: var(--text-xs); }
  .table-scroll #product-table { min-width: 480px; }
  .table-scroll #stock-table, .table-scroll #hot-stock-table, .table-scroll #po-table { min-width: 440px; }
  .table-scroll #users-table { min-width: 620px; }
  #product-table .name-cell { min-width: 150px; }
  .auth-shell { padding: var(--space-sm); }
  .auth-card { padding: var(--space-md); }
  .auth-brand { margin-bottom: var(--space-lg); }
  .auth-card h1 { font-size: 28px; }
  .section-actions { justify-content: flex-start; }
  .form-row { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  button:active:not(:disabled) { transform: none; }
}
/* Keep native table-cell sizing and group secondary product details on phones. */
#product-table .name-cell { display: table-cell; }
.product-mobile-meta { display: none; }
@media (max-width: 640px) {
  .toolbar #search, .toolbar #stock-search, .toolbar #po-search, .toolbar #hot-stock-search { flex: 1 1 100%; width: 100%; }
  #product-filter-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3xs); }
  #product-table th:nth-child(3), #product-table td:nth-child(3),
  #product-table th:nth-child(9), #product-table td:nth-child(9) { display: none; }
  .table-scroll #product-table { min-width: 0; table-layout: fixed; }
  #product-table th:nth-child(2) { width: 56%; }
  #product-table th:nth-child(5) { width: 25%; }
  #product-table th:nth-child(6) { width: 19%; }
  #product-table .name-cell { min-width: 0; overflow-wrap: anywhere; }
  .product-mobile-meta { display: block; margin-top: var(--space-3xs); font-family: var(--font-mono); font-size: 10px; font-weight: 400; color: var(--muted); }
  #product-table .name-edit-input { width: 100%; min-width: 0; }
  #product-table .icon-btn { min-height: 24px; min-width: 24px; }
  .mobile-bar-title { white-space: nowrap; }
}
@media (max-width: 860px) {
  .sidebar { box-shadow: none; }
  .sidebar.is-open { box-shadow: var(--shadow-lg); }
}
#product-table td:nth-child(3), #product-table td:nth-child(5),
#product-table td:nth-child(6), #product-table td:nth-child(7) { white-space: nowrap; }
#product-table tbody tr.empty-state td,
#stock-table tbody tr.empty-state td,
#hot-stock-table tbody tr.empty-state td { display: table-cell; white-space: normal; }
