/* ============================================================
   Cumulus — Components
   ============================================================ */

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 9px;
  font-weight: 600;
  font-size: var(--t-sm);
  letter-spacing: -0.01em;
  padding: 11px 20px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  transition: transform 0.12s var(--ease), background 0.2s var(--ease),
              box-shadow 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }

.btn--primary {
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow-2);
}
.btn--primary:hover { background: #16283c; box-shadow: var(--shadow-card); }

.btn--accent {
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
  color: #fff;
  box-shadow: 0 8px 22px -10px var(--accent-glow), var(--shadow-1);
}
.btn--accent:hover { filter: brightness(1.05); box-shadow: 0 12px 30px -10px var(--accent-glow); }

.btn--ghost {
  background: var(--surface);
  color: var(--ink-2);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-1);
}
.btn--ghost:hover { border-color: var(--ink-2); color: var(--ink); }

.btn--quiet { background: none; color: var(--muted); padding: 11px 14px; }
.btn--quiet:hover { color: var(--ink); background: var(--paper-2); }

.btn--lg { padding: 14px 26px; font-size: var(--t-body); }
.btn:disabled { opacity: 0.42; cursor: not-allowed; transform: none; }

/* ---------- Stepper (left rail) ---------- */
.stepper { display: flex; flex-direction: column; }
.step {
  position: relative;
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 13px;
  align-items: start;
  padding: 9px 8px 9px 6px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 0.18s var(--ease);
  text-align: left;
  width: 100%;
}
.step:not(.is-locked):hover { background: var(--paper-2); }
.step.is-locked { cursor: not-allowed; opacity: 0.55; }

/* connector line */
.step::before {
  content: "";
  position: absolute;
  left: 20px; top: 34px; bottom: -9px;
  width: 2px;
  background: var(--line-strong);
}
.step:last-child::before { display: none; }
.step.is-done::before { background: var(--accent); }

.step__num {
  position: relative;
  z-index: 1;
  width: 29px; height: 29px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  font-weight: 600;
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  color: var(--muted);
  transition: all 0.2s var(--ease);
}
.step.is-active .step__num {
  background: var(--ink); border-color: var(--ink); color: #fff;
  box-shadow: 0 0 0 4px rgba(14,27,43,0.10);
}
.step.is-done .step__num {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.step__num svg { width: 15px; height: 15px; }

.step__body { padding-top: 3px; min-width: 0; }
.step__label {
  font-size: var(--t-sm);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
}
.step.is-active .step__label { color: var(--ink); }
.step:not(.is-active) .step__label { color: var(--ink-2); }
.step__sub {
  font-size: var(--t-2xs);
  color: var(--faint);
  margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.step.is-done .step__sub { color: var(--accent-deep); font-family: var(--font-mono); }

/* ---------- Step header (center) ---------- */
.step-head { margin-bottom: 26px; }
.step-head__kicker {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.04em;
  color: var(--accent-deep);
  margin-bottom: 12px;
}
.step-head__kicker .idx {
  background: var(--accent-tint);
  padding: 2px 8px; border-radius: var(--r-pill);
  font-weight: 600;
}
.step-head h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--t-h1);
  letter-spacing: -0.02em;
  line-height: 1.08;
  font-optical-sizing: auto;
}
.step-head p {
  margin-top: 10px;
  color: var(--ink-2);
  font-size: 1.02rem;
  max-width: 54ch;
}

/* ---------- Toolbar (search / sort / filter) ---------- */
.toolbar {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 18px; flex-wrap: wrap;
}
.search {
  display: flex; align-items: center; gap: 9px;
  flex: 1; min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  padding: 9px 15px;
  box-shadow: var(--shadow-1);
  transition: border-color 0.18s, box-shadow 0.18s;
}
.search:focus-within { border-color: var(--accent); box-shadow: var(--shadow-glow); }
.search svg { width: 16px; height: 16px; color: var(--faint); flex: none; }
.search input { border: none; outline: none; background: none; flex: 1; font-size: var(--t-sm); }

.select {
  display: flex; align-items: center; gap: 7px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  padding: 9px 13px;
  box-shadow: var(--shadow-1);
  font-size: var(--t-sm); font-weight: 500;
}
.select select { border: none; outline: none; background: none; font-weight: 600; cursor: pointer; }
.select svg { width: 14px; height: 14px; color: var(--faint); }

/* ---------- Tag chips (filter) ---------- */
.chips { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 18px; }
.chip {
  font-size: var(--t-xs);
  font-weight: 600;
  padding: 6px 13px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--muted);
  transition: all 0.16s var(--ease);
  display: inline-flex; align-items: center; gap: 6px;
}
.chip:hover { border-color: var(--ink-2); color: var(--ink); }
.chip.is-on {
  background: var(--ink); color: #fff; border-color: var(--ink);
}
.chip .x { opacity: 0.7; }

