﻿:root {
  --bg: #e9f0f7;
  --surface: #f3f7fa;
  --text: #2d3436;
  --muted: #5b6677;
  --line: #f0f4fb;
  --primary: #006d77;
  --primary-strong: #006d77;
  --good: #ff6f61;
  --bad: #ff6f61;
  --warn: #ff6f61;
  --shadow: 0 10px 28px rgba(24, 39, 75, 0.08);
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Inter", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.4;
  position: relative;
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    url("boxfit-pixels-top-right.svg"),
    url("boxfit-pixels-bottom-left.svg");
  background-position:
    top right,
    bottom left;
  background-repeat: no-repeat, no-repeat;
  background-size:
    clamp(140px, 24vw, 360px) auto,
    clamp(140px, 24vw, 360px) auto;
  background-attachment: fixed, fixed;
  opacity: 0.25;
  pointer-events: none;
  z-index: 0;
}

body > * {
  position: relative;
  z-index: 1;
}

.container {
  width: min(1100px, 92vw);
  margin: 0 auto;
}

.site-header,
.site-footer {
  background: transparent;
  border-bottom: 1px solid var(--line);
}

.site-header {
  padding: 1.5rem 0 1rem;
}

.site-header .container {
  text-align: center;
}

.site-header h1 {
  margin: 0;
  font-size: clamp(1.6rem, 2.1vw, 2.1rem);
  color: var(--text);
  font-family: "Space Grotesk", "Inter", sans-serif;
}

.site-header p {
  margin: 0.35rem 0 0;
  color: var(--text);
}

.brand-logo-icon {
  width: 100%;
  max-width: 10vw;
  height: auto;
  display: block;
  margin: 0 auto 0.45rem;
}

.site-footer {
  margin-top: 1.2rem;
  padding: 0.8rem 0;
  border-top: 1px solid var(--line);
  border-bottom: none;
}

.site-footer p {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.footer-line + .footer-line {
  margin-top: 0.2rem;
}

.site-footer .container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.footer-link {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 600;
}

.footer-link:hover,
.footer-link:focus {
  color: #005962;
}

main {
  padding: 1rem 0 1.4rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.9rem;
  box-shadow: var(--shadow);
}

h2,
h3 {
  margin-top: 0;
  color: var(--primary);
  font-family: "Space Grotesk", "Inter", sans-serif;
}

h2 {
  font-size: 1.15rem;
  margin-bottom: 0.8rem;
}

h3 {
  font-size: 1rem;
  margin: 1rem 0 0.6rem;
}

label,
legend {
  font-weight: 600;
  font-size: 0.94rem;
}

.section-help {
  margin: 0 0 0.65rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.field-help {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.7rem 0.9rem;
  margin: 0;
}

fieldset label {
  margin-right: 1rem;
  font-weight: 500;
}

input,
select,
button {
  font: inherit;
  font-family: "Inter", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

input[type="number"],
select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 0;
  padding: 0.5rem 0.55rem;
}

input[type="radio"] {
  width: auto;
  margin: 0;
}

input:focus,
select:focus,
button:focus {
  outline: 2px solid #9fc4df;
  outline-offset: 1px;
}

input.invalid,
select.invalid {
  border-color: var(--bad);
  background: #fff5f4;
}

.grid {
  display: grid;
  gap: 0.8rem;
}

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

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

.inline-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.panel-subgrid {
  margin-top: 0.85rem;
}

.units-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.units-title {
  font-weight: 700;
}

.unit-option {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 500;
}

.measure-input {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.measure-number {
  width: 9ch;
}

.measure-select {
  width: 18ch;
  min-width: 18ch;
}

.item-qty {
  width: 7ch;
}

.unit-suffix {
  color: var(--muted);
  font-weight: 600;
}

.mode-tabs {
  display: flex;
  gap: 0.5rem;
}

.tab {
  border: 1px solid var(--primary);
  background: #fff;
  border-radius: 0;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  color: var(--primary);
  font-family: "Space Grotesk", "Inter", sans-serif;
}

.tab.active {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.table-wrap {
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: 0;
}

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

.container-table th,
.container-table td {
  white-space: nowrap;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 0;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 0.5rem;
  text-align: left;
  vertical-align: top;
}

thead th {
  background: transparent;
  color: var(--text);
  font-size: 0.9rem;
  font-family: "Space Grotesk", "Inter", sans-serif;
}

tbody tr:last-child td {
  border-bottom: none;
}

.actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn {
  border: 1px solid transparent;
  border-radius: 0;
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  min-height: 2.4rem;
}

.btn.primary {
  color: #fff;
  background: var(--primary);
}

.btn.secondary {
  background: #fff;
  border-color: var(--primary);
  color: var(--primary);
}

.btn.ghost {
  background: #fff;
  border-color: #c9d3e2;
  color: #334861;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.remove-btn {
  background: #ff6f61;
  border-color: var(--bad);
  color: #fff;
}

.add-row-btn {
  margin-top: 0.65rem;
}

.footer-app-logo {
  margin-top: 0.55rem;
  width: clamp(120px, 24vw, 210px);
  max-width: 100%;
  height: auto;
  display: block;
}

@media (min-width: 980px) {
  .footer-app-logo {
    width: clamp(150px, 16vw, 250px);
  }
}

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

.errors {
  margin-top: 0.8rem;
  color: var(--bad);
}

.errors ul {
  margin: 0;
  padding-left: 1.1rem;
}

.result-summary {
  border: 1px solid var(--bad);
  border-radius: var(--radius);
  background: #fff2f1;
  padding: 0.8rem;
}

.result-summary.pass,
.result-summary.fail,
.result-summary.warn {
  border-color: var(--bad);
  background: #fff2f1;
}

.result-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
  margin-top: 0.8rem;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  padding: 0.5rem;
}

.metric .label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
}

.metric .value {
  font-size: 1rem;
  font-weight: 700;
}

.ad-slot {
  border: 2px dashed var(--line);
  border-radius: 0;
  background: #fff;
  color: #3d5872;
  text-align: center;
  padding: 0.85rem;
  margin: 0;
}

.ad-panel {
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

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

.viz-col {
  min-width: 0;
}

#layoutCanvas {
  width: 100%;
  height: auto;
  margin-top: 0.6rem;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
}

#layout3dCanvas {
  width: 100%;
  height: auto;
  margin-top: 0.6rem;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  cursor: grab;
}

#layout3dCanvas:active {
  cursor: grabbing;
}

