:root {
  --color-page: #f3f6fa;
  --color-surface: #ffffff;
  --color-surface-soft: #f8fafc;
  --color-text: #111827;
  --color-text-soft: #4b5b73;
  --color-text-muted: #718096;
  --color-line: #dbe3ee;
  --color-line-soft: #edf2f7;
  --color-primary: #1d4ed8;
  --color-primary-dark: #173b8f;
  --color-primary-soft: #eaf1ff;
  --color-success: #0f7a3f;
  --color-success-soft: #e9f9ef;
  --color-result: #111827;
  --radius: 8px;
  --shadow-panel: 0 10px 24px rgba(17, 24, 39, 0.05);
  --shadow-focus: 0 0 0 3px rgba(29, 78, 216, 0.14);
}

html {
  font-size: 15px;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  max-width: 100%;
}

body {
  margin: 0;
  color: var(--color-text);
  background: var(--color-page);
  font-family: "HarmonyOS Sans SC", "Microsoft YaHei", "PingFang SC", sans-serif;
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

button,
.button-link,
input,
select {
  max-width: 100%;
}

.app-container {
  width: min(1320px, calc(100% - 32px));
  max-width: 100%;
  margin: 0 auto;
  padding: 24px 0 48px;
  overflow-x: clip;
}

.quote-shell {
  display: grid;
  gap: 16px;
  min-width: 0;
  max-width: 100%;
}

.quote-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 4px 10px;
  min-width: 0;
  max-width: 100%;
}

.quote-header > div {
  min-width: 0;
}

.quote-header h1 {
  margin: 0;
  color: #0f1b31;
  font-size: clamp(26px, 2.4vw, 34px);
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: 0;
}

.quote-header p {
  max-width: 820px;
  margin: 7px 0 0;
  color: var(--color-text-soft);
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.quote-badge,
.notice {
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  background: var(--color-surface);
  padding: 11px 14px;
  color: var(--color-primary-dark);
  font-weight: 800;
  white-space: nowrap;
  overflow-wrap: anywhere;
}

.notice {
  color: var(--color-success);
  background: var(--color-success-soft);
  border-color: #c8efd6;
  white-space: normal;
}

.quote-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.32fr) minmax(340px, 0.68fr);
  gap: 16px;
  align-items: start;
  min-width: 0;
  max-width: 100%;
}

.panel {
  padding: 18px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  background: var(--color-surface);
  box-shadow: var(--shadow-panel);
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.panel h2,
.panel h3 {
  margin: 0;
  font-weight: 900;
}

.panel h2 {
  color: #0f1b31;
  font-size: 20px;
  letter-spacing: 0;
}

.panel h3 {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--color-line-soft);
  color: #17243a;
  font-size: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.form-grid label,
.template-box label {
  display: grid;
  gap: 6px;
  color: #26364f;
  font-size: 13px;
  font-weight: 800;
  min-width: 0;
}

input,
select {
  min-width: 0;
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  background: var(--color-surface);
  padding: 9px 10px;
  color: var(--color-text);
  font-weight: 700;
  line-height: 1.3;
}

input:focus,
select:focus {
  border-color: var(--color-primary);
  outline: none;
  box-shadow: var(--shadow-focus);
}

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

.cost-grid label {
  display: grid;
  grid-template-columns: 18px minmax(130px, 1fr) minmax(88px, 116px);
  align-items: center;
  gap: 8px;
  border: 1px solid var(--color-line-soft);
  border-radius: var(--radius);
  background: var(--color-surface-soft);
  padding: 8px;
  color: #2d3c55;
  font-size: 13px;
  font-weight: 800;
  min-width: 0;
}

.cost-grid input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 18px;
  accent-color: var(--color-primary);
}

.cost-grid input[type="number"] {
  min-height: 36px;
  padding: 7px 9px;
  background: var(--color-surface);
}

.actions,
.template-box {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  margin-top: 16px;
}

.template-box label {
  flex: 1 1 280px;
}

button {
  min-height: 40px;
  border: 1px solid #c8d3e2;
  border-radius: var(--radius);
  background: var(--color-surface);
  padding: 10px 14px;
  color: var(--color-text);
  font-weight: 900;
  cursor: pointer;
  line-height: 1.25;
}

button.primary,
.actions button:first-child {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: #ffffff;
}

button:hover,
.button-link:hover {
  border-color: #9eb1cc;
  background: var(--color-surface-soft);
}

button.primary:hover,
.actions button:first-child:hover,
.button-link.primary:hover {
  border-color: var(--color-primary-dark);
  background: var(--color-primary-dark);
  color: #ffffff;
}

button:focus-visible,
.button-link:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid #c8d3e2;
  border-radius: var(--radius);
  background: var(--color-surface);
  padding: 9px 12px;
  color: var(--color-text);
  font-weight: 900;
  text-decoration: none;
  line-height: 1.25;
  text-align: center;
}

.button-link:visited {
  color: #334155;
}

.button-link.primary {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: #ffffff;
}

.button-link.primary:visited {
  color: #ffffff;
}

.top-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  min-width: 0;
  max-width: 100%;
}

