/* Buttons, sections, fields, tables, banners. Tokens only - never a literal
   colour, so the whole app rethemes by editing css/tokens.css. */

/* ------------------------------------------------------------- surfaces -- */

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}

.panel h2, .panel h3 { margin: 0; font-size: 15px; }
.panel h2 { font-size: 18px; }

.panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.panel__head h2, .panel__head h3 { margin: 0; }
.panel__head p { margin: 2px 0 0; }

.rule { border: none; border-top: 1px solid var(--border); margin: var(--space-2) 0; }

.muted { color: var(--text-faint); font-size: 12px; margin: 0; }

/* The "fill a plate and save" chart. */
.savings {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-2);
  margin-top: var(--space-2);
  background: var(--surface-soft, var(--surface));
}
.savings__headline { font-size: 14px; margin-bottom: var(--space-1); }
.savings__note { margin-top: var(--space-1); }
.savings-chart { width: 100%; height: auto; }

.empty {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: var(--space-6) var(--space-4);
  text-align: center;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* -------------------------------------------------------------- buttons -- */

.btn {
  font: inherit;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  min-height: 32px;
  /* A .btn may be an <a> (e.g. the coffee link): keep it from being underlined. */
  text-decoration: none;
}
.btn:hover { background: var(--panel-3); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:focus-visible, .chip:focus-visible, .input:focus-visible, .select:focus-visible,
.section__toggle:focus-visible, .info:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 1px;
}

/* --accent is ~2.3:1 on white: it fills and outlines, it never carries text.
   Accent-coloured text uses --accent-strong. */
.btn-primary {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: var(--accent-ink);
}
.btn-primary:hover { filter: brightness(1.08); background: var(--accent-strong); }

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

/* In-app confirmation dialog (replaces window.confirm, which sandboxes block). */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.45); padding: var(--space-4);
}
.modal-card {
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  padding: var(--space-4); max-width: 26rem; width: 100%;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
.modal-card__title { margin: 0 0 var(--space-2); font-size: 1.05rem; }
.modal-card__body { margin: 0 0 var(--space-4); color: var(--text-2); }
.modal-card__actions { display: flex; gap: var(--space-2); justify-content: flex-end; }

/* A round, single-glyph button. Used for the theme switch, which reports its
   state through the glyph and its accessible name, not a word. */
.btn-icon {
  width: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
}

.btn-row { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; }

.linkish {
  font: inherit; font-size: 12px; background: none; border: none; padding: 0;
  color: var(--accent-strong); cursor: pointer; text-decoration: underline;
}

/* ----------------------------------------------------------- segmented -- */

.segmented {
  display: flex; flex-wrap: wrap; gap: 2px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
}

.segmented__btn {
  font: inherit; font-size: 13px;
  flex: 1 1 auto;
  padding: 7px var(--space-3);
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
}
.segmented__btn:hover { background: var(--panel-3); }
.segmented__btn.is-active { background: var(--panel); color: var(--text); font-weight: 600; box-shadow: var(--shadow-sm); }
/* A quiet divider between the workflow groups: a hairline, not a wall. It is a
   flex item that never grows, so it does not steal tab width. */
.segmented__sep {
  flex: 0 0 auto; align-self: stretch; width: 1px; margin: 3px 4px;
  background: var(--border);
}
@media (max-width: 640px) { .segmented__sep { display: none; } }

.chipset { display: flex; flex-wrap: wrap; gap: var(--space-2); }

.chip {
  font: inherit; font-size: 13px;
  padding: 5px var(--space-3);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text-dim);
  cursor: pointer;
}
.chip:hover { background: var(--panel-2); }
.chip[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent-strong);
  color: var(--accent-strong);
  font-weight: 600;
}

.chipset--modes .chip { font-size: 12px; padding: 4px var(--space-2); }

.pill {
  display: inline-block;
  font-size: 11px; font-weight: 600;
  padding: 2px var(--space-2);
  border-radius: 999px;
  border: 1px solid;
}
.pill--info { color: var(--text-dim); border-color: var(--border-strong); background: var(--panel-2); }
.pill--ok { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); }
.pill--warn { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }
.pill--danger { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }

/* ------------------------------------------------------------- sections -- */

.section { border-bottom: 1px solid var(--border); }

.section__head {
  display: flex; align-items: center; gap: var(--space-2);
  background: var(--panel-2);
  padding-right: var(--space-3);
}

