@font-face {
  font-family: "Bahnschrift Custom";
  src:
    url("./Font/Bahnschrift.woff2") format("woff2"),
    url("./Font/Bahnschrift.woff") format("woff"),
    url("./Font/Bahnschrift.TTF") format("truetype");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --page-bg: #ffffff;
  --panel-bg: #ffffff;
  --border: rgba(22, 49, 77, 0.12);
  --text: #17314c;
  --muted: #49637e;
  --brand: #0d4d8c;
  --radius: 6px;
  --input-radius: 10px;
  --panel-shadow: 0 8px 20px rgba(23, 49, 76, 0.08);
  --input-shadow: 0 4px 12px rgba(23, 49, 76, 0.11);
  --table-line: #9fb6d1;
  --control-height: 40px;
  --body-font: "Avenir Next", Avenir, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --heading-font: "Avenir Next", Avenir, "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

[hidden] {
  display: none !important;
}

#printRoot {
  display: none;
}

body {
  margin: 0;
  padding: 24px;
  background: var(--page-bg);
  color: var(--text);
  font-family: var(--body-font);
  font-weight: 400;
}

@media print {
  body.is-printing-selection > *:not(#printRoot) {
    display: none !important;
  }

  body.is-printing-selection {
    padding: 0;
    background: #fff;
    color: #111;
  }

  #printRoot {
    display: block !important;
    padding: 24px;
    color: #111;
    font-family: Arial, sans-serif;
  }

  #printRoot .breakdown-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 24px;
  }

  #printRoot table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
  }

  #printRoot th,
  #printRoot td {
    border: 1px solid #c7d3df;
    padding: 8px;
    text-align: left;
    vertical-align: top;
    background: #fff !important;
    color: #111 !important;
  }

  #printRoot .profile-strip {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 170px;
    gap: 12px;
    overflow: visible;
    padding: 0;
  }

  #printRoot .profile-card {
    border: 1px solid #d7e0ec;
    padding: 8px;
    text-align: center;
    box-shadow: none;
  }

  #printRoot .profile-card__meta {
    text-align: center;
    font-size: 14px;
  }

  #printRoot .profile-card__stack img {
    width: 160px;
    display: block;
    margin: 0 auto;
    filter: none !important;
  }

  #printRoot .print-sheet--plain pre {
    white-space: pre-wrap;
    font: 14px/1.45 Arial, sans-serif;
    margin: 0;
  }
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select,
.icon-action,
.cart-button,
.mode-tab {
  cursor: pointer;
}

.app-shell {
  width: 100%;
  margin: 0;
}

.app-shell.app-shell--with-mode-switcher {
  padding-top: 74px;
}

.app-shell[data-mode="au-timber"] {
  --body-font: "Bahnschrift Custom", Bahnschrift, "Avenir Next", Avenir, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --heading-font: "Bahnschrift Custom", Bahnschrift, "Avenir Next", Avenir, "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  position: fixed;
  top: 12px;
  z-index: 50;
  width: fit-content;
  max-width: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 22px rgba(23, 49, 76, 0.1);
  backdrop-filter: blur(10px);
}

.page-header__brand {
  color: var(--brand);
  font-family: var(--heading-font);
  font-size: 1rem;
  font-weight: 800;
  text-transform: uppercase;
}

.page-header__modes {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mode-tab {
  min-height: 40px;
  padding: 7px 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-weight: 700;
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.mode-tab.is-active,
.mode-tab:hover {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: 0 8px 16px rgba(13, 77, 140, 0.18);
  transform: translateY(-1px);
}

@media (max-width: 640px) {
  .app-shell.app-shell--with-mode-switcher {
    padding-top: 66px;
  }

  .page-header {
    top: 8px;
    width: calc(100% - 16px);
    justify-content: center;
    padding: 8px;
  }

  .page-header__modes {
    width: 100%;
    flex-wrap: nowrap;
  }

  .mode-tab {
    flex: 1 1 0;
    justify-content: center;
    text-align: center;
    padding-inline: 10px;
  }
}

.title-block {
  padding: 8px 0 16px;
  text-align: center;
}

.title-block__eyebrow {
  color: var(--muted);
  font-size: 1.05rem;
  text-transform: uppercase;
}

.title-block h1,
.calc-panel h2,
.glossary h3 {
  margin: 0;
  font-family: var(--heading-font);
  font-weight: 700;
}

.title-block h1 {
  margin-top: 2px;
  color: var(--brand);
  font-size: clamp(2rem, 3.8vw, 3rem);
  text-transform: uppercase;
}

.top-grid,
.bottom-grid {
  display: grid;
  gap: 12px;
}

.top-grid {
  grid-template-columns: 1fr 1fr;
}

.bottom-grid {
  grid-template-columns: 2fr 1fr;
}

.calc-panel {
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-bg);
  box-shadow: var(--panel-shadow);
}

@media (min-width: 981px) {
  .calc-panel {
    padding: 18px 20px;
  }
}

.app-shell[data-mode="nz-timber"] .bottom-grid {
  grid-template-columns: 1fr;
}

.app-shell[data-mode="nz-timber"] #instructionsSection {
  display: none;
}

