/* =========================================================
   Zinc Ledger, warm off-white — the panel-optimizer design
   language (hairline structure, near-black as the only UI
   accent, dense and flat) on a slightly off-white page.
   The one place with colour is the 3D model, drawn in birch.

   To switch to the neutral off-white, change the five
   surface tokens below to: #FAFAFA #F4F4F5 #E4E4E7 #ECECEE #EFEFF1
   ========================================================= */

:root {
  --bg: #faf9f6;
  --rail: #f3f2ee;
  --border: #e3e1db;
  --border-light: #eae8e3;
  --hover: #efeee9;

  --border-strong: #d2d0ca;
  --text: #18181b;
  --text-muted: #6b6b70;
  --text-faint: #96969b;
  --primary: #18181b;
  --primary-hover: #3f3f46;
  --danger: #b91c1c;
  --danger-soft: #fbeeee;
  --green: #15803d;
  --amber: #92400e;
  --amber-soft: #f7efdc;
  --radius: 4px;
  --nav-h: 46px;
}

* { box-sizing: border-box; }

/* An element whose class sets `display` (e.g. .btn, .notice) would stay
   visible with the `hidden` attribute — equal specificity, author wins. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  background: var(--bg);
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.5;
}

a { color: inherit; }
code, kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  background: var(--rail);
  border: 1px solid var(--border-light);
  border-radius: 3px;
  padding: 0 4px;
}

/* ---------- Navigation ---------- */
.topnav {
  display: flex;
  align-items: stretch;
  gap: 26px;
  padding: 0 20px;
  height: var(--nav-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
  align-self: center;
}
.nav-links { display: flex; gap: 2px; align-items: stretch; }
.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  font-weight: 500;
  font-size: 13px;
  transition: color 0.1s, background 0.1s;
}
.nav-links a:hover { color: var(--text); background: var(--hover); }
.nav-links a.active { color: var(--text); box-shadow: inset 0 -2px 0 var(--text); font-weight: 600; }

/* ---------- Layout ---------- */
.container { max-width: 1180px; margin: 0 auto; padding: 24px 24px 60px; }
.container.wide { max-width: none; padding: 0; }

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
h1 { margin: 0 0 3px; font-size: 19px; letter-spacing: -0.01em; }
.subtitle { margin: 0; color: var(--text-muted); max-width: 680px; font-size: 13px; }
.section-title {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.005em;
  color: var(--text);
  margin: 0 0 12px;
}
.section-title em { font-style: normal; font-weight: 400; font-size: 12px; letter-spacing: 0; color: var(--text-muted); }
/* a thin line above each section that follows another */
.section-title.gap-top, .section-title.gap-top-sm { border-top: 1px solid var(--border); padding-top: 20px; }
.print-page .section-title { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); font-weight: 600; border-top: 0; padding-top: 0; }

