:root {
  --ink: #17212b;
  --muted: #66717d;
  --line: #d9e0e7;
  --panel: #ffffff;
  --steel: #eef2f5;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --warm: #f4b860;
}

* {
  box-sizing: border-box;
}

img,
svg,
video,
canvas {
  max-width: 100%;
}

html {
  font-size: 16px;
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background: linear-gradient(180deg, #f7f9fb 0%, #e9eef2 100%);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

.navbar,
footer {
  display: none;
}

.app-language-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 22px rgba(23, 33, 43, 0.08);
}

.app-language-bar span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.app-language-bar a {
  min-width: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 9px;
  background: #fff;
  color: var(--ink);
  text-align: center;
  text-decoration: none;
  font-weight: 900;
}

.app-language-bar a.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.container {
  max-width: 1180px;
}

.app-heading,
.ai-panel,
.calculator-panel,
.analysis-output,
.result-panel,
.admin-panel,
.admin-menu a,
.admin-list article,
.production-context,
.production-search,
.production-panel,
.production-results,
.production-action-menu a,
.production-result-grid article,
.history-panel,
.history-result {
  overflow-wrap: anywhere;
}

.calculator-shell {
  padding: 32px 0;
}

.app-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-strong);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: 36px;
  font-weight: 800;
}

.total-badge {
  min-width: 220px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-left: 6px solid var(--warm);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 28px rgba(23, 33, 43, 0.08);
}

.total-badge span,
.result-main span {
  display: block;
  color: var(--muted);
  font-size: 14px;
}

.total-badge strong,
.result-main strong {
  display: block;
  margin-top: 4px;
  font-size: 30px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.75fr);
  gap: 20px;
  align-items: start;
}

.workflow-band {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.workflow-band.row,
.qr-station.row,
.ai-grid.row {
  display: flex;
}

.workflow-step {
  min-height: 74px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.workflow-step span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #d7dee5;
  color: var(--ink);
  font-weight: 900;
}

.workflow-step strong {
  display: block;
  margin-top: 8px;
  font-size: 14px;
}

.workflow-step.active {
  border-color: var(--accent);
  background: #edf8f5;
}

.workflow-step.active span {
  background: var(--accent);
  color: #fff;
}

.wizard-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

.wizard-nav-button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 14px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.wizard-nav-button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.wizard-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
}

.wizard-actions-top {
  margin: 0 0 16px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.wizard-actions .primary-button,
.wizard-actions .secondary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.wizard-hidden {
  display: none !important;
}

.calculator-shell:not(.wizard-ready) [data-wizard-step]:not([data-wizard-step="1"]),
.calculator-shell:not(.wizard-ready) .cost-meter,
.calculator-shell:not(.wizard-ready) .scan-readiness,
.calculator-shell:not(.wizard-ready) .travel-card-preview,
.calculator-shell:not(.wizard-ready) .analysis-output,
.calculator-shell:not(.wizard-ready) .workspace-grid,
.calculator-shell:not(.wizard-ready) .piece-lines-panel,
.calculator-shell:not(.wizard-ready) .capture-assistant {
  display: none !important;
}

.wizard-step-description {
  margin: 6px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.wizard-step-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #f8fbfc;
}

.wizard-step-card h2 {
  margin: 0 0 6px;
  font-size: 22px;
}

.wizard-step-card p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.surface-entry-card {
  border: 2px solid #1d4ed8;
  border-radius: 8px;
  padding: 16px;
  background: #eff6ff;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.surface-entry-card h2 {
  margin: 0 0 6px;
  font-size: 24px;
}

.surface-entry-card p {
  margin: 0;
  color: #1e3a8a;
  font-weight: 700;
}

.surface-entry-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.surface-entry-actions a {
  border: 1px solid #1d4ed8;
  border-radius: 8px;
  padding: 10px 12px;
  color: #1d4ed8;
  background: #fff;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.ai-panel,
.calculator-panel,
.analysis-output,
.result-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 30px rgba(23, 33, 43, 0.08);
}

.ai-panel {
  margin-bottom: 20px;
  padding: 22px;
}

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-title-row h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
}

