/* ───────── Tokens ───────── */
:root {
  /* Warm-tinted neutrals */
  --bg:           oklch(0.985 0.004 80);
  --bg-soft:      oklch(0.965 0.005 80);
  --surface:      oklch(1 0 0);
  --line:         oklch(0.91 0.006 80);
  --line-strong:  oklch(0.84 0.008 80);
  --ink:          oklch(0.20 0.012 80);
  --ink-2:        oklch(0.42 0.010 80);
  --ink-3:        oklch(0.62 0.008 80);

  /* Accent — indigo-violet */
  --acc:          oklch(0.52 0.18 285);
  --acc-soft:     oklch(0.95 0.04 285);
  --acc-ink:      oklch(0.30 0.14 285);

  --good:         oklch(0.62 0.13 155);
  --warn:         oklch(0.66 0.16 50);
  --low:          oklch(0.62 0.05 240);

  --r-sm: 6px;
  --r:    10px;
  --r-lg: 14px;

  --shadow-sm: 0 1px 0 oklch(0.90 0.006 80);
  --shadow:    0 1px 2px oklch(0.85 0.01 80 / 0.5), 0 4px 14px oklch(0.80 0.01 80 / 0.18);

  --font-sans: 'Inter', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 14px;
  line-height: 1.45;
}

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }

/* ───────── Top bar ───────── */
.app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.brand { display: flex; align-items: center; gap: 14px; }
.brand-logo {
  height: 36px;
  width: auto;
  display: block;
  object-fit: contain;
}
.brand-divider {
  width: 1px;
  height: 28px;
  background: var(--line-strong);
}
.brand-name { font-weight: 600; font-size: 14px; letter-spacing: -0.01em; }
.brand-sub  { font-size: 12px; color: var(--ink-3); }

.topbar-right { display: flex; align-items: center; gap: 16px; }

.topbar-meta { display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: 12px; }
.topbar-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--ink-3); display: inline-block; }

/* ───────── Language toggle ───────── */
.lang-toggle {
  display: inline-flex;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.lang-opt {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
  background: transparent;
  border: 0;
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 140ms, color 140ms;
}
.lang-opt:hover { color: var(--ink); }
.lang-opt.is-on {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm), 0 1px 3px oklch(0.80 0.01 80 / 0.25);
}
.lang-flag {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 2px 5px;
  border-radius: 3px;
  background: var(--ink);
  color: var(--surface);
}
.lang-opt.is-on .lang-flag { background: var(--acc); }
.lang-name { font-size: 12px; }
@media (max-width: 700px) {
  .lang-name { display: none; }
}

/* ───────── Grid ───────── */
.grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 0;
  flex: 1;
  min-height: 0;
}

.panel {
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.panel.inputs   { background: var(--bg-soft); border-right: 1px solid var(--line); }
.panel.decision { background: var(--bg); }

.panel-head { display: flex; flex-direction: column; gap: 4px; }
.panel-head.row { flex-direction: row; align-items: flex-end; justify-content: space-between; gap: 24px; }
.panel-eyebrow {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
}
.panel-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}

/* ───────── Form fields ───────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
}
.field label .hint { color: var(--ink-3); font-weight: 400; }

.text-input {
  font-family: var(--font-sans);
  font-size: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  outline: none;
  transition: border-color 120ms, box-shadow 120ms;
  resize: vertical;
}
.text-input:focus { border-color: var(--acc); box-shadow: 0 0 0 3px oklch(0.52 0.18 285 / 0.15); }

.money-input {
  display: flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  overflow: hidden;
  transition: border-color 120ms, box-shadow 120ms;
}
.money-input:focus-within { border-color: var(--acc); box-shadow: 0 0 0 3px oklch(0.52 0.18 285 / 0.15); }
.money-prefix {
  padding: 0 12px;
  font-family: var(--font-mono);
  color: var(--ink-3);
  border-right: 1px solid var(--line);
  align-self: stretch;
  display: grid; place-items: center;
  background: var(--bg-soft);
}
.money-input input {
  flex: 1;
  border: 0;
  background: transparent;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 16px;
  padding: 11px 12px;
  outline: none;
  color: var(--ink);
}

/* ───────── Formula box ───────── */
.formula {
  margin-top: auto;
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px 16px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.formula-head {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
  margin-bottom: 4px;
}
.formula-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-2);
  padding: 4px 0;
}
.formula-row.accent { color: var(--acc-ink); font-weight: 600; border-top: 1px dashed var(--line); padding-top: 8px; margin-top: 4px; }
.formula-name { color: var(--ink-3); }

/* ───────── Buttons ───────── */
.actions { display: flex; gap: 8px; }
.btn {
  flex: 1;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 120ms, border-color 120ms, transform 80ms;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--ink); color: var(--surface); }
.btn.primary:hover { background: oklch(0.30 0.012 80); }
.btn.ghost { background: transparent; border-color: var(--line-strong); color: var(--ink-2); }
.btn.ghost:hover { background: var(--bg-soft); }