.timber-note {
  margin-top: 10px;
  font-size: 12px;
  color: #17314c;
}

.timber-note p {
  margin: 6px 0 0;
  line-height: 1.45;
}

.calc-panel h2 {
  margin-bottom: 10px;
  font-size: 22px;
  color: #000;
}

.form-stack,
.profile-strip {
  display: grid;
  gap: 10px;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 240px);
  gap: 12px;
  align-items: start;
}

.input-label {
  line-height: 1.2;
  color: #000;
}

.input-label em {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-style: normal;
}

.field-error {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 6px;
  color: #c03535;
  font-size: 0.9rem;
  line-height: 1.35;
}

.field-error::before {
  content: "!";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #c03535;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  flex: 0 0 18px;
  margin-top: 1px;
}

.control-stack {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.input-control {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--control-height);
  min-width: 0;
}

.input-control input,
.input-control select {
  width: 100%;
  height: var(--control-height);
  padding: 0 8px;
  border: 1px solid #b8c8dc;
  border-radius: var(--input-radius);
  background: #fff;
  color: var(--text);
  box-shadow: var(--input-shadow);
  min-width: 0;
}

.input-group {
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 1 1 0;
  filter: drop-shadow(0 4px 12px rgba(23, 49, 76, 0.11));
}

.input-group input,
.input-group select,
.input-group > span {
  box-shadow: none;
}

.input-group > span {
  height: var(--control-height);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid #b8c8dc;
  background: #f7f9fc;
  color: var(--muted);
  flex: 0 0 auto;
}

.input-group > * {
  margin-left: -1px;
}

.input-group > *:first-child {
  margin-left: 0;
  border-top-left-radius: var(--input-radius);
  border-bottom-left-radius: var(--input-radius);
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.input-group > *:last-child {
  border-top-right-radius: var(--input-radius);
  border-bottom-right-radius: var(--input-radius);
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.input-control--equation {
  gap: 8px;
}

.input-control--equation .input-group {
  min-width: 0;
  filter: none;
}

.input-control--equation .input-group input {
  width: 100%;
  min-width: 0;
  box-shadow: var(--input-shadow);
  border-radius: var(--input-radius);
}

.input-control__times {
  display: inline;
  color: var(--muted);
  font-size: inherit;
  font-weight: inherit;
  white-space: nowrap;
  padding: 0;
  margin: 0;
  min-width: 0;
  height: auto;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.input-control--equation .input-group > * {
  margin-left: 0;
}

.input-control--equation .input-group > *:first-child,
.input-control--equation .input-group > *:last-child {
  border-radius: var(--input-radius);
}

.input-control--equation .input-group > span {
  height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  margin-left: 8px;
}

.input-control select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 38px;
}

.input-control--pair input {
  flex: 1 1 0;
  width: 0;
  min-width: 72px;
}

.input-control input[type="number"] {
  min-width: 0;
}

.input-control span:not(.input-control__times),
.input-control strong {
  white-space: nowrap;
}

.input-control > span:not(.input-control__times) {
  height: var(--control-height);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid #b8c8dc;
  border-radius: 10px;
  background: #f7f9fc;
  color: var(--muted);
  box-shadow: var(--input-shadow);
  flex: 0 0 auto;
}

.input-control--pair > span:first-of-type {
  min-width: 36px;
  padding: 0 10px;
}

.input-control--pair > span:last-of-type {
  min-width: 52px;
}

.input-control strong {
  display: inline-flex;
  align-items: center;
  min-height: var(--control-height);
}

#calculatedMaxHeightRow .input-control strong {
  color: #000;
  font-weight: 700;
}

.input-control--group {
  gap: 0 !important;
  filter: drop-shadow(0 4px 12px rgba(23, 49, 76, 0.11));
}

.input-control--group input,
.input-control--group select,
.input-control--group strong,
.input-control--group > span {
  box-shadow: none;
  border-radius: 0;
}

.input-control--group > * {
  margin-left: -1px;
}

.input-control--group > *:first-child {
  margin-left: 0;
  border-top-left-radius: var(--input-radius);
  border-bottom-left-radius: var(--input-radius);
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.input-control--group > *:last-child {
  border-top-right-radius: var(--input-radius);
  border-bottom-right-radius: var(--input-radius);
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.input-control--group > span:last-child {
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
  border-top-right-radius: var(--input-radius) !important;
  border-bottom-right-radius: var(--input-radius) !important;
}

.input-control--group > *:focus {
  position: relative;
  z-index: 1;
}

.input-control--group strong {
  min-width: 0;
  width: 100%;
  height: var(--control-height);
  padding: 0 8px;
  border: 1px solid #b8c8dc;
  background: #fff;
  color: #000;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
}

#calculatedMaxHeightRow .input-control--group {
  filter: drop-shadow(0 4px 12px rgba(23, 49, 76, 0.11));
}

#deckX,
#deckY,
#tileX,
#tileY,
#claddingGap,
#tileDepth,
#minHeight,
#timberDeckDown,
#timberDeckAcross,
#deckingW,
#deckingH,
#deckingGap,
#joistW,
#joistH,
#bearerW,
#bearerH,
#soilStarts,
#maxHeight {
  cursor: pointer;
}

.input-control--select {
  position: relative;
}

.input-control--select::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 8px;
  height: 8px;
  margin-top: -6px;
  border-right: 2px solid #5d7691;
  border-bottom: 2px solid #5d7691;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
  pointer-events: none;
}

