/* ============================================================
   PLATFORM PREVIEW — the app home screen as a live component.
   Self-contained light theme inside .pd-frame so it reads as
   the product on both the dark homepage and light demo page.
   ============================================================ */
.pd-frame {
  --pbg: #fdf8f0;        /* app canvas */
  --pcard: #ffffff;
  --pink1: #2b2026;      /* primary ink */
  --pink2: #5f5560;
  --pink3: #6c646b;
  --prule: #f0e7dc;
  --pmar: #8f1153;       /* jacquard maroon */
  --pmar-deep: #82104c;
  --pyellow: #ffe14d;
  --pgreen: #1a754d;
  --pgreen-soft: #ddf1e6;
  --pamber: #a05a00;

  display: grid;
  grid-template-columns: 168px 1.55fr 1fr;
  gap: 0;
  background: var(--pbg);
  text-align: left;
  font-family: var(--f-text);
  color: var(--pink1);
  position: relative;
}

/* ---- window shell — browser chrome + scaled live viewport ---- */
.pd-window {
  border: 1px solid rgba(21, 2, 12, 0.45);
  border-radius: 16px;
  overflow: hidden;
  background: #2b0e22;
  box-shadow: 0 30px 80px -40px rgba(0, 0, 0, 0.55);
}
.pd-chrome { display: flex; align-items: center; gap: 7px; padding: 11px 16px; }
.pd-dot { width: 9px; height: 9px; border-radius: 50%; background: rgba(246, 239, 224, 0.22); }
.pd-url {
  margin: 0 auto; font-family: var(--f-data); font-size: 10.5px; letter-spacing: 0.04em;
  color: rgba(246, 239, 224, 0.6); background: rgba(246, 239, 224, 0.08);
  border-radius: 999px; padding: 3px 14px;
}
.pd-viewport { position: relative; overflow: hidden; }
/* scaled shot mode: the app renders at design width, the live DOM scales
   down to product-shot density; the viewport ends on a hard clean edge
   just below the revenue chart (height set by fit() in dashboard.js) */
.pd-scaled .pd-scale { width: 1460px; transform-origin: top left; overflow: hidden; }