.muted { color: var(--text-muted); }
.small { font-size: 11.5px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.pad { padding: 14px 0; }
.empty { color: var(--text-muted); padding: 18px 0; border-top: 1px solid var(--border-light); }

/* ---------- Notices ---------- */
.notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--amber-soft);
  color: var(--amber);
  border: 1px solid #ead9b0;
  border-radius: var(--radius);
  padding: 8px 12px;
  margin-bottom: 18px;
  font-size: 13px;
}
.notice-flush { border-width: 0 0 1px; border-radius: 0; margin: 0; padding: 8px 20px; }
.notice-ok { background: #edf5ee; color: var(--green); border-color: #cfe3d2; }
.notice-error { background: var(--danger-soft); color: var(--danger); border-color: #efcaca; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 550;
  padding: 6px 13px;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.1s, border-color 0.1s;
  appearance: none;
  -webkit-appearance: none;
  line-height: normal;
}
.btn:hover { background: var(--hover); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--bg); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: #e6b4b4; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--hover); color: var(--text); }
.btn-ghost.btn-danger { color: var(--danger); }
.btn-sm { padding: 4px 10px; font-size: 12.5px; }
.btn-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.btn-row form { margin: 0; }
.form-actions { display: flex; gap: 10px; margin-top: 16px; }

/* Segmented control: the near-black fill marks the active choice */
.seg {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
  vertical-align: middle;
}
.seg button {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  padding: 4px 11px;
  cursor: pointer;
  line-height: normal;
  white-space: nowrap;
}
.seg button + button { border-left: 1px solid var(--border-strong); }
.seg button:hover { background: var(--hover); color: var(--text); }
.seg button.on { background: var(--primary); color: var(--bg); }
.seg-sm button { padding: 2px 9px; font-size: 12px; min-width: 26px; }

/* ---------- Forms ---------- */
input[type="text"], input[type="number"], input[type="password"], select {
  font: inherit;
  font-size: 13px;
  padding: 5px 9px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  width: 100%;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid rgba(24, 24, 27, 0.35);
  outline-offset: 1px;
}
input[type="checkbox"], input[type="range"] { accent-color: var(--primary); }
input.input-num { width: 92px; }
input.input-num-sm { width: 72px; }
input.input-cost { width: 124px; }
.inline-field { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }
.inline-field select { width: auto; min-width: 150px; }

/* ---------- Tables ---------- */
.table-scroll { overflow-x: auto; }
.panel-table, .data-table { width: 100%; border-collapse: collapse; }
.panel-table th, .data-table th {
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  padding: 7px 9px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--rail);
}
.panel-table th.num, .data-table th.num { text-align: right; }
.panel-table td, .data-table td { padding: 6px 9px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
.data-table { border: 1px solid var(--border-light); }
.data-table .add-row td { background: var(--rail); border-bottom: 0; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions form { display: inline-block; margin: 0 0 0 4px; }
.row-link { font-weight: 600; text-decoration: none; }
.row-link:hover { text-decoration: underline; }
.total-row td { font-weight: 650; border-top: 1px solid var(--border); border-bottom: 0; }
.row-remove {
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 13px;
  cursor: pointer;
  padding: 3px 7px;
  border-radius: var(--radius);
}
.row-remove:hover { color: var(--danger); background: var(--danger-soft); }

/* ---------- Estimates list ---------- */
.import-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(240px, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 26px;
}
.dropzone {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  padding: 22px 20px;
  cursor: pointer;
  border-right: 1px solid var(--border);
  background: var(--rail);
  transition: background 0.1s;
  min-height: 108px;
}
.dropzone strong { font-size: 15px; }
.dropzone:hover, .dropzone.over { background: var(--hover); }
.dropzone.over { box-shadow: inset 0 0 0 2px var(--text); }
.dropzone.busy { cursor: progress; opacity: 0.7; }
.import-status { margin-top: 6px; font-size: 12.5px; color: var(--text-muted); }
.import-status.error { color: var(--danger); font-weight: 550; }
.import-side { padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; }
.import-side p { margin: 0; }
@media (max-width: 760px) {
  .import-row { grid-template-columns: 1fr; }
  .dropzone { border-right: 0; border-bottom: 1px solid var(--border); }
}

.howto { margin-top: 26px; border-top: 1px solid var(--border); padding-top: 12px; }
.howto summary { cursor: pointer; font-weight: 550; }
.howto ol { margin: 10px 0 8px; padding-left: 20px; max-width: 720px; }
.howto li { margin-bottom: 4px; }

/* ---------- Workbench ---------- */
.wb-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 14px 24px;
  flex-wrap: wrap;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}
.wb-title { flex: 1; min-width: 240px; }
.wb-title p { margin: 0; font-size: 12.5px; }
.wb-crumb { display: block; width: fit-content; margin-bottom: 3px; }
.wb-crumb:hover { color: var(--text); }
input.title-input {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  border-color: transparent;
  background: transparent;
  padding: 1px 6px;
  margin-left: -7px;
  max-width: 560px;
}
input.title-input:hover { border-color: var(--border); }
input.title-input:focus { border-color: var(--border-strong); background: var(--bg); }
.wb-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.wb-main {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(330px, 1fr);
  border-bottom: 1px solid var(--border);
}
.wb-view {
  background: var(--rail);
  border-right: 1px solid var(--border);
  padding: 8px 20px 12px;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.viewer { position: relative; height: clamp(300px, 50vh, 560px); }
.viewer canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.viewer canvas:active { cursor: grabbing; }
.viewer-msg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 12.5px;
  pointer-events: none;
}
.view-controls { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding-top: 8px; border-top: 1px solid var(--border); }
.slider { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-muted); flex: 1; min-width: 170px; }
.slider input { flex: 1; min-width: 80px; }
.check-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-muted); white-space: nowrap; cursor: pointer; }
.check-inline input { margin: 0; }