.auth-panel {
  width: min(460px, 100%);
  margin: 48px auto;
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  background: var(--color-surface);
  padding: 24px;
  box-shadow: var(--shadow-panel);
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form label {
  display: grid;
  gap: 7px;
  color: #26364f;
  font-size: 13px;
  font-weight: 800;
}

.small-muted {
  color: var(--color-text-muted);
  font-size: 13px;
}

.inline-inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(80px, 1fr));
  gap: 8px;
}

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

.price-card {
  display: grid;
  gap: 6px;
  margin-top: 16px;
  border: 1px solid #0b1220;
  border-radius: var(--radius);
  background: var(--color-result);
  padding: 18px;
  color: #ffffff;
}

.price-card span {
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 800;
}

.price-card strong {
  font-size: clamp(30px, 3vw, 38px);
  line-height: 1.1;
}

.price-card em {
  color: #dbe5f2;
  font-style: normal;
  font-weight: 700;
}

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

.metrics div {
  border: 1px solid var(--color-line-soft);
  border-radius: var(--radius);
  background: var(--color-surface-soft);
  padding: 10px;
}

.metrics dt {
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 800;
}

.metrics dd {
  margin: 6px 0 0;
  color: var(--color-text);
  font-weight: 900;
}

.detail-table,
.table-wrap table {
  width: 100%;
  border-collapse: collapse;
}

.detail-table th,
.detail-table td,
.table-wrap th,
.table-wrap td {
  border-bottom: 1px solid var(--color-line-soft);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

.detail-table th,
.table-wrap th {
  color: #334155;
  background: var(--color-surface-soft);
  font-weight: 900;
}

.table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.detail-table tr:last-child th,
.detail-table tr:last-child td,
.table-wrap tbody tr:last-child td {
  border-bottom: 0;
}

.formula-list {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--color-text-soft);
  line-height: 1.7;
  font-size: 13px;
}

.table-wrap {
  margin-top: 12px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--color-line-soft);
  border-radius: var(--radius);
  background: var(--color-surface);
}

.table-wrap table {
  min-width: 760px;
}

.template-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.template-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(260px, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--color-line-soft);
  border-radius: var(--radius);
  background: var(--color-surface-soft);
  padding: 10px;
}

.template-row span {
  font-weight: 900;
}

.template-row small {
  color: var(--color-text-muted);
}

@media (max-width: 980px) {
  .quote-layout,
  .form-grid,
  .cost-grid,
  .template-row {
    grid-template-columns: 1fr;
  }

  .result-panel {
    position: static;
  }

  .quote-header {
    flex-direction: column;
  }

  .top-links {
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  html {
    font-size: 14px;
  }

  .app-container {
    width: 100%;
    padding: 10px 10px 32px;
  }

  main.pb-3 {
    padding-bottom: 0 !important;
  }

  .quote-shell {
    gap: 12px;
  }

  .quote-header {
    gap: 12px;
    padding: 10px 0;
  }

  .quote-header h1 {
    font-size: 24px;
  }

  .quote-header p {
    margin-top: 6px;
    line-height: 1.55;
    max-width: 100%;
  }

  .top-links,
  .actions,
  .template-box {
    width: 100%;
  }

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

  .button-link,
  button {
    min-height: 44px;
    padding: 10px 12px;
    overflow-wrap: anywhere;
  }

  .actions > *,
  .template-box > *,
  .template-box label {
    flex: 1 1 100%;
    width: 100%;
  }

  .actions .button-link,
  .actions button,
  .template-box button {
    width: 100%;
  }

  .panel {
    padding: 14px;
    box-shadow: 0 6px 16px rgba(17, 24, 39, 0.04);
  }

  .panel h2 {
    font-size: 18px;
  }

  .panel h3 {
    margin-top: 18px;
    padding-top: 14px;
  }

  .cost-grid label {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
  }

  .cost-grid label input[type="number"] {
    grid-column: 1 / -1;
  }

  .form-grid,
  .cost-grid {
    gap: 10px;
    margin-top: 12px;
  }

  input,
  select {
    min-height: 42px;
    padding: 9px 10px;
    font-size: 16px;
  }

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

  .price-card strong {
    font-size: 28px;
    overflow-wrap: anywhere;
  }

  .detail-table th,
  .detail-table td,
  .table-wrap th,
  .table-wrap td {
    padding: 9px;
  }

  .table-wrap {
    border-radius: var(--radius);
  }

  .table-wrap::after {
    display: block;
    padding: 8px 10px;
    color: var(--color-text-muted);
    background: var(--color-surface-soft);
    content: "可左右滑动查看更多";
    font-size: 12px;
  }

  .template-row {
    padding: 10px;
  }

  .template-row form,
  .template-row button,
  .template-row .button-link {
    width: 100%;
  }

  .auth-panel {
    margin: 18px auto;
    padding: 18px;
  }

  .inline-inputs {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 380px) {
  .top-links {
    grid-template-columns: 1fr;
  }

  .quote-header h1 {
    font-size: 22px;
  }

  .price-card {
    padding: 16px;
  }
}