/* ---- guided tour chips ---- */
.pd-tour { display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 18px; }
.pd-tourbtn {
  flex: 1 1 190px; text-align: left; cursor: pointer;
  background: rgba(246, 239, 224, 0.05); border: 1px solid rgba(246, 239, 224, 0.16);
  border-radius: 12px; padding: 11px 14px;
  transition: border-color .18s ease, background .18s ease;
}
.pd-tourbtn b { display: block; font-family: var(--f-sans); font-weight: 600; font-size: 13.5px; color: #f6efe0; }
.pd-tourbtn span { display: block; font-family: var(--f-sans); font-size: 12px; line-height: 1.45; color: rgba(246, 239, 224, 0.68); margin-top: 2px; }
.pd-tourbtn:hover { background: rgba(246, 239, 224, 0.09); }
.pd-tourbtn.on { border-color: var(--pd-acc, #ff7ae9); background: rgba(246, 239, 224, 0.09); }

/* ---- region focus — dim the rest, ring the target ---- */
.pd-frame .pd-card, .pd-frame .pd-side, .pd-frame .pd-greet { transition: opacity .25s ease; }
.pd-frame[data-focus] .pd-card:not(.pd-hit),
.pd-frame[data-focus] .pd-side,
.pd-frame[data-focus] .pd-greet { opacity: 0.3; }
.pd-card.pd-hit { position: relative; z-index: 2; box-shadow: 0 0 0 3px var(--pmar), 0 18px 50px -18px rgba(21, 2, 12, 0.5); }

/* ---- sidebar ---- */
.pd-side { background: var(--pmar-deep); color: #f2dbe7; padding: 18px 12px; display: flex; flex-direction: column; gap: 2px; }
.pd-logo { display: flex; align-items: center; justify-content: space-between; color: #fff; font-family: var(--f-sans); font-weight: 700; letter-spacing: 0.16em; font-size: 12.5px; padding: 2px 8px 16px; }
.pd-ic { width: 15px; height: 15px; flex: none; }
.pd-nav {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--f-label); font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase;
  color: #dfb8cd; border-radius: 7px; padding: 7px 8px; cursor: default;
  transition: background .14s ease, color .14s ease;
}
.pd-nav:hover { background: rgba(255,255,255,0.07); color: #fff; }
.pd-nav.on { background: rgba(255,255,255,0.14); color: #fff; }
.pd-nav.sub { padding-left: 32px; font-size: 9px; color: #d6adc4; }
.pd-badge { margin-left: auto; background: var(--pyellow); color: #240016; font-family: var(--f-data); font-size: 9px; border-radius: 999px; padding: 1px 6px; }

/* ---- columns ---- */
.pd-main { padding: 20px 18px 20px 22px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.pd-right { padding: 20px 20px 20px 0; min-width: 0; display: flex; flex-direction: column; gap: 14px; }

.pd-greet { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.pd-h { font-family: var(--f-display); font-size: clamp(20px, 2vw, 27px); letter-spacing: -0.02em; margin: 0; color: var(--pink1); }
.pd-h b { color: var(--pmar); }
.pd-date { font-size: 12px; color: var(--pink2); white-space: nowrap; }

.pd-card { background: var(--pcard); border: 1px solid var(--prule); border-radius: 12px; padding: 14px 16px; box-shadow: 0 6px 20px -16px rgba(21,2,12,0.25); min-width: 0; }
.pd-card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.pd-lab { font-family: var(--f-label); font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--pink3); }
.pd-right .pd-lab { font-size: 9.5px; }
.pd-chip { display: inline-flex; align-items: center; gap: 6px; font-family: var(--f-label); font-size: 8.5px; letter-spacing: 0.1em; text-transform: uppercase; border-radius: 999px; padding: 3px 9px; }
.pd-chip.gen { color: var(--pmar); background: #f7e3ee; }
.pd-chip.ok { color: var(--pgreen); background: var(--pgreen-soft); }
.pd-chip.sel { color: var(--pink2); border: 1px solid var(--prule); margin-left: auto; cursor: default; }
.pd-chip.sel:hover { border-color: var(--pink3); }
.pd-node { width: 6px; height: 6px; border-radius: 50%; border: 1.5px solid currentColor; }
.pd-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pd-right2 { margin-left: auto; }
.pd-meta.pd-right { margin-left: auto; }

.pd-digest { font-size: 13.5px; line-height: 1.6; margin: 0 0 6px; color: var(--pink1); }
.pd-digest b { font-weight: 600; }
.pd-meta { font-size: 11px; color: var(--pink3); margin: 0; }
.pd-meta b { color: var(--pink2); }

/* needs you */
.pd-need { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--prule); transition: opacity .3s ease; }
.pd-need.is-done { opacity: 0.45; }
.pd-need-c { flex: 1; min-width: 0; }
.pd-need-t { font-size: 13px; font-weight: 600; margin: 0; color: var(--pink1); }
.pd-need-s { font-size: 11.5px; color: var(--pink2); margin: 2px 0 0; }
.pd-time { font-size: 11px; color: var(--pink3); white-space: nowrap; }
.pd-review {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  font-family: var(--f-label); font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase;
  background: var(--pyellow); color: #240016; border: 0; border-radius: 8px; padding: 8px 13px;
  transition: filter .14s ease, transform .14s ease;
}
.pd-review:hover { filter: brightness(1.05); transform: translateY(-1px); }
.pd-done { font-family: var(--f-label); font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--pgreen); }

/* performance chart */
.pd-big { margin: 2px 0 8px; }
.pd-big b { font-family: var(--f-display); font-weight: 500; font-size: 30px; letter-spacing: -0.02em; color: var(--pink1); }
.pd-big.sm b { font-size: 26px; }
.pd-big span { font-size: 11.5px; color: var(--pink2); margin-left: 6px; }
.pd-chartwrap { position: relative; }
.pd-svg { width: 100%; height: auto; display: block; }
.pd-svg .grid { stroke: var(--prule); stroke-width: 1; }
.pd-svg .axis, .pd-spark .axis, .pd-radar .axis { font-family: var(--f-data); font-size: 9px; fill: var(--pink3); }
.pd-area { fill: rgba(143, 17, 83, 0.07); opacity: 0; transition: opacity .8s ease .6s; }
.is-live .pd-area { opacity: 1; }
.pd-line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pd-line.jq { stroke: var(--pmar); }
.pd-line.ctl, .pd-line.ct { stroke: #a99fa5; stroke-width: 1.5; stroke-dasharray: 0.012 0.008; }
.pd-line.jq { stroke-dasharray: 1; stroke-dashoffset: 1; }
.is-live .pd-line.jq { animation: pddraw 1.4s ease forwards; }
@keyframes pddraw { to { stroke-dashoffset: 0; } }
.pd-end { fill: var(--pmar); opacity: 0; transition: opacity .3s ease 1.3s; }
.is-live .pd-end { opacity: 1; }
.pd-endlab { font-family: var(--f-text); font-weight: 600; font-size: 11px; fill: var(--pink1); opacity: 0; transition: opacity .3s ease 1.3s; }
.is-live .pd-endlab { opacity: 1; }
.pd-cross { stroke: var(--pink3); stroke-width: 1; stroke-dasharray: 3 3; }
.pd-hdot.jq { fill: var(--pmar); }
.pd-hdot.ct { fill: #a99fa5; }
.pd-tip {
  position: absolute; top: 4px; transform: translateX(-50%);
  background: #241c26; color: #f6efe0; border-radius: 8px; padding: 7px 11px;
  font-size: 11px; line-height: 1.5; pointer-events: none; white-space: nowrap; z-index: 4;
}
.pd-tip b { display: block; font-family: var(--f-label); font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; color: #cbb; margin-bottom: 2px; }
.pd-tip span { display: block; }
.pd-tip .jq { color: #ff9ad5; }
.pd-tip .ct { color: #bdb3b8; }
.pd-legend { display: flex; gap: 16px; font-size: 11px; color: var(--pink2); margin: 6px 0 0; }
.pd-legend .sw { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 5px; }
.pd-legend .sw.jq { background: var(--pmar); }
.pd-legend .sw.ct { background: #a99fa5; }
.pd-conv { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid var(--prule); margin-top: 12px; padding-top: 12px; }
.pd-conv-n { font-family: var(--f-sans); font-weight: 700; font-size: 15px; margin: 0; color: var(--pink1); }
.pd-spark { width: 200px; height: 32px; flex: none; }
.pd-spark.wide { width: 100%; height: 24px; margin: 4px 0 10px; }
.pd-spark .pd-line { stroke-width: 1.6; }

/* training rail */
.pd-rail { display: flex; flex-direction: column; }
.pd-stage { display: flex; gap: 11px; position: relative; padding-bottom: 14px; }
.pd-stage:last-child { padding-bottom: 2px; }
.pd-stage::before { content: ""; position: absolute; left: 11px; top: 24px; bottom: -2px; width: 1.5px; background: var(--prule); }
.pd-stage:last-child::before { display: none; }
.pd-stage-m {
  flex: none; width: 23px; height: 23px; border-radius: 50%; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--f-data); font-size: 10px;
  transition: transform .15s ease;
}
.pd-stage:hover .pd-stage-m { transform: scale(1.12); }
.pd-stage.done .pd-stage-m { background: var(--pmar); color: #fff; }
.pd-stage.live .pd-stage-m { border: 1.5px solid var(--pmar); color: var(--pmar); background: #fff; }
.pd-stage.next .pd-stage-m { border: 1.5px solid var(--prule); color: var(--pink3); background: #fff; }
.pd-stage-b { min-width: 0; }
.pd-stage-t { font-size: 12px; margin: 2px 0 0; color: var(--pink1); }
.pd-stage-t b { font-weight: 600; }
.pd-stage-tag { font-size: 11px; color: var(--pink3); }
.pd-stage-tag.live { color: var(--pgreen); }
.pd-stage-d { font-size: 11.5px; line-height: 1.55; color: var(--pink2); margin: 2px 0 0; }
.pd-link { color: var(--pmar); text-decoration: underline; cursor: pointer; }

/* AI visibility */
.pd-prov { display: flex; align-items: center; gap: 10px; padding: 4.5px 0; }
.pd-prov-n { flex: none; width: 72px; font-size: 12px; color: var(--pink1); }
.pd-prov-bar { flex: 1; height: 9px; border-radius: 3px; background: transparent; }
.pd-prov-bar i { display: block; height: 100%; width: 0; border-radius: 3px; background: var(--pmar); transition: width .9s cubic-bezier(0.34, 1, 0.4, 1); }
.pd-prov:hover .pd-prov-bar i { background: var(--pmar-deep); }
.pd-prov-v { flex: none; width: 34px; text-align: right; font-size: 12px; font-weight: 600; color: var(--pink1); }
.pd-flag { font-size: 11.5px; color: var(--pamber); margin: 8px 0 0; }

/* sentiment radar: your messages vs category baseline */
.pd-radar { width: 100%; height: auto; display: block; margin: 4px 0 2px; }
.pd-radar-grid { fill: none; stroke: var(--prule); stroke-width: 1; }
.pd-radar-base { fill: rgba(95, 85, 96, 0.08); stroke: #8d8390; stroke-width: 1.4; stroke-dasharray: 4 3; }
.pd-radar-fill { fill: rgba(143, 17, 83, 0.12); stroke: var(--pmar); stroke-width: 2; stroke-linejoin: round; }
.pd-radar-dot { fill: var(--pmar); }
.pd-radar-lab { font-size: 11px; fill: var(--pink3); }
.pd-radar-val { font-size: 10px; font-weight: 600; fill: var(--pink1); }
.pd-sent-leg { display: flex; gap: 18px; margin: 2px 0 0; }
.pd-sent-l { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--pink2); }
.pd-sent-swatch { width: 16px; height: 0; border-top: 3px solid var(--pmar); border-radius: 2px; }
.pd-sent-swatch.base { border-top: 3px dashed #8d8390; }
.pd-sent-cap { font-size: 11.5px; color: var(--pink3); margin: 8px 0 0; }

/* ---- responsive ---- */
@media (max-width: 1080px) {
  .pd-frame { grid-template-columns: 152px 1.5fr 1fr; }
}
@media (max-width: 900px) {
  .pd-frame { grid-template-columns: 1fr; }
  .pd-side { flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px 14px; gap: 4px; }
  .pd-logo { width: 100%; padding-bottom: 8px; }
  .pd-nav.sub { display: none; }
  .pd-main { padding: 18px 16px 8px; }
  .pd-right { padding: 0 16px 16px; }
  .pd-card.pd-sent { display: none; }
  .pd-spark:not(.wide) { display: none; }
  .pd-tourbtn { flex-basis: 46%; }
}
@media (prefers-reduced-motion: reduce) {
  .pd-frame .pd-card, .pd-frame .pd-side, .pd-frame .pd-greet, .pd-tourbtn { transition: none; }
}
@media (prefers-reduced-motion: reduce) {
  .pd-line.jq { stroke-dasharray: none; stroke-dashoffset: 0; animation: none !important; }
  .pd-area, .pd-end, .pd-endlab { opacity: 1 !important; transition: none; }
  .pd-prov-bar i, .pd-review, .pd-stage-m { transition: none; }
}