.input-control--group.input-control--select::after {
  right: 60px;
}

.input-control--select:focus-within::after {
  transform: rotate(-135deg);
  margin-top: -1px;
}

.input-control.is-invalid input,
.input-control.is-invalid select,
.input-group.is-invalid,
.input-group.is-invalid input,
.input-group.is-invalid > span {
  border-color: #c03535;
}

.input-control.is-invalid input,
.input-control.is-invalid select,
.input-group.is-invalid input {
  background: #fff7f7;
}

.input-control.is-invalid,
.input-group.is-invalid {
  filter: none;
}

.input-control.is-invalid input:focus,
.input-control.is-invalid select:focus,
.input-group.is-invalid input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(192, 53, 53, 0.16);
}

.input-control--select.is-invalid::after {
  border-right-color: #c03535;
  border-bottom-color: #c03535;
}

.toggle-row {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: flex-end;
  min-height: 40px;
  flex-wrap: wrap;
}

#membraneRow,
#bearersRow,
#nuraspikesRow {
  margin-bottom: 10px;
}

#membraneRow .toggle-row,
#bearersRow .toggle-row,
#nuraspikesRow .toggle-row {
  row-gap: 10px;
}

.toggle-row label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 40px;
  min-width: 108px;
  padding: 0 16px;
  border: 1px solid #b8c8dc;
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
  box-shadow: var(--input-shadow);
  cursor: pointer;
}

.toggle-row input[type="radio"] {
  width: 16px;
  height: 16px;
  margin: 0;
  display: block;
  flex: 0 0 auto;
  accent-color: var(--brand);
  cursor: pointer;
}

.toggle-row label:has(input:checked) {
  border-color: var(--brand);
  color: var(--brand);
  background: rgba(13, 77, 140, 0.06);
}

.preview-block img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.preview-block div {
  margin-top: 4px;
}

.input-row--preview {
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
}

.preview-control {
  display: grid;
  gap: 10px;
  min-width: 0;
}

#secondaryPanel .input-control,
#secondaryPanel .preview-block {
  min-width: 0;
}

#secondaryPanel .preview-block {
  width: 100%;
}

#secondaryPanel .preview-block img {
  object-fit: contain;
  object-position: left center;
}

.preview-block span,
.deck-plan-title span {
  float: right;
}

