/* =============================================================================
   Revenue Recovery AI — public interactive demo (synthetic data)
   Hand-written CSS. Extends site/styles.css, which must be loaded first: the
   design tokens (--surface, --line, --green, ...), .wrap, .card, .tag, .btn,
   .stats, .ticks/.crosses, .table-wrap, .callout and the site chrome all come
   from there. This file only adds what the demo needs.

   Constraint that shapes everything below: the hosting Content-Security-Policy
   is `style-src 'self'`, so there is not a single inline style attribute and no
   script may set one. Every visual state is a class or a native <progress>.
   ========================================================================== */

/* -------------------------------------------------------------- chrome --- */

.brand__stack { display: flex; flex-direction: column; line-height: 1.25; }
.brand__sub {
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: var(--text-3);
}

.demo-strip {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 10px;
  margin: 0;
  padding: 12px clamp(16px, 3vw, 32px);
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--text-2);
  background: rgba(56, 189, 248, 0.07);
  border-bottom: 1px solid var(--line);
}
.demo-strip > span:last-child { max-width: 104ch; }

.demo-strip__dot {
  flex: none;
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--sky);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.15);
}

/* ----------------------------------------------------------- dashboard --- */

.demo-second-row { margin-top: clamp(16px, 2vw, 22px); }

.num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.demo-mini {
  margin: 0;
  font-size: 0.84rem;
  color: var(--text-3);
}

