:root {
  color-scheme: light;
  --ink: #17231e;
  --muted: #5f6c66;
  --paper: #f4f2eb;
  --surface: #fffdf7;
  --surface-strong: #ffffff;
  --line: #d8d7ce;
  --line-strong: #b7beb8;
  --brand: #173c31;
  --brand-2: #23634e;
  --accent: #e6a93a;
  --accent-soft: #fff2cf;
  --danger: #a3332e;
  --danger-soft: #fff0ee;
  --success: #17613d;
  --success-soft: #e9f7ef;
  --warning: #865b0c;
  --shadow: 0 18px 55px rgba(22, 39, 31, 0.09);
  --radius: 18px;
  --radius-small: 11px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% -10%, rgba(230, 169, 58, 0.16), transparent 30rem),
    linear-gradient(180deg, #f7f5ee 0%, var(--paper) 100%);
  font-family: var(--font);
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

button,
select,
input[type="number"] {
  min-height: 44px;
}

button {
  cursor: pointer;
}

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

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible,
pre:focus-visible {
  outline: 3px solid rgba(35, 99, 78, 0.32);
  outline-offset: 3px;
}

a {
  color: var(--brand-2);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 18ch;
  margin-bottom: 0.75rem;
  font-size: clamp(2.25rem, 5vw, 4.65rem);
  line-height: 0.98;
  letter-spacing: -0.045em;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.25rem, 2vw, 1.65rem);
  letter-spacing: -0.02em;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  padding: 0.65rem 0.9rem;
  color: white;
  background: var(--brand);
  border-radius: 0.5rem;
  transform: translateY(-180%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  border-bottom: 1px solid rgba(23, 35, 30, 0.08);
  background: rgba(255, 253, 247, 0.8);
  backdrop-filter: blur(14px);
}

.site-header__inner,
.page-shell,
.site-footer {
  width: min(1500px, calc(100% - 2rem));
  margin-inline: auto;
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: inherit;
  text-decoration: none;
}

.brand__mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--brand);
  background: var(--accent);
  border-radius: 12px;
  font-size: 1.6rem;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1.02rem;
}

.brand small {
  color: var(--muted);
  font-size: 0.78rem;
}

.mvp-badge,
.preview-state {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0.3rem 0.65rem;
  color: var(--brand);
  background: var(--accent-soft);
  border: 1px solid #edd593;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 750;
  letter-spacing: 0.025em;
}

.page-shell {
  padding-block: clamp(2.25rem, 6vw, 5.5rem) 4rem;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 330px);
  gap: clamp(2rem, 6vw, 6rem);
  align-items: end;
  margin-bottom: clamp(2.25rem, 5vw, 4rem);
}

.hero__copy {
  max-width: 68ch;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.4vw, 1.18rem);
}