.profile-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 170px;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 12px 12px 14px;
  background: #fff;
  box-shadow: none;
  scrollbar-width: auto;
  scrollbar-color: rgba(61, 91, 125, 0.45) rgba(215, 224, 236, 0.75);
  scrollbar-gutter: stable both-edges;
  -webkit-overflow-scrolling: touch;
  position: relative;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0)),
    linear-gradient(to left, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0));
  background-position: left center, right center;
  background-repeat: no-repeat;
  background-size: 18px 100%, 18px 100%;
}

.profile-strip::-webkit-scrollbar {
  height: 12px;
  -webkit-appearance: none;
}

.profile-strip::-webkit-scrollbar-thumb {
  background: rgba(61, 91, 125, 0.45);
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.95);
}

.profile-strip::-webkit-scrollbar-track {
  background: rgba(215, 224, 236, 0.75);
  border-radius: 999px;
}

.profile-card {
  min-height: 290px;
  padding: 8px;
  border: 1px solid #d7e0ec;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(23, 49, 76, 0.1);
  text-align: center;
  overflow: hidden;
}

.profile-card__stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.profile-card__stack img {
  width: 120px;
  max-width: 100%;
  display: block;
}

.profile-card__stack img.profile-wide {
  width: 132px;
  max-width: 100%;
}

.profile-part--prfTile_Corner,
.profile-part--prfTile_Center,
.profile-part--prfTile_L,
.profile-part--prfTile_R {
  margin-bottom: 8px;
}

.profile-part--prfNJ_Top_Tile,
.profile-part--prfStarT {
  margin-top: 2px;
  margin-bottom: 6px;
}

.profile-part--prfNJ_Shaft {
  margin-top: 0;
  margin-bottom: 10px;
}

.profile-part--prfNJ_Base,
.profile-part--prfShim,
.profile-part--prfSTSC {
  margin-top: 0;
}

.profile-card__meta {
  margin-top: 8px;
  font-size: 0.9rem;
  text-align: center;
}

.glossary {
  margin-top: 12px;
  font-size: 0.95rem;
}

.glossary h3 {
  margin-bottom: 6px;
  font-size: 0.95rem;
}

.deck-plan-title {
  margin-bottom: 6px;
}

.plan-stage {
  display: grid;
  gap: 8px;
}

.plan-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.plan-toolbar--overlay {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 2;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 8px 20px rgba(23, 49, 76, 0.1);
  backdrop-filter: blur(4px);
}

.plan-toolbar--floating-corner {
  left: 12px;
  top: 12px;
  right: auto;
  bottom: auto;
}

.plan-toolbar--inline {
  position: static;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.plan-tool {
  min-width: 38px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--input-shadow);
  color: var(--brand);
  font-weight: 700;
}

.plan-tool--icon {
  width: 36px;
  min-width: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.plan-tool--icon svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  display: block;
}

.plan-canvas-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: 500px;
  border: 1px solid #d7e0ec;
  border-radius: 3px;
  background-color: #fff;
  background-image: radial-gradient(circle, rgba(137, 150, 167, 0.22) 1px, transparent 1px);
  background-size: 18px 18px;
  box-shadow: none;
  touch-action: none;
}

.plan-canvas-wrap:fullscreen {
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  padding: 0;
  overflow: visible;
  background-size: 18px 18px;
}

.plan-canvas-wrap.is-expanded {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  padding: 0;
  overflow: visible;
  border-radius: 0;
  z-index: 9999;
  background-size: 18px 18px;
}

.plan-edge-labels {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  pointer-events: none;
  z-index: 1;
  color: #4a5560;
  font-size: 11px;
  line-height: 1;
}

.plan-edge-labels span {
  position: absolute;
  top: var(--plan-label-top, 12px);
  transform: translateX(0);
}

#planShallowLabel {
  left: var(--plan-label-left, 12px);
}

#planDeepLabel {
  left: var(--plan-label-right, calc(100% - 12px));
  transform: translateX(-100%);
}

#deckCanvas {
  width: 100%;
  height: auto;
  display: block;
  background: transparent;
  cursor: grab;
}

.plan-canvas-wrap:fullscreen #deckCanvas {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
}

.plan-canvas-wrap.is-expanded #deckCanvas {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
}

#deckCanvas.is-dragging {
  cursor: grabbing;
}

.legend-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 8px;
  padding: 12px 14px;
  background: #d8d8d8;
  width: fit-content;
  max-width: 100%;
  border-radius: 3px;
}

.legend-row span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #4a5560;
}

.legend-row img {
  display: block;
  width: 18px;
  height: 18px;
  object-fit: contain;
  flex: 0 0 auto;
}

