/* ============================================================
   iServ — AI Cost & ROI Calculator (scoped widget styles)
   Token-driven: reads event.css :root vars so the dark and
   light themes both work. No hardcoded brand colors.
   ============================================================ */

/* mobile-only sticky live total: keeps the number visible while adjusting inputs */
.calc-mobile-summary { display: none; }
@media (max-width: 900px) {
  .calc-mobile-summary {
    display: flex; align-items: baseline; justify-content: space-between; gap: 14px;
    position: sticky; top: 56px; z-index: 30;
    background: color-mix(in srgb, var(--panel-2) 92%, transparent);
    -webkit-backdrop-filter: blur(9px); backdrop-filter: blur(9px);
    border: 1px solid var(--line); border-radius: 12px;
    padding: 11px 16px; margin-bottom: 6px;
  }
  .calc-mobile-summary .cms-label { font-size: 12px; color: var(--muted); letter-spacing: .02em; }
  .calc-mobile-summary .cms-val { font-family: var(--font-serif); font-size: 25px; color: var(--gold-light); font-variant-numeric: tabular-nums; line-height: 1; }
  .calc-mobile-summary .cms-val span { font-size: 13.5px; color: var(--muted); margin-left: 2px; }
}

/* breadcrumb (cao3.css scopes .crumb to .chero; this page uses .section) */
.calc-page .crumb { display: flex; align-items: center; gap: 10px; font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.calc-page .crumb a { color: var(--gold-light); }
.calc-page .crumb svg { width: 12px; height: 12px; flex: 0 0 auto; color: var(--muted-2); }

/* hero two-column: copy + "what you'll learn" aside */
.calc-hero { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: clamp(28px, 4vw, 56px); align-items: center; }
@media (max-width: 900px) { .calc-hero { grid-template-columns: 1fr; gap: 30px; } }
.calc-hero .shead { max-width: 660px; }
.calc-hero-aside {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: clamp(22px, 2.4vw, 30px);
}
.calc-hero-aside .hero-q { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 13px; }
.calc-hero-aside .hero-q li {
  display: grid; grid-template-columns: 22px 1fr; gap: 11px; align-items: start;
  font-size: 14.5px; line-height: 1.4; color: var(--muted);
}
.calc-hero-aside .hero-q li b { color: var(--cream); font-weight: 500; }
.calc-hero-aside .hero-q svg { width: 19px; height: 19px; color: var(--gold); margin-top: 1px; }
@media (max-width: 460px) { .calc-hero-aside { padding: 20px; } }

/* hero trust/value chips */
.calc-chips { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 24px; }
.calc-chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 500; color: var(--muted);
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; padding: 7px 14px; line-height: 1;
}
.calc-chip svg { width: 14px; height: 14px; color: var(--gold); flex: 0 0 auto; }

/* scroll cue from results to the comparison */
.scroll-cue {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 16px;
  font-size: 12.5px; font-weight: 500; letter-spacing: .04em; color: var(--gold-light);
  text-decoration: none; transition: gap .18s var(--ease);
}
.scroll-cue:hover { gap: 11px; }
.scroll-cue svg { width: 15px; height: 15px; }

.calc {
  --calc-r: 16px;
  --calc-r-sm: 11px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 26px;
  align-items: start;
  margin-top: 38px;
}
@media (max-width: 940px) {
  .calc { grid-template-columns: minmax(0, 1fr); gap: 20px; }
}

/* ---- shared panel surface ---- */
.calc-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--calc-r);
  padding: clamp(20px, 2.4vw, 30px);
  min-width: 0;
}
.calc-card + .calc-card { margin-top: 22px; }

.calc-results {
  position: sticky;
  top: 92px;
  min-width: 0;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--calc-r);
  padding: clamp(20px, 2.4vw, 30px);
}
@media (max-width: 940px) { .calc-results { position: static; } }

.calc-eyebrow {
  font-size: 11.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--gold-light);
  font-weight: 600;
  display: block;
  margin-bottom: 6px;
}
.calc-card h2, .calc-card h3, .calc-results h2, .calc-results h3 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 20px;
  color: var(--cream);
  margin: 0 0 4px;
}
.calc-sub { color: var(--muted-2); font-size: 13.5px; margin: 0 0 18px; }

