:root {
  color-scheme: light;
  --ink: #111827;
  --muted: #657082;
  --line: #dbe3ef;
  --soft: #f4f8ff;
  --panel: #ffffff;
  --brand: #304cfe;
  --brand-dark: #0d0d2e;
  --accent: #1a56ff;
  --accent-dark: #1b3fd6;
  --navy: #0d0d2e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f7f9ff;
  color: var(--ink);
  font-family: "Pretendard", "Noto Sans KR", Arial, sans-serif;
  line-height: 1.5;
}

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

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
}

.estimate-page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 54px;
}

.intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.brand-heading {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-logo {
  flex: 0 0 auto;
  width: 68px;
  height: 68px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 10px 24px rgba(48, 76, 254, 0.14);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 700;
}

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

h1 {
  margin-bottom: 8px;
  font-size: clamp(30px, 4vw, 44px);
  letter-spacing: 0;
  line-height: 1.16;
}

h2 {
  margin-bottom: 16px;
  font-size: 19px;
}

.lead {
  max-width: 650px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 17px;
}

.trust-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.trust-strip span {
  border: 1px solid rgba(48, 76, 254, 0.18);
  border-radius: 999px;
  background: #ffffff;
  color: var(--navy);
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 800;
}

.intro-actions,
.button-row {
  display: flex;
  gap: 10px;
}

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

.estimate-form,
.result-panel {
  display: grid;
  gap: 16px;
}

.form-section,
.result-card,
.summary-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 22px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
}

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

label,
fieldset {
  min-width: 0;
}

label span,
legend {
  display: block;
  margin-bottom: 7px;
  color: #333333;
  font-size: 14px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid #c8d3e3;
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  padding: 10px 12px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 102, 242, 0.14);
  outline: none;
}

textarea {
  resize: vertical;
}

.inline-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: center;
  border: 1px solid #c8d3e3;
  border-radius: 6px;
  background: #ffffff;
}

.inline-input input {
  border: 0;
  box-shadow: none;
}

.inline-input span {
  margin: 0;
  color: var(--muted);
  text-align: center;
}

fieldset {
  margin: 20px 0 0;
  border: 0;
  padding: 0;
}

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

.checkbox-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
  padding: 9px 10px;
  font-size: 14px;
}

.checkbox-grid input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--brand);
}

.customer-section label:last-child {
  display: block;
  margin-top: 16px;
}

.result-panel {
  position: sticky;
  top: 18px;
}

.result-card {
  border-color: rgba(31, 102, 242, 0.55);
  background: #ffffff;
}

.result-label {
  margin-bottom: 8px;
  color: var(--accent-dark);
  font-weight: 700;
}

#estimateRange {
  display: block;
  margin-bottom: 12px;
  color: var(--brand);
  font-size: 32px;
  line-height: 1.2;
}

.result-note {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
}

.summary-list {
  margin: 0;
}

.summary-list div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #eeeeee;
  padding: 10px 0;
}

.summary-list div:first-child {
  padding-top: 0;
}

.summary-list div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.summary-list dt {
  color: var(--muted);
}

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

.primary-button,
.print-button,
.ghost-button,
.phone-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 6px;
  padding: 0 16px;
  font-weight: 700;
}

.primary-button,
.print-button,
.phone-button {
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #ffffff;
}

.primary-button:hover,
.print-button:hover,
.phone-button:hover {
  background: var(--brand-dark);
}

.ghost-button {
  border: 1px solid #c8d3e3;
  background: #ffffff;
  color: var(--ink);
}

.estimate-document {
  display: grid;
  gap: 12px;
  width: 210mm;
  min-height: 297mm;
  margin: 26px auto 0;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #ffffff;
  padding: 13mm;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
}

.document-head,
.document-total,
.document-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.document-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.document-brand p,
.document-brand strong,
.document-brand span {
  display: block;
  margin: 0;
}

.document-brand p {
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 800;
}

.document-brand strong {
  font-size: 28px;
  line-height: 1.18;
}

.document-brand span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.document-logo {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  border-radius: 10px;
  object-fit: cover;
}

