:root {
  color-scheme: dark;
  --charcoal: #17110f;
  --charcoal-2: #241815;
  --surface: rgba(18, 14, 13, 0.92);
  --surface-2: rgba(255, 255, 255, 0.06);
  --surface-3: rgba(255, 255, 255, 0.1);
  --text-light: #f8fafc;
  --ink: #f8fafc;
  --muted: #aab2c0;
  --line: rgba(248, 250, 252, 0.14);
  --line-strong: rgba(248, 250, 252, 0.24);
  --tomato: #d85d36;
  --fire: #f29b3d;
  --olive: #657b4e;
  --basil: #86a15c;
  --steel: #376173;
  --wine: #7f2d2d;
  --shadow: 0 20px 44px rgba(0, 0, 0, 0.34);
}

* { box-sizing: border-box; }
html,
body {
  height: 100%;
  min-height: 100%;
  overflow: hidden;
}
body {
  margin: 0;
  color: var(--ink);
  font-family: "Aptos", "Segoe UI", system-ui, sans-serif;
  background:
    linear-gradient(115deg, rgba(216, 93, 54, 0.22), transparent 34%),
    linear-gradient(250deg, rgba(55, 97, 115, 0.22), transparent 38%),
    linear-gradient(180deg, var(--charcoal) 0%, #0f0c0b 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background:
    linear-gradient(90deg, transparent 0 23px, rgba(255, 255, 255, 0.08) 24px, transparent 25px),
    linear-gradient(0deg, transparent 0 23px, rgba(255, 255, 255, 0.06) 24px, transparent 25px);
  background-size: 96px 96px;
  mask-image: linear-gradient(180deg, black, transparent 82%);
}

button,
input,
select { font: inherit; }
button { cursor: pointer; }
button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
h1,
h2,
h3,
p { margin: 0; }
a {
  color: inherit;
  text-decoration: none;
}
[hidden] { display: none !important; }

.shell {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.login-view,
.warehouse-list,
.detail-tabs,
.detail-tab-panel,
.shelf-list,
.label-list,
.shelf-form,
.top-actions {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.login-view::-webkit-scrollbar,
.warehouse-list::-webkit-scrollbar,
.detail-tabs::-webkit-scrollbar,
.detail-tab-panel::-webkit-scrollbar,
.shelf-list::-webkit-scrollbar,
.label-list::-webkit-scrollbar,
.shelf-form::-webkit-scrollbar,
.top-actions::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.login-view {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 22px;
}

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 22px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(23, 17, 15, 0.9);
  box-shadow: var(--shadow);
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.brand-logo {
  display: block;
  width: min(176px, 46vw);
  height: auto;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
}

.login-card .brand-logo { width: min(240px, 68vw); }

.brand-context {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.login-copy {
  display: grid;
  gap: 6px;
  padding: 6px 0 2px;
}

.login-copy h1 {
  font-size: clamp(30px, 8vw, 46px);
  line-height: 1;
}

.login-copy p:last-child,
.auth-message {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.auth-message.error { color: #ffd0c2; }

.eyebrow {
  color: var(--tomato);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

input,
select {
  width: 100%;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(5, 5, 5, 0.34);
  outline: none;
}

select[multiple] {
  min-height: 150px;
  align-content: start;
}

option {
  color: var(--ink);
  background: var(--charcoal);
}

input:focus,
select:focus {
  border-color: rgba(216, 93, 54, 0.58);
  box-shadow: 0 0 0 3px rgba(216, 93, 54, 0.15);
}

.primary-button,
.ghost-button,
.icon-button {
  min-height: 36px;
  border: 0;
  border-radius: 8px;
  font-weight: 900;
}

.primary-button {
  padding: 0 13px;
  color: #fff;
  background: linear-gradient(135deg, var(--tomato), var(--fire));
}

.primary-button.compact { min-height: 34px; }

.ghost-button {
  padding: 0 12px;
  color: var(--text-light);
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.ghost-button.dark { background: rgba(255, 255, 255, 0.08); }

.icon-button {
  width: 36px;
  color: #fff;
  background: var(--tomato);
  font-size: 22px;
  line-height: 1;
}

.app-view {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 10px;
  overflow: hidden;
  padding: 10px;
}

.topbar {
  min-height: 58px;
  display: grid;
  grid-template-columns: minmax(190px, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 17, 15, 0.86);
  backdrop-filter: blur(20px);
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 6px;
  flex-wrap: wrap;
}

.nav-link,
#logoutButton { min-height: 34px; }

.station-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 13px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--basil);
  box-shadow: 0 0 0 4px rgba(134, 161, 92, 0.18);
}

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

.summary-card {
  min-width: 0;
  min-height: 70px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--fire);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.summary-card span,
.summary-card small {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-card span { text-transform: uppercase; }

.summary-card strong {
  min-width: 0;
  max-width: 100%;
  overflow: visible;
  justify-self: end;
  font-size: clamp(24px, 3vw, 32px);
  line-height: 1.15;
  text-overflow: clip;
  white-space: nowrap;
}

.summary-card small { grid-column: 1 / -1; }
.summary-card.tomato { border-left-color: var(--tomato); }
.summary-card.fire { border-left-color: var(--fire); }
.summary-card.steel { border-left-color: var(--steel); }
.summary-card.wine { border-left-color: var(--wine); }

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 10px;
  overflow: hidden;
}

.workspace.editor-open {
  grid-template-columns: 340px minmax(0, 1fr) 380px;
}

.warehouse-list-panel,
.detail-panel,
.editor-panel {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.warehouse-list-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.panel-head,
.detail-header,
.shelf-toolbar,
.editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2,
.detail-header h2,
.editor-empty h2 {
  font-size: 18px;
  line-height: 1.1;
}

.shelf-toolbar h3,
.editor-head h3 {
  font-size: 16px;
  line-height: 1.1;
}

.detail-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: end;
}

.panel-search {
  display: grid;
  gap: 6px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
}

.panel-search label {
  color: var(--muted);
  font-size: 10px;
}

.panel-search input {
  min-height: 36px;
  background: rgba(255, 255, 255, 0.055);
}

.warehouse-list {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 8px;
  overscroll-behavior: contain;
  overflow: auto;
}

.warehouse-card {
  min-width: 0;
  width: 100%;
  min-height: 120px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 6px 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--steel);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.045);
  overflow: visible;
  text-align: left;
}

.warehouse-card:nth-child(2n) { border-left-color: var(--tomato); }
.warehouse-card:nth-child(3n) { border-left-color: var(--olive); }

.warehouse-card.active {
  border-color: rgba(216, 93, 54, 0.52);
  border-left-color: var(--fire);
  background: rgba(216, 93, 54, 0.12);
}

.warehouse-card .usage-bar { grid-column: 1 / -1; }

.warehouse-card > div {
  min-width: 0;
}

.warehouse-card h3 {
  overflow: visible;
  font-size: 14px;
  line-height: 1.15;
  text-overflow: clip;
  white-space: normal;
}

.warehouse-code,
.muted,
.compact-line,
.shelf-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.warehouse-code {
  overflow: hidden;
  color: var(--text-light);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-line {
  min-width: 0;
  overflow: visible;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(92px, auto);
  align-items: start;
  gap: 4px 10px;
  grid-column: 1 / -1;
}

.compact-line > span {
  min-width: 0;
  max-width: 100%;
  overflow: visible;
  line-height: 1.2;
  text-overflow: clip;
  white-space: normal;
}

.compact-line > span:last-child {
  text-align: right;
}

.status-pill {
  min-width: 0;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 8px;
  color: #fff;
  background: var(--steel);
  font-size: 11px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-pill.off { background: var(--wine); }
.status-pill.ok { background: var(--olive); }
.status-pill.warn { background: var(--fire); color: #21110b; }
.status-pill.hot { background: var(--tomato); }

.usage-bar {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.usage-bar span {
  display: block;
  height: 100%;
  width: var(--fill, 0%);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--olive), var(--fire), var(--tomato));
}

.detail-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
}

.detail-view {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.detail-header p:last-child {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.detail-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  overflow-x: auto;
}

.detail-tab {
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 950;
  white-space: nowrap;
}

.detail-tab.active {
  color: #fff;
  border-color: rgba(216, 93, 54, 0.42);
  background: rgba(216, 93, 54, 0.24);
}

.detail-tab-panel {
  min-height: 0;
  overscroll-behavior: contain;
  overflow: auto;
}

.empty-state,
.editor-empty {
  min-height: 0;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 18px;
}

.editor-empty {
  align-content: start;
}

.editor-empty p:last-child {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.config-form {
  display: grid;
  gap: 10px;
}

.warehouse-profile,
.warehouse-editor {
  padding: 10px;
  background: rgba(255, 255, 255, 0.03);
}

.environment-panel {
  display: grid;
  gap: 10px;
  margin: 10px;
  padding: 12px;
  border: 1px solid rgba(248, 250, 252, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.045)),
    rgba(11, 14, 16, 0.72);
  box-shadow:
    0 22px 58px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(24px) saturate(1.18);
}

.environment-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 0.34fr);
  gap: 14px;
  align-items: center;
}

.environment-hero h3 {
  color: var(--text-light);
  font-size: clamp(22px, 3vw, 36px);
  line-height: 1.02;
}

.environment-hero p:last-child,
.environment-toolbar,
.environment-empty span,
.environment-log-row span,
.environment-log-row small {
  color: rgba(226, 232, 240, 0.68);
  font-size: 12px;
  font-weight: 850;
}

.environment-reading {
  min-height: 118px;
  display: grid;
  align-content: center;
  justify-items: end;
  gap: 6px;
  padding: 12px;
  border: 1px solid rgba(248, 250, 252, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.04)),
    rgba(255, 255, 255, 0.055);
}

.environment-reading strong {
  font-size: clamp(30px, 4.2vw, 48px);
  line-height: 0.94;
}

.environment-status {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  justify-content: center;
  padding: 0 9px;
  border: 1px solid rgba(248, 250, 252, 0.16);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}

.environment-status.ok {
  color: #d9f7d1;
  border-color: rgba(134, 161, 92, 0.48);
  background: rgba(134, 161, 92, 0.18);
}

.environment-status.warning,
.environment-status.missing {
  color: #ffe2cc;
  border-color: rgba(242, 155, 61, 0.52);
  background: rgba(242, 155, 61, 0.18);
}

.environment-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.environment-metrics article {
  min-height: 72px;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 10px;
  border: 1px solid rgba(248, 250, 252, 0.11);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
}

.environment-metrics span {
  color: rgba(226, 232, 240, 0.62);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.environment-metrics strong {
  color: var(--text-light);
  font-size: 20px;
  line-height: 1;
}

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

.environment-log-list {
  display: grid;
  gap: 8px;
}

.environment-log-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.05fr) minmax(140px, 0.9fr) minmax(96px, 0.45fr) minmax(90px, 0.45fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(248, 250, 252, 0.1);
  border-left: 4px solid var(--basil);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.environment-log-row.warning,
.environment-log-row.alert {
  border-left-color: var(--fire);
}

.environment-log-row > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.environment-log-row strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text-light);
  font-size: 14px;
  line-height: 1.14;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.environment-log-row span,
.environment-log-row small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.environment-log-row span {
  text-transform: uppercase;
}

.environment-reading-cell {
  justify-items: end;
}

.environment-reading-cell strong {
  font-size: 20px;
}

.environment-empty {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px dashed rgba(248, 250, 252, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.environment-empty.required {
  border-color: rgba(242, 155, 61, 0.45);
  background: rgba(242, 155, 61, 0.08);
}

.environment-empty strong {
  color: var(--text-light);
  font-size: 15px;
}

.temporary-storage-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  margin: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.compact-toolbar {
  min-height: 46px;
}

.temporary-storage-list {
  min-height: 0;
  max-height: 260px;
  display: grid;
  grid-auto-rows: max-content;
  gap: 8px;
  padding: 10px;
  overflow: auto;
  overscroll-behavior: contain;
}

.temporary-storage-card {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(180px, 1.15fr) minmax(150px, 0.8fr) minmax(150px, 0.8fr) auto;
  gap: 10px;
  align-items: center;
  padding: 11px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--fire);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
}

.temporary-storage-card.dough_stack {
  border-left-color: var(--basil);
}

.temporary-storage-card.prepared_material {
  border-left-color: var(--steel);
}

.temporary-storage-card > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.temporary-storage-card span,
.temporary-storage-card small {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.temporary-storage-card span {
  color: var(--fire);
  font-weight: 950;
  text-transform: uppercase;
}

.temporary-storage-card strong {
  min-width: 0;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.temporary-storage-qty {
  justify-items: end;
}

.temporary-storage-qty strong {
  font-size: 18px;
}

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

.profile-card {
  min-width: 0;
  min-height: 76px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  overflow: hidden;
}

.profile-card span,
.profile-note,
.shelf-card-grid small,
.usage-cell small {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-card span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.profile-card strong {
  overflow: visible;
  font-size: 18px;
  line-height: 1.2;
  text-overflow: clip;
  white-space: nowrap;
}

.profile-note {
  margin-top: 8px;
}

.section-inline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.section-inline-head h3 {
  font-size: 16px;
  line-height: 1.1;
}

.warehouse-form {
  padding: 0;
  background: transparent;
}

.field-row {
  display: grid;
  gap: 8px;
}

.warehouse-fields {
  grid-template-columns: 92px minmax(180px, 1fr) minmax(150px, 0.7fr) 120px 88px 88px 78px;
  align-items: end;
}

.checkbox-row {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 16px;
}

.checkbox-row input {
  width: 18px;
  min-height: 18px;
}

.shelf-section {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.labels-section {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.stock-section {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.shelf-tools {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-tabs {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.filter-tab {
  min-height: 28px;
  padding: 0 9px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 900;
}

.filter-tab.active {
  color: #fff;
  background: rgba(216, 93, 54, 0.72);
}

.shelf-list {
  min-height: 0;
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  gap: 8px;
  padding: 10px;
  overscroll-behavior: contain;
  overflow: auto;
}

.label-list {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  align-content: start;
  gap: 8px;
  padding: 10px;
  overscroll-behavior: contain;
  overflow: auto;
}

.stock-list {
  min-height: 0;
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  gap: 8px;
  padding: 10px;
  overscroll-behavior: contain;
  overflow: auto;
}

.stock-card {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(140px, 0.9fr) minmax(180px, 1.2fr) minmax(190px, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--olive);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.stock-card-empty {
  border-left-color: var(--steel);
  background: rgba(255, 255, 255, 0.03);
}

.stock-card-empty .stock-lot-block strong {
  color: var(--muted);
  font-family: inherit;
}

.stock-card > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.stock-card span,
.stock-card small {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-card span {
  color: var(--fire);
  font-weight: 950;
}

.stock-card strong {
  min-width: 0;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-shelf strong,
.stock-lot-block strong {
  font-family: "SFMono-Regular", Consolas, monospace;
}

.stock-qty {
  justify-items: end;
  gap: 7px;
}

.stock-qty strong {
  font-size: 18px;
}

.stock-override-button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 11px;
}

.stock-initial-button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 11px;
}

.override-card {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
}

.override-summary {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 8px 10px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.045);
}

.override-summary span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.override-summary strong {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.override-form {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 12px;
  overflow: auto;
}

.override-form .primary-button {
  width: 100%;
}

.shelf-label-card {
  min-width: 0;
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--steel);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  overflow: hidden;
}

.shelf-label-card > div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.shelf-label-kicker {
  min-width: 0;
  overflow: hidden;
  color: var(--tomato);
  font-size: 11px;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shelf-label-card strong {
  overflow: hidden;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 24px;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shelf-label-card small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shelf-card {
  min-width: 0;
  min-height: max-content;
  width: 100%;
  display: grid;
  gap: 9px;
  padding: 11px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--steel);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.045);
  overflow: hidden;
  text-align: left;
}

.shelf-card:hover,
.shelf-card.selected {
  border-color: rgba(216, 93, 54, 0.52);
  border-left-color: var(--fire);
  background: rgba(216, 93, 54, 0.11);
}

.shelf-card-main {
  min-width: 0;
  width: 100%;
  display: grid;
  gap: 9px;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}

.shelf-card-head,
.usage-cell > span:first-child {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.shelf-card-head > *,
.usage-cell > span:first-child > * {
  min-width: 0;
}

.shelf-card-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(140px, 0.9fr) minmax(180px, 1.1fr) minmax(90px, 0.6fr);
  gap: 8px;
}

.shelf-card-grid > span {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.shelf-card-grid strong {
  overflow: hidden;
  font-size: 13px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shelf-card-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 3px;
  border-top: 1px solid var(--line);
}

.shelf-lot {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shelf-print-button {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.shelf-primary {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.shelf-primary strong,
.shelf-primary small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shelf-primary strong {
  font-size: 13px;
}

.shelf-primary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.usage-cell {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.editor-panel {
  display: grid;
  height: 100%;
  min-height: 0;
  align-self: stretch;
  max-height: none;
}

.shelf-form {
  min-height: 0;
  padding: 0;
  overscroll-behavior: contain;
  overflow: auto;
}

.shelf-fields,
.assignment-grid {
  padding: 10px;
}

.shelf-fields {
  grid-template-columns: 1fr;
}

.assignment-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  border-top: 1px solid var(--line);
}

.shelf-form > .primary-button {
  margin: 0 10px 10px;
}

.empty-card {
  margin: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
  font-size: 13px;
  font-weight: 800;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 10;
  max-width: min(360px, calc(100vw - 32px));
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #fff;
  background: rgba(23, 17, 15, 0.96);
  box-shadow: var(--shadow);
}

.label-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.68);
}

.label-dialog {
  width: min(720px, 100%);
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(23, 17, 15, 0.98);
  box-shadow: var(--shadow);
}

.label-dialog-actions,
.label-buttons {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.label-buttons {
  justify-content: end;
}

.label-dialog-actions h2 {
  font-size: 18px;
  line-height: 1.1;
}

.shelf-print-label {
  width: min(100%, 640px);
  min-height: 360px;
  display: grid;
  grid-template-rows: auto auto auto auto minmax(86px, 1fr) auto;
  gap: 8px;
  justify-self: center;
  padding: 22px;
  border: 1px solid #111;
  border-radius: 8px;
  color: #111;
  background: #fff;
}

.label-brand {
  color: #111;
  font-size: 16px;
  font-weight: 950;
  text-transform: uppercase;
}

.label-lot {
  color: #333;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 22px;
  font-weight: 950;
}

.label-shelf-code {
  overflow-wrap: anywhere;
  color: #111;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: clamp(50px, 11vw, 92px);
  font-weight: 950;
  line-height: 0.95;
}

.label-shelf-name {
  color: #333;
  font-size: 20px;
  font-weight: 900;
}

.label-barcode {
  min-height: 94px;
}

.label-barcode svg {
  display: block;
  width: 100%;
  height: 94px;
}

.label-barcode-value {
  color: #111;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 20px;
  font-weight: 950;
  text-align: center;
}

@media print {
  @page {
    size: 100mm 60mm;
    margin: 0;
  }

  body {
    background: #fff !important;
  }

  body * {
    visibility: hidden !important;
  }

  #labelModal,
  #labelModal * {
    visibility: visible !important;
  }

  #labelModal {
    position: static;
    display: block;
    padding: 0;
    background: #fff;
  }

  .label-dialog {
    width: auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: #fff;
    box-shadow: none;
  }

  .label-dialog-actions {
    display: none !important;
  }

  .shelf-print-label {
    width: 100mm;
    min-height: 60mm;
    height: 60mm;
    padding: 5mm;
    border: 0;
    border-radius: 0;
  }

  .label-brand {
    font-size: 11pt;
  }

  .label-lot,
  .label-barcode-value {
    font-size: 14pt;
  }

  .label-shelf-code {
    font-size: 42pt;
  }

  .label-shelf-name {
    font-size: 13pt;
  }

  .label-barcode svg {
    height: 18mm;
  }
}

@media (max-width: 1260px) {
  .summary-grid,
  .profile-grid,
  .environment-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .environment-log-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace,
  .workspace.editor-open {
    grid-template-columns: 250px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
  }

  .workspace.editor-open {
    grid-template-rows: minmax(0, 0.62fr) minmax(0, 0.38fr);
  }

  .editor-panel {
    grid-column: 1 / -1;
    min-height: 0;
    align-self: stretch;
    max-height: none;
  }

  .shelf-form {
    grid-template-rows: auto auto minmax(0, 1fr) auto;
  }

  .shelf-fields {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .assignment-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .warehouse-fields {
    grid-template-columns: 82px minmax(180px, 1fr) minmax(150px, 0.8fr);
  }
}

@media (max-width: 1460px) {
  .warehouse-fields {
    grid-template-columns: 82px minmax(180px, 1fr) minmax(150px, 0.8fr);
  }
}

@media (max-width: 860px) {
  .app-view {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    display: grid;
    gap: 8px;
    padding: 8px;
  }

  .topbar {
    min-height: 0;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 7px;
  }

  .topbar .brand-lockup {
    min-width: 0;
    flex-wrap: nowrap;
  }

  .topbar .brand-logo {
    width: min(136px, 36vw);
  }

  .topbar .brand-context {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .top-actions {
    grid-column: 1 / -1;
    flex-wrap: nowrap;
    justify-content: start;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

  .top-actions::-webkit-scrollbar {
    display: none;
  }

  .top-actions .ghost-button {
    flex: 0 0 auto;
    min-height: 32px;
    padding: 0 9px;
    font-size: 12px;
    white-space: nowrap;
  }

  .summary-grid {
    gap: 6px;
  }

  .summary-card {
    min-height: 58px;
    padding: 8px 9px;
    border-left-width: 4px;
  }

  .summary-card span,
  .summary-card small {
    font-size: 10px;
  }

  .summary-card strong {
    font-size: 22px;
  }

  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(168px, 0.34fr) minmax(0, 0.66fr);
  }

  .workspace.editor-open {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 0.44fr) minmax(0, 0.56fr);
  }

  .workspace.editor-open .warehouse-list-panel {
    display: none;
  }

  .profile-grid,
  .environment-hero,
  .environment-metrics,
  .environment-log-row,
  .shelf-card-grid,
  .temporary-storage-card,
  .stock-card,
  .label-list {
    grid-template-columns: 1fr;
  }

  .stock-qty,
  .temporary-storage-qty,
  .environment-reading,
  .environment-reading-cell {
    justify-items: start;
  }

  .environment-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .shelf-card-head,
  .usage-cell > span:first-child {
    align-items: start;
  }

  .label-dialog-actions,
  .shelf-card-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .label-buttons {
    width: 100%;
  }

  .label-buttons button,
  .shelf-print-button {
    flex: 1 1 auto;
  }

  .top-actions {
    justify-content: stretch;
  }

  .top-actions .ghost-button {
    flex: 1 1 120px;
  }

  .warehouse-list-panel,
  .detail-panel,
  .editor-panel {
    min-height: 0;
  }

  .warehouse-fields,
  .shelf-fields,
  .assignment-grid {
    grid-template-columns: 1fr;
  }

  .checkbox-row {
    padding-top: 0;
  }
}