/* definition list: stacked on narrow screens, two columns once there is room */
.kv {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin: 0;
  border-top: 1px solid var(--line);
}
.kv > div {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.kv > div:last-child { border-bottom: 0; }
.kv dt {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}
.kv dd { margin: 0; font-size: 0.92rem; color: var(--text-2); }
.kv--tight dd { font-size: 0.9rem; }

@media (min-width: 620px) {
  .kv > div { grid-template-columns: minmax(150px, 210px) minmax(0, 1fr); gap: 0 18px; align-items: baseline; }
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin-top: clamp(22px, 2.6vw, 30px);
}
.toolbar__hint { font-size: 0.84rem; color: var(--text-3); }

/* ------------------------------------------------------------- reveal ---- */

.reveal {
  margin-top: clamp(18px, 2.2vw, 24px);
  padding: clamp(18px, 2vw, 24px);
  background: rgba(255, 255, 255, 0.022);
  border: 1px solid var(--line);
  border-left: 3px solid var(--sky);
  border-radius: var(--radius-sm);
}
.reveal[hidden] { display: none; }
.reveal__title { margin-bottom: 0.35em; }
.reveal__lead { max-width: 84ch; font-size: 0.92rem; }

/* ----------------------------------------------------------- timeline ---- */

.timeline {
  position: relative;
  margin: 0;
  padding: 0 0 0 22px;
  list-style: none;
  border-left: 1px solid var(--line-strong);
}
.timeline__item { position: relative; padding: 0 0 18px; }
.timeline__item:last-child { padding-bottom: 0; }
.timeline__item::before {
  content: "";
  position: absolute;
  left: -27px;
  top: 7px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
}
.timeline__item--end::before { background: var(--green-deep); border-color: var(--green); }
.timeline__when {
  display: block;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}
.timeline__item p { margin: 2px 0 0; font-size: 0.9rem; }

/* -------------------------------------------------------------- cases ---- */

.cases {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(16px, 2vw, 22px);
  margin-top: clamp(20px, 2.6vw, 28px);
}
@media (min-width: 980px) {
  .cases { grid-template-columns: 322px minmax(0, 1fr); align-items: start; }
}

.cases__list { display: flex; flex-direction: column; gap: 10px; min-width: 0; }

.case-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
  padding: 13px 15px;
  text-align: left;
  font: inherit;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.case-item:hover { border-color: var(--line-strong); }
.case-item[aria-selected="true"] {
  background: var(--surface-2);
  border-color: var(--line-strong);
  border-left-color: var(--green);
}
.case-item__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.case-item__amount {
  font-family: var(--mono);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.case-item__title { font-size: 0.96rem; font-weight: 620; color: var(--text); }
.case-item__meta { font-size: 0.8rem; color: var(--text-3); }

.cases__detail {
  min-width: 0;
  padding: clamp(18px, 2vw, 26px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.cases__detail:focus-visible { outline: 2px solid var(--sky); outline-offset: 3px; }

.detail__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px 22px;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.detail__head h3 { margin: 0.35em 0 0.15em; }
.detail__id { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.detail__customer { margin: 0; font-size: 0.86rem; color: var(--text-3); overflow-wrap: anywhere; }
.detail__amount { text-align: right; }
.detail__amount-num {
  display: block;
  font-family: var(--mono);
  font-size: clamp(1.5rem, 1.2rem + 1vw, 1.9rem);
  font-weight: 700;
  line-height: 1.1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.detail__amount-label { font-size: 0.76rem; color: var(--text-3); }

.detail__sub {
  margin: clamp(20px, 2.4vw, 26px) 0 0.5em;
  font-size: 0.98rem;
}
.detail__hint { margin-bottom: 0.6em; font-size: 0.84rem; color: var(--text-3); }

.mono {
  font-family: var(--mono);
  font-size: 0.85em;
  color: var(--text-2);
  overflow-wrap: anywhere;
}

/* -------------------------------------------------------------- stamps --- */

.stamp {
  margin-top: 14px;
  padding: 13px 16px;
  background: rgba(255, 255, 255, 0.022);
  border: 1px solid var(--line);
  border-left: 3px solid var(--text-3);
  border-radius: var(--radius-sm);
}
.stamp__label {
  margin: 0 0 0.25em;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}
.stamp__label span { color: inherit; }
.stamp__note { margin: 0; font-size: 0.9rem; }

.stamp--ok    { border-left-color: var(--green); background: rgba(34, 197, 94, 0.055); }
.stamp--ok .stamp__label span    { color: #56D98C; }
.stamp--info  { border-left-color: var(--sky); background: rgba(56, 189, 248, 0.05); }
.stamp--info .stamp__label span  { color: #6FCDEC; }
.stamp--warn  { border-left-color: var(--amber); background: rgba(245, 176, 68, 0.06); }
.stamp--warn .stamp__label span  { color: #F0B864; }
.stamp--block { border-left-color: var(--rose); background: rgba(249, 115, 98, 0.06); }
.stamp--block .stamp__label span { color: #F79585; }

/* ---------------------------------------------------------------- json --- */

.json {
  margin: 0;
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--text-2);
  background: #0A0C10;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  /* pre-wrap + anywhere keeps a long synthetic value inside the box on a 390px
     screen instead of introducing a horizontal scrollbar anywhere. */
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* --------------------------------------------------------------- gates --- */

.gates {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: gate;
}

.gate {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 12px;
  padding: 11px 14px;
  background: rgba(255, 255, 255, 0.018);
  border: 1px solid var(--line);
  border-left: 2px solid var(--text-3);
  border-radius: 8px;
}
.gate__name { font-size: 0.92rem; font-weight: 620; color: var(--text); }
.gate__status {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--text-3);
  white-space: nowrap;
}
.gate__note { grid-column: 1 / -1; font-size: 0.85rem; color: var(--text-3); }

.gate--pass    { border-left-color: var(--green); }
.gate--pass .gate__status    { color: #56D98C; }
.gate--skip    { border-left-color: var(--line-strong); }
.gate--sim     { border-left-color: var(--sky); }
.gate--sim .gate__status     { color: #6FCDEC; }
.gate--pending { border-left-color: var(--amber); background: rgba(245, 176, 68, 0.055); }
.gate--pending .gate__status { color: #F0B864; }
.gate--blocked { border-left-color: var(--rose); background: rgba(249, 115, 98, 0.055); }
.gate--blocked .gate__status { color: #F79585; }
.gate--idle .gate__status    { color: var(--text-3); }

/* ------------------------------------------------------------- outcome --- */

.outcome {
  margin-top: clamp(20px, 2.4vw, 26px);
  padding: 14px 16px;
  background: rgba(34, 197, 94, 0.05);
  border: 1px solid var(--line);
  border-left: 3px solid var(--green);
  border-radius: var(--radius-sm);
}
.outcome__label {
  margin: 0 0 0.25em;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}
.outcome__label span { color: #56D98C; }
.outcome__note { margin: 0; font-size: 0.9rem; }

.outcome--neutral { background: rgba(255, 255, 255, 0.022); border-left-color: var(--sky); }
.outcome--neutral .outcome__label span { color: #6FCDEC; }
.outcome--pending { background: rgba(245, 176, 68, 0.06); border-left-color: var(--amber); }
.outcome--pending .outcome__label span { color: #F0B864; }
.outcome--blocked { background: rgba(249, 115, 98, 0.06); border-left-color: var(--rose); }
.outcome--blocked .outcome__label span { color: #F79585; }

/* ----------------------------------------------------------------- sim --- */

.sim { margin-top: clamp(20px, 2.4vw, 26px); }

.sim--box {
  margin-top: clamp(24px, 3vw, 32px);
  padding: clamp(18px, 2vw, 24px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.sim__title { margin-bottom: 0.3em; }
.sim__lead { max-width: 82ch; font-size: 0.92rem; }
.sim__buttons { display: flex; flex-wrap: wrap; gap: 10px; }

.sim__note,
.sim__result {
  margin-top: 14px;
  padding: 13px 16px;
  font-size: 0.88rem;
  background: rgba(56, 189, 248, 0.05);
  border: 1px solid var(--line);
  border-left: 3px solid var(--sky);
  border-radius: var(--radius-sm);
}
.sim__result[hidden], .sim__note[hidden] { display: none; }
.sim__result .stamp__label { margin-bottom: 0.3em; }
.sim__result--blocked { background: rgba(249, 115, 98, 0.06); border-left-color: var(--rose); }
.sim__result--blocked .stamp__label span { color: #F79585; }
.sim__result--pending { background: rgba(245, 176, 68, 0.06); border-left-color: var(--amber); }
.sim__result--pending .stamp__label span { color: #F0B864; }

/* ------------------------------------------------------------ decision --- */

.decision {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  margin: clamp(22px, 2.6vw, 28px) 0 0;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
@media (min-width: 640px)  { .decision { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1040px) { .decision { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.decision__step { padding: clamp(15px, 1.8vw, 20px); background: var(--surface); }
.decision__step p { margin: 0; font-size: 0.9rem; }
.decision__k {
  display: block;
  margin-bottom: 0.4em;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}
.decision__step--detect .decision__k { color: var(--sky); }
.decision__step--end .decision__k { color: #56D98C; }

/* -------------------------------------------------------------- states --- */

.states {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(12px, 1.6vw, 18px);
  margin: 0 0 clamp(22px, 2.6vw, 30px);
  padding: 0;
  list-style: none;
}
@media (min-width: 700px)  { .states { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .states { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.state {
  padding: clamp(15px, 1.8vw, 20px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--text-3);
  border-radius: var(--radius-sm);
}
.state p { margin: 0; font-size: 0.88rem; }
.state__name {
  display: block;
  margin-bottom: 0.45em;
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  color: var(--text);
}
.state--recovered   { border-top-color: var(--green); }
.state--recovered .state__name   { color: #56D98C; }
.state--influenced  { border-top-color: var(--sky); }
.state--influenced .state__name  { color: #6FCDEC; }
.state--organic     { border-top-color: var(--line-strong); }
.state--unrecovered { border-top-color: var(--line-strong); }
.state--unknown     { border-top-color: var(--amber); }
.state--unknown .state__name     { color: #F0B864; }

/* ---------------------------------------------------------------- split --- */

.split {
  margin-top: clamp(22px, 2.6vw, 30px);
  padding: clamp(16px, 2vw, 22px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.split__bar {
  display: flex;
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
}
.split__seg { display: block; height: 100%; }
.split__seg--recovered  { flex: 0 0 70%; background: linear-gradient(90deg, var(--green), var(--green-deep)); }
.split__seg--influenced { flex: 1 1 auto; background: rgba(56, 189, 248, 0.55); }

.split__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.82rem;
  font-family: var(--mono);
  color: var(--text-3);
}
.split__legend li { display: flex; align-items: center; gap: 7px; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot--recovered  { background: var(--green); }
.dot--influenced { background: rgba(56, 189, 248, 0.75); }
.dot--none       { background: rgba(255, 255, 255, 0.2); }

/* --------------------------------------------------------------- levels --- */

.levels {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(12px, 1.6vw, 18px);
  margin: 0 0 clamp(20px, 2.4vw, 26px);
  padding: 0;
  list-style: none;
}
@media (min-width: 700px) { .levels { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.level {
  padding: clamp(15px, 1.8vw, 20px);
  background: rgba(255, 255, 255, 0.022);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  border-radius: var(--radius-sm);
}
.level p { margin: 0.5em 0 0; font-size: 0.88rem; }
.level__badge {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--text);
}
.level--a { border-left-color: var(--green-deep); }
.level--a .level__badge { color: #56D98C; }
.level--b { border-left-color: var(--sky); }
.level--b .level__badge { color: #6FCDEC; }
.level--c { border-left-color: var(--amber); }
.level--c .level__badge { color: #F0B864; }
.level--d { border-left-color: var(--line-strong); }

/* ---------------------------------------------------------------- chain --- */

.chain {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: chain;
}
.chain__step {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 14px 9px 10px;
  font-size: 0.83rem;
  font-weight: 560;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
}
.chain__step::before {
  counter-increment: chain;
  content: counter(chain);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex: none;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  border-radius: 50%;
}
.chain__step--end { border-color: rgba(34, 197, 94, 0.4); color: var(--text); }
.chain__step--end::before { background: rgba(34, 197, 94, 0.22); }

.chain__caption {
  margin: 14px 0 0;
  font-family: var(--mono);
  font-size: 0.76rem;
  line-height: 1.7;
  color: var(--text-3);
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------------- narrow ---- */

@media (max-width: 480px) {
  .detail__amount { text-align: left; }
  .case-item__top { flex-wrap: wrap; }
  .sim__buttons .btn { width: 100%; }
  .split__legend { font-size: 0.78rem; }
}
