@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/dm-sans.woff2") format("woff2");
}

/* Reisvenne-Oranje identiteit */
body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 92% 4%, rgba(255, 125, 23, 0.34) 0 9rem, transparent 9.1rem),
    linear-gradient(145deg, #ffd7b8 0%, var(--bg) 54%, #ffbd8a 100%);
}

/* Schaaltekening-meetwerkruimte */
body.scale-drawing-open {
  overflow: hidden;
}

.modal.scale-drawing-modal {
  z-index: 260;
}

.modal-dialog.scale-drawing-dialog {
  display: flex;
  flex-direction: column;
  width: calc(100vw - 24px);
  height: calc(100vh - 24px);
  max-height: none;
  margin: 12px auto;
  overflow: hidden;
}

.scale-drawing-head {
  flex: 0 0 auto;
  align-items: center;
}

.scale-drawing-head h2,
.scale-drawing-head p,
.scale-drawing-inspector h3 {
  margin: 0;
}

.scale-drawing-head-actions,
.scale-drawing-manager,
.scale-tool-grid,
.scale-view-controls > div,
.scale-area-controls > div,
.scale-formula-operators,
.scale-formula-add,
.scale-result-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.scale-drawing-manager {
  flex: 0 0 auto;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.scale-drawing-manager label {
  display: grid;
  gap: 3px;
  min-width: 190px;
  color: var(--muted);
  font-size: 11px;
}

.scale-drawing-manager label:nth-child(2) {
  flex: 1;
}

.scale-drawing-manager .secondary-file-button {
  display: inline-flex;
  min-width: auto;
  color: inherit;
  font-size: 13px;
}

.scale-drawing-empty {
  display: grid;
  flex: 1;
  place-content: center;
  gap: 8px;
  text-align: center;
  color: var(--muted);
}

.scale-drawing-empty strong {
  color: var(--text);
  font-size: 20px;
}

.scale-drawing-workspace {
  display: grid;
  grid-template-columns: 230px minmax(320px, 1fr) 360px;
  flex: 1;
  min-height: 0;
}

.scale-drawing-tools,
.scale-drawing-inspector {
  min-height: 0;
  overflow: auto;
  background: var(--surface);
}

.scale-drawing-tools {
  padding: 12px;
  border-right: 1px solid var(--line);
}

.scale-drawing-inspector {
  border-left: 1px solid var(--line);
}

.scale-drawing-inspector > section {
  display: grid;
  gap: 9px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.scale-tool-group,
.scale-calibration-panel,
.scale-area-controls,
.scale-view-controls {
  display: grid;
  gap: 9px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.scale-tool-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.scale-tool-grid button,
.scale-area-controls button,
.scale-formula-operators button,
.scale-view-controls button {
  min-height: 36px;
  padding: 6px 8px;
}

.scale-tool-grid button.active,
.scale-area-controls button.active {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
  color: #fff;
}

.scale-calibration-panel {
  padding: 10px;
  border: 1px solid #d8c5e7;
  border-radius: 7px;
  background: #faf5fe;
}

.scale-calibration-panel.ready {
  border-color: #bdd5c6;
  background: #f2f8f4;
}

.scale-calibration-panel p,
.scale-attach-panel p,
.scale-drawing-tools > p {
  margin: 0;
  font-size: 12px;
}

.scale-calibration-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 62px;
  gap: 6px;
}

.scale-calibration-fields button {
  grid-column: 1 / -1;
}

.scale-canvas-wrap {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #dce2dc;
}

#scaleDrawingCanvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

#scaleDrawingCanvas:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
}

.scale-result-list {
  display: grid;
  gap: 7px;
}

.scale-result-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px 10px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.scale-result-row.selected {
  border-color: var(--accent-dark);
  box-shadow: inset 3px 0 var(--accent-dark);
}

.scale-result-row > div:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.scale-result-row input {
  width: 100%;
  min-height: 30px;
  padding: 4px 6px;
  font-weight: 650;
}

.scale-result-row span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
}

.scale-result-row > strong {
  align-self: center;
  white-space: nowrap;
}

.scale-result-actions {
  grid-column: 1 / -1;
  justify-content: flex-end;
}

.scale-result-actions button {
  min-height: 30px;
  padding: 4px 7px;
  font-size: 11px;
}

.scale-formula-builder label,
.scale-attach-panel label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.scale-formula-tokens {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 42px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.scale-formula-tokens span:not(.muted) {
  padding: 3px 6px;
  border-radius: 4px;
  background: var(--surface-soft);
  font-size: 12px;
}

.scale-formula-add select,
.scale-formula-add input {
  min-width: 0;
  flex: 1;
}

.scale-formula-add button {
  flex: 0 0 auto;
}

.scale-formula-operators {
  flex-wrap: wrap;
}

.scale-formula-operators button {
  min-width: 36px;
}

.scale-formula-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#scaleFormulaPreview.error {
  color: var(--danger);
}

@media (max-width: 1050px) {
  .scale-drawing-workspace {
    grid-template-columns: 190px minmax(280px, 1fr) 310px;
  }
}

@media (max-width: 820px) {
  .modal-dialog.scale-drawing-dialog {
    width: 100vw;
    height: 100vh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  .scale-drawing-head,
  .scale-drawing-manager {
    align-items: stretch;
    flex-direction: column;
  }

  .scale-drawing-head-actions {
    flex-wrap: wrap;
  }

  .scale-drawing-manager label {
    width: 100%;
    min-width: 0;
  }

  .scale-drawing-workspace {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(340px, 58vh) auto;
    overflow: auto;
  }

  .scale-drawing-tools,
  .scale-drawing-inspector {
    overflow: visible;
    border: 0;
  }

  .scale-drawing-tools {
    border-bottom: 1px solid var(--line);
  }

  .scale-tool-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .scale-canvas-wrap {
    min-height: 340px;
  }
}

h1,
h2,
h3 {
  color: #000;
  font-weight: 800;
  letter-spacing: -0.025em;
}

h1 { font-size: clamp(28px, 3vw, 42px); line-height: 1; }
h2 { font-size: 21px; }

.app-login-screen {
  overflow: hidden;
  background:
    radial-gradient(circle at 12% 88%, #ff7d17 0 11rem, transparent 11.1rem),
    radial-gradient(circle at 92% 8%, rgba(255, 125, 23, 0.5) 0 15rem, transparent 15.1rem),
    #ffc99f;
}

.app-login-card {
  position: relative;
  gap: 18px;
  width: min(470px, 100%);
  padding: 34px;
  border: 2px solid #000;
  border-radius: 28px;
  background: rgba(255, 250, 246, 0.96);
  box-shadow: 12px 12px 0 rgba(0, 0, 0, 0.95);
}

.login-brand,
.app-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.brand-logo {
  flex: 0 0 auto;
  width: 86px;
  height: 64px;
  object-fit: contain;
  object-position: center;
}

.login-brand-logo {
  width: 106px;
  height: 78px;
}

.brand-copy { min-width: 0; }

.brand-kicker {
  display: block;
  margin-bottom: 5px;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.12em;
  line-height: 1.2;
  text-transform: uppercase;
}

.app-header {
  position: relative;
  align-items: center;
  padding: 18px 28px;
  border-bottom: 4px solid var(--accent);
  background: rgba(255, 250, 246, 0.96);
  box-shadow: 0 5px 18px rgba(99, 46, 9, 0.12);
}

.app-header::after {
  position: absolute;
  right: 0;
  bottom: -4px;
  width: 18%;
  height: 4px;
  background: #000;
  content: "";
}

.app-header h1 { font-size: 30px; }
.app-header p { color: var(--muted); }

button,
.file-button {
  min-height: 40px;
  border-width: 2px;
  border-radius: 999px;
  color: #111;
  font-weight: 750;
  transition: transform 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}

button:hover:not(:disabled),
.file-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.16);
}

.secondary-button,
.secondary-file-button {
  border-color: var(--accent);
  background: #fffaf6;
  color: #8b3900;
}

.danger-button { color: #fff; }

input,
select,
textarea {
  border-color: #d99a6b;
  border-radius: 11px;
  background: #fff;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(255, 125, 23, 0.2);
}

main { max-width: 1800px; margin: 0 auto; }

.toolbar {
  position: sticky;
  z-index: 20;
  top: 0;
  padding: 12px 0;
  background: rgba(255, 201, 159, 0.92);
  backdrop-filter: blur(10px);
}

.tabs {
  gap: 4px;
  padding: 4px;
  border: 2px solid rgba(0, 0, 0, 0.82);
  border-radius: 999px;
  background: #fffaf6;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.82);
}

.tab {
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #1c1713;
}

.tab.active {
  background: var(--accent);
  color: #000;
  box-shadow: none;
}

.table-wrap,
.weekend-card,
.kpi-card,
.user-editor,
.scanner-camera-card,
.scanner-selection-card,
.component-row,
.object-input-card {
  border-color: #df9f70;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 6px 18px rgba(110, 52, 12, 0.08);
}

.table-wrap { overflow: auto; }

th { background: #ffe2cb; color: #20160f; }
tfoot th,
tfoot td { background: #fff0e4; }

tbody tr:hover td { background-color: rgba(255, 125, 23, 0.075); }

.status-badge,
.priority-badge,
.progress-badge { border-radius: 999px; }

.kpi-card strong { color: #000; }

.modal-dialog {
  border: 2px solid #000;
  border-radius: 24px;
  box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.72);
}

@media (max-width: 900px) {
  .app-header {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
  }

  .app-header .actions {
    padding-top: 12px;
    border-top: 1px solid var(--line);
  }

  .toolbar { top: 0; }
}

@media (max-width: 650px) {
  body {
    background: linear-gradient(160deg, #ffd6b6, var(--bg));
  }

  .app-header { padding: 12px 14px 14px; }
  .brand-logo { width: 65px; height: 50px; }
  .app-header h1 { font-size: 24px; }
  .brand-kicker { font-size: 9px; }

  .app-header .actions {
    flex-wrap: nowrap;
    padding-bottom: 5px;
    overflow-x: auto;
  }

  .app-header .actions > * { flex: 0 0 auto; }

  .toolbar {
    margin: 0 -12px 12px;
    padding: 9px 12px 12px;
  }

  .tabs {
    border-width: 1px;
    border-radius: 16px;
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.75);
  }

  .tab { min-height: 42px; padding-inline: 13px; }

  .section-head h2 { font-size: 20px; }

  .app-login-card {
    padding: 24px;
    border-radius: 22px;
    box-shadow: 7px 7px 0 #000;
  }

  .login-brand-logo { width: 80px; height: 60px; }
}

@media print {
  body { background: #fff; }
  button,
  .file-button { box-shadow: none; }
}

:root {
  color-scheme: light;
  font-family: "DM Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #ffc99f;
  --surface: #fffaf6;
  --surface-soft: #fff0e4;
  --line: #e7aa7a;
  --text: #11100f;
  --muted: #6d5546;
  --accent: #ff7d17;
  --accent-dark: #b94700;
  --danger: #b9342b;
  --warning-bg: #fff1c7;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

[hidden] { display: none !important; }

body:not(.app-authenticated) .app-header,
body:not(.app-authenticated) main { display: none; }

.app-login-screen {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: linear-gradient(145deg, #edf2ec, #dce8df);
}

.app-login-screen.hidden { display: none; }

.app-login-card {
  display: grid;
  gap: 16px;
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 18px 50px rgba(30, 48, 37, 0.16);
}

.app-login-card h1,
.app-login-card p { margin: 0; }

.app-user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
}

.app-user-menu span { font-weight: 750; }

.settings-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.75fr) minmax(420px, 1.5fr);
  gap: 18px;
  align-items: start;
}

.users-list,
.user-editor {
  display: grid;
  gap: 10px;
}

.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  text-align: left;
}

.user-row:hover { background: var(--surface-soft); }
.user-row strong,
.user-row small { display: block; }
.user-row small { margin-top: 3px; color: var(--muted); }
.user-row > span:last-child { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.status-badge.inactive { background: #ececea; color: #666; }

.user-editor {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.user-flags,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.user-flags label { display: flex; align-items: center; gap: 7px; }
.user-flags input { width: auto; }

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

.permission-editor fieldset {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.permission-editor legend { padding: 0 5px; font-weight: 800; }
.permission-editor label { display: flex; align-items: flex-start; gap: 7px; font-weight: 500; }
.permission-editor input { flex: 0 0 auto; width: auto; margin-top: 2px; }
.permission-editor.disabled { opacity: 0.48; }

body.cannot-edit-input #input button,
body.cannot-edit-input #input select,
body.cannot-edit-input #input input:not(#flowerFilter),
body.cannot-edit-flowers #flowers form,
body.cannot-edit-parts #parts button,
body.cannot-edit-parts #parts input,
body.cannot-edit-parts #parts select,
body.cannot-edit-parts #parts textarea {
  pointer-events: none;
  opacity: 0.5;
}

button,
input,
select {
  font: inherit;
}

button,
.file-button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 6px;
  cursor: pointer;
}

.secondary-button {
  background: #fff;
  color: var(--accent-dark);
}

.danger-button {
  border-color: var(--danger);
  background: var(--danger);
}

.danger-button:hover {
  background: #8d2d23;
}

button:hover,
.file-button:hover {
  background: var(--accent-dark);
}

.secondary-button:hover {
  background: #edf1ea;
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

input,
select {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
}

select {
  width: 100%;
}

input[type="number"] {
  width: 92px;
  text-align: right;
}

.app-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 28px 18px;
  background: #e8ede6;
  border-bottom: 1px solid var(--line);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  font-weight: 700;
}

h2 {
  font-size: 18px;
}

.app-header p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 14px;
}

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

.file-button {
  display: inline-flex;
  align-items: center;
}

.file-button input {
  display: none;
}

main {
  padding: 20px 28px 40px;
}

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

.tabs {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  background: var(--surface);
}

.tab {
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  color: var(--text);
}

.tab:last-child {
  border-right: 0;
}

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

.status {
  min-height: 22px;
  font-size: 14px;
  color: var(--muted);
}

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

.panel {
  display: none;
}

.panel.active {
  display: block;
}

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

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

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  background: var(--surface);
  max-height: calc(100vh - 205px);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}

th,
td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 7px 8px;
  white-space: nowrap;
  font-size: 14px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #edf1ea;
  text-align: left;
  font-weight: 650;
}

tfoot th,
tfoot td {
  background: #f6f8f3;
  font-weight: 700;
}

tfoot th {
  position: static;
}

tfoot .object-remaining-row th,
tfoot .object-remaining-row td {
  background: #fff;
  color: var(--muted);
  font-weight: 600;
}

.sort-header {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-weight: 650;
  text-align: inherit;
  cursor: pointer;
}

.sort-header:hover,
.sort-header.active {
  background: transparent;
  color: var(--accent-dark);
}

th.number .sort-header {
  justify-content: flex-end;
}

td.number,
th.number {
  text-align: right;
}

tr.warn td {
  background: var(--warning-bg);
}

.flower-cell {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 190px;
}

.flower-thumb {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #f0f2ee;
}

.flower-thumb.small {
  width: 28px;
  height: 28px;
  flex-basis: 28px;
}

.flower-name {
  display: block;
  font-weight: 650;
}

[data-preview-image] {
  cursor: zoom-in;
}

.flower-meta {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.color-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px 2px 4px;
  background: #fff;
  font-size: 12px;
}

.color-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 1px solid rgba(0, 0, 0, 0.22);
  border-radius: 50%;
  background: #d5d9d0;
}

