/*
  Retirement bridge calculator styles.
  Upstream: index.html. Downstream: browser-rendered static page.
*/

:root {
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-muted: #edf4f2;
  --text: #172321;
  --muted: #63706d;
  --line: #d9e2df;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --green: #15803d;
  --amber: #b7791f;
  --red: #b42318;
  --shadow: 0 20px 50px rgba(21, 38, 35, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

button,
input {
  font: inherit;
}

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

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

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 10px;
  font-size: clamp(30px, 5vw, 52px);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 6px;
  font-size: 18px;
  letter-spacing: 0;
}

.intro-copy {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

.reset-button {
  min-height: 44px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  color: #fff;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(15, 118, 110, 0.22);
}

.reset-button:hover {
  background: var(--primary-dark);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(310px, 410px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.input-panel,
.results-panel,
.chart-section,
.summary-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.input-panel {
  position: sticky;
  top: 18px;
  padding: 22px;
}

.panel-heading p,
.chart-heading p,
.summary-box p,
.metric p {
  color: var(--muted);
  line-height: 1.6;
}

.panel-heading {
  margin-bottom: 20px;
}

.panel-heading p {
  margin-bottom: 0;
  font-size: 14px;
}

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

.field {
  display: grid;
  gap: 7px;
  color: #33423f;
  font-size: 14px;
  font-weight: 700;
}

.input-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fbfcfc;
}

.input-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.input-wrap input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 18px;
  font-weight: 700;
}

.input-wrap span {
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

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

.hero-result {
  border-radius: 8px;
  padding: 22px;
  color: #fff;
  background: linear-gradient(135deg, #0f766e, #256c85);
}

.hero-result.success {
  background: linear-gradient(135deg, #15803d, #0f766e);
}

.hero-result.warning {
  background: linear-gradient(135deg, #b7791f, #0f766e);
}

.hero-result.danger {
  background: linear-gradient(135deg, #b42318, #7c2d12);
}

.result-label {
  margin-bottom: 8px;
  opacity: 0.82;
  font-size: 14px;
}

.hero-result strong {
  display: block;
  margin-bottom: 8px;
  font-size: clamp(28px, 5vw, 44px);
  line-height: 1.1;
  letter-spacing: 0;
}

.hero-result span {
  display: block;
  max-width: 720px;
  line-height: 1.65;
}

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

.metric {
  min-height: 142px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fbfcfc;
}

.metric-wide {
  grid-column: 1 / -1;
}

.metric span {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-bottom: 8px;
  color: var(--primary-dark);
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: 0;
}

.metric p {
  margin-bottom: 0;
  font-size: 14px;
}

.chart-section,
.summary-box {
  box-shadow: none;
}

.chart-section {
  padding: 18px;
}

.chart-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.chart-heading p {
  margin-bottom: 0;
  font-size: 14px;
}

#finalBalance {
  flex: 0 0 auto;
  color: var(--primary-dark);
  font-weight: 800;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.summary-box {
  padding: 18px;
  background: var(--surface-muted);
}

.summary-box p {
  margin-bottom: 0;
}

.disclaimer {
  margin-top: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100% - 22px, 720px);
    padding-top: 22px;
  }

  .intro,
  .workspace,
  .chart-heading {
    display: grid;
  }

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

  .input-panel {
    position: static;
  }
}

@media (max-width: 560px) {
  .intro {
    gap: 16px;
  }

  .reset-button {
    width: 100%;
  }

  .input-panel,
  .results-panel {
    padding: 16px;
  }

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

  .metric {
    min-height: 0;
  }
}
