/* ---------- Design Tokens ---------- */
:root {
  --brand:        #1d9e75;
  --brand-dark:   #0f7558;
  --brand-tint:   #ecfdf5;
  --brand-tint-2: #d1fae5;
  --brand-line:   #a7f3d0;
  --bg:           #f7f8f6;
  --card:         #ffffff;
  --border:       #e5e7eb;
  --line-soft:    #f1f5f9;
  --text:         #0f172a;
  --muted:        #475569;
  --muted-light:  #94a3b8;
  --danger:       #e24b4a;
  --shadow-sm:    0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 1px rgba(15, 23, 42, 0.03);
  --shadow-md:    0 4px 12px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-lg:    0 12px 32px rgba(15, 23, 42, 0.08), 0 2px 6px rgba(15, 23, 42, 0.04);
  --radius:       12px;
  --radius-sm:    8px;

  /* Legacy aliases used elsewhere in this file */
  --primary:      var(--brand);
  --primary-soft: var(--brand-tint);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(1200px 600px at 100% -10%, #ecfdf5 0%, transparent 55%),
    radial-gradient(1000px 500px at -10% 110%, #f1f5f9 0%, transparent 50%),
    var(--bg);
  color: var(--text);
  line-height: 1.4;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ── Nav ─────────────────────────────────────────── */
.topnav {
  height: 52px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 6px;
  font-size: 13px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.breadcrumb-item {
  color: var(--muted-light);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s;
}

.breadcrumb-item:hover { color: var(--text); }

.breadcrumb-sep { color: #d1d5db; }

.breadcrumb-current {
  font-weight: 600;
  color: var(--text);
}

.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 24px 56px;
}

/* ── Hero ────────────────────────────────────────── */
.hero {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  align-items: center;
  background: linear-gradient(135deg, #ffffff 0%, #f0fdf8 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(600px 220px at 80% -40%, rgba(29,158,117,0.10) 0%, transparent 60%);
  pointer-events: none;
}

.hero-copy { position: relative; z-index: 1; }

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--brand-line);
  font-size: 11px;
  font-weight: 600;
  color: var(--brand-dark);
  letter-spacing: 0.01em;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}

.hero-kicker-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 3px rgba(29,158,117,0.18);
}

.page-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--text);
}

.page-title-accent {
  background: linear-gradient(90deg, var(--brand) 0%, var(--brand-dark) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 700;
}

.page-sub a {
  color: var(--brand-dark);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.page-sub a:hover {
  color: var(--brand);
}

.page-sub {
  font-size: 13px;
  color: var(--muted);
  margin: 8px 0 0;
  max-width: 56ch;
  line-height: 1.55;
}

.hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.hero-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  box-shadow: var(--shadow-sm);
}

.hero-chip svg {
  width: 12px; height: 12px;
  stroke: var(--brand);
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--brand);
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #ffffff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(29,158,117,0.25), inset 0 1px 0 rgba(255,255,255,0.18);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.cta-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(29,158,117,0.32), inset 0 1px 0 rgba(255,255,255,0.18);
}

.cta-btn svg {
  width: 14px; height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cta-btn.cta-ghost {
  background: #fff;
  color: var(--brand-dark);
  border-color: var(--brand-line);
  box-shadow: var(--shadow-sm);
}

.cta-btn.cta-ghost:hover {
  background: var(--brand-tint);
  box-shadow: var(--shadow-md);
}

.hero-art {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-art svg {
  width: 100%;
  height: auto;
  max-width: 320px;
  filter: drop-shadow(0 8px 18px rgba(15, 23, 42, 0.08));
  border-radius: 14px;
}

/* ── Layout ──────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 16px;
  align-items: start;
}

.col-left,
.col-right {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

/* ── Card ────────────────────────────────────────── */
.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.card::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--brand-line) 50%, transparent 100%);
  border-top-left-radius: var(--radius);
  border-top-right-radius: var(--radius);
  opacity: 0.7;
}

.card-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-light);
  margin-bottom: 14px;
}

.card-icon {
  width: 13px; height: 13px;
  stroke: var(--brand);
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* ── Input group ─────────────────────────────────── */
.input-group {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: linear-gradient(180deg, #fff 0%, #fafefa 100%);
}

.field {
  padding: 12px 14px 12px;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent;
  transition: border-left-color 0.18s, background 0.18s;
}

.field:last-child { border-bottom: none; }

.field:focus-within {
  border-left-color: var(--brand);
  background: #fafffe;
}

.field:hover { background: #fbfffd; }

.field label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-light);
  margin-bottom: 4px;
}

.field input[type="number"] {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  font-family: inherit;
  -moz-appearance: textfield;
  appearance: textfield;
}

.field input[type="number"]::-webkit-inner-spin-button,
.field input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; }

.field input[type="number"]:focus { outline: none; }

.hint {
  font-size: 10px;
  color: var(--muted-light);
  margin-top: 3px;
  display: block;
  font-weight: 500;
}

