:root {
  --charcoal: #17110f;
  --text-light: #f8fafc;
  --paper: #11100f;
  --ink: #f8fafc;
  --muted: #aab2c0;
  --line: rgba(248, 250, 252, 0.16);
  --light-line: rgba(248, 250, 252, 0.16);
  --tomato: #d85d36;
  --fire: #f29b3d;
  --olive: #657b4e;
  --basil: #86a15c;
  --steel: #376173;
  --wine: #7f2d2d;
  --shadow: 0 24px 54px rgba(0, 0, 0, 0.32);
  --soft-shadow: 0 14px 32px rgba(0, 0, 0, 0.16);
}

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

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.2;
  background:
    linear-gradient(90deg, transparent 0 17px, rgba(255,255,255,0.08) 18px, transparent 19px),
    linear-gradient(0deg, transparent 0 17px, rgba(255,255,255,0.06) 18px, transparent 19px);
  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 { position: relative; min-height: 100vh; }
.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
}
.login-card {
  width: min(470px, 100%);
  display: grid;
  gap: 18px;
  padding: 26px;
  border: 1px solid rgba(248, 250, 252, 0.18);
  border-radius: 8px;
  color: var(--text-light);
  background:
    linear-gradient(180deg, rgba(36, 24, 21, 0.88), rgba(23, 17, 15, 0.96)),
    url("https://thedoughlab.eu/wp-content/uploads/2025/12/kep-5.1-1024x1024.png") center/cover no-repeat;
  box-shadow: var(--shadow);
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.brand-logo {
  display: block;
  width: min(214px, 50vw);
  height: auto;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 8px;
}
.login-card .brand-logo { width: min(250px, 68vw); }
.brand-context {
  color: rgba(248, 250, 252, 0.74);
  font-size: 13px;
  font-weight: 900;
}
.brand-lockup strong { display: block; font-size: 18px; line-height: 1; }
.brand-lockup span:last-child { color: rgba(248, 250, 252, 0.74); font-size: 13px; }
.login-copy { display: grid; gap: 8px; padding: 20px 0 4px; }
.login-copy h1 { font-size: clamp(38px, 8vw, 62px); line-height: 0.96; }
.login-copy p:last-child, .auth-message { color: rgba(248, 250, 252,0.78); }
.auth-message.error { color: #ffd0c2; }

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

label {
  display: grid;
  gap: 8px;
  font-size: 13px;
  font-weight: 900;
}
input, select {
  width: 100%;
  min-height: 56px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255,255,255,0.08);
  outline: none;
}
input:focus, select:focus {
  border-color: rgba(216, 93, 54, 0.62);
  box-shadow: 0 0 0 4px rgba(216, 93, 54, 0.16);
}
select option {
  color: #17110f;
  background: #f8fafc;
}
select option:checked {
  color: #17110f;
  background: #f29b3d;
}
.checkbox-row {
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.checkbox-row input {
  width: 20px;
  min-height: 20px;
}

.primary-button, .ghost-button, .danger-button {
  min-height: 54px;
  border-radius: 8px;
  font-weight: 900;
  border: 1px solid transparent;
}
.primary-button {
  color: #fff;
  background: linear-gradient(135deg, var(--tomato), var(--fire));
  box-shadow: 0 14px 28px rgba(216, 93, 54, 0.28);
}
.primary-button.compact {
  min-width: 120px;
  padding: 0 18px;
}
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  color: var(--text-light);
  background: rgba(248, 250, 252, 0.08);
  border-color: rgba(248, 250, 252, 0.18);
}
.danger-button {
  color: #fff;
  background: var(--wine);
}

.app-view {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
  padding: 14px;
}
.topbar {
  min-height: 70px;
  display: grid;
  grid-template-columns: minmax(190px, 1fr) auto minmax(220px, 1fr);
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--light-line);
  border-radius: 8px;
  color: var(--text-light);
  background: rgba(23, 17, 15, 0.82);
  backdrop-filter: blur(20px);
}
.station-pill, .top-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.station-pill {
  justify-self: center;
  width: 18px;
  height: 18px;
}
.top-actions { justify-self: end; }
.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--basil);
  box-shadow: 0 0 0 5px rgba(134, 161, 92, 0.18);
}