.viz-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  margin-top: 0.8rem;
}

.viz-controls input[type="range"] {
  width: 100%;
}

.toggle-row {
  margin-top: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 500;
}

.legend {
  margin: 0.8rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.35rem;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.swatch {
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 0;
  border: 1px solid rgba(0, 0, 0, 0.22);
  flex: 0 0 auto;
}

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

.hidden {
  display: none;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 36, 43, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 30;
}

.modal-overlay.hidden {
  display: none;
}

.modal-card {
  width: min(980px, 96vw);
  height: min(86vh, 820px);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 0.65rem 0.8rem;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.modal-close {
  border: 1px solid var(--primary);
  background: #fff;
  color: var(--primary);
  border-radius: 0;
  padding: 0.35rem 0.55rem;
  min-height: 2rem;
  cursor: pointer;
}

.privacy-frame {
  width: 100%;
  flex: 1 1 auto;
  border: 0;
  background: #fff;
}

@media (max-width: 900px) {
  .table-wrap table,
  .table-wrap thead,
  .table-wrap tbody,
  .table-wrap tr,
  .table-wrap th,
  .table-wrap td {
    display: block;
    width: 100%;
  }

  .table-wrap thead {
    display: none;
  }

  .table-wrap tr {
    border-bottom: 1px solid var(--line);
    padding: 0.55rem 0.7rem;
  }

  .table-wrap tr:last-child {
    border-bottom: none;
  }

  .table-wrap td {
    border-bottom: none;
    padding: 0.35rem 0;
    display: grid;
    grid-template-columns: minmax(8.5rem, 45%) 1fr;
    gap: 0.55rem;
    align-items: center;
    white-space: normal;
  }

  .table-wrap td::before {
    content: attr(data-label);
    color: var(--text);
    font-weight: 600;
  }

  .table-wrap td[data-label="Action"] {
    display: flex;
    align-items: center;
    gap: 0.55rem;
  }

  .table-wrap td[data-label="Action"]::before {
    flex: 0 0 auto;
  }

  .grid.two,
  .grid.three,
  .result-metrics,
  .viz-controls,
  .viz-grid {
    grid-template-columns: 1fr;
  }

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