.legend-icon {
  position: relative;
  width: 20px;
  height: 20px;
  display: inline-block;
  border-radius: 50%;
  flex: 0 0 auto;
}

.legend-icon::before,
.legend-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border-radius: 999px;
}

.legend-icon::before {
  width: 2px;
  height: 10px;
}

.legend-icon::after {
  width: 10px;
  height: 2px;
}

.legend-icon--pad {
  background: rgba(53, 59, 66, 0.88);
}

.legend-icon--pad::before,
.legend-icon--pad::after,
.legend-icon--spike::before,
.legend-icon--spike::after {
  background: rgba(255, 255, 255, 0.95);
}

.legend-icon--jack {
  background: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 0 0 1px rgba(90, 95, 103, 0.45);
}

.legend-icon--jack::before,
.legend-icon--jack::after {
  background: rgba(58, 58, 58, 0.82);
}

.legend-icon--spike {
  background: rgba(190, 92, 92, 0.84);
}

.breakdown-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: start;
}

.table-wrap {
  min-width: 0;
}

.table-wrap + .table-wrap {
  margin-top: 12px;
}

.breakdown-grid .table-wrap + .table-wrap {
  margin-top: 0;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  border-radius: 3px;
  overflow: hidden;
}

.data-table th,
.data-table td {
  padding: 7px 8px;
  border: 1px solid var(--table-line);
  vertical-align: top;
  background: #fff;
}

.data-table th {
  text-align: left;
  background: #f5f9ff;
}

#plainTextInstructions {
  width: 100%;
  min-height: 360px;
  padding: 10px;
  border: 1px solid #b8c8dc;
  border-radius: 3px;
  resize: vertical;
  background: #fff;
  color: var(--text);
  box-shadow: none;
}

.action-row {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}

.icon-action {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  box-shadow: var(--input-shadow);
  transition: opacity 0.18s ease, transform 0.18s ease, background-color 0.18s ease, filter 0.18s ease;
}

.icon-action--icon-only {
  width: 42px;
  min-width: 42px;
  justify-content: center;
  gap: 0;
  padding: 8px;
}

.icon-action img {
  width: 18px;
  height: 18px;
  filter: brightness(0) invert(1);
}

.icon-action:disabled {
  cursor: wait;
}

.icon-action:hover:not(:disabled) {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.icon-action.is-loading {
  opacity: 0.82;
}

.icon-action.is-loading img {
  opacity: 0;
}

.icon-action.is-loading::after {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: rgba(255, 255, 255, 0.96);
  border-radius: 999px;
  animation: button-spin 0.75s linear infinite;
}

.icon-action--icon-only.is-loading::after {
  left: 50%;
  margin-left: -8px;
}

.icon-action.is-success {
  background: #2f7d4a;
}

.icon-action.is-success img {
  opacity: 0;
}

.icon-action.is-success::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 9px;
  margin-left: -8px;
  margin-top: -6px;
  border-left: 3px solid #fff;
  border-bottom: 3px solid #fff;
  transform: rotate(-45deg);
}

@keyframes button-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.cart-tools {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding: 16px;
  border: 1px solid #d7e0ec;
  border-radius: 12px;
  background: linear-gradient(180deg, #fff7ef 0%, #fff 100%);
}

.cart-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  width: 100%;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  box-shadow: var(--input-shadow);
  cursor: pointer;
  transition: transform 0.18s ease, filter 0.18s ease;
}

.cart-button:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.cart-button svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  display: block;
}

.cart-button:disabled {
  cursor: wait;
  opacity: 0.82;
}

.action-row--breakdown {
  margin-top: 14px;
}

.app-shell #breakdownSection .breakdown-grid {
  align-items: stretch;
}

.app-shell #breakdownSection .table-wrap {
  display: flex;
  flex-direction: column;
}

.app-shell #breakdownSection .is-calculation-column .action-row--breakdown {
  margin-top: 12px;
  padding-top: 0;
}

.app-shell #breakdownSection .is-calculation-column .icon-action {
  width: fit-content;
}

.app-shell #breakdownSection .is-product-column .cart-tools {
  margin-top: 12px;
}

.app-shell #breakdownSection .is-product-column .data-table {
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid #d8e5f4;
  box-shadow: 0 12px 28px rgba(13, 77, 140, 0.08);
}

