/* ── Card positioning ───────────────────────────────────────────────────── */
.msg.cmp-msg {
  margin: 0 auto;
  max-width: 620px;
  width: 100%;
}
.cmp-msg .msg-content { flex: 1; min-width: 0; }

/* The one assistant message that keeps a surface: it is a document, not prose. */
.cmp-bubble {
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg-2);
  padding: 20px;
  box-shadow: 0 18px 44px rgba(0,0,0,.32);
}

.cmp-intro { font-size: 13px; color: var(--text-2); margin-bottom: 16px; }
.cmp-intro strong { color: var(--text); font-weight: 600; }

.cmp-empty { color: var(--text-3); font-size: 13px; }

/* ── Scenario tabs ────────────────────────────────────────────────────────
   Two real, tappable cards. They must not be filled with solid accent — that is
   the CTA's job — but they must still read as controls, so they get a surface,
   a border and an explicit cue. */

.cmp-tabs-hint,
.cmp-next-hint {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-4);
  margin-bottom: 8px;
}

.cmp-tabs { display: flex; gap: 8px; margin-bottom: 18px; }

.cmp-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 13px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: border-color .15s, background .15s, transform .12s;
}
.cmp-tab:hover:not(.active) {
  border-color: var(--accent);
  background: rgba(124,131,255,.10);
  transform: translateY(-1px);
}
.cmp-tab.active {
  border-color: var(--accent);
  background: rgba(124,131,255,.14);
}

.cmp-tab-cue {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-4);
}
.cmp-tab.active .cmp-tab-cue { color: var(--accent-2); }

.cmp-tab-label { font-size: 12.5px; font-weight: 600; color: var(--text-3); transition: color .15s; }
.cmp-tab.active .cmp-tab-label { color: var(--text); }

/* The figure keeps its meaning in both states — the selected one is simply
   brighter, never recoloured. */
.cmp-tab-amount {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.5px;
  font-variant-numeric: tabular-nums;
  opacity: .55;
  transition: opacity .15s;
}
.cmp-tab-amount.positive { color: var(--lime); }
.cmp-tab-amount.negative { color: var(--red); }
.cmp-tab.active .cmp-tab-amount { opacity: 1; }

.cmp-panel[hidden] { display: none; }

/* ── Headline: what this invoice would have cost ──────────────────────────
   The one figure on the card that extrapolates nothing, so it gets the size, the
   colour and the counter. Everything below it is an estimate and must read as one. */

.cmp-headline { margin-bottom: 16px; }

.cmp-headline-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-4);
  margin-bottom: 6px;
}

.cmp-bill {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 4px;
}

.cmp-amount {
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 700;
  letter-spacing: -2px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.cmp-amount.positive { color: var(--lime); }
.cmp-amount.negative { color: var(--red); }

/* The bill the user actually paid, struck through: the before half of the comparison. */
.cmp-bill-was {
  font-size: 13px;
  color: var(--text-4);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  font-variant-numeric: tabular-nums;
}

.cmp-headline-meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .2px;
  color: var(--text-3);
}
.cmp-delta { font-weight: 700; }
.cmp-delta.positive { color: var(--lime); }
.cmp-delta.negative { color: var(--red); }

/* ── The two bars ─────────────────────────────────────────────────────────
   One measure in two states, so this is not a categorical pair: the reference
   bar carries no hue and only the cheaper one is tinted. Amber-vs-green failed
   the deuteranopia separation check (ΔE 1.8), and the labelled gap is what
   carries the reading either way. */

.cmp-meter { margin-bottom: 16px; }

.cmp-meter-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
}
.cmp-meter-label {
  font-size: 12px;
  color: var(--text-2);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cmp-meter-label strong { color: var(--text); font-weight: 600; }
.cmp-meter-value {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: #C6CBDC;
  font-variant-numeric: tabular-nums;
}
.cmp-meter-value.best { color: var(--lime); }

.cmp-bar { height: 12px; border-radius: 6px; }
.cmp-bar-ref  { background: var(--ref-bar); margin-bottom: 14px; }
.cmp-bar-best { background: var(--lime-bar); }

/* 2px of surface between the fill and the gap, so the two never read as one bar */
.cmp-bar-split { display: flex; gap: 2px; height: 12px; }
.cmp-bar-gap {
  flex: 1;
  min-width: 0;
  border: 1px dashed #3A4155;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.cmp-bar-gap span {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .2px;
  color: var(--text-3);
  white-space: nowrap;
}

/* Winning tariff, shown only when there is no meter to name it */
.cmp-best {
  margin-bottom: 14px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-3);
}
.cmp-best strong { color: var(--text); font-weight: 600; }

