/* ==========================================================================
   /index2 — Financial calculators (SIP, Lumpsum, SWP, Retirement).
   Rendered inside the "compounding" band: inputs + result legend on the
   left, gold bar chart card on the right. Charts are plain DOM bars
   (no chart library), drawn by js/calculators.js.
   ========================================================================== */

.calc-tabs { margin-top: 30px; }
.calc-tab sup { font-size: .8em; margin-left: 1px; letter-spacing: 0; }
.calc-panel { margin-top: 26px; }
.calc-panel[hidden] { display: none; }

.calc-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 16px; }
.calc-fields .field { margin-top: 12px; }
.calc-fields .field--full { grid-column: 1 / -1; }
.field__wrap { position: relative; }
.field__prefix { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font: 400 14px/1 var(--mono); color: var(--muted); pointer-events: none; }
.field__wrap input { padding-left: 32px; }
.calc-fields input, .calc-fields select {
  width: 100%; height: 46px; padding: 0 14px; border-radius: 10px; border: 1px solid #ddd5c5; background: #fff;
  font: 400 14.5px/1 var(--mono); color: var(--ink); transition: border-color .2s ease, box-shadow .2s ease;
}
.calc-fields .field__wrap input { padding-left: 30px; }
.calc-fields input:focus, .calc-fields select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(194, 154, 44, .18); }
.calc-fields input[aria-invalid="true"] { border-color: #c0634f; }

/* Results: one horizontal row under the inputs + chart; each metric on one line. */
.legend { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 32px; border-block: 1px solid #e3ddcf; }
.legend[hidden] { display: none; }
.legend__row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; padding: 16px 18px; }
.legend__row + .legend__row { border-left: 1px solid #e3ddcf; }
.legend__dot { width: 8px; height: 8px; border-radius: 2px; align-self: center; flex: none; }
.legend__label { font-size: 13.5px; line-height: 1.35; color: var(--ink-2); }
.legend__value { font: 500 13.5px/1.35 var(--mono); color: var(--ink); white-space: nowrap; }
.legend__detail { font: 400 10px/1.3 var(--mono); letter-spacing: .04em; color: var(--muted); white-space: nowrap; }
.dot-1 { background: #a67c1f; }
.dot-2 { background: #c9a33a; }
.dot-3 { background: #d9b95d; }
.dot-4 { background: #eadcb4; }

/* Chart card */
.band__grid { align-items: stretch; }
.chart-card {
  display: flex; flex-direction: column;
  position: relative; background: #fff; border: 1px solid #e6e0d4; border-radius: var(--radius);
  padding: 32px 29px 29px; box-shadow: 0 2px 4px rgba(40, 30, 10, .04), 0 36px 60px -34px rgba(70, 52, 18, .38);
}
.chart-card__title { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 18px; }
.chart-card__title strong { font: 400 17px/1.2 var(--serif); letter-spacing: -.01em; }
.chart-keys { display: flex; flex-wrap: wrap; gap: 6px 14px; font: 400 10px/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.chart-keys span { display: inline-flex; align-items: center; gap: 6px; }
.chart-keys i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.key-gold { background: linear-gradient(180deg, #dfc166, #a98121); }
.key-soft { background: #eadcb4; }
.key-mute { background: #cfc5ae; }

.bars { position: relative; display: flex; align-items: flex-end; flex: 1 1 auto; height: auto; min-height: 251px; border-bottom: 1.5px solid #2b2e33; }
.bars__col { position: relative; flex: 1 1 0; height: 100%; display: flex; align-items: flex-end; cursor: default; }
.bars__bar {
  position: relative; width: 100%; min-height: 1px; border-radius: 2px 2px 0 0; overflow: hidden;
  background: linear-gradient(180deg, #dfc166 0%, #c29a2c 55%, #a98121 100%);
  box-shadow: inset 0 1px 0 rgba(255, 244, 205, .75);
  transform-origin: bottom; transition: height .45s cubic-bezier(.2, .7, .2, 1), background .3s ease;
}
.bars__bar--mute { background: linear-gradient(180deg, #ddd3bd 0%, #cfc5ae 100%); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7); }
.bars__base { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(255, 250, 235, .55); border-top: 1px solid rgba(255, 255, 255, .6); transition: height .45s cubic-bezier(.2, .7, .2, 1); }
.bars__col:hover .bars__bar { filter: brightness(1.06); }
.bars__axis { display: flex; justify-content: space-between; margin-top: 10px; font: 400 9.5px/1 var(--mono); letter-spacing: .12em; color: var(--muted); text-transform: uppercase; }
.bars__tip {
  position: absolute; z-index: 2; pointer-events: none; transform: translate(-50%, calc(-100% - 10px));
  background: var(--ink); color: #f9f8f4; border-radius: 8px; padding: 8px 10px; white-space: nowrap;
  font: 400 11px/1.45 var(--mono); opacity: 0; transition: opacity .15s ease;
}
.bars__tip.is-on { opacity: 1; }
.chart-card__note { margin-top: 22px; font: 400 9.5px/1.7 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.chart-card__note a { margin-left: 4px; color: var(--gold-ink); text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.chart-card__empty { position: absolute; inset: 0; z-index: 3; border-radius: inherit; background: rgba(255, 255, 255, .94); display: grid; place-items: center; font: 400 11px/1.5 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); text-align: center; padding: 20px; }
.chart-card__empty[hidden] { display: none; }

/* SWP yearly breakdown */
.swp-table { margin-top: 56px; }
.swp-table[hidden] { display: none; }
.swp-table h3 { font: 400 22px/1.2 var(--serif); letter-spacing: -.01em; margin-bottom: 14px; }
.swp-table table { width: 100%; border-collapse: collapse; font-size: 14px; background: rgba(255, 255, 255, .55); }
.swp-table th { padding: 12px 14px; text-align: right; font: 500 9.5px/1.4 var(--mono); letter-spacing: .18em; text-transform: uppercase; color: var(--gold-ink); border-bottom: 1.5px solid var(--ink); }
.swp-table td { padding: 11px 14px; text-align: right; font: 400 13px/1.4 var(--mono); color: var(--ink-2); border-bottom: 1px solid #e3ddcf; }
.swp-table th:first-child, .swp-table td:first-child { text-align: left; }
.swp-table .btn { margin-top: 18px; }

@media (max-width: 720px) {
  .calc-fields { grid-template-columns: 1fr 1fr; }
  .legend { grid-template-columns: 1fr 1fr; }
  .legend__row { padding: 12px 10px; }
  .legend__row:nth-child(3) { border-left: 0; }
  .legend__row:nth-child(n+3) { border-top: 1px solid #e3ddcf; }
  .chart-card { padding: 24px 18px 20px; }
  .bars { min-height: 200px; }
  .chart-card__title { flex-direction: column; }
}
@media (max-width: 420px) {
  .calc-fields { grid-template-columns: 1fr; }
}

/* 18 Oct (round 4): the whole calculator — inputs, chart and results row — fits one screen.
   Smaller chart, tighter spacing on the left, results row moved up. */
/* Desktop only: unscoped, this rule overrode style.css's one-column band at <=1024px, so on phones
   the chart card sat on top of the tabs and squeezed the inputs (fixed 13 Nov). */
@media (min-width: 1025px) {
  .band__grid { grid-template-columns: minmax(0, 1fr) minmax(0, 500px); gap: 48px; align-items: start; }
}
.band .h2--sm { font-size: clamp(28px, 2.6vw, 36px); }
.calc-tabs { margin-top: 20px; }
.calc-panel { margin-top: 14px; }
.calc-fields .field { margin-top: 8px; }
.calc-fields input, .calc-fields select { height: 42px; }
.chart-card { padding: 22px 24px 18px; align-self: start; }
.chart-card__title { margin-bottom: 12px; }
.bars { flex: none; height: 210px; min-height: 0; }
.chart-card__note { margin-top: 14px; }
.legend { margin-top: 20px; }
.legend__row { padding: 12px 16px; }
@media (max-width: 720px) {
  .bars { height: 180px; }
}