/* ---------- Selectable cards (grid) ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 13px; }
.card-grid--wide { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

.pcard {
  position: relative;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px 16px 15px;
  box-shadow: var(--shadow-1);
  transition: transform 0.16s var(--ease), box-shadow 0.2s var(--ease), border-color 0.18s;
  cursor: pointer;
  display: flex; flex-direction: column; gap: 9px;
}
.pcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--line-strong); }
.pcard.is-sel { border-color: var(--accent); box-shadow: 0 0 0 1.5px var(--accent), var(--shadow-2); }
.pcard.is-sel::after {
  content: "";
  position: absolute; top: 13px; right: 13px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / 13px no-repeat;
}
.pcard__icon {
  width: 38px; height: 38px; border-radius: var(--r-sm);
  display: grid; place-items: center;
  background: var(--accent-tint); color: var(--accent-deep);
}
.pcard__icon svg { width: 20px; height: 20px; }
.pcard__peril { background: var(--loss-high-tint); color: var(--loss-high); }
.pcard__name { font-weight: 700; font-size: 0.96rem; letter-spacing: -0.01em; padding-right: 22px; }
.pcard__desc { font-size: var(--t-xs); color: var(--muted); line-height: 1.45; }
.pcard__meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.tagpill {
  font-family: var(--font-mono);
  font-size: var(--t-2xs);
  letter-spacing: 0.02em;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  background: var(--paper-2);
  color: var(--muted);
}

/* ---------- Option rows (radio / check list) ---------- */
.opt-list { display: flex; flex-direction: column; gap: 11px; }
.opt {
  display: flex; align-items: flex-start; gap: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 15px 17px;
  cursor: pointer;
  box-shadow: var(--shadow-1);
  transition: border-color 0.16s, box-shadow 0.18s, background 0.16s;
}
.opt:hover { border-color: var(--line-strong); }
.opt.is-sel { border-color: var(--accent); background: linear-gradient(0deg, var(--accent-tint), var(--surface)); box-shadow: 0 0 0 1px var(--accent); }
.opt__control {
  flex: none; margin-top: 1px;
  width: 20px; height: 20px;
  border: 1.5px solid var(--line-strong);
  border-radius: 6px;
  display: grid; place-items: center;
  transition: all 0.15s var(--ease);
}
.opt__control.round { border-radius: 50%; }
.opt.is-sel .opt__control { background: var(--accent); border-color: var(--accent); }
.opt.is-sel .opt__control svg { opacity: 1; }
.opt__control svg { width: 13px; height: 13px; color: #fff; opacity: 0; }
.opt.is-sel .opt__control.round::after {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fff;
}
.opt.is-sel .opt__control.round svg { display: none; }
.opt__body { min-width: 0; }
.opt__title { font-weight: 600; font-size: var(--t-body); display: flex; align-items: center; gap: 9px; }
.opt__title .badge { font-family: var(--font-mono); font-size: var(--t-2xs); }
.opt__desc { font-size: var(--t-sm); color: var(--muted); margin-top: 3px; line-height: 1.45; }

.badge {
  font-size: var(--t-2xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: var(--paper-2);
  color: var(--muted);
}
.badge--accent { background: var(--accent-tint); color: var(--accent-deep); }
.badge--rec { background: var(--loss-low-tint); color: var(--loss-low); }

/* ---------- Sliders / fine-tune ---------- */
.field { margin-bottom: 22px; }
.field__head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.field__label { font-weight: 600; font-size: var(--t-body); }
.field__val {
  font-family: var(--font-mono);
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--accent-deep);
  background: var(--accent-tint);
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-variant-numeric: tabular-nums;
}
.field__hint { font-size: var(--t-xs); color: var(--muted); margin-top: 8px; }
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; border-radius: var(--r-pill);
  background: var(--paper-2);
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; border: 2px solid var(--accent);
  box-shadow: var(--shadow-2);
  transition: transform 0.14s var(--ease);
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.12); }
input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; border: 2px solid var(--accent);
  box-shadow: var(--shadow-2);
}

/* ---------- Info panel ---------- */
.info__eyebrow {
  font-family: var(--font-mono);
  font-size: var(--t-2xs);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--faint);
  margin-bottom: 14px;
}
.info__card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 17px;
  box-shadow: var(--shadow-1);
  margin-bottom: 16px;
}
.info__card h4 {
  font-size: var(--t-sm); font-weight: 700;
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px;
}
.info__card h4 svg { width: 15px; height: 15px; color: var(--accent-deep); }
.info__card p { font-size: var(--t-sm); color: var(--ink-2); line-height: 1.5; }
.info__card ul.ticks { margin-top: 10px; display: flex; flex-direction: column; gap: 7px; }
.info__card ul.ticks li {
  font-size: var(--t-sm); color: var(--ink-2);
  display: flex; gap: 8px; align-items: flex-start;
}
.info__card ul.ticks li::before {
  content: ""; flex: none; margin-top: 6px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
}

/* Live running summary */
.summary__list { display: flex; flex-direction: column; }
.summary__row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
  font-size: var(--t-sm);
}
.summary__row:last-child { border-bottom: none; }
.summary__row .k { color: var(--muted); }
.summary__row .v { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.summary__row .v.empty { color: var(--faint); font-weight: 500; font-style: italic; }

.metric-mini {
  display: flex; align-items: baseline; gap: 7px;
  font-family: var(--font-mono);
}
.metric-mini .big { font-size: 1.6rem; font-weight: 600; letter-spacing: -0.03em; }
.metric-mini .unit { font-size: var(--t-xs); color: var(--muted); }

/* ---------- Empty / utility ---------- */
.empty {
  text-align: center; color: var(--faint);
  padding: 40px 20px; font-size: var(--t-sm);
}
.callout {
  display: flex; gap: 12px;
  background: var(--accent-tint);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: var(--r);
  padding: 14px 16px;
  font-size: var(--t-sm);
  color: var(--ink-2);
  margin-top: 18px;
}
.callout svg { width: 18px; height: 18px; color: var(--accent-deep); flex: none; margin-top: 1px; }