/* ───────── Band readout ───────── */
.band-readout {
  text-align: right;
}
.band-readout-label { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.band-readout-value { font-size: 14px; font-weight: 600; color: var(--ink); margin-top: 2px; }

/* ───────── Quadrants ───────── */
.quad-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.quad {
  text-align: left;
  font-family: inherit;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color 140ms, box-shadow 140ms, transform 80ms;
}
.quad:hover { border-color: var(--line-strong); }
.quad.is-selected {
  border-color: var(--acc);
  box-shadow: 0 0 0 3px oklch(0.52 0.18 285 / 0.12), var(--shadow);
}
.quad:active { transform: translateY(1px); }

.quad-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.quad-tag { display: flex; gap: 6px; }
.quad-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--ink-2);
  border: 1px solid var(--line);
}
.quad.is-selected .quad-pill {
  background: var(--acc-soft);
  color: var(--acc-ink);
  border-color: transparent;
}
.quad-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  transition: background 140ms, border-color 140ms;
}
.quad-dot.is-on {
  background: var(--acc);
  border-color: var(--acc);
  box-shadow: inset 0 0 0 3px var(--surface);
}

.quad-price-label { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.quad-price-value { font-size: 28px; font-weight: 600; color: var(--ink); margin-top: 2px; letter-spacing: -0.02em; }

.quad-rows { display: flex; flex-direction: column; gap: 8px; }
.quad-row {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}
.quad-row-label { color: var(--ink-3); }
.quad-row-value { color: var(--ink-2); font-size: 12px; }
.bar-track { display: block; height: 4px; background: var(--bg-soft); border-radius: 999px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--ink); border-radius: 999px; }
.bar-fill.alt { background: var(--acc); }

.quad-foot {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  font-size: 12px;
  color: var(--ink-2);
}
.foot-label { color: var(--ink-3); margin-right: 6px; }

/* ───────── Decision slider ───────── */
.decider {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px 20px;
}
.decider-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 16px;
}
.decider-label { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.decider-value { font-size: 32px; font-weight: 600; letter-spacing: -0.02em; color: var(--acc-ink); margin-top: 2px; }
.decider-bounds { font-size: 12px; color: var(--ink-3); display: flex; gap: 8px; align-items: center; }
.decider-bounds-sep { color: var(--ink-3); }

.decider-track {
  position: relative;
  height: 30px;
  display: flex;
  align-items: center;
}
.decider-track::before {
  content: '';
  position: absolute;
  left: 0; right: 0;
  height: 6px;
  background: var(--bg-soft);
  border-radius: 999px;
  border: 1px solid var(--line);
}
.decider-fill {
  position: absolute;
  left: 0;
  height: 6px;
  background: linear-gradient(90deg, var(--ink) 0%, var(--acc) 100%);
  border-radius: 999px;
  pointer-events: none;
}
.decider-thumb {
  position: absolute;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--surface);
  border: 2.5px solid var(--acc);
  box-shadow: var(--shadow);
  transform: translateX(-50%);
  pointer-events: none;
}
.decider-track input[type="range"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  margin: 0;
}
.decider-marks {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 11px;
  color: var(--ink-3);
}

/* ───────── Verdict ───────── */
.verdict {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--ink-3);
  border-radius: var(--r);
  padding: 16px 18px;
}
.verdict.tone-good { border-left-color: var(--good); }
.verdict.tone-warn { border-left-color: var(--warn); }
.verdict.tone-low  { border-left-color: var(--low);  }
.verdict-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
}
.verdict-label { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.verdict-status { font-size: 14px; font-weight: 600; color: var(--ink); }
.tone-good .verdict-status { color: var(--good); }
.tone-warn .verdict-status { color: var(--warn); }
.tone-low  .verdict-status { color: var(--low);  }

.verdict-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.stat-k { font-size: 11px; color: var(--ink-3); margin-bottom: 4px; }
.stat-v { font-size: 16px; font-weight: 600; color: var(--ink); }

/* ───────── Sensitivity ───────── */
.sens {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px 18px;
}
.sens-head {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 12px;
}
.sens-grid {
  display: grid;
  gap: 4px;
}
.sens-h {
  font-size: 11px;
  color: var(--ink-3);
  text-align: center;
  padding: 6px 4px;
}
.sens-cell {
  font-family: inherit;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px 6px;
  cursor: pointer;
  text-align: center;
  background:
    linear-gradient(
      var(--bg-soft),
      var(--bg-soft)
    );
  position: relative;
  transition: border-color 120ms;
}
.sens-cell::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--r-sm);
  background: var(--acc);
  opacity: calc(var(--intensity, 0) * 0.10);
  pointer-events: none;
}
.sens-cell:hover { border-color: var(--line-strong); }
.sens-cell.is-picked { border-color: var(--acc); box-shadow: 0 0 0 2px oklch(0.52 0.18 285 / 0.15); }
.sens-cell .mono { font-size: 12px; color: var(--ink); position: relative; }

/* ───────── Responsive ───────── */
@media (max-width: 1024px) {
  .grid { grid-template-columns: 1fr; }
  .panel.inputs { border-right: 0; border-bottom: 1px solid var(--line); }
  .verdict-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .quad-grid { grid-template-columns: 1fr; }
  .panel { padding: 20px; }
  .topbar { padding: 14px 20px; }
}
