:root {
  --sales-bg: #181411;
  --sales-panel: rgba(255, 255, 255, 0.08);
  --sales-panel-strong: rgba(255, 255, 255, 0.12);
  --sales-line: rgba(255, 255, 255, 0.16);
  --sales-text: #fff8ef;
  --sales-muted: rgba(255, 248, 239, 0.68);
  --sales-tomato: #e34d36;
  --sales-olive: #9bb86f;
  --sales-steel: #8ca7b7;
  --sales-fire: #f0a34a;
  --sales-shadow: 0 20px 60px rgba(0, 0, 0, 0.38);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body {
  margin: 0;
  color: var(--sales-text);
  background:
    linear-gradient(120deg, rgba(227, 77, 54, 0.18), transparent 34%),
    linear-gradient(245deg, rgba(155, 184, 111, 0.14), transparent 38%),
    var(--sales-bg);
  font-family: "Aptos", "Segoe UI", system-ui, sans-serif;
}

button, input, select { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }

.shell {
  width: 100%;
  max-width: none;
  min-height: 100vh;
  margin: 0 auto;
  padding: 14px;
}

.login-view {
  min-height: calc(100vh - 28px);
  display: grid;
  place-items: center;
}

.login-card {
  width: min(470px, 100%);
  display: grid;
  gap: 18px;
  padding: 26px;
  border: 1px solid var(--sales-line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(24, 20, 17, 0.9), rgba(15, 12, 11, 0.96)),
    url("https://thedoughlab.eu/wp-content/uploads/2026/01/etterem-1024x751.png") center/cover no-repeat;
  box-shadow: var(--sales-shadow);
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  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;
  background: #111;
}

.brand-context {
  min-width: 0;
  color: rgba(255, 248, 239, 0.74);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.login-copy {
  display: grid;
  gap: 8px;
}

.login-copy h1 {
  font-size: clamp(38px, 8vw, 62px);
  line-height: 0.96;
}

.login-copy p,
.auth-message,
.panel-note,
.detail-head p,
.section-title span,
.action-box p,
.empty-card span {
  color: var(--sales-muted);
}

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

.app-view {
  min-height: calc(100vh - 28px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
}

.topbar {
  min-height: 70px;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--sales-line);
  border-radius: 8px;
  background: rgba(24, 20, 17, 0.84);
  backdrop-filter: blur(18px);
}

.station-pill,
.top-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.station-pill {
  justify-self: center;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 13px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--sales-olive);
  box-shadow: 0 0 0 5px rgba(155, 184, 111, 0.18);
}

.top-actions {
  justify-self: end;
  flex-wrap: wrap;
}

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

label {
  display: grid;
  gap: 8px;
  color: var(--sales-text);
  font-size: 13px;
  font-weight: 900;
}

input,
select {
  width: 100%;
  min-height: 52px;
  padding: 12px 13px;
  border: 1px solid var(--sales-line);
  border-radius: 8px;
  color: var(--sales-text);
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

input::placeholder { color: rgba(255, 248, 239, 0.42); }

input:focus,
select:focus {
  border-color: rgba(227, 77, 54, 0.62);
  box-shadow: 0 0 0 4px rgba(227, 77, 54, 0.14);
}

.primary-button,
.ghost-button {
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

.primary-button {
  background: linear-gradient(135deg, var(--sales-tomato), var(--sales-fire));
  box-shadow: 0 14px 28px rgba(227, 77, 54, 0.24);
}

.primary-button.confirm-button {
  background: linear-gradient(135deg, #657b4e, var(--sales-olive));
  box-shadow: 0 14px 28px rgba(155, 184, 111, 0.18);
}

.primary-button:disabled,
.ghost-button[aria-disabled="true"] {
  pointer-events: none;
  opacity: 0.44;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
}

.ghost-button:hover,
.filter-button:hover,
.sales-row:hover {
  border-color: rgba(227, 77, 54, 0.38);
}

.ghost-button.compact {
  min-height: 40px;
  padding: 0 12px;
  font-size: 12px;
}

.sales-command-shell {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(380px, 0.95fr) minmax(460px, 1fr) minmax(300px, 0.8fr);
  gap: 12px;
}

.queue-panel,
.detail-panel,
.action-panel {
  min-height: 0;
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--sales-line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(24, 20, 17, 0.92), rgba(15, 12, 11, 0.96));
  box-shadow: var(--sales-shadow);
}

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

.detail-panel {
  grid-template-rows: auto auto;
  align-content: start;
}

.action-panel {
  align-content: start;
  overflow: auto;
  scrollbar-gutter: stable;
}

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

  .shell {
    height: 100vh;
    overflow: hidden;
  }

  .app-view {
    height: calc(100vh - 28px);
    min-height: 0;
  }

  .sales-command-shell {
    overflow: hidden;
  }

  .detail-panel {
    overflow: auto;
  }
}

.panel-head,
.detail-head,
.section-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.panel-head h1 {
  font-size: clamp(30px, 4vw, 50px);
  line-height: 0.95;
}

.panel-note {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 800;
}

.detail-head {
  align-items: start;
}

.detail-head h1 {
  margin-top: 5px;
  font-size: clamp(30px, 4vw, 52px);
  line-height: 0.94;
}

.detail-head p {
  margin-top: 8px;
  font-weight: 750;
}

.section-title h2,
.action-box h2,
.new-order-box h2 {
  margin-top: 4px;
  font-size: 22px;
  line-height: 1;
}

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

.filter-button {
  min-height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: var(--sales-muted);
  background: rgba(255, 255, 255, 0.06);
  font-size: 11px;
  font-weight: 900;
}

.filter-button.active {
  color: #fff;
  background: rgba(227, 77, 54, 0.72);
}

.sales-order-queue,
.readiness-list {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 9px;
  overflow: auto;
  padding-right: 4px;
}

.sales-row {
  width: 100%;
  display: grid;
  gap: 7px;
  padding: 11px;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-left: 8px solid var(--sales-steel);
  border-radius: 8px;
  color: var(--sales-text);
  background: rgba(255, 255, 255, 0.07);
}

.sales-row.active {
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 0 3px rgba(227, 77, 54, 0.14);
}

.sales-row.ready { border-left-color: var(--sales-olive); }
.sales-row.production { border-left-color: var(--sales-tomato); }
.sales-row.draft { border-left-color: var(--sales-fire); }
.sales-row.shipped {
  border-left-color: var(--sales-muted);
  opacity: 0.68;
}

.row-top,
.row-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.sales-row strong {
  font-size: 15px;
  line-height: 1.05;
}

.sales-row span,
.row-line {
  color: var(--sales-muted);
  font-size: 12px;
  font-weight: 800;
}

.status-pill {
  width: max-content;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 9px;
  border-radius: 8px;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.status-pill.ready { background: rgba(101, 123, 78, 0.95); }
.status-pill.production { background: rgba(227, 77, 54, 0.95); }
.status-pill.draft {
  color: #21170b;
  background: rgba(240, 163, 74, 0.95);
}
.status-pill.shipped { background: rgba(170, 178, 192, 0.7); }

.readiness-section,
.action-box,
.new-order-box {
  display: grid;
  align-content: start;
  gap: 11px;
  padding: 13px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.action-box {
  gap: 9px;
  padding: 12px;
}

.new-order-box {
  gap: 10px;
  padding: 12px;
}

.readiness-card,
.empty-card {
  display: grid;
  gap: 6px;
  padding: 11px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-left: 8px solid var(--sales-steel);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.readiness-card.production { border-left-color: var(--sales-tomato); }
.readiness-card.ready { border-left-color: var(--sales-olive); }
.readiness-card.draft { border-left-color: var(--sales-fire); }

.readiness-card strong,
.empty-card strong {
  font-size: 14px;
}

.readiness-card span,
.empty-card span,
.action-box p,
.form-note {
  font-size: 13px;
  font-weight: 800;
}

.action-box .primary-button,
.action-box .confirm-button,
.action-box .action-link,
.new-order-box .ghost-button {
  width: 100%;
}

.action-box .action-link {
  color: #21170b;
  background: var(--sales-fire);
  border-color: rgba(240, 163, 74, 0.85);
}

.form-note {
  color: var(--sales-muted);
}

.form-step {
  display: grid;
  gap: 9px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.038)),
    rgba(255, 255, 255, 0.035);
}

.step-title {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
}

.step-title > span {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: #21170b;
  background: var(--sales-fire);
  font-size: 13px;
  font-weight: 950;
}

.step-title strong,
.customer-mode-button span,
.customer-field-panel > span,
.customer-panel-head span {
  display: block;
  line-height: 1.05;
  font-size: 13px;
  font-weight: 950;
}

.step-title small,
.customer-mode-button small,
.customer-panel-head small {
  display: block;
  margin-top: 3px;
  color: var(--sales-muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
}

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

.customer-choice-panel {
  display: grid;
  gap: 8px;
}

.customer-mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.065), rgba(255, 255, 255, 0.025)),
    rgba(0, 0, 0, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.customer-mode-button {
  min-width: 0;
  min-height: 50px;
  padding: 8px 10px;
  color: var(--sales-text);
  text-align: left;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    transform 0.18s ease;
}

.customer-mode-button:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.055);
}

.customer-mode-button.is-active {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0.12)),
    rgba(227, 77, 54, 0.38);
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.customer-mode-button.is-active small {
  color: rgba(255, 248, 239, 0.72);
}