/* ── Slider with progress fill ───────────────────── */
.slider-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.slider-wrap input[type="range"] {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(
    to right,
    var(--brand) 0%,
    var(--brand) var(--p, 50%),
    #e5e7eb var(--p, 50%),
    #e5e7eb 100%
  );
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  transition: background 0.08s linear;
}

.slider-wrap input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--brand);
  box-shadow: 0 1px 3px rgba(29,158,117,0.40);
  transition: transform 0.12s;
}

.slider-wrap input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }
.slider-wrap input[type="range"]::-webkit-slider-thumb:active { transform: scale(1.25); }

.slider-wrap input[type="range"]::-moz-range-track {
  height: 4px;
  background: linear-gradient(
    to right,
    var(--brand) 0%,
    var(--brand) var(--p, 50%),
    #e5e7eb var(--p, 50%),
    #e5e7eb 100%
  );
  border-radius: 3px;
}

.slider-wrap input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--brand);
  box-shadow: 0 1px 3px rgba(29,158,117,0.40);
  cursor: pointer;
}

.slider-min,
.slider-max {
  font-size: 9px;
  color: var(--muted-light);
  white-space: nowrap;
  font-weight: 600;
  min-width: 22px;
  letter-spacing: 0.04em;
}

.slider-max { text-align: right; }

/* ── Results grid ────────────────────────────────── */
.results-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-areas:
    "invested total gain"
    "tax hero hero";
  gap: 10px;
  align-items: stretch;
}

.result-item {
  position: relative;
  background: linear-gradient(180deg, #ffffff 0%, #f9fafb 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 14px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 4px;
  min-height: 108px;
  min-width: 0;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.result-item:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  border-color: #d1d5db;
}

.result-invested { grid-area: invested; }
.result-total    { grid-area: total; }
.result-gain     { grid-area: gain; }
.result-tax      { grid-area: tax; }

.result-item.hero {
  grid-area: hero;
  background:
    radial-gradient(600px 200px at 100% 0%, rgba(29,158,117,0.10) 0%, transparent 60%),
    linear-gradient(180deg, #f0fdf8 0%, #ecfdf5 100%);
  border-color: var(--brand-line);
  min-height: 108px;
  padding: 14px 16px 16px;
}

.result-item.hero::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, #34d399 50%, transparent 100%);
  border-radius: 10px;
}

.hero-badge {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand-dark);
  background: #fff;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--brand-line);
  box-shadow: var(--shadow-sm);
}