.section__toggle {
  flex: 1 1 auto;
  display: flex; align-items: center; gap: var(--space-2);
  font: inherit; font-size: 12px; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-dim);
  background: none; border: none;
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  text-align: left;
}

.section__chevron { transition: transform 0.15s ease; font-size: 10px; }
.section__chevron.is-closed { transform: rotate(-90deg); }

.section__actions { display: flex; gap: var(--space-2); }

.section__body {
  padding: var(--space-4);
  display: flex; flex-direction: column; gap: var(--space-3);
  border-top: 1px solid var(--border);
}

/* Deliberately quieter than a section, so the hierarchy reads at a glance. */
.subsection { display: flex; flex-direction: column; gap: var(--space-3); }
.subsection__title {
  margin: var(--space-2) 0 0;
  font-size: 12px; font-weight: 600; color: var(--text-dim);
}
.subsection__hint { margin: 0; font-size: 11px; color: var(--text-faint); }

/* --------------------------------------------------------------- fields -- */

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }

.field__label {
  display: flex; align-items: center; gap: var(--space-2);
  font-size: 12px; font-weight: 600; color: var(--text-dim);
}

.field__hint { font-size: 11px; color: var(--text-faint); }
.field__row { display: flex; align-items: center; gap: var(--space-2); }
.field__row .input { flex: 1 1 auto; min-width: 0; }
.field__suffix { font-size: 12px; color: var(--text-faint); white-space: nowrap; }

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: var(--space-3);
}

.input, .select {
  font: inherit;
  width: 100%;
  min-width: 0;
  padding: 6px var(--space-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text);
}
.input--area { resize: vertical; min-height: 60px; font-family: inherit; }
/* A field the production gate is waiting on — grams or print time not yet entered. */
.input--error {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--danger) 25%, transparent);
  background: color-mix(in srgb, var(--danger) 8%, var(--panel));
}

/* Client-form validation: red when wrong (with a message), green when a value
   already looks valid, and an asterisk on the required fields. */
.field--error .input { border-color: var(--danger); }
.field__error { margin-top: var(--space-1); font-size: 12px; color: var(--danger); }
.field--valid .input {
  border-color: var(--ok);
  background: var(--ok-soft);
  box-shadow: 0 0 0 2px var(--ok) inset;
}

/* The print-type radar (portal picker and profile settings). */
.radar { display: flex; justify-content: center; padding: var(--space-2) 0; }
.radar svg { width: 100%; max-width: 210px; height: auto; }
.field__req { color: var(--danger); font-weight: 700; }

/* The client's confirm-before-send summary. */
.modal-overlay {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-4);
  background: rgba(0, 0, 0, 0.45);
}
.modal {
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--space-4);
  width: min(560px, 100%); max-height: 85vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: var(--space-3);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}
.summary-parts { display: flex; flex-direction: column; gap: var(--space-3); }
.summary-part {
  display: flex; flex-direction: column; gap: 2px;
  padding-bottom: var(--space-2); border-bottom: 1px dashed var(--border);
}

.field--check { flex-direction: column; }
.check__label {
  display: flex; align-items: center; gap: var(--space-2);
  font-size: 13px; color: var(--text); cursor: pointer;
}
.check { width: 15px; height: 15px; accent-color: var(--accent-strong); flex: 0 0 auto; }

.slider { width: 100%; accent-color: var(--accent-strong); }
.slider__value { margin-left: auto; font-size: 12px; color: var(--text); }

.row-editor {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto;
  gap: var(--space-2);
  align-items: end;
  padding-bottom: var(--space-2);
  border-bottom: 1px dashed var(--border);
}

/* A row-editor that stacks its fields instead of a single grid row — for a
   post-processing step, which carries several fields and its own header. */
.row-editor--stacked {
  display: flex;
  flex-direction: column;
  /* The base .row-editor uses align-items:end, which in a column flow would pin
     every field to the right edge. Stretch them to fill the row instead. */
  align-items: stretch;
  gap: var(--space-3);
  padding: var(--space-3) 0;
}
.row-editor__head {
  display: flex;
  gap: var(--space-2);
  align-items: end;
}
.row-editor__head > :first-child { flex: 1 1 auto; }