/* ── Annual projection ───────────────────────────────────────────────────
   A band and its caveat, never a lone number: this one extrapolates a year the
   user has not lived. */

.cmp-annual {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  padding: 13px 16px;
  margin-bottom: 12px;
}
.cmp-annual-fig { flex-shrink: 0; }
.cmp-annual-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-4);
  margin-bottom: 3px;
}
/* Deliberately smaller than .cmp-amount — the projection never outranks the measurement. */
.cmp-proj-amount {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -1px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.cmp-proj-amount.positive { color: var(--lime); }
.cmp-proj-amount.negative { color: var(--red); }

.cmp-annual-sep { width: 1px; align-self: stretch; background: var(--border); }
.cmp-annual-note { font-size: 11.5px; line-height: 1.5; color: var(--text-3); }
.cmp-annual-note strong { color: #C6CBDC; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ── Metric tiles ────────────────────────────────────────────────────────── */

.cmp-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.cmp-grid:has(.cmp-item:nth-child(2):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.cmp-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
}
.cmp-item:has(.cmp-val.best) { border-color: rgba(192,241,78,.22); background: #191D1C; }

.cmp-key {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-4);
}
.cmp-val { font-size: 15px; font-weight: 700; color: #C6CBDC; font-variant-numeric: tabular-nums; }
.cmp-val.yours { color: var(--elec); }
.cmp-val.best  { color: var(--lime); }
/* The unit rides with the number but stays subordinate to it — muted, never
   tinted by the .yours/.best accent it sits inside. */
.cmp-unit {
  margin-left: 3px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  color: var(--text-3);
}

/* ── Alternatives: reference material, folded away by default ───────────── */

.cmp-alts { border-top: 1px solid var(--line); padding-top: 10px; }

.cmp-alts summary {
  cursor: pointer;
  list-style: none;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-3);
  padding: 3px 0;
  transition: color .15s;
}
.cmp-alts summary::-webkit-details-marker { display: none; }
.cmp-caret { display: inline-block; margin-right: 7px; transition: transform .15s; }
.cmp-alts[open] .cmp-caret { transform: rotate(90deg); }
.cmp-alts summary:hover { color: #C6CBDC; }

.cmp-alt-list { margin-top: 8px; }
.cmp-alt-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #1F2531;
}
.cmp-alt-row:last-child { border-bottom: none; padding-bottom: 0; }
.cmp-alt-id { min-width: 0; }
.cmp-alt-tariff  { font-size: 12.5px; color: #C6CBDC; }
.cmp-alt-company { font-size: 11px; color: var(--text-4); }
.cmp-alt-price {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

/* Footnote for what the figures rest on — days invoiced, power term, assumed profile. */
.cmp-basis-note {
  font-family: var(--font-mono);
  font-size: 9.5px;
  line-height: 1.65;
  color: var(--text-4);
  margin-top: 10px;
}

/* ── Next steps ──────────────────────────────────────────────────────────
   Chips, not a paragraph: they seed the chat rather than assert the answer.
   They wrap instead of scrolling — three questions in Spanish do not fit one
   line on a phone, and a horizontal scroller hides the third behind an edge
   nobody thinks to drag. */

.cmp-next {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.cmp-next-chips { display: flex; flex-wrap: wrap; gap: 7px; }

.cmp-chip {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s, transform .12s;
}
.cmp-chip:hover {
  border-color: var(--accent);
  background: rgba(124,131,255,.12);
  color: var(--text);
  transform: translateY(-1px);
}
.cmp-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.cmp-footer {
  font-size: 11.5px;
  color: var(--text-4);
  margin-top: 12px;
}

/* ── Media queries — always AFTER base styles ───────────────────────────── */

@media (max-width: 1100px) {
  .msg.cmp-msg { max-width: 520px; }
}

@media (max-width: 860px) {
  .msg.cmp-msg          { max-width: 100%; }
  .cmp-msg .msg-avatar  { display: none; }
}

@media (max-width: 600px) {
  .cmp-bubble        { padding: 16px; border-radius: 18px; }
  .cmp-amount        { font-size: 38px; letter-spacing: -1.7px; }
  .cmp-grid          { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cmp-annual        { flex-direction: column; align-items: flex-start; gap: 10px; }
  .cmp-annual-sep    { display: none; }
  .cmp-bar-gap span  { display: none; }
}