.document-meta {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.document-notice {
  border: 1px solid #bad0ff;
  border-radius: 8px;
  background: #f1f6ff;
  color: #18346c;
  padding: 13px 15px;
  font-size: 13px;
  font-weight: 700;
}

.document-total {
  border-top: 2px solid var(--brand);
  border-bottom: 2px solid var(--brand);
  padding: 12px 0;
}

.document-total span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.document-total strong {
  display: block;
  color: var(--brand);
  font-size: 24px;
  line-height: 1.15;
  text-align: right;
}

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

.document-section,
.document-grid > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

.estimate-document h2 {
  margin-bottom: 8px;
  color: var(--accent-dark);
  font-size: 13px;
}

.document-list {
  display: grid;
  gap: 0;
  margin: 0;
}

.document-list div {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 10px;
  border-bottom: 1px solid #edf1f7;
  padding: 5px 0;
  font-size: 12px;
}

.document-list div:last-child {
  border-bottom: 0;
}

.document-list dt {
  color: var(--muted);
  font-weight: 700;
}

.document-list dd {
  margin: 0;
  color: var(--ink);
  font-weight: 800;
  word-break: keep-all;
}

.document-list.compact div {
  grid-template-columns: 86px minmax(0, 1fr);
}

.quote-table-wrap {
  overflow-x: auto;
}

.quote-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 11px;
}

.quote-table th,
.quote-table td {
  border: 1px solid #dce4f0;
  padding: 6px 7px;
  text-align: left;
  vertical-align: top;
  word-break: keep-all;
}

.quote-table th {
  background: #f2f6ff;
  color: var(--navy);
  font-weight: 800;
}

.quote-table th:nth-child(1),
.quote-table td:nth-child(1) {
  width: 15%;
}

.quote-table th:nth-child(2),
.quote-table td:nth-child(2) {
  width: 32%;
}

.quote-table th:nth-child(3),
.quote-table td:nth-child(3),
.quote-table th:nth-child(6),
.quote-table td:nth-child(6) {
  width: 16%;
  text-align: right;
}

.quote-table th:nth-child(4),
.quote-table td:nth-child(4),
.quote-table th:nth-child(5),
.quote-table td:nth-child(5) {
  width: 10%;
  text-align: center;
}

.document-grid-tight {
  gap: 12px;
}

.document-copy {
  margin: 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.55;
}

.document-footer {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  color: var(--muted);
  font-size: 11px;
}

.document-footer span:first-child {
  color: var(--brand);
  font-weight: 800;
}

.button-row button {
  flex: 1;
}

@media (max-width: 900px) {
  .intro {
    align-items: stretch;
    flex-direction: column;
  }

  .intro-actions {
    justify-content: flex-start;
  }

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

  .result-panel {
    position: static;
  }

  .estimate-document {
    width: 100%;
    min-height: auto;
    padding: 22px;
  }

  .document-grid,
  .document-head,
  .document-total,
  .document-footer {
    grid-template-columns: 1fr;
  }

  .document-head,
  .document-total,
  .document-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .document-meta,
  .document-total strong {
    text-align: left;
  }
}

@media (max-width: 640px) {
  .estimate-page {
    width: min(100% - 20px, 1180px);
    padding: 24px 0;
  }

  .field-grid,
  .checkbox-grid {
    grid-template-columns: 1fr;
  }

  .form-section,
  .result-card,
  .summary-list {
    padding: 18px;
  }

  .intro-actions,
  .button-row {
    flex-direction: column;
  }

  .brand-heading {
    align-items: flex-start;
  }

  .brand-logo {
    width: 58px;
    height: 58px;
  }

  .document-list div {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

@media print {
  @page {
    size: A4;
    margin: 0;
  }

  body {
    background: #ffffff;
  }

  .estimate-page {
    width: 100%;
    padding: 0;
  }

  .intro,
  .tool-grid {
    display: none;
  }

  .estimate-document {
    display: grid;
    width: 210mm;
    min-height: 297mm;
    margin: 0;
    border: 0;
    border-radius: 0;
    padding: 11mm;
    box-shadow: none;
  }

  .document-section,
  .document-grid > div,
  .document-notice {
    break-inside: avoid;
  }

  .document-total strong {
    font-size: 22px;
  }

  .quote-table {
    font-size: 10px;
  }

  .quote-table th,
  .quote-table td {
    padding: 5px;
  }
}