.part-block {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.part-block__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.part-block__head strong { font-size: 14px; }
/* The clickable accordion header for a part. */
.part-block--collapsed { padding: var(--space-3) var(--space-4); }
.part-block__toggle {
  display: flex; align-items: center; gap: var(--space-2);
  background: none; border: none; padding: 0; margin: 0; cursor: pointer;
  font: inherit; color: var(--text); text-align: left; flex: 1 1 auto; min-width: 0;
}
.part-block__toggle:hover strong { text-decoration: underline; }
.part-block__chev { color: var(--text-dim); font-size: 12px; width: 1em; flex: 0 0 auto; }

.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: var(--space-5) var(--space-3);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--text-dim);
  cursor: pointer;
  text-align: center;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--accent-strong); background: var(--accent-soft); }
.dropzone__hint { font-size: 11px; color: var(--text-faint); }

.info {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; flex: 0 0 auto;
  font-size: 10px; font-weight: 700; font-style: italic;
  border: 1px solid var(--border-strong); border-radius: 50%;
  background: var(--panel-2); color: var(--text-faint);
  cursor: help; padding: 0;
}

/* --------------------------------------------------------------- stats -- */

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-3);
}

.three-numbers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-3);
}

/* A row of filters above a list (quotes & invoices). */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-3);
  align-items: flex-end; margin-bottom: var(--space-3);
}
.filter-bar .field { margin: 0; }
.filter-bar .btn { min-height: 34px; }

.stat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3);
  display: flex; flex-direction: column; gap: 2px;
  min-width: 0;
}
.stat__label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-faint); }
.stat__value { font-size: 17px; font-weight: 600; color: var(--text); word-break: break-word; }
.stat__hint { font-size: 11px; color: var(--text-faint); }

.stat--big .stat__value { font-size: 26px; }
.stat--info { border-color: var(--border-strong); background: var(--panel-2); }
.stat--accent { border-color: var(--accent-strong); background: var(--accent-soft); }
.stat--accent .stat__value { color: var(--accent-strong); }
.stat--ok { border-color: var(--ok); background: var(--ok-soft); }
.stat--ok .stat__value { color: var(--ok); }
.stat--warn { border-color: var(--warn); background: var(--warn-soft); }
.stat--warn .stat__value { color: var(--warn); }
.stat--danger { border-color: var(--danger); background: var(--danger-soft); }
.stat--danger .stat__value { color: var(--danger); }

.value { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------- tables -- */

.table-wrap { overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}
.table th {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--text-faint);
  background: var(--panel-2);
  white-space: nowrap;
}
.table .is-right { text-align: right; }
.table tbody tr:hover { background: var(--panel-2); }

/* Click a row to select it (catalogue browse tables). */
.table tbody tr.is-clickable { cursor: pointer; }
.table tbody tr.is-clickable:hover { background: var(--panel-3); }
.table tbody tr.is-selected,
.table tbody tr.is-selected:hover {
  background: var(--accent-soft, var(--panel-3));
  box-shadow: inset 3px 0 0 var(--accent-strong);
}
.table tbody tr.is-archived { opacity: 0.5; font-style: italic; }
.table--compact th, .table--compact td { padding: 4px var(--space-2); }
.table--compact .input, .table--compact .select { padding: 3px 6px; font-size: 12px; }
.table .is-blocked { opacity: 0.55; }
.table td .field { gap: 0; }
.table td .btn { padding: 3px var(--space-2); min-height: 26px; font-size: 12px; }

/* --------------------------------------------------- money breakdown ---- */

.breakdown { gap: 0; }