.customer-field-panel {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.085), rgba(255, 255, 255, 0.035)),
    rgba(255, 255, 255, 0.045);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.055);
}

.customer-field-panel[hidden] {
  display: none;
}

.new-customer-fields {
  display: grid;
  gap: 8px;
}

.customer-contact-panel {
  position: relative;
  overflow: hidden;
}

.customer-contact-panel::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg, var(--sales-fire), var(--sales-tomato));
  opacity: 0.86;
}

.customer-panel-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.customer-panel-head small {
  max-width: 170px;
  text-align: right;
}

.new-customer-fields label {
  gap: 6px;
  color: rgba(255, 248, 239, 0.78);
  font-size: 11px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.new-customer-fields input,
.order-details-grid input,
#orderProduct,
#existingCustomer {
  min-height: 46px;
  padding: 10px 12px;
}

.new-order-box > .ghost-button {
  min-height: 46px;
}

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

@media (prefers-reduced-motion: no-preference) {
  .sales-row {
    transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
  }

  .sales-row:hover {
    transform: translateY(-2px);
  }
}

@media (max-width: 1220px) {
  .topbar,
  .sales-command-shell {
    grid-template-columns: 1fr;
  }

  .station-pill,
  .top-actions {
    justify-self: stretch;
  }

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

  .sales-command-shell {
    min-height: auto;
  }
}

@media (max-width: 1220px) and (min-width: 861px) {
  .sales-command-shell {
    grid-template-columns: minmax(300px, 0.85fr) minmax(0, 1.15fr);
    align-items: stretch;
  }

  .action-panel {
    grid-column: 1 / -1;
    grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.2fr);
  }
}

@media (max-width: 760px) {
  .shell { padding: 10px; }

  .filter-row,
  .order-details-grid {
    grid-template-columns: 1fr;
  }

  .panel-head,
  .detail-head,
  .section-title,
  .row-top,
  .row-footer {
    display: grid;
  }

  .panel-head h1,
  .detail-head h1 {
    font-size: 34px;
  }

  .top-actions .ghost-button {
    width: 100%;
  }
}
