:root {
  color-scheme: dark;
  --bg: #0d0e10;
  --side: #111214;
  --panel: #16181b;
  --panel-raised: #1c1f23;
  --hover: #24272c;
  --line: #272a30;
  --line-raised: #343840;
  --text: #ecedee;
  --muted: #a9aeb6;
  --subtle: #878e97;
  --accent: #f5b544;
  --accent-quiet: #2b2318;
  --green: #65dba5;
  --error: #ff9d9b;
  --radius: 14px;
  --sans: "Schibsted Grotesk", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", ui-monospace, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 280px; background: var(--bg); scrollbar-color: var(--line-raised) var(--bg); }
body {
  display: grid;
  grid-template-columns: clamp(194px, 17vw, 238px) minmax(0, 1fr);
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
::selection { background: var(--accent); color: #1b150c; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
a, button { color: inherit; }
a { text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
svg { display: block; }
svg:not(.building-sketch) { fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
.visually-hidden, .skip-link:not(:focus) { position: absolute; clip: rect(0, 0, 0, 0); width: 1px; height: 1px; overflow: hidden; }
.skip-link { position: absolute; z-index: 4; top: 12px; left: 12px; padding: 8px 12px; color: #17130c; background: var(--accent); border-radius: 6px; }

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 38px;
  height: 100vh;
  min-height: 440px;
  padding: 17px 14px;
  background: var(--side);
  border-right: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  align-self: flex-start;
  padding: 0 7px;
  border-radius: 8px;
  font-size: 17px;
  font-weight: 760;
  letter-spacing: -.035em;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 37px;
  height: 37px;
  border: 1px solid #5a4226;
  border-radius: 10px;
  color: var(--accent);
  background: linear-gradient(150deg, #342818, #241e15);
}
.brand-mark svg { width: 22px; height: 22px; }
.step-nav { display: grid; gap: 4px; }
.sidebar-label {
  margin: 0 0 8px;
  padding: 0 10px;
  color: var(--subtle);
  font: 600 10.5px/1.5 var(--mono);
  text-transform: uppercase;
  letter-spacing: .12em;
}
.step-nav a, .reset-button {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 570;
  transition: color .14s, border-color .14s, background .14s;
}
.step-nav a svg, .reset-button svg { flex: 0 0 17px; width: 17px; height: 17px; }
.step-nav a:hover, .reset-button:hover { color: var(--text); background: var(--hover); }
.step-nav a[aria-current] { border-color: #3f3323; color: #f3ede3; background: #231e16; }
.step-nav a[aria-current] svg { color: var(--accent); }
.step-nav .nav-chevron { visibility: hidden; width: 13px; height: 13px; margin-left: auto; }
.step-nav a[aria-current] .nav-chevron { visibility: visible; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 12px; }
.reset-button { width: 100%; background: none; color: var(--subtle); font-size: 13px; text-align: left; }
.app-main { min-width: 0; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 66px;
  padding: 0 clamp(20px, 3.3vw, 48px);
  background: var(--side);
  border-bottom: 1px solid var(--line);
}
.breadcrumb, .topbar-actions, .save-state { display: flex; align-items: center; }
.breadcrumb { gap: 8px; font-size: 13px; font-weight: 600; }
.breadcrumb-root { color: var(--subtle); font-weight: 480; }
.breadcrumb svg { width: 14px; height: 14px; color: var(--subtle); }
.topbar-actions { gap: 10px; }
.save-state { gap: 8px; color: var(--muted); font-size: 12px; }
.save-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px #23332b; }
.save-state.is-unavailable .save-dot { background: var(--accent); box-shadow: 0 0 0 3px #322a1e; }
.button.mobile-reset { display: none; }
.workspace { max-width: 1520px; margin: auto; padding: 0 clamp(20px, 3.3vw, 48px) 44px; }
.page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin: 36px 0 26px;
}
.page-heading .eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font: 600 11px/1.5 var(--mono);
  text-transform: uppercase;
  letter-spacing: .11em;
}
.page-heading h1 { width: fit-content; margin: 0; font-size: clamp(33px, 3.35vw, 49px); font-weight: 760; line-height: 1.08; letter-spacing: -.052em; }
.page-heading h1:focus { outline: 0; }
.page-heading h1 + p { margin: 10px 0 0; font-size: clamp(14px, 1.15vw, 16px); color: var(--muted); }
.card { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.card-heading { display: flex; align-items: center; gap: 11px; min-width: 0; padding: 19px 20px; }
.card-heading h2, .supplier-heading h2 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -.023em; }
.card-heading p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.section-icon {
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid #443620;
  border-radius: 9px;
  background: var(--accent-quiet);
  color: var(--accent);
}
.section-icon svg { width: 18px; height: 18px; }
.dimension-layout { display: grid; grid-template-columns: minmax(0, .96fr) minmax(0, 1.24fr); gap: 14px; }
.dimension-card, .sketch-card { margin: 0; }
.dimension-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 14px;
  row-gap: 16px;
  padding: 4px 20px 22px;
}
.field { display: grid; align-content: start; gap: 7px; min-width: 0; font-size: 13px; font-weight: 620; }
.field-wide { grid-column: 1 / -1; }
.field small { color: var(--subtle); font-size: 12px; font-weight: 450; }
.input-frame, .text-input {
  display: flex;
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--line-raised);
  border-radius: 8px;
  background: #101114;
  color: var(--text);
}
.input-frame:focus-within, .text-input:focus-visible {
  border-color: var(--accent);
  outline: 0;
  box-shadow: 0 0 0 2px #4c3b20;
}
.input-frame:has(input[aria-invalid="true"]), .text-input[aria-invalid="true"] { border-color: #b66b68; }
.input-frame input {
  flex: 1;
  width: 1px;
  min-width: 0;
  padding: 9px 0 9px 11px;
  border: 0;
  outline: 0;
  color: inherit;
  background: transparent;
  font: 500 14px/1.35 var(--mono);
  font-variant-numeric: tabular-nums;
}
.input-frame input::placeholder, .text-input::placeholder { color: var(--subtle); opacity: 1; }
.text-input { width: 100%; padding: 8px 10px; font-weight: 500; }
.input-unit { align-self: center; min-width: 34px; padding: 0 10px 0 6px; color: var(--subtle); text-align: right; font: 500 12px var(--mono); white-space: nowrap; }
.sketch-card { display: flex; flex-direction: column; overflow: hidden; }
.sketch-card .card-heading { padding-bottom: 15px; }
.sketch-stage {
  position: relative;
  flex: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  margin: 0 13px;
  min-height: 220px;
  border: 1px solid #242830;
  border-radius: 10px;
  background-color: #111417;
  background-image: radial-gradient(ellipse at 46% 52%, #25313e61, transparent 65%),
    linear-gradient(#69788b15 1px, transparent 1px), linear-gradient(90deg, #69788b15 1px, transparent 1px);
  background-size: 100% 100%, 20px 20px, 20px 20px;
  background-position: center;
}
.building-sketch { width: 100%; min-height: 170px; max-height: 260px; height: 100%; overflow: visible; }
.building-sketch .facade { fill: #26323e; stroke: #718292; }
.building-sketch .gable { fill: #303d49; stroke: #8a9baa; }
.building-sketch .roof-front { fill: #34444f; stroke: #a2b2bf; }
.building-sketch .roof-back { fill: #232f39; stroke: #667a8c; }
.building-sketch .facade, .building-sketch .gable, .building-sketch .roof-front, .building-sketch .roof-back { stroke-width: 1.4; stroke-linejoin: round; }
.building-sketch .seam { stroke: #869bac; stroke-width: .8; opacity: .37; }
.building-sketch .guide { stroke: var(--accent); stroke-width: 1; opacity: .48; stroke-dasharray: 3 4; }
.building-sketch .measure { stroke: var(--accent); stroke-width: 1.2; fill: none; }
.building-sketch .measure-text { fill: #ffcd75; stroke: #13171b; stroke-width: 5px; paint-order: stroke; stroke-linejoin: round; font: 600 15px var(--mono); dominant-baseline: middle; text-anchor: middle; }
.sketch-empty { position: absolute; margin: 0; color: var(--muted); }
.sketch-footer { display: flex; justify-content: space-between; gap: 10px; padding: 11px 19px 13px; color: var(--subtle); font-size: 12px; }
.sketch-footer span:first-child { display: flex; align-items: center; gap: 7px; }
.sketch-footer i { width: 12px; height: 2px; border-radius: 2px; background: var(--accent); }
.sketch-footer strong { margin-left: 4px; color: var(--text); font: 600 12px var(--mono); }
.geometry-stats, .overview-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.stat { display: flex; align-items: flex-start; gap: 12px; padding: 15px 16px; }
.stat .section-icon { flex-basis: 33px; width: 33px; height: 33px; border-color: var(--line-raised); color: #b5a289; background: var(--panel-raised); }
.stat p, .estimate-total p { margin: 0 0 5px; color: var(--muted); font-size: 12.5px; }
.stat strong, .estimate-total strong { display: block; font-size: clamp(18px, 2vw, 29px); font-weight: 720; line-height: 1.16; letter-spacing: -.04em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat small, .estimate-total small { display: block; margin-top: 5px; color: var(--subtle); font-size: 12px; }
.step-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}
.button {
  display: inline-flex;
  flex: 0 1 auto;
  justify-content: center;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  transition: color .14s, background .14s, border-color .14s;
}
.button svg { flex: 0 0 16px; width: 16px; height: 16px; }
.button-primary { padding-inline: 14px; border-color: #f4b340; color: #1b150b; background: var(--accent); font-weight: 740; }
.button-primary:hover { border-color: #ffcd75; background: #ffca6b; }
.button-secondary { border-color: var(--line-raised); background: var(--panel-raised); }
.button-secondary:hover { border-color: #717781; background: var(--hover); }
.button-quiet { color: var(--muted); }
.button-quiet:hover { color: var(--text); background: var(--panel-raised); }
.step-actions .button-quiet:first-child { margin-left: -9px; }
.button-icon { width: 39px; padding: 6px; }
.button-icon:hover { color: var(--error); }
.button-group { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.material-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.spec-list { display: grid; gap: 8px; margin: 0; padding: 0 20px 18px; }
.spec-list div { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.spec-list div:last-child { border: 0; padding-bottom: 0; }
.spec-list dt { color: var(--muted); }
.spec-list dd { margin: 0; font: 550 13px/1.5 var(--mono); text-align: right; }
.waste-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 0 20px 18px; }
.table-heading { flex-wrap: wrap; }
.table-heading > div:nth-child(2) { flex: 1; }
.table-heading > .button, .table-heading > .button-group { margin-left: auto; }
.table-toolbar { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 0 20px 12px; }
.check-field { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; cursor: pointer; }
.check-field input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.table-scroll { overflow: auto; border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); }
.table-scroll:focus-visible { outline-offset: -3px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 14px; text-align: left; vertical-align: middle; }
th:first-child, td:first-child { padding-left: 20px; }
th:last-child, td:last-child { padding-right: 20px; }
thead th { color: var(--subtle); background: #131417; font: 650 11px/1.45 var(--mono); text-transform: uppercase; letter-spacing: .025em; white-space: nowrap; }
tbody tr + tr { border-top: 1px solid var(--line); }
tbody tr:hover { background: #ffffff03; }
tbody th { font-weight: 650; }
td small, tbody th small { display: block; margin-top: 3px; color: var(--subtle); font-size: 11.5px; font-weight: 480; overflow-wrap: anywhere; }
.pricetable-empty { color: var(--muted); }
.price-table { min-width: 550px; }
.price-table .text-input { min-width: 128px; }
.price-table .input-frame { min-width: 115px; }
.price-table .input-frame, .price-table .text-input { min-height: 36px; }
.price-table .input-frame input { padding-block: 7px; font-size: 13px; }
.price-table tbody th { width: 35%; }
.price-table td:last-child { width: 22%; }
.numeric { white-space: nowrap; font: 500 12.5px/1.5 var(--mono); }
.pending { color: var(--accent); font-size: 12px; font-weight: 540; }
.notice {
  margin: 14px 0;
  padding: 12px 15px;
  border: 1px solid var(--line-raised);
  border-radius: 9px;
  color: var(--muted);
  background: var(--panel-raised);
}
.error-notice { background: #2c1d1d; color: #ffd0cf; border-color: #644145; }
.warning-notice { padding-left: 33px; color: #f6d9a4; border-color: #5b482a; background: #251f16; }
.warning-notice li + li { margin-top: 6px; }
.import-status { margin: 0 20px 12px; }
.openings-card .card-heading { border-bottom: 1px solid var(--line); }
.empty-state { display: grid; justify-items: center; gap: 7px; padding: 40px 20px; text-align: center; }
.empty-state strong { font-size: 15px; }
.empty-state p { margin: 0; color: var(--muted); }
.empty-icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 4px; border-radius: 12px; color: var(--subtle); background: var(--panel-raised); border: 1px solid var(--line-raised); }
.empty-icon svg { width: 23px; height: 23px; }
.opening-rows { display: grid; gap: 10px; }
.opening-item { padding: 15px 20px 17px; }
.opening-item + .opening-item { border-top: 1px solid var(--line); }
.opening-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.opening-heading h3 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; }
.opening-heading h3 svg { width: 17px; height: 17px; color: var(--accent); }
.opening-fields { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) repeat(3, minmax(0, .65fr)) minmax(0, .9fr); gap: 10px; }
.opening-fields .field { font-size: 12.5px; }
.opening-fields .input-unit { min-width: 24px; padding-right: 6px; }
.overview-stats { margin: 0 0 14px; }
.estimate-total { padding: 14px 16px; background: linear-gradient(140deg, #2c2318, #1a1919 72%); border-color: #4b3b25; }
.estimate-total strong { color: #ffcb71; }
.estimate-table { min-width: 680px; }
.estimate-table th[scope="row"] { max-width: 250px; }
.estimate-table td:nth-child(4) { min-width: 125px; overflow-wrap: anywhere; }
.supplier-section { margin-top: 22px; }
.supplier-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.supplier-heading h2 { font-size: 19px; }
.supplier-lists { display: grid; gap: 10px; }
.supplier-card { padding: 14px 17px; }
.supplier-card summary { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; }
.supplier-card summary::-webkit-details-marker { display: none; }
.supplier-card summary svg { width: 16px; height: 16px; color: var(--subtle); }
.supplier-card[open] summary svg { transform: rotate(90deg); }
.supplier-card summary strong { overflow-wrap: anywhere; }
.supplier-card summary span { color: var(--muted); margin-left: auto; white-space: nowrap; }
.supplier-items { display: grid; gap: 4px; margin: 9px 0 14px; padding-left: 24px; color: var(--muted); overflow-wrap: anywhere; }
.scope-note { margin: 16px 0 0; color: var(--muted); font-size: 12.5px; }

@media (max-width: 1120px) {
  .opening-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dimension-layout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 920px) {
  body { grid-template-columns: 177px minmax(0, 1fr); }
  .sidebar { padding-inline: 10px; }
  .step-nav a { gap: 7px; padding-inline: 8px; }
  .dimension-layout { grid-template-columns: 1fr; }
  .sketch-stage { min-height: 190px; }
  .building-sketch { max-height: 245px; }
  .material-layout { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  body { display: block; }
  .sidebar { position: static; height: auto; min-height: 0; gap: 12px; padding: 11px 12px 9px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-label, .sidebar-foot, .step-nav .nav-chevron { display: none; }
  .brand { padding: 0; }
  .brand-mark { width: 31px; height: 31px; border-radius: 8px; }
  .brand-mark svg { width: 19px; height: 19px; }
  .step-nav { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
  .step-nav a { justify-content: center; gap: 5px; padding: 5px; font-size: 12px; min-height: 40px; text-align: center; line-height: 1.2; }
  .step-nav a svg { flex-basis: 14px; width: 14px; height: 14px; }
  .topbar { min-height: 48px; padding-inline: 14px; }
  .button.mobile-reset { display: inline-flex; min-height: 34px; padding: 6px; }
  .workspace { padding: 0 14px 24px; }
  .page-heading { align-items: flex-start; margin: 23px 0 17px; }
  .overview-heading { flex-wrap: wrap; gap: 10px; }
  .card-heading { padding: 14px; }
  .dimension-fields { gap: 13px 10px; padding: 0 14px 16px; }
  .sketch-stage { margin-inline: 9px; }
  .stat { gap: 6px; padding: 11px 9px; }
  .stat .section-icon { display: none; }
  .stat p, .estimate-total p { font-size: 11px; }
  .stat small, .estimate-total small { font-size: 10.5px; }
  .geometry-stats, .overview-stats { gap: 6px; }
  .overview-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .estimate-total { grid-column: 1 / -1; }
  .spec-list, .waste-fields { padding-inline: 14px; }
  .table-toolbar { padding-inline: 14px; }
  .opening-item { padding-inline: 14px; }
  .opening-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 365px) {
  .step-nav a { flex-direction: column; padding-block: 6px; }
  .step-actions .button { width: 100%; }
  .step-actions .button-quiet:first-child { margin-left: 0; }
  .sketch-stage { min-height: 155px; }
  .building-sketch { min-height: 145px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
@media print {
  :root { color-scheme: light; }
  body { display: block; background: #fff; color: #141414; }
  .sidebar, .topbar, .skip-link, .step-actions, .button, .section-icon, .eyebrow, .step:not(#step-overslag) { display: none !important; }
  #step-overslag[hidden] { display: block !important; }
  .workspace { max-width: none; padding: 0; }
  .page-heading { margin: 0 0 15px; }
  .page-heading h1 { font-size: 25px; }
  .card, .notice { color: #141414; background: #fff; border-color: #aaa; }
  .card-heading { padding: 9px; }
  .table-scroll { overflow: visible; border-color: #ccc; }
  .estimate-table { min-width: 0; }
  th, td, th:first-child, td:first-child, th:last-child, td:last-child { padding: 6px; }
  thead th { white-space: normal; font-size: 9px; background: #eee; }
  .numeric { white-space: normal; font-size: 10px; }
  .estimate-table td:nth-child(4) { min-width: 0; }
  .page-heading h1 + p, .breadcrumb, .card-heading p, .stat p, th, td, .stat small, .estimate-total small, .estimate-total p, .estimate-total strong, .supplier-card summary span, .supplier-items, .pending, td small, tbody th small { color: #282828; }
  .estimate-total { background: #fff; }
  .overview-stats { margin-bottom: 10px; }
  .stat strong, .estimate-total strong { font-size: 17px; }
  .supplier-card { break-inside: avoid; }
  .supplier-card .supplier-items { display: grid !important; }
  .scope-note { color: #282828; }
  tr { break-inside: avoid; }
}