.cost-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-3);
  align-items: baseline;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
}
.cost-row__label { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.cost-row__note {
  grid-column: 1;
  grid-row: 2;
  font-size: 11px;
  color: var(--text-faint);
}
.cost-row__amount { white-space: nowrap; }
.cost-row--strong { font-weight: 700; border-bottom-width: 2px; }
.cost-row--sub { padding-left: var(--space-4); color: var(--text-dim); }

.totals { display: flex; flex-direction: column; margin-top: var(--space-3); }

.doc-list { margin: 0; padding-left: var(--space-4); font-size: 12px; color: var(--text-dim); }

/* -------------------------------------------------------------- banners -- */

.banner {
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  border: 1px solid;
  display: flex; align-items: center; gap: var(--space-3);
  font-size: 13px;
}
.banner-info   { color: var(--text-dim); background: var(--panel-2); border-color: var(--border-strong); }
.banner-ok     { color: var(--ok);     background: var(--ok-soft);     border-color: var(--ok); }
.banner-warn   { color: var(--warn);   background: var(--warn-soft);   border-color: var(--warn); }
.banner-danger { color: var(--danger); background: var(--danger-soft); border-color: var(--danger); }
.banner__text { flex: 1 1 auto; }

.toast {
  position: fixed; left: 50%; bottom: var(--space-5); transform: translateX(-50%);
  z-index: 400;
  padding: var(--space-2) var(--space-4);
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
}

/* -------------------------------------------------------------- explain -- */

.explain-host { display: flex; flex-direction: column; gap: var(--space-2); }
.explain__heading { font-size: 16px; margin: var(--space-4) 0 0; }

.explain {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.explain__summary {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}
.explain__summary::-webkit-details-marker { display: none; }
.explain__summary::before { content: '?'; font-size: 11px; font-weight: 700;
  width: 16px; height: 16px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--accent-soft); color: var(--accent-strong); }
.explain__source { margin-left: auto; font-size: 11px; font-weight: 400; color: var(--text-faint); }

.explain__body {
  padding: 0 var(--space-4) var(--space-4);
  display: flex; flex-direction: column; gap: var(--space-3);
  border-top: 1px solid var(--border);
  padding-top: var(--space-3);
}
.explain__plain { margin: 0; color: var(--text-dim); }
.explain__formula {
  margin: 0; padding: var(--space-3);
  background: var(--panel-2);
  border-radius: var(--radius-sm);
  font-size: 12px;
  white-space: pre-wrap;
  overflow-x: auto;
}
.explain__worked {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px var(--space-3);
  font-size: 13px;
}
.explain__worked dt { color: var(--text-dim); }
.explain__worked dd { margin: 0; text-align: right; }
.explain__mistake { margin: 0; font-size: 12px; color: var(--text-dim);
  border-left: 3px solid var(--warn); padding-left: var(--space-3); }
.explain__correction { margin: 4px 0 0; font-size: 12px; color: var(--text-dim);
  border-left: 3px solid var(--ok); padding-left: var(--space-3); }

.facts {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px var(--space-3);
  font-size: 12px;
}
.facts dt { color: var(--text-faint); }
.facts dd { margin: 0; text-align: right; }

.equations { display: flex; flex-direction: column; gap: var(--space-4); }
.equation { display: flex; flex-direction: column; gap: 4px; }
.equation__name { font-weight: 600; }
.equation__formula {
  margin: 0; padding: var(--space-2) var(--space-3);
  background: var(--panel-2); border-radius: var(--radius-sm);
  font-size: 12px; white-space: pre-wrap; overflow-x: auto;
}
.equation__note { font-size: 12px; color: var(--text-faint); }

/* ------------------------------------------------------- printed sheet -- */

.sheet {
  background: #fff;
  color: #111;
  padding: 18mm;
  font-size: 11pt;
  line-height: 1.45;
  --sheet-accent: #111; /* overridden inline from the company's accent colour */
}
.sheet__head { display: flex; justify-content: space-between; gap: 12mm; margin-bottom: 10mm; }
.sheet__logo { max-height: 22mm; max-width: 70mm; margin-bottom: 3mm; display: block; }
.sheet__company h1 { margin: 0 0 2mm; font-size: 16pt; color: var(--sheet-accent); }
.sheet__company p { margin: 0; font-size: 9pt; }
.sheet__meta { text-align: right; min-width: 60mm; }
.sheet__meta h2 { margin: 0 0 3mm; font-size: 14pt; text-transform: uppercase; letter-spacing: 0.08em; color: var(--sheet-accent); }
.sheet__metarow { display: flex; justify-content: space-between; gap: 6mm; font-size: 9pt; }
.sheet__to { margin-bottom: 8mm; }
.sheet__to h3 { margin: 0 0 1mm; font-size: 9pt; text-transform: uppercase; letter-spacing: 0.06em; }
.sheet__to p { margin: 0; }
.sheet__table { width: 100%; border-collapse: collapse; margin-bottom: 6mm; }
.sheet__table th, .sheet__table td { padding: 2mm 0; border-bottom: 0.3mm solid #ccc; text-align: left; }
.sheet__table th { font-size: 8pt; text-transform: uppercase; letter-spacing: 0.06em; }
.sheet__table .is-right { text-align: right; }
.sheet__table .is-center { text-align: center; width: 8mm; }
/* The work sheet: a group heading spans the row, and each step carries a box
   to tick off on the bench. */
.sheet__grouprow td { font-weight: 700; padding-top: 4mm; border-bottom: 0.4mm solid #111; }
.sheet__table--labour td.is-center { font-size: 12pt; color: #111; }
.sheet__detail { font-size: 9pt; color: #555; }
.sheet__totals { margin-left: auto; width: 70mm; }
.sheet__total { display: flex; justify-content: space-between; padding: 1mm 0; }
.sheet__total--strong { font-weight: 700; border-top: 0.5mm solid var(--sheet-accent); margin-top: 1mm; padding-top: 2mm; }
.sheet__terms { margin-top: 8mm; font-size: 9pt; }
.sheet__terms h3 { margin: 0 0 1mm; font-size: 9pt; }
/* Each banking detail on its own tight line, so it reads and copies cleanly. */
.sheet__bankline { margin: 0; line-height: 1.5; }
/* A quiet, centred thank-you at the foot of an invoice. */
.sheet__thanks { margin-top: 8mm; font-size: 9pt; font-style: italic; text-align: center; color: #555; }
.sheet__thanks p { margin: 0; }

/* -------------------------------------------------------------- bed plan -- */
.bedplan { display: flex; flex-direction: column; gap: var(--space-3); }
.bedplan__legend { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); font-size: 13px; }
.bedplan__key { display: inline-flex; align-items: center; gap: 6px; }
.bedplan__key--over { color: var(--danger); font-weight: 600; }

/* Compact inline inputs inside a table cell (e.g. the commercial-category weights). */
.cell-input { width: 64px; text-align: right; padding: 2px 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel); color: var(--text); font: inherit; }
.cell-input--text { width: 160px; text-align: left; }
.bedplan__swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; flex: 0 0 auto; }
.bedplan__title { font-size: 15px; font-weight: 700; color: var(--text); margin: 0; }
/* Title/legend/plates on the left, the 3-D block pushed to the right. */
.bedplan__cols { display: flex; flex-wrap: wrap; gap: var(--space-4); align-items: flex-start; justify-content: space-between; }
.bedplan__left { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
@media (max-width: 720px) { .bedplan__cols { flex-direction: column; } }
.bedplan__grid { display: flex; flex-wrap: wrap; gap: var(--space-3); min-width: 0; max-width: 640px; }
.bedplan__plate { margin: 0; display: flex; flex-direction: column; gap: 4px; border: 1px solid transparent; border-radius: var(--radius-sm); padding: 4px; }
.bedplan__plate[role="button"] { cursor: pointer; }
.bedplan__plate[role="button"]:hover { background: var(--panel-2); }
.bedplan__plate.is-selected { border-color: var(--accent); background: var(--panel-2); }
.bedplan__svg { width: 100%; max-width: 300px; height: auto; display: block; }
.bedplan__cap { font-size: 12px; color: var(--text-dim); text-align: center; }
/* Sized to the 3-D view (~760px viewBox); the block sits on the right, but its own
   contents (heading + iso) are left-aligned within it. Can shrink on a narrow panel. */
.bedplan__isowrap { flex: 0 1 760px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
/* Same size and format as the panel's own "Beds & layout" heading. */
.bedplan__isohead { font-size: 15px; font-weight: 700; color: var(--text); margin: 0; text-align: left; }
/* The on-screen size is pinned by capDiagramScale to the SVG's viewBox width; this
   just lets it shrink to fit narrower panels. Left-aligned, no auto-centring. */
.bedplan__iso { width: 100%; height: auto; display: block; margin: 0; }

/* -------------------------------------------------------------- notices -- */
.notices { border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel-2); overflow: hidden; }
.notices--warn { border-color: var(--warn); }
.notices__summary { cursor: pointer; padding: var(--space-2) var(--space-3); font-size: 13px; color: var(--text-dim); list-style: none; user-select: none; }
.notices__summary::-webkit-details-marker { display: none; }
.notices__summary::before { content: '▸ '; color: var(--text-dim); }
.notices[open] .notices__summary::before { content: '▾ '; }
.notices__list { display: flex; flex-direction: column; border-top: 1px solid var(--border); }
.notices__item { display: flex; align-items: flex-start; gap: var(--space-2); padding: var(--space-2) var(--space-3); font-size: 12px; color: var(--text-dim); }
.notices__item + .notices__item { border-top: 1px solid var(--border); }
.notices__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-dim); margin-top: 6px; flex: 0 0 auto; }
.notices__item--warn .notices__dot { background: var(--warn); }
.notices__text { flex: 1 1 auto; min-width: 0; }
.notices__x { flex: 0 0 auto; background: none; border: none; cursor: pointer; color: var(--text-dim); font-size: 16px; line-height: 1; padding: 0 4px; }
.notices__x:hover { color: var(--text); }

.backup-reminder { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }

/* -------------------------------------------------------------- branding -- */
.brand-row { display: flex; gap: var(--space-3); align-items: flex-start; flex-wrap: wrap; }
.brand-preview {
  max-width: 160px; max-height: 70px; object-fit: contain;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: #fff; padding: var(--space-2);
}
.brand-preview--empty {
  display: flex; align-items: center; justify-content: center;
  width: 120px; height: 60px;
}
.brand-actions { display: flex; flex-direction: column; gap: var(--space-2); }
.brand-colour { display: flex; align-items: center; gap: var(--space-3); }
.brand-colour input[type="color"] {
  width: 40px; height: 32px; padding: 2px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--panel-2); cursor: pointer;
}

/* ---------------------------------------------------- catalogue actions -- */
.catalogue-actions {
  display: flex; flex-direction: column; gap: var(--space-2);
  margin-top: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

/* --------------------------------------------------------------- gantt -- */
.gantt { width: 100%; height: auto; }
.gantt text { font-family: inherit; }

/* The to-scale weekly production timeline: fills the width on a desktop, and
   scrolls sideways on a narrow phone (min-width forces the scroll). */
.timeline-scroll { overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; }
.week-timeline { display: block; width: 100%; min-width: 720px; height: auto; }
.week-timeline text { font-family: inherit; }

/* "What to start now": one row per machine, the live recommendation. */
.startnow {
  display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap;
  padding: var(--space-2) var(--space-3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin-bottom: var(--space-2);
}
.startnow--go { border-color: var(--ok); background: var(--ok-soft, var(--panel-2)); }
.startnow__machine { font-weight: 700; min-width: 6rem; }
.startnow__note { flex: 1 1 12rem; color: var(--text); }

/* Per-day working hours in the Schedule sidebar. */
.workday-row {
  display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap;
  padding: var(--space-1) 0; border-bottom: 1px solid var(--border);
}
.workday-row__hours { display: flex; gap: var(--space-2); margin-left: auto; }
.workday-row__hours .field { margin: 0; }
.workday-row__hours .input, .workday-row__hours .select { max-width: 5.5rem; }

/* --------------------------------------------------------------- guide -- */
/* Two lanes side by side - the company and the client - with numbered steps,
   so the flow reads as a chart rather than a wall of paragraphs. */

.guide__lanes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-4);
}
.guide__lane {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.guide__lane-head { margin-bottom: var(--space-1); }

.guide__step {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
}
.guide__step-num {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.guide__step--client .guide__step-num { background: var(--ok-soft, var(--accent-soft)); }
.guide__step-body { min-width: 0; }
.guide__step-text { margin: 2px 0 0; font-size: 13px; color: var(--text-dim); }
.guide__crossing { margin-top: var(--space-3); }

/* ------------------------------------------------------ workspace bar -- */
/* Tabs and the detail level share a row. They lived in two places until a
   375px check showed the header could not hold the brand as well - the logo
   shrank to nothing and the theme button ran off the right edge. */

.workspace-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.workspace-bar .segmented { flex: 1 1 300px; min-width: 0; }
.workspace-bar .chipset--modes { flex: 0 0 auto; }

@media (max-width: 620px) {
  .workspace-bar .chipset--modes { width: 100%; }
  .workspace-bar .chipset--modes .chip { flex: 1 1 auto; text-align: center; }
}

.workspace-bar-host { display: block; }

/* ------------------------------------------------------- customer form -- */
/* A separate page with no sidebar and no chrome: the customer is doing one
   thing, and every internal figure is absent by construction rather than
   hidden by a flag. */

.portal-body { display: block; background: var(--bg); }

.portal {
  max-width: 760px;
  margin: 0 auto;
  padding: var(--space-5) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.portal__title { margin: 0; font-size: 22px; }
.portal h2 { margin: 0; font-size: 16px; }

/* Progress stepper (client form): a clickable strip of the four steps. */
.stepper { display: flex; flex-wrap: wrap; gap: var(--space-2); padding: 0; }
.stepper__step {
  display: inline-flex; align-items: center; gap: 8px; flex: 1 1 auto;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--space-2) var(--space-3); font: inherit; color: var(--text-dim); cursor: pointer; text-align: left;
}
.stepper__step:hover { border-color: var(--accent); }
.stepper__num {
  flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; background: var(--panel-2); color: var(--text-dim);
}
.stepper__label { font-size: 13px; }
.stepper__step.is-current { border-color: var(--accent-strong); color: var(--text); }
.stepper__step.is-current .stepper__num { background: var(--accent); color: #fff; }
.stepper__step.is-done { color: var(--text); }
.stepper__step.is-done .stepper__num { background: var(--ok); color: #fff; }

/* Numbered step heading on each section. */
.stephead { display: flex; align-items: center; gap: var(--space-2); }
.stephead__title { margin: 0; font-size: 16px; }
.stephead__num {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; background: var(--accent); color: #fff;
}
.stephead__num--done { background: var(--ok); }
.panel--steplead { background: var(--panel-2); }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--border); vertical-align: middle; margin-right: var(--space-1); flex: none; }
.checklist { margin: var(--space-1) 0 0; padding-left: var(--space-4); font-size: 13px; color: var(--text-dim); }
.checklist li { margin: var(--space-1) 0; }

/* Banking details on the client form (expedite): keep the typed line breaks. */
.banking { white-space: pre-line; font-family: var(--mono, monospace); margin: var(--space-1) 0; }
.portal .panel--price { border-color: var(--accent-strong); }
.portal .app-footer { border-radius: var(--radius); border: 1px solid var(--border); }

/* --------------------------------------------------- adding a colour ---- */

.add-colour {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
}
.add-colour__summary {
  padding: var(--space-2) var(--space-3);
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
  list-style: none;
}
.add-colour__summary::-webkit-details-marker { display: none; }
.add-colour__summary::before { content: '+ '; font-weight: 700; }
.add-colour__body {
  padding: 0 var(--space-3) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* ------------------------------------------------- loaded filament ------ */

.mode-line { display: flex; align-items: baseline; gap: var(--space-2); flex-wrap: wrap; }
.mode-line__hint { font-size: 11px; color: var(--text-faint); flex: 1 1 180px; }

.slot-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: var(--space-2);
  align-items: end;
}
.slot-row__index {
  width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 11px; font-weight: 700;
  margin-bottom: 6px;
}

.slot-block {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  display: flex; flex-direction: column; gap: var(--space-2);
  background: var(--panel-2);
}
.slot-block__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }

.mix-total {
  display: flex; justify-content: space-between; align-items: baseline;
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-dim);
}
.mix-total.is-off strong { color: var(--warn); }

/* ------------------------------------------------- return on a machine -- */
/* The bar can pass 100%: past its own cost a machine keeps earning, and
   clipping it at full would hide the most interesting number on the screen. */

.roi { display: flex; align-items: center; gap: var(--space-2); min-width: 140px; }
.roi__track {
  flex: 1 1 auto;
  height: 8px;
  border-radius: 999px;
  background: var(--panel-3);
  overflow: hidden;
  display: flex;
}
.roi__fill { background: var(--accent-strong); height: 100%; }
.roi__over { background: var(--ok); height: 100%; }
.roi__value { font-size: 11px; color: var(--text-dim); min-width: 34px; text-align: right; }

.table tbody tr.is-group td { background: var(--panel-2); font-weight: 600; }
.table tbody tr.is-group:hover { background: var(--panel-2); }

/* Workflow progress bars — the overall order bar and the current-phase bar. */
.progressbar { margin: 10px 0; }
.progressbar__label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 13px; color: var(--text-dim); margin-bottom: 5px;
}
.progressbar__track {
  height: 9px; border-radius: 999px; background: var(--panel-2);
  border: 1px solid var(--border); overflow: hidden;
}
.progressbar__fill {
  height: 100%; background: var(--accent); border-radius: 999px;
  transition: width .25s ease; min-width: 2px;
}

/* How-to step lists and FAQ entries (guide tab). */
.howto-steps { margin: 6px 0 0; padding-left: 20px; }
.howto-steps li { margin: 4px 0; line-height: 1.45; }
.faq { padding: 10px 0; border-bottom: 1px solid var(--border); }
.faq:last-child { border-bottom: 0; }
.faq__q { display: block; margin-bottom: 4px; }
.faq__a { margin: 0; color: var(--text-dim); line-height: 1.5; }
