/* US NRI Retirement Planner. Site-wide colours, themes, top bar, buttons and tables are in /shared/css/site.css. */
.fx-chip { padding: 8px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-deep); font-size: 13px; font-weight: 650; }
.top-actions select { height: 44px; padding: 0 10px; border: 1px solid var(--field-line); border-radius: var(--radius); background: var(--surface); max-width: 220px; }
.levers[hidden] { display: none; }

/* steps */
.steps { padding-top: 18px; padding-bottom: 4px; }
.steps ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.steps button { display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 0 14px; border-radius: var(--radius);
  border: 1px dashed var(--field-line); background: transparent; color: var(--muted); cursor: pointer; font-size: 14px; }
.steps button.done { border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); }
.steps button.done .ic { color: var(--accent); }
.steps button.current { border: 1px solid var(--ink); background: var(--ink); color: var(--ground); font-weight: 750; }

/* layout */
.layout { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; padding-top: 16px; padding-bottom: 32px; }
.form-col { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.results { flex: 1 1 360px; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 20px; display: flex; flex-direction: column; gap: 16px; position: sticky; top: 12px; }
@media (max-width: 960px) { .results { position: static; } }
.step-head { display: flex; flex-direction: column; gap: 4px; margin-bottom: 4px; }
.step-head p { color: var(--muted); max-width: 70ch; }
.step-head p + p { margin-top: 6px; }
.kid-costs-head { margin-top: 16px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.panel.empty { color: var(--muted); }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.note { font-size: 14px; color: var(--ink-2); }
.grid { display: grid; gap: 14px; }
.g3 { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.g2 { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); } /* fewer, wider columns for longer labels */
.g4 { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.g5 { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.grow, .grow { flex: 1; min-width: 0; }
.field label { font-size: 13px; font-weight: 650; color: var(--ink-2); }
.field input, .field select {
  height: 44px; width: 100%; padding: 0 12px; border: 1px solid var(--field-line); border-radius: var(--radius);
  background: var(--surface); font-size: 15px;
}
.field input:focus, .field select:focus { border-color: var(--accent); }
.input-wrap { position: relative; }
.input-wrap.has-suffix input { padding-right: 30px; }
.suffix { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 14px; pointer-events: none; }
.hint { font-size: 12px; color: var(--muted); min-height: 16px; }
.note-hint { min-height: 0; }
.row-tight { display: flex; flex-wrap: wrap; gap: 6px; }
.row-tight select { flex: 1 1 100%; min-width: 0; }
.row-tight .year-input { flex: 1 1 100%; min-width: 0; height: 44px; padding: 0 10px; border: 1px solid var(--field-line); border-radius: var(--radius); background: var(--surface); }

.item-head { display: flex; align-items: center; gap: 12px; }
.item-head > h2, .item-head > h3 { flex: 1; min-width: 0; }
.kid .grow { display: flex; flex-direction: column; }
.badge { flex: none; width: 40px; height: 40px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-deep); font-weight: 800;
  display: flex; align-items: center; justify-content: center; }
.sub { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 12px; }
.check { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 650; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.item-row { display: flex; gap: 10px; align-items: flex-start; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.item-row .grid { flex: 1; }
.item-row .icon-btn { margin-top: 23px; }
.item-block { display: flex; flex-direction: column; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }

.segmented { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.seg { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border: 1px solid var(--field-line); border-radius: var(--radius); cursor: pointer; font-weight: 600; }
.seg input { accent-color: var(--accent); }
.seg.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-deep); }

.add-btn { min-height: 56px; border: 2px dashed var(--field-line); border-radius: var(--radius-lg); background: transparent; color: var(--accent);
  font-weight: 750; display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; }
.add-btn:hover { border-color: var(--accent); }
.add-btn.small { min-height: 46px; border-radius: var(--radius); }
.step-nav { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding-top: 6px; }

/* results panel */
.res-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.res-head small { color: var(--muted); }
#res-dyn { display: flex; flex-direction: column; gap: 14px; }
.verdict { padding: 16px; border-radius: 12px; display: flex; flex-direction: column; gap: 2px; border: 1px solid; }
.verdict strong { font-size: 21px; font-weight: 800; }
.verdict .v-label { font-size: 13px; font-weight: 750; }
.verdict.bad { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn-ink); }
.verdict.ok { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok-ink); }
.verdict.warn { background: var(--ground); border-color: var(--warn-line); color: var(--ink); }
.verdict.warn strong { font-size: 16px; font-weight: 700; }
.verdict.warn .v-label { color: var(--warn); }
#res-dyn { transition: opacity .15s ease; }
.results.busy #res-dyn { opacity: .55; transition-delay: .15s; }
/* required fields and errors */
.req { color: var(--warn); font-weight: 700; margin-left: 3px; }
.req-note { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.req-note .req { margin: 0 3px 0 0; }
.field-error { font-size: 13px; font-weight: 600; color: var(--warn); }
.field input[aria-invalid="true"], .field select[aria-invalid="true"] { border-color: var(--warn); box-shadow: 0 0 0 1px var(--warn); }
.question { border: 0; padding: 0; margin: 0 0 14px; display: flex; flex-direction: column; gap: 8px; }
.question legend { padding: 0; margin-bottom: 8px; font-size: 14px; font-weight: 650; color: var(--ink); }
.question { position: relative; } /* anchors an (i) pop-up on small screens */
.question legend .info { margin: 0 0 0 6px; vertical-align: middle; }
.question legend .info-btn { width: 18px; height: 18px; font-size: 11px; }
.question legend .info-pop { font-size: 13px; font-weight: 400; }
.question:has(.seg input[aria-invalid="true"]) .seg { border-color: var(--warn); }
.step-nav-wrap { display: flex; flex-direction: column; gap: 12px; }
.step-errors { padding: 12px 16px; border-radius: 12px; border: 1px solid var(--warn-line); background: var(--warn-soft); color: var(--warn-ink); font-size: 14px; }
.step-errors ul { margin: 6px 0 0; padding-left: 18px; }
.steps button:disabled { opacity: .45; cursor: not-allowed; }
.progress-card { display: flex; flex-direction: column; gap: 2px; padding: 16px; border-radius: 12px; background: var(--ground); }
.progress-card strong { font-size: 17px; }
.progress-card span { font-size: 14px; color: var(--muted); }
.progress { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.progress li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); font-size: 14px; }
.progress li span { display: inline-flex; align-items: center; gap: 6px; }
.progress li small { color: var(--muted); }
.progress li.todo small { color: var(--warn); font-weight: 600; }
.progress li.done small { color: var(--ok); font-weight: 600; }
.progress li.new { border-style: dashed; color: var(--muted); }
.progress li.done .ic { width: 16px; height: 16px; color: var(--ok); }
.offline { max-width: 560px; margin: 64px auto; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.offline h1 { font-size: 22px; margin: 0; }
.offline code { background: var(--ground); padding: 1px 6px; border-radius: 6px; font-size: .95em; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat { padding: 12px 14px; border-radius: 12px; background: var(--ground); display: flex; flex-direction: column; gap: 2px; }
.stat span, .stat small { font-size: 12px; color: var(--muted); }
.stat strong { font-size: 19px; font-weight: 800; }
.mini-chart { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.mini-chart figcaption { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.tip { font-size: 14px; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-deep); }
.levers { display: flex; flex-direction: column; gap: 12px; border-top: 1px solid var(--line); padding-top: 14px; }
.lever-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.lever-top output { font-weight: 750; }
.lever input[type="range"] { width: 100%; height: 30px; accent-color: var(--accent); }
.lever-group { margin: 6px 0 -4px; font-size: 13px; font-weight: 700; color: var(--muted); }
.lever-note { font-size: 13px; color: var(--ink-2); }
.link-btn { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 650; text-decoration: underline; cursor: pointer; }

/* chart */
.chart { width: 100%; height: auto; display: block; }
.chart .gridline { stroke: var(--line); stroke-width: 1; }
.chart .zero { stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 4 3; }
.chart .move-line { stroke: var(--field-line); stroke-width: 1; stroke-dasharray: 2 3; }
.chart .nw { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.chart .nw-stress { fill: none; stroke: var(--chart-2); stroke-width: 2.2; stroke-dasharray: 6 5; stroke-linecap: round; }
/* the stress test under the key figures on Results */
.stress { padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; gap: 6px; }
.stress-head { display: flex; align-items: center; gap: 8px; }
.stress-head .info { margin: 0; }
.stress-head .info-btn { width: 18px; height: 18px; font-size: 11px; }
.stress p { font-size: 14px; color: var(--ink-2); }
.stress.ok strong { color: var(--ink); }
.stress.bad { background: var(--warn-soft); border-color: var(--warn-line); }
.stress.bad p strong { color: var(--warn-ink); }
.chart .nw-neg { fill: none; stroke: var(--warn); stroke-width: 3; stroke-dasharray: 6 4; stroke-linejoin: round; }
.chart .dot-neg { fill: var(--warn); }
.chart .tick { font-size: 10px; fill: var(--muted); font-family: inherit; }
.chart .tick.strong { fill: var(--ink); font-weight: 700; }
.chart .gridline.v { stroke-dasharray: 2 4; }
.chart .tick.age { font-size: 9px; }
.chart .tick.lane { font-weight: 650; fill: var(--ink-2); }
.chart .axis-title { font-size: 11px; font-weight: 700; fill: var(--ink-2); font-family: inherit; }
.chart .ms-text { font-size: 10px; fill: var(--ink-2); font-family: inherit; }
.chart .ms-text.in { fill: var(--accent-ink); font-weight: 600; }
.chart .ms-text.in.school { fill: var(--accent-deep); }
.chart .ms-bar { stroke-width: 1; }
.chart .ms-bar.school { fill: var(--accent-soft); stroke: var(--accent); }
.chart .ms-bar.kid { fill: var(--accent); stroke: var(--accent); }
.chart .ms-bar.ira, .chart .ms-dot.ira { fill: var(--chart-2); stroke: var(--chart-2); }
.chart .ms-text.in.ira { fill: var(--chart-2-ink); }
.chart .ms-dot.family { fill: var(--ink); }
.chart .ms-bar.family { fill: var(--accent-soft); stroke: var(--accent); } /* e.g. "Rented out" for a US home */
.chart .ms-text.in.family { fill: var(--accent-deep); }
.chart .ms-dot.kid { fill: var(--accent); }

@media (max-width: 600px) {
  .panel, .results { padding: 16px; }
  .steps ol { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .steps button { white-space: nowrap; }
}
/* sizes step down: section title (h2, 17px) → sub-heading (15px) → question (14px) → field label (13px) */
.sub-title { margin: 20px 0 10px; font-size: 15px; font-weight: 700; color: var(--ink); }
.sub-title:first-of-type { margin-top: 4px; }
.results-head { flex-direction: row; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.results-head > div:first-child { flex: 1 1 320px; }
.results-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.layout.full .form-col { flex-basis: 100%; }
.results-top { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 14px; align-items: start; }
.results-top #results-summary { display: flex; flex-direction: column; gap: 14px; }
.results-top .levers { border-top: 0; padding-top: 22px; }
.stats3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 860px) { .results-top { grid-template-columns: 1fr; } .stats3 { grid-template-columns: 1fr; } }
.shared-banner { margin-top: 16px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--accent); background: var(--accent-soft);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.shared-banner strong { display: block; }
.shared-banner span { font-size: 14px; color: var(--ink-2); }
.shared-actions { display: flex; flex-wrap: wrap; gap: 8px; }
/* calculated, read-only totals */
.calc-total { margin-top: 12px; padding: 12px 14px; border-radius: 10px; background: var(--ground); border: 1px solid var(--line); border-left: 4px solid var(--accent); display: flex; flex-direction: column; gap: 3px; }
.calc-total .calc-label { font-size: 13px; font-weight: 650; color: var(--ink-2); }
.calc-total .calc-label em { font-style: normal; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; margin-left: 6px; }
.calc-total strong { font-size: 18px; }
.calc-total small { color: var(--muted); font-size: 13px; }
/* a step-by-step calculation inside a calculated box (the sale of a home abroad) */
.calc-breakdown { width: 100%; max-width: 640px; border-collapse: collapse; margin: 6px 0; font-size: 14px; }
.calc-breakdown th, .calc-breakdown td { padding: 6px 0; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; }
.calc-breakdown th { font-weight: 600; color: var(--ink-2); padding-right: 16px; white-space: normal; }
.calc-breakdown th small { display: block; font-weight: 400; margin-top: 2px; }
.calc-breakdown td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.calc-breakdown tr.total th, .calc-breakdown tr.total td { border-bottom: 0; font-weight: 750; color: var(--ink); }
.car-total { margin: -2px 0 14px; }
.preset-row { display: flex; align-items: flex-end; gap: 10px; }
.preset-row .question { margin-bottom: 0; }
.info { position: relative; display: inline-flex; margin-bottom: 10px; }
.info-btn { width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--field-line); background: var(--surface); color: var(--ink-2);
  font: italic 700 13px/1 Georgia, serif; cursor: help; padding: 0; }
.info-btn:hover, .info-btn:focus-visible { border-color: var(--accent); color: var(--accent-deep); background: var(--accent-soft); }
.info-pop { display: none; position: absolute; z-index: 20; top: 32px; left: 50%; transform: translateX(-50%); width: min(460px, calc(100vw - 32px));
  max-height: min(70vh, 560px); overflow-y: auto; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  color: var(--ink-2); box-shadow: 0 10px 30px rgba(0, 0, 0, .18); font-size: 13px; line-height: 1.45; text-align: left; }
.info:hover .info-pop, .info:focus-within .info-pop { display: block; }
.info-title { display: block; color: var(--ink); font-size: 14px; margin: 10px 0 4px; }
.info-title:first-child { margin-top: 0; }
.info-pop dl { margin: 0; }
.info-pop dt { font-weight: 650; color: var(--ink); margin-top: 6px; }
.info-pop dd { margin: 0; }
.info-pop ul { margin: 0; padding-left: 18px; }
.info-pop li + li { margin-top: 4px; }
/* an (i) next to a step's title; its tips open from the button rightwards */
.title-row { position: relative; display: flex; align-items: center; gap: 10px; }
.title-row .info { margin: 0; }
.title-row .info-pop { left: 0; transform: none; }
/* an (i) next to a field's label: small enough to keep the input in line with its neighbours */
.label-row { position: relative; display: flex; align-items: center; gap: 6px; }
.label-row .info { margin-bottom: 0; }
.label-row .info-btn { width: 18px; height: 18px; font-size: 11px; }
input[readonly] { background: var(--ground); color: var(--ink-2); cursor: default; }
@media (max-width: 640px) { .info { position: static; } .preset-row { position: relative; } .info-pop { left: 0; transform: none; width: 100%; } }
/* on a phone, a title's tips open full width just below the title */
@media (max-width: 640px) { .title-row .info-pop { top: calc(100% + 6px); } }

/* Paragraphs, (i) texts and the explanations under calculated amounts are justified on wider screens. Phones keep
   left-aligned text: a narrow column would otherwise show big gaps between words. (A line on its own, or a paragraph's
   last line, stays left-aligned either way.) */
@media (min-width: 641px) {
  #app p:not(.loading), .info-pop, .info-pop li, .calc-total small { text-align: justify; }
}