.stage-home {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-content: stretch;
  min-height: 100%;
}
.catalog-home {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  overflow: auto;
  padding-right: 2px;
}
.catalog-stage-grid {
  min-height: auto;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.catalog-stage-grid .stage-button {
  min-height: 150px;
}
.catalog-stage-grid .stage-button strong {
  font-size: clamp(23px, 2.4vw, 38px);
  line-height: 0.96;
}
.catalog-stage-grid .stage-button > span:last-child {
  font-size: clamp(34px, 3.6vw, 58px);
}
.catalog-health-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(248, 250, 252,0.2);
  border-radius: 8px;
  color: var(--text-light);
  background: linear-gradient(180deg, rgba(23, 17, 15, 0.94), rgba(15, 12, 11, 0.98));
  box-shadow: var(--shadow);
}
.catalog-health-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 380px);
  gap: 16px;
  align-items: end;
}
.catalog-health-head h1 {
  margin-top: 5px;
  font-size: clamp(30px, 4vw, 58px);
  line-height: 0.94;
}
.catalog-health-head p:last-child {
  color: var(--muted);
  font-size: 14px;
  font-weight: 850;
  text-align: right;
}
.catalog-health-list {
  max-height: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 10px;
  overflow: visible;
  padding-right: 0;
}
.health-card {
  display: grid;
  gap: 9px;
  align-content: start;
  padding: 12px;
  border: 1px solid rgba(248, 250, 252,0.16);
  border-left: 8px solid var(--tomato);
  border-radius: 8px;
  background: rgba(248, 250, 252,0.08);
}
.health-card.supplier-risk {
  border-left-color: var(--fire);
}
.health-card.ready {
  border-left-color: var(--basil);
}
.health-card-head {
  display: grid;
  gap: 4px;
}
.health-card-head strong {
  font-size: 18px;
  line-height: 1.08;
}
.health-card-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}
.health-issues {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.health-issues span {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border-radius: 8px;
  color: #fff;
  background: rgba(216, 93, 54, 0.78);
  font-size: 11px;
  font-weight: 900;
}
.health-issues span.more {
  color: var(--text-light);
  background: rgba(248, 250, 252, 0.16);
}
.health-card.supplier-risk .health-issues span {
  background: rgba(242, 155, 61, 0.78);
}
.health-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.health-actions .ghost-button {
  min-height: 38px;
  padding: 0 11px;
  font-size: 12px;
}
.health-empty {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid rgba(134, 161, 92, 0.36);
  border-radius: 8px;
  background: rgba(134, 161, 92, 0.12);
}
.health-empty strong {
  font-size: 17px;
}
.health-empty span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}
.stage-button {
  position: relative;
  min-height: 250px;
  display: grid;
  align-content: space-between;
  gap: 18px;
  padding: 20px;
  overflow: hidden;
  text-align: left;
  color: var(--text-light);
  border: 1px solid rgba(248, 250, 252,0.14);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(248, 250, 252,0.09), rgba(248, 250, 252,0.03));
  box-shadow: var(--soft-shadow);
  transition: transform 140ms ease, border-color 140ms ease;
}
.stage-button::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(216, 93, 54, 0.34), transparent 62%);
}
.stage-button:nth-child(2)::before { background: linear-gradient(135deg, rgba(101, 123, 78, 0.34), transparent 62%); }
.stage-button:nth-child(3)::before { background: linear-gradient(135deg, rgba(55, 97, 115, 0.34), transparent 62%); }
.stage-button:nth-child(4)::before { background: linear-gradient(135deg, rgba(127, 45, 45, 0.34), transparent 62%); }
.stage-button:nth-child(5)::before { background: linear-gradient(135deg, rgba(242, 155, 61, 0.3), transparent 62%); }
.stage-button:hover {
  transform: translateY(-3px);
  border-color: rgba(248, 250, 252,0.34);
}
.stage-button > * { position: relative; }
.stage-index {
  width: fit-content;
  max-width: 100%;
  padding: 6px 9px;
  border-radius: 8px;
  color: #fff;
  background: rgba(248, 250, 252,0.13);
  font-weight: 900;
}
.stage-button strong {
  min-width: 0;
  max-width: 420px;
  font-size: clamp(38px, 5vw, 76px);
  line-height: 0.92;
  overflow-wrap: anywhere;
}
.stage-button > span:last-child {
  justify-self: end;
  align-self: end;
  color: #fff;
  font-size: clamp(48px, 7vw, 96px);
  font-weight: 900;
  line-height: 0.8;
}

