:root {
  color-scheme: light;
  --ink: #17223f;
  --muted: #64728b;
  --line: #d7e3e7;
  --panel: #ffffff;
  --band: #f3f8f7;
  --navy: #111b49;
  --navy-soft: #18245c;
  --mint: #aee6d3;
  --mint-strong: #65c7af;
  --lime: #a5dc8a;
  --yellow: #ffdc69;
  --accent: #65c7af;
  --accent-strong: #243b7a;
  --warn: #9a6710;
  --bad: #bd3e4b;
  --good: #2c8c5b;
  --sky: #e9f7f2;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Century Gothic", "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 92% -40px, var(--lime) 0 118px, transparent 120px),
    radial-gradient(circle at 101% 120px, var(--yellow) 0 108px, transparent 110px),
    linear-gradient(180deg, #f8fbfa 0, var(--band) 100%);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 34px;
  color: #fff;
  background:
    radial-gradient(circle at 8% 0, rgba(174, 230, 211, 0.22) 0 90px, transparent 92px),
    linear-gradient(135deg, var(--navy) 0, #17235a 72%, #23317a 100%);
  border-bottom: 4px solid var(--mint);
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.file-status {
  flex-basis: 100%;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: right;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.45rem, 2vw, 2rem);
  font-weight: 500;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 14px;
  font-size: 1rem;
}

.eyebrow {
  margin-bottom: 4px;
  color: var(--mint);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tagline {
  margin: 8px 0 0;
  color: #d7fff1;
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  font-weight: 700;
}

.layout {
  display: block;
  width: min(1480px, calc(100% - 32px));
  min-height: calc(100vh - 110px);
  margin: 0 auto;
  padding: 24px 0 40px;
}

.input-panel,
.output-panel {
  padding: 0;
  min-width: 0;
}

.input-panel {
  margin-bottom: 18px;
  background: transparent;
}

.section-band,
.result-grid article {
  padding: 18px;
  margin-bottom: 18px;
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(17, 27, 73, 0.07);
}

.section-band.output {
  background: #fff;
}

.grid {
  display: grid;
  gap: 14px;
}

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

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #c1d5d9;
  border-radius: 6px;
  font: inherit;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(101, 199, 175, 0.28);
  border-color: var(--mint-strong);
}

textarea {
  resize: vertical;
  line-height: 1.35;
}

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

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

button {
  min-height: 38px;
  padding: 8px 12px;
  color: #fff;
  background: var(--navy-soft);
  border: 0;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

.toolbar {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.support-editor {
  display: grid;
  gap: 10px;
}

.geometry-table {
  min-width: 860px;
}

.geometry-table input {
  min-height: 34px;
  padding: 6px 8px;
}

.geometry-table td {
  white-space: normal;
}

.geometry-table td:first-child input {
  min-width: 70px;
}

.selected-row {
  background: #fff7d8;
}

.support-row {
  display: grid;
  grid-template-columns: 34px repeat(4, minmax(72px, 1fr)) 42px;
  align-items: end;
  gap: 8px;
  padding: 10px;
  background: var(--sky);
  border-radius: 8px;
}

.support-index {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: #fff;
  background: var(--navy-soft);
  border-radius: 50%;
  font-weight: 700;
}

.remove-point {
  min-width: 40px;
  padding: 0;
  color: var(--bad);
  background: #fff;
  border: 1px solid #e4b9b9;
}

.remove-point:hover {
  color: #fff;
  background: var(--bad);
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.report-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 18px;
  margin-bottom: 18px;
  background:
    radial-gradient(circle at 96% -30px, var(--lime) 0 64px, transparent 66px),
    linear-gradient(135deg, var(--navy) 0, #17235a 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.report-header h2 {
  margin-bottom: 6px;
  color: #fff;
  font-size: 1.35rem;
}

.report-header p {
  margin-bottom: 0;
  color: #d7fff1;
}

.brand-block {
  display: grid;
  gap: 4px;
  min-width: 190px;
  padding: 12px;
  color: var(--navy);
  background: var(--mint);
  border-radius: 8px;
  text-align: right;
}

.brand-block span {
  font-size: 0.78rem;
}

.status {
  padding: 16px 18px;
  margin-bottom: 18px;
  border-radius: 8px;
  font-weight: 800;
}

.status.acceptable {
  color: #155c3b;
  background: #e8f7ec;
}

.status.marginal {
  color: var(--warn);
  background: #fff5d7;
}

.status.outside {
  color: var(--bad);
  background: #fde8eb;
}

.status.review {
  color: #7a4b00;
  background: #ffe9cf;
}

.status.invalid {
  color: #ffffff;
  background: #b3122e;
}

.status-reasons {
  margin: -8px 0 18px;
  padding: 10px 18px 10px 34px;
  border-radius: 8px;
  background: #fff2f4;
  color: #7a1024;
  font-size: 0.85rem;
}

.status-reasons:empty {
  display: none;
}

.status-reasons li {
  margin: 3px 0;
}

/* ------------------------------------------------------------------ */
/* Sales Quotation Version                                             */
/* One colour language everywhere: green / yellow / orange / red / black */
/* ------------------------------------------------------------------ */

.sales-banner {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 26px 24px;
  border-radius: 10px;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.sales-label {
  font-size: 1.9rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  line-height: 1.1;
}

.sales-subline {
  font-size: 1.05rem;
  font-weight: 600;
  opacity: 0.92;
}

.sales-banner.sales-green { background: #1e8e4e; color: #ffffff; }
.sales-banner.sales-yellow { background: #f2c230; color: #4a3a00; }
.sales-banner.sales-orange { background: #e8842c; color: #ffffff; }
.sales-banner.sales-red { background: #c22336; color: #ffffff; }
.sales-banner.sales-black { background: #1c1f24; color: #ffffff; }

.sales-action {
  margin: -8px 0 14px;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 1.05rem;
  font-weight: 800;
  background: #eef3f9;
  border-left: 6px solid #8aa2bd;
}

.sales-action.sales-green { border-left-color: #1e8e4e; }
.sales-action.sales-yellow { border-left-color: #f2c230; }
.sales-action.sales-orange { border-left-color: #e8842c; }
.sales-action.sales-red { border-left-color: #c22336; }
.sales-action.sales-black { border-left-color: #1c1f24; }

.sales-card-band h2 {
  margin-top: 0;
}

.sales-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 20px;
  font-size: 1rem;
}

.sales-card dt {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.65;
  font-weight: 700;
}

.sales-card dd {
  margin: 2px 0 0;
  font-size: 1.12rem;
  font-weight: 800;
}

.sales-table td {
  font-size: 0.95rem;
}

.sales-chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 800;
  white-space: nowrap;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.sales-chip.sales-green { background: #e2f6e9; color: #14582f; }
.sales-chip.sales-yellow { background: #fdf3cd; color: #6b5200; }
.sales-chip.sales-orange { background: #fde9d2; color: #7c4308; }
.sales-chip.sales-red { background: #fbdfe3; color: #7c1220; }

/* Engineering values stay available but visually secondary */
.calc-details {
  margin: 18px 0;
  border: 1px solid #d7dfe8;
  border-radius: 8px;
  background: #fafbfd;
}

.calc-details > summary {
  cursor: pointer;
  padding: 12px 16px;
  font-weight: 700;
  font-size: 0.9rem;
  color: #4a5a6d;
}

.calc-details[open] > summary {
  border-bottom: 1px solid #d7dfe8;
}

.muted-eng {
  padding: 14px 16px;
  color: #55606d;
}

.muted-eng h2 {
  font-size: 0.88rem;
  color: #55606d;
}

.muted-eng table,
.muted-eng dl,
.muted-eng li,
.muted-eng p {
  font-size: 0.8rem;
  color: #55606d;
}

.muted-eng td,
.muted-eng th {
  padding: 4px 8px;
}

.sales-tool-statement {
  margin: 20px 0 6px;
  font-weight: 900;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  color: #7a1024;
}

@media print {
  .calc-details {
    page-break-before: always;
    border: none;
    background: none;
  }
  .calc-details > summary {
    font-size: 1.1rem;
    color: #000;
  }
  .sales-banner,
  .sales-chip,
  .sales-action {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
}

dl {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto;
  gap: 8px 14px;
  margin: 0;
  font-size: 0.9rem;
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
  font-weight: 700;
  text-align: right;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}

.plan-view {
  position: relative;
  min-height: 520px;
  overflow: hidden;
  background: #3d74ba;
  border: 1px solid #2c5c99;
  border-radius: 8px;
  touch-action: none;
}

.plan-view svg {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  min-height: 520px;
  cursor: crosshair;
  user-select: none;
}

.plan-view.selecting svg {
  cursor: grab;
}

.plan-view.dragging svg {
  cursor: grabbing;
}

.plan-edge {
  fill: rgba(75, 207, 194, 0.22);
  stroke: #64f2df;
  stroke-width: 0.06;
}

.plan-cable {
  fill: none;
  stroke: #a9fff4;
  stroke-dasharray: 0.16 0.12;
  stroke-width: 0.04;
}

.plan-post {
  fill: #f7ffff;
  stroke: #64f2df;
  stroke-width: 0.08;
  vector-effect: non-scaling-stroke;
}

.plan-post.selected {
  fill: #ffdd78;
  stroke: #ffffff;
}

.plan-label {
  fill: #f6fbff;
  font-size: 0.34px;
  font-weight: 700;
  paint-order: stroke;
  stroke: #08223a;
  stroke-width: 0.08;
  stroke-linejoin: round;
}

.plan-small {
  fill: #d4edf7;
  font-size: 0.25px;
  paint-order: stroke;
  stroke: #08223a;
  stroke-width: 0.06;
  stroke-linejoin: round;
}

.plan-warning {
  fill: #ffcc4d;
  stroke: #2a1f00;
  stroke-width: 0.04;
  vector-effect: non-scaling-stroke;
}

.grid-minor {
  stroke: rgba(141, 205, 230, 0.18);
  stroke-width: 0.01;
}

.grid-major {
  stroke: rgba(190, 237, 255, 0.32);
  stroke-width: 0.02;
}

.axis-line {
  stroke: rgba(255, 255, 255, 0.45);
  stroke-width: 0.03;
}

.snap-marker {
  fill: none;
  stroke: #ffdd78;
  stroke-width: 0.05;
  vector-effect: non-scaling-stroke;
}

.measurement-line,
.tracking-line {
  stroke: #ffdd78;
  stroke-width: 0.04;
  stroke-dasharray: 0.12 0.08;
  vector-effect: non-scaling-stroke;
}

.dxf-entity {
  fill: none;
  stroke: rgba(255, 255, 255, 0.58);
  stroke-width: 0.025;
  vector-effect: non-scaling-stroke;
}

.hidden {
  display: none !important;
}

/* SSPFC - Shade Sail Post & Footing Calculator. */

.brand-licence {
  margin: 4px 0 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.75;
}

.report-footer {
  margin: 18px 0 6px;
  font-size: 0.72rem;
  color: #5a6c76;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.section-cell {
  white-space: nowrap;
}

.section-stepper {
  display: inline-flex;
  gap: 2px;
  margin-left: 6px;
  vertical-align: middle;
}

.section-stepper button {
  min-height: 22px;
  padding: 0 6px;
  font-size: 0.7rem;
  line-height: 1;
  border-radius: 4px;
}

.section-name.undersized {
  color: #b00020;
  font-weight: 800;
}

/* Results flagged for engineer review (e.g. design height >= 8 m) */
.results-attention td {
  color: #b00020;
  font-weight: 600;
}

.attention-input {
  border-color: #b00020 !important;
  background: #fdecec;
}

.field-hint.attention {
  color: #b00020;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.subheading {
  margin: 16px 0 4px;
  font-size: 0.95rem;
  color: var(--navy);
}

.field-hint {
  display: block;
  margin-top: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #4a6b7a;
}

input[readonly] {
  background: #eef2f5;
  color: #46606e;
}

.lock-plan {
  min-height: 38px;
  padding: 8px 14px;
  color: #ffffff;
  background: #1f8a5d;
  border: 0;
  border-radius: 6px;
  font-size: 0.86rem;
  font-weight: 800;
  cursor: pointer;
}

.lock-plan:hover {
  background: #239c69;
}

.plan-print-image {
  display: none;
}

.import-status {
  flex-basis: 100%;
  font-size: 0.82rem;
  font-weight: 700;
  color: #14523f;
}

.import-status:empty {
  display: none;
}

.import-status.error {
  color: #9c2f2f;
}

.cad-toolbar,
.cad-import {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.cad-toolbar button,
.cad-import button {
  min-height: 34px;
}

.cad-tool.active {
  color: var(--navy);
  background: var(--mint);
  box-shadow: inset 0 0 0 2px #64f2df;
}

.cad-import {
  padding: 10px;
  background: #eef8f5;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.import-plan-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 14px;
  color: var(--navy);
  background: var(--yellow);
  border: 0;
  border-radius: 6px;
  font-size: 0.86rem;
  font-weight: 800;
  cursor: pointer;
}

.import-plan-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.import-note {
  flex-basis: 100%;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.cad-import label,
.toggle-control {
  display: flex;
  align-items: center;
  gap: 6px;
  width: auto;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.cad-import input[type="range"] {
  width: 110px;
}

.cad-import input[type="number"],
.cad-import select,
.toggle-control select {
  width: 86px;
  min-height: 34px;
}

.toggle-control input {
  width: auto;
  min-height: auto;
}

.cad-readout {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 10px;
  margin-bottom: 8px;
  color: #dff7ff;
  background: var(--navy-soft);
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 700;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
  font-size: 0.86rem;
}

th,
td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

th:first-child,
td:first-child,
th:nth-child(2),
td:nth-child(2),
th:last-child,
td:last-child {
  text-align: left;
}

ul {
  padding-left: 20px;
  margin-bottom: 0;
}

li {
  margin-bottom: 8px;
}

.disclaimer {
  padding: 14px;
  margin-bottom: 0;
  background: #fff8e8;
  border-left: 4px solid var(--warn);
  font-weight: 700;
}

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

@media (max-width: 720px) {
  .topbar,
  .report-header {
    padding: 16px;
  }

  .layout {
    width: min(100% - 20px, 1480px);
    padding-top: 14px;
  }

  .topbar,
  .report-header {
    align-items: stretch;
    flex-direction: column;
  }

  .header-actions {
    justify-content: stretch;
  }

  .header-actions button {
    flex: 1 1 90px;
  }

  .grid.two,
  .grid.three,
  .support-row {
    grid-template-columns: 1fr;
  }

  .support-index {
    width: 100%;
    border-radius: 6px;
  }
}

@media print {
  body {
    background: #fff;
  }

  .input-panel,
  .topbar,
  .toolbar {
    display: none;
  }

  .layout {
    display: block;
  }

  .output-panel {
    padding: 0;
  }

  .section-band,
  .result-grid article,
  .report-header {
    break-inside: avoid;
  }

  .report-header,
  .section-band,
  .result-grid article {
    border-color: #b8c2c6;
  }

  /* The report prints a fixed extents-fitted snapshot of the drawing, never
     the live zoomed/panned workspace. */
  .cad-toolbar,
  .cad-import,
  .cad-readout,
  .plan-view {
    display: none;
  }

  .plan-print-image[src] {
    display: block;
    width: 100%;
    border: 1px solid #b8c2c6;
    border-radius: 8px;
  }
}