/* ---- segmented control ---- */
.seg {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  gap: 4px;
  width: 100%;
}
.seg button {
  flex: 1 1 0;
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--muted);
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  padding: 9px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: color .18s var(--ease), background .18s var(--ease);
  white-space: nowrap;
}
.seg button:hover { color: var(--cream); }
.seg button[aria-pressed="true"] {
  background: var(--gold);
  color: #1a1206;
  font-weight: 600;
}
/* long-label segmented controls stack vertically on narrow screens */
@media (max-width: 560px) {
  .seg { flex-direction: column; border-radius: 14px; }
  .seg button { white-space: normal; border-radius: 10px; }
}

/* ---- field rows ---- */
.field { margin-top: 20px; }
.field:first-of-type { margin-top: 0; }
.field-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 9px;
}
.field-head label {
  font-size: 14px;
  font-weight: 500;
  color: var(--cream);
}
.field-hint { display: block; font-size: 12px; color: var(--muted-2); margin-top: 2px; font-weight: 400; }
.field-val {
  font-family: var(--font-serif);
  font-size: 19px;
  color: var(--gold-light);
  font-weight: 500;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* range slider */
input[type="range"].calc-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: var(--line);
  outline: none;
  cursor: pointer;
}
input[type="range"].calc-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--gold);
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 1px var(--gold-dim);
  cursor: pointer;
  transition: transform .12s var(--ease);
}
input[type="range"].calc-range::-webkit-slider-thumb:hover { transform: scale(1.12); }
input[type="range"].calc-range::-moz-range-thumb {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--gold);
  border: 3px solid var(--bg);
  cursor: pointer;
}
input[type="range"].calc-range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--gold-dim); }

/* number / select inputs */
.calc-input, .calc-select {
  width: 100%;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--calc-r-sm);
  color: var(--cream);
  font: inherit;
  font-size: 15px;
  padding: 11px 13px;
  transition: border-color .18s var(--ease);
}
.calc-input:focus, .calc-select:focus { outline: none; border-color: var(--gold); }
.calc-input::-webkit-outer-spin-button,
.calc-input::-webkit-inner-spin-button { opacity: .4; }

.field-pair { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 14px; }
@media (max-width: 460px) { .field-pair { grid-template-columns: 1fr; } }

/* prefix-wrapped input (e.g. $) */
.calc-affix { position: relative; }
.calc-affix > span {
  position: absolute; top: 50%; left: 13px; transform: translateY(-50%);
  color: var(--muted-2); font-size: 15px; pointer-events: none;
}
.calc-affix .calc-input { padding-left: 26px; }

/* advanced disclosure */
.calc-adv { margin-top: 26px; border-top: 1px solid var(--line-soft); padding-top: 18px; }
.calc-adv > summary {
  list-style: none;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--gold-light);
  display: flex; align-items: center; gap: 8px;
}
.calc-adv > summary::-webkit-details-marker { display: none; }
.calc-adv > summary svg { width: 15px; height: 15px; transition: transform .2s var(--ease); }
.calc-adv[open] > summary svg { transform: rotate(90deg); }
.calc-adv .field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
@media (max-width: 560px) { .calc-adv .field-grid { grid-template-columns: 1fr; } }
.calc-adv .field { margin-top: 0; }

/* ---- RESULTS ---- */
.calc-headline {
  font-size: 12px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted-2); font-weight: 600; margin-bottom: 16px;
}
.kpi-hero { margin-bottom: 22px; }
.kpi-hero .kpi-label { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.kpi-hero .kpi-big {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(38px, 6vw, 52px);
  line-height: 1;
  color: var(--cream);
  font-variant-numeric: tabular-nums;
}
.kpi-hero .kpi-big .unit { font-size: 18px; color: var(--muted); font-weight: 400; margin-left: 4px; }
.kpi-hero .kpi-side { font-size: 13.5px; color: var(--gold-light); margin-top: 6px; }

.kpi-grid {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr);
  gap: 1px;
  background: var(--line-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--calc-r-sm);
  overflow: hidden;
}
.kpi {
  background: var(--panel);
  padding: 15px 16px;
}
.kpi .kpi-label { font-size: 12px; color: var(--muted-2); margin-bottom: 5px; line-height: 1.3; }
.kpi .kpi-num {
  font-family: var(--font-serif); font-weight: 500; font-size: 24px; color: var(--cream);
  font-variant-numeric: tabular-nums;
}
.kpi .kpi-num.pos { color: var(--gold-light); }
.kpi .kpi-foot { font-size: 11.5px; color: var(--muted-2); margin-top: 3px; }

