:root {
  color-scheme: light;
  --paper: #f4f1e8;
  --panel: #fcfaf4;
  --field: #fffdf8;
  --ink: #1a3028;
  --body: #37443a;
  --muted: #626a5c;
  --line: #d8d9cb;
  --green: #1b3c30;
  --green-deep: #132d23;
  --orange: #bc421f;
  --orange-bright: #f08755;
  --outset: 0 12px 30px #263a2410;
  --sans: "Aptos", "Inter", "Segoe UI", system-ui, sans-serif;
  --mono: "Cascadia Mono", "IBM Plex Mono", "Consolas", monospace;
  --serif: "Georgia", serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 300px; }
body { margin: 0; color: var(--ink); background: var(--paper); font: 15px/1.55 var(--sans); }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button, input, select, a, textarea, summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; }
a { color: var(--green); text-underline-offset: .2em; }
input, select, textarea { color: var(--ink); }
img, svg { max-width: 100%; }
p, h1, h2, h3 { margin-top: 0; }
button:disabled { opacity: .58; }
.muted { color: var(--muted) !important; }

.visually-hidden, .skip-link:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.skip-link:focus { position: fixed; top: 10px; left: 10px; z-index: 20; background: var(--field); padding: 12px; }
.page-width { width: min(1450px, calc(100% - 72px)); margin-inline: auto; }