.primary-button {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  padding: 0 18px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.secondary-link {
  min-height: 42px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 9px 14px;
  background: #fff;
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: none;
}

.secondary-link:hover {
  color: var(--accent-strong);
  background: #edf8f5;
}

.secondary-link.active {
  background: var(--accent);
  color: #fff;
}

.source-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.source-pill.legacy {
  border-color: #c7b26b;
  background: #fff8db;
  color: #6f5600;
}

.cost-meter {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7fafb;
}

.cost-meter span {
  display: block;
  color: var(--muted);
  text-align: right;
}

.scan-readiness {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 2px solid #b91c1c;
  background: #fff5f5;
}

.scan-readiness span {
  color: #6b1d1d;
  text-align: right;
  font-weight: 700;
}

.scan-readiness-good {
  border-color: #15803d;
  background: #f0fdf4;
}

.scan-readiness-good span {
  color: #14532d;
}

.qr-station {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.qr-station div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdfe;
}

.qr-station span,
.qr-station strong {
  display: block;
}

.qr-station span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.qr-station strong {
  margin: 3px 0 10px;
}

.qr-station button {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: #fff;
  color: var(--accent-strong);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.reference-actions {
  display: flex;
  align-items: end;
}

.reference-actions button {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: #fff;
  color: var(--accent-strong);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

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

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

.ai-grid.row > .wide-field {
  flex: 0 0 auto;
  width: 100%;
}

.upload-zone {
  position: relative;
  display: block;
  min-height: 116px;
  border: 2px dashed #9fb0bf;
  border-radius: 8px;
  padding: 16px;
  background: #fbfdfe;
  cursor: pointer;
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--accent);
  background: #edf8f5;
}

.upload-zone strong {
  display: block;
  margin: 6px 0 2px;
  font-size: 18px;
}

.upload-zone small {
  color: var(--muted);
  font-weight: 700;
}

.upload-zone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.capture-assistant {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f7fafb;
}

.piece-lines-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f7fafb;
}

.wizard-advanced {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f7fafb;
}

.wizard-advanced summary {
  cursor: pointer;
  font-weight: 900;
}

.wizard-advanced label,
.wizard-advanced .reference-actions {
  display: block;
  margin-top: 10px;
}

.advanced-menu {
  margin-top: 16px;
}

.advanced-menu .admin-menu {
  margin-top: 12px;
}

.compact-title-row {
  margin-bottom: 10px;
}

.compact-title-row h2 {
  font-size: 20px;
}

.piece-lines-list {
  display: grid;
  gap: 10px;
}

.piece-line {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 110px 130px 130px 44px;
  gap: 8px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.rack-load-status {
  border: 2px solid #15803d;
  border-radius: 8px;
  padding: 12px 14px;
  background: #f0fdf4;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.rack-load-status strong,
.rack-load-status span {
  font-weight: 800;
}

.rack-load-warning {
  border-color: #ca8a04;
  background: #fffbeb;
}

.rack-load-danger {
  border-color: #b91c1c;
  background: #fff5f5;
}

.piece-line button {
  min-height: 44px;
}

.route-builder {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.route-builder-note {
  margin: 0 0 12px;
  color: var(--muted);
  font-weight: 700;
}

.route-step-list {
  display: grid;
  gap: 10px;
}

.route-step-row {
  display: grid;
  grid-template-columns: 44px minmax(160px, 1fr) minmax(160px, 1fr) minmax(220px, auto);
  gap: 8px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.route-step-number {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
  align-self: center;
}

.route-step-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.route-step-actions button {
  min-height: 44px;
  padding-inline: 8px;
}

.order-split-line {
  grid-template-columns: minmax(180px, 1fr) 110px minmax(160px, 0.8fr) minmax(160px, 1fr) 44px;
}

.travel-card-lines-preview {
  display: grid;
  gap: 6px;
  margin: 12px 0;
}

.travel-card-line-preview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  background: #f7fafb;
  font-weight: 800;
}

.capture-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}

.capture-label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.capture-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.capture-buttons button {
  min-height: 38px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 0 12px;
  background: #fff;
  color: var(--accent-strong);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.viewfinder {
  position: relative;
  overflow: hidden;
  min-height: 300px;
  border-radius: 8px;
  background: #111820;
}

.viewfinder video {
  position: relative;
  z-index: 0;
  display: block;
  width: 100%;
  height: 360px;
  object-fit: cover;
}

.viewfinder-grid {
  position: absolute;
  inset: 12%;
  border: 3px solid #dc2626;
  border-radius: 8px;
  pointer-events: none;
}

.viewfinder.ready .viewfinder-grid {
  border-color: #22c55e;
}

.viewfinder-grid::before,
.viewfinder-grid::after,
.viewfinder-grid span {
  content: "";
  position: absolute;
  background: #dc2626;
}

.viewfinder.ready .viewfinder-grid::before,
.viewfinder.ready .viewfinder-grid::after,
.viewfinder.ready .viewfinder-grid span {
  background: #22c55e;
}

.viewfinder-grid::before {
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
}

.viewfinder-grid::after {
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
}

.scan-target {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 86px;
  height: 86px;
  transform: translate(-50%, -50%);
  border: 3px solid #dc2626;
  border-radius: 50%;
  pointer-events: none;
}

.scan-target::before,
.scan-target::after {
  content: "";
  position: absolute;
  background: #dc2626;
}

.scan-target::before {
  left: 50%;
  top: -14px;
  bottom: -14px;
  width: 2px;
  transform: translateX(-50%);
}

.scan-target::after {
  top: 50%;
  left: -14px;
  right: -14px;
  height: 2px;
  transform: translateY(-50%);
}

.viewfinder.ready .scan-target,
.viewfinder.ready .scan-target::before,
.viewfinder.ready .scan-target::after {
  border-color: #22c55e;
  background-color: #22c55e;
}

.viewfinder.ready .scan-target {
  background-color: transparent;
}

.walk-path {
  position: absolute;
  z-index: 3;
  left: 14px;
  right: 14px;
  bottom: 14px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.walk-path button {
  position: relative;
  z-index: 4;
  min-height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 6px;
  background: rgba(17, 24, 32, 0.72);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
}

.walk-path button.active {
  border-color: var(--warm);
  background: rgba(244, 184, 96, 0.92);
  color: #17212b;
}

.camera-status {
  display: block;
  padding: 8px 10px;
  background: #17212b;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.camera-status[data-state="error"] {
  background: #991b1b;
}

.camera-status[data-state="success"] {
  background: #166534;
}

.capture-hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-weight: 700;
}

textarea {
  width: 100%;
  border: 1px solid #b9c4cf;
  border-radius: 6px;
  padding: 9px 11px;
  resize: vertical;
  font: inherit;
}

.analysis-output {
  display: grid;
  grid-template-columns: minmax(220px, 0.42fr) minmax(0, 1fr);
  gap: 18px;
  margin-bottom: 20px;
  padding: 18px;
}

.image-strip {
  display: grid;
  gap: 10px;
}

.image-strip img {
  width: 100%;
  max-height: 190px;
  object-fit: contain;
  border-radius: 6px;
  background: #111820;
}

.ai-result {
  overflow-x: auto;
}

.report-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.report-actions button {
  min-height: 38px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 0 12px;
  background: #fff;
  color: var(--accent-strong);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.travel-card-preview {
  border: 2px solid #101820;
  border-radius: 8px;
  padding: 16px;
  background: #fff;
  min-width: 900px;
  max-width: 1040px;
  margin-inline: auto;
}

.travel-card-header,
.travel-card-body,
.travel-card-route {
  display: grid;
  gap: 10px;
}

.travel-card-header {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border-bottom: 2px solid #101820;
  padding-bottom: 12px;
  margin-bottom: 10px;
}

.travel-card-header span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.travel-card-header strong {
  font-size: 26px;
  letter-spacing: 0;
}

.travel-card-subheader {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
  margin-bottom: 12px;
  color: var(--muted);
}

.travel-card-subheader strong {
  color: var(--ink);
}

.travel-card-body {
  grid-template-columns: 190px minmax(0, 1fr);
  align-items: start;
}

.travel-card-qr-wrap {
  display: grid;
  gap: 8px;
  align-content: start;
}

.travel-card-qr {
  width: 190px;
  min-height: 190px;
  border: 2px solid #101820;
  display: grid;
  place-items: center;
  text-align: center;
  overflow-wrap: anywhere;
  font-weight: 900;
  background: #fff;
}

.travel-card-qr svg {
  width: 172px;
  height: 172px;
}

.travel-card-qr-wrap span {
  display: block;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px;
  text-align: center;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.travel-card-body dl {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.travel-card-body div {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
}

.travel-card-body dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.travel-card-body dd {
  margin: 3px 0 0;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.travel-card-route {
  grid-template-columns: repeat(7, minmax(0, 1fr));
  margin-top: 12px;
}

.travel-card-route label {
  min-height: 44px;
  border: 1px solid #101820;
  border-radius: 6px;
  padding: 8px;
  font-weight: 800;
}

.travel-card-route-preview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.route-preview-step {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 1px solid #101820;
  border-radius: 6px;
  padding: 8px;
  font-weight: 900;
}

.route-preview-step span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #101820;
  color: #fff;
  font-size: 12px;
}

.route-preview-step strong {
  overflow-wrap: anywhere;
}

.travel-card-notes {
  min-height: 96px;
  border: 2px solid #101820;
  border-radius: 6px;
  margin-top: 12px;
  padding: 10px;
}

.travel-card-notes strong {
  display: block;
  margin-bottom: 6px;
}

.travel-card-notes p {
  margin: 0;
  min-height: 48px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.ai-result table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
}

.ai-result th,
.ai-result td {
  border: 1px solid var(--line);
  padding: 8px;
  text-align: left;
  vertical-align: top;
}

.ai-result th {
  background: var(--steel);
}

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

.report-kpis div,
.report-details div {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #f7fafb;
}

.report-kpis dt,
.report-details dt {
  color: var(--muted);
  font-weight: 800;
}

.report-kpis dd,
.report-details dd {
  margin: 4px 0 0;
  font-weight: 700;
}

.admin-shell {
  padding: 32px 0;
}

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

.admin-menu,
.admin-page-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.admin-menu.row,
.admin-page-grid.row,
.production-context.row,
.production-action-menu.row {
  display: flex;
}

.admin-menu a {
  min-height: 116px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 12px 30px rgba(23, 33, 43, 0.08);
}

.admin-menu strong,
.admin-menu span {
  display: block;
}

.admin-menu strong {
  margin-bottom: 8px;
  font-size: 19px;
  font-weight: 900;
}

.admin-menu span {
  color: var(--muted);
  font-weight: 700;
}

.admin-page-grid.wide-form {
  grid-template-columns: minmax(320px, 0.9fr) minmax(360px, 1.1fr);
}

.admin-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(23, 33, 43, 0.08);
}

.admin-panel h2 {
  margin: 0 0 12px;
  font-size: 20px;
  font-weight: 900;
}

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

.admin-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7fafb;
}

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

.admin-options label {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.admin-options input {
  width: 18px;
  min-height: 18px;
}

.admin-options strong {
  display: block;
  margin-bottom: 2px;
  font-weight: 900;
}

.hidden-admin-field {
  display: none;
}

.language-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 900;
}

.language-switcher a {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 8px;
  color: var(--ink);
  text-decoration: none;
}

.admin-form button {
  min-height: 40px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: #fff;
  color: var(--accent-strong);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.admin-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.admin-list article {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #f7fafb;
}

.employee-badge-qr {
  width: 96px;
  min-height: 96px;
  display: grid;
  place-items: center;
  margin: 8px 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.employee-badge-qr svg {
  width: 84px;
  height: 84px;
}

.admin-list article.inactive {
  background: #f1f3f4;
  opacity: 0.72;
}

.admin-list strong,
.admin-list span {
  display: block;
}

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

.admin-list button {
  margin-top: 8px;
  width: 100%;
}

.admin-camera {
  display: none;
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 220px;
  border-radius: 8px;
  overflow: hidden;
  background: #111820;
  box-shadow: 0 12px 30px rgba(23, 33, 43, 0.18);
}

.admin-camera.is-active {
  display: block;
}

.admin-camera video {
  display: block;
  width: 100%;
  min-height: 130px;
  object-fit: cover;
}

.production-camera {
  display: none;
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 220px;
  border-radius: 8px;
  overflow: hidden;
  background: #111820;
  box-shadow: 0 12px 30px rgba(23, 33, 43, 0.18);
}

.production-camera.is-active {
  display: block;
}

.production-camera video {
  display: block;
  width: 100%;
  min-height: 130px;
  object-fit: cover;
}

.scan-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 8px;
  align-items: stretch;
}

.scan-input input {
  min-width: 0;
}

.scan-input button {
  min-height: 44px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: #fff;
  color: var(--accent-strong);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.qr-label-panel {
  grid-column: span 3;
}

.email-template-panel,
.customer-template-panel,
.mail-settings-panel {
  grid-column: span 3;
}

.admin-page-grid .qr-label-panel,
.admin-page-grid .email-template-panel,
.admin-page-grid .customer-template-panel,
.admin-page-grid .mail-settings-panel,
.admin-shell > .qr-label-panel,
.admin-shell > .customer-template-panel,
.admin-shell > .mail-settings-panel {
  grid-column: auto;
}

.qr-source-list {
  display: none;
}

.qr-label-sheet {
  display: grid;
  justify-items: center;
  gap: 14px;
  margin-top: 16px;
  border: 2px solid #101820;
  border-radius: 8px;
  padding: 24px;
  background: #fff;
  text-align: center;
}

.qr-label-title {
  font-size: 42px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.qr-label-code {
  width: 360px;
  min-height: 360px;
  display: grid;
  place-items: center;
  border: 2px solid #101820;
  background: #fff;
}

.qr-label-code svg {
  width: 330px;
  height: 330px;
}

.qr-label-caption {
  font-size: 26px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.history-shell {
  padding: 8px 0 28px;
}

.production-shell {
  padding: 32px 0;
}

.production-message {
  margin-bottom: 16px;
  border-radius: 8px;
  padding: 12px 14px;
  font-weight: 800;
}

.production-message.success {
  border: 1px solid #86c69d;
  background: #f0fdf4;
  color: #14532d;
}

.production-message.error {
  border: 1px solid #f2b8ad;
  background: #fff4f2;
  color: #9f2d20;
}

.production-context,
.production-search,
.production-panel,
.production-results {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(23, 33, 43, 0.08);
}

.production-context {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
  padding: 16px;
}

.production-scan-panel {
  grid-template-columns: 1fr;
  gap: 14px;
}

.scan-hub-main {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
  gap: 12px;
}

.scan-hub-main button,
.scan-hub-actions button:first-child {
  min-height: 64px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 22px;
  font-weight: 900;
  cursor: pointer;
}

.scan-hub-main input {
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 16px;
  font: inherit;
  font-size: 20px;
  font-weight: 800;
}

.scan-hub-field {
  min-width: 0;
}

.scan-hub-actions {
  justify-content: stretch;
}

.scan-hub-actions button {
  flex: 1 1 0;
}

.scan-hub-status {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #f7fafc;
  color: var(--muted);
  font-weight: 800;
}

.scan-hub-status[data-state="success"] {
  border-color: #b8dfc2;
  background: #f0fff4;
  color: #206b39;
}

.scan-hub-status[data-state="error"] {
  border-color: #f2b8ad;
  background: #fff4f2;
  color: #9f2d20;
}

.scan-hub-status[data-state="loading"],
.scan-hub-status[data-state="waiting"] {
  border-color: #cfd8e3;
  background: #f6f8fb;
}

.production-manual-menu {
  margin-top: 16px;
}

.production-manual-menu summary {
  cursor: pointer;
  color: var(--accent-strong);
  font-weight: 900;
}

.production-context span,
.production-search span,
.production-form span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.context-actions {
  display: flex;
  gap: 8px;
}

.context-actions button,
.production-search button,
.production-form button {
  min-height: 44px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: #fff;
  color: var(--accent-strong);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.production-form button {
  grid-column: 1 / -1;
  background: var(--accent);
  color: #fff;
}

.production-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
  padding: 16px;
}

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

.production-action-menu {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.production-action-menu a {
  min-height: 170px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 12px 30px rgba(23, 33, 43, 0.08);
}

.production-action-menu strong,
.production-action-menu span {
  display: block;
}

.production-action-menu strong {
  font-size: 24px;
  font-weight: 900;
}

.production-action-menu span {
  margin-top: 8px;
  color: var(--muted);
  font-weight: 800;
}

.narrow-production {
  max-width: 760px;
  margin-inline: auto;
}

.production-panel,
.production-results {
  padding: 18px;
}

.production-panel h2,
.production-results h2,
.production-result-grid h3 {
  margin: 0 0 12px;
  font-weight: 900;
}

.production-panel h2 {
  font-size: 20px;
}

.production-info {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
  border: 1px solid #b7d4ea;
  border-radius: 8px;
  padding: 12px;
  background: #eef7ff;
  color: #183247;
}

.production-info strong,
.production-info span {
  display: block;
}

.production-info strong {
  font-weight: 900;
}

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

.production-form.single-flow {
  grid-template-columns: 1fr;
}

.production-form details {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f7fafb;
}

.production-form summary {
  cursor: pointer;
  font-weight: 900;
}

.production-form details label {
  display: block;
  margin-top: 10px;
}

.production-form .wide-field {
  grid-column: 1 / -1;
}

.production-results {
  margin-top: 18px;
}

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

.production-result-grid article {
  display: grid;
  gap: 2px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #f7fafb;
}

.production-result-grid strong,
.production-result-grid span {
  display: block;
}

.production-result-grid span {
  color: var(--muted);
  font-size: 13px;
}

.history-panel,
.history-result {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fff;
  margin-bottom: 16px;
}

.history-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: end;
}

.history-search.row {
  display: flex;
}

.history-search label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-weight: 800;
}

.history-search button {
  min-height: 44px;
}

.history-camera {
  display: none;
  width: 100%;
  max-height: 340px;
  margin-top: 14px;
  border: 2px solid var(--accent);
  border-radius: 8px;
  object-fit: cover;
  background: #101820;
}

.history-title span {
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.history-title h2 {
  margin-bottom: 4px;
}

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

.history-facts div,
.history-empty {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #f7fafb;
}

.history-facts dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.history-facts dd {
  margin: 3px 0 0;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.history-empty strong,
.history-empty span {
  display: block;
}

.history-empty span {
  margin-top: 4px;
  color: var(--muted);
}

.model-note,
.error-box {
  padding: 10px 12px;
  border-radius: 6px;
  background: #f7fafb;
  border: 1px solid var(--line);
}

.error-box {
  grid-column: 1 / -1;
  background: #fff4f2;
  border-color: #f2b8ad;
  color: #9f2d20;
  font-weight: 700;
}

.calculator-panel {
  padding: 22px;
}

fieldset {
  margin: 0 0 24px;
  padding: 0;
  border: 0;
}

fieldset:last-child {
  margin-bottom: 0;
}

legend,
.formula-box h2 {
  margin-bottom: 12px;
  font-size: 18px;
  font-weight: 800;
}

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

.shape-option {
  position: relative;
  min-height: 58px;
  margin: 0;
  cursor: pointer;
}

.shape-option input {
  position: absolute;
  opacity: 0;
}

.shape-option span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--steel);
  text-align: center;
  font-weight: 700;
}

.shape-option input:checked + span {
  border-color: var(--accent);
  background: #dff3ef;
  color: var(--accent-strong);
  box-shadow: inset 0 0 0 2px var(--accent);
}

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

label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.field-help-button {
  display: inline-grid;
  place-items: center;
  width: 24px;
  min-width: 24px;
  height: 24px;
  min-height: 24px;
  margin: 0 0 6px 6px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--accent-strong);
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
  cursor: help;
}

label > span:first-child {
  display: inline-block;
}

.check-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding-top: 21px;
}

.check-field input {
  width: 20px;
  min-height: 20px;
}

.check-field span {
  margin: 0;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid #b9c4cf;
  border-radius: 6px;
  padding: 9px 11px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(15, 118, 110, 0.2);
  border-color: var(--accent);
}

.result-panel {
  position: sticky;
  top: 20px;
  padding: 22px;
}

.result-main {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.result-list {
  margin: 18px 0;
}

.result-list div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.result-list dt {
  color: var(--muted);
  font-weight: 700;
}

.result-list dd {
  margin: 0;
  text-align: right;
  font-weight: 800;
}

.formula-box {
  padding: 16px;
  border-radius: 8px;
  background: #f7fafb;
  border: 1px solid var(--line);
}

.formula-box h2 {
  margin-top: 0;
}

.formula-box p {
  margin: 0;
  color: #3f4d59;
  line-height: 1.5;
}

@media (max-width: 1024px) {
  html {
    font-size: 17px;
  }

  body {
    background: #f5f7f9;
  }

  .container {
    width: 100%;
    max-width: none;
    padding-right: 18px;
    padding-left: 18px;
  }

  .app-heading,
  .workspace-grid,
  .analysis-output {
    display: block;
  }

  .surface-entry-card {
    display: block;
  }

  .surface-entry-actions {
    justify-content: flex-start;
    margin-top: 12px;
  }

  .app-heading {
    margin-bottom: 18px;
  }

  .app-heading .secondary-link,
  .language-switcher {
    display: inline-flex;
    margin: 10px 8px 0 0;
    vertical-align: top;
  }

  h1 {
    font-size: 32px;
    line-height: 1.12;
  }

  .calculator-shell,
  .admin-shell,
  .production-shell {
    padding: 18px 0;
  }

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

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

  .piece-line {
    grid-template-columns: 1fr 96px 130px;
  }

  .piece-line label:first-child,
  .order-split-line label:first-child,
  .order-split-line label:nth-child(4) {
    grid-column: 1 / -1;
  }

  .ai-panel,
  .calculator-panel,
  .analysis-output,
  .result-panel,
  .admin-panel,
  .production-context,
  .production-search,
  .production-panel,
  .production-results {
    box-shadow: none;
  }

  .ai-grid,
  .field-grid,
  .admin-grid,
  .production-grid,
  .production-result-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wide-field,
  .qr-label-panel,
  .email-template-panel,
  .customer-template-panel,
  .mail-settings-panel {
    grid-column: 1 / -1;
  }

  .admin-grid,
  .admin-menu,
  .admin-page-grid,
  .admin-page-grid.wide-form {
    grid-template-columns: 1fr;
  }

  .admin-menu a,
  .production-action-menu a {
    min-height: auto;
    padding: 16px;
  }

  .history-search,
  .history-facts,
  .production-context,
  .production-search,
  .production-action-menu {
    grid-template-columns: 1fr;
  }

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

  .production-context {
    align-items: stretch;
  }

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

  .admin-camera,
  .production-camera {
    position: static;
    width: 100%;
    margin-top: 16px;
  }

  .admin-camera video,
  .production-camera video {
    min-height: 220px;
    max-height: 320px;
  }

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

  input,
  select,
  textarea,
  .primary-button,
  .secondary-link,
  .scan-input button,
  .admin-form button,
  .production-form button,
  .production-search button,
  .context-actions button {
    min-height: 48px;
  }

  .total-badge,
  .result-panel {
    margin-top: 16px;
  }

  .result-panel {
    position: static;
  }
}

@media (max-width: 620px) {
  .calculator-shell {
    padding: 18px 0;
  }

  h1 {
    font-size: 28px;
  }

  .shape-grid,
  .field-grid,
  .ai-grid,
  .production-grid,
  .production-result-grid {
    grid-template-columns: 1fr;
  }

  .panel-title-row {
    display: block;
  }

  .primary-button {
    width: 100%;
    margin-top: 14px;
  }

  .wide-field {
    grid-column: span 1;
  }

  .qr-station {
    grid-template-columns: 1fr;
  }

  .travel-card-header,
  .travel-card-body,
  .travel-card-body dl,
  .travel-card-route {
    grid-template-columns: 1fr;
  }

  .travel-card-body {
    grid-template-columns: 1fr;
  }

  .travel-card-body dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .scan-input,
  .scan-hub-main,
  .context-actions,
  .piece-line,
  .route-step-row,
  .route-step-actions {
    grid-template-columns: 1fr;
  }

  .admin-options {
    grid-template-columns: 1fr;
  }
}

@media print {
  @page {
    size: A4 landscape;
    margin: 10mm;
  }

  body.printing-qr-label {
    margin: 0 !important;
    background: #fff !important;
  }

  body.printing-qr-label * {
    visibility: hidden !important;
  }

  body.printing-qr-label .qr-label-panel,
  body.printing-qr-label .qr-label-panel * {
    visibility: visible !important;
  }

  body {
    background: #fff;
  }

  .calculator-panel,
  .result-panel,
  .app-heading,
  .report-actions {
    display: none;
  }

  .ai-panel {
    display: block;
    border: 0;
    box-shadow: none;
    padding: 0;
  }

  .ai-panel > * {
    display: none;
  }

  .ai-panel .ai-grid {
    display: block;
  }

  .ai-panel .ai-grid > * {
    display: none;
  }

  .ai-panel .travel-card-preview {
    display: block;
    break-inside: avoid;
  }

  .travel-card-header button {
    display: none;
  }

  body.printing-travel-card header,
  body.printing-travel-card footer,
  body.printing-travel-card .calculator-shell > *:not(.ai-panel),
  body.printing-travel-card .ai-panel > *:not(.ai-grid),
  body.printing-travel-card .ai-grid > *:not(.travel-card-preview),
  body.printing-travel-card .workspace-grid,
  body.printing-travel-card .analysis-output {
    display: none !important;
  }

  body.printing-travel-card .container,
  body.printing-travel-card main,
  body.printing-travel-card .calculator-shell,
  body.printing-travel-card .ai-panel,
  body.printing-travel-card .ai-grid {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
  }

  body.printing-travel-card .travel-card-preview {
    width: 100%;
    max-width: none;
    min-height: 0;
    border: 3px solid #000;
    color: #000;
  }

  body.printing-travel-card .travel-card-body {
    grid-template-columns: 46mm minmax(0, 1fr);
  }

  body.printing-travel-card .travel-card-qr {
    width: 46mm;
    min-height: 46mm;
  }

  body.printing-travel-card .travel-card-qr svg {
    width: 42mm;
    height: 42mm;
  }

  body.printing-travel-card .travel-card-body dl {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  body.printing-travel-card .travel-card-route {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }

  body.printing-travel-card .travel-card-qr {
    border-color: #000;
  }

  body.printing-qr-label header,
  body.printing-qr-label footer,
  body.printing-qr-label main > *:not(.admin-shell),
  body.printing-qr-label .admin-shell > *:not(.qr-label-panel),
  body.printing-qr-label .admin-panel:not(.qr-label-panel),
  body.printing-qr-label .app-heading,
  body.printing-qr-label .admin-page-grid,
  body.printing-qr-label .qr-source-list,
  body.printing-qr-label .admin-camera,
  body.printing-qr-label .qr-label-panel h2,
  body.printing-qr-label .qr-label-panel .admin-form {
    display: none !important;
  }

  body.printing-qr-label .container,
  body.printing-qr-label main,
  body.printing-qr-label .admin-shell,
  body.printing-qr-label .qr-label-panel {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
  }

  body.printing-qr-label .qr-label-panel {
    position: fixed !important;
    inset: 0 !important;
    overflow: hidden !important;
  }

  body.printing-qr-label .qr-label-sheet {
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) auto;
    align-items: center;
    justify-items: center;
    width: 100% !important;
    height: 180mm !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 14mm !important;
    border: 4px solid #000;
    page-break-inside: avoid;
    break-inside: avoid;
    overflow: hidden !important;
  }

  body.printing-qr-label .qr-label-code {
    display: grid !important;
    place-items: center;
    width: 100%;
    min-height: 0;
  }

  body.printing-qr-label .qr-label-code svg {
    width: 95mm !important;
    height: 95mm !important;
  }

  .analysis-output {
    display: block;
    border: 0;
    box-shadow: none;
    padding: 0;
  }

  .image-strip {
    grid-template-columns: repeat(3, 1fr);
    margin-bottom: 12px;
  }

  .image-strip img {
    max-height: 140px;
  }
}
