:root {
  --ink: #16202b;
  --muted: #5b6b7a;
  --line: #d3dae1;
  --bg: #eceff2;
  --card: #ffffff;
  --materiaal: #2d6cdf;
  --machine: #7b5cd6;
  --stroom: #e0a12e;
  --handwerk: #17a398;
  --risico: #d94f6a;
  --marge: #16202b;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  padding: 28px 24px 36px;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1080px; margin: 0 auto; }

.masthead { margin-bottom: 26px; }
.masthead h1 {
  font-size: 30px;
  font-weight: 650;
  letter-spacing: -0.022em;
  margin: 0 0 6px;
}
.masthead p {
  margin: 0;
  max-width: 62ch;
  color: var(--muted);
  font-size: 14.5px;
}

.cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 22px;
  align-items: start;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px 20px 22px;
}
.panel + .panel { margin-top: 18px; }

.panel h2, .breakdown h2 {
  font-size: 16px;
  font-weight: 640;
  letter-spacing: -0.012em;
  margin: 0 0 3px;
}
.panel .sub, .breakdown .sub {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 13.5px;
}

.fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px 16px;
}

.field label {
  display: block;
  font-size: 13.5px;
  font-weight: 550;
  margin-bottom: 5px;
}
.inputline {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfd;
  overflow: hidden;
  transition: border-color .12s, box-shadow .12s;
}
.inputline:focus-within {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(22, 32, 43, .12);
}
.inputline .pre, .inputline .post {
  display: flex;
  align-items: center;
  padding: 0 9px;
  font-size: 13px;
  color: var(--muted);
  background: #f1f4f7;
  white-space: nowrap;
}
.inputline .pre { border-right: 1px solid var(--line); }
.inputline .post { border-left: 1px solid var(--line); }
.inputline input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  padding: 9px 10px;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.duo { display: flex; gap: 8px; }
.duo > .inputline { flex: 1; }

/* ---- help tooltips ---- */
/* Shown on hover and on focus, so a tap or the keyboard works as well as a
   mouse. The text stays reachable for screen readers via aria-describedby. */
.field-head {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 5px;
}
.field-head label { margin-bottom: 0; }

.help { position: relative; display: inline-flex; }
.help-btn {
  font: inherit;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #dfe5eb;
  color: var(--muted);
  cursor: help;
  transition: background .12s, color .12s;
}
.help-btn:hover, .help-btn:focus { background: var(--ink); color: #fff; }
.help-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.help-bubble {
  position: absolute;
  bottom: calc(100% + 8px);
  left: -8px;
  z-index: 5;
  width: max-content;
  max-width: 232px;
  padding: 8px 10px;
  border-radius: 7px;
  background: var(--ink);
  color: #fff;
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.4;
  text-align: left;
  opacity: 0;
  visibility: hidden;
  transition: opacity .12s;
}
.help-bubble::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 14px;
  border: 5px solid transparent;
  border-top-color: var(--ink);
}
.help-btn:hover + .help-bubble,
.help-btn:focus + .help-bubble {
  opacity: 1;
  visibility: visible;
}
/* ---- price panel ---- */
.price-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px 18px 18px;
  position: sticky;
  top: 16px;
}
.total { margin-bottom: 4px; }
.total .amount {
  font-size: 46px;
  font-weight: 660;
  letter-spacing: -0.035em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  display: block;
}
.total .caption {
  font-size: 13.5px;
  color: var(--muted);
  margin-top: 7px;
  display: block;
}
.rounded-tip {
  margin-top: 12px;
  padding: 9px 11px;
  border-radius: 7px;
  background: #f1f4f7;
  font-size: 13.5px;
  line-height: 1.45;
}
.rounded-tip b { font-weight: 620; font-variant-numeric: tabular-nums; }

.breakdown {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

/* ---- breakdown ---- */
.rows { margin-top: 2px; }
.row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 11px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.row:last-of-type { border-bottom: 0; }
.swatch {
  width: 11px; height: 11px;
  border-radius: 3px;
  transform: translateY(1px);
}
.row .name { font-size: 14.5px; font-weight: 550; }
.row .calc { display: block; font-size: 12.5px; color: var(--muted); font-weight: 400; }
.row .val { font-size: 14.5px; font-variant-numeric: tabular-nums; }

/* ---- filament rolls ---- */
.rolls-block { margin-bottom: 18px; }

.rolls-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.rolls-title { font-size: 13.5px; font-weight: 550; }
.rolls-total {
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.rolls-cols, .roll {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 108px 128px 26px;
  gap: 8px;
  align-items: center;
}
.rolls-cols {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}
.roll + .roll { margin-top: 8px; }

.roll-remove {
  font: inherit;
  font-size: 17px;
  line-height: 1;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background .12s, color .12s;
}
.roll-remove:hover { background: #f1f4f7; color: var(--risico); }
.roll-remove:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }

.linkbutton {
  font: inherit;
  font-size: 13px;
  font-weight: 550;
  margin-top: 10px;
  padding: 5px 10px;
  border: 1px dashed var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.linkbutton:hover { background: #f1f4f7; border-color: #b9c3cc; }
.linkbutton:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

@media (max-width: 860px) {
  body { padding: 20px 16px 30px; }
  .cols { grid-template-columns: minmax(0, 1fr); }
  .price-panel { position: static; margin-top: 18px; }
  .masthead h1 { font-size: 25px; }
  .total .amount { font-size: 40px; }
}
@media (max-width: 560px) {
  .rolls-cols { display: none; }
  .roll { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 26px; }
  .roll-cell-name { grid-column: 1 / -1; }
  .roll + .roll {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
  }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
