:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --paper: #ffffff;
  --ink: #17212b;
  --muted: #627181;
  --line: #d7dee6;
  --line-strong: #b7c2cd;
  --field: #fff8df;
  --green: #143d2b;
  --green-2: #0f5132;
  --blue: #263b50;
  --gold: #8a6a3e;
  --red: #8a261b;
  --shadow: 0 18px 42px rgba(23, 33, 43, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(20, 61, 43, 0.08), rgba(20, 61, 43, 0) 280px),
    var(--bg);
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  padding: 24px;
}

.quote-workspace {
  width: min(1280px, 100%);
  margin: 0 auto;
}

.quote-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--green);
  color: #ffffff;
  font-weight: 800;
  font-size: 17px;
}

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

h1 {
  margin-bottom: 4px;
  font-size: 28px;
  line-height: 1.08;
}

.quote-header p {
  margin-bottom: 0;
  max-width: 680px;
  color: var(--muted);
  line-height: 1.45;
}

.header-total {
  min-width: 210px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
  text-align: right;
}

.header-total span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.header-total strong {
  display: block;
  margin-top: 4px;
  font-size: 28px;
  line-height: 1;
}

.layout-grid {
  display: grid;
  grid-template-columns: minmax(420px, 0.95fr) minmax(430px, 1.05fr);
  gap: 18px;
  align-items: start;
}

.form-panel,
.result-panel,
.form-section,
.quote-card,
.line-builder,
.suggestions,
.share-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.form-panel,
.result-panel {
  overflow: hidden;
  box-shadow: var(--shadow);
}

.form-section,
.quote-card,
.line-builder,
.suggestions,
.share-panel {
  margin: 14px;
  padding: 16px;
}

.form-section:first-child,
.quote-card:first-child {
  margin-top: 14px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 12px;
}

.section-title h2 {
  margin-bottom: 0;
  font-size: 17px;
  line-height: 1.2;
}

.section-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 11px 12px;
  background: var(--field);
  color: var(--ink);
  font-size: 16px;
}

input[readonly] {
  background: #f7f9fb;
}

textarea {
  min-height: 146px;
  resize: vertical;
  line-height: 1.45;
}

.field-grid {
  display: grid;
  gap: 12px;
}

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

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

.form-section label + label,
.form-section .field-grid + label,
.form-section label + .field-grid {
  margin-top: 12px;
}

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

.primary-action,
.secondary-action,
.icon-action {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 11px 13px;
  font-weight: 800;
}

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

.secondary-action {
  background: var(--blue);
  color: #ffffff;
}

.secondary-action.full {
  width: 100%;
}

.icon-action {
  width: 42px;
  min-height: 42px;
  padding: 0;
  border: 1px solid var(--line-strong);
  background: #ffffff;
  color: var(--red);
  font-size: 17px;
}

.quote-card {
  background:
    linear-gradient(145deg, rgba(15, 81, 50, 0.06), rgba(38, 59, 80, 0.06)),
    #ffffff;
}

.quote-card-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.quote-card-head span {
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.quote-card-head strong {
  font-size: 34px;
  line-height: 1;
}

.metric-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 14px 0;
}

.metric-list div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.metric-list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric-list dd {
  margin: 4px 0 0;
  font-size: 18px;
  font-weight: 800;
}

.quote-note,
.submit-status {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.line-list {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.line-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.line-item-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 10px;
}

.line-description {
  margin: 8px 0 10px;
  color: var(--muted);
  line-height: 1.4;
}

.line-fields {
  display: grid;
  grid-template-columns: 110px 1fr 140px;
  gap: 10px;
}

.suggestion-list {
  display: grid;
  gap: 8px;
}

.suggestion-empty,
.suggestion-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfd;
}

.suggestion-row strong {
  display: block;
  margin-bottom: 3px;
}

.suggestion-row span,
.suggestion-empty {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.share-panel .secondary-action.full {
  margin-top: 10px;
}

.submit-status {
  min-height: 20px;
  margin-top: 9px;
  font-size: 13px;
}

.compliance-ok {
  color: var(--green);
}

.compliance-warning {
  color: var(--gold);
}

.compliance-stop {
  color: var(--red);
}

@media (max-width: 980px) {
  .app-shell {
    padding: 14px;
  }

  .quote-header {
    align-items: stretch;
    flex-direction: column;
  }

  .header-total {
    width: 100%;
    text-align: left;
  }

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

@media (max-width: 640px) {
  .app-shell {
    padding: 0;
  }

  .quote-workspace {
    width: 100%;
  }

  .quote-header,
  .form-panel,
  .result-panel {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    box-shadow: none;
  }

  .quote-header {
    margin-bottom: 0;
  }

  h1 {
    font-size: 24px;
  }

  .field-grid.two,
  .field-grid.three,
  .metric-list,
  .line-fields,
  .button-row {
    grid-template-columns: 1fr;
  }

  .line-item-head {
    grid-template-columns: minmax(0, 1fr) 42px;
  }
}

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

  .form-panel,
  .line-builder,
  .suggestions,
  .share-panel,
  .header-total {
    display: none;
  }

  .app-shell {
    padding: 0;
  }

  .quote-header,
  .result-panel,
  .quote-card {
    border: 0;
    box-shadow: none;
  }

  .layout-grid {
    display: block;
  }
}