/* Logo strip: engraved logos, opened under the 3D view. One hairline per row, like the ledger. */
#logo-open[aria-expanded="true"] { background: var(--primary); border-color: var(--primary); color: var(--bg); }
.logo-strip { margin-top: 10px; border-top: 1px solid var(--border); }
.logo-row { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--border-light); }
.logo-strip > .logo-row:first-child { border-top: 0; }
.logo-row .section-title { margin: 0; }
.logo-row .inline-field input { text-align: right; font-variant-numeric: tabular-nums; }
.logo-list { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; min-width: 0; }
.logo-chip {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  font-size: 12.5px;
  line-height: normal;
  padding: 4px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.logo-chip:hover { background: var(--hover); color: var(--text); }
.logo-chip.on { background: var(--primary); border-color: var(--primary); color: var(--bg); }
.logo-note { margin: 0; padding: 0 0 8px; }
.logo-note:empty { display: none; }
.logo-note.warn { color: var(--amber); }
.logo-out { min-width: 52px; text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }
.logo-strip.busy { opacity: 0.6; pointer-events: none; }

/* Default view strip: the piece from each of its four corners, then from each height; what is chosen is drawn in every picture of it. */
#corner-open[aria-expanded="true"] { background: var(--primary); border-color: var(--primary); color: var(--bg); }
.corner-strip { margin-top: 10px; border-top: 1px solid var(--border); }
.corner-strip > .logo-row { border-top: 0; }
.corner-choices { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 0 0 10px; }
.corner-choice {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  font-size: 12.5px;
  line-height: normal;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 6px 7px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.corner-choice:hover { background: var(--hover); color: var(--text); }
.corner-choice[aria-checked="true"] { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); color: var(--text); font-weight: 600; }
.corner-pic { display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 3; }
.corner-pic img { width: 100%; height: 100%; object-fit: contain; }
.corner-name { text-align: center; }
.corner-head { display: flex; align-items: baseline; gap: 8px; padding: 2px 0 6px; }
.corner-title { font-size: 12.5px; font-weight: 600; }

.wb-cost { padding: 4px 20px 16px; min-width: 0; }
.ledger-line {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border-light);
}
.ledger-line .what { min-width: 0; }
.ledger-line .label { font-weight: 550; }
.ledger-line .detail { color: var(--text-muted); font-size: 12.5px; }
.ledger-line .amount { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 550; }
.ledger-line .seg { margin-top: 5px; }
.ledger-total { padding: 12px 0 10px; border-bottom: 1px solid var(--border); }
.ledger-total .muted { font-size: 12.5px; }
.ledger-total .big { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.compare { display: grid; grid-template-columns: 1fr 1fr; margin-top: 12px; border: 1px solid var(--border); border-radius: var(--radius); }
.compare-cell { padding: 8px 12px; text-align: left; background: none; border: 0; font: inherit; color: var(--text-muted); cursor: pointer; }
.compare-cell + .compare-cell { border-left: 1px solid var(--border); }
.compare-cell:hover { background: var(--hover); }
.compare-cell .tag { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; display: block; }
.compare-cell .val { font-size: 14.5px; font-weight: 650; font-variant-numeric: tabular-nums; color: var(--text-muted); }
.compare-cell.on { background: var(--rail); box-shadow: inset 0 -2px 0 var(--text); }
.compare-cell.on .val, .compare-cell.on .tag { color: var(--text); }
.compare-note { margin: 7px 0 0; font-size: 12px; color: var(--text-muted); }
.busy .ledger-line .amount, .busy .ledger-total .big, .busy .kind-line .amount, .busy .kind-line .share { opacity: 0.45; }

/* The total again, by kind of cost: materials, labour, machining — each with its share. */
.kinds { margin-top: 14px; padding: 10px 0 2px; border-top: 1px solid var(--border); }
.kinds-title { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); padding-bottom: 2px; }
.kind-line { display: flex; align-items: baseline; gap: 14px; padding: 7px 0; border-top: 1px solid var(--border-light); }
.kinds-title + .kind-line { border-top: 0; }
.kind-line .what { flex: 1; min-width: 0; }
.kind-line .label { font-weight: 550; }
.kind-line .detail { color: var(--text-muted); font-size: 12.5px; }
.kind-line .amount { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 550; }
.kind-line .share { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 650; min-width: 3.2em; text-align: right; }