.list-panel, .detail-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
  overflow: hidden;
  border: 1px solid rgba(248, 250, 252,0.22);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(23, 17, 15, 0.96), rgba(15, 12, 11, 0.98));
  box-shadow: var(--shadow);
}
.list-panel { grid-template-rows: auto minmax(0, 1fr); }
.detail-panel { overflow: auto; align-content: start; }

@media (min-width: 681px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

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

  .app-view {
    height: 100vh;
    min-height: 0;
    overflow: hidden;
  }

  .list-panel,
  .detail-panel {
    min-height: 0;
  }
}
.section-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
}
.section-header h2 {
  margin-top: 6px;
  font-size: clamp(38px, 5vw, 70px);
  line-height: 0.92;
}
.back-button {
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, var(--tomato), var(--fire));
  font-size: 30px;
  font-weight: 900;
}

.card-list {
  display: grid;
  gap: 10px;
  overflow: auto;
  align-content: start;
  padding: 2px 8px 12px 2px;
  scrollbar-gutter: stable;
}
.card-list.device-list {
  grid-template-columns: 1fr;
  gap: 8px;
  overflow-x: hidden;
  overflow-y: auto;
}
.list-card {
  width: 100%;
  min-width: 0;
  min-height: 148px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 9px;
  padding: 14px 16px;
  overflow: hidden;
  text-align: left;
  border: 1px solid var(--line);
  border-left: 8px solid var(--tomato);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255,255,255,0.08);
  box-shadow: var(--soft-shadow);
}
.list-card:nth-child(2n) { border-left-color: var(--olive); }
.list-card:nth-child(3n) { border-left-color: var(--steel); }
.list-card.inactive { opacity: 0.58; }
.list-card h3 {
  font-size: clamp(20px, 1.8vw, 26px);
  line-height: 1.08;
}
.material-card,
.supplier-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  height: auto;
}
.device-card {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  align-items: center;
  min-height: 58px;
  gap: 12px;
  padding: 12px 14px;
  border-left-width: 1px;
  border-left-color: rgba(248, 250, 252, 0.12) !important;
  border-color: rgba(248, 250, 252, 0.12);
  color: var(--text-light);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.055)),
    rgba(15, 16, 18, 0.42);
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(18px) saturate(1.18);
}
.card-list.device-list .device-card:hover {
  transform: translateY(-2px) !important;
  border-color: rgba(248, 250, 252, 0.24);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.07)),
    rgba(15, 16, 18, 0.52);
}
.device-row-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}
.device-card h3 {
  max-width: none;
  color: var(--text-light);
  font-size: 16px;
  line-height: 1.18;
  overflow-wrap: anywhere;
}
.device-row-copy span {
  min-width: 0;
  color: rgba(246, 247, 242, 0.54);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.1;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}
