:root {
  color-scheme: light;
  --ink: #10243e;
  --muted: #68788d;
  --subtle: #8d9aab;
  --line: #dfe5ec;
  --line-strong: #cbd4de;
  --surface: #ffffff;
  --surface-soft: #f6f8fa;
  --canvas: #f4f7f9;
  --navy: #102a4f;
  --navy-dark: #0b1e38;
  --navy-soft: #e9eef5;
  --orange: #f58a2a;
  --orange-dark: #d96b0b;
  --orange-soft: #fff3e7;
  --teal: #0f8792;
  --teal-soft: #e5f5f6;
  --red: #c94949;
  --red-soft: #fff0f0;
  --shadow: 0 18px 48px rgba(17, 36, 62, 0.11);
  --shadow-small: 0 7px 20px rgba(17, 36, 62, 0.1);
  --radius: 14px;
  --radius-small: 9px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
}

body {
  background: #eef2f5;
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button,
label,
select {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: relative;
  z-index: 10;
  min-height: 72px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--orange-soft);
  color: var(--orange);
}

.brand-mark svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2;
}

.brand-title,
.brand-subtitle {
  display: block;
}

.brand-title {
  font-size: 15px;
  font-weight: 760;
  letter-spacing: -0.01em;
}

.brand-subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 520;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.share-button,
.pledge-button {
  min-height: 36px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #f0d4ba;
  border-radius: 9px;
  background: var(--orange-soft);
  color: #8a480f;
  font-size: 11px;
  font-weight: 760;
  cursor: pointer;
}

.share-button:hover,
.pledge-button:hover {
  border-color: #e8b787;
  background: #ffe9d4;
}

.share-button svg,
.pledge-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.pledge-button {
  border-color: #cfe2d4;
  background: #f0f8f2;
  color: #23643b;
}

.pledge-button:hover {
  border-color: #9ec9aa;
  background: #e3f3e7;
}

.pledge-button svg {
  fill: none;
}

.save-status {
  margin-right: 8px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 620;
}

.save-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34a36f;
  box-shadow: 0 0 0 3px #e5f5ed;
}

.save-status.is-saving .save-dot {
  background: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-soft);
}

.icon-button {
  width: 36px;
  height: 36px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  cursor: pointer;
  transition: 150ms ease;
}

.icon-button:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: var(--surface-soft);
  transform: translateY(-1px);
}

.icon-button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.workspace {
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: 328px minmax(0, 1fr);
}

.controls-panel {
  position: relative;
  z-index: 2;
  padding: 23px 22px 28px;
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.control-section {
  padding: 0 0 22px;
  margin: 0 0 21px;
  border-bottom: 1px solid var(--line);
}

.compact-section {
  padding-bottom: 20px;
  margin-bottom: 20px;
}

.section-heading,
.field-label-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--orange-dark);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  color: var(--ink);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h1 {
  font-size: 19px;
}

h2 {
  font-size: 17px;
}

.text-button {
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.text-button:hover {
  color: var(--navy);
}

.catalog-tools {
  margin-top: 13px;
}

.catalog-search {
  min-height: 38px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.catalog-search:focus-within {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(245, 138, 42, 0.12);
}

.catalog-search svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--muted);
  stroke-linecap: round;
  stroke-width: 1.8;
}

.catalog-search input {
  min-width: 0;
  width: 100%;
  padding: 8px 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
}

.catalog-search input::placeholder {
  color: var(--subtle);
}

.catalog-meta {
  min-height: 15px;
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
}

.catalog-meta-row {
  min-height: 27px;
  margin: 5px 2px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.catalog-add-button {
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--orange-dark);
  font-size: 9px;
  font-weight: 760;
  white-space: nowrap;
  cursor: pointer;
}

.catalog-add-button:hover {
  color: #a94f00;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.catalog-filter-grid {
  margin-top: 7px;
  display: grid;
  grid-template-columns: 0.85fr 1fr 1.15fr;
  gap: 6px;
}

.catalog-filter-grid label > span {
  display: block;
  margin: 0 0 4px 2px;
  color: var(--subtle);
  font-size: 8px;
  font-weight: 760;
  text-transform: uppercase;
}