.app-shell #breakdownSection .is-product-column .data-table th {
  background: linear-gradient(180deg, #edf5ff 0%, #dcecff 100%);
  color: #0f467f;
  font-size: 1rem;
}

.app-shell #breakdownSection .is-product-column .data-table td {
  border-color: #d8e5f4;
}

.app-shell #breakdownSection .is-product-column .data-table tbody tr:nth-child(odd) td {
  background: #fcfdff;
}

.app-shell #breakdownSection .is-product-column .data-table tbody tr:nth-child(even) td {
  background: #f4f8fd;
}

.app-shell #breakdownSection .is-product-column .data-table tbody tr td:first-child {
  font-weight: 600;
  color: #143a63;
}

.cart-clear {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  cursor: pointer;
  color: var(--text);
  user-select: none;
}

.cart-clear input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.cart-clear__box {
  width: 20px;
  height: 20px;
  border: 1.5px solid #b8c8dc;
  border-radius: 6px;
  background: #fff;
  box-shadow: var(--input-shadow);
  position: relative;
  flex: 0 0 auto;
  transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.cart-clear__box::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(45deg);
  opacity: 0;
}

.cart-clear__label {
  line-height: 1.2;
}

.cart-clear input:checked + .cart-clear__box {
  border-color: var(--brand);
  background: var(--brand);
  box-shadow: 0 8px 18px rgba(13, 77, 140, 0.18);
}

.cart-clear input:checked + .cart-clear__box::after {
  opacity: 1;
}

.cart-clear input:focus-visible + .cart-clear__box {
  outline: 2px solid rgba(13, 77, 140, 0.28);
  outline-offset: 2px;
}

.cart-clear input,
.cart-clear__label,
.cart-clear__box {
  cursor: pointer;
}

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

  .breakdown-grid {
    grid-template-columns: 1fr;
  }

  .input-row {
    grid-template-columns: 1fr;
  }

  .preview-block {
    padding-left: 0;
  }

  .preview-block img {
    width: 100%;
    max-width: 100%;
  }

  .action-row {
    flex-wrap: wrap;
  }

  .calc-panel,
  .table-wrap,
  .preview-control {
    min-width: 0;
    overflow: hidden;
  }

  .breakdown-grid .is-product-column {
    order: 1;
  }

  .breakdown-grid .is-calculation-column {
    order: 2;
  }

  .breakdown-grid .table-wrap + .table-wrap {
    margin-top: 12px;
  }
}

@media (max-width: 640px) {
  body {
    padding: 14px;
    padding-bottom: 24px;
  }

  body.plan-expanded-body {
    overflow: hidden;
  }

  .app-shell {
    width: 100%;
  }

  .page-header {
    flex-direction: column;
    align-items: start;
  }

  .plan-canvas-wrap {
    display: flex;
    overflow: hidden;
    min-height: 500px;
    padding-top: 0;
    touch-action: none;
  }

  .plan-toolbar--overlay {
    left: 12px;
    right: auto;
    top: 12px;
    padding: 6px 8px;
  }

  .plan-toolbar {
    justify-content: flex-end;
  }

  .plan-toolbar--inline {
    margin-top: -2px;
    margin-bottom: 10px;
  }

  .plan-toolbar--floating-corner {
    position: absolute;
    left: 12px;
    top: 12px;
    right: auto;
    bottom: auto;
    z-index: 3;
    padding: 6px 8px;
  }

  .plan-edge-labels {
    font-size: 12px;
  }

  .plan-edge-labels span {
    white-space: nowrap;
  }

  .profile-strip {
    overflow-x: auto;
    scrollbar-gutter: stable both-edges;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 16px;
    scrollbar-width: auto;
    background-size: 22px 100%, 22px 100%;
  }

  #membraneRow,
  #bearersRow,
  #nuraspikesRow {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  #membraneRow .toggle-row,
  #bearersRow .toggle-row,
  #nuraspikesRow .toggle-row {
    justify-content: flex-start;
  }

  #deckCanvas {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .legend-row {
    width: 100%;
    justify-content: space-between;
    border-radius: 10px;
  }

}

@media (max-width: 394px) {
  .legend-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px 10px;
    width: 100%;
    padding: 10px 12px;
  }

  .legend-row span {
    justify-content: center;
    gap: 6px;
    font-size: 12px;
    white-space: nowrap;
  }

  .legend-icon,
  .legend-row img {
    width: 16px;
    height: 16px;
  }
}