.rgb-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 132px;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: copy;
}

.rgb-chip:hover {
  background: transparent;
  color: var(--accent-dark);
}

.rgb-swatch {
  display: inline-block;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border: 1px solid rgba(0, 0, 0, 0.26);
  border-radius: 5px;
  background: #d5d9d0;
}

.rgb-chip strong,
.rgb-chip small {
  display: block;
}

.rgb-chip small {
  color: var(--muted);
  font-size: 11px;
}

.rgb-cell {
  display: grid;
  gap: 6px;
  min-width: 144px;
}

.color-rgb-cell {
  display: grid;
  gap: 6px;
  min-width: 150px;
}

.color-rgb-cell .rgb-chip {
  min-width: 0;
}

.planting-indicator {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 104px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.planting-indicator.empty {
  min-width: 0;
  font-weight: 500;
}

.planting-dots {
  display: inline-grid;
  grid-template-columns: repeat(5, 6px);
  gap: 2px;
}

.planting-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #d9ded4;
}

.planting-indicator.level-1 .active {
  background: #b33b2e;
}

.planting-indicator.level-2 .active {
  background: #d1892f;
}

.planting-indicator.level-3 .active {
  background: #75856d;
}

.planting-indicator.level-4 .active {
  background: #4d8a62;
}

.planting-indicator.level-5 .active {
  background: #276a55;
}

.planting-label {
  white-space: nowrap;
}

.matrix-flower {
  display: grid;
  gap: 3px;
  min-width: 120px;
}

.group-row th {
  position: static;
  background: #e8ede6;
  color: var(--text);
  border-top: 2px solid var(--line);
}

.image-preview {
  position: fixed;
  z-index: 50;
  width: 272px;
  padding: 10px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 120ms ease, transform 120ms ease;
  border: 1px solid rgba(31, 42, 36, 0.18);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(31, 42, 36, 0.22);
}

.image-preview.visible {
  opacity: 1;
  transform: translateY(0);
}

.image-preview img {
  display: block;
  width: 250px;
  height: 250px;
  object-fit: cover;
  border-radius: 6px;
  background: #f0f2ee;
}

.image-preview div {
  margin-top: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sticky-col {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fff;
  min-width: 170px;
}

th.sticky-col {
  z-index: 3;
  background: #edf1ea;
}

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

.rgb-override-form {
  flex-wrap: wrap;
  margin: 0 0 10px;
}

.rgb-override-form input {
  min-width: 150px;
}

.component-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 430px), 1fr));
  align-items: start;
  gap: 12px;
}

.weekend-tab {
  font-weight: 700;
}

.prep-tables-tab {
  font-weight: 700;
}

.weekend-panel {
  max-width: 1500px;
  margin: 0 auto;
}