/* verdict line */
.verdict {
  margin-top: 22px;
  padding: 16px 18px;
  border-radius: var(--calc-r-sm);
  background: linear-gradient(180deg, rgba(209,174,109,.07), rgba(209,174,109,.02));
  border: 1px solid var(--line);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--muted);
}
.verdict b { color: var(--cream); font-weight: 600; }

/* comparison bars */
.bars { margin-top: 8px; display: grid; gap: 16px; }
.bar-row .bar-top { display: flex; justify-content: space-between; font-size: 13.5px; margin-bottom: 7px; }
.bar-row .bar-top .bar-name { color: var(--muted); }
.bar-row .bar-top .bar-name b { color: var(--cream); font-weight: 500; }
.bar-row .bar-top .bar-amt { color: var(--cream); font-variant-numeric: tabular-nums; font-weight: 500; }
.bar-track { height: 12px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line-soft); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; }
.bar-fill.is-gold { background: linear-gradient(90deg, var(--gold-deep), var(--gold)); opacity: .42; }
.bar-fill.is-muted { background: var(--muted-2); opacity: .42; }
.bar-fill.is-best { background: linear-gradient(90deg, var(--gold), var(--gold-light)); box-shadow: 0 0 14px -2px var(--gold-dim); }
.bar-tag {
  display: inline-block; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
  color: #1a1206; background: var(--gold); border-radius: 999px; padding: 1px 8px; margin-left: 8px; font-weight: 700;
  vertical-align: middle;
}

/* budget status pill */
.status-pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 600; padding: 5px 12px; border-radius: 999px;
}
.status-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; }
.status-pill.ok { color: #8fe3b0; background: rgba(80,200,130,.12); }
.status-pill.ok::before { background: #5ec88a; }
.status-pill.warn { color: var(--gold-light); background: rgba(209,174,109,.14); }
.status-pill.warn::before { background: var(--gold); }
.status-pill.over { color: #f0a8a0; background: rgba(220,110,95,.13); }
.status-pill.over::before { background: #d96e5f; }

/* range strip (conservative / realistic / optimistic) */
.scen { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 1px; background: var(--line-soft); border-radius: var(--calc-r-sm); overflow: hidden; border: 1px solid var(--line-soft); }
.scen div { background: var(--panel); padding: 13px 12px; text-align: center; }
.scen div.mid { background: var(--panel-2); }
.scen .scen-k { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted-2); margin-bottom: 5px; }
.scen .scen-v { font-family: var(--font-serif); font-size: 19px; color: var(--cream); font-variant-numeric: tabular-nums; }
.scen div.mid .scen-v { color: var(--gold-light); }

/* result action buttons */
.calc-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.calc-actions .btn { flex: 1 1 auto; }

/* lead form */
.calc-lead {
  margin-top: 26px; border-top: 1px solid var(--line-soft); padding-top: 22px;
}
.calc-lead .field-pair { margin-top: 14px; }
.calc-lead .consent { display: flex; gap: 9px; align-items: flex-start; margin-top: 14px; font-size: 12.5px; color: var(--muted-2); }
.calc-lead .consent input { margin-top: 2px; accent-color: var(--gold); }
.calc-lead .lead-msg { font-size: 13px; margin-top: 12px; min-height: 18px; }
.calc-lead .lead-msg.ok { color: #8fe3b0; }
.calc-lead .lead-msg.err { color: #f0a8a0; }

/* assumptions table */
.assume-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.assume-table th, .assume-table td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.assume-table th { color: var(--muted-2); font-weight: 600; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; }
.assume-table td:nth-child(2) { color: var(--cream); font-variant-numeric: tabular-nums; white-space: nowrap; }
.assume-table td:last-child { color: var(--muted); }
.assume-table a { color: var(--gold-light); }

/* tiny footnote ref */
.calc-foot { font-size: 12px; color: var(--muted-2); margin-top: 16px; line-height: 1.5; }

/* print */
@media print {
  body { background: #fff !important; }
  #lux-header, #lux-footer, .calc-actions, .calc-lead, .seg, .calc-adv, .no-print { display: none !important; }
  .calc { grid-template-columns: 1fr 1fr; }
  .calc-card, .calc-results { border: 1px solid #ccc; background: #fff !important; box-shadow: none; }
  * { color: #111 !important; }
  .bar-fill.is-gold, .bar-fill.is-best { background: #b8924a !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
