/* ==========================================================================
   PEARTO — Calculator workspace
   Port of src/components/calculator-view.tsx onto the Pearto design system.
   Every value here references a semantic token from app.css — no raw colours.
   ========================================================================== */

.calc-layout { display: grid; grid-template-columns: minmax(300px, 2fr) 3fr; gap: var(--space-6); align-items: start; }
@media (max-width: 960px) { .calc-layout { grid-template-columns: 1fr; } }

/* --- Inputs panel -------------------------------------------------------- */
.field-list { display: flex; flex-direction: column; gap: var(--space-4); }
.field label { display: block; font-size: 14px; font-weight: 600; color: var(--ink-700); margin-bottom: 6px; }
.field-help { margin: 6px 0 0; font-size: 12.5px; color: var(--text-subtle); }

.input-wrap { position: relative; display: flex; align-items: center; }
.input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 11px 12px;
  font-size: 14.5px;
  color: var(--text);
  font-family: inherit;
  box-shadow: var(--shadow-xs);
}
.input.has-prefix { padding-left: 28px; }
.input.has-suffix { padding-right: 32px; }
.input:focus { border-color: var(--brand-400); outline: none; box-shadow: var(--shadow-focus); }
.affix { position: absolute; font-size: 14px; color: var(--text-subtle); pointer-events: none; }
.affix-left { left: 12px; }
.affix-right { right: 12px; }

.button-block { width: 100%; margin-top: var(--space-5); text-align: center; }
.button-ghost { display: inline-block; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); color: var(--ink-700); font-weight: 700; padding: 12px 18px; font-size: 14px; }
.button-ghost:hover { background: var(--surface-sunken); color: var(--ink-900); }
.action-row { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-5); padding-top: var(--space-5); border-top: 1px solid var(--border-subtle); }

/* --- Priorities / weights ------------------------------------------------ */
.priorities { margin-top: var(--space-5); padding-top: var(--space-5); border-top: 1px solid var(--border-subtle); }
.link-button { display: inline-flex; align-items: center; gap: var(--space-2); border: 0; background: none; padding: 0; font: inherit; font-size: 14px; font-weight: 600; color: var(--ink-700); cursor: pointer; }
.link-button:hover { color: var(--text); }
.priorities-body { margin-top: var(--space-4); display: flex; flex-direction: column; gap: var(--space-4); }
.row-split { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); font-size: 14px; }
.row-label { font-weight: 600; color: var(--ink-700); }
.row-value { font-weight: 800; color: var(--brand); font-variant-numeric: tabular-nums; }
.slider { width: 100%; margin-top: var(--space-2); accent-color: var(--brand); }
.note { margin: 0; border-radius: var(--radius-md); background: var(--surface-sunken); border: 1px solid var(--border-subtle); padding: var(--space-3); font-size: 12.5px; line-height: 1.65; color: var(--text-muted); }
.note a { color: var(--brand); font-weight: 600; }

/* --- Options ------------------------------------------------------------- */
.option-list { display: flex; flex-direction: column; gap: var(--space-3); }
.option-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-sunken); padding: var(--space-4); }
.option-row.is-winner { border-color: var(--brand-200); background: var(--positive-bg); }
.option-main { display: flex; align-items: center; gap: var(--space-3); }
.option-mark { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--border-strong); color: var(--positive); font-size: 13px; font-weight: 900; flex: none; }
.option-row.is-winner .option-mark { border-color: transparent; background: var(--positive-bg); border-radius: 50%; }
.option-label { font-size: 14.5px; font-weight: 800; color: var(--text); }
.option-summary { font-size: 12.5px; color: var(--text-muted); }
.option-side { text-align: right; }
.option-monthly { font-size: 14.5px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.option-score { font-size: 12.5px; color: var(--text-muted); }

.banner { margin-top: var(--space-5); border-radius: var(--radius-md); background: var(--positive-bg); box-shadow: inset 0 0 0 1px var(--brand-200); padding: var(--space-4); }
.banner p { margin: 0; font-size: 14.5px; font-weight: 700; line-height: 1.6; color: var(--brand-900); }

/* --- Stats --------------------------------------------------------------- */
.stat-grid { margin-top: var(--space-5); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
@media (min-width: 1024px) { .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); padding: var(--space-4); }
.stat-label { font-size: 12px; font-weight: 600; color: var(--text-subtle); }
.stat-value { margin-top: 4px; font-size: 18px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.stat-sub { margin-top: 2px; font-size: 12px; color: var(--text-subtle); }

.confidence-note { margin: var(--space-4) 0 0; font-size: 12.5px; color: var(--text-subtle); }

/* --- Reason / tradeoff lists --------------------------------------------- */
.result-columns { display: grid; grid-template-columns: 1fr; gap: var(--space-5); margin-top: var(--space-5); }
@media (min-width: 640px) { .result-columns { grid-template-columns: 1fr 1fr; } }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.list li { position: relative; padding-left: 26px; font-size: 14px; line-height: 1.6; color: var(--ink-700); }
.list li::before { position: absolute; left: 0; top: 0; font-weight: 900; }
.list-check li::before { content: "\2713"; color: var(--positive); }
.list-minus li::before { content: "\2013"; color: var(--accent-500); }
.list-arrow li::before { content: "\2192"; color: var(--brand); }

.assumptions { margin: var(--space-5) 4px 0; font-size: 12.5px; line-height: 1.7; color: var(--text-subtle); }

/* --- Category chips (parity with the Tailwind colour scale) -------------- */
:root {
  --money: #059669;
  --career: #7c3aed;
  --cars: #0ea5e9;
  --home: #f97316;
  --moving: #14b8a6;
  --purchases: #ec4899;
  --subscriptions: #6366f1;
  --freelance: #eab308;
}
.chip { display: inline-flex; align-items: center; gap: var(--space-2); align-self: flex-start; border-radius: var(--radius-pill); padding: 5px 12px; font-size: 12px; font-weight: 700; background: var(--surface-inset); color: var(--ink-700); }
.chip-money { background: rgba(5, 150, 105, 0.12); color: var(--money); }
.chip-career { background: rgba(124, 58, 237, 0.12); color: var(--career); }
.chip-cars { background: rgba(14, 165, 233, 0.12); color: var(--cars); }
.chip-home { background: rgba(249, 115, 22, 0.12); color: var(--home); }
.chip-moving { background: rgba(20, 184, 166, 0.12); color: var(--moving); }
.chip-purchases { background: rgba(236, 72, 153, 0.12); color: var(--purchases); }
.chip-subscriptions { background: rgba(99, 102, 241, 0.12); color: var(--subscriptions); }
.chip-freelancing { background: rgba(234, 179, 8, 0.16); color: #a16207; }

/* Chip tones that need to stay legible in dark mode */
[data-theme="dark"] .chip-money,
[data-theme="dark"] .chip-career,
[data-theme="dark"] .chip-cars,
[data-theme="dark"] .chip-home,
[data-theme="dark"] .chip-moving,
[data-theme="dark"] .chip-purchases,
[data-theme="dark"] .chip-subscriptions,
[data-theme="dark"] .chip-freelancing { background: rgba(255, 255, 255, 0.08); color: var(--text); }

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
