:root {
  --paper:   #EFF2EC;
  --surface: #FBFCFA;
  --surface-2: #F3F6F0;
  --ink:     #17251E;
  --ink-soft:#54655B;
  --line:    #DCE3DB;
  --line-strong:#C6D0C4;
  --forest:  #1E5B44;
  --forest-deep:#143F30;
  --forest-tint:#E7F0EA;
  --brass:   #9A6B1E;
  --brass-bright:#B98A2E;
  --shadow:  0 1px 2px rgba(20,40,30,.06), 0 12px 34px -14px rgba(20,40,30,.22);
  --radius:  14px;

  --serif: "Iowan Old Style","Palatino Linotype",Palatino,"Book Antiqua",Georgia,"Times New Roman",serif;
  --sans:  -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
}
/* Always light: the widget is embedded in a light site, so it does NOT follow
   the visitor's OS theme. Light tokens above are the only palette. */

.cec, .cec * { box-sizing: border-box; }
.cec {
  color-scheme: light;
  margin: 0; max-width: 100%; background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}

/* calculator shell */
.calc {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.panel { min-width: 0; padding: clamp(20px, 3vw, 30px); } /* min-width:0 lets grid columns shrink below content min-width (mobile no-overflow) */
.panel.inputs { border-right: 1px solid var(--line); background: var(--surface); }
.panel.results { background: var(--surface-2); display: flex; flex-direction: column; }

.panel h2 { font-size: 12px; letter-spacing: .13em; text-transform: uppercase; color: var(--ink-soft); font-weight: 600; margin: 0 0 20px; }

/* fields */
.field { margin-bottom: 22px; }
.field:last-child { margin-bottom: 0; }
.flabel { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.flabel span:first-child { font-size: 14px; font-weight: 600; color: var(--ink); }
.flabel .hint { font-size: 12px; color: var(--ink-soft); }

.amount { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--paper); padding: 0 12px; height: 46px; transition: border-color .15s, box-shadow .15s; }
.amount:focus-within { border-color: var(--forest); box-shadow: 0 0 0 3px color-mix(in srgb, var(--forest) 18%, transparent); }
.amount input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; padding: 0; }
.amount input:focus { outline: none; }
.amount .cur { font-size: 14px; font-weight: 600; color: var(--ink-soft); white-space: nowrap; }

.cec input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 100px; margin: 16px 0 4px; background: var(--line-strong); cursor: pointer; }
.cec input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 22px; height: 22px; border-radius: 50%; background: var(--forest); border: 3px solid var(--surface); box-shadow: 0 1px 4px rgba(20,40,30,.35); cursor: grab; }
.cec input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--forest); border: 3px solid var(--surface); box-shadow: 0 1px 4px rgba(20,40,30,.35); cursor: grab; }
.cec input[type="range"]:active::-webkit-slider-thumb { cursor: grabbing; }
.scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* segmented toggles */
.seg { display: inline-flex; padding: 3px; gap: 3px; background: var(--paper); border: 1px solid var(--line-strong); border-radius: 10px; }
.seg button { font: inherit; font-size: 14px; font-weight: 600; color: var(--ink-soft); background: transparent; border: 0; border-radius: 7px; padding: 8px 16px; cursor: pointer; transition: color .15s; }
.seg button[aria-pressed="true"] { background: var(--forest); color: #fff; box-shadow: 0 1px 3px rgba(20,40,30,.28); }

.seg.full { display: flex; }
.seg.full button { flex: 1; }

/* income unlock field */
.field.income { border: 1px dashed var(--line-strong); border-radius: 12px; padding: 16px; background: color-mix(in srgb, var(--brass) 7%, transparent); margin-top: 26px; }
.field.income .flabel span:first-child { display: inline-flex; align-items: center; gap: 7px; }
.field.income .unlock { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--brass); font-weight: 700; }
.field.income .nudge { font-size: 12.5px; color: var(--ink-soft); margin: 9px 0 0; }

/* results */
.headline { margin-bottom: 6px; }
.headline .cap { font-size: 12.5px; letter-spacing: .04em; color: var(--ink-soft); font-weight: 600; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.badge-max { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--brass); border: 1px solid color-mix(in srgb, var(--brass) 45%, transparent); border-radius: 100px; padding: 2px 8px; font-weight: 700; opacity: 0; transform: translateY(2px); transition: opacity .3s, transform .3s; }
.badge-max.on { opacity: 1; transform: none; }
.badge-max.ok { color: var(--forest); border-color: color-mix(in srgb, var(--forest) 45%, transparent); }
.bignum { font-size: clamp(38px, 8vw, 56px); line-height: 1; font-weight: 800; color: var(--brass); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.bignum .u { font-size: .42em; font-weight: 700; color: var(--brass); margin-left: 6px; letter-spacing: 0; }
.sub-of { font-size: 13px; color: var(--ink-soft); margin-top: 8px; }
.sub-of b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

.rows { margin: 22px 0 4px; border-top: 1px solid var(--line); }
.row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.row .k { font-size: 14px; color: var(--ink-soft); }
.row .v { font-size: 18px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.row .v .pre { font-size: 12px; font-weight: 500; color: var(--ink-soft); margin-right: 5px; letter-spacing: .02em; }

.repex { font-size: 11.5px; line-height: 1.5; color: var(--ink-soft); margin: 16px 0 0; padding-top: 14px; }

/* cta block */
.ctaband { margin-top: auto; padding-top: 22px; }
.honesty { font-size: 12.5px; color: var(--ink-soft); margin: 0 0 14px; line-height: 1.5; }
.honesty b { color: var(--forest); font-weight: 600; }
.cta-primary {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  font: inherit; font-size: 16px; font-weight: 700; color: #fff; cursor: pointer;
  background: var(--forest); border: 0; border-radius: 11px; padding: 15px 18px;
  box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--forest) 70%, transparent); transition: background .15s, transform .05s;
}
.cta-primary:hover { background: var(--forest-deep); }
.cta-primary:active { transform: translateY(1px); }
.cta-sub { text-align: center; font-size: 12px; color: var(--ink-soft); margin: 10px 0 0; }

/* reveal form */
.reveal { overflow: hidden; max-height: 0; opacity: 0; transition: max-height .4s ease, opacity .3s ease, margin .4s ease; margin-top: 0; }
.reveal.open { max-height: 620px; opacity: 1; margin-top: 16px; }
.reveal .card { border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); padding: 18px; }

@media (max-width: 720px) {
  .calc { grid-template-columns: 1fr; }
  .panel.inputs { border-right: 0; border-bottom: 1px solid var(--line); }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
