.nest-app {
  --nest-ink: #25352c;
  --nest-soft: #576658;
  --nest-line: #c4c8b5;
  --nest-paper: #f3f1e6;
  --nest-accent: #286452;
  color: var(--nest-ink);
  color-scheme: light;
  background: var(--nest-paper);
  border: 1px solid #b9c0b2;
  border-radius: 5px;
}
.nest-header { padding: clamp(1rem,2.3vw,1.65rem); }
.nest-header h3 {
  color: var(--nest-ink);
  margin: 0;
  font: 700 clamp(1.65rem,3.2vw,2.7rem)/1.05 "Barlow Condensed","Arial Narrow",sans-serif;
  letter-spacing: -.02em;
}
.nest-header p { margin: .35rem 0 0; color: var(--nest-soft); font-size: 1rem; line-height: 1.45; }
.nest-workspace { display: grid; grid-template-columns: minmax(0,1.65fr) minmax(18rem,.75fr); align-items: start; border-top: 1px solid var(--nest-line); }
.nest-board { min-width: 0; margin: 0; position: sticky; top: .5rem; }
.nest-drawing {
  background-color: #293d35;
  background-image: radial-gradient(#82968a45 .8px,transparent 1px);
  background-size: 9px 9px;
  padding: clamp(.7rem,2.5vw,1.55rem);
  color: #e6eee4;
}
.nest-drawing-head, .nest-readout {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .45rem 1rem;
  flex-wrap: wrap;
}
.nest-drawing-head {
  margin: 0 0 clamp(.45rem,1.7vw,1rem);
  text-shadow: 0 1px 3px #293d35;
  font: 650 .9rem/1.4 var(--body,sans-serif);
}
.nest-drawing-head [data-nest-size] { font: 550 .78rem/1.4 var(--mono,monospace); color: #d7e5d8; }
.nest-drawing svg { display: block; width: 100%; height: auto; aspect-ratio: 1.5; user-select: none; }
.nest-rulers { font-family: ui-monospace,"SFMono-Regular",Menlo,monospace; font-variant-numeric: tabular-nums; }
.nest-readout {
  background: #1c3027;
  color: #eff3e7;
  min-height: 2.8rem;
  padding: .6rem clamp(.7rem,2.5vw,1.55rem);
  font: 700 .92rem/1.45 var(--body,sans-serif);
  border-bottom-left-radius: 4px;
}
.nest-readout [data-nest-coverage] { color: #d0dfd0; font-weight: 450; font-variant-numeric: tabular-nums; }
.nest-settings {
  display: grid;
  gap: clamp(.7rem,1.5vw,1.15rem);
  padding: clamp(.9rem,2.2vw,1.6rem);
  border-left: 1px solid var(--nest-line);
  min-width: 0;
}
.nest-stock-field { display: grid; gap: .35rem; }
.nest-app label, .nest-app legend { color: var(--nest-ink); font: 700 .94rem/1.35 var(--body,sans-serif); }
.nest-stock-field select {
  display: block;
  width: 100%;
  min-height: 44px;
  appearance: none;
  background: #fffef6;
  color: var(--nest-ink);
  border: 1px solid #8f9e8a;
  border-radius: 4px;
  padding: .45rem 2.2rem .45rem .65rem;
  font: 550 .94rem/1.35 var(--body,sans-serif);
}
.nest-stock-field { position: relative; }
.nest-stock-field::after {
  content: "";
  position: absolute;
  bottom: 20px;
  right: .95rem;
  width: .48rem;
  height: .48rem;
  border: solid currentColor;
  border-width: 0 1.7px 1.7px 0;
  transform: rotate(45deg);
  pointer-events: none;
}
.nest-custom {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: .55rem .7rem;
  margin-top: -.22rem;
  padding: .7rem;
  border: 1px solid var(--nest-line);
  border-radius: 4px;
  background: #e9ecdf;
}
.nest-custom[hidden] { display: none; }
.nest-unit, .nest-error { grid-column: 1/-1; }
.nest-dimension { display: grid; min-width: 0; gap: .35rem; }
.nest-dimension input {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: .45rem .65rem;
  border: 1px solid #8f9e8a;
  border-radius: 4px;
  color: var(--nest-ink);
  background: #fffef6;
  font: 550 1rem/1.35 var(--body,sans-serif);
  font-variant-numeric: tabular-nums;
}
.nest-dimension input[aria-invalid="true"] { border-color: #944425; }
.nest-app .nest-error { margin: 0; color: #813b22; font-size: .875rem; line-height: 1.4; }
.nest-app .nest-parts { padding: 0; min-width: 0; border: 0; margin: 0; }
.nest-parts legend { padding: 0 0 .27rem; }
.nest-part {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .35rem;
  padding: .24rem 0;
  border-bottom: 1px solid var(--nest-line);
}
.nest-part-name { display: flex; align-items: center; gap: .48rem; min-width: 0; }
.nest-app .nest-part-name { font-weight: 500; }
.nest-part-name svg { width: 1.8rem; height: 1.8rem; flex-shrink: 0; }
.nest-stepper { display: grid; grid-template-columns: 44px 2.6rem 44px; align-items: center; flex-shrink: 0; }
.nest-stepper button, .nest-stepper input {
  display: grid;
  place-items: center;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 3px;
  text-align: center;
  color: var(--nest-ink);
}
.nest-stepper button { background: transparent; font: 500 1.3rem/1 var(--body,sans-serif); }
.nest-stepper button:not(:disabled):hover { background: #dce5d4; }
.nest-stepper button:disabled { color: #a5ad9d; }
.nest-stepper input {
  width: 100%;
  height: 2.52rem;
  appearance: textfield;
  border-color: #aab5a3;
  background: #fffdf2;
  font: 650 .96rem/1 var(--body,sans-serif);
  font-variant-numeric: tabular-nums;
}
.nest-stepper input::-webkit-outer-spin-button,.nest-stepper input::-webkit-inner-spin-button { appearance: none; margin: 0; }
.nest-clearance { display: grid; grid-template-columns: 1fr auto; align-items: center; }
.nest-clearance output { font: 600 .85rem/1.3 var(--mono,monospace); }
.nest-clearance input { grid-column: 1/-1; width: 100%; margin: 0; min-height: 44px; accent-color: var(--nest-accent); }
.nest-app .nest-turns {
  display: inline-flex; align-items: center; gap: .55rem;
  width: fit-content; min-height: 44px;
  margin: -.8rem 0 -.3rem;
  font-weight: 550;
  cursor: pointer;
}
.nest-turns input { width: 1.12rem; height: 1.12rem; margin: 0; accent-color: var(--nest-accent); }
.nest-app .nest-left {
  margin: 0;
  padding: .55rem .65rem;
  border-left: 3px solid #b16735;
  color: #654525;
  background: #f2e2c5;
  font: 500 .875rem/1.45 var(--body,sans-serif);
}
.nest-save {
  min-height: 44px;
  width: 100%;
  padding: .55rem .75rem;
  border: 1px solid #203e31;
  border-radius: 4px;
  background: #254d3c;
  color: #fffdf1;
  font: 650 .96rem/1.4 var(--body,sans-serif);
}
.nest-save:hover:not(:disabled) { background: #183e2e; }
.nest-save:disabled { opacity: .55; }
.nest-app :focus-visible { outline: 3px solid #b05c31; outline-offset: 1px; }
.nest-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 760px) {
  .nest-workspace { grid-template-columns: minmax(0,1fr); }
  .nest-board { top: 0; z-index: 1; }
  .nest-drawing { padding: .68rem .72rem .55rem; }
  .nest-drawing-head { margin-bottom: .15rem; }
  .nest-drawing svg { width: 100%; height: clamp(8.8rem,25svh,15rem); }
  .nest-readout { border-radius: 0; padding: .43rem .72rem; min-height: 2.25rem; gap: .24rem; font-size: .85rem; }
  .nest-settings { gap: .73rem; border-left: 0; }
  .nest-stock-field select { font-size: 1rem; }
  .nest-settings :is(input,select,button) { scroll-margin-top: min(45svh,19rem); }
}
@media (max-height: 550px) { .nest-board { position: static; } }
@media (max-width: 359px) {
  .nest-settings { padding: .66rem; }
  .nest-part-name { gap: .27rem; }
  .nest-app .nest-part-name { font-size: .86rem; }
  .nest-stepper { grid-template-columns: 44px 2.1rem 44px; }
}