.wb-table { border-bottom: 1px solid var(--border); }
.table-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 20px; flex-wrap: wrap; }
.table-toolbar .section-title { margin: 0; }
.wb-table .panel-table th:first-child, .wb-table .panel-table td:first-child { padding-left: 20px; }
.wb-table .panel-table th:last-child, .wb-table .panel-table td:last-child { padding-right: 20px; }
.wb-table .panel-table tbody tr { cursor: default; }
.wb-table .panel-table tbody tr.hv { background: var(--hover); }
.wb-table .panel-table tbody tr.sel { background: var(--hover); box-shadow: inset 3px 0 0 var(--text); }
.wb-table .panel-table tbody tr.off td { color: var(--text-faint); }
.wb-table .panel-table tbody tr.off select { color: var(--text-faint); }
.wb-table .panel-table tbody tr:last-child td { border-bottom: 1px solid var(--border); }
.wb-table .panel-table tfoot td { padding: 9px; font-weight: 650; border-bottom: 0; }
.wb-table .panel-table select { padding: 3px 6px; font-size: 12.5px; min-width: 104px; }
.wb-table .panel-name { font-weight: 550; white-space: nowrap; }
.changed {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text);
  margin-left: 6px;
  vertical-align: middle;
}
.tag-warn {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--amber);
  background: var(--amber-soft);
  border-radius: 3px;
  padding: 1px 5px;
  margin-left: 6px;
}

.wb-extra { padding: 4px 20px 50px; }
.wb-extra details { border-bottom: 1px solid var(--border-light); padding: 10px 0; }
.wb-extra summary { cursor: pointer; font-weight: 550; }
.wb-extra summary span { font-weight: 400; color: var(--text-muted); }
.warn-list { margin: 10px 0; padding-left: 18px; color: var(--amber); }
.sheet-group { margin: 12px 0 4px; }
.sheet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 12px; }
.sheet-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 6px; background: var(--bg); }
.sheet-svg { display: block; }
.skipped-list { margin: 8px 0 0; padding-left: 18px; color: var(--text-muted); font-size: 12.5px; }

@media (max-width: 940px) {
  .wb-main { grid-template-columns: 1fr; }
  .wb-view { border-right: 0; border-bottom: 1px solid var(--border); }
  .viewer { height: clamp(260px, 44vh, 420px); }
}

