/* CleanMargin live showcase (fictional data). Works with the landing and the demo app tokens. */
.sc {
  --sc-accent: var(--accent, var(--green, #0f766e));
  --sc-neg: var(--neg, var(--red, #b42318));
  --sc-warn: var(--warn-text, var(--amber, #975a0b));
  --sc-surface: var(--surface, #fff);
  --sc-bg2: var(--bg-alt, var(--grey, #eef2f4));
  --sc-line: var(--line, #e2e8ec);
  --sc-muted: var(--muted, #56666f);
  --sc-text: var(--text, var(--ink, #0f1c24));
  --sc-ease: cubic-bezier(.2, .7, .2, 1);
  display: grid; gap: 14px; min-width: 0;
  background: var(--sc-surface); border: 1px solid var(--sc-line); border-radius: 18px;
  padding: 18px; box-shadow: var(--shadow-lg, 0 24px 60px rgba(15, 40, 50, .12)); color: var(--sc-text);
}
.sc * { box-sizing: border-box; }
.sc-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.sc-tag { font-size: 12px; font-weight: 700; color: var(--sc-muted); border: 1px dashed var(--sc-muted); border-radius: 999px; padding: 2px 10px; }
.sc-picker { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--sc-bg2); }
.sc-pick { font: inherit; font-size: 13px; font-weight: 650; border: 0; border-radius: 9px; padding: 7px 12px; background: transparent; color: var(--sc-muted); cursor: pointer; transition: background-color .2s, color .2s, transform .15s var(--sc-ease); }
.sc-pick:hover { color: var(--sc-text); }
.sc-pick:active { transform: scale(.97); }
.sc-pick[aria-pressed="true"] { background: var(--sc-surface); color: var(--sc-text); box-shadow: 0 1px 3px rgba(15, 40, 50, .12); }
.sc-pick:focus-visible, .sc input[type=range]:focus-visible { outline: 3px solid color-mix(in srgb, var(--sc-accent) 55%, transparent); outline-offset: 2px; }

/* files -> columns -> results */
.sc-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.sc-step { position: relative; display: grid; gap: 6px; align-content: start; padding: 10px 12px; border: 1px solid var(--sc-line); border-radius: 12px; background: var(--sc-bg2); font-size: 13px; height: 120px; overflow: hidden;
  opacity: .35; transform: translateY(4px); transition: opacity .45s var(--sc-ease), transform .45s var(--sc-ease), border-color .3s; }
.sc-step.on { opacity: 1; transform: none; border-color: color-mix(in srgb, var(--sc-accent) 35%, var(--sc-line)); }
.sc-step-n { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--sc-accent); color: var(--on-accent, #fff); font-size: 11px; font-weight: 800; }
.sc-step strong { font-size: 13px; }
.sc-chips { display: flex; flex-wrap: wrap; gap: 4px; color: var(--sc-muted); font-size: 12px; }
.sc-chip { padding: 1px 7px; border-radius: 6px; background: var(--sc-surface); border: 1px solid var(--sc-line); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.sc-chip.ok { color: var(--sc-accent); }

/* controls */
.sc-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.sc-ctl { display: grid; gap: 4px; font-size: 13px; color: var(--sc-muted); }
.sc-ctl-top { display: flex; justify-content: space-between; gap: 8px; }
.sc-ctl-val { min-width: 4.5ch; text-align: right; color: var(--sc-text); font-variant-numeric: tabular-nums; }
.sc input[type=range] { width: 100%; accent-color: var(--sc-accent); margin: 0; }

/* KPIs: fixed widths, tabular digits */
.sc-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.sc-kpi { border: 1px solid var(--sc-line); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.sc-kpi-l { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--sc-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-kpi-v { display: block; margin-top: 4px; font-size: clamp(16px, 1.1rem + .6vw, 22px); font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; min-height: 1.3em; }
.sc-kpi.neg .sc-kpi-v { color: var(--sc-neg); }

/* leak call-out: reserved space, fades in once */
.sc-leak { margin: 0; height: 64px; overflow: hidden; font-size: 13.5px; line-height: 1.5; padding: 8px 12px; border-radius: 10px; border-left: 3px solid var(--sc-neg);
  background: color-mix(in srgb, var(--sc-neg) 8%, transparent); opacity: 0; transform: translateY(4px); transition: opacity .45s var(--sc-ease), transform .45s var(--sc-ease); }
.sc-leak.show { opacity: 1; transform: none; }

/* site list: fixed height so switching 3/6/12 sites never moves the page */
.sc-list { list-style: none; margin: 0; padding: 0 4px 0 0; height: 288px; overflow-y: auto; overscroll-behavior: contain; display: grid; align-content: start; gap: 0; }
.sc-row { display: grid; grid-template-columns: minmax(0, 1.5fr) 64px minmax(60px, 1fr) 7ch 8.5ch; gap: 10px; align-items: center; height: 48px; padding: 0 8px; border-bottom: 1px solid var(--sc-line); border-radius: 8px; font-size: 13.5px; position: relative; }
.sc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.sc-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sc-c { font-weight: 700; }
.sc-row.neg .sc-c, .sc-row.neg .sc-m { color: var(--sc-neg); }
.sc-row.warn .sc-m { color: var(--sc-warn); }
.sc-spark { width: 64px; height: 22px; overflow: visible; }
.sc-spark .sc-zero { stroke: var(--sc-line); stroke-width: 1; stroke-dasharray: 2 2; }
.sc-spark polyline { fill: none; stroke: var(--sc-accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset .8s var(--sc-ease); }
.sc-row.neg .sc-spark polyline { stroke: var(--sc-neg); }
.sc-row.warn .sc-spark polyline { stroke: var(--sc-warn); }
.sc-spark.drawn polyline { stroke-dashoffset: 0; }
.sc-spark.nodraw polyline { transition: none; }
.sc-track { position: relative; display: block; height: 8px; border-radius: 99px; background: var(--sc-bg2); overflow: hidden; }
.sc-fill { position: absolute; inset: 0; border-radius: 99px; background: var(--sc-accent); transform-origin: left; transform: scaleX(var(--w, 0)); transition: transform .5s var(--sc-ease), background-color .3s; }
.sc-row.warn .sc-fill { background: var(--sc-warn); }
.sc-row.neg .sc-fill { background: var(--sc-neg); }
.sc-tgt { position: absolute; inset: 0; transform: translateX(calc(var(--t, .5) * 100%)); transition: transform .4s var(--sc-ease); pointer-events: none; }
.sc-tgt::before { content: ""; position: absolute; left: -1px; top: 0; bottom: 0; width: 2px; background: var(--sc-text); opacity: .55; }
.sc-row.leak { background: color-mix(in srgb, var(--sc-neg) 9%, transparent); }
.sc-row.leak-in { animation: sc-leak .8s var(--sc-ease) 1; }
@keyframes sc-leak { 0% { transform: scale(1); } 35% { transform: scale(1.015); box-shadow: 0 0 0 2px color-mix(in srgb, var(--sc-neg) 45%, transparent); } 100% { transform: none; box-shadow: none; } }
.sc-foot { margin: 0; font-size: 12px; color: var(--sc-muted); min-height: 1.5em; }

/* before first view: numbers wait (exact text is already in the DOM) */
.js .sc-wait .sc-kpi-v, .js .sc-wait .sc-num { opacity: 0; }
.sc-kpi-v, .sc-num { transition: opacity .3s; }

@media (max-width: 720px) {
  .sc-steps { grid-template-columns: 1fr; }
  .sc-step { height: 96px; }
  .sc-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sc-controls { grid-template-columns: 1fr; }
  .sc-row { grid-template-columns: minmax(0, 1fr) 48px 6.5ch 8ch; gap: 8px; }
  .sc-row .sc-track { display: none; }
  .sc-spark { width: 48px; }
  .sc-leak { height: 104px; }
}
@media (prefers-reduced-motion: reduce) {
  .sc *, .sc *::before { transition: none !important; animation: none !important; }
  .sc-step, .sc-leak { opacity: 1; transform: none; }
  .sc-spark polyline { stroke-dashoffset: 0; }
  .js .sc-wait .sc-kpi-v, .js .sc-wait .sc-num { opacity: 1; }
}
@media print { .sc-leak, .sc-step { opacity: 1; transform: none; } .js .sc-wait .sc-kpi-v, .js .sc-wait .sc-num { opacity: 1; } .sc-list { height: auto; overflow: visible; } }
