/* Ezinore's SPARKO TERMINAL: the public calculators (/data/calculator and /data/calculator/asset).
   The same black theme, tokens and self-hosted Chivo / Chivo Mono as the sign-in pages (auth.css) and the
   terminal (web/src/styles.css): panels 10px, fields and buttons 7px, green actions with dark text.
   Kept apart from auth.css, whose form rules are written for the account pages. */

   Chivo for text, Chivo Mono for figures, labels and codes (self-hosted, SIL Open Font License). */

@font-face { font-family: "Chivo"; font-style: normal; font-display: swap; font-weight: 100 900; src: url(/assets/fonts/chivo-latin-ext-wght-normal.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Chivo"; font-style: normal; font-display: swap; font-weight: 100 900; src: url(/assets/fonts/chivo-latin-wght-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

/* --- tokens ------------------------------------------------------------------------------- */

:root {
  --sans: "Chivo", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "Chivo Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --bg: #000000; --panel: #0B0B0C; --panel-2: #111214; --border: #1E1F22; --border-strong: #2B2D31;
  --text: #F2F3F5; --muted: #A0A4AB; --faint: #7A7F87; --label: #C2C6CC;
  --brand: #12A37F; --brand-text: #2BC79C; --fill: #12A37F; --fill-hover: #17B98F; --on-fill: #03140F;
  --accent: #F4B832; --accent-bg: rgba(244, 184, 50, .07); --tint: rgba(18, 163, 127, .12); --ring: rgba(18, 163, 127, .5);
  --field: #000000; --field-border: #5C6068; --field-hover: #7A7F87; --negative: #F87171;
  --radius: 10px; --radius-field: 7px;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23A0A4AB' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  color-scheme: dark;
}

/* --- base ---------------------------------------------------------------------------------- */

* { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-width: 320px; background: var(--bg); color: var(--text);
  font: 400 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; font-variant-numeric: tabular-nums;
}
a { color: var(--brand-text); text-underline-offset: 2px; }
a:hover { color: var(--text); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
[hidden] { display: none !important; }

/* --- top bar, lockup and the way into the terminal ----------------------------------------- */

.bar { background: var(--bg); border-bottom: 1px solid var(--border); }
.bar-inner { max-width: 1240px; min-height: 60px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.lockup { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--text); }
.lockup img { display: block; width: 30px; height: 30px; flex: none; }
.lockup-text { display: flex; flex-direction: column; font-family: var(--mono); line-height: 1.15; white-space: nowrap; }
.lockup-text small { font-size: 10px; font-weight: 500; letter-spacing: .12em; color: var(--muted); }
.lockup-text b { font-size: 13.5px; font-weight: 600; letter-spacing: .05em; }
.bar-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.bar-link {
  display: inline-flex; align-items: center; min-height: 34px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-field);
  color: var(--text); font: 500 12px/1 var(--mono); letter-spacing: .04em; text-decoration: none; white-space: nowrap;
}
.bar-link:hover { border-color: var(--brand); color: var(--text); }
.bar-link.fill { background: var(--fill); border-color: var(--fill); color: var(--on-fill); font-weight: 600; }
.bar-link.fill:hover { background: var(--fill-hover); border-color: var(--fill-hover); color: var(--on-fill); }

.strip { border-bottom: 1px solid var(--border); background: linear-gradient(90deg, rgba(18, 163, 127, .12), rgba(18, 163, 127, 0) 75%); }
.strip-inner { max-width: 1240px; margin: 0 auto; padding: 9px 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 18px; font-size: 13px; line-height: 1.45; color: var(--muted); }
.strip-inner b { color: var(--text); font-weight: 600; }
.strip-links { display: inline-flex; flex-wrap: wrap; gap: 4px 16px; font: 500 12px/1.45 var(--mono); letter-spacing: .02em; }
.strip-links a { text-decoration: none; }
.strip-links a:hover { text-decoration: underline; }

/* --- page head ----------------------------------------------------------------------------- */

main { max-width: 1240px; margin: 0 auto; padding: 26px 24px 56px; }
.tabs { display: flex; flex-wrap: wrap; gap: 2px; margin: 0 0 24px; border-bottom: 1px solid var(--border); }
.tabs a { margin-bottom: -1px; padding: 8px 12px 9px; border-bottom: 2px solid transparent; color: var(--muted); font: 500 12px/1.3 var(--mono); letter-spacing: .02em; text-decoration: none; }
.tabs a:hover { color: var(--text); }
.tabs a[aria-current] { color: var(--text); border-bottom-color: var(--brand); }
.heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.eyebrow { margin: 0; color: var(--accent); font: 500 11px/1.4 var(--mono); letter-spacing: .1em; text-transform: uppercase; }
h1 { margin: 10px 0 0; font-size: 34px; line-height: 1.1; font-weight: 700; letter-spacing: -.012em; }
.intro { margin: 10px 0 0; max-width: 760px; color: var(--muted); font-size: 15px; line-height: 1.6; }
.status {
  flex: none; display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px; border: 1px solid var(--border-strong); border-radius: 999px;
  color: var(--muted); font: 500 11px/1.3 var(--mono); letter-spacing: .04em; white-space: nowrap;
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }

/* --- form ---------------------------------------------------------------------------------- */

.workspace { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(320px, .95fr); gap: 32px; align-items: start; }
form, .results { min-width: 0; }
form > section { border-top: 1px solid var(--border); padding: 20px 0; }
form > section:first-child { border-top: 0; padding-top: 0; }
form h2 { margin: 0 0 14px; font: 600 12px/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--text); }
.section-note { margin: 0 0 14px; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.fine { margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.subsection, #bessFields { margin-top: 16px; }

.role-select { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.role-select label {
  position: relative; display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 6px 8px; text-align: center;
  border: 1px solid var(--border-strong); border-radius: var(--radius-field); background: var(--field); color: var(--muted);
  font: 600 13px/1.3 var(--sans); cursor: pointer; transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}
.role-select label:hover { border-color: var(--field-hover); color: var(--text); }
.role-select label:has(input:checked) { border-color: var(--brand); background: var(--tint); color: var(--text); box-shadow: inset 0 0 0 1px var(--brand); }
.role-select label:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.role-select input { position: absolute; opacity: 0; pointer-events: none; }

.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 14px; }
.price-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; color: var(--label); font: 500 11.5px/1.35 var(--mono); letter-spacing: .02em; }
.field.wide { grid-column: 1 / -1; }
.field small { color: var(--muted); font: 400 12px/1.4 var(--sans); letter-spacing: 0; }
.field input, .field select {
  display: block; width: 100%; min-width: 0; height: 42px; margin: 0; padding: 9px 11px; border: 1px solid var(--field-border); border-radius: var(--radius-field);
  background: var(--field); color: var(--text); font: 400 14px/1.4 var(--sans); letter-spacing: 0; transition: border-color .15s ease, box-shadow .15s ease;
}
.field input[type="number"] { font-family: var(--mono); font-size: 13.5px; }
.field input::placeholder { color: var(--faint); opacity: 1; }
.field input:hover, .field select:hover { border-color: var(--field-hover); }
.field input:focus, .field select:focus { outline: 2px solid transparent; border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.field input:disabled, .field select:disabled { opacity: .55; }
.field select { -webkit-appearance: none; appearance: none; padding-right: 32px; background-image: var(--chevron); background-repeat: no-repeat; background-position: right 11px center; cursor: pointer; }
.field select option { background: var(--panel); color: var(--text); }
.toggle { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font: 600 13.5px/1.4 var(--sans); cursor: pointer; }
.toggle input { width: 17px; height: 17px; margin: 0; accent-color: var(--brand); }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 18px 0 0; }
.actions span { color: var(--muted); font-size: 12px; }
.primary {
  min-height: 44px; padding: 0 20px; border: 1px solid var(--fill); border-radius: var(--radius-field); background: var(--fill); color: var(--on-fill);
  font: 600 14px/1.2 var(--sans); letter-spacing: .005em; transition: background-color .15s ease, border-color .15s ease;
}
.primary:hover { background: var(--fill-hover); border-color: var(--fill-hover); }
.primary:focus-visible { outline-offset: 3px; }
.primary:disabled { opacity: .6; cursor: wait; }

/* --- results ------------------------------------------------------------------------------- */

.results { position: sticky; top: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.result-head { padding: 16px 20px 14px; border-bottom: 1px solid var(--border); }
.result-head h2 { margin: 0; font-size: 16px; line-height: 1.3; font-weight: 700; }
.result-head p { margin: 4px 0 0; color: var(--muted); font: 400 11.5px/1.4 var(--mono); }
.result-body { padding: 18px 20px 20px; }
.empty { margin: 0; min-height: 100px; color: var(--muted); }
.error { margin: 0; padding: 10px 12px; border-left: 3px solid var(--negative); border-radius: var(--radius-field); background: rgba(239, 68, 68, .1); color: var(--negative); font-weight: 600; }
.summary, .number-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--border); border-left: 1px solid var(--border); border-radius: var(--radius-field); overflow: hidden; }
.summary div, .number-grid div { min-width: 0; padding: 12px 13px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--bg); }
.summary span, .number-grid span { display: block; color: var(--muted); font: 400 11px/1.35 var(--mono); }
.summary strong, .number-grid strong { display: block; margin-top: 6px; font: 600 16px/1.25 var(--mono); overflow-wrap: anywhere; }
.number-grid strong { font-size: 17px; }
.scenario { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 12px; align-items: baseline; padding: 14px 0; border-bottom: 1px solid var(--border); }
.scenario strong { font-size: 13px; font-weight: 600; }
.scenario .value { font: 600 18px/1.2 var(--mono); text-align: right; }
.scenario .value.negative { color: var(--negative); }
.scenario small { grid-column: 1 / -1; color: var(--muted); font-size: 12px; line-height: 1.45; }
.provenance { margin-top: 16px; padding: 12px 14px; border-left: 2px solid var(--accent); border-radius: 0 var(--radius-field) var(--radius-field) 0; background: var(--accent-bg); color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.provenance strong { color: var(--text); }
.provenance p { margin: 4px 0 0; }
.years { max-height: 230px; overflow: auto; margin-top: 18px; border: 1px solid var(--border); border-radius: var(--radius-field); }
.years table { width: 100%; min-width: 490px; border-collapse: collapse; font: 400 11.5px/1.4 var(--mono); }
.years th, .years td { padding: 7px 8px; border-bottom: 1px solid var(--border); text-align: right; }
.years th { position: sticky; top: 0; background: var(--panel-2); color: var(--muted); font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.years th:first-child, .years td:first-child { text-align: left; }
.years tr:last-child td { border-bottom: 0; }

/* --- call to action: the SPARKO TERMINAL --------------------------------------------------- */

.cta {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 18px 22px; align-items: center; margin-top: 40px; padding: 24px 26px;
  border: 1px solid rgba(18, 163, 127, .4); border-radius: var(--radius);
  background: radial-gradient(120% 160% at 100% 0%, rgba(18, 163, 127, .16), rgba(18, 163, 127, 0) 60%), var(--panel);
}
.cta > img { display: block; width: 46px; height: 46px; }
.cta h2 { margin: 6px 0 0; font-size: 22px; line-height: 1.25; font-weight: 700; letter-spacing: -.005em; text-wrap: balance; }
.cta-text > p:not(.eyebrow) { margin: 6px 0 0; max-width: 640px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.cta-text .cta-note { color: var(--faint); font-size: 12px; }
.cta-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-field); color: var(--text); font: 600 14px/1.2 var(--sans); text-decoration: none; white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease;
}
.button:hover { border-color: var(--brand); color: var(--text); }
.button.fill { background: var(--fill); border-color: var(--fill); color: var(--on-fill); }
.button.fill:hover { background: var(--fill-hover); border-color: var(--fill-hover); color: var(--on-fill); }

footer { max-width: 1240px; margin: 0 auto; padding: 18px 24px 32px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; line-height: 1.55; }

/* --- smaller screens ------------------------------------------------------------------------ */

@media (max-width: 960px) {
  .cta { grid-template-columns: auto minmax(0, 1fr); }
  .cta-actions { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .results { position: static; }
  .heading { flex-direction: column; align-items: flex-start; gap: 14px; }
}
@media (max-width: 560px) {
  .bar-inner, .strip-inner { padding-left: 16px; padding-right: 16px; }
  main { padding: 20px 16px 44px; }
  footer { padding: 18px 16px 28px; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-bottom: 20px; }
  .tabs a { flex: none; padding: 8px 8px 9px; font-size: 11px; }
  h1 { font-size: 27px; }
  .intro { font-size: 14.5px; }
  .fields, .price-grid { grid-template-columns: minmax(0, 1fr); }
  .field.wide { grid-column: auto; }
  .role-select label { font-size: 12.5px; }
  .result-head, .result-body { padding-left: 16px; padding-right: 16px; }
  .cta { grid-template-columns: minmax(0, 1fr); padding: 20px 18px; margin-top: 32px; }
  .cta > img { width: 38px; height: 38px; }
  .cta h2 { font-size: 20px; }
  .cta-actions { display: grid; grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 400px) {
  .bar-inner { gap: 10px; }
  .lockup { gap: 8px; }
  .lockup img { width: 26px; height: 26px; }
  .lockup-text b { font-size: 12px; letter-spacing: .03em; }
  .bar-actions { gap: 6px; }
  .bar-link { padding: 0 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