/* ---------- Rates ---------- */
.rates-section { border-top: 1px solid var(--border); padding: 18px 0 22px; }
.rates-section > p { margin: 8px 0 0; }
.rates-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 22px 40px; }
.rate-group { border: 0; padding: 0; margin: 0; min-width: 0; }
.rate-group legend { padding: 0; margin-bottom: 2px; }
.rate-group > p { margin: 0 0 6px; }
.rate-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border-light);
}
.rate-input { display: inline-flex; align-items: center; gap: 7px; flex-shrink: 0; }
.rate-input input { width: 112px; text-align: right; }
.rate-input em { font-style: normal; color: var(--text-muted); font-size: 12px; width: 62px; }
.finish-block { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 12px; }
.finish-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 10px; flex-wrap: wrap; }
input.finish-name { max-width: 280px; font-weight: 600; }
.steps-table { border-width: 1px 0 0; }
.steps-table tr:last-child td { border-bottom: 0; }
.steps-empty { margin: 0; padding: 8px 12px; border-top: 1px solid var(--border-light); }
.finish-new { display: flex; gap: 8px; align-items: center; max-width: 520px; }

/* ---------- Print / export ---------- */
.print-page { max-width: 960px; margin: 0 auto; padding: 20px 24px 60px; }
.print-bar { display: flex; gap: 8px; margin-bottom: 20px; }
.print-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  border-bottom: 2px solid var(--text);
  padding-bottom: 10px;
  margin-bottom: 18px;
}
.print-head p { margin: 0; }
.print-total { display: flex; flex-direction: column; align-items: flex-end; white-space: nowrap; }
.print-total strong { font-size: 22px; letter-spacing: -0.02em; }
.print-page .section-title { margin-top: 22px; }
.print-page .sheet-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media print {
  .print-bar { display: none; }
  body { background: #fff; font-size: 11.5px; }
  .print-page { padding: 0; max-width: none; }
  .panel-table th, .data-table th, .data-table .add-row td { background: #fff; }
  .sheet-card, .print-page tr { break-inside: avoid-page; }
  .print-sheets { break-inside: avoid-page; }
}

/* ---------- Assembly instructions ---------- */
.crumb { text-decoration: none; font-size: 12.5px; }
.crumb:hover { text-decoration: underline; }
.asm .wb-title h1 { margin: 2px 0; }
.asm .viewer { height: clamp(320px, 56vh, 640px); }

/* The step being shown, under the picture: big number, what to do, the note. */
.step-now {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 12px 0 2px;
  margin-top: 10px;
  border-top: 1px solid var(--border);
  min-height: 74px;
}
.step-now p { margin: 2px 0 0; white-space: pre-wrap; }
.step-big {
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  min-width: 44px;
  font-variant-numeric: tabular-nums;
}
.step-title-big { font-size: 15.5px; font-weight: 650; }

/* The customer's guide: its opening text and its link. */
.asm-share { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.asm-share .section-title { margin: 0; }
.asm-share p { margin: 0; }
.share-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.share-row input { flex: 1; min-width: 220px; font-size: 12.5px; }

.asm-side { padding-top: 12px; }
.asm-side-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; }
.asm-side-head .section-title { margin: 0; }
.asm-parts-title { margin-top: 22px; }

.step-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.step { border-bottom: 1px solid var(--border-light); }
.step-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  width: 100%;
  padding: 8px 8px 8px 6px;
  background: none;
  border: 0;
  font: inherit;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.step-head:hover { background: var(--hover); }
.step-no {
  flex-shrink: 0;
  min-width: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
}
.step.on { background: var(--rail); box-shadow: inset 3px 0 0 var(--text); }
.step.on .step-no { color: var(--text); }
.step.on .step-name { font-weight: 600; }
.step-edit { padding: 2px 10px 12px 38px; display: flex; flex-direction: column; gap: 8px; }
.step-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-muted); }
textarea {
  font: inherit;
  font-size: 13px;
  padding: 6px 9px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  width: 100%;
  resize: vertical;
}
textarea:focus-visible { outline: 2px solid rgba(24, 24, 27, 0.35); outline-offset: 1px; }
.step-tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.step-tools select { min-width: 120px; padding: 3px 6px; font-size: 12.5px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.part-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border: 1px solid var(--text);
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 12px;
}
#parts tr.hv { background: var(--rail); }
#parts tr.hv .part-letter { background: var(--text); color: var(--bg); }