.device-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  box-shadow: 0 0 0 4px rgba(248, 250, 252, 0.05);
}
.device-status-dot.online {
  background: #34c759;
  box-shadow: 0 0 0 4px rgba(52, 199, 89, 0.13);
}
.device-status-dot.offline {
  background: rgba(174, 174, 178, 0.86);
  box-shadow: 0 0 0 4px rgba(174, 174, 178, 0.1);
}
.device-status-dot.error {
  background: #ff3b30;
  box-shadow: 0 0 0 4px rgba(255, 59, 48, 0.16);
}
.card-top, .panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-top {
  min-width: 0;
  max-width: 100%;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 6px;
  overflow: hidden;
}
.compact-line {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 6px 8px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.15;
}
.compact-line span,
.card-top > span {
  min-width: 0;
  min-height: 25px;
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  overflow: hidden;
  border: 1px solid rgba(248, 250, 252, 0.12);
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.055);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-top .status-pill {
  flex: 0 0 auto;
}
.panel-head {
  min-width: 0;
  max-width: 100%;
}
.list-card > *,
.health-card > *,
.health-empty > *,
.recipe-mix-preview > *,
.route-box > *,
.printer-profile-card > *,
.device-detail-card > *,
.device-empty > * {
  min-width: 0;
  max-width: 100%;
}
.list-card h3,
.health-card-head strong,
.health-card-head span,
.health-issues span,
.status-pill,
.device-card h3,
.device-row-copy span,
.detail-header h2,
.detail-header p,
.recipe-mix-preview strong,
.recipe-mix-preview span,
.printer-test-result,
.printer-capability-note,
.pizza-label-preview span,
.pizza-label-preview strong,
.pizza-label-preview footer,
.internal-label-preview span,
.internal-label-preview strong,
.internal-label-preview p,
.inkjet-copy span,
.inkjet-copy strong,
.device-detail-card h3,
.device-type-chip,
.device-status-board span,
.device-status-board strong,
.device-forget-card h3,
.device-forget-card p,
.empty-card,
.device-empty h3,
.device-empty p {
  min-width: 0;
  max-width: 100%;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
}
.status-pill,
.health-issues span,
.device-type-chip {
  height: auto;
  padding-top: 7px;
  padding-bottom: 7px;
  line-height: 1.15;
  text-align: center;
}
.list-card h3 {
  display: -webkit-box;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  color: #fff;
  background: var(--steel);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
  font-size: 11px;
  font-weight: 900;
}
.status-pill.ok { background: rgba(111, 142, 76, 0.82); }
.status-pill.warn { background: rgba(242, 155, 61, 0.86); }
.status-pill.off { background: rgba(170, 178, 192, 0.34); }
.status-pill.alert { background: rgba(255, 69, 58, 0.88); }

.device-health-banner {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid rgba(248, 250, 252, 0.14);
  border-radius: 8px;
  color: rgba(246, 247, 242, 0.78);
  background: rgba(23, 17, 15, 0.22);
  font-size: 14px;
  font-weight: 900;
}
.device-health-banner.attention {
  color: #ffd7d2;
  border-color: rgba(255, 111, 94, 0.46);
  background: rgba(227, 77, 54, 0.16);
}
.device-health-banner.ready {
  color: #eff8d2;
  border-color: rgba(134, 161, 92, 0.38);
  background: rgba(134, 161, 92, 0.14);
}

.detail-header, .detail-form, .split, .form-actions {
  display: grid;
  gap: 12px;
}
.detail-header h2 {
  font-size: clamp(34px, 5vw, 70px);
  line-height: 0.92;
}
.detail-header p:last-child {
  color: var(--muted);
  font-weight: 800;
}
.detail-form {
  padding: 16px;
  border: 1px solid var(--line);
  border-top: 8px solid var(--tomato);
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  box-shadow: var(--soft-shadow);
}
.split {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.recipe-items {
  display: grid;
  gap: 10px;
}
.recipe-studio {
  gap: 14px;
  border-top-color: var(--fire);
}
.recipe-studio-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.36fr);
  gap: 14px;
  align-items: stretch;
}
.recipe-studio-main {
  display: grid;
  gap: 12px;
}
.recipe-mix-preview {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 100%;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(242, 155, 61, 0.12);
}
.recipe-mix-preview strong {
  font-size: 20px;
  line-height: 1.1;
}
.recipe-mix-preview span {
  color: var(--muted);
  font-weight: 800;
}
.route-box {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
}
.printer-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.printer-test-result {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(23, 17, 15, 0.18);
  font-size: 13px;
  font-weight: 850;
  line-height: 1.25;
}
.printer-test-result.ok {
  color: #fff;
  background: rgba(134, 161, 92, 0.82);
}
.printer-test-result.warn {
  color: #fff;
  background: rgba(242, 155, 61, 0.82);
}
.printer-test-result.error {
  color: #fff;
  background: rgba(163, 61, 65, 0.9);
}
.printer-checkbox-row {
  width: fit-content;
  padding: 10px 12px;
  border: 1px solid rgba(248, 250, 252, 0.14);
  border-radius: 999px;
  background: rgba(248, 250, 252, 0.07);
}
.printer-profile-card {
  overflow: visible;
}
.printer-profile-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(340px, 1.05fr);
  gap: 14px;
  align-items: stretch;
}
.printer-profile-fields {
  display: grid;
  align-content: start;
  gap: 12px;
}
.printer-facts-panel,
.label-size-panel,
.label-customization-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(248, 250, 252, 0.1);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025)),
    rgba(12, 13, 15, 0.28);
}
.printer-facts-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.printer-facts-title span,
.label-template-help,
.printer-facts-grid span {
  color: rgba(246, 247, 242, 0.56);
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}
.printer-facts-title strong {
  color: rgba(255, 231, 198, 0.88);
  font-size: 12px;
}
.printer-facts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.printer-facts-grid article {
  display: grid;
  gap: 4px;
  min-height: 62px;
  align-content: center;
  padding: 10px;
  border: 1px solid rgba(248, 250, 252, 0.09);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}