.weekend-empty {
  max-width: 560px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.weekend-empty p {
  margin: 8px 0 18px;
}

.stack-form {
  display: grid;
  gap: 12px;
}

.stack-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.weekend-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.weekend-alerts {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.weekend-alert {
  padding: 10px 12px;
  border: 1px solid #e0bd59;
  border-radius: 8px;
  background: var(--warning-bg);
  color: #694e08;
}

.weekend-alert.danger {
  border-color: #dda59e;
  background: #fff0ee;
  color: var(--danger);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.kpi-card {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}

.kpi-card span,
.kpi-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.kpi-card strong {
  display: block;
  margin: 3px 0;
  font-size: 26px;
}

.weekend-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}

.weekend-actions-grid {
  grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
}

.weekend-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  margin-bottom: 14px;
}

.weekend-grid .weekend-card {
  margin-bottom: 0;
}

.weekend-card h3 {
  margin: 0 0 12px;
}

.compact-form {
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.two-fields {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 8px;
}

.stack-form .check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 500;
}

.check-row input {
  min-height: 0;
}

.availability {
  min-height: 38px;
  padding: 9px;
  border-radius: 6px;
  background: #edf4ef;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 650;
}

.surplus-current {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.surplus-current h4 {
  margin: 0 0 8px;
  font-size: 13px;
}

.surplus-chip-list {
  display: grid;
  gap: 6px;
}

.surplus-chip-list span {
  padding: 8px 10px;
  border-radius: 7px;
  background: #fff3dc;
  color: #6e4516;
  font-size: 12px;
}

.recommendation-list,
.component-progress-list {
  display: grid;
  gap: 8px;
}

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

.session-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.session-row strong,
.session-row small {
  display: block;
}

.session-row small {
  margin-top: 3px;
  color: var(--muted);
}

.session-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.mobile-weekend-nav {
  display: none;
}

.recommendation-row,
.component-progress {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.component-extra-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.component-extra-list span {
  padding: 4px 7px;
  border: 1px solid #e4bd70;
  border-radius: 999px;
  background: #fff7e6;
  color: #684c09;
  font-size: 11px;
}

.component-progress-list.expanded { gap: 20px; }
.component-progress.expanded {
  --component-accent: #c8681d;
  --component-soft: #fff0e3;
  display: block;
  padding: 0;
  overflow: hidden;
  border: 2px solid var(--component-accent);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 5px 14px rgba(52, 39, 28, .12);
}

.component-progress-list.expanded > .component-progress:nth-child(5n + 1) { --component-accent: #c65f18; --component-soft: #ffead9; }
.component-progress-list.expanded > .component-progress:nth-child(5n + 2) { --component-accent: #3679af; --component-soft: #e5f1fb; }
.component-progress-list.expanded > .component-progress:nth-child(5n + 3) { --component-accent: #3b8052; --component-soft: #e5f3e9; }
.component-progress-list.expanded > .component-progress:nth-child(5n + 4) { --component-accent: #7659a8; --component-soft: #eee8f8; }
.component-progress-list.expanded > .component-progress:nth-child(5n + 5) { --component-accent: #a94f59; --component-soft: #f8e7e9; }
.component-progress.expanded.completed { --component-accent: #2f8550; --component-soft: #dff2e5; background: #f4fbf6; box-shadow: 0 5px 16px rgba(47, 133, 80, .2); }
.component-progress.expanded.completed .progress-track > span { width: 100%; background: #2f8550; }
.component-completed-badge { display: inline-flex; margin-left: 9px; padding: 3px 8px; border-radius: 999px; background: #2f8550; color: #fff; font-size: 10px; font-weight: 850; vertical-align: 2px; }

.component-progress-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 14px;
  padding: 10px 12px;
  border-bottom: 2px solid var(--component-accent);
  background: var(--component-soft);
  box-shadow: inset 7px 0 var(--component-accent);
}

.component-progress-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.component-progress-title > div { min-width: 0; flex: 1; }
.component-part-number {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border-radius: 9px;
  background: var(--component-accent);
  color: #fff;
  font-size: 15px;
  font-weight: 900;
}
.component-progress-head h4 { margin: 0 0 1px; font-size: 18px; }
.component-progress-head small { color: var(--muted); }
.component-progress-head .progress-track { max-width: 480px; }
.component-part-label { color: var(--accent-dark); font-size: 10px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.component-priority-field { display: grid; gap: 4px; min-width: 175px; color: var(--muted); font-size: 11px; font-weight: 750; }
.component-priority-field .priority-select { width: 100%; }
.component-progress-actions { display: flex; align-items: end; justify-content: flex-end; gap: 8px; }
.component-stock-book-button { min-height: 40px; white-space: nowrap; }

.component-flower-status-list { display: grid; gap: 6px; padding: 8px; }
.component-flower-status {
  display: grid;
  grid-template-columns: minmax(185px, .8fr) minmax(300px, 1.15fr) minmax(285px, 1.15fr);
  align-items: stretch;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.component-flower-status.extra { border-color: #c18a20; }
.component-flower-status.deviation { border-color: #c76c4a; }
.component-flower-status.completed { border-color: #328552; box-shadow: inset 5px 0 #328552; }
.component-flower-status.completed > header,
.component-flower-status.completed .component-stage,
.component-flower-status.completed .component-source-list { background: #e7f5eb; }
.component-flower-status.completed .component-stage { box-shadow: none; }
.component-crate-book-button { display: inline-flex; align-items: center; gap: 6px; }
.component-crate-book-button span { display: inline-grid; min-width: 21px; height: 21px; padding: 0 5px; place-items: center; border-radius: 999px; background: var(--accent); color: white; font-size: 11px; }
.component-crate-dialog { width: min(720px, calc(100vw - 28px)); }
.component-crate-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--surface-soft); }
.component-crate-toolbar label { display: inline-flex; align-items: center; gap: 8px; font-weight: 750; }
.component-crate-list { display: grid; gap: 7px; max-height: min(54vh, 520px); padding: 12px 18px; overflow-y: auto; }
.component-crate-option { display: grid; grid-template-columns: auto 1fr; gap: 11px; align-items: center; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; }
.component-crate-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 4px 0 var(--accent); }
.component-crate-option input { width: 20px; height: 20px; }
.component-crate-option span { display: grid; gap: 2px; min-width: 0; }
.component-crate-option strong { font-size: 14px; }
.component-crate-option small { color: var(--muted); line-height: 1.3; }
.component-stock-dialog { width: min(620px, calc(100vw - 28px)); }
.component-stock-form { padding: 16px 18px 0; }
.component-stock-form .modal-actions { margin: 4px -18px 0; }
.component-stock-note { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--surface-soft); color: var(--muted); font-size: 12px; }
.component-flower-status > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 9px;
  border-right: 1px solid var(--line);
  border-bottom: 0;
}
.component-flower-status h5 { display: inline; margin: 0 0 0 5px; font-size: 14px; }
.component-flower-status header small { display: block; margin-top: 3px; color: var(--muted); }
.component-flower-code { color: var(--accent-dark); font-size: 13px; font-weight: 850; }
.component-flower-badges { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 5px; }
.component-origin-badge {
  display: inline-flex;
  width: fit-content;
  padding: 3px 7px;
  border-radius: 999px;
  background: #eef0ed;
  color: #4a514b;
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}
.component-origin-badge.ordered { background: #e8f2eb; color: #27643c; }
.component-origin-badge.replacement { background: #e7effb; color: #245f99; }
.component-origin-badge.extra { background: #fff0bd; color: #775207; }
.component-origin-badge.warning { background: #f9ded4; color: #8b351c; }
.component-origin-badge.completed { background: #328552; color: #fff; }
.component-flower-complete-button { min-height: 30px; padding: 5px 8px; font-size: 11px; }

.component-stage-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); }
.component-stage { display: grid; grid-template-columns: 1fr auto; align-items: baseline; align-content: center; gap: 2px 5px; padding: 7px 8px; background: #fff; }
.component-stage span { grid-column: 1 / -1; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.component-stage strong { font-size: 17px; line-height: 1; }
.component-stage small { color: var(--muted); font-size: 10px; }
.component-stage.undelivered { box-shadow: inset 4px 0 #b6bbb6; }
.component-stage.raw { box-shadow: inset 4px 0 #f2a541; }
.component-stage.prepped { box-shadow: inset 4px 0 #4a91d8; }
.component-stage.installed { box-shadow: inset 4px 0 #328552; }
.component-stage.installed strong { color: #246c3e; }

.component-source-list { display: grid; align-content: center; gap: 4px; padding: 6px 8px; border-left: 1px solid var(--line); background: #f8faf7; }
.component-source { display: grid; grid-template-columns: minmax(0, 1fr); align-items: center; gap: 2px; padding-left: 7px; border-left: 3px solid #7aa58a; }
.component-source.replacement { border-left-color: #4a91d8; }
.component-source.extra { border-left-color: #d39a25; }
.component-source > div { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; min-width: 0; }
.component-source strong { font-size: 12px; }
.component-source small { color: var(--muted); font-size: 10px; text-align: left; }
.component-source-arrow { color: #245f99; font-size: 11px; font-weight: 750; }
.component-source-empty { display: block; padding: 10px 11px; color: var(--muted); font-size: 12px; }

@media (max-width: 1120px) {
  .component-flower-status { grid-template-columns: minmax(180px, .8fr) minmax(300px, 1.2fr); }
  .component-source-list,
  .component-flower-status > .component-source-empty { grid-column: 1 / -1; border-top: 1px solid var(--line); border-left: 0; }
}

.recommendation-row strong,
.recommendation-row small {
  display: block;
}

.recommendation-row small {
  color: var(--muted);
  margin-top: 2px;
}

.recommendation-count {
  min-width: 75px;
  text-align: right;
  color: var(--accent-dark);
  font-size: 20px;
  font-weight: 750;
}

.priority-select {
  width: auto;
  min-width: 90px;
}

.progress-track {
  height: 7px;
  margin-top: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #e1e6de;
}

.progress-track span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.status-cell,
.status-stack,
.workflow-status,
.component-chip-list,
.component-use-list {
  display: grid;
  gap: 5px;
}

.status-cell small {
  color: var(--muted);
  font-size: 12px;
}

.workflow-status {
  min-width: 170px;
}

.workflow-status strong {
  font-size: 13px;
}

.workflow-label {
  display: inline-flex;
  width: fit-content;
  padding: 3px 8px;
  border-radius: 999px;
  background: #ecefea;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.workflow-status.ready .workflow-label {
  background: #e5f0e9;
  color: var(--accent-dark);
}

.workflow-status.active .workflow-label {
  background: #fff0c7;
  color: #735509;
}

.workflow-status.done .workflow-label {
  background: var(--accent);
  color: #fff;
}

.workflow-status.done .progress-track span {
  background: var(--accent-dark);
}

.component-chip-list,
.component-use-list {
  justify-items: start;
  min-width: 155px;
}

.component-chip,
.component-use {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  padding: 3px 7px;
  border-radius: 6px;
  background: #edf1ea;
  font-size: 12px;
}

.component-use.deviation {
  border: 1px solid #e0bd59;
  background: var(--warning-bg);
  color: #694e08;
  font-weight: 700;
}

.weekend-table {
  max-height: 430px;
}

.weekend-table progress {
  width: 90px;
}

.status-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  background: #edf1ea;
  font-size: 11px;
  font-weight: 700;
}

.status-badge.warning { background: #fff0d7; color: #7a4710; }
.status-badge.done { background: #e5f2e8; color: #285f39; }

.correction-event td {
  color: var(--muted);
  text-decoration: line-through;
}

.prep-tables-panel {
  max-width: 1500px;
  margin: 0 auto;
}

.prep-tables-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.prep-tables-heading h2,
.prep-tables-heading p {
  margin: 0 0 4px;
}

.prep-tables-heading .actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.prep-tables-progress {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr);
  align-items: center;
  gap: 14px;
  min-height: 42px;
  margin-bottom: 12px;
  padding: 8px 12px;
  border: 1px solid #df9f70;
  border-radius: 12px;
  background: var(--surface);
}

.prep-tables-progress-copy {
  display: flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
}

.prep-tables-progress-copy strong { font-size: 15px; }
.prep-tables-progress-copy span { color: var(--muted); font-size: 12px; }

.prep-tables-progress-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #f0d4bd;
}

.prep-tables-progress-track > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 200ms ease;
}

.prep-tables-notice:not(:empty) {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.prep-tables-empty,
.prep-tables-info {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.prep-tables-stock-warning {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border: 2px solid #d75d00;
  border-radius: 12px;
  background: #fff0df;
  color: #5e2904;
}

.prep-tables-stock-warning strong { font-size: 14px; }
.prep-tables-stock-warning span { font-weight: 650; }

.prep-tables-empty h3,
.prep-tables-empty p {
  margin: 0 0 8px;
}

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

.prep-table-card {
  --table-border: #a9b0aa;
  --table-bg: #eef0ee;
  --table-head: #dde1de;
  --table-action: #657069;
  --table-action-hover: #4e5852;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
  min-height: 350px;
  overflow: hidden;
  border: 2px solid var(--table-border);
  border-radius: 14px;
  background: var(--table-bg);
  box-shadow: 0 5px 18px rgba(31, 42, 36, 0.07);
}

.prep-table-card > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--table-border);
  background: var(--table-head);
}

.prep-table-card > header span,
.prep-table-card > header h3 {
  display: block;
  margin: 0;
}

.prep-table-card > header > div:first-child > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.prep-table-card > header h3 {
  font-size: 30px;
  line-height: 32px;
}

.prep-table-card > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 3px 12px;
  padding: 9px 14px;
  border-top: 1px solid var(--table-border);
  background: rgba(255, 255, 255, 0.3);
  color: var(--muted);
  font-size: 12px;
}

.prep-table-responsible {
  color: var(--text);
}

.prep-table-card.inactive {
  box-shadow: none;
}

.prep-table-card.active.assigned {
  --table-border: #d48413;
  --table-bg: #fff3d5;
  --table-head: #ffe2a1;
  --table-action: #cf7410;
  --table-action-hover: #a95908;
}

.prep-table-card.active.working {
  --table-border: #287bab;
  --table-bg: #e6f3fb;
  --table-head: #cfe8f7;
  --table-action: #287bab;
  --table-action-hover: #185d86;
}

.prep-table-card.active.idle {
  --table-border: #43875a;
  --table-bg: #e8f5eb;
  --table-head: #d2ead8;
  --table-action: #34784c;
  --table-action-hover: #245d39;
}

.prep-table-card.unavailable {
  --table-border: #a9a79e;
  --table-bg: #f2f1ec;
  --table-head: #e3e1da;
  --table-action: #6f706b;
  --table-action-hover: #575853;
}

.prep-table-no-stock {
  display: grid;
  justify-items: center;
  gap: 7px;
  padding: 16px 10px;
  text-align: center;
}

.prep-table-no-stock strong {
  font-size: 17px;
}

.prep-table-no-stock p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.prep-table-state {
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--table-border);
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  font-size: 11px;
  font-weight: 750;
}

.prep-table-header-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.prep-table-power {
  width: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: 999px;
  background: #fff;
  color: var(--danger);
  border-color: #d8aaa4;
  font-size: 19px;
}

.prep-table-power:disabled {
  color: #9aa098;
  border-color: var(--line);
  background: #f0f2ee;
}

.prep-table-power:hover:not(:disabled) {
  border-color: var(--danger);
  background: #fff0ee;
  color: var(--danger);
}

.prep-table-inactive-body,
.prep-table-body {
  display: grid;
  align-content: center;
  gap: 14px;
  padding: 16px;
}

.prep-table-inactive-body {
  justify-items: stretch;
  text-align: center;
}

.prep-table-inactive-body p {
  margin: 0;
  color: var(--muted);
}

.prep-table-action-button {
  width: 100%;
  min-height: 72px;
  border-color: var(--table-action);
  background: var(--table-action);
  font-size: 19px;
  font-weight: 800;
}

.prep-table-action-button:hover:not(:disabled) {
  border-color: var(--table-action-hover);
  background: var(--table-action-hover);
}

.prep-table-action-button:disabled {
  cursor: progress;
  opacity: 0.58;
}

.prep-table-controls {
  display: grid;
  gap: 8px;
}

.prep-table-override-button {
  min-height: 48px;
  border-color: var(--table-action);
  background: rgba(255, 255, 255, 0.82);
  color: var(--table-action-hover);
  font-size: 14px;
}

.prep-table-override-button:hover:not(:disabled) {
  border-color: var(--table-action-hover);
  background: #fff;
  color: var(--table-action-hover);
}

.prep-table-crate {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.7);
}

.prep-table-crate small,
.prep-table-crate strong,
.prep-table-replacement,
.prep-table-order-match {
  display: block;
}

.prep-table-crate strong {
  margin: 3px 0;
  font-size: 17px;
}

.prep-table-crate small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.prep-table-crate-code {
  display: block;
  margin: 3px 0 5px;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  font-weight: 800;
}

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

.delivery-round-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
}

.delivery-round-row strong,
.delivery-round-row small { display: block; }
.delivery-round-row small { margin-top: 2px; color: var(--muted); }

.prep-override-form,
.crate-lookup-content {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.crate-lookup-status {
  padding: 18px;
  border-left: 6px solid #777;
  border-radius: 10px;
  background: var(--surface-soft);
}

.crate-lookup-status span,
.crate-lookup-status strong { display: block; }
.crate-lookup-status strong { margin-top: 4px; font-size: 24px; }
.crate-lookup-status.raw { border-color: #777; }
.crate-lookup-status.assigned { border-color: #d48413; background: #fff3d5; }
.crate-lookup-status.prepped { border-color: #287bab; background: #e6f3fb; }
.crate-lookup-status.installed { border-color: #43875a; background: #e8f5eb; }
.crate-lookup-status.warning { border-color: var(--danger); }

.crate-lookup-content dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 16px;
  margin: 0;
}

.crate-lookup-content dt { color: var(--muted); }
.crate-lookup-content dd { margin: 0; font-weight: 700; }

.scanner-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.85fr) minmax(420px, 1.15fr);
  gap: 16px;
}

.scanner-camera-card,
.scanner-selection-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.scanner-video-wrap {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 10px;
  background: #17231d;
  color: #fff;
}

.scanner-video-wrap video { width: 100%; height: 100%; object-fit: cover; }

.scanner-guide {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: none;
  place-items: center;
  align-content: center;
  gap: 14px;
  padding: 20px;
  pointer-events: none;
  text-align: center;
  text-shadow: 0 1px 4px #000;
}

.scanner-video-wrap.scanning .scanner-guide { display: grid; }

.scanner-guide-frame {
  position: relative;
  width: min(58%, 260px);
  aspect-ratio: 1;
  border: 3px solid rgb(255 255 255 / 82%);
  border-radius: 18px;
  box-shadow: 0 0 0 999px rgb(0 0 0 / 24%), 0 0 0 1px rgb(0 0 0 / 35%);
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.scanner-guide-frame span {
  position: absolute;
  left: 10%;
  right: 10%;
  top: 50%;
  height: 3px;
  border-radius: 3px;
  background: #ff8a2c;
  box-shadow: 0 0 10px #ff8a2c;
  animation: scanner-line 1.8s ease-in-out infinite;
}

.scanner-video-wrap.scan-detected .scanner-guide-frame {
  border-color: #45df78;
  box-shadow: 0 0 0 999px rgb(0 0 0 / 18%), 0 0 0 7px rgb(69 223 120 / 28%);
  transform: scale(1.025);
}

.scanner-video-wrap.scan-detected .scanner-guide-frame span { background: #45df78; box-shadow: 0 0 12px #45df78; }

.scanner-scan-feedback {
  position: absolute;
  z-index: 4;
  display: grid;
  place-items: center;
  gap: 3px;
  min-width: min(80%, 300px);
  padding: 14px 20px;
  border: 2px solid #8af2a9;
  border-radius: 14px;
  background: rgb(20 104 50 / 94%);
  color: #fff;
  box-shadow: 0 8px 30px rgb(0 0 0 / 35%);
  text-align: center;
  animation: scanner-success 180ms ease-out;
}

.scanner-scan-feedback[hidden] { display: none; }
.scanner-scan-check { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: #fff; color: #176c35; font-size: 27px; font-weight: 900; }
.scanner-scan-feedback strong { font-size: 18px; }
.scanner-scan-feedback > span:last-child { font-size: 13px; font-weight: 750; }

@keyframes scanner-line { 0%, 100% { transform: translateY(-72px); } 50% { transform: translateY(72px); } }
@keyframes scanner-success { from { opacity: 0; transform: scale(.86); } to { opacity: 1; transform: scale(1); } }

#scannerCameraPlaceholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 6px;
  padding: 20px;
  background: #25362d;
  text-align: center;
}

.scanner-camera-actions,
.scanner-status-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 12px;
}

.scanner-camera-actions button,
.scanner-camera-actions .scanner-photo-button { flex: 1 1 150px; min-height: 52px; justify-content: center; }
.scanner-manual { margin-top: 14px; }
.scanner-manual summary { cursor: pointer; font-weight: 750; }
.scanner-manual form { margin-top: 10px; }

.scanned-crates-list {
  display: grid;
  gap: 8px;
  max-height: 58vh;
  overflow-y: auto;
}

.scanned-crate-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 42px;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 10px 13px;
  border-left: 5px solid #777;
  border-radius: 8px;
  background: var(--surface-soft);
}

.scanned-crate-row.raw { border-color: #777; }
.scanned-crate-row.assigned { border-color: #d48413; background: #fff3d5; }
.scanned-crate-row.prepped { border-color: #287bab; background: #e6f3fb; }
.scanned-crate-row.installed { border-color: #43875a; background: #e8f5eb; }
.scanned-crate-row.warning { border-color: var(--danger); }
.scanned-crate-row strong,
.scanned-crate-row small { display: block; }
.scanned-crate-row small { margin-top: 2px; color: var(--muted); }
.scanned-crate-row .crate-status-basis { max-width: 54ch; font-size: 11px; }
.scanned-crate-row > span { font-size: 12px; font-weight: 750; }

.scanner-empty {
  display: grid;
  gap: 5px;
  padding: 32px 16px;
  border: 1px dashed var(--line);
  border-radius: 9px;
  color: var(--muted);
  text-align: center;
}

.scanner-status-actions {
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.scanner-status-actions > span { width: 100%; font-weight: 750; }
.scanner-status-actions button { flex: 1 1 130px; min-height: 52px; }

.prep-table-flower-visual {
  position: relative;
  width: 72px;
  height: 72px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}

.prep-table-flower-visual img,
.prep-table-flower-visual > span {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.prep-table-flower-visual > span {
  display: block;
}

.prep-table-flower-visual img {
  position: absolute;
  z-index: 1;
  inset: 0;
}

.prep-table-replacement,
.prep-table-order-match {
  width: fit-content;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 750;
}

.prep-table-replacement {
  background: var(--warning-bg);
  color: #694e08;
}

.prep-table-order-match {
  background: #e5f0e9;
  color: var(--accent-dark);
}

.prep-table-working {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: #185d86;
}

.prep-table-saving {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--table-border);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--text);
}

.prep-table-saving .prep-table-pulse {
  animation: prep-table-saving-pulse 1s ease-in-out infinite alternate;
}

@keyframes prep-table-saving-pulse {
  to { opacity: 0.42; transform: scale(0.82); }
}

@media (prefers-reduced-motion: reduce) {
  .prep-table-saving .prep-table-pulse {
    animation: none;
  }
}

.prep-table-pulse {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #287bab;
  box-shadow: 0 0 0 5px rgba(40, 123, 171, 0.16);
}

.prep-table-idle {
  text-align: center;
}

.prep-table-idle > span {
  display: inline-grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 8px;
  border-radius: 50%;
  background: #e5f0e9;
  color: var(--accent-dark);
  font-size: 28px;
  font-weight: 800;
}

.prep-table-idle strong {
  display: block;
  font-size: 20px;
}

.prep-table-idle p {
  margin: 5px 0 0;
  color: var(--muted);
}

@media (max-width: 980px) {
  .weekend-actions-grid,
  .weekend-grid {
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 650px) {
  main {
    padding: 12px;
  }

  .app-header {
    padding: 14px;
  }

  .toolbar,
  .weekend-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .tabs {
    display: flex;
    overflow-x: auto;
  }

  .tab {
    flex: 0 0 auto;
  }

  .kpi-grid {
    grid-template-columns: 1fr 1fr;
  }

  .weekend-card {
    padding: 12px;
  }
}

.component-row {
  display: flex;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 10px;
  border-radius: 8px;
  min-width: 0;
}

.component-editor {
  display: grid;
  align-items: stretch;
  gap: 10px;
  overflow: hidden;
}

.component-fields {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) minmax(92px, 120px) auto;
  gap: 8px;
  align-items: end;
  min-width: 0;
}

.component-fields label,
.total-field {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.component-row input {
  min-width: 0;
  width: 100%;
  flex: 1;
}

.component-row button {
  background: #fff;
  color: var(--danger);
  border-color: #d8aaa4;
  white-space: nowrap;
}

.component-row .icon-button {
  align-self: end;
  color: var(--text);
  border-color: var(--line);
}

.component-row.locked {
  background: #f8faf6;
}

.summary-grid {
  display: grid;
  grid-template-columns: minmax(520px, 1.1fr) minmax(420px, 0.9fr);
  gap: 18px;
}

#totalsTable {
  min-width: 820px;
  table-layout: fixed;
}

#totalsTable .summary-code-column { width: 8%; }
#totalsTable .summary-flower-column { width: 30%; }
#totalsTable .summary-planting-column { width: 18%; }
#totalsTable .summary-m2-column { width: 8%; }
#totalsTable .summary-boxes-column { width: 12%; }
#totalsTable .summary-flowers-column { width: 12%; }

#totalsTable th:nth-child(2),
#totalsTable td:nth-child(2),
#totalsTable th:nth-child(3),
#totalsTable td:nth-child(3) {
  white-space: normal;
}

#totalsTable .flower-cell,
.component-summary-table .flower-cell {
  min-width: 0;
}

.component-summary-table {
  width: 100%;
  table-layout: fixed;
}

.component-summary-table .component-flower-column { width: 38%; }
.component-summary-table .component-color-column { width: 23%; }
.component-summary-table .component-number-column { width: 13%; }

.component-summary-table th:first-child,
.component-summary-table td:first-child,
.component-summary-table th:nth-child(2),
.component-summary-table td:nth-child(2) {
  white-space: normal;
}

.object-input-list {
  display: grid;
  gap: 16px;
}

.object-input {
  border: 1px solid var(--line);
  background: var(--surface);
}

.object-input.locked {
  background: #fbfcfa;
}

.object-input-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding: 12px;
  background: #dceee5;
  border-bottom: 1px solid var(--line);
}

.object-input.locked .object-input-head {
  background: #f3f5ef;
  border-bottom-color: #dfe5da;
}

.object-input-head h3 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 3px;
  font-size: 16px;
}

.object-input.compact .object-input-head {
  padding: 9px 10px;
}

.object-input.compact .input-table-wrap {
  max-height: none;
}

.color-toggle-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.color-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  max-width: 100%;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 12px;
  line-height: 1.1;
  white-space: nowrap;
}

.color-toggle.disabled {
  opacity: 0.58;
}

.color-toggle input {
  width: auto;
  flex: 0 0 auto;
  min-height: auto;
  margin: 0;
}

.input-table-wrap {
  max-height: none;
  overflow-y: visible;
  border: 0;
}

.mobile-flower-code,
.mobile-allocation-summary,
.mobile-table-label {
  display: none;
}

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

.allocation-mode-toggle {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  width: 70px;
  min-width: 70px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.allocation-mode-toggle button {
  min-height: 34px;
  padding: 0 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.allocation-mode-toggle button + button {
  border-left: 1px solid var(--line);
}

.allocation-mode-toggle button.active {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.allocation-readonly,
.total-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7f8f5;
  color: var(--text);
  font-weight: 650;
  white-space: nowrap;
}

.manual-flower-form {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  background: #f8faf6;
}

.manual-flower-form label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.manual-flower-form label > span {
  display: flex;
  gap: 6px;
}

.manual-flower-form input {
  width: 130px;
  min-height: 34px;
}

.manual-flower-form button {
  min-height: 34px;
}

.flower-input-identity {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.manual-flower-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 2px 5px;
  border-radius: 5px;
  background: var(--warning-bg);
  color: #694e08;
  font-size: 10px;
  font-weight: 700;
}

.manual-flower-badge button {
  width: 18px;
  min-height: 18px;
  margin-left: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #694e08;
  font-size: 16px;
  line-height: 1;
}

.alternative-materials {
  border-bottom: 1px solid var(--line);
  background: #fbfaf5;
}

.alternative-materials-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
}

.alternative-materials-head h4 {
  margin: 0 0 2px;
  font-size: 14px;
}

.alternative-materials-head span,
.alternative-material-empty,
.alternative-material-identity > span {
  color: var(--muted);
  font-size: 11px;
}

.alternative-materials-head form {
  display: flex;
  gap: 6px;
}

.alternative-materials-head input {
  width: 180px;
}

.alternative-material-list {
  border-top: 1px solid var(--line);
}

.alternative-material-row {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(150px, 190px) 90px auto;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
}

.alternative-material-row:last-child {
  border-bottom: 0;
}

.alternative-material-identity {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.alternative-material-identity input {
  width: 100%;
  min-width: 0;
}

.alternative-material-identity .material-note {
  min-height: 30px;
  color: var(--muted);
  font-size: 12px;
}

.alternative-material-value {
  display: flex;
  align-items: center;
  gap: 6px;
}

.alternative-material-value input[type="number"] {
  width: 82px;
  min-width: 0;
}

.alternative-material-calculated {
  text-align: right;
  white-space: nowrap;
}

.alternative-material-empty {
  margin: 0;
  padding: 0 12px 10px;
}

.alternative-material-summary-row td {
  background: #fffcf1;
}

.component-summary {
  margin-bottom: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.component-summary h3 {
  margin: 0;
  padding: 10px 12px;
  font-size: 15px;
  background: #edf1ea;
  border-bottom: 1px solid var(--line);
}

.surface-items {
  margin: 10px 12px;
  border: 1px solid var(--line);
  background: #f8faf6;
}

.surface-items-head,
.surface-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.surface-items-head {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}

.surface-items ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.surface-item {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
}

.surface-item:last-child {
  border-bottom: 0;
}

.surface-item.locked {
  background: #f1f4ed;
}

.surface-item div:first-child {
  min-width: 0;
}

.surface-item strong,
.surface-item span {
  display: block;
}

.surface-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
}

.surface-item span {
  color: var(--muted);
  font-size: 12px;
  white-space: normal;
}

.surface-item-actions {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 8px;
  text-align: right;
}

.surface-item-actions span {
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}

.icon-button {
  width: 30px;
  min-height: 30px;
  padding: 0;
  border-radius: 6px;
}

.icon-button.locked {
  background: #dfe8d8;
  color: var(--accent-dark);
}

.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.download-link {
  color: var(--accent-dark);
  font-weight: 650;
}

.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
}

.modal.open {
  display: block;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 42, 36, 0.32);
}

.modal-dialog {
  position: relative;
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  margin: 24px auto;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 22px 70px rgba(31, 42, 36, 0.28);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: #edf1ea;
}

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

.calculator-grid label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.calculator-grid select,
.calculator-grid input {
  width: 100%;
}

.calculator-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 16px 0;
}

.option-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
}

.option-toggle input {
  width: auto;
  min-height: auto;
  margin: 0;
}

.calculator-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  background: #f7f8f5;
}

.calculator-result strong {
  font-size: 22px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  padding: 0 16px 16px;
}

.weekend-primary-action {
  width: 100%;
  min-height: 48px;
  margin-top: 14px;
  font-size: 16px;
  font-weight: 750;
}

.delivery-modal-dialog {
  width: min(980px, calc(100vw - 32px));
}

.delivery-wizard-content {
  padding: 16px;
}

.delivery-round-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.delivery-round-fields label,
.delivery-flower-toolbar label,
.delivery-replacement-row label,
.delivery-box-input {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

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

.delivery-flower-toolbar label {
  width: min(460px, 100%);
}

.delivery-flower-toolbar strong {
  padding-bottom: 9px;
  color: var(--muted);
  font-size: 12px;
}

.delivery-flower-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.delivery-flower-section + .delivery-flower-section {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 2px solid var(--line);
}

.delivery-flower-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 9px;
}

.delivery-flower-section-head h3,
.delivery-flower-section-head p {
  margin: 0;
}

.delivery-flower-section-head p,
.delivery-flower-section-head span {
  color: var(--muted);
  font-size: 12px;
}

.delivery-flower-section.replacements {
  padding: 16px;
  border: 1px solid #e4bd70;
  border-radius: 10px;
  background: #fffaf0;
}

.delivery-flower-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.delivery-flower-option:has(input:checked) {
  border-color: var(--accent);
  background: #edf4ef;
}

.delivery-flower-option > input {
  width: 20px;
  min-height: 20px;
}

.delivery-flower-option > span:nth-child(2) {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 8px;
}

.delivery-flower-option strong,
.delivery-flower-option small,
.delivery-replacement-row strong,
.delivery-replacement-row small,
.delivery-quantity-flower strong,
.delivery-quantity-flower small {
  display: block;
}

.delivery-flower-option small,
.delivery-replacement-row small,
.delivery-quantity-flower small {
  color: var(--muted);
  font-size: 12px;
}

.delivery-flower-option .flower-thumb {
  grid-row: 1 / 3;
}

.status-badge.replacement {
  background: var(--warning-bg);
  color: #694e08;
}

.delivery-step-intro {
  margin-bottom: 14px;
}

.delivery-step-intro h3,
.delivery-step-intro p {
  margin: 0 0 5px;
}

.delivery-replacement-list,
.delivery-quantity-list {
  display: grid;
  gap: 10px;
}

.delivery-replacement-row {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(280px, 1.3fr);
  align-items: center;
  gap: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.delivery-quantity-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 160px minmax(280px, 1.2fr);
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.delivery-complete-check {
  display: flex;
  grid-column: 3;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
}

.delivery-overflow-target,
.component-deviation-warning {
  padding: 12px;
  border: 2px solid #d75d00;
  border-radius: 12px;
  background: #fff0df;
  color: #5e2904;
}

.delivery-overflow-target {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(180px, 0.7fr) minmax(280px, 1.3fr);
  align-items: center;
  gap: 8px 16px;
}

.delivery-overflow-target > strong { font-size: 16px; }
.delivery-overflow-target > p { margin: 0; }
.delivery-overflow-target > label { grid-column: 2; }

.component-deviation-warning {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
}

.delivery-complete-check input {
  flex: 0 0 auto;
  margin-top: 2px;
}

.delivery-wizard-actions {
  position: sticky;
  bottom: 0;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.workflow-label.done {
  background: var(--accent);
  color: #fff;
}

.workflow-label.shortage {
  background: var(--warning-bg);
  color: #694e08;
}

@media print {
  * {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  @page {
    margin: 12mm;
    size: A4 landscape;
  }

  body {
    background: #fff;
  }

  .app-header,
  .app-status-wrap,
  .toolbar,
  .print-action,
  main > .panel:not(#summary),
  .modal,
  .image-preview {
    display: none !important;
  }

  main {
    padding: 0;
  }

  #summary {
    display: block !important;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
  }

  #summary {
    color: #1f2a24;
  }

  .summary-grid {
    display: block;
  }

  .component-summary-heading {
    display: none !important;
  }

  .print-page {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .summary-totals-page {
    break-after: page;
    page-break-after: always;
  }

  .component-summary {
    break-before: page;
    page-break-before: always;
    margin: 0;
  }

  .print-page-content {
    zoom: var(--print-scale, 1);
  }

  .section-head {
    display: block;
    margin: 0 0 8px;
  }

  .table-wrap {
    overflow: visible;
    max-height: none;
    border: 1px solid #bfc7b8;
  }

  table {
    width: 100%;
    table-layout: fixed;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  th {
    position: static;
    background: #edf1ea !important;
  }

  th,
  td {
    padding: 5px 6px;
    font-size: 11px;
  }

  .flower-thumb.small {
    width: 24px;
    height: 24px;
    flex-basis: 24px;
  }

  .flower-cell {
    min-width: 0;
  }

  .component-summary h3 {
    background: #edf1ea !important;
  }
}

@media (max-width: 920px) {
  .app-header,
  .toolbar,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .tabs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

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

  .component-row button {
    width: 100%;
  }

  .color-toggle-list {
    padding: 8px;
  }

  .modal-head,
  .calculator-result {
    align-items: stretch;
    flex-direction: column;
  }

  .calculator-grid {
    grid-template-columns: 1fr;
  }

  .settings-layout,
  .permission-editor { grid-template-columns: 1fr; }

  .app-user-menu { width: 100%; justify-content: space-between; padding: 8px 0 0; border: 0; border-top: 1px solid var(--line); }
  .scanner-layout { grid-template-columns: 1fr; }
}

@media (max-width: 650px) {
  .scanner-panel { padding: 0; }
  .scanner-camera-card,
  .scanner-selection-card { padding: 10px; border-radius: 10px; }
  .scanner-video-wrap { aspect-ratio: 16 / 10; }
  .scanned-crate-row { grid-template-columns: minmax(0, 1fr) 38px; }
  .scanned-crate-row > span { grid-column: 1; }
  .scanned-crate-row > button { grid-column: 2; grid-row: 1 / span 2; }
}

@media (max-width: 700px) {
  body.weekend-mode {
    padding-bottom: calc(74px + env(safe-area-inset-bottom));
  }

  body.weekend-mode .app-header {
    display: block;
    padding: 10px 14px;
  }

  body.weekend-mode .app-header h1 {
    font-size: 20px;
  }

  body.weekend-mode .app-header p,
  body.weekend-mode .app-header .actions {
    display: none;
  }

  body.weekend-mode main {
    padding: 8px 10px 18px;
  }

  .toolbar {
    gap: 7px;
    margin-bottom: 10px;
  }

  .tabs {
    display: flex;
    width: 100%;
    overflow-x: auto;
    border-radius: 8px;
    scrollbar-width: none;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  .tab {
    flex: 0 0 auto;
    min-height: 42px;
    padding: 0 14px;
  }

  .weekend-tab {
    order: -1;
  }

  .prep-tables-tab {
    order: -2;
  }

  .status {
    min-height: 0;
    padding: 8px 10px;
    border-radius: 7px;
    background: #edf4ef;
    color: var(--accent-dark);
    font-size: 13px;
  }

  .status:empty {
    display: none;
  }

  .status.error {
    background: #fff0ee;
    color: var(--danger);
  }

  .weekend-heading {
    gap: 9px;
    margin-bottom: 10px;
  }

  .weekend-heading h2 {
    font-size: 21px;
  }

  .weekend-heading .actions {
    display: flex;
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .weekend-heading .actions button {
    flex: 0 0 auto;
    min-height: 42px;
  }

  .weekend-alerts {
    margin-bottom: 9px;
  }

  .weekend-alert {
    padding: 9px 10px;
    font-size: 13px;
  }

  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 12px;
  }

  .kpi-card {
    min-width: 0;
    padding: 9px;
    border-radius: 8px;
  }

  .kpi-card strong {
    margin: 1px 0;
    font-size: 22px;
  }

  .kpi-card span,
  .kpi-card small {
    overflow: hidden;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-weekend-nav {
    position: fixed;
    z-index: 40;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 6px 7px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 -6px 20px rgba(31, 42, 36, 0.12);
  }

  .mobile-weekend-nav button {
    display: grid;
    justify-items: center;
    min-width: 0;
    min-height: 52px;
    padding: 4px 2px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
  }

  .mobile-weekend-nav button span {
    font-size: 20px;
    line-height: 20px;
  }

  .mobile-weekend-nav button.active {
    border-radius: 7px;
    background: #e3eee8;
    color: var(--accent-dark);
  }

  .weekend-actions-grid [data-weekend-action] {
    display: none;
  }

  .weekend-actions-grid [data-weekend-action].mobile-active {
    display: block;
  }

  [data-weekend-action],
  #weekendStatusTop,
  #weekendStatusDetails {
    scroll-margin-top: 12px;
  }

  .weekend-card {
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 9px;
  }

  .weekend-card h3 {
    font-size: 17px;
  }

  .stack-form {
    gap: 13px;
  }

  .stack-form label {
    font-size: 14px;
  }

  .stack-form input,
  .stack-form input,
  .stack-form select {
    width: 100%;
    min-height: 48px;
    font-size: 16px;
  }

  .stack-form input[type="number"] {
    width: 100%;
    text-align: left;
  }

  .stack-form button,
  .weekend-empty > button {
    width: 100%;
    min-height: 50px;
    font-weight: 700;
  }

  .availability {
    min-height: 44px;
    padding: 11px;
  }

  .recommendation-row {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 9px;
  }

  .recommendation-count {
    min-width: 62px;
    font-size: 19px;
  }

  .component-progress {
    grid-template-columns: 1fr;
  }

  .component-progress-head { grid-template-columns: 1fr; align-items: stretch; }
  .component-progress-actions { align-items: stretch; flex-direction: column-reverse; }
  .component-stock-book-button { width: 100%; }
  .component-priority-field { min-width: 0; }
  .component-flower-status { display: block; }
  .component-stage-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .component-source-list { border-top: 1px solid var(--line); border-left: 0; }
  .component-source { grid-template-columns: 1fr; }
  .component-source small { text-align: left; }
  .component-flower-status > header { align-items: stretch; flex-direction: column; }
  .component-flower-badges { justify-content: flex-start; }

  .priority-select {
    width: 100%;
    min-height: 44px;
  }

  .weekend-table {
    max-height: none;
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .weekend-table table,
  .weekend-table tbody,
  .weekend-table tr {
    display: block;
    width: 100%;
  }

  .weekend-table thead {
    display: none;
  }

  .weekend-table tr {
    padding: 8px 10px;
    margin-bottom: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
  }

  .weekend-table tr.warn {
    background: var(--warning-bg);
  }

  .weekend-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 31px;
    padding: 5px 0;
    border-right: 0;
    font-size: 14px;
    white-space: normal;
    text-align: right;
  }

  .weekend-table td::before {
    content: attr(data-label);
    flex: 0 0 42%;
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
    text-align: left;
  }

  .weekend-table td:empty {
    display: none;
  }

  .weekend-table td.number {
    text-align: right;
  }

  .weekend-table progress {
    max-width: 86px;
  }

  .weekend-table .mobile-card-action {
    display: block;
    padding-top: 8px;
  }

  .weekend-table .mobile-card-action::before {
    display: none;
  }

  .mobile-card-action button {
    width: 100%;
    min-height: 44px;
  }

  .session-row {
    align-items: stretch;
    flex-direction: column;
  }

  .session-actions button {
    flex: 1 1 120px;
    min-height: 44px;
  }

  .weekend-empty {
    padding: 16px;
  }

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

  .prep-tables-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .prep-tables-heading .actions {
    justify-content: space-between;
  }

  .prep-tables-progress {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 8px 10px;
  }

  .prep-tables-progress-copy { justify-content: space-between; }

  .prep-tables-stock-warning {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .prep-tables-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .prep-table-card {
    min-height: 0;
    border-radius: 11px;
  }

  .prep-table-card > header {
    gap: 4px;
    padding: 8px;
  }

  .prep-table-card > header h3 {
    font-size: 26px;
    line-height: 27px;
  }

  .prep-table-card > header > div:first-child > span {
    display: none;
  }

  .prep-table-card > footer {
    padding: 5px 8px;
    font-size: 10px;
  }

  .prep-table-inactive-body,
  .prep-table-body {
    grid-template-columns: minmax(0, 1fr) minmax(132px, 42%);
    align-content: center;
    align-items: center;
    gap: 8px 12px;
    padding: 10px;
  }

  .prep-table-inactive-body {
    justify-items: stretch;
    text-align: left;
  }

  .prep-table-body > .prep-table-crate,
  .prep-table-body > .prep-table-idle,
  .prep-table-body > .prep-table-working {
    grid-column: 1;
  }

  .prep-table-body > .prep-table-controls {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .prep-table-action-button {
    min-height: 54px;
    padding: 8px;
    font-size: 15px;
    line-height: 18px;
  }

  .prep-table-override-button {
    min-height: 48px;
    font-size: 13px;
  }

  .prep-table-crate {
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 6px;
    padding: 7px;
  }

  .prep-table-flower-visual {
    width: 46px;
    height: 46px;
  }

  .prep-table-crate strong {
    margin: 1px 0;
    font-size: 13px;
    line-height: 15px;
  }

  .prep-table-crate small {
    font-size: 8px;
  }

  .prep-table-replacement,
  .prep-table-order-match {
    padding: 2px 5px;
    font-size: 9px;
  }

  .prep-table-header-actions {
    gap: 3px;
  }

  .prep-table-state {
    padding: 3px 5px;
    font-size: 9px;
  }

  .prep-table-power {
    width: 34px;
    min-height: 34px;
    font-size: 17px;
  }

  .prep-table-idle > span {
    width: 40px;
    height: 40px;
    grid-row: 1 / span 2;
    margin-bottom: 0;
    font-size: 22px;
  }

  .prep-table-idle strong {
    font-size: 17px;
  }

  .prep-table-idle {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    text-align: left;
  }

  .prep-table-idle p {
    display: none;
  }

  .prep-table-working {
    justify-content: flex-start;
    gap: 6px;
    font-size: 11px;
    text-align: center;
  }

  .prep-table-pulse {
    width: 9px;
    height: 9px;
    box-shadow: 0 0 0 3px rgba(40, 123, 171, 0.16);
  }

  .prep-table-inactive-body p {
    font-size: 12px;
  }

  .delivery-round-row {
    align-items: stretch;
  }

  .delivery-round-row button {
    min-width: 100px;
    min-height: 48px;
  }

  .delivery-modal-dialog {
    width: calc(100vw - 12px);
    max-height: calc(100dvh - 12px);
    margin: 6px auto;
    border-radius: 10px;
  }

  .delivery-modal-dialog .modal-head {
    position: sticky;
    z-index: 2;
    top: 0;
    align-items: flex-start;
    flex-direction: row;
    padding: 12px;
  }

  .delivery-modal-dialog .modal-head h2 {
    font-size: 20px;
  }

  .delivery-modal-dialog .modal-head button {
    min-height: 42px;
  }

  .delivery-wizard-content {
    padding: 12px;
  }

  .delivery-round-fields,
  .delivery-flower-list,
  .delivery-replacement-row,
  .delivery-quantity-row {
    grid-template-columns: 1fr;
  }

  .delivery-round-fields input,
  .delivery-flower-toolbar input,
  .delivery-replacement-row select,
  .delivery-box-input input {
    width: 100%;
    min-height: 48px;
    font-size: 16px;
  }

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

  .delivery-flower-toolbar strong {
    padding: 0;
  }

  .delivery-flower-option {
    grid-template-columns: auto minmax(0, 1fr);
    min-height: 72px;
  }

  .delivery-flower-option > .status-badge {
    grid-column: 2;
    justify-self: start;
  }

  .delivery-replacement-row,
  .delivery-quantity-row {
    align-items: stretch;
    gap: 10px;
  }

  .delivery-complete-check {
    grid-column: 1;
    padding: 10px;
    border-radius: 7px;
    background: #f7f8f5;
    font-size: 14px;
  }

  .delivery-overflow-target {
    grid-template-columns: 1fr;
  }

  .delivery-overflow-target > label { grid-column: 1; }

  .delivery-complete-check input {
    width: 22px;
    min-height: 22px;
  }

  .delivery-wizard-actions button {
    flex: 1;
    min-height: 48px;
  }

  .input-table-wrap {
    max-height: none;
    overflow-x: hidden;
    overflow-y: visible;
  }

  .manual-flower-form {
    padding: 9px 10px;
  }

  .manual-flower-form label {
    align-items: stretch;
    flex-direction: column;
    gap: 6px;
  }

  .manual-flower-form label > span {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .manual-flower-form input {
    width: 100%;
    min-width: 0;
    min-height: 42px;
    font-size: 16px;
  }

  .manual-flower-form button {
    min-height: 42px;
  }

  .alternative-materials-head {
    align-items: stretch;
    flex-direction: column;
  }

  .alternative-materials-head form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .alternative-materials-head input {
    width: 100%;
    min-width: 0;
    min-height: 42px;
    font-size: 16px;
  }

  .alternative-materials-head button {
    min-height: 42px;
  }

  .alternative-material-row {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px;
  }

  .alternative-material-value input[type="number"] {
    width: min(110px, calc(100% - 76px));
    min-height: 40px;
  }

  .alternative-material-calculated {
    text-align: left;
  }

  .alternative-material-row .material-remove {
    width: 100%;
    min-height: 42px;
  }

  .input-table-wrap table {
    width: 100%;
    table-layout: fixed;
  }

  .input-table-wrap .flower-input-code,
  .input-table-wrap .flower-input-color,
  .input-table-wrap .flower-input-planting {
    display: none;
  }

  .input-table-wrap .flower-input-name {
    width: 42%;
  }

  .input-table-wrap .flower-input-allocation {
    width: 38%;
  }

  .input-table-wrap .flower-input-calculated {
    width: 20%;
  }

  .input-table-wrap th,
  .input-table-wrap td {
    height: auto;
    padding: 7px 6px;
    vertical-align: middle;
    white-space: normal;
  }

  .input-table-wrap th {
    font-size: 12px;
  }

  .input-table-wrap .flower-cell {
    min-width: 0;
    gap: 5px;
    overflow: hidden;
  }

  .input-table-wrap .flower-thumb,
  .input-table-wrap .flower-meta {
    display: none;
  }

  .input-table-wrap .flower-cell > span:last-child {
    min-width: 0;
    overflow: hidden;
  }

  .input-table-wrap .flower-name {
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-flower-code {
    display: inline-block;
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
  }

  .input-table-wrap .desktop-table-label {
    display: none;
  }

  .input-table-wrap .mobile-table-label {
    display: inline;
  }

  .input-table-wrap .allocation-cell {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
  }

  .input-table-wrap .allocation-mode-toggle {
    width: 62px;
    min-width: 62px;
  }

  .input-table-wrap .allocation-mode-toggle button {
    min-height: 36px;
    padding: 0 5px;
  }

  .input-table-wrap .allocation-cell input[type="number"] {
    width: 100%;
    min-width: 0;
    min-height: 38px;
    padding: 0 5px;
  }

  .input-table-wrap .allocation-readonly {
    max-width: 100%;
    min-height: 36px;
    padding: 4px 7px;
  }

  .input-table-wrap tfoot {
    display: none;
  }

  .mobile-allocation-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    border-top: 1px solid var(--line);
    background: var(--line);
  }

  .mobile-allocation-summary > div {
    display: grid;
    gap: 2px;
    padding: 9px 10px;
    background: #f7f8f5;
  }

  .mobile-allocation-summary span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 650;
  }

.mobile-allocation-summary strong {
    font-size: 13px;
  }
}

/* Brandlaag staat bewust als laatste, zodat ook bestaande en mobiele componenten
   dezelfde Reisvenne-Oranje uitstraling krijgen. */
body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 92% 4%, rgba(255, 125, 23, 0.34) 0 9rem, transparent 9.1rem),
    linear-gradient(145deg, #ffd7b8 0%, var(--bg) 54%, #ffbd8a 100%);
}

h1, h2, h3 {
  color: #000;
  font-weight: 800;
  letter-spacing: -0.025em;
}

h1 { font-size: clamp(28px, 3vw, 42px); line-height: 1; }
h2 { font-size: 21px; }

.app-login-screen {
  overflow: hidden;
  background:
    radial-gradient(circle at 12% 88%, #ff7d17 0 11rem, transparent 11.1rem),
    radial-gradient(circle at 92% 8%, rgba(255, 125, 23, 0.5) 0 15rem, transparent 15.1rem),
    #ffc99f;
}

.app-login-card {
  gap: 18px;
  width: min(470px, 100%);
  padding: 34px;
  border: 2px solid #000;
  border-radius: 28px;
  background: rgba(255, 250, 246, 0.96);
  box-shadow: 12px 12px 0 rgba(0, 0, 0, 0.95);
}

.app-header {
  align-items: center;
  padding: 18px 28px;
  border-bottom: 4px solid var(--accent);
  background: rgba(255, 250, 246, 0.96);
  box-shadow: 0 5px 18px rgba(99, 46, 9, 0.12);
}

.app-header h1 { font-size: 30px; }

button,
.file-button {
  min-height: 40px;
  border-width: 2px;
  border-radius: 999px;
  color: #111;
  font-weight: 750;
}

.secondary-button,
.secondary-file-button {
  border-color: var(--accent);
  background: #fffaf6;
  color: #8b3900;
}

.danger-button { color: #fff; }

input,
select,
textarea {
  border-color: #d99a6b;
  border-radius: 11px;
}

.tabs {
  gap: 4px;
  padding: 4px;
  border: 2px solid rgba(0, 0, 0, 0.82);
  border-radius: 999px;
  background: #fffaf6;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.82);
}

.tab {
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #1c1713;
}

.tab.active { background: var(--accent); color: #000; }

.table-wrap,
.weekend-card,
.kpi-card,
.user-editor,
.scanner-camera-card,
.scanner-selection-card,
.component-row,
.object-input-card {
  border-color: #df9f70;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 6px 18px rgba(110, 52, 12, 0.08);
}

th { background: #ffe2cb; color: #20160f; }
tfoot th, tfoot td { background: #fff0e4; }
tbody tr:hover td { background-color: rgba(255, 125, 23, 0.075); }

.modal-dialog {
  border: 2px solid #000;
  border-radius: 24px;
  box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.72);
}

@media (max-width: 900px) {
  .app-header {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
  }

  .app-header .actions {
    padding-top: 12px;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 650px) {
  body { background: linear-gradient(160deg, #ffd6b6, var(--bg)); }
  .app-header { padding: 12px 14px 14px; }
  .brand-logo { width: 65px; height: 50px; }
  .app-header h1 { font-size: 24px; }
  .brand-kicker { font-size: 9px; }

  .app-header .actions {
    flex-wrap: nowrap;
    padding-bottom: 5px;
    overflow-x: auto;
  }

  .app-header .actions > * { flex: 0 0 auto; }

  .toolbar {
    margin: 0 -12px 12px;
    padding: 9px 12px 12px;
  }

  .tabs {
    border-width: 1px;
    border-radius: 16px;
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.75);
  }

  .tab { min-height: 42px; padding-inline: 13px; }
  .app-login-card { padding: 24px; border-radius: 22px; box-shadow: 7px 7px 0 #000; }
  .login-brand-logo { width: 80px; height: 60px; }
}

@media print {
  body { background: #fff; }
  button, .file-button { box-shadow: none; }
}

/* Hoofdnavigatie */
.app-header {
  position: sticky;
  z-index: 80;
  top: 0;
  display: grid;
  grid-template-columns: auto minmax(420px, 1fr) auto;
  align-items: center;
  gap: 22px;
}

.app-brand { min-width: max-content; }
.main-menu-toggle { display: none; }
.main-menu-close { display: none; }

.main-navigation {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
}

.main-nav-group {
  position: relative;
}

.main-nav-group[hidden] { display: none !important; }

.main-nav-toggle {
  min-height: 44px;
  padding: 8px 17px;
  border: 2px solid transparent;
  background: transparent;
  color: #1c1713;
  white-space: nowrap;
}

.main-nav-toggle span {
  display: inline-block;
  margin-left: 5px;
  transition: transform 150ms ease;
}

.main-nav-group.active-section > .main-nav-toggle {
  border-color: #111;
  background: var(--accent);
}

.main-nav-group.open > .main-nav-toggle {
  border-color: var(--accent);
  background: #fffaf6;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.78);
}

.main-nav-group.open > .main-nav-toggle span { transform: rotate(180deg); }

.main-nav-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  display: none;
  width: min(720px, calc(100vw - 32px));
  padding: 14px;
  border: 2px solid #111;
  border-radius: 18px;
  background: #fffaf6;
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.76);
  transform: translateX(-50%);
}

.main-nav-group.open > .main-nav-dropdown { display: grid; }

.bloemtelling-menu {
  grid-template-columns: repeat(2, minmax(230px, 1fr));
  gap: 10px;
}

.nav-page-group {
  display: grid;
  gap: 5px;
  padding: 8px;
  border: 1px solid #efb88e;
  border-radius: 12px;
  background: #fff;
}

.nav-page-group-single { align-content: start; }

.nav-page-link.tab {
  display: flex;
  justify-content: flex-start;
  width: 100%;
  min-height: 42px;
  padding: 8px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #17120f;
  box-shadow: none;
  font-size: 16px;
  text-align: left;
}

.nav-page-link.tab:hover:not(:disabled) { background: #fff0e4; transform: none; box-shadow: none; }
.nav-page-link.tab.active { background: var(--accent); color: #111; }

.nav-subaction,
.nav-action,
.nav-file-action {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 38px;
  padding: 7px 11px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #8b3900;
  box-shadow: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
  text-align: left;
}

.nav-subaction::before { margin-right: 7px; color: var(--accent); content: "↳"; }
.nav-subaction:hover:not(:disabled),
.nav-action:hover:not(:disabled),
.nav-file-action:hover { background: #fff0e4; transform: none; box-shadow: none; }

.nav-file-action input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.nav-project-actions {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  padding-top: 11px;
  border-top: 1px solid #e5a577;
}

.nav-project-actions .nav-action {
  justify-content: center;
  min-height: 42px;
  border: 1px solid #e4a171;
  background: #fff;
  color: #51250a;
  text-align: center;
}

.nav-project-actions .nav-action-primary { border-color: #111; background: var(--accent); color: #111; }

.compact-menu {
  left: 0;
  width: 280px;
  gap: 5px;
  transform: none;
}

.settings-menu { right: 0; left: auto; }

.app-user-menu {
  min-width: max-content;
}

.app-status-wrap {
  max-width: 1800px;
  min-height: 8px;
  margin: 0 auto;
  padding: 8px 22px 0;
}

.app-status-wrap .status:empty { display: none; }

@media (max-width: 1050px) {
  .app-header { grid-template-columns: auto 1fr auto; gap: 12px; }
  .brand-copy .brand-kicker { display: none; }
  .main-nav-toggle { padding-inline: 12px; }
  .app-user-menu span { display: none; }
}

@media (max-width: 800px) {
  body.main-menu-open { overflow: hidden; }

  .app-header,
  body.weekend-mode .app-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 9px 12px;
  }

  .app-brand { min-width: 0; }
  .brand-logo { width: 56px; height: 44px; }
  .app-header h1,
  body.weekend-mode .app-header h1 { font-size: 20px; }
  .brand-kicker { display: none; }

  .main-menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 44px;
    padding: 7px 14px;
    border-color: #111;
    background: var(--accent);
  }

  .main-menu-toggle span { font-size: 19px; }

  .main-navigation {
    grid-column: 1 / -1;
    display: none;
    max-height: calc(100dvh - 130px);
    overflow-y: auto;
    align-items: stretch;
    justify-content: stretch;
    gap: 7px;
    padding: 10px 0 4px;
    border-top: 1px solid #df9f70;
  }

  .main-navigation.mobile-open { display: grid; }

  .main-nav-toggle {
    display: flex;
    justify-content: space-between;
    width: 100%;
    min-height: 48px;
    border-color: #e4a171;
    border-radius: 11px;
    background: #fffaf6;
    text-align: left;
  }

  .main-nav-group.active-section > .main-nav-toggle { border-color: #111; }
  .main-nav-group.open > .main-nav-toggle { box-shadow: none; }

  .main-nav-dropdown,
  .compact-menu,
  .settings-menu {
    position: static;
    width: 100%;
    margin-top: 6px;
    padding: 8px;
    border-width: 1px;
    border-radius: 12px;
    box-shadow: none;
    transform: none;
  }

  .bloemtelling-menu { grid-template-columns: 1fr; }

  .nav-page-group {
    grid-template-columns: minmax(125px, .8fr) minmax(150px, 1.2fr);
    align-items: center;
    padding: 5px;
  }

  .nav-page-group-single { grid-template-columns: 1fr; }
  .nav-page-link.tab { min-height: 44px; font-size: 15px; }
  .nav-subaction { min-height: 44px; }

  .nav-project-actions {
    grid-template-columns: 1fr 1fr;
  }

  .nav-project-actions .nav-action { min-height: 46px; }

  .app-user-menu {
    display: none;
    grid-column: 1 / -1;
    justify-content: space-between;
    width: 100%;
    padding: 8px 0 2px;
    border: 0;
    border-top: 1px solid #df9f70;
  }

  .main-navigation.mobile-open + .app-user-menu { display: flex; }
  .main-navigation.mobile-open + .app-user-menu span { display: inline; }

  .app-status-wrap { padding: 5px 10px 0; }
  body.weekend-mode { padding-bottom: 0; }
  .mobile-weekend-nav { display: none !important; }
  .weekend-actions-grid [data-weekend-action] { display: block !important; }
}

@media (max-width: 430px) {
  .nav-page-group { grid-template-columns: 1fr; }
  .nav-subaction { padding-left: 12px; }
}

/* Zakelijke interface v2: vlak, operationeel en compact. */
:root {
  --bg: #fff0e4;
  --surface: #fffaf6;
  --surface-soft: #ffe6d2;
  --line: #e4b38e;
  --line-strong: #c9783d;
  --text: #17120f;
  --muted: #6b5547;
  --accent: #ff7d17;
  --accent-dark: #a84000;
  --danger: #b9342b;
  --warning-bg: #fff1c7;
  --shadow-sm: 0 2px 8px rgba(91, 43, 13, 0.09);
  --shadow-md: 0 10px 28px rgba(64, 31, 11, 0.15);
}

html { background: var(--bg); }

body {
  min-height: 100vh;
  background: var(--bg) !important;
  color: var(--text);
}

body::before { pointer-events: none; }

h1,
h2,
h3 {
  color: var(--text);
  font-weight: 750;
  letter-spacing: -0.018em;
}

h1 { font-size: 26px; line-height: 1.1; }
h2 { font-size: 22px; line-height: 1.2; }
h3 { font-size: 17px; line-height: 1.25; }

button,
.file-button,
.secondary-file-button,
.action-menu > summary {
  min-height: 42px;
  border: 1px solid var(--accent-dark);
  border-radius: 8px;
  background: var(--accent);
  color: var(--text);
  box-shadow: none;
  font-weight: 750;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

button:hover:not(:disabled),
.file-button:hover,
.secondary-file-button:hover,
.action-menu > summary:hover {
  background: #f06e08;
  box-shadow: none;
  transform: none;
}

.secondary-button,
.secondary-file-button,
.action-menu > summary {
  border-color: var(--line-strong);
  background: var(--surface);
  color: #713006;
}

.secondary-button:hover:not(:disabled),
.secondary-file-button:hover,
.action-menu > summary:hover {
  background: #ffead9;
  color: #512205;
}

.danger-button,
.danger-button:hover:not(:disabled) {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

.primary-action { min-height: 44px; padding-inline: 18px; }

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
.file-button:focus-within,
.secondary-file-button:focus-within {
  outline: 3px solid #16110e;
  outline-offset: 2px;
}

input,
select,
textarea {
  min-height: 40px;
  border: 1px solid #c99066;
  border-radius: 7px;
  background: #fff;
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent-dark);
  outline-color: rgba(255, 125, 23, 0.25);
}

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

.secondary-file-button,
.file-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  cursor: pointer;
  white-space: nowrap;
}

.secondary-file-button input,
.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

/* Zakelijk gesplitst loginscherm */
.app-login-screen {
  padding: 24px;
  overflow: auto;
  background: var(--surface-soft) !important;
}

.app-login-shell {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(360px, 1.1fr);
  width: min(900px, 100%);
  min-height: 510px;
  overflow: hidden;
  border: 1px solid #d99868;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.login-brand-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 30px;
  padding: 48px;
  background: var(--accent);
  color: var(--text);
}

.login-brand-panel p {
  max-width: 31ch;
  font-size: 17px;
  line-height: 1.5;
}

.login-brand-panel .brand-kicker { color: #4f2105; }
.login-brand-logo { width: 112px; height: 82px; }

.app-login-card {
  align-content: center;
  gap: 18px;
  width: 100%;
  padding: 56px;
  border: 0;
  border-radius: 0;
  background: var(--surface);
  box-shadow: none;
}

.app-login-card label {
  display: grid;
  gap: 7px;
  color: #3f3027;
  font-size: 14px;
  font-weight: 700;
}

.app-login-card input { width: 100%; min-height: 46px; }
.app-login-card button { min-height: 48px; }
.login-form-heading { display: grid; gap: 7px; margin-bottom: 4px; }
.login-form-heading h2 { font-size: 28px; }
.app-login-card .status { padding: 0; background: transparent; }

/* Lage header met bestemmingmenu's */
.app-header,
body.weekend-mode .app-header {
  position: sticky;
  z-index: 100;
  top: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 22px;
  min-height: 64px;
  max-height: 64px;
  padding: 6px 20px;
  border: 0;
  background: var(--accent);
  box-shadow: 0 2px 10px rgba(75, 34, 8, 0.16);
}

.app-header::after { display: none; }

.app-brand { gap: 10px; min-width: max-content; }
.app-brand .brand-logo { width: 54px; height: 40px; }
.app-header h1,
body.weekend-mode .app-header h1 { font-size: 20px; }
.app-header .brand-kicker { margin-bottom: 2px; color: #542305; font-size: 9px; }

.main-menu-toggle { display: none; }

.main-navigation {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
}

.main-nav-groups {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-width: 0;
}

.main-nav-toggle {
  min-height: 40px;
  padding: 6px 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
}

.main-nav-toggle:hover:not(:disabled) { background: rgba(255, 255, 255, 0.28); }

.main-nav-group.active-section > .main-nav-toggle {
  border-color: rgba(23, 18, 15, 0.45);
  background: rgba(255, 250, 246, 0.82);
}

.main-nav-group.open > .main-nav-toggle {
  border-color: var(--text);
  background: var(--surface);
  box-shadow: none;
}

.main-nav-dropdown,
.bloemtelling-menu,
.compact-menu {
  top: calc(100% + 7px);
  left: 0;
  width: 248px;
  padding: 6px;
  border: 1px solid #c88b5e;
  border-radius: 9px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  transform: none;
}

.bloemtelling-menu { grid-template-columns: 1fr; gap: 2px; }
.compact-menu { gap: 2px; }
.settings-menu { right: 0; left: auto; }

.nav-page-link.tab {
  justify-content: flex-start;
  min-height: 42px;
  padding: 8px 11px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  text-align: left;
}

.nav-page-link.tab:hover:not(:disabled) { background: #ffead9; }
.nav-page-link.tab.active { background: var(--accent); color: var(--text); }

.app-user-menu {
  display: flex;
  gap: 9px;
  min-width: max-content;
  padding-left: 12px;
  border-left: 1px solid rgba(23, 18, 15, 0.3);
}

.app-user-menu span { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-user-menu .secondary-button { min-height: 38px; border-color: rgba(23, 18, 15, 0.5); background: rgba(255, 255, 255, 0.34); color: var(--text); }
.app-user-menu .secondary-button:hover { background: rgba(255, 255, 255, 0.62); }

/* Paginastructuur en acties */
main { max-width: 1640px; padding: 18px 24px 44px; }
.app-status-wrap { min-height: 0; padding: 0; }

.app-status-wrap .status:not(:empty) {
  margin-bottom: 10px;
  padding: 9px 12px;
  border: 1px solid #d7b38c;
  border-radius: 7px;
  background: #fff8ee;
}

.app-status-wrap .status.error { border-color: #d99b95; background: #fff0ee; }

.project-workspace-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 12px;
}

.action-menu { position: relative; }
.action-menu > summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  cursor: pointer;
  list-style: none;
}

.action-menu > summary::-webkit-details-marker { display: none; }
.action-menu[open] > summary span { transform: rotate(180deg); }

.action-menu-content {
  position: absolute;
  z-index: 70;
  top: calc(100% + 6px);
  right: 0;
  display: grid;
  gap: 4px;
  width: 245px;
  padding: 6px;
  border: 1px solid #c88b5e;
  border-radius: 9px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.action-menu-content button,
.action-menu-content .secondary-file-button {
  justify-content: flex-start;
  width: 100%;
  min-height: 42px;
  border-color: transparent;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.action-menu-content button:hover,
.action-menu-content .secondary-file-button:hover { background: #ffead9; }
.action-menu-content .danger-button { color: var(--danger); }
.action-menu-content .danger-button:hover { background: #fff0ee; color: var(--danger); }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.page-header-copy { display: grid; gap: 5px; min-width: 0; }
.page-header-copy h2,
.page-header-copy p { margin: 0; }
.page-header-copy p { max-width: 76ch; color: var(--muted); font-size: 14px; line-height: 1.45; }

.page-header-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.search-field input { width: min(260px, 30vw); }
.compact-add-form { flex-wrap: nowrap; }
.compact-add-form input { width: 210px; }

.settings-disclosure,
.weekend-detail {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}

.settings-disclosure > summary,
.weekend-detail > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 750;
  list-style: none;
}

.settings-disclosure > summary::-webkit-details-marker,
.weekend-detail > summary::-webkit-details-marker { display: none; }
.settings-disclosure-content { display: grid; gap: 10px; padding: 0 14px 14px; }

.table-wrap,
.weekend-card,
.kpi-card,
.user-editor,
.scanner-camera-card,
.scanner-selection-card,
.component-row,
.object-input,
.object-input-card,
.prep-table-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.table-wrap { border-radius: 9px; box-shadow: none; }
th { background: #ffe2cb; color: var(--text); }
tfoot th,
tfoot td { background: #fff0e4; }
tbody tr:hover td { background-color: rgba(255, 125, 23, 0.065); }

.object-input-list { gap: 12px; }
.object-input-head { padding: 10px 12px; border-bottom-color: var(--line); background: #ffe2cb; }
.object-input.locked .object-input-head { background: #f5e9df; }
.component-row { padding: 10px; }

/* Taakgerichte prikweekendweergave */
.weekend-panel { max-width: 1380px; }
.weekend-heading { margin-bottom: 12px; }
.weekend-alerts { gap: 6px; margin-bottom: 10px; }
.weekend-alert { padding: 9px 11px; border-radius: 7px; }

.kpi-grid {
  grid-template-columns: repeat(5, minmax(112px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.kpi-card { padding: 11px 12px; box-shadow: none; }
.kpi-card strong { margin: 2px 0; font-size: 23px; }

.weekend-task-switcher {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 10px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffe2cb;
}

.weekend-task-switcher button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  min-height: 48px;
  border-color: transparent;
  background: transparent;
  color: #56301b;
  text-align: left;
}

.weekend-task-switcher button span {
  display: inline-grid;
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid #c67d47;
  border-radius: 6px;
  background: var(--surface);
  font-size: 12px;
}

.weekend-task-switcher button:hover:not(:disabled) { background: rgba(255, 255, 255, 0.55); }
.weekend-task-switcher button[aria-selected="true"] { border-color: var(--accent-dark); background: var(--accent); color: var(--text); }
.weekend-task-switcher button[aria-selected="true"] span { border-color: var(--text); }

.weekend-actions-grid { display: block; margin-bottom: 12px; }
.weekend-task-panel { max-width: 820px; min-height: 250px; margin: 0; padding: 18px; }
.weekend-task-panel[hidden] { display: none !important; }
.weekend-task-panel > .muted { max-width: 70ch; margin-bottom: 14px; }
.weekend-primary-action,
.weekend-task-panel .stack-form button { min-height: 50px; }

.weekend-details { display: grid; gap: 7px; }
.weekend-detail { margin: 0; box-shadow: none; }
.weekend-detail > summary { min-height: 54px; }
.weekend-detail > summary > span:first-child { display: grid; gap: 2px; }
.weekend-detail > summary small { color: var(--muted); font-size: 12px; font-weight: 550; }
.weekend-detail[open] > summary { border-bottom: 1px solid var(--line); background: #fff4eb; }
.weekend-detail[open] > summary > span:last-child { transform: rotate(180deg); }
.weekend-detail-content { padding: 12px; }
.weekend-detail-content .table-wrap { margin: 0; }

.scanner-camera-actions button,
.scanner-camera-actions .scanner-photo-button,
.scanner-status-actions button,
.prep-table-action-button { min-height: 50px; }

.modal-dialog {
  border: 1px solid #b87341;
  border-radius: 11px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.modal-head { padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.status-badge,
.priority-badge,
.progress-badge { border-radius: 999px; }

@media (max-width: 980px) {
  .page-header { align-items: flex-start; }
  .page-header-actions { flex-wrap: wrap; }
  .summary-grid,
  .settings-layout { grid-template-columns: 1fr; }
}

@media (max-width: 800px) {
  body.main-menu-open { overflow: hidden; }

  body.main-menu-open::before {
    position: fixed;
    z-index: 90;
    inset: 0;
    background: rgba(23, 18, 15, 0.48);
    content: "";
    pointer-events: auto;
  }

  .app-header,
  body.weekend-mode .app-header {
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 56px;
    max-height: 56px;
    padding: 5px 10px;
  }

  .app-brand .brand-logo { width: 43px; height: 33px; }
  .app-header h1,
  body.weekend-mode .app-header h1 { font-size: 18px; }
  .app-header .brand-kicker { display: none; }

  .main-menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 44px;
    border-color: rgba(23, 18, 15, 0.6);
    background: rgba(255, 255, 255, 0.42);
  }

  .main-navigation {
    position: fixed;
    z-index: 120;
    top: 0;
    right: 0;
    bottom: 0;
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    width: min(88vw, 370px);
    max-height: none;
    padding: 70px 14px 14px;
    overflow: hidden;
    border: 0;
    background: var(--surface);
    box-shadow: -12px 0 32px rgba(27, 16, 9, 0.2);
    transform: translateX(105%);
    visibility: hidden;
    transition: transform 180ms ease, visibility 180ms ease;
  }

  .main-navigation.mobile-open { transform: translateX(0); visibility: visible; }

  .main-menu-close {
    position: absolute;
    top: 10px;
    right: 14px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 44px;
  }

  .main-menu-close span { font-size: 22px; line-height: 1; }

  .main-nav-groups {
    display: grid;
    align-content: start;
    gap: 7px;
    overflow-y: auto;
  }

  .main-nav-toggle {
    display: flex;
    justify-content: space-between;
    width: 100%;
    min-height: 48px;
    border-color: var(--line);
    border-radius: 8px;
    background: #fff4eb;
  }

  .main-nav-group.active-section > .main-nav-toggle { border-color: var(--accent-dark); background: #ffe2cb; }

  .main-nav-dropdown,
  .bloemtelling-menu,
  .compact-menu,
  .settings-menu {
    position: static;
    width: 100%;
    margin-top: 4px;
    padding: 4px 4px 4px 13px;
    border: 0;
    border-left: 2px solid var(--accent);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .nav-page-link.tab { min-height: 46px; }

  .app-user-menu {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-top: auto;
    padding: 14px 0 0;
    border: 0;
    border-top: 1px solid var(--line);
  }

  .app-user-menu span { display: inline; }
  .app-user-menu .secondary-button { background: #fff0e4; }

  main { padding: 14px 14px 32px; }
  .project-workspace-bar { justify-content: stretch; }
  .project-workspace-bar > * { flex: 1 1 0; }
  .project-workspace-bar summary,
  .project-workspace-bar > button { width: 100%; }

  .page-header { align-items: stretch; flex-direction: column; gap: 12px; }
  .page-header-actions { justify-content: flex-start; width: 100%; }
  .search-field { flex: 1 1 180px; }
  .search-field input { width: 100%; }

  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .weekend-task-switcher { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .weekend-task-panel { max-width: none; min-height: 0; }
}

@media screen and (max-width: 650px) {
  .app-login-screen { padding: 12px; }
  .app-login-shell { grid-template-columns: 1fr; min-height: 0; }
  .login-brand-panel { gap: 18px; padding: 22px; }
  .login-brand-panel p { display: none; }
  .login-brand-logo { width: 78px; height: 58px; }
  .login-brand-panel h1 { font-size: 25px; }
  .app-login-card { padding: 26px 22px 30px; }
  .login-form-heading h2 { font-size: 24px; }

  .page-header-actions > button,
  .page-header-actions > .secondary-file-button,
  .page-header-actions > .action-menu { flex: 1 1 auto; }
  .page-header-actions .action-menu > summary { width: 100%; }
  .compact-add-form { flex: 1 1 100%; width: 100%; }
  .compact-add-form input { flex: 1 1 auto; width: auto; min-width: 0; }

  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-card:last-child { grid-column: 1 / -1; }
  .weekend-task-switcher { gap: 5px; padding: 5px; }
  .weekend-task-switcher button { min-height: 50px; padding: 7px 8px; font-size: 13px; }
  .weekend-task-panel { padding: 14px; }

  .action-menu-content { position: fixed; top: auto; right: 12px; bottom: 12px; left: 12px; width: auto; }
  .scanner-panel { padding: 0; }

  #summary,
  #summary .summary-grid,
  #summary .summary-totals-page,
  #summary .summary-components-pages,
  #summary .print-page-content,
  #summary .component-summary {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  #summary .table-wrap {
    width: 100%;
    max-width: 100%;
    max-height: none;
    overflow: visible;
    border: 0;
    background: transparent;
  }

  #summary table,
  #summary #totalsTable,
  #summary .component-summary-table {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    table-layout: auto;
    background: transparent;
  }

  #summary colgroup,
  #summary table > thead {
    display: none;
  }

  #summary table > tbody,
  #summary table > tfoot {
    display: grid;
    gap: 10px;
    width: 100%;
  }

  #summary table > tbody > tr,
  #summary table > tfoot > tr {
    display: grid;
    width: 100%;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
  }

  #summary table > tbody > tr.warn {
    border-color: #d7a928;
    background: var(--warning-bg);
  }

  #summary table > tbody > tr > td {
    display: grid;
    grid-template-columns: minmax(98px, 0.85fr) minmax(0, 1.4fr);
    align-items: center;
    gap: 10px;
    width: 100%;
    min-width: 0;
    padding: 8px 10px;
    border-right: 0;
    white-space: normal;
    text-align: left;
    overflow-wrap: anywhere;
  }

  #summary table > tbody > tr > td::before,
  #summary table > tfoot > tr > td::before {
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
    line-height: 1.25;
    content: attr(data-label);
  }

  #summary table > tbody > tr > td:last-child { border-bottom: 0; }
  #summary table > tbody > tr > td[colspan] {
    display: block;
    text-align: center;
  }
  #summary table > tbody > tr > td[colspan]::before { display: none; }
  #summary table .flower-cell { width: 100%; min-width: 0; }
  #summary table .flower-cell > * { min-width: 0; }
  #summary table .flower-meta { white-space: normal; }

  #summary table > tfoot { margin-top: 10px; }
  #summary table > tfoot > tr {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 10px;
    border-color: var(--accent);
    background: #fff4eb;
  }

  #summary table > tfoot > tr > th {
    position: static;
    grid-column: 1 / -1;
    padding: 0 0 8px;
    border: 0;
    background: transparent;
    font-size: 16px;
  }

  #summary table > tfoot > tr > td {
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 7px;
    border: 0;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.72);
    text-align: left;
    overflow-wrap: anywhere;
  }

  #summary .component-summary { margin-top: 14px; }
  #summary .component-summary h3 {
    margin: 0 0 8px;
    padding: 10px 12px;
    border-radius: 9px;
    font-size: 17px;
  }
}

@media (max-width: 650px) {
  .component-crate-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
  .component-crate-toolbar { align-items: flex-start; padding: 10px 12px; font-size: 12px; }
  .component-crate-list { max-height: 56dvh; padding: 8px; }
  .component-crate-option { padding: 10px; }
  .component-crate-dialog .modal-actions { position: sticky; bottom: 0; display: grid; grid-template-columns: 1fr; }
  .component-crate-dialog .modal-actions button { width: 100%; min-height: 46px; }
}

@media (max-width: 420px) {
  .brand-copy { min-width: 0; }
  .app-brand .brand-logo { width: 38px; }
  .app-header h1,
  body.weekend-mode .app-header h1 { font-size: 17px; }
  .main-menu-toggle { padding-inline: 10px; }
  .project-workspace-bar { flex-wrap: wrap; }
  .project-workspace-bar > * { flex-basis: 100%; }
  .page-header-actions { align-items: stretch; flex-direction: column; }
  .page-header-actions > * { width: 100%; }
}

@media print {
  body { background: #fff !important; }
  .project-workspace-bar,
  .page-header-actions,
  .settings-disclosure,
  .weekend-task-switcher { display: none !important; }
  .page-header { padding-bottom: 8px; border-color: #aaa; }
  .table-wrap,
  .weekend-card,
  .kpi-card { box-shadow: none; }
}

/* Editing, review and integration controls. */
.project-save-state { display:flex; gap:12px; align-items:center; margin-right:auto; flex-wrap:wrap; }
#projectSaveStatus { font-size:13px; color:#355044; }
#projectSaveStatus[data-state="error"], [data-dialog-status].error { color:#a12617; }
#projectSaveStatus[data-state="dirty"] { color:#865006; }
.project-save-state button { min-height:40px; }
.review-dialog { padding:24px; max-width:760px; width:calc(100% - 32px); max-height:85vh; overflow:auto; background:var(--surface,#fffaf5); border-radius:12px; }
.review-differences { max-height:55vh; overflow:auto; overflow-wrap:anywhere; }
.review-actions { display:flex; justify-content:flex-end; gap:12px; position:sticky; bottom:0; background:var(--surface,#fffaf5); padding-top:12px; }
[data-dialog-status] { padding:10px 16px; background:#fff1db; white-space:pre-wrap; }
[data-weekend-connection] { font-size:12px; color:#47634f; }
[data-weekend-connection].error { color:#a12617; }
.scale-keyboard-panel { display:grid; gap:10px; padding:12px; background:#fff8ef; border:1px solid #d7c6b5; border-radius:8px; }
.scale-keyboard-row { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:8px; }
.scale-keyboard-panel label { display:grid; gap:4px; min-width:0; font-size:12px; }
.scale-keyboard-panel input, .scale-keyboard-panel select { width:100%; min-width:0; }
#scaleDrawingStatus { padding:8px 18px; margin:0; }
#scaleDrawingStatus:empty { display:none; }
@media (max-width:650px) {
 .project-save-state { width:100%; justify-content:space-between; }
 .project-save-state button { width:auto; }
 .input-table-wrap .allocation-cell input[type="number"] { min-width:58px; font-size:16px; padding:5px; }
}

/* Each component has one accent; its nested tables share a quiet surface. */
.object-input-list { gap: 24px; }
.object-input {
  --component-accent: #276752;
  --component-tint: #e6f1eb;
  border: 1px solid var(--component-accent);
  border-inline-start: 5px solid var(--component-accent);
  overflow: clip;
}
.object-input[data-component-tone="1"] { --component-accent: #365e91; --component-tint: #e8eef8; }
.object-input[data-component-tone="2"] { --component-accent: #80538e; --component-tint: #f1e9f5; }
.object-input[data-component-tone="3"] { --component-accent: #95621d; --component-tint: #f8eedc; }
.object-input[data-component-tone="4"] { --component-accent: #9b4e59; --component-tint: #f7e9ec; }
.object-input .object-input-head,
.object-input.locked .object-input-head,
.object-input.compact .object-input-head {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  padding: 16px;
  background: var(--component-tint);
  border-bottom: 1px solid var(--component-accent);
}
.object-input .component-heading { min-width: 0; }
.object-input .object-input-head h3 {
  display: flex;
  min-height: 40px;
  margin: 0;
  font-size: 18px;
  line-height: 1.35;
  color: var(--component-accent);
}
.object-input .object-input-head h3 > span { overflow-wrap: anywhere; }
.object-input .object-input-head .icon-button { flex: 0 0 32px; width: 32px; height: 32px; margin: 0; }
.object-input .component-heading > .muted { display: block; margin: 6px 0 0 40px; }
.object-input .component-collapse-button {
  display: grid;
  place-items: center;
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 0;
  margin: 0;
  color: var(--component-accent);
  border: 1px solid currentColor;
  border-radius: 8px;
  background: #fff;
}
.component-chevron { width: 9px; height: 9px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); }
[aria-expanded="false"] > .component-chevron { transform: translateX(-2px) rotate(-45deg); }
.object-input .component-collapse-button:focus-visible { outline: 3px solid var(--component-accent); outline-offset: 3px; }
.object-input .total-field, .object-input .total-pill { margin: 0; align-self: start; }
.object-input .surface-items,
.object-input .alternative-materials { background: #fff; }
.object-input .surface-items-head,
.object-input .input-table-wrap thead th { background: #f3f4f3; }
.object-input .input-table-wrap tfoot th,
.object-input .input-table-wrap tfoot td,
.object-input .mobile-allocation-summary { background: var(--component-tint); }
@media (max-width: 650px) {
  .object-input .object-input-head,
  .object-input.locked .object-input-head,
  .object-input.compact .object-input-head { grid-template-columns: 40px minmax(0, 1fr); gap: 8px; padding: 12px; }
  .object-input .total-field, .object-input .total-pill { grid-column: 2; justify-self: start; }
  .object-input .component-heading > .muted { margin-left: 0; }
}
.object-input.component-collapsed > :not(.object-input-head):not(.mobile-allocation-summary) { display:none; }
.object-input.component-collapsed .object-input-head .muted { display:none; }
.design-source { font-size:12px; overflow-wrap:anywhere; color:var(--muted); }
@media(max-width:600px) { .page-header-actions .search-field { flex:0 0 auto; } }

/* Allocation totals stay legible in collapsed components at every screen size. */
.object-input .mobile-allocation-summary {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  padding: 4px 16px;
  border-top: 0;
  background: #fff;
}
.object-input .mobile-allocation-summary > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(3.5rem, auto) minmax(6.5rem, auto);
  align-items: baseline;
  gap: 12px;
  padding: 10px 0;
  background: transparent;
}
.object-input .mobile-allocation-summary > div + div { border-top: 1px solid var(--line); }
.object-input .mobile-allocation-summary span {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}
.object-input .mobile-allocation-summary strong {
  text-align: right;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
  line-height: 1.4;
}
.object-input .mobile-allocation-summary strong:first-of-type {
  color: var(--component-accent);
  font-size: 18px;
  font-weight: 750;
}
.object-input .mobile-allocation-summary strong:last-of-type {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}
.object-input.component-collapsed .mobile-allocation-summary { display: grid; }
@media (max-width: 380px) {
  .object-input .mobile-allocation-summary { padding-inline: 12px; }
  .object-input .mobile-allocation-summary > div { column-gap: 8px; grid-template-columns: minmax(0, 1fr) minmax(3rem, auto) minmax(5.5rem, auto); }
}
