:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-muted: #eef3f1;
  --text: #18201f;
  --muted: #5e6b68;
  --line: #d9e1de;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --accent-soft: #dff3ef;
  --blue: #2869a8;
  --amber: #aa6b14;
  --danger: #a33d3d;
  --shadow: 0 18px 45px rgba(23, 38, 36, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px;
  background: #15211f;
  color: #f5fbf8;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 8px;
  background: #dff3ef;
  color: #102320;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: #a8bab5;
}

.module-nav {
  display: grid;
  gap: 8px;
}

.nav-item,
.primary-action,
.secondary-action,
.back-button {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-item {
  width: 100%;
  padding: 0 14px;
  background: transparent;
  color: #cddbd7;
  text-align: left;
}

.nav-item:hover,
.nav-item:focus-visible,
.nav-item.is-active {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.source-card {
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
}

.source-label {
  display: block;
  margin-bottom: 6px;
  color: #a8bab5;
  font-size: 0.82rem;
}

.source-card strong {
  line-height: 1.3;
}

.content {
  width: min(1180px, 100%);
  padding: 40px;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.page-header {
  max-width: 760px;
  margin-bottom: 28px;
}

.eyebrow,
.module-kicker {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 12px;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.04;
}

h2 {
  margin-bottom: 10px;
  font-size: 1.2rem;
  line-height: 1.2;
}

p {
  color: var(--muted);
  line-height: 1.58;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.module-card {
  display: grid;
  grid-template-rows: 104px 1fr auto;
  gap: 18px;
  min-height: 340px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.module-card-active {
  border-color: #9acbc3;
}

.module-visual {
  display: grid;
  gap: 8px;
  min-height: 104px;
  padding: 14px;
  border-radius: 8px;
  background: var(--surface-muted);
  overflow: hidden;
}

.module-visual span {
  display: block;
  border-radius: 6px;
}

.module-visual-data {
  grid-template-columns: 1fr 1.6fr;
  grid-template-rows: repeat(2, 1fr);
}

.module-visual-data span:nth-child(1) {
  grid-row: span 2;
  background: #0f766e;
}

.module-visual-data span:nth-child(2) {
  background: #2869a8;
}

.module-visual-data span:nth-child(3) {
  background: #d69e2e;
}

.module-visual-planned {
  grid-template-columns: 1fr 1fr;
}

.module-visual-planned span:nth-child(1) {
  background: #dce7ef;
}

.module-visual-planned span:nth-child(2) {
  background: #f0dfc1;
}

.module-visual-drive {
  grid-template-columns: 1.3fr 1fr;
  grid-template-rows: 1fr 1fr;
}

.module-visual-drive span:nth-child(1) {
  grid-row: span 2;
  background: #2869a8;
}

.module-visual-drive span:nth-child(2) {
  background: #0f766e;
}

.module-visual-drive span:nth-child(3) {
  background: #aa6b14;
}

.module-visual-empty {
  grid-template-columns: repeat(2, 1fr);
}

.module-visual-empty span {
  background: #e3e6e4;
}

.module-visual-offer {
  grid-template-columns: 1fr 1fr 1fr;
  align-items: end;
}

.module-visual-offer span:nth-child(1) {
  height: 78%;
  background: #0f766e;
}

.module-visual-offer span:nth-child(2) {
  height: 58%;
  background: #aa6b14;
}

.module-visual-offer span:nth-child(3) {
  height: 92%;
  background: #2869a8;
}

.primary-action,
.secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 112px;
  padding: 0 18px;
  font-weight: 700;
}

.primary-action {
  background: var(--accent);
  color: #ffffff;
}

.primary-action:hover,
.primary-action:focus-visible {
  background: var(--accent-strong);
}

.secondary-action {
  border-color: var(--line);
  background: #ffffff;
  color: var(--text);
}

.secondary-action:hover,
.secondary-action:focus-visible {
  border-color: #acc2bc;
  background: var(--surface-muted);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.module-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.back-button {
  display: inline-grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-color: var(--line);
  background: #ffffff;
  color: var(--text);
  font-size: 1.25rem;
}

.back-button:hover,
.back-button:focus-visible {
  background: var(--surface-muted);
}

.module-header h1 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(160px, 220px) auto auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.toolbar-drive-config {
  grid-template-columns: minmax(260px, 1fr) minmax(220px, 0.9fr) minmax(160px, 220px) auto;
}

.toolbar-drive-create {
  grid-template-columns: minmax(260px, 1fr) auto auto;
}

.field,
.filter-field {
  display: grid;
  gap: 6px;
}

.field span,
.filter-field span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
}

input:focus,
select:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(15, 118, 110, 0.16);
}

.connection-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 76px;
  margin-bottom: 14px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.connection-actions,
.table-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.inline-action {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font-weight: 700;
}

.inline-action:hover,
.inline-action:focus-visible {
  border-color: #acc2bc;
  background: var(--surface-muted);
}

.file-type {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  background: #eef3f1;
  color: #344641;
  font-size: 0.82rem;
  font-weight: 700;
}

.notice {
  min-height: 44px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid #cde0dc;
  border-radius: 8px;
  background: var(--accent-soft);
  color: #19433d;
  line-height: 1.35;
}

.notice.is-error {
  border-color: #efc3c3;
  background: #fff0f0;
  color: var(--danger);
}

.table-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table-tools {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  min-height: 76px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.filter-field {
  width: min(360px, 100%);
}

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

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

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8faf9;
  color: #364541;
  font-size: 0.82rem;
  text-transform: uppercase;
}

tbody tr:hover {
  background: #fbf6ed;
}

.empty-table-cell {
  color: var(--muted);
  text-align: center;
}

.empty-state {
  max-width: 620px;
  padding: 28px;
  border: 1px dashed #b9c7c3;
  border-radius: 8px;
  background: #ffffff;
}

.empty-state h2 {
  margin-bottom: 8px;
}

.offer-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

.offer-main,
.offer-summary {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.offer-main {
  overflow: hidden;
}

.wizard-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
  background: #f8faf9;
}

.wizard-tab {
  min-height: 52px;
  padding: 0 10px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.wizard-tab:last-child {
  border-right: 0;
}

.wizard-tab:hover,
.wizard-tab:focus-visible,
.wizard-tab.is-active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.offer-form {
  padding: 20px;
}

.wizard-panel {
  display: none;
}

.wizard-panel.is-active {
  display: block;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-heading h2 {
  margin: 0;
}

.computed-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  background: #eef3f1;
  color: #344641;
  font-size: 0.86rem;
  font-weight: 800;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.logistics-grid {
  margin-top: 18px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.choice-tile {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 10px;
  min-height: 76px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.choice-tile:hover {
  border-color: #acc2bc;
  background: #f8faf9;
}

.choice-tile input {
  width: 18px;
  min-height: 18px;
  margin-top: 3px;
}

.choice-tile strong,
.choice-tile small {
  display: block;
}

.choice-tile small {
  color: var(--muted);
  line-height: 1.45;
}

.wizard-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  background: #f8faf9;
}

.offer-summary {
  position: sticky;
  top: 20px;
  display: grid;
  gap: 18px;
  padding: 18px;
}

.summary-block strong {
  display: block;
  margin: 6px 0;
  font-size: 2rem;
  line-height: 1;
}

.summary-block small {
  color: var(--muted);
  font-weight: 700;
}

.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.summary-grid div {
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
}

.summary-grid span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.summary-grid strong {
  font-size: 1.05rem;
}

.stove-preview {
  display: grid;
  gap: 14px;
  min-height: 300px;
}

.stove-canvas {
  display: block;
  width: 100%;
  height: 245px;
  min-height: 245px;
  border-radius: 8px;
  background: #edf3f0;
  touch-action: none;
}

.dimension-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

.visual-status {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.offer-alerts {
  display: grid;
  gap: 8px;
}

.offer-alert {
  padding: 10px 12px;
  border: 1px solid #efdcaf;
  border-radius: 8px;
  background: #fff8e8;
  color: #60430d;
  font-size: 0.9rem;
  line-height: 1.4;
}

.cost-split {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.cost-bar {
  display: flex;
  height: 18px;
  overflow: hidden;
  border-radius: 8px;
  background: #eef3f1;
}

.cost-bar span:first-child {
  background: var(--blue);
}

.cost-bar span:last-child {
  background: var(--amber);
}

.cost-legend {
  display: flex;
  gap: 16px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border-radius: 50%;
}

.legend-material {
  background: var(--blue);
}

.legend-labor {
  background: var(--amber);
}

.compact-tables {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.compact-tables h3,
.document-preview h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.line-list,
.payment-list {
  display: grid;
  gap: 8px;
}

.line-item,
.payment-item {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.line-item strong,
.payment-item strong {
  font-size: 0.94rem;
}

.line-meta,
.payment-meta {
  color: var(--muted);
  font-size: 0.86rem;
}

.document-preview {
  margin-bottom: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
}

@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .side-panel {
    position: sticky;
    top: 0;
    z-index: 5;
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 16px;
  }

  .module-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .nav-item {
    min-height: 40px;
    padding: 0 8px;
    text-align: center;
  }

  .source-card {
    display: none;
  }

  .content {
    padding: 24px 16px 36px;
  }

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

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

  .toolbar-drive-config,
  .toolbar-drive-create {
    grid-template-columns: 1fr 1fr;
  }

  .offer-layout,
  .compact-tables {
    grid-template-columns: 1fr;
  }

  .offer-summary {
    position: static;
  }

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

@media (max-width: 620px) {
  .module-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .toolbar-drive-config,
  .toolbar-drive-create {
    grid-template-columns: 1fr;
  }

  .connection-bar {
    display: grid;
  }

  .wizard-tabs,
  .form-grid,
  .logistics-grid,
  .choice-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .table-tools {
    display: grid;
    align-items: stretch;
  }

  h1 {
    font-size: 2.1rem;
  }
}