.r-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted-light);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.r-icon {
  width: 11px; height: 11px;
  stroke: var(--brand);
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.r-value {
  font-size: clamp(18px, 1.8vw, 24px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text);
  word-break: break-word;
  overflow-wrap: anywhere;
  max-width: 100%;
}

.result-item.hero .r-value {
  font-size: clamp(22px, 2.2vw, 30px);
  letter-spacing: -0.025em;
}

.value-positive { color: #15803d; }
.value-negative { color: #b91c1c; }

.r-delta {
  font-size: 11px;
  color: var(--muted-light);
  white-space: normal;
  font-weight: 500;
}

.r-main {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  margin-top: 8px;
}

.r-main-inline {
  flex-direction: row;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
}

.r-inline-tax {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}

.green { color: var(--brand); }

/* ── Inline editable assumptions inside the Real CAGR card ──
   Looks like a sentence; numbers are quietly editable in place.            */
.r-assume {
  margin-top: 10px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.7;
}

/* Each "[ number % ]" reads as one editable token */
.r-assume-token {
  display: inline-flex;
  align-items: baseline;
  padding: 1px 5px 2px;
  margin: 0 1px;
  border-radius: 5px;
  background: rgba(29, 158, 117, 0.07);
  border: 1px solid rgba(29, 158, 117, 0.18);
  cursor: text;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.12s;
}

.r-assume-token:hover {
  background: rgba(29, 158, 117, 0.14);
  border-color: rgba(29, 158, 117, 0.45);
}

.r-assume-token:focus-within {
  background: #ffffff;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(29, 158, 117, 0.16);
  transform: translateY(-0.5px);
}

.r-assume-input {
  width: 2ch;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--brand-dark);
  text-align: right;
  line-height: 1.2;
  cursor: text;
  border-bottom: 1.5px dotted rgba(29, 158, 117, 0.55);
  -moz-appearance: textfield;
  appearance: textfield;
  transition: border-bottom-color 0.15s, border-bottom-style 0.15s;
}

.r-assume-input::-webkit-inner-spin-button,
.r-assume-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.r-assume-input:focus {
  outline: none;
  border-bottom-color: var(--brand);
  border-bottom-style: solid;
}

.r-assume-unit {
  font-size: 11px;
  font-weight: 700;
  color: var(--brand);
  margin-left: 1px;
  user-select: none;
}

.r-assume-suffix {
  color: var(--muted);
  font-weight: 500;
}

.r-assume-sep {
  margin: 0 6px;
  color: var(--muted-light);
  font-weight: 600;
}

/* Hidden helper kept for JS that writes the tax estimate (Estimated Tax tile already shows the rupee value) */
.r-assume-hint { display: none; }

/* ── Insight pills ───────────────────────────────── */
.card-reality .insight-line + .insight-line { margin-top: 8px; }

.insight-line {
  font-size: 12px;
  line-height: 1.6;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 0;
  background: #fafafa;
  border: 1px solid var(--border);
  border-left-width: 3px;
  color: var(--muted);
}

.insight-line:last-child { border-bottom: none; margin-bottom: 0; }

.insight-tag {
  display: inline-block;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-right: 7px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--muted);
  vertical-align: 1px;
}

.insight-good { border-left-color: #10b981; background: #ecfdf5; border-color: #a7f3d0; }
.insight-good .insight-tag { color: #047857; border-color: #a7f3d0; }

.insight-warn { border-left-color: #f59e0b; background: #fffbeb; border-color: #fde68a; }
.insight-warn .insight-tag { color: #b45309; border-color: #fde68a; }

.insight-risk { border-left-color: #ef4444; background: #fef2f2; border-color: #fecaca; }
.insight-risk .insight-tag { color: #b91c1c; border-color: #fecaca; }

/* ── Chart ───────────────────────────────────────── */
.card-chart .chart-wrap {
  background: linear-gradient(180deg, #ffffff 0%, #fafefb 100%);
  border-radius: var(--radius-sm);
  padding: 8px 4px 4px;
}

.chart-wrap {
  min-height: 280px;
  position: relative;
}

/* ── Quick actions ───────────────────────────────── */
.quick-actions .action-text {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
  line-height: 1.55;
}

.action-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ── Content grid + Info sections ────────────────── */
.content-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.info-section h2 {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 17px;
  margin-bottom: 12px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

.section-icon {
  width: 16px; height: 16px;
  padding: 5px;
  box-sizing: content-box;
  background: var(--brand-tint);
  border-radius: 8px;
  stroke: var(--brand-dark);
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.info-section h3 {
  font-size: 13.5px;
  margin: 14px 0 4px;
  font-weight: 600;
  color: var(--text);
}

.info-section p,
.info-section li {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.65;
}

.info-section ul,
.info-section ol {
  padding-left: 18px;
  display: grid;
  gap: 6px;
}

.info-section ol > li { padding-left: 4px; }
.info-section ol > li strong { color: var(--text); }

/* ── Touch devices ───────────────────────────────── */
@media (pointer: coarse) {
  .slider-wrap input[type="range"]::-webkit-slider-thumb {
    width: 22px; height: 22px;
  }
  .slider-wrap input[type="range"]::-moz-range-thumb {
    width: 22px; height: 22px;
  }
  .slider-wrap input[type="range"] { padding: 10px 0; }
}

/* ── Tablet / hero wrap ──────────────────────────── */
@media (max-width: 880px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .hero-art { order: -1; }
  .hero-art svg { max-width: 360px; margin: 0 auto; }
  .col-right { position: static !important; }
}

@media (max-width: 780px) {
  .layout,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .results-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "invested total"
      "gain tax"
      "hero hero";
  }

  .r-main { gap: 3px; }

  /* Collapse to SmartFinance / current — hide Guides + Calculators trail */
  .topnav > .breadcrumb-sep:nth-child(2),
  .topnav > .breadcrumb-item:nth-child(3),
  .topnav > .breadcrumb-sep:nth-child(4),
  .topnav > .breadcrumb-item:nth-child(5) { display: none; }
}

@media (max-width: 480px) {
  .page    { padding: 16px 16px 40px; }
  .topnav  { padding: 0 16px; }
  .hero    { padding: 18px 18px; }
  .page-title { font-size: 22px; }
  .hero-art { display: none; }

  .breadcrumb-sep,
  .breadcrumb-item { display: none; }
  .breadcrumb-current { font-size: 13px; }

  .field input[type="number"] { font-size: 18px; }

  .results-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "invested"
      "total"
      "gain"
      "tax"
      "hero";
  }

  .result-item { min-height: unset; gap: 6px; }

  .hero-badge { position: static; display: inline-block; margin-bottom: 6px; }

  .chart-wrap { min-height: 220px; }

  .r-assume { font-size: 11.5px; line-height: 1.9; }
  .r-assume-input { width: 2.2ch; font-size: 13px; }
  .r-assume-token { padding: 2px 6px 3px; }

  .slider-min, .slider-max { display: none; }

  .card { padding: 14px 16px; }
}

@media (max-width: 360px) {
  .topnav { font-size: 11px; gap: 4px; }
  .card { padding: 12px 14px; }
  .field input[type="number"] { font-size: 17px; }
  .r-value { font-size: 19px; }
  .cta-btn { width: 100%; min-height: 36px; }
  .action-links .cta-btn { width: 100%; }
  .info-section h2 { font-size: 15px; }
}