.printer-facts-grid strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  line-height: 1.16;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.label-size-panel h4,
.label-customization-panel h4 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  line-height: 1;
}
.label-template-help {
  margin: 0;
  line-height: 1.35;
  text-transform: none;
}
.printer-preview-inputs {
  display: grid;
  grid-template-columns: minmax(96px, 0.48fr) repeat(5, minmax(98px, 1fr));
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(248, 250, 252, 0.1);
  border-radius: 8px;
  background: rgba(12, 13, 15, 0.24);
}
.printer-preview-inputs span {
  color: rgba(246, 247, 242, 0.54);
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}
.printer-preview-inputs input {
  min-height: 38px;
  padding: 9px 10px;
  font-size: 12px;
}
.printer-capability-note {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid rgba(242, 155, 61, 0.28);
  border-radius: 8px;
  color: rgba(255, 231, 198, 0.86);
  background: rgba(242, 155, 61, 0.12);
  font-size: 13px;
  font-weight: 850;
  line-height: 1.35;
}
.printer-label-stage {
  min-height: 320px;
  display: grid;
  place-items: center;
  padding: 18px;
  border: 1px solid rgba(248, 250, 252, 0.1);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.16), transparent 42%),
    linear-gradient(145deg, rgba(255,255,255,0.1), rgba(255,255,255,0.035)),
    rgba(10, 10, 12, 0.42);
}
.pizza-label-preview,
.internal-label-preview {
  width: min(430px, 100%);
  aspect-ratio: 1.55 / 1;
  display: grid;
  gap: 12px;
  padding: 20px;
  border-radius: 8px;
  color: #131313;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(244, 242, 235, 0.96)),
    #fff;
  box-shadow:
    0 28px 70px rgba(0, 0, 0, 0.42),
    inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  transform: rotate(-0.6deg);
  transition: transform 180ms ease, box-shadow 180ms ease;
}
.printer-label-stage:hover .pizza-label-preview,
.printer-label-stage:hover .internal-label-preview {
  transform: translateY(-3px) rotate(0deg);
  box-shadow: 0 34px 88px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}
.pizza-label-preview header {
  display: grid;
  grid-template-columns: 0.55fr 1fr;
  gap: 12px;
  align-items: end;
  padding-bottom: 10px;
  border-bottom: 2px solid #111;
}
.pizza-label-preview header span,
.internal-label-preview > span {
  font-size: 18px;
  font-weight: 950;
  letter-spacing: 0;
}
.pizza-label-preview header strong {
  text-align: right;
  font-size: clamp(28px, 3vw, 44px);
  line-height: 0.92;
  text-transform: uppercase;
}
.pizza-label-preview section {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr 0.9fr;
  gap: 8px;
}
.pizza-label-preview section div {
  display: grid;
  gap: 4px;
  padding: 9px;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 6px;
  background: rgba(0,0,0,0.035);
}
.pizza-label-preview section span,
.pizza-label-preview footer,
.internal-label-preview p {
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}
.pizza-label-preview section strong {
  font-size: 15px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}