.catalog-filter-grid select {
  width: 100%;
  height: 31px;
  min-width: 0;
  padding: 0 6px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  cursor: pointer;
}

.fit-shortlist-summary {
  min-height: 13px;
  margin: 6px 2px 0;
  color: var(--subtle);
  font-size: 8.5px;
  font-weight: 650;
}

.fit-shortlist-summary.has-models {
  color: var(--teal);
}

.catalog-drag-tip {
  margin: 6px 0 0;
  padding: 7px 9px;
  border: 1px solid #d9e5ef;
  border-radius: 8px;
  background: #f5f9fc;
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 560;
  line-height: 1.4;
}

.catalog-drag-tip strong {
  color: var(--navy);
}

.model-options {
  margin-top: 8px;
  max-height: min(390px, 42vh);
  padding: 2px 5px 2px 2px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 9px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: #c7d0da transparent;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

.model-options::-webkit-scrollbar {
  width: 7px;
}

.model-options::-webkit-scrollbar-thumb {
  border-radius: 99px;
  background: #c7d0da;
}

.model-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.model-card:hover {
  border-color: #b9c6d3;
  box-shadow: 0 4px 13px rgba(17, 36, 62, 0.06);
}

.model-card.is-selected {
  border-color: var(--orange);
  background: #fffaf5;
  box-shadow: 0 0 0 2px rgba(245, 138, 42, 0.12);
}

.model-card[draggable="true"] {
  cursor: grab;
}

.model-card.is-dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.model-card-choice {
  position: relative;
  min-height: 72px;
  padding: 10px 11px 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.model-card-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.model-radio {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  border: 1.5px solid #acb8c5;
  border-radius: 50%;
}

.model-card.is-selected .model-radio {
  border: 5px solid var(--orange);
  background: #fff;
}

.model-card-copy {
  min-width: 0;
  flex: 1;
}

.model-name,
.model-detail,
.model-size,
.model-features {
  display: block;
}

.model-card-links {
  min-height: 27px;
  padding: 0 11px 8px 38px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
}

.model-source-link {
  color: var(--navy);
  font-size: 9px;
  font-weight: 740;
  text-decoration-color: #b4c0ce;
  text-underline-offset: 2px;
}

.model-source-link:hover {
  color: var(--orange-dark);
  text-decoration-color: currentColor;
}

.model-source-action {
  padding: 0;
  border: 0;
  background: none;
  color: var(--navy);
  font-size: 9px;
  font-weight: 740;
  text-decoration: underline;
  text-decoration-color: #b4c0ce;
  text-underline-offset: 2px;
  cursor: pointer;
}

.model-source-action:hover {
  color: var(--orange-dark);
  text-decoration-color: currentColor;
}

.model-source-action.is-danger:hover {
  color: var(--red);
}

.fit-shortlist-toggle {
  margin-left: auto;
  padding: 3px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 99px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 760;
  cursor: pointer;
}

.fit-shortlist-toggle:hover {
  border-color: #8dbfc2;
  color: var(--teal);
}

.fit-shortlist-toggle[aria-pressed="true"] {
  border-color: #8bbfc3;
  background: var(--teal-soft);
  color: #0a6d76;
}

.custom-model-badge {
  padding: 2px 6px;
  border-radius: 99px;
  background: var(--orange-soft);
  color: #9a5112;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.catalog-empty {
  margin: 10px 2px 0;
  color: var(--muted);
  font-size: 11px;
}

.model-name {
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-weight: 770;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-detail {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 610;
}

.model-size {
  margin-top: 5px;
  color: var(--subtle);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.model-features {
  margin-top: 3px;
  overflow: hidden;
  color: var(--subtle);
  font-size: 8.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-swatch {
  width: 28px;
  height: 45px;
  flex: 0 0 auto;
  border: 2px solid;
  border-radius: 3px;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.2) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.18) 1px, transparent 1px);
  background-size: 100% 8px, 7px 100%;
  box-shadow: 0 3px 8px rgba(10, 28, 50, 0.15);
}

.aptos-swatch {
  border-color: #0d505c;
  background-color: #147884;
}

.trina-swatch {
  border-color: #254777;
  background-color: #3e69a0;
}

.hyundai-swatch {
  border-color: #263f66;
  background-color: #3f5f8e;
}

.sunpro-swatch {
  border-color: #3d315e;
  background-color: #5f4e89;
}

.seg440-swatch {
  border-color: #1c4d40;
  background-color: #317060;
}

.hyperion450-swatch {
  border-color: #162b38;
  background-color: #293f50;
}

.solarever450-swatch {
  border-color: #63342f;
  background-color: #8a4f48;
}

.messi450-swatch {
  border-color: #314536;
  background-color: #4f6652;
}

.ja445-swatch {
  border-color: #1c4664;
  background-color: #2e658a;
}

.ja500-swatch {
  border-color: #0c4457;
  background-color: #17647a;
}

.hyundai410-swatch {
  border-color: #434e5a;
  background-color: #66717e;
}

.model-swatch.catalog-color-0 {
  border-color: #0d505c;
  background-color: #147884;
}

.model-swatch.catalog-color-1 {
  border-color: #254777;
  background-color: #3e69a0;
}

.model-swatch.catalog-color-2 {
  border-color: #263f66;
  background-color: #3f5f8e;
}

.model-swatch.catalog-color-3 {
  border-color: #3d315e;
  background-color: #5f4e89;
}

.model-swatch.catalog-color-4 {
  border-color: #1c4d40;
  background-color: #317060;
}

.model-swatch.catalog-color-5 {
  border-color: #162b38;
  background-color: #293f50;
}

.model-swatch.catalog-color-6 {
  border-color: #63342f;
  background-color: #8a4f48;
}

.model-swatch.catalog-color-7 {
  border-color: #314536;
  background-color: #4f6652;
}

.model-swatch.catalog-color-8 {
  border-color: #1c4664;
  background-color: #2e658a;
}

.model-swatch.catalog-color-9 {
  border-color: #5a4120;
  background-color: #826335;
}

.model-swatch.catalog-color-10 {
  border-color: #553154;
  background-color: #784d77;
}

.model-swatch.catalog-color-11 {
  border-color: #434e5a;
  background-color: #66717e;
}

.spec-sources {
  margin-top: 10px;
  padding: 10px 11px;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.spec-sources p {
  margin: 0 0 7px;
}

.spec-sources p:last-child {
  margin-bottom: 0;
}

.spec-sources div {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.spec-sources a {
  color: var(--navy);
  font-weight: 720;
  text-underline-offset: 2px;
}

.field-label {
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
}

.field-hint,
.replace-note {
  color: var(--subtle);
  font-size: 9px;
  font-weight: 600;
}

.segmented-control {
  margin-top: 10px;
  padding: 3px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
}

.segment {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 720;
  cursor: pointer;
}

.segment.is-active {
  background: var(--surface);
  color: var(--navy);
  box-shadow: 0 2px 7px rgba(17, 36, 62, 0.11);
}

.orientation-icon {
  display: inline-block;
  border: 1.5px solid currentColor;
  border-radius: 2px;
}

.portrait-icon {
  width: 8px;
  height: 13px;
}

.landscape-icon {
  width: 13px;
  height: 8px;
}

.gap-control {
  height: 39px;
  margin-top: 10px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 54px 36px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
}

.gap-control input,
.gap-control select,
.step-button {
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
}

.gap-control input {
  width: 100%;
  padding: 0 5px;
  text-align: center;
  font-size: 12px;
  font-weight: 740;
  font-variant-numeric: tabular-nums;
  appearance: textfield;
}

.gap-control input::-webkit-inner-spin-button {
  appearance: none;
}

.gap-control select {
  padding: 0 5px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.step-button {
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
}

.step-button:first-child {
  border-right: 1px solid var(--line);
}

.step-button:last-child {
  border-left: 1px solid var(--line);
}

.step-button:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

.array-builder {
  padding-bottom: 20px;
}

.fit-builder {
  padding-bottom: 20px;
}

.fit-helper {
  margin: 7px 0 0;
  color: var(--subtle);
  font-size: 9px;
  font-weight: 560;
  line-height: 1.45;
}

.array-heading {
  align-items: center;
}

.array-inputs {
  margin: 15px 0 14px;
  display: grid;
  grid-template-columns: 1fr 15px 1fr;
  align-items: end;
  gap: 7px;
}

.space-inputs {
  margin: 15px 0 11px;
  display: grid;
  grid-template-columns: 1fr 15px 1fr;
  align-items: end;
  gap: 7px;
}

.space-field > span:first-child,
.select-field > span:first-child {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 720;
}

.space-field > span:first-child {
  text-align: center;
}

.space-field input,
.select-field select {
  width: 100%;
  height: 38px;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 11px;
  font-weight: 720;
}

.space-field input {
  padding: 0 10px;
  text-align: center;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  appearance: textfield;
}

.space-field input::-webkit-inner-spin-button {
  appearance: none;
}

.space-field input[aria-invalid="true"] {
  border-color: #d74e4e;
  box-shadow: 0 0 0 2px rgba(215, 78, 78, 0.1);
}

.fit-options {
  margin-bottom: 12px;
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 8px;
}

.select-field select {
  padding: 0 9px;
  cursor: pointer;
}

.count-field > span:first-child {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 720;
  text-align: center;
}

.number-stepper {
  height: 38px;
  display: grid;
  grid-template-columns: 29px minmax(0, 1fr) 29px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}

.number-stepper button,
.number-stepper input {
  min-width: 0;
  border: 0;
  background: var(--surface);
}

.number-stepper button {
  color: var(--muted);
  cursor: pointer;
}

.number-stepper button:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

.number-stepper input {
  width: 100%;
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
  color: var(--ink);
  font-size: 12px;
  font-weight: 760;
  text-align: center;
  appearance: textfield;
}

.number-stepper input::-webkit-inner-spin-button {
  appearance: none;
}

.array-times {
  padding-bottom: 10px;
  color: var(--subtle);
  font-size: 13px;
  text-align: center;
}

.primary-button,
.secondary-button {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 790;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.primary-button {
  border: 1px solid var(--orange-dark);
  background: var(--orange);
  color: #301a07;
  box-shadow: 0 5px 14px rgba(217, 107, 11, 0.2);
}

.primary-button:hover {
  background: #fb973e;
  box-shadow: 0 7px 18px rgba(217, 107, 11, 0.27);
  transform: translateY(-1px);
}

.secondary-button {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--navy);
}

.secondary-button:hover {
  background: var(--surface-soft);
  transform: translateY(-1px);
}

.roof-outline-button {
  min-height: 38px;
  margin-top: 8px;
  font-size: 10px;
}

.boundary-status {
  min-height: 34px;
  margin-top: 9px;
  padding: 7px 8px 7px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px dashed #dca66e;
  border-radius: 8px;
  background: #fffaf4;
  color: #7f4c20;
  font-size: 9px;
  font-weight: 680;
  line-height: 1.35;
}

.boundary-status button {
  padding: 3px 5px;
  border: 0;
  background: none;
  color: var(--red);
  font-size: 9px;
  font-weight: 760;
  cursor: pointer;
}

.primary-button svg,
.secondary-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.or-divider {
  margin: 13px 0;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--subtle);
  font-size: 9px;
  font-weight: 650;
  white-space: nowrap;
}

.or-divider::before,
.or-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.fit-error {
  margin: 9px 2px 0;
  color: #b62f2f;
  font-size: 10px;
  font-weight: 650;
  line-height: 1.4;
}

.fit-result {
  margin-top: 10px;
  padding: 10px 11px;
  display: grid;
  gap: 3px;
  border: 1px solid #bcd9d5;
  border-radius: 9px;
  background: #f2faf8;
}

.fit-result strong {
  color: #123d45;
  font-size: 11px;
  line-height: 1.35;
}

.fit-result span {
  color: #547178;
  font-size: 9px;
  font-weight: 620;
  line-height: 1.4;
}

.tips-section {
  padding: 11px 12px;
  margin: 0;
  display: flex;
  gap: 10px;
  border: 0;
  border-radius: 9px;
  background: var(--navy-soft);
}

.tip-icon {
  width: 25px;
  height: 25px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--surface);
  color: var(--navy);
}

.tip-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.tips-section p {
  margin: 0;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.5;
}

.tips-section strong {
  color: var(--navy);
}

.planner {
  min-width: 0;
  min-height: 0;
  padding: 20px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  background:
    radial-gradient(circle at 93% 0%, rgba(245, 138, 42, 0.07), transparent 25%),
    #eef2f5;
}

.stats-bar {
  min-height: 96px;
  padding: 14px 18px;
  display: grid;
  grid-template-columns: minmax(112px, 0.75fr) 1px minmax(125px, 0.8fr) 1px minmax(185px, 1.25fr) 1px minmax(185px, 1.25fr);
  align-items: center;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 5px 17px rgba(17, 36, 62, 0.045);
}

.stat-item {
  min-width: 0;
}

.stat-label,
.stat-value,
.stat-secondary {
  display: block;
}

.stat-label {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 760;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.stat-value {
  overflow: hidden;
  color: var(--ink);
  font-size: clamp(17px, 1.5vw, 22px);
  font-weight: 790;
  letter-spacing: -0.035em;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.dimension-stat .stat-value {
  color: var(--navy);
}

.stat-secondary {
  margin-top: 5px;
  overflow: hidden;
  color: var(--subtle);
  font-size: 9px;
  font-weight: 570;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.stat-divider {
  width: 1px;
  height: 51px;
  background: var(--line);
}

.axis-dot {
  width: 7px;
  height: 7px;
  margin-right: 6px;
  display: inline-block;
  border-radius: 2px;
}

.horizontal-axis {
  background: var(--orange);
}

.vertical-axis {
  background: var(--teal);
}

.canvas-card {
  min-height: 520px;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.canvas-toolbar {
  min-height: 56px;
  padding: 8px 12px 8px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.canvas-title-group {
  min-width: 145px;
  margin-right: auto;
}

.canvas-kicker,
.canvas-scale {
  display: block;
}

.canvas-kicker {
  color: var(--ink);
  font-size: 11px;
  font-weight: 780;
}

.canvas-scale {
  margin-top: 2px;
  color: var(--subtle);
  font-size: 9px;
}

.selection-actions,
.view-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.selection-actions {
  min-width: 0;
  padding: 3px 5px 3px 9px;
  border: 1px solid #f2dbc6;
  border-radius: 9px;
  background: var(--orange-soft);
}

.selected-label {
  max-width: 110px;
  margin-right: 3px;
  overflow: hidden;
  color: #8d4c13;
  font-size: 9px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selection-actions button,
.toolbar-button {
  min-height: 30px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 9px;
  font-weight: 720;
  cursor: pointer;
}

.selection-actions button:hover,
.toolbar-button:hover {
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
}

.selection-actions .danger-action:hover {
  background: var(--red-soft);
  color: var(--red);
}

.selection-actions svg,
.toolbar-button svg,
.accuracy-note svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.view-actions {
  flex: 0 0 auto;
}

.toolbar-button {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.toolbar-button:hover {
  background: var(--surface-soft);
}

.zoom-buttons {
  height: 34px;
  display: flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.zoom-buttons button {
  width: 31px;
  border: 0;
  background: var(--surface);
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
}

.zoom-buttons button + button {
  border-left: 1px solid var(--line);
}

.zoom-buttons button:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

.clear-button {
  color: var(--red);
}

.canvas-wrap {
  position: relative;
  min-height: 390px;
  flex: 1;
  overflow: hidden;
  background: var(--canvas);
}

.canvas-wrap.is-catalog-drag-target::after {
  position: absolute;
  inset: 12px;
  content: "Drop panel here";
  display: grid;
  place-items: center;
  border: 2px dashed var(--orange);
  border-radius: 12px;
  background: rgba(255, 248, 239, 0.72);
  color: var(--orange-dark);
  font-size: 15px;
  font-weight: 800;
  pointer-events: none;
}

#layout-canvas {
  width: 100%;
  height: 100%;
  display: block;
  overflow: hidden;
  touch-action: none;
  user-select: none;
}

.minor-grid-line {
  stroke: #dfe5e9;
  stroke-width: 0.45;
}

.major-grid-line {
  stroke: #cbd5dc;
  stroke-width: 0.75;
}

.space-boundary {
  fill: rgba(245, 138, 42, 0.045);
  stroke: rgba(201, 93, 8, 0.72);
  stroke-width: 1.5;
  stroke-dasharray: 7 5;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.space-boundary-label-bg {
  fill: rgba(255, 250, 244, 0.97);
  stroke: rgba(201, 93, 8, 0.46);
  stroke-width: 0.8;
  vector-effect: non-scaling-stroke;
}

.space-boundary-label {
  fill: #a6530b;
  font-family: inherit;
  font-weight: 800;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}

.empty-icon-circle {
  fill: #e8edf2;
}

.empty-icon-lines {
  fill: none;
  stroke: #9cabb8;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.empty-title {
  fill: var(--ink);
  font-family: inherit;
  font-size: 14px;
  font-weight: 760;
}

.empty-copy {
  fill: var(--muted);
  font-family: inherit;
  font-size: 10px;
  font-weight: 550;
}

.panel-group {
  cursor: grab;
  outline: none;
}

.panel-group:active {
  cursor: grabbing;
}

.panel-frame {
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.panel-group.aptos .panel-frame {
  fill: #147784;
  stroke: #0c4f5a;
}

.panel-group.trina .panel-frame {
  fill: #3e69a0;
  stroke: #254777;
}

.panel-group.hyundai .panel-frame {
  fill: #3f5f8e;
  stroke: #263f66;
}

.panel-group.sunpro .panel-frame {
  fill: #5f4e89;
  stroke: #3d315e;
}

.panel-group.seg440 .panel-frame {
  fill: #317060;
  stroke: #1c4d40;
}

.panel-group.hyperion450 .panel-frame {
  fill: #293f50;
  stroke: #162b38;
}

.panel-group.solarever450 .panel-frame {
  fill: #8a4f48;
  stroke: #63342f;
}

.panel-group.messi450 .panel-frame {
  fill: #4f6652;
  stroke: #314536;
}

.panel-group.ja445 .panel-frame {
  fill: #2e658a;
  stroke: #1c4664;
}

.panel-group.ja500 .panel-frame {
  fill: #17647a;
  stroke: #0c4457;
}

.panel-group.hyundai410 .panel-frame {
  fill: #66717e;
  stroke: #434e5a;
}

.panel-group.catalog-color-0 .panel-frame {
  fill: #147784;
  stroke: #0c4f5a;
}

.panel-group.catalog-color-1 .panel-frame {
  fill: #3e69a0;
  stroke: #254777;
}

.panel-group.catalog-color-2 .panel-frame {
  fill: #3f5f8e;
  stroke: #263f66;
}

.panel-group.catalog-color-3 .panel-frame {
  fill: #5f4e89;
  stroke: #3d315e;
}

.panel-group.catalog-color-4 .panel-frame {
  fill: #317060;
  stroke: #1c4d40;
}

.panel-group.catalog-color-5 .panel-frame {
  fill: #293f50;
  stroke: #162b38;
}

.panel-group.catalog-color-6 .panel-frame {
  fill: #8a4f48;
  stroke: #63342f;
}

.panel-group.catalog-color-7 .panel-frame {
  fill: #4f6652;
  stroke: #314536;
}

.panel-group.catalog-color-8 .panel-frame {
  fill: #2e658a;
  stroke: #1c4664;
}

.panel-group.catalog-color-9 .panel-frame {
  fill: #826335;
  stroke: #5a4120;
}

.panel-group.catalog-color-10 .panel-frame {
  fill: #784d77;
  stroke: #553154;
}

.panel-group.catalog-color-11 .panel-frame {
  fill: #66717e;
  stroke: #434e5a;
}

.panel-group.is-selected .panel-frame {
  stroke: var(--orange);
  stroke-width: 3.5;
  filter: url(#panel-shadow);
}

.panel-group.has-conflict .panel-frame {
  stroke: #da4545;
  stroke-width: 3;
}

.panel-group.is-outside-boundary .panel-frame {
  stroke: #da4545;
  stroke-width: 3;
  stroke-dasharray: 7 4;
}

.panel-cell-line {
  stroke: rgba(255, 255, 255, 0.28);
  stroke-width: 0.65;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.panel-spine {
  stroke: rgba(255, 255, 255, 0.52);
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.panel-label,
.panel-wattage {
  fill: rgba(255, 255, 255, 0.96);
  font-family: inherit;
  font-weight: 780;
  text-anchor: middle;
  pointer-events: none;
  paint-order: stroke;
  stroke: rgba(9, 29, 50, 0.55);
  stroke-width: 1.8px;
  stroke-linejoin: round;
}

.panel-wattage {
  fill: rgba(255, 255, 255, 0.78);
  font-weight: 650;
  stroke-width: 1.2px;
}

.dimension-line,
.dimension-extension {
  fill: none;
  vector-effect: non-scaling-stroke;
}

.dimension-line.width-dimension,
.dimension-extension.width-dimension {
  stroke: var(--orange-dark);
}

.dimension-line.length-dimension,
.dimension-extension.length-dimension {
  stroke: var(--teal);
}

.dimension-line {
  stroke-width: 1.4;
  marker-start: url(#arrow-start);
  marker-end: url(#arrow-end);
}

.dimension-extension {
  stroke-width: 0.8;
  stroke-dasharray: 3 3;
  opacity: 0.78;
}

.dimension-arrow-head {
  fill: context-stroke;
  stroke: none;
}

.dimension-label-bg {
  fill: rgba(255, 255, 255, 0.94);
  stroke: #d7dfe6;
  stroke-width: 0.8;
  vector-effect: non-scaling-stroke;
}

.dimension-label {
  font-family: inherit;
  font-weight: 780;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

.dimension-label.width-dimension {
  fill: #b95c0a;
}

.dimension-label.length-dimension {
  fill: #0a747e;
}

.snap-guide {
  fill: none;
  stroke: var(--orange);
  stroke-width: 1.2;
  stroke-dasharray: 4 3;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.canvas-toast {
  position: absolute;
  left: 50%;
  bottom: 18px;
  max-width: calc(100% - 32px);
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(13, 31, 52, 0.92);
  color: #fff;
  box-shadow: var(--shadow-small);
  font-size: 10px;
  font-weight: 680;
  transform: translateX(-50%);
  pointer-events: none;
}

.canvas-footer {
  min-height: 42px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.canvas-footer p {
  margin: 0;
  color: var(--subtle);
  font-size: 8.5px;
  line-height: 1.4;
}

.footer-key {
  padding: 2px 4px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 8px;
  font-weight: 750;
}

.footer-dot {
  margin: 0 4px;
}

.accuracy-note {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  text-align: right;
}

.accuracy-note svg {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
}

.app-dialog {
  width: min(560px, calc(100vw - 28px));
  max-height: min(760px, calc(100dvh - 28px));
  padding: 22px;
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 75px rgba(11, 30, 56, 0.26);
}

.app-dialog::backdrop {
  background: rgba(9, 25, 45, 0.48);
  backdrop-filter: blur(2px);
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.dialog-close {
  width: 32px;
  height: 32px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 21px;
  line-height: 1;
  cursor: pointer;
}

.dialog-copy {
  margin: 12px 0 18px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.dialog-copy code {
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--surface-soft);
  color: var(--navy);
  font-size: 10px;
}

.dialog-field > span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 760;
}

.dialog-field input,
.dialog-field select {
  width: 100%;
  height: 41px;
  min-width: 0;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  font-weight: 620;
}

.dialog-field input[readonly] {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 10px;
}

.dialog-field input[aria-invalid="true"] {
  border-color: var(--red);
  box-shadow: 0 0 0 2px rgba(201, 73, 73, 0.1);
}

.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
}

.primary-dialog-actions {
  margin-top: 16px;
}

.dialog-actions .primary-button,
.dialog-actions .secondary-button {
  width: auto;
  min-width: 142px;
  padding: 0 16px;
}

.dialog-error {
  margin: 9px 0 0;
  color: #b62f2f;
  font-size: 10px;
  font-weight: 680;
  line-height: 1.45;
}

.dialog-import-row {
  margin-top: 16px;
  padding-top: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  color: var(--subtle);
  font-size: 9px;
  line-height: 1.4;
}

.pledge-lead {
  margin: 14px 0 15px;
  color: var(--navy);
  font-size: 14px;
  font-weight: 720;
  line-height: 1.45;
}

.pledge-list {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 9px;
  list-style: none;
}

.pledge-list li {
  padding-left: 19px;
  position: relative;
}

.pledge-list li::before {
  content: "✓";
  position: absolute;
  top: 0;
  left: 0;
  color: #2f8350;
  font-size: 12px;
  font-weight: 850;
}

.pledge-list strong,
.pledge-list span {
  display: block;
}

.pledge-list strong {
  color: var(--ink);
  font-size: 11px;
}

.pledge-list span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.pledge-list code {
  padding: 1px 3px;
  border-radius: 3px;
  background: var(--surface-soft);
  color: var(--navy);
  font-size: 9px;
}

.tip-card {
  margin-top: 17px;
  padding: 15px;
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 13px;
  border: 1px solid #f0d4ba;
  border-radius: 12px;
  background: linear-gradient(135deg, #fff8f1, #fffdf9);
}

.tip-spool {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--orange-soft);
  color: var(--orange);
}

.tip-spool svg {
  width: 36px;
  height: 36px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.tip-card h3 {
  margin: 1px 0 4px;
  color: var(--navy);
  font-size: 13px;
}

.tip-card p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.tip-card .tip-link {
  width: fit-content;
  min-height: 36px;
  margin-top: 11px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.tip-card .tip-pending {
  margin-top: 9px;
  color: #8a601f;
  font-weight: 650;
}

.pledge-footnote {
  margin: 13px 0 0;
  color: var(--subtle);
  font-size: 9px;
  line-height: 1.5;
}

.custom-name-fields,
.custom-spec-fields {
  display: grid;
  gap: 11px;
}

.custom-name-fields {
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
}

.custom-spec-fields {
  margin-top: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.custom-impact {
  margin: 12px 0 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--orange-soft);
  color: #8a4c17;
  font-size: 10px;
  font-weight: 650;
  line-height: 1.45;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
.model-card:has(input:focus-visible),
.panel-group:focus-visible .panel-frame {
  outline: 3px solid rgba(245, 138, 42, 0.32);
  outline-offset: 2px;
}

@media (min-width: 721px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .app-shell {
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  .workspace,
  .planner,
  .canvas-card,
  .canvas-wrap {
    min-height: 0;
  }

  .workspace,
  .planner {
    overflow: hidden;
  }
}

@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: 292px minmax(0, 1fr);
  }

  .controls-panel {
    padding-right: 18px;
    padding-left: 18px;
  }

  .planner {
    padding-right: 16px;
    padding-left: 16px;
  }

  .stats-bar {
    gap: 12px;
    padding-right: 14px;
    padding-left: 14px;
  }

  .selection-actions .selected-label {
    display: none;
  }

  .selection-actions button {
    padding: 0 6px;
  }
}

@media (max-width: 900px) {
  .stats-bar {
    grid-template-columns: 1fr 1fr;
    gap: 15px 20px;
  }

  .stat-divider {
    display: none;
  }

  .canvas-toolbar {
    flex-wrap: wrap;
  }

  .selection-actions {
    order: 3;
    width: 100%;
    justify-content: center;
  }

  .selection-actions .selected-label {
    display: inline;
  }
}

@media (max-width: 720px) {
  .topbar {
    min-height: 64px;
    padding: 0 14px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .brand-subtitle,
  .save-status {
    display: none;
  }

  .workspace {
    display: block;
  }

  .controls-panel {
    max-height: none;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .model-options {
    max-height: 430px;
  }

  .planner {
    padding: 14px 10px 18px;
  }

  .canvas-card {
    min-height: 600px;
  }

  .canvas-wrap {
    min-height: 430px;
  }

  .canvas-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .accuracy-note {
    justify-content: flex-start;
    text-align: left;
  }

  .app-dialog {
    padding: 18px;
  }

  .custom-name-fields,
  .custom-spec-fields {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 460px) {
  .stats-bar {
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    padding: 14px;
  }

  .stat-value {
    font-size: 17px;
  }

  .canvas-title-group {
    display: none;
  }

  .view-actions {
    width: 100%;
    justify-content: space-between;
  }

  .toolbar-button,
  .zoom-buttons {
    flex: 1;
    justify-content: center;
  }

  .selection-actions {
    overflow-x: auto;
    justify-content: flex-start;
  }

  .share-button,
  .pledge-button {
    width: 36px;
    padding: 0;
    justify-content: center;
  }

  .share-button span,
  .pledge-button span {
    display: none;
  }

  .dialog-actions,
  .dialog-import-row {
    align-items: stretch;
    flex-direction: column;
  }

  .dialog-actions .primary-button,
  .dialog-actions .secondary-button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