.site-header { border-top: 4px solid var(--ink); border-bottom: 1px solid var(--line); background: #f9f7ef; }
.site-bar { display: flex; align-items: center; gap: clamp(22px, 4vw, 64px); min-height: 63px; }
.brand, .footer-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-size: 24px; font-weight: 800; text-decoration: none; letter-spacing: -.08em; white-space: nowrap; }
.site-nav { display: flex; align-items: stretch; align-self: stretch; gap: clamp(15px, 2.1vw, 32px); }
.site-nav a { display: inline-flex; align-items: center; position: relative; color: var(--body); text-decoration: none; white-space: nowrap; font-size: 13px; font-weight: 650; }
.site-nav a:hover, .site-nav a[aria-current] { color: var(--orange); }
.site-nav a[aria-current]::after { content: ""; height: 2px; background: var(--orange); position: absolute; inset: auto 0 -1px; }
.header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; white-space: nowrap; }
.folder-icon { position: relative; display: inline-block; width: 14px; height: 10px; border: 1.3px solid currentColor; border-radius: 1px; margin-right: 1px; }
.folder-icon::before { position: absolute; content: ""; width: 7px; height: 4px; top: -4px; left: -1px; border: 1.3px solid currentColor; border-radius: 1px 2px 0 0; border-bottom: 0; }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 39px; gap: 6px; padding: 8px 14px; border: 1px solid transparent; border-radius: 5px; background: transparent; color: var(--ink); font-size: 13px; line-height: 1.2; font-weight: 700; text-decoration: none; white-space: nowrap; }
.button:not(:disabled):hover { background: #e9eadf; }
.button-outline, .button-compact { border-color: #cbd0c2; background: var(--field); }
.button-compact { min-height: 32px; padding: 6px 9px; font-size: 12px; }
.button-ink { color: white; background: var(--green); border-color: var(--green); }
.button-ink:not(:disabled):hover { background: #2b5240; }
.button-primary { background: var(--orange); color: white; border-color: var(--orange); }
.button-primary:not(:disabled):hover { background: #a63315; border-color: #a63315; }
.button-text { padding-inline: 5px; color: var(--green); }
.button-add { justify-content: flex-start; padding: 4px 8px; min-height: 32px; color: var(--green); }
.button-add span { font-size: 19px; line-height: .8; }

.work-page { padding: clamp(24px, 2.8vw, 40px) 0 46px; }
.work-intro { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 30px; }
.eyebrow, .section-kicker, .job-name label { display: block; font: 700 10px/1.3 var(--mono); letter-spacing: .13em; }
.eyebrow { color: var(--orange); display: flex; align-items: center; gap: 8px; }
.eyebrow-mark { display: inline-block; width: 13px; height: 7px; background: repeating-linear-gradient(115deg, var(--orange) 0 2px, transparent 2px 4px); }
.work-intro h1 { margin: 7px 0 6px; font: 500 clamp(40px, 5vw, 64px)/1.02 var(--serif); letter-spacing: -.07em; }
.title-period { color: var(--orange); }
.work-intro p { margin: 0; color: var(--muted); font-size: clamp(14px, 1.5vw, 17px); }
.work-intro-side { display: grid; justify-items: end; gap: 9px; flex-shrink: 0; padding-bottom: 3px; }
.local-badge { display: flex; align-items: center; gap: 7px; color: #3b5446; font: 700 11px/1.3 var(--mono); white-space: nowrap; }
.local-badge span { width: 7px; height: 7px; background: #52866c; border-radius: 50%; outline: 3px solid #dfe9dd; }
.intro-rule { display: block; width: 168px; height: 9px; border-bottom: 1px solid #b6bda9; background: repeating-linear-gradient(to right, transparent 0 11px, #b6bda9 11px 12px) bottom left/100% 5px no-repeat; }

.job-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: #e9e9de; padding: 8px 13px; border: 1px solid #dadcd0; border-radius: 8px; margin-bottom: 13px; }
.job-name { display: flex; align-items: center; gap: 9px; min-width: 0; flex: 1; }
.job-name label { color: var(--muted); }
.job-name input { width: min(390px, 100%); height: 38px; padding: 6px 8px; font-size: 14px; font-weight: 700; border: 1px solid transparent; background: transparent; }
.job-name input:hover, .job-name input:focus { background: var(--field); border-color: var(--line); }
.job-tools { display: flex; align-items: center; gap: 10px; }
.unit-picker { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid #cbd0c2; border-radius: 5px; background: #f2f1e9; }
.unit-picker button { border: 0; min-width: 33px; padding: 5px; border-radius: 3px; color: var(--muted); background: transparent; font: 700 12px/1.2 var(--mono); }
.unit-picker button[aria-pressed="true"], .unit-picker button.active { color: white; background: var(--green); }

.workbench { display: grid; grid-template-columns: minmax(335px, 1.12fr) minmax(400px, 1.75fr) minmax(227px, .73fr); gap: 13px; align-items: start; }
.work-inputs, .work-side { display: grid; gap: 12px; min-width: 0; align-self: start; }
.bench-panel { min-width: 0; overflow: clip; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--outset); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 7px; border-bottom: 1px solid var(--line); padding: 13px 15px 12px; }
.section-kicker { color: var(--muted); }
.panel-heading h2 { margin: 2px 0 0; font: 500 28px/1.07 var(--serif); letter-spacing: -.055em; }
.panel-icon { display: block; position: relative; width: 31px; height: 31px; flex: 0 0 auto; color: #5c6659; background: #ebede2; border-radius: 4px; }
.stock-icon::before { content: ""; position: absolute; inset: 9px 8px; border: 1px solid; transform: skewY(-14deg); box-shadow: 2px 3px #ebede2, 3px 4px currentColor; }
.list-icon::before { content: ""; position: absolute; inset: 8px 8px; background: repeating-linear-gradient(to bottom, currentColor 0 1px, transparent 1px 5px); }
.cut-icon::before { content: ""; position: absolute; inset: 8px; background: repeating-linear-gradient(135deg, transparent 0 3px, currentColor 3px 4px, transparent 4px 6px); border: 1px solid; }
.panel-body { min-width: 0; padding: 12px 14px; }

.row-list { display: grid; gap: 7px; }
.stock-row { padding: 9px 0 8px; border-bottom: 1px dashed var(--line); }
.stock-row:first-child { padding-top: 1px; }
.stock-row .row-main, .stock-fields, .stock-main, .stock-dims { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 8px; align-items: end; }
.stock-main { grid-template-columns: minmax(0, 1fr) 31px; }
.stock-main .remove-row { min-height: 33px; }
.stock-dims { grid-template-columns: repeat(2, minmax(0, 1fr)) minmax(46px, .6fr); margin-block: 5px; }
.stock-row :is(.trim-fields, .trim-grid) { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.stock-row details { margin-top: 6px; }
.stock-row summary { color: var(--muted); cursor: pointer; font-size: 12px; padding-bottom: 4px; }
.stock-row button, .part-row button { border: 0; border-radius: 4px; color: var(--muted); background: transparent; min-height: 29px; }
.stock-row button:hover, .part-row button:hover { color: var(--orange); background: #f1e5d9; }
.stock-row label, .part-row label { display: grid; gap: 2px; min-width: 0; color: var(--muted); font-size: 11px; font-weight: 650; }
.part-row .row-main, .part-row { min-width: 0; }
.part-row.row-main, .part-row .row-main, .part-table :is(.part-head, .parts-head, .parts-labels) { display: grid; grid-template-columns: minmax(73px, 1.6fr) repeat(2, minmax(41px, .85fr)) minmax(32px, .45fr) minmax(62px, 1.2fr) 23px; gap: 4px; align-items: end; }
.part-table :is(.part-head, .parts-head, .parts-labels) { color: var(--muted); font-size: 10px; font-weight: 700; padding: 0 1px; }
.part-head { margin-bottom: 4px; }
.part-row .row-main > button, .part-row > button { padding: 0; min-height: 33px; }
.part-row :is(input, select), .stock-row :is(input, select), #kerf, #app-dialog :is(input, textarea, select) {
  width: 100%;
  min-width: 0;
  padding: 6px 7px;
  min-height: 33px;
  border: 1px solid #cbd0c2;
  border-radius: 4px;
  background: var(--field);
  font-size: 12px;
}
.part-row :is(input, select) { padding-inline: 4px; }
.part-row input[name="qty"] { padding-inline: 3px; }
.part-row input[type="number"] { appearance: textfield; }
.part-row input[type="number"]::-webkit-inner-spin-button { appearance: none; }
.stock-row input:hover, .part-row input:hover, .stock-row select:hover, .part-row select:hover { border-color: #949e8f; }
.kerf-field { display: grid; grid-template-columns: 1fr 79px; align-items: center; margin-top: 5px; background: #f1f0e7; padding: 8px; border-radius: 5px; }
.kerf-field label { font-size: 12px; font-weight: 750; }
.kerf-field label span { display: block; color: var(--muted); font-size: 10px; font-weight: 500; }
.kerf-field input { font-family: var(--mono); }
.parts-tools { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-bottom: 8px; }
.parts-tools .button-text, .parts-footer .button-text { min-height: 32px; font-size: 12px; }
.parts-tools .button-text { margin-left: auto; }
.parts-footer { display: flex; justify-content: space-between; margin-top: 5px; }
.solve-block { display: grid; grid-template-columns: 1fr auto; gap: 6px; }
#optimize { min-height: 49px; padding-inline: 14px; justify-content: space-between; font-size: 14px; }
#optimize span { font-size: 19px; font-weight: 500; }
#form-message { grid-column: 1 / -1; margin: 0; padding: 7px 9px; border-left: 2px solid var(--orange); background: #f9e9de; font-size: 12px; }

.plan-panel { display: flex; flex-direction: column; min-height: 515px; }
.plan-actions { display: flex; align-items: center; gap: 6px; }
.plan-actions .button { min-height: 33px; }
.result-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(94px, 1fr)); background: #edf0e6; border-bottom: 1px solid var(--line); }
.result-summary:empty { display: none; }
.result-summary > * { padding: 8px 12px; min-width: 0; border-right: 1px solid var(--line); }
.result-summary > *:last-child { border-right: 0; }
.result-summary strong { display: block; color: var(--ink); font: 700 21px/1.2 var(--mono); }
.result-summary span, .result-summary small { color: var(--muted); font-size: 10px; }
.result-tools { padding: 6px 11px; display: flex; justify-content: space-between; align-items: center; gap: 5px; border-bottom: 1px solid var(--line); min-height: 42px; }
.sheet-tabs { display: flex; overflow-x: auto; align-items: center; gap: 4px; flex: 1; min-width: 0; }
.sheet-tab { min-height: 28px; flex: 0 0 auto; padding: 4px 8px; border-radius: 3px; border: 1px solid var(--line); color: var(--green); background: var(--field); font-size: 11px; font-weight: 700; }
.sheet-tab:hover { background: #e1e6da; }
.sheet-tab:is(.active, [aria-current="true"], [aria-selected="true"], [aria-pressed="true"]) { color: #fff; background: var(--green); border-color: var(--green); }
#result-status { margin: 0; color: var(--muted); font-size: 11px; }
.sheet-diagram {
  min-height: 336px;
  flex: 1;
  display: grid;
  place-content: center;
  align-items: center;
  justify-items: center;
  padding: clamp(6px, 2vw, 20px);
  color: #f0f1e6;
  background-color: var(--green-deep);
  background-image: linear-gradient(#70938222 1px, transparent 1px), linear-gradient(90deg, #70938222 1px, transparent 1px), linear-gradient(#92b4a229 1px, transparent 1px), linear-gradient(90deg, #92b4a229 1px, transparent 1px);
  background-size: 14px 14px, 14px 14px, 70px 70px, 70px 70px;
  background-position: center center;
  grid-template-columns: minmax(0, 1fr);
}
.sheet-diagram svg { display: block; width: 100%; height: auto; max-height: 580px; overflow: visible; }
.diagram-empty { text-align: center; padding: 15px 8px; }
.diagram-empty strong { display: block; margin-top: 20px; font: 500 24px/1.15 var(--serif); letter-spacing: -.035em; }
.diagram-empty p { color: #c1d0c5; margin: 7px 0 0; font-size: 12px; }
.empty-board { display: flex; position: relative; gap: 5px; width: 148px; height: 85px; justify-content: space-between; margin: auto; transform: rotate(-6deg); border: 1px solid #749a87; padding: 5px; box-shadow: 4px 5px 0 #adbf9e21; }
.empty-board span { display: block; width: 49%; border: 1px solid #b7cbb2; background: #c6dfb12b; }
.empty-board span:nth-child(2) { border-color: #ed9e6c; background: #ea8b3934; height: 51%; }
.empty-board span:nth-child(3) { position: absolute; bottom: 5px; right: 5px; width: calc(45% - 3px); height: 35%; background: repeating-linear-gradient(135deg, transparent 0 4px, #b2ccad30 4px 5px); }
.plan-bottom { padding: 12px 14px; }
.diagram-key { display: flex; flex-wrap: wrap; gap: 12px; font-size: 11px; color: var(--muted); }
.diagram-key span { display: flex; align-items: center; gap: 5px; }
.diagram-key i { width: 12px; height: 9px; display: inline-block; border: 1px solid #888c7d; }
.diagram-key .key-part { background: #aaccb4; }
.diagram-key .key-offcut { background: repeating-linear-gradient(135deg, #f5f1dd 0 2px, #d6d1bb 2px 3px); }
.diagram-key .key-kerf { background: #e88c64; border-color: #b44722; }
#unplaced:not(:empty) { color: #803315; border-top: 1px solid var(--line); margin-top: 9px; padding-top: 8px; font-size: 12px; }
#unplaced p, #unplaced ul { margin-block: 3px 5px; }

.empty-note { margin: 0; color: var(--muted); font-size: 12px; }
.cuts-body { max-height: min(66vh, 520px); overflow: auto; }
.cuts-body :is(ol, ul), #leftovers :is(ol, ul) { list-style: none; margin: 0; padding: 0; }
.cut-row, #leftovers li { display: grid; grid-template-columns: 26px 1fr; align-items: start; width: 100%; gap: 5px 8px; text-align: left; border: 0; border-radius: 4px; padding: 7px; border-bottom: 1px solid var(--line); background: var(--panel); color: var(--ink); font-size: 12px; }
.cut-row span, #leftovers small { color: var(--muted); }
.cut-row .cut-number { display: grid; place-items: center; min-height: 24px; border: 1px solid #d9dbce; border-radius: 3px; background: #efefe4; color: var(--green); font: 700 11px var(--mono); }
.cut-meta { margin: 0 0 9px; color: var(--green); font-size: 12px; font-weight: 700; }
.offcut-row { margin: 0; padding-block: 4px; color: var(--body); font-size: 12px; }
.offcut-row + .offcut-row { border-top: 1px solid var(--line); }
.cut-row:not(:first-child), #leftovers li:not(:first-child) { margin-top: 2px; }
.cut-row:hover, .cut-row.active, .cut-row[aria-pressed="true"], .cut-row[aria-current="true"] { background: #f3e5d8; border-color: #e5c3ac; }

.content-section, .content-page { margin-inline: auto; }
.content-page { max-width: 890px; margin-block: 42px 78px; }
#content > .prose { max-width: 890px; min-height: 45vh; margin: 42px auto 65px; }
#content > .prose h1 { font: 500 clamp(35px, 4vw, 58px)/1.05 var(--serif); letter-spacing: -.055em; }
.content-page > section { margin-block: 32px; }
.content-section { width: min(1110px, calc(100% - 72px)); padding-block: 38px 46px; border-top: 1px solid var(--line); }
.content-intro { margin-bottom: 27px; }
.content-intro h1, .content-intro h2, .content-section h2, .content-page h2, .content-page > h1 { font: 500 clamp(28px, 4.5vw, 50px)/1.07 var(--serif); letter-spacing: -.055em; margin-bottom: 11px; }
.content-page > section h2, .content-section > section h2 { font-size: clamp(24px, 3vw, 34px); }
.content-intro h1, .content-page > h1 { font-size: clamp(42px, 6vw, 74px); }
.content-page p, .content-section p, .content-page li { max-width: 78ch; color: var(--body); }
.content-page a:not(.button), .content-section a:not(.button) { font-weight: 650; }
.content-page :is(ul, ol), .content-section :is(ul, ol) { padding-inline-start: 22px; }
.content-page li + li, .content-section li + li { margin-top: 5px; }
.content-page :is(table, pre), .content-section :is(table, pre) { max-width: 100%; overflow-x: auto; display: block; }
.content-page table, .content-section table { border-collapse: collapse; text-align: left; }
.content-page :is(th, td), .content-section :is(th, td) { padding: 7px 12px; border: 1px solid var(--line); }
.content-page th, .content-section th { background: #e7eade; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; margin-block: 20px 32px; }
.info-grid article { padding: 16px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); }
.info-grid h3, .content-page h3 { font: 600 20px/1.15 var(--serif); margin-bottom: 8px; }
.info-grid p:last-child { margin-bottom: 0; }
.content-page details, .content-section details { padding: 11px 13px; background: var(--panel); border: 1px solid var(--line); border-radius: 5px; margin-block: 7px; }
.content-page summary, .content-section summary { cursor: pointer; font-weight: 700; }
.content-page details p, .content-section details p { margin: 7px 0 0; }

.site-footer { background: #ebece2; border-top: 1px solid var(--line); }
.footer-inner { display: flex; justify-content: space-between; gap: 23px; align-items: center; padding-block: 24px; }
.footer-brand { display: inline; font-size: 19px; }
.footer-inner p { margin: 0; color: var(--muted); font-size: 12px; }
.footer-inner nav { display: flex; flex-wrap: wrap; gap: 16px; }
.footer-inner nav a { font-size: 12px; font-weight: 650; }

#app-dialog { color: var(--ink); background: var(--panel); border: 1px solid #bec9b9; border-radius: 9px; padding: 0; width: min(540px, calc(100% - 26px)); max-height: 86dvh; box-shadow: 0 20px 80px #091f1760; }
#app-dialog::backdrop { background: #10251c86; }
.dialog-top { padding: 15px 19px; display: flex; justify-content: space-between; align-items: center; gap: 7px; border-bottom: 1px solid var(--line); }
.dialog-top h2 { margin: 0; font: 500 30px/1.1 var(--serif); letter-spacing: -.045em; }
.dialog-close { flex: 0 0 34px; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 4px; color: var(--ink); background: #eeefe6; font-size: 20px; line-height: 1; }
#dialog-body { padding: 17px 19px 20px; }
#dialog-body :is(form, .dialog-fields) { display: grid; gap: 9px; align-items: start; }
#dialog-body label { display: grid; gap: 3px; font-size: 13px; font-weight: 650; }
#dialog-body textarea { min-height: 130px; resize: vertical; font: 12px/1.5 var(--mono); }
#dialog-body p { margin-bottom: 10px; }
#dialog-body :is(ul, ol) { padding-inline-start: 22px; }
#dialog-body a { overflow-wrap: anywhere; }
#dialog-body .button { width: fit-content; }
#dialog-body .button-primary { justify-self: start; }
#print-report { display: none; }

@media (max-width: 1120px) {
  .page-width { width: calc(100% - 38px); }
  .workbench { grid-template-columns: minmax(312px, .9fr) minmax(365px, 1.35fr); }
  .work-side { grid-column: 2; display: grid; grid-template-columns: 1.25fr 1fr; }
  .work-inputs { grid-row: span 2; }
  .site-bar { gap: 25px; }
}
@media (max-width: 760px) {
  .page-width, .content-section { width: calc(100% - 26px); }
  .site-bar { display: grid; grid-template-columns: 1fr auto; gap: 0 10px; padding-top: 8px; }
  .brand { font-size: 21px; }
  .header-actions { grid-column: 2; grid-row: 1; gap: 4px; }
  .header-actions .button { padding-inline: 7px; min-height: 34px; font-size: 11px; }
  .site-nav { grid-row: 2; grid-column: 1 / -1; gap: 0 19px; min-height: 39px; overflow-x: auto; }
  .site-nav a { font-size: 12px; }
  .work-intro { display: block; margin-bottom: 17px; }
  .work-intro h1 { margin-top: 5px; }
  .work-intro-side { display: block; margin-top: 9px; }
  .intro-rule { display: none; }
  .job-bar { padding: 6px 7px; gap: 6px; }
  .job-tools { gap: 4px; }
  .job-name { gap: 1px; }
  .job-name label { font-size: 9px; }
  .job-name input { padding-inline: 4px; }
  #save-project, #quick-optimize { padding-inline: 7px; min-height: 33px; font-size: 11px; }
  .unit-picker button { min-width: 24px; font-size: 10px; }
  .workbench { grid-template-columns: minmax(0, 1fr); }
  .work-inputs { grid-row: auto; }
  .plan-panel { min-height: 415px; }
  .sheet-diagram { min-height: 258px; }
  .work-side { grid-column: 1; }
  .parts-tools .button-text { margin-left: 2px; }
  .content-page { margin-top: 29px; }
}
@media (max-width: 420px) {
  .work-side { grid-template-columns: 1fr; }
  .work-intro h1 { font-size: 38px; }
  .part-row.row-main, .part-row .row-main, .part-table :is(.part-head, .parts-head, .parts-labels) { grid-template-columns: minmax(62px, 1.35fr) repeat(2, minmax(35px, .85fr)) minmax(25px, .42fr) minmax(48px, 1.1fr) 19px; }
  .part-row :is(input, select) { font-size: 11px; padding-inline: 2px; }
  .footer-inner { align-items: start; flex-direction: column; gap: 10px; }
}

@page { margin: 13mm; }
@media print {
  body { margin: 0; color: #000; background: #fff; font-size: 10pt; line-height: 1.35; }
  body > :not(#print-report) { display: none !important; }
  #print-report { display: block !important; width: 100%; color: #000; }
  #print-report h1 { font-size: 21pt; line-height: 1.15; margin: 0 0 4mm; }
  #print-report h2 { font-size: 15pt; margin: 3mm 0 2mm; break-after: avoid; }
  #print-report h3 { font-size: 11pt; margin: 3mm 0 1mm; break-after: avoid; }
  #print-report p { margin: 1.5mm 0; }
  #print-report :is(.print-sheet, .print-page) { break-before: page; }
  #print-report :is(.print-sheet, .print-page):first-of-type { break-before: auto; }
  #print-report svg { display: block; width: 100%; max-height: 104mm; height: auto; print-color-adjust: exact; break-inside: avoid; }
  #print-report .diagram-caption { fill: #26382d; }
  #print-report :is(li, tr) { break-inside: avoid; }
  #print-report table { border-collapse: collapse; width: 100%; margin-block: 2mm; }
  #print-report :is(td, th) { border: 1px solid #b4b4b4; padding: 1.4mm 2mm; text-align: left; }
  #print-report ol, #print-report ul { padding-inline-start: 6mm; }
}
.workshop-settings { margin-top: .7rem; border-top: 1px solid var(--line, #d8ccbb); padding-top: .65rem; }
.workshop-settings summary, .row-profile summary { cursor: pointer; font-size: .82rem; font-weight: 650; }
.workshop-settings .field:first-of-type { margin-top: .6rem; }
.workshop-settings .field + .field { margin-top: .4rem; }
.row-profile { grid-column: 1 / -1; margin: .35rem 0 .1rem; }
.row-profile-fields { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: .4rem; margin-top: .45rem; }
.row-profile-fields .field { min-width: 0; }
.row-profile-fields :is(input, select) { width: 100%; min-width: 0; }
.stock-profile-note { display: block; color: var(--muted, #5b675d); margin-top: .3rem; font-size: .75rem; }
.cut-progress-line { display: flex; align-items: center; justify-content: space-between; gap: .5rem; font-size: .78rem; padding: .35rem 0; }
.cut-progress-row { display: flex; align-items: center; gap: .2rem; }
.cut-progress-row .cut-row { flex: 1; min-width: 0; }
.cut-progress-row input[type=checkbox] { accent-color: #245c46; flex: 0 0 auto; width: 1rem; height: 1rem; }
.cut-progress-row.cut-done .cut-number { background-color: #c8deca; color: #17513d; }

/* Project recovery and readable workshop navigation. */
button, a, summary { touch-action: manipulation; }
#app-dialog { overscroll-behavior: contain; }
h1, h2 { text-wrap: balance; }
#stock-heading, #parts-heading, #plan-heading, #cuts-heading { scroll-margin-top: 62px; }
.workspace-toolbar, .workspace-history, .workspace-files { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.workspace-toolbar { justify-content: space-between; margin: -2px 0 14px; }
#draft-status { font-size: 11px; color: var(--muted); }
.workspace-jumps { display: none; }
.diagram-controls { display: flex; align-items: center; justify-content: flex-end; gap: 5px; padding: 7px 11px; border-bottom: 1px solid var(--line); }
.diagram-controls > span { margin-right: auto; color: var(--muted); font-size: 11px; }
.diagram-controls output { min-width: 42px; text-align: center; font-size: 12px; font-variant-numeric: tabular-nums; }
.diagram-controls .button { min-width: 32px; }
.diagram-viewport { width: 100%; max-height: 580px; overflow: auto; overscroll-behavior: contain; }
.diagram-viewport > svg { max-width: none; max-height: none; }
.diagram-viewport[data-zoom="1.5"] > svg { width: 150%; }
.diagram-viewport[data-zoom="2"] > svg { width: 200%; }
.diagram-viewport[data-zoom="2.5"] > svg { width: 250%; }
.diagram-viewport[data-zoom="3"] > svg { width: 300%; }
.part-row > .part-cell > span { display: none; }
input[aria-invalid="true"] { border-color: var(--orange) !important; outline: 2px solid #bc421f33; }
input[readonly] { background-color: #eeeede; color: var(--muted); }
#result-status { max-width: 24ch; }
.result-stat strong { font-variant-numeric: tabular-nums; }
@media (max-width: 760px) {
  .job-bar { flex-wrap: wrap; padding: 10px; }
  .job-name { flex-basis: 100%; gap: 8px; }
  .job-name input { flex: 1; width: 100%; font-size: 16px; }
  .job-tools { width: 100%; justify-content: flex-end; gap: 8px; }
  .job-tools .unit-picker { margin-right: auto; }
  #save-project, #quick-optimize { font-size: 13px; min-height: 42px; padding-inline: 12px; }
  .unit-picker button { min-height: 32px; min-width: 34px; font-size: 12px; }
  .workspace-toolbar { gap: 9px; }
  .workspace-history { width: 100%; }
  .workspace-files { width: 100%; }
  .workspace-files .button { flex: 1; }
  .workspace-toolbar .button { min-height: 40px; }
  #draft-status { flex: 1; min-width: 120px; }
  .workspace-jumps { display: flex; position: sticky; top: 0; z-index: 10; margin-bottom: 12px; padding: 3px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); box-shadow: 0 3px 8px #1a302812; }
  .workspace-jumps a { display: grid; place-items: center; flex: 1; min-height: 40px; text-decoration: none; font-size: 13px; font-weight: 700; }
  .workspace-jumps a:hover { background: #e9eadf; }
  .part-head { display: none !important; }
  .part-row.row-main { grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(65px, 1fr); gap: 6px; border-bottom: 1px solid var(--line); padding-block: 9px; }
  .part-row > .part-cell > span { display: block; font-size: 11px; }
  .part-row > .part-cell:first-child { grid-column: 1 / 4; }
  .part-row > .remove-row { grid-column: 4; grid-row: 1; justify-self: end; min-width: 40px; min-height: 40px; }
  .part-row > .part-cell:nth-child(2) { grid-column: 1; grid-row: 2; }
  .part-row > .part-cell:nth-child(3) { grid-column: 2; grid-row: 2; }
  .part-row > .part-cell:nth-child(4) { grid-column: 3; grid-row: 2; }
  .part-row > .part-cell:nth-child(5) { grid-column: 4; grid-row: 2; }
  .part-row :is(input, select), .stock-row :is(input, select), #kerf { min-height: 42px; font-size: 16px; padding-inline: 6px; }
  .parts-tools .button, .parts-footer .button, .button-add { min-height: 42px; }
  .part-row details summary, .stock-row details summary { min-height: 32px; padding-block: 6px; }
  .diagram-controls .button { min-height: 42px; min-width: 40px; }
  .diagram-controls > span { max-width: 14ch; font-size: 10px; }
  .diagram-viewport { max-height: 460px; }
  .sheet-tab { min-height: 40px; min-width: 60px; }
  .cut-progress-row input[type=checkbox] { width: 24px; height: 24px; margin: 8px; }
}
@media (max-width: 350px) {
  .header-actions .button { padding-inline: 4px; }
  .brand { font-size: 18px; gap: 5px; }
  #inbox-button { display: none; }
}

@media (min-width: 761px) and (max-width: 950px) {
  .site-bar { display: grid; grid-template-columns: 1fr auto; gap: 0 20px; padding-top: 8px; }
  .header-actions { grid-column: 2; grid-row: 1; }
  .site-nav { grid-row: 2; grid-column: 1 / -1; min-height: 40px; }
}
@media (max-width: 760px) {
  .part-row select { font-size: 14px; padding-inline: 4px; }
}

.diagram-viewport[data-zoom="1"] > svg { max-height: 580px; }
@media (max-width: 760px) {
  .diagram-viewport[data-zoom="1"] > svg { max-height: 460px; }
}

.draft-recovery { flex-basis: 100%; padding: 12px; border: 1px solid var(--orange); border-radius: 5px; background: #fff0e4; }
.draft-recovery p { margin: 0 0 8px; font-size: 13px; }
.draft-recovery .button + .button { margin-left: 6px; }

/* CutListFox uses the generated fox mark with an exact, selectable wordmark. */
.brand, .footer-brand { gap: 8px; letter-spacing: -.045em; }
.brand-logo { display: block; width: 40px; height: 40px; flex: 0 0 auto; object-fit: contain; }
.brand-name { color: var(--ink); font-weight: 750; white-space: nowrap; }
.footer-brand { display: inline-flex; align-items: center; }
.footer-brand .brand-logo { width: 32px; height: 32px; }
.footer-brand .brand-name { color: var(--ink); margin-left: 0; }
@media (max-width: 760px) {
  .brand { font-size: 20px; gap: 6px; }
  .brand .brand-logo { width: 32px; height: 32px; }
}
@media (max-width: 350px) {
  .brand { font-size: 18px; gap: 5px; }
  .brand .brand-logo { width: 28px; height: 28px; }
}