.barcode-preview {
  min-height: 58px;
  display: flex;
  justify-content: center;
  align-items: end;
  gap: 2px;
  padding: 8px 10px 4px;
  border-radius: 4px;
  background: #fff;
}
.barcode-preview i {
  width: var(--bar-width);
  height: var(--bar-height);
  display: block;
  background: #111;
}
.pizza-label-preview footer {
  text-align: center;
  letter-spacing: 0.08em;
}
.internal-label-preview {
  aspect-ratio: 1.8 / 1;
  align-content: center;
  text-align: center;
}
.internal-label-preview strong {
  font-size: 24px;
  line-height: 1.05;
}
.carton-inkjet-preview {
  width: min(470px, 100%);
  min-height: 210px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 118px;
  gap: 18px;
  align-items: center;
  padding: 22px;
  border: 1px dashed rgba(32, 28, 21, 0.34);
  border-radius: 8px;
  color: rgba(34, 27, 19, 0.84);
  background:
    linear-gradient(135deg, rgba(157, 111, 68, 0.18), rgba(99, 70, 43, 0.12)),
    #b8895d;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.38);
}
.inkjet-copy {
  display: grid;
  gap: 6px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  text-transform: uppercase;
}
.inkjet-copy span {
  font-size: 14px;
  font-weight: 900;
}
.inkjet-copy strong {
  color: rgba(18, 17, 15, 0.9);
  font-size: clamp(30px, 4vw, 52px);
  line-height: 0.94;
}
.matrix-code {
  width: 112px;
  height: 112px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  gap: 3px;
  padding: 8px;
  border: 3px solid rgba(21, 18, 15, 0.76);
  background: rgba(245, 232, 209, 0.54);
}
.matrix-code i {
  background: rgba(21, 18, 15, 0.18);
}
.matrix-code i.on {
  background: rgba(21, 18, 15, 0.88);
}
.lot-exp-inkjet-preview {
  width: min(430px, 100%);
  aspect-ratio: 40 / 15;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 10px 14px;
  border: 1px dashed rgba(20, 20, 20, 0.48);
  border-radius: 4px;
  color: rgba(18, 18, 18, 0.88);
  background: #f4efe4;
  box-shadow: 0 24px 58px rgba(0, 0, 0, 0.34);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  text-transform: uppercase;
}
.lot-exp-inkjet-preview strong,
.lot-exp-inkjet-preview span {
  display: block;
  min-width: 0;
  overflow: hidden;
  line-height: 1;
  letter-spacing: 0;
  text-overflow: clip;
  white-space: nowrap;
}
.lot-exp-inkjet-preview strong {
  font-size: clamp(18px, 2.4vw, 28px);
  font-weight: 950;
}
.lot-exp-inkjet-preview span {
  font-size: clamp(16px, 2vw, 24px);
  font-weight: 900;
}
.lot-exp-inkjet-preview.dense {
  gap: 4px;
}
.lot-exp-inkjet-preview.dense strong {
  font-size: clamp(13px, 1.55vw, 18px);
}
.lot-exp-inkjet-preview.dense span {
  font-size: clamp(12px, 1.35vw, 16px);
}
.device-detail-header h2 {
  overflow-wrap: anywhere;
}
.device-detail-hero {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
}
.device-detail-hero .device-status-dot {
  width: 12px;
  height: 12px;
}
.device-detail-hero p:last-child {
  color: rgba(246, 247, 242, 0.62);
  font-size: 15px;
  font-weight: 850;
  overflow-wrap: anywhere;
}
.device-detail-form {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.device-detail-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(248, 250, 252, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.055)),
    rgba(15, 16, 18, 0.38);
  box-shadow:
    0 16px 38px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(18px) saturate(1.16);
}
.device-detail-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.device-detail-card h3 {
  color: var(--text-light);
  font-size: 22px;
  line-height: 1.05;
}
.device-type-chip {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 10px;
  border: 1px solid rgba(248, 250, 252, 0.14);
  border-radius: 999px;
  color: rgba(246, 247, 242, 0.74);
  background: rgba(248, 250, 252, 0.08);
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}
.device-status-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.device-status-board div {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid rgba(248, 250, 252, 0.14);
  border-radius: 8px;
  background: rgba(23, 17, 15, 0.18);
}
.device-status-board span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}
.device-status-board strong {
  overflow-wrap: anywhere;
  color: var(--text-light);
  font-size: 16px;
  line-height: 1.15;
}
.device-save-actions {
  justify-items: stretch;
}
.danger-zone {
  border-color: rgba(255, 69, 58, 0.28);
  background:
    linear-gradient(180deg, rgba(255, 69, 58, 0.12), rgba(255, 255, 255, 0.035)),
    rgba(20, 14, 14, 0.44);
}
.danger-zone p {
  color: rgba(246, 247, 242, 0.66);
  font-size: 13px;
  font-weight: 820;
  line-height: 1.35;
}
.danger-zone .danger-button {
  justify-self: start;
  min-width: 170px;
}
.device-forget-dialog {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
}
.device-forget-backdrop {
  position: absolute;
  inset: 0;
  opacity: 0;
  background: rgba(4, 6, 10, 0.52);
  backdrop-filter: blur(18px) saturate(1.24);
  transition: opacity 160ms ease;
}
.device-forget-card {
  position: relative;
  width: min(430px, calc(100vw - 36px));
  display: grid;
  gap: 12px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  color: var(--text-light);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.07)),
    rgba(20, 18, 18, 0.9);
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.46),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  transition: opacity 160ms ease, transform 160ms ease;
}
.device-forget-dialog.show .device-forget-backdrop {
  opacity: 1;
}
.device-forget-dialog.show .device-forget-card {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.device-forget-card h3 {
  font-size: 26px;
  line-height: 1.04;
}
.device-forget-card p:last-of-type {
  color: rgba(246, 247, 242, 0.68);
  font-size: 14px;
  font-weight: 820;
  line-height: 1.35;
}
.device-forget-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}
.recipe-item-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(120px, 160px) minmax(90px, 120px);
  gap: 10px;
  align-items: end;
}
.form-actions {
  grid-template-columns: 1fr auto;
  align-items: center;
}
.empty-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  color: var(--muted);
  font-weight: 900;
}
.device-empty {
  min-height: 180px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  text-align: center;
  border-color: rgba(248, 250, 252, 0.12);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255,255,255,0.035)),
    rgba(19, 19, 21, 0.34);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(18px) saturate(1.15);
}
.device-empty h3 {
  margin: 0;
  color: var(--text-light);
  font-size: 24px;
  line-height: 1;
}
.device-empty p {
  margin: 0;
  color: rgba(246, 247, 242, 0.6);
  font-size: 13px;
}

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