/* ---------- Production: approve for production, take down ---------- */
.prod-open[data-status="approved"]::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.prod-open[data-status="down"] { color: var(--text-muted); }
.tag-prod {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--green);
  background: #edf5ee;
  border: 1px solid #cfe3d2;
  border-radius: 3px;
  white-space: nowrap;
  vertical-align: middle;
}
.tag-prod-down { color: var(--text-muted); background: var(--rail); border-color: var(--border); }

.prod-dialog {
  width: min(620px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 18px 50px rgba(24, 24, 27, 0.22);
}
.prod-dialog::backdrop { background: rgba(24, 24, 27, 0.35); }
.prod-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
}
.prod-head h2 { margin: 0; font-size: 15px; }
.prod-body { padding: 16px 18px 20px; }
.prod-body .notice { margin-bottom: 14px; }
.prod-status { margin: 0 0 16px; }
.prod-changes { margin: 4px 0 0; padding-left: 18px; }
.prod-batch label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 5px; }
.prod-batch-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.prod-batch-row input { width: 84px; }
.prod-use { font-weight: 550; }
.prod-batch p { margin: 6px 0 16px; }
.prod-parts { margin-bottom: 8px; }
.prod-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.prod-ops { margin: 12px 0 0; font-size: 12.5px; }
.prod-warn { color: var(--amber); }
.prod-history-title { margin: 22px 0 6px; }
.prod-history { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border-light); }
.prod-history li { display: grid; grid-template-columns: 150px 1fr; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border-light); font-size: 12.5px; }
button:disabled { opacity: 0.45; cursor: not-allowed; }

/* A panel's name is edited in place: it reads as text until hovered or focused */
.wb-table input.name-input {
  width: auto;
  max-width: 100%;
  font-weight: 550;
  padding: 2px 5px;
  margin-left: -6px;
  border-color: transparent;
  background: transparent;
}
.wb-table input.name-input:hover { border-color: var(--border); }
.wb-table input.name-input:focus { border-color: var(--border-strong); background: var(--bg); }
.wb-table .panel-table tbody tr.off input.name-input { color: var(--text-faint); }

/* Taking a design down, with an optional note */
.prod-takedown { margin-top: 16px; padding: 12px 14px; border: 1px solid #efcaca; border-radius: var(--radius); background: var(--danger-soft); }
.prod-takedown label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 5px; }
.prod-takedown textarea {
  width: 100%;
  font: inherit;
  font-size: 13px;
  padding: 5px 9px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  resize: vertical;
}
.prod-takedown p { margin: 6px 0 0; }
.prod-takedown .prod-actions { margin-top: 10px; }
.prod-note { margin: -8px 0 16px; padding: 8px 12px; border-left: 3px solid var(--border-strong); background: var(--rail); }

/* Rates: archived materials */
.sub-heading { margin: 18px 0 6px; font-size: 12.5px; font-weight: 650; }
.narrow-table { max-width: 520px; }

/* ---------- Sign in ---------- */
/* One narrow column on the bare page: the same hairlines and near-black as
   the app, and nothing from it that needs a signed-in device. */
body.signin { min-height: 100vh; display: flex; align-items: flex-start; justify-content: center; padding: 14vh 20px 40px; }
.signin-box { width: 100%; max-width: 340px; }
.signin-brand { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.signin-lead { margin: 2px 0 18px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.signin-form { display: flex; flex-direction: column; gap: 14px; }
.signin-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 550; }
.signin-form label .muted { font-weight: 400; }
.signin-form input { font-size: 15px; padding: 8px 10px; }
.signin-form input.signin-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 18px; letter-spacing: 0.22em; }
.signin-form .btn { justify-content: center; padding: 9px 14px; font-size: 14px; margin-top: 2px; }
.signin-foot { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--border); }
