:root {
  --ice: #effcff;
  --water: #d9f6ff;
  --panel: rgba(255, 255, 255, 0.82);
  --panel-solid: #ffffff;
  --text: #102033;
  --muted: #5e7288;
  --line: rgba(70, 145, 174, 0.26);
  --line-strong: rgba(25, 127, 166, 0.42);
  --cyan: #10bde8;
  --blue: #2f73f6;
  --mint: #28d39b;
  --amber: #f7b733;
  --coral: #ff6376;
  --shadow: 0 22px 70px rgba(43, 113, 145, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  background:
    linear-gradient(120deg, rgba(16, 189, 232, 0.17) 1px, transparent 1px) 0 0 / 170px 170px,
    linear-gradient(180deg, #f8feff 0%, var(--ice) 42%, #e7f8ff 100%);
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.page-frame {
  width: min(1420px, calc(100% - 36px));
  margin: 22px auto 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.56);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.topbar {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.76);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  border-radius: 8px;
  font-weight: 1000;
  line-height: 1;
  box-shadow: 0 12px 28px rgba(16, 189, 232, 0.24);
}

.brand strong {
  display: block;
  font-size: 22px;
  color: #0a8fbd;
  line-height: 1;
}

.brand small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.status-strip {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
  color: #245a72;
  font-size: 13px;
}

.status-strip span {
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(239, 252, 255, 0.84);
}

.app-shell {
  padding: 30px 32px 36px;
}

.workbench {
  display: grid;
  gap: 18px;
}

.headline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  align-items: end;
  min-height: 140px;
}

.eyebrow {
  margin: 0 0 9px;
  color: #0a8fbd;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  color: #0b1f35;
  font-size: clamp(42px, 5vw, 70px);
  line-height: 0.98;
}

.subhead {
  width: min(760px, 100%);
  margin-top: 14px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}

.formula-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  backdrop-filter: blur(20px);
  box-shadow: 0 18px 46px rgba(66, 132, 161, 0.12);
}

.formula-card {
  min-height: 122px;
  padding: 22px;
  display: grid;
  align-content: center;
  gap: 9px;
  border-left: 5px solid var(--cyan);
}

.formula-card span,
.formula-card small {
  color: var(--muted);
}

.formula-card strong {
  font-size: 20px;
}

.calculator-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(460px, 1.1fr);
  gap: 18px;
}

.panel {
  padding: 22px;
}

.panel-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.panel-heading span {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  font-weight: 900;
}

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

.controls-panel {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
}

.field > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

select,
input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.94);
  padding: 0 13px;
  outline: none;
}

select:focus,
input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(16, 189, 232, 0.16);
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 0.54fr);
  gap: 12px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  overflow: hidden;
}

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

.segment {
  min-height: 46px;
  border: 0;
  border-right: 1px solid var(--line);
  color: var(--muted);
  background: transparent;
  font-weight: 900;
}

.segment:last-child {
  border-right: 0;
}

.segment.active {
  color: #ffffff;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
}

.quick-actions {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 12px;
  margin-top: 4px;
}

.primary-btn,
.ghost-btn {
  min-height: 48px;
  border-radius: 8px;
  font-weight: 900;
}

.primary-btn {
  color: #ffffff;
  border: 1px solid var(--mint);
  background: linear-gradient(135deg, var(--mint), #0cb8ba);
  box-shadow: 0 14px 34px rgba(40, 211, 155, 0.22);
}

.ghost-btn {
  color: var(--text);
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.78);
}

.results-panel {
  display: grid;
  gap: 18px;
}

.result-hero {
  min-height: 178px;
  display: grid;
  align-content: center;
  padding: 24px;
  border: 1px solid rgba(16, 189, 232, 0.38);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(16, 189, 232, 0.18), rgba(40, 211, 155, 0.16)),
    rgba(255, 255, 255, 0.78);
}

.result-hero span {
  color: #048ab8;
  font-weight: 900;
}

.result-hero strong {
  margin-top: 8px;
  color: #071a2d;
  font-size: clamp(44px, 6vw, 78px);
  line-height: 1;
}

.result-hero small {
  margin-top: 12px;
  color: var(--muted);
  font-size: 18px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.metric {
  min-height: 100px;
  display: grid;
  align-content: center;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
}

.metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.metric strong {
  color: var(--text);
  font-size: 23px;
}

.quote-box {
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--mint);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
}

.quote-box span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.quote-box p {
  min-height: 54px;
  color: var(--text);
  line-height: 1.65;
}

.tier-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.tier-card {
  min-height: 128px;
  display: grid;
  gap: 9px;
  padding: 17px;
  color: var(--text);
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
}

.tier-card.active {
  border-color: var(--cyan);
  box-shadow: inset 0 0 0 2px rgba(16, 189, 232, 0.2);
}

.tier-card span {
  color: var(--muted);
  font-weight: 800;
}

.tier-card strong {
  font-size: 30px;
}

.tier-card small {
  color: var(--muted);
  line-height: 1.5;
}

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

table {
  width: 100%;
  min-width: 960px;
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  padding: 15px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  color: #0f4e69;
  background: rgba(218, 246, 255, 0.78);
  font-size: 13px;
}

td {
  color: var(--muted);
}

td strong {
  color: var(--text);
}

.rate-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  color: #ffffff;
  background: var(--cyan);
  font-weight: 900;
}

.rate-pill.b {
  background: var(--blue);
}

.rate-pill.agent {
  background: var(--mint);
}

.rate-pill.custom {
  color: var(--text);
  background: #dbeaf3;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  padding: 12px 16px;
  border-radius: 8px;
  color: #ffffff;
  background: #0a8fbd;
  font-weight: 900;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1080px) {
  .page-frame {
    width: min(100% - 24px, 980px);
  }

  .headline,
  .calculator-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 720px) {
  .page-frame {
    width: 100%;
    margin: 0;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }

  .topbar {
    height: auto;
    min-height: 76px;
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    padding: 18px;
  }

  .status-strip {
    width: 100%;
    justify-content: flex-start;
  }

  .app-shell {
    padding: 22px 16px 28px;
  }

  h1 {
    font-size: 42px;
  }

  .subhead {
    font-size: 16px;
  }

  .panel {
    padding: 17px;
  }

  .input-row,
  .quick-actions,
  .tier-cards,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .segmented,
  .segmented.two {
    grid-template-columns: 1fr;
  }

  .segment {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .segment:last-child {
    border-bottom: 0;
  }

  .result-hero strong {
    font-size: 48px;
  }
}