@media (max-width: 1040px) {
  .topbar { grid-template-columns: 1fr auto; }
  .station-pill {
    grid-column: 1 / -1;
    justify-self: center;
    order: 3;
  }
  .stage-home,
  .catalog-stage-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .card-list.device-list {
    grid-template-columns: 1fr;
  }
  .catalog-health-head {
    grid-template-columns: 1fr;
  }
  .catalog-health-head p:last-child {
    text-align: left;
  }
  .printer-profile-grid {
    grid-template-columns: 1fr;
  }
  .printer-preview-inputs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .printer-preview-inputs span {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  .app-view { padding: 10px; }
  .topbar, .top-actions {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: stretch;
  }
  .stage-home, .catalog-stage-grid, .split, .recipe-item-row, .recipe-studio-grid, .form-actions {
    grid-template-columns: 1fr;
  }
  .device-status-board,
  .printer-facts-grid,
  .printer-actions,
  .printer-preview-inputs,
  .carton-inkjet-preview {
    grid-template-columns: 1fr;
  }
  .pizza-label-preview section {
    grid-template-columns: 1fr;
  }
  .printer-label-stage {
    min-height: 240px;
    padding: 12px;
  }
  .carton-inkjet-preview {
    justify-items: start;
  }
  .stage-button { min-height: 160px; }
  .catalog-health-list {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }
  .section-header {
    grid-template-columns: auto 1fr;
  }
  .primary-button.compact {
    grid-column: 1 / -1;
    width: 100%;
  }
}