.eyebrow,
.step-label {
  margin-bottom: 0.5rem;
  color: var(--brand-2);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.coordinate-card {
  display: grid;
  gap: 0.5rem;
  padding: 1.15rem 1.25rem;
  background: rgba(255, 253, 247, 0.72);
  border: 1px solid rgba(23, 35, 30, 0.12);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(22, 39, 31, 0.05);
}

.coordinate-card span {
  color: var(--muted);
  font-size: 0.9rem;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(420px, 0.95fr) minmax(500px, 1.2fr);
  gap: 1.25rem;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid rgba(23, 35, 30, 0.11);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel--controls,
.panel--preview,
.panel--json {
  padding: clamp(1.1rem, 2vw, 1.6rem);
}

.panel--preview {
  position: sticky;
  top: 1rem;
}

.panel--json {
  margin-top: 1.25rem;
}

.panel__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.field {
  display: grid;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.field select,
.field input[type="number"],
.edge-length-input {
  width: 100%;
  color: var(--ink);
  background: var(--surface-strong);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
}

.field select {
  padding: 0.65rem 2.3rem 0.65rem 0.75rem;
}

.field input[type="number"] {
  padding: 0.65rem 0.75rem;
  text-align: right;
}

.field--wide {
  grid-column: 1 / -1;
}

.field-help {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 500;
  line-height: 1.4;
}

.measurement-input {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.measurement-input > span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
}

.model-description,
.input-note,
.json-help {
  color: var(--muted);
  font-size: 0.88rem;
}

.model-description {
  min-height: 2.75rem;
  margin: 0.8rem 0 1rem;
}

.closure-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.closure-card {
  display: grid;
  gap: 0.15rem;
  padding: 0.75rem 0.85rem;
  background: #f3f5f1;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
}

.closure-card span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.closure-card strong {
  font-size: 0.9rem;
}

.closure-card.is-valid {
  background: var(--success-soft);
  border-color: #b9dec9;
}

.closure-card.is-invalid {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #efc0bb;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 13px;
}

.edge-table {
  width: 100%;
  min-width: 610px;
  border-collapse: collapse;
  background: white;
  font-size: 0.86rem;
}

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

.edge-table th,
.edge-table td {
  padding: 0.7rem;
  border-bottom: 1px solid #ecece5;
  text-align: left;
  vertical-align: middle;
}

.edge-table tr:last-child td {
  border-bottom: 0;
}

.edge-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  background: #f7f7f2;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.segment-cell {
  min-width: 185px;
}

.segment-name {
  display: block;
  color: var(--ink);
  font-weight: 750;
}

.segment-help {
  display: block;
  margin-top: 0.1rem;
  color: var(--muted);
  font-size: 0.74rem;
}

.direction-badge,
.edge-id-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  padding: 0.28rem 0.42rem;
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 800;
}

.direction-badge {
  color: var(--brand);
  background: #edf3ef;
  border: 1px solid #d3e2da;
}

.edge-id-badge {
  color: #714900;
  background: var(--accent-soft);
  border: 1px solid #efd99c;
}

.edge-id-badge.is-empty {
  color: var(--muted);
  background: #f1f1ed;
  border-color: #deded7;
}

.edge-length-wrap {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 145px;
}

.edge-length-input {
  min-width: 100px;
  padding: 0.55rem 0.6rem;
  text-align: right;
}

.edge-length-wrap span {
  color: var(--muted);
  font-size: 0.78rem;
}

.input-note {
  margin: 0.75rem 0;
}

.flooring-fieldset {
  min-width: 0;
  margin: 1.2rem 0 0.9rem;
  padding: 1rem;
  background: #faf9f3;
  border: 1px solid var(--line);
  border-radius: 13px;
}

.flooring-fieldset legend {
  padding: 0 0.45rem;
  color: var(--brand);
  font-size: 0.82rem;
  font-weight: 850;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.flooring-intro {
  margin: 0 0 0.9rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.flooring-grid {
  align-items: start;
}

.flooring-rule-note {
  margin: 0.9rem 0 0;
  padding: 0.7rem 0.8rem;
  color: #4e5e56;
  background: #edf3ef;
  border: 1px solid #d3e2da;
  border-radius: 10px;
  font-size: 0.79rem;
}

.status,
.storage-status {
  padding: 0.85rem 0.95rem;
  border-radius: var(--radius-small);
  font-size: 0.88rem;
}

.status {
  margin-block: 0.85rem;
  border: 1px solid var(--line);
}

.status--neutral {
  color: var(--muted);
  background: #f4f4ef;
}

.status--success {
  color: var(--success);
  background: var(--success-soft);
  border-color: #b7dfc7;
}

.status--error {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #efbbb5;
}

.status--working {
  color: var(--warning);
  background: #fff7df;
  border-color: #eddbab;
}

.status ul {
  margin: 0.4rem 0 0;
  padding-left: 1.25rem;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.button-row--compact {
  gap: 0.45rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.68rem 0.95rem;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 760;
  text-decoration: none;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.button:not(:disabled):hover {
  transform: translateY(-1px);
}

.button--primary {
  color: white;
  background: var(--brand);
  border-color: var(--brand);
}

.button--primary:hover {
  background: #0e3026;
}

.button--secondary {
  color: var(--brand);
  background: #eef5f1;
  border-color: #c7ddd2;
}

.button--quiet {
  color: var(--ink);
  background: transparent;
  border-color: var(--line);
}

.svg-frame {
  overflow: hidden;
  background: #f8f8f4;
  border: 1px solid var(--line);
  border-radius: 15px;
}

#room-svg {
  display: block;
  width: 100%;
  aspect-ratio: 960 / 680;
}

.svg-canvas {
  fill: #f9faf6;
  stroke: #e0e2da;
}

.room-polygon {
  fill: #e9e0c8;
  stroke: #173c31;
  stroke-width: 3;
  stroke-linejoin: round;
}

.room-edge {
  stroke-width: 5;
  stroke-linecap: round;
}

.edge-facing-n { stroke: #2f6b55; }
.edge-facing-e { stroke: #9b5b20; }
.edge-facing-s { stroke: #49637b; }
.edge-facing-w { stroke: #7b496a; }

.edge-tick {
  stroke: #67736d;
  stroke-width: 1.5;
}

.edge-label {
  fill: #1d2924;
  font-family: var(--font);
  font-size: 14px;
  paint-order: stroke;
  stroke: #f9faf6;
  stroke-width: 5px;
  stroke-linejoin: round;
}

.edge-label-id {
  font-weight: 850;
}

.edge-label-length {
  font-size: 12px;
  font-weight: 650;
}

.room-vertex {
  fill: #ffffff;
  stroke: #173c31;
  stroke-width: 2;
}

.vertex-label {
  fill: #67736d;
  font-family: var(--mono);
  font-size: 10px;
  paint-order: stroke;
  stroke: #f9faf6;
  stroke-width: 3px;
}

.svg-summary-title {
  fill: #17231e;
  font-size: 19px;
  font-weight: 800;
}

.svg-summary-detail {
  fill: #64706a;
  font-size: 13px;
}

.compass-ring {
  fill: rgba(255, 255, 255, 0.82);
  stroke: #c9cec8;
}

.compass-axis {
  stroke: #738079;
  stroke-width: 1.5;
}

.compass-north {
  fill: #173c31;
}

.compass-label {
  fill: #31423a;
  font-size: 11px;
  font-weight: 850;
}

.svg-placeholder {
  fill: #78837d;
  font-size: 18px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
  margin: 0.85rem 0;
}

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

.metric-grid--flooring div:last-child {
  grid-column: 1 / -1;
}

.metric-grid div {
  padding: 0.7rem;
  background: #f5f5f0;
  border: 1px solid #e2e2db;
  border-radius: 10px;
}

.metric-grid dt {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.metric-grid dd {
  margin: 0.2rem 0 0;
  font-weight: 800;
}

.storage-status {
  margin-bottom: 0.75rem;
  color: var(--muted);
  background: #f3f3ee;
  border: 1px solid var(--line);
}

.storage-status.is-success {
  color: var(--success);
  background: var(--success-soft);
  border-color: #b7dfc7;
}

.storage-status.is-error {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #efbbb5;
}

.panel--json pre {
  max-height: 520px;
  margin: 0;
  padding: 1rem;
  overflow: auto;
  color: #e7eee9;
  background: #17231e;
  border-radius: 13px;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.55;
  tab-size: 2;
}

.rule-note {
  display: grid;
  grid-template-columns: minmax(220px, 0.35fr) minmax(0, 1fr);
  gap: 2rem;
  margin-top: 1.25rem;
  padding: 1.35rem 1.5rem;
  color: #203229;
  background: #e9efe9;
  border: 1px solid #cedacf;
  border-radius: var(--radius);
}

.rule-note p {
  max-width: 80ch;
  margin-bottom: 0;
  color: #52635a;
}

.site-footer {
  padding-block: 0 3rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.simple-page {
  width: min(700px, calc(100% - 2rem));
  margin: 12vh auto;
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

@media (max-width: 1120px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .panel--preview {
    position: static;
  }
}

@media (max-width: 760px) {
  .site-header__inner,
  .page-shell,
  .site-footer {
    width: min(100% - 1rem, 1500px);
  }

  .site-header__inner {
    min-height: 64px;
  }

  .mvp-badge {
    display: none;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  h1 {
    font-size: clamp(2.25rem, 12vw, 3.4rem);
  }

  .form-grid,
  .closure-grid,
  .metric-grid,
  .rule-note {
    grid-template-columns: 1fr 1fr;
  }

  .rule-note {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .panel__heading {
    align-items: flex-start;
  }
}

@media (max-width: 520px) {
  .form-grid,
  .closure-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .field--wide {
    grid-column: auto;
  }

  .panel__heading {
    flex-direction: column;
  }

  .panel__heading > .button-row {
    width: 100%;
  }

  .button-row .button {
    flex: 1 1 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

input.is-invalid,
select.is-invalid,
.edge-length-input.is-invalid {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: var(--danger);
}

/* WhereToCut calculation -------------------------------------------------- */

.panel--calculation {
  margin-top: 1.25rem;
  padding: clamp(1rem, 2.4vw, 1.75rem);
}

.button--calculate {
  color: #fff;
  background: #7b3f16;
  border-color: #7b3f16;
}

.button--calculate:not(:disabled):hover {
  background: #602f0f;
}

.calculation-intro,
.calculation-reason {
  max-width: 88ch;
  color: var(--muted);
}

.calculation-working {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.9rem 1rem;
  align-items: center;
  margin: 1rem 0;
  padding: 1rem;
  color: #6b4800;
  background: #fff7df;
  border: 1px solid #eddbab;
  border-radius: var(--radius-small);
}

.calculation-working[hidden] {
  display: none;
}

.calculation-spinner {
  width: 2.25rem;
  height: 2.25rem;
  border: 4px solid rgba(123, 63, 22, 0.22);
  border-top-color: #7b3f16;
  border-radius: 50%;
  animation: calculation-spin 800ms linear infinite;
}

.calculation-working__copy {
  display: grid;
  gap: 0.18rem;
}

.calculation-working progress {
  grid-column: 1 / -1;
  width: 100%;
  height: 0.7rem;
  accent-color: #7b3f16;
}

.calculating-dots::after {
  display: inline-block;
  width: 1.5em;
  overflow: hidden;
  vertical-align: bottom;
  content: '...';
  animation: calculating-dots 1.2s steps(4, end) infinite;
}

@keyframes calculation-spin {
  to { transform: rotate(360deg); }
}

@keyframes calculating-dots {
  0% { width: 0; }
  100% { width: 1.5em; }
}

.calculation-result-heading,
.result-table-heading {
  display: flex;
  justify-content: space-between;
  gap: 1.25rem;
  align-items: flex-start;
}

.calculation-result-heading {
  margin: 1.25rem 0 0.85rem;
  padding: 1rem 1.1rem;
  background: #edf4ef;
  border: 1px solid #ccddd2;
  border-radius: var(--radius-small);
}

.calculation-result-heading h3,
.result-table-heading h3 {
  margin-bottom: 0;
}

.orientation-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.orientation-card {
  display: grid;
  gap: 0.45rem;
  width: 100%;
  padding: 0.9rem 1rem;
  text-align: left;
  color: var(--ink);
  background: #fafaf6;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
}

.orientation-card:not(:disabled):hover,
.orientation-card.is-selected {
  background: #eef5f1;
  border-color: #82aa96;
}

.orientation-card.is-selected {
  box-shadow: inset 0 0 0 2px #2f6b55;
}

.orientation-card.is-unavailable {
  color: var(--muted);
  background: #f2f2ed;
}

.orientation-card__title {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: space-between;
  align-items: center;
}

.orientation-card__badge {
  padding: 0.2rem 0.45rem;
  color: #fff;
  background: #2f6b55;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.orientation-card__detail {
  color: var(--muted);
  font-size: 0.82rem;
}

.layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.55fr);
  gap: 1rem;
  align-items: start;
}

.layout-svg-frame {
  overflow: hidden;
  background: #f8f8f4;
  border: 1px solid var(--line);
  border-radius: 15px;
}

#layout-svg {
  display: block;
  width: 100%;
  aspect-ratio: 1120 / 760;
}

.layout-svg-canvas {
  fill: #f9faf6;
  stroke: #e0e2da;
}

.layout-room-outline {
  fill: #f2e9d4;
  stroke: #a58d67;
  stroke-width: 2;
  stroke-dasharray: 8 6;
  stroke-linejoin: round;
}

.layout-usable-floor {
  fill: #f5f4ed;
  stroke: #173c31;
  stroke-width: 2.5;
  stroke-linejoin: round;
}

.layout-piece {
  stroke: #173c31;
  stroke-width: 1.1;
  stroke-linejoin: round;
}

.layout-piece--odd { fill: #d9e8de; }
.layout-piece--even { fill: #e8dfca; }
.layout-piece--underwidth { stroke: #a33a2b; stroke-width: 3; stroke-dasharray: 7 4; }
.layout-piece:focus { outline: none; stroke-width: 4; }

.layout-piece-label {
  fill: #173c31;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 760;
  pointer-events: none;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.9);
  stroke-width: 3px;
}

.layout-svg-summary-title {
  fill: #17231e;
  font-size: 19px;
  font-weight: 800;
}

.layout-svg-summary-detail,
.layout-direction-label {
  fill: #64706a;
  font-size: 13px;
}

.layout-direction-line {
  stroke: #7b3f16;
  stroke-width: 3;
}

.layout-arrow-head { fill: #7b3f16; }
.layout-direction-label { font-weight: 800; }
.layout-svg-placeholder { fill: #78837d; font-size: 18px; }

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

.calculation-warnings {
  margin-top: 0.85rem;
  padding: 0.85rem 0.95rem;
  color: #66501e;
  background: #fff8e5;
  border: 1px solid #ead9aa;
  border-radius: var(--radius-small);
  font-size: 0.8rem;
}

.calculation-warnings ul {
  margin: 0.4rem 0 0;
  padding-left: 1.1rem;
}

.result-table-section {
  margin-top: 1.4rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
}

.result-table-heading p {
  max-width: 62ch;
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.result-table-wrap {
  max-height: 620px;
  margin-top: 0.75rem;
}

.result-table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.result-table th,
.result-table td {
  padding: 0.68rem 0.72rem;
  vertical-align: top;
  text-align: left;
  border-bottom: 1px solid #e2e2db;
}

.result-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #35453d;
  background: #f1f3ed;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.result-subline {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.72rem;
}

.result-compact-list {
  display: grid;
  gap: 0.26rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.calculation-json-details {
  margin-top: 1.4rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

.calculation-json-details summary {
  cursor: pointer;
  font-weight: 800;
}

.calculation-json-details pre {
  max-height: 560px;
  margin: 0.75rem 0 0;
  padding: 1rem;
  overflow: auto;
  color: #e7eee9;
  background: #17231e;
  border-radius: 13px;
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.5;
}

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

@media (max-width: 720px) {
  .orientation-options,
  .calculation-metrics {
    grid-template-columns: 1fr;
  }

  .calculation-result-heading,
  .result-table-heading {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  .calculation-spinner,
  .calculating-dots::after {
    animation: none;
  }
}

/* v0.6 local floors, reports and piece types ---------------------------- */
.site-nav { display: flex; gap: .45rem; align-items: center; margin-left: auto; }
.site-nav__link { color: #eaf2ed; text-decoration: none; padding: .55rem .75rem; border-radius: 999px; font-weight: 700; font-size: .9rem; }
.site-nav__link:hover, .site-nav__link:focus-visible, .site-nav__link.is-current { background: rgba(255,255,255,.13); }
.current-floor-name { margin: .5rem 0 0; display: inline-flex; padding: .35rem .7rem; border-radius: 999px; background: #e8f1eb; color: #173d2c; font-weight: 800; }
.calculation-result-badges { display: flex; flex-wrap: wrap; gap: .45rem; justify-content: flex-end; }
.preview-state--local { background: #e9edf5; color: #263d63; }
.preview-state--local.is-warning { background: #fff0cc; color: #745100; }
.turnstile-panel { margin: 1rem 0; padding: 1rem; border: 1px solid #c8d5cd; background: #f5f8f6; border-radius: 14px; display: flex; gap: 1rem; align-items: center; justify-content: space-between; }
.turnstile-panel[hidden] { display: none; }
.turnstile-panel p { margin: .3rem 0 0; color: var(--muted); max-width: 62ch; }
.modal-dialog { width: min(560px, calc(100vw - 2rem)); border: 0; border-radius: 18px; padding: 1.25rem; box-shadow: 0 24px 80px rgba(0,0,0,.28); color: var(--ink); }
.modal-dialog::backdrop { background: rgba(12, 22, 18, .65); backdrop-filter: blur(2px); }
.dialog-heading { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; margin-bottom: 1rem; }
.dialog-heading h2 { margin: 0; }
.dialog-close { border: 0; background: transparent; font-size: 2rem; line-height: 1; cursor: pointer; color: var(--muted); }
.dialog-note { color: var(--muted); }
.report-choice { border: 0; padding: 0; margin: 1rem 0; display: grid; gap: .7rem; }
.report-choice legend { font-weight: 800; margin-bottom: .6rem; }
.report-choice label { display: flex; gap: .7rem; align-items: flex-start; border: 1px solid #d4ddd7; border-radius: 12px; padding: .85rem; cursor: pointer; }
.report-choice small { display: block; color: var(--muted); margin-top: .2rem; }
.button--danger { color: #8d261c; border-color: #d8aaa4; }

.layout-piece--full { }
.layout-pattern-base { fill: #e4eee7; }
.layout-pattern-rip { fill: #e7d9af; }
.layout-pattern-notch { fill: #ddddd7; }
.layout-pattern-reuse { fill: #d7e5ee; }
.layout-pattern-mark { stroke: #526c5f; stroke-width: 1.2; fill: #526c5f; }
.layout-piece--ripped, .layout-piece--notched, .layout-piece--reused { stroke-width: 2.2; }
.layout-piece-type-label { fill: #183328; font-size: 9px; font-weight: 900; letter-spacing: .06em; pointer-events: none; }
.layout-svg-legend { font-size: 12px; }
.layout-legend-full { fill: #d9e8de; stroke: #335447; }
.layout-legend-swatch { stroke: #335447; }
.layout-legend-label { fill: #1b342a; font-weight: 700; }

.hero--compact { align-items: center; }
.saved-page { max-width: 1220px; }
.storage-meter-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1.25rem; margin-bottom: 1rem; }
.storage-meter-label { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: .45rem; font-size: .9rem; }
.storage-meter-grid progress { width: 100%; height: 16px; }
.storage-data-bar { width: 100%; height: 16px; border-radius: 999px; background: #e1e8e3; overflow: hidden; }
.storage-data-bar span { display: block; height: 100%; width: 0; background: #4d826b; border-radius: inherit; transition: width .25s ease; }
.saved-library-heading { align-items: flex-start; }
.saved-controls { display: grid; grid-template-columns: 2fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.saved-floor-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); gap: 1rem; margin-top: 1rem; }
.saved-floor-card { border: 1px solid #d7e0da; border-radius: 16px; padding: 1rem; background: #fff; box-shadow: 0 8px 28px rgba(21,38,31,.07); }
.saved-floor-card__heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.saved-floor-card h3 { margin: .15rem 0 .8rem; font-size: 1.25rem; }
.saved-floor-metrics { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .65rem; margin: 0; }
.saved-floor-metrics div { background: #f5f8f6; border-radius: 10px; padding: .6rem; }
.saved-floor-metrics dt { color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; }
.saved-floor-metrics dd { margin: .2rem 0 0; font-weight: 800; }
.saved-floor-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.saved-empty { grid-column: 1/-1; text-align: center; padding: 3rem 1rem; border: 2px dashed #cbd8d0; border-radius: 16px; }
.saved-empty strong { font-size: 1.2rem; }

@media (max-width: 820px) {
  .site-header__inner { flex-wrap: wrap; }
  .site-nav { order: 3; width: 100%; margin: .25rem 0 0; }
  .mvp-badge { margin-left: auto; }
  .storage-meter-grid, .saved-controls { grid-template-columns: 1fr; }
  .turnstile-panel { align-items: flex-start; flex-direction: column; }
}

/* v0.7 consumer UI, tips, invalid previews and print selection ----------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 253, 247, .96);
  border-bottom-color: rgba(23, 60, 49, .2);
}

.site-header__inner {
  min-height: 76px;
}

.brand__mark {
  display: block;
  width: 46px;
  height: 46px;
  padding: 0;
  border-radius: 13px;
  background: transparent;
}

.brand strong {
  color: var(--ink);
  font-size: 1.08rem;
}

.site-nav {
  margin-left: auto;
  padding: .25rem;
  background: #eef3ef;
  border: 1px solid #d2ddd6;
  border-radius: 999px;
}

.site-nav__link {
  color: #163b2f;
  padding: .58rem .9rem;
  font-size: .92rem;
}

.site-nav__link:hover,
.site-nav__link:focus-visible {
  color: #0d2b21;
  background: #dfe9e3;
}

.site-nav__link.is-current {
  color: #fff;
  background: var(--brand);
  box-shadow: 0 2px 8px rgba(23, 60, 49, .18);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.header-action {
  min-height: 38px;
  padding: .45rem .75rem;
  color: var(--brand);
  background: #fffaf0;
  border: 1px solid #d8c58c;
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 800;
}

.header-action:hover,
.header-action:focus-visible {
  background: var(--accent-soft);
  border-color: #c49c3c;
}

.hero--dismissible {
  position: relative;
  padding: clamp(1.25rem, 3vw, 2rem);
  background: rgba(255, 253, 247, .74);
  border: 1px solid rgba(23, 35, 30, .12);
  border-radius: var(--radius);
  box-shadow: 0 12px 35px rgba(22, 39, 31, .05);
}

.hero-dismiss {
  position: absolute;
  top: .65rem;
  right: .65rem;
  z-index: 2;
  width: 40px;
  min-height: 40px;
  padding: 0;
  color: #52615a;
  background: rgba(255, 255, 255, .8);
  border: 1px solid #d4dad6;
  border-radius: 50%;
  font-size: 1.75rem;
  line-height: 1;
}

.hero-dismiss:hover,
.hero-dismiss:focus-visible {
  color: var(--ink);
  background: #fff;
}

html.hero-dismissed #intro-hero {
  display: none;
}

.tip-host {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}

.tip-icon {
  display: none;
  flex: 0 0 auto;
  width: 26px;
  min-height: 26px;
  padding: 0;
  place-items: center;
  color: #fff;
  background: var(--brand-2);
  border: 0;
  border-radius: 50%;
  font-size: .77rem;
  font-weight: 900;
  line-height: 1;
}

.tip-popover {
  position: absolute;
  z-index: 80;
  top: calc(100% + .45rem);
  left: 0;
  width: min(320px, calc(100vw - 2rem));
  padding: .75rem .85rem;
  color: #fff;
  background: #173c31;
  border-radius: 10px;
  box-shadow: 0 14px 35px rgba(0, 0, 0, .2);
  font-size: .84rem;
  line-height: 1.45;
}

.tip-popover[hidden] {
  display: none;
}

html.tips-off [data-tip-copy] {
  display: none !important;
}

html.tips-off .tip-icon {
  display: inline-grid;
}

html.tips-on .tip-icon,
html.tips-on .tip-popover {
  display: none !important;
}

/* Draft geometry remains visible when invalid. */
.room-draft-fill {
  fill: rgba(62, 126, 99, .08);
  stroke: none;
}

.room-draft-fill--invalid {
  fill: rgba(163, 51, 46, .06);
}

.room-draft-edge {
  fill: none;
  stroke: #263d33;
  stroke-width: 4;
  stroke-linecap: round;
}

.room-draft-edge--invalid {
  stroke: #bd322a;
  stroke-width: 6;
}

.room-draft-label {
  fill: #33483e;
  font-size: 13px;
  font-weight: 900;
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 4px;
  stroke-linejoin: round;
}

.room-draft-closure {
  stroke: #bd322a;
  stroke-width: 5;
  stroke-dasharray: 10 7;
}

.room-draft-endpoint {
  fill: #fff;
  stroke: #bd322a;
  stroke-width: 4;
}

.room-draft-crossing {
  fill: #bd322a;
  stroke: #fff;
  stroke-width: 3;
}

/* Piece state takes priority over alternating course colour. */
.layout-piece--reused-source {
  /* Reuse is provenance, not an installed visual category. */
}

.layout-piece-label,
.layout-piece-type-label {
  dominant-baseline: middle;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, .9);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.layout-piece-label--vertical,
.layout-piece-type-label--vertical {
  transform-box: fill-box;
  transform-origin: center;
}

.layout-svg-legend {
  pointer-events: none;
}

.source-board-shaping {
  margin-top: .45rem;
  padding-top: .45rem;
  border-top: 1px dashed #d2d8d4;
  color: #42534b;
  font-size: .86rem;
}

.source-board-shaping strong {
  color: var(--ink);
}

.modal-dialog--wide {
  width: min(820px, calc(100vw - 2rem));
}

.report-orientation-choice {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.report-orientation-card {
  align-items: stretch !important;
  padding: .7rem !important;
}

.report-orientation-card:has(input:checked) {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 3px rgba(35, 99, 78, .15);
  background: #f4faf6;
}

.report-orientation-card > input {
  margin-top: .4rem;
}

.report-orientation-visual {
  display: grid;
  grid-template-rows: 118px auto;
  width: 100%;
  gap: .55rem;
}

.report-orientation-visual svg {
  width: 100%;
  height: 118px;
  background: #fff;
  border: 1px solid #d4ddd7;
  border-radius: 10px;
}

.orientation-thumb-room {
  fill: #fffdf7;
  stroke: #173c31;
  stroke-width: 3;
}

.orientation-thumb-band {
  fill: rgba(230, 169, 58, .42);
  stroke: rgba(23, 60, 49, .65);
  stroke-width: 1.5;
}

.saved-page-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2rem;
  align-items: center;
  margin-bottom: 1.4rem;
}

.saved-page-heading h1 {
  margin-bottom: .5rem;
}

.saved-library-panel {
  margin-bottom: 1rem;
}

.storage-panel--collapsible {
  padding: 0;
  overflow: hidden;
}

.storage-panel--collapsible > summary {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 1.1rem 1.25rem;
  cursor: pointer;
  list-style: none;
}

.storage-panel--collapsible > summary::-webkit-details-marker {
  display: none;
}

.storage-panel--collapsible > summary::after {
  content: '＋';
  font-weight: 900;
}

.storage-panel--collapsible[open] > summary::after {
  content: '−';
}

.storage-panel__body {
  padding: 0 1.25rem 1.25rem;
}

.storage-panel-actions {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.saved-floor-grid {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.saved-floor-card {
  display: flex;
  flex-direction: column;
  min-height: 280px;
}

.saved-floor-actions {
  margin-top: auto;
}

.saved-floor-actions .button:first-child {
  flex: 1 1 130px;
}

.saved-card-menu {
  position: relative;
}

.saved-card-menu[open] .saved-card-menu__items {
  display: grid;
}

.saved-card-menu__items {
  position: absolute;
  right: 0;
  bottom: calc(100% + .35rem);
  z-index: 12;
  display: none;
  min-width: 150px;
  padding: .35rem;
  background: #fff;
  border: 1px solid #d4ddd7;
  border-radius: 10px;
  box-shadow: 0 14px 34px rgba(22, 39, 31, .18);
}

.saved-card-menu__items button {
  min-height: 38px;
  padding: .45rem .6rem;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 7px;
}

.saved-card-menu__items button:hover {
  background: #eff5f1;
}

@media (max-width: 980px) {
  .site-header__inner {
    flex-wrap: wrap;
    padding-block: .55rem;
  }

  .site-nav {
    order: 3;
    width: 100%;
    justify-content: center;
    margin: 0;
  }

  .header-actions {
    margin-left: auto;
  }

  .page-shell {
    padding-top: 1.5rem;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 1.2rem;
    align-items: start;
  }

  .workspace-grid,
  .results-grid {
    grid-template-columns: 1fr;
  }

  .calculation-actions {
    position: static;
  }

  .saved-page-heading {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .saved-page-heading .button {
    width: 100%;
  }
}

@media (max-width: 700px) {
  .site-header__inner,
  .page-shell,
  .site-footer {
    width: min(100% - 1rem, 1500px);
  }

  .brand small {
    display: none;
  }

  .brand__mark {
    width: 40px;
    height: 40px;
  }

  .header-action {
    padding-inline: .6rem;
  }

  .site-nav__link {
    flex: 1 1 0;
    text-align: center;
  }

  .hero--dismissible {
    padding: 1.1rem;
  }

  h1 {
    max-width: none;
    font-size: clamp(2rem, 12vw, 3.3rem);
    line-height: 1;
  }

  .coordinate-card {
    padding: .9rem;
  }

  .panel {
    padding: 1rem;
    border-radius: 14px;
  }

  .panel__heading,
  .calculation-result-heading,
  .saved-library-heading {
    align-items: stretch;
  }

  .button-row,
  .calculation-actions,
  .saved-controls,
  .storage-meter-grid {
    grid-template-columns: 1fr !important;
  }

  .calculation-actions .button,
  .button-row .button,
  .button-row a.button {
    width: 100%;
  }

  .report-orientation-choice {
    grid-template-columns: 1fr;
  }

  .saved-floor-grid {
    grid-template-columns: 1fr;
  }

  .saved-floor-card {
    min-height: 0;
  }

  .storage-panel-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .layout-svg-wrap {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  .layout-svg-wrap svg {
    min-width: 720px;
  }
}

html.tips-off .tip-popover {
  display: none;
}

html.tips-off .tip-icon:hover .tip-popover,
html.tips-off .tip-icon:focus-visible .tip-popover,
html.tips-off .tip-icon.is-open .tip-popover {
  display: block;
}

.saved-floor-more {
  position: relative;
}

.saved-floor-more > summary {
  display: inline-grid;
  min-height: 44px;
  place-items: center;
  padding: .55rem .8rem;
  color: var(--brand);
  background: #fff;
  border: 1px solid #cbd7cf;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 800;
  list-style: none;
}

.saved-floor-more > summary::-webkit-details-marker { display: none; }
.saved-floor-more > div {
  position: absolute;
  right: 0;
  bottom: calc(100% + .35rem);
  z-index: 12;
  display: grid;
  min-width: 150px;
  padding: .35rem;
  background: #fff;
  border: 1px solid #d4ddd7;
  border-radius: 10px;
  box-shadow: 0 14px 34px rgba(22, 39, 31, .18);
}
.saved-floor-more button {
  min-height: 38px;
  padding: .45rem .6rem;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 7px;
}
.saved-floor-more button:hover { background: #eff5f1; }
.saved-floor-more button.is-danger { color: var(--danger); }

.orientation-thumb-bg { fill: #fff; }
.orientation-thumb-bg.is-recommended { fill: #f4faf6; }
.orientation-thumb-outline { fill: none; stroke: #173c31; stroke-width: 3; }
.orientation-thumb-band--odd { fill: rgba(35, 99, 78, .24); }
.orientation-thumb-band--even { fill: rgba(230, 169, 58, .4); }

.turnstile-widget--background {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 120;
  max-width: calc(100vw - 2rem);
}
.turnstile-widget--background:empty { display: none; }

/* v0.8 cutting, kerf and remaining-material presentation */
.toggle-field {
  align-content: start;
}

.toggle-control {
  display: flex;
  gap: .7rem;
  align-items: flex-start;
  min-height: 48px;
  padding: .75rem .85rem;
  color: var(--ink);
  background: #f7faf8;
  border: 1px solid #ced8d2;
  border-radius: 11px;
  font-weight: 750;
  line-height: 1.35;
}

.toggle-control input {
  width: 1.15rem;
  height: 1.15rem;
  margin: .08rem 0 0;
  accent-color: var(--brand);
  flex: 0 0 auto;
}

.field.is-disabled .measurement-input {
  opacity: .55;
  background: #eef1ef;
}

.source-board-diagram-cell {
  width: 42%;
  min-width: 350px;
}

.cut-diagram-cell {
  width: 235px;
  min-width: 210px;
}

.source-board-diagram,
.cut-entry-diagram,
.remaining-piece-diagram {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.diagram-board-stock {
  fill: #f7f3e8;
  stroke: #173c31;
  stroke-width: 2;
}

.diagram-installed-piece {
  fill: #dcebe3;
  stroke: #234b3b;
  stroke-width: 1.4;
}

.diagram-installed-piece--shaped {
  fill: #eadfbf;
}

.diagram-unused {
  fill: url(#diagram-waste-hatch);
  stroke: #66726c;
  stroke-width: 1.2;
}

.diagram-kerf {
  fill: #bd322a;
  opacity: .72;
}

.diagram-cut-line {
  fill: none;
  stroke: #8c3d11;
  stroke-width: 2.4;
  stroke-dasharray: 6 4;
}

.diagram-cut-line--rip {
  stroke: #aa5b13;
}

.diagram-cut-line--notch {
  stroke: #8b2140;
  stroke-dasharray: 3 3;
}

.diagram-cut-kept {
  fill: #dcebe3;
}

.diagram-board-id,
.diagram-piece-label,
.diagram-unused-label,
.diagram-cut-label,
.diagram-small-label,
.diagram-dimension-label {
  fill: #14261e;
  font-family: inherit;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, .94);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.diagram-board-id { font-size: 16px; font-weight: 900; }
.diagram-piece-label { font-size: 11px; font-weight: 850; }
.diagram-unused-label { font-size: 10px; font-weight: 750; }
.diagram-cut-label { font-size: 10px; font-weight: 900; fill: #7f2f11; }
.diagram-small-label { font-size: 9px; font-weight: 900; }
.diagram-dimension-label { font-size: 11px; font-weight: 800; }
.diagram-dimension-line { stroke: #50635a; stroke-width: 1.2; }
.diagram-pattern-base { fill: #f8f7f2; }
.diagram-pattern-mark { fill: none; stroke: #8b9590; stroke-width: 1.2; }

.diagram-remaining {
  stroke: #173c31;
  stroke-width: 2;
}

.diagram-remaining--reusable { fill: #d9eee2; }
.diagram-remaining--limited { fill: #f3e6bf; }

.remaining-material-section {
  display: grid;
  gap: 1rem;
}

.remaining-material-summary,
.extra-board-facts {
  min-width: 0;
}

.remaining-metrics {
  margin: 0;
}

.remaining-material-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: .9rem;
}

.remaining-piece-card {
  display: grid;
  grid-template-columns: minmax(130px, .8fr) 1fr;
  gap: .9rem;
  align-items: center;
  min-width: 0;
  padding: .85rem;
  background: #fff;
  border: 1px solid #d4ddd7;
  border-radius: 12px;
}

.remaining-piece-card--limited {
  border-color: #dec781;
  background: #fffaf0;
}

.remaining-piece-card h4,
.remaining-piece-card p {
  margin: 0;
}

.remaining-piece-card strong {
  display: block;
  margin: .25rem 0;
}

.remaining-piece-card p {
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.42;
}

.remaining-material-unusable {
  padding: .85rem 1rem;
  background: #f7f4ef;
  border: 1px solid #ddd7cd;
  border-radius: 11px;
}

.remaining-material-unusable:empty {
  display: none;
}

.remaining-material-unusable h4 {
  margin: 0 0 .45rem;
}

.compact-unusable-list {
  margin: 0;
  color: #59645f;
  font-size: .88rem;
  line-height: 1.55;
}

.extra-board-facts h4 {
  margin: 0 0 .6rem;
}

.contingency-facts-table {
  width: 100%;
  border-collapse: collapse;
}

.contingency-facts-table th,
.contingency-facts-table td {
  padding: .7rem .75rem;
  border: 1px solid #d4ddd7;
  text-align: left;
}

.contingency-facts-table th {
  color: #fff;
  background: var(--brand);
}

.contingency-facts-table tbody tr:nth-child(even) {
  background: #f4f7f5;
}

@media (max-width: 900px) {
  .source-board-diagram-cell,
  .cut-diagram-cell {
    min-width: 280px;
  }
}

@media (max-width: 700px) {
  .remaining-piece-card {
    grid-template-columns: 1fr;
  }

  .source-board-diagram-cell,
  .cut-diagram-cell {
    min-width: 250px;
  }

  .contingency-facts-table {
    font-size: .88rem;
  }
}

.diagram-offcut {
  stroke: #52635b;
  stroke-width: 1.1;
}
.diagram-offcut--reusable { fill: #cfe7d9; }
.diagram-offcut--limited { fill: #f1ddb0; }
.diagram-offcut--unusable { fill: url(#diagram-waste-hatch); }
.diagram-offcut--reused { fill: #dcebe3; stroke-dasharray: 4 3; }
.diagram-offcut-label {
  fill: #21372d;
  font-size: 8.5px;
  font-weight: 900;
  paint-order: stroke;
  stroke: rgba(255,255,255,.92);
  stroke-width: 3px;
}
