/* "See your system before we build it": the live preview is themed with --brand and data-* attributes set by demo.js. */

.demo-head { padding: 40px clamp(20px, 6vw, 96px) 0 !important; max-width: 1040px; }
.demo-head h1 { font-size: clamp(34px, 3.6vw, 52px); margin-bottom: 14px; }
.demo-head .sub { margin-bottom: 0; }
/* the live preview sits under "How we'll work together": a breadcrumb in the eyebrow's place */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 18px; font-size: 13px; font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase; color: #9fb4bf; }
.crumbs a { color: #9fb4bf; text-decoration: none; border-bottom: 1px solid #3a4650; }
.crumbs a:hover { color: #fff; border-color: var(--accent); }
.crumbs [aria-current] { color: #e6e9ec; }
section.demo { padding-top: 32px !important; }

.demo { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(320px, 1fr); gap: 32px; align-items: start; }

/* ---------- stage and device frame ---------- */
.stage { position: sticky; top: 96px; }
.stage-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.role-switch { display: flex; align-items: center; gap: 10px; }
.role-switch .label { color: #c7ccd2; font-size: 14px; }
.view-switch { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid var(--edge); border-radius: 8px; background: #17191c; }
.view-switch button, .seg button {
  font: 500 14px 'Inter', sans-serif; color: #c7ccd2; background: none; border: 0; border-radius: 6px; padding: 8px 14px; cursor: pointer;
}
.view-switch button[aria-pressed="true"], .seg button[aria-pressed="true"] {
  background: #26303a; color: #fff; box-shadow: inset 0 0 0 1px #3d5866;
}
.stage-note { margin: 12px 0 0; color: var(--muted); font-size: 13px; text-align: center; }
.device {
  margin: 0 auto; max-width: 100%; border-radius: 14px; overflow: hidden; border: 1px solid #2c3036; background: #202327;
  box-shadow: 0 40px 80px -40px rgba(0,0,0,.9), 0 12px 30px -16px rgba(0,0,0,.7); transition: max-width .35s ease;
}
.device[data-view="phone"] { max-width: 390px; border-radius: 34px; border-width: 10px; border-color: #24282d; }
.device-bar { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid #2c3036; }
.device-bar i { width: 9px; height: 9px; border-radius: 50%; background: #3a3f46; }
.device-bar span { margin-left: 10px; flex: 1; padding: 4px 10px; border-radius: 6px; background: #17191c; color: #8a929b; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.device[data-view="phone"] .device-bar i { display: none; }
.device[data-view="phone"] .device-bar span { margin: 0; text-align: center; }

/* ---------- the preview ---------- */
.app {
  --brand: #2f7cf6; --r: 12px; --bg-app: #f3f5f8; --panel: #ffffff; --ink: #1c2430; --soft: #616b77; --line-app: #e3e8ee;
  --ok: #138a5e; --warn: #b7791f; --bad: #d1433a;
  display: grid; grid-template-columns: 190px 1fr; min-height: 560px; background: var(--bg-app); color: var(--ink);
  font: 13px/1.45 'Inter', sans-serif; transition: background .3s, color .3s;
}
.app[data-theme="dark"] { --bg-app: #11151b; --panel: #1a2029; --ink: #e9edf2; --soft: #98a2ae; --line-app: #2a323d; --ok: #3ccf91; --warn: #f0b44c; --bad: #ff6b5e; }
.app[data-corners="sharp"] { --r: 2px; }
.app[data-layout="topbar"], .app[data-layout="focus"] { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
.m-nav { background: var(--panel); border-right: 1px solid var(--line-app); padding: 18px 12px; display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.app[data-layout="topbar"] .m-nav, .app[data-layout="focus"] .m-nav {
  flex-direction: row; align-items: center; justify-content: space-between; border-right: 0; border-bottom: 1px solid var(--line-app); padding: 12px 18px;
}
.app[data-layout="focus"] .m-nav { justify-content: center; background: none; border-bottom: 0; padding-top: 18px; }
.app[data-layout="focus"] .m-main { max-width: 760px; width: 100%; margin: 0 auto; }
.m-logo { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-mark { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: calc(var(--r) * .7); background: var(--brand); color: #fff; font-size: 12px; letter-spacing: .04em; }
.m-mark.own { width: auto; padding: 0 8px; background: none; color: var(--soft); border: 1px dashed var(--soft); font-size: 10px; letter-spacing: .12em; }
.m-links { display: flex; flex-direction: column; gap: 4px; }
.app[data-layout="topbar"] .m-links { flex-direction: row; }
.m-links span { padding: 8px 10px; border-radius: calc(var(--r) * .7); color: var(--soft); white-space: nowrap; }
.m-links span.on { background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); font-weight: 600; }
.app[data-theme="dark"] .m-links span.on { color: color-mix(in srgb, var(--brand) 70%, #fff); }
.m-main { padding: 20px; min-width: 0; container-type: inline-size; }
.m-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.m-head h3 { margin: 0; font-size: 19px; }
.m-sync { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.m-sync span { padding: 3px 9px; border-radius: 99px; border: 1px solid var(--line-app); background: var(--panel); font-size: 11px; font-weight: 600; }
.m-sync span::before { content: "●"; color: var(--ok); margin-right: 5px; font-size: 9px; }
.m-sync small { color: var(--soft); margin-left: 4px; }

.m-mods { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
.m-mods > .wide { grid-column: 1 / -1; }
.m-card { background: var(--panel); border: 1px solid var(--line-app); border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.m-card-head b { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.m-muted { color: var(--soft); font-size: 12px; }
.m-live { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--ok); display: inline-flex; align-items: center; gap: 5px; }
.m-live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); animation: m-pulse 1.6s ease-in-out infinite; }
@keyframes m-pulse { 50% { opacity: .3; } }

.m-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.m-kpi { gap: 4px; }
.m-kpi strong { font-size: 22px; line-height: 1.15; font-variant-numeric: tabular-nums; white-space: nowrap; }
.m-kpi small { color: var(--soft); font-size: 11px; }

.m-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.m-bars li { display: grid; grid-template-columns: 110px 1fr 44px; align-items: center; gap: 10px; }
.m-bars li span { color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-bars i { height: 8px; border-radius: 4px; background: var(--line-app); overflow: hidden; }
.m-bars em { display: block; height: 100%; background: var(--brand); border-radius: 4px; transition: width .6s ease; }
.m-bars b { text-align: right; font-variant-numeric: tabular-nums; }

.m-alert { margin: 0; padding: 8px 10px; border-radius: calc(var(--r) * .7); background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); font-weight: 600; font-size: 12px; }
.m-risk, .m-audit, .m-list, .m-ticks { list-style: none; margin: 0; padding: 0; }
.m-risk li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line-app); }
.m-risk li > span:nth-child(2) { flex: 1; min-width: 0; }
.m-risk small { display: block; color: var(--soft); }
.m-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--ok); }
.m-dot.warn { background: var(--warn); } .m-dot.bad { background: var(--bad); }
.m-sla { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; color: var(--ok); }
.m-sla.warn { color: var(--warn); } .m-sla.bad { color: var(--bad); }

.m-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.m-table th { text-align: left; color: var(--soft); font-weight: 500; padding: 0 8px 8px; border-bottom: 1px solid var(--line-app); }
.m-table td { padding: 8px; border-bottom: 1px solid var(--line-app); white-space: nowrap; }
.m-table th:first-child, .m-table td:first-child { padding-left: 0; }
.m-table .m-num { text-align: right; font-variant-numeric: tabular-nums; padding-right: 0; }
.m-table tr.done td { color: var(--soft); }
.m-table tr.moved td { animation: m-flash 1.8s ease-out; }
@keyframes m-flash { from { background: color-mix(in srgb, var(--brand) 18%, transparent); } }
.m-pill { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; background: var(--line-app); color: var(--soft); }
.m-pill.s1 { background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); }
.m-pill.s2 { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.m-pill.s3 { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.app[data-theme="dark"] .m-pill.s1 { color: color-mix(in srgb, var(--brand) 70%, #fff); }

.m-appr { display: flex; flex-direction: column; gap: 2px; }
.m-appr span { color: var(--soft); }
.m-appr strong { font-size: 22px; font-variant-numeric: tabular-nums; }
.m-ticks li { padding: 5px 0 5px 22px; position: relative; }
.m-ticks li::before { position: absolute; left: 0; font-weight: 700; }
.m-ticks li.ok::before { content: "✓"; color: var(--ok); }
.m-ticks li.warn::before { content: "!"; color: var(--warn); left: 4px; }
.m-ticks li.wait::before { content: "○"; color: var(--warn); }
.m-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.m-btn { display: inline-block; align-self: flex-start; padding: 8px 14px; border-radius: calc(var(--r) * .7); background: var(--brand); color: #fff; font-weight: 600; font-size: 12px; }
.m-btn.ghost { background: none; color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.app[data-theme="dark"] .m-btn.ghost { color: color-mix(in srgb, var(--brand) 70%, #fff); }

.m-audit li { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line-app); }
.m-audit time { color: var(--soft); font-variant-numeric: tabular-nums; flex: none; }
.m-audit li.new { animation: m-in .6s ease-out; }
@keyframes m-in { from { opacity: 0; transform: translateY(-6px); } }

.m-steps { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.m-steps li { position: relative; padding-top: 22px; }
.m-steps li::before { content: ""; position: absolute; top: 4px; left: 0; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line-app); background: var(--panel); z-index: 1; }
.m-steps li::after { content: ""; position: absolute; top: 10px; left: 14px; right: -8px; height: 2px; background: var(--line-app); }
.m-steps li:last-child::after { display: none; }
.m-steps li.done::before { background: var(--brand); border-color: var(--brand); }
.m-steps li.done::after { background: var(--brand); }
.m-steps li.now::before { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 22%, transparent); }
.m-steps b { display: block; font-size: 12px; }
.m-steps small { color: var(--soft); font-size: 11px; }
.m-list li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line-app); }
.m-list li em { font-style: normal; color: var(--soft); font-size: 11px; font-weight: 600; }
.m-list li em.ok { color: var(--ok); }
.m-msg { margin: 0; color: var(--soft); font-style: italic; }

.m-map { position: relative; height: 210px; border-radius: calc(var(--r) * .7); overflow: hidden;
  background: color-mix(in srgb, var(--brand) 5%, var(--bg-app)); border: 1px solid var(--line-app); }
.m-map svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.m-map path { fill: none; stroke: var(--line-app); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.m-map i { position: absolute; width: 10px; height: 10px; margin: -5px; border-radius: 50%; background: var(--brand);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 22%, transparent); animation: m-drive 9s ease-in-out var(--d) infinite alternate; }
.m-map i.late { background: var(--bad); box-shadow: 0 0 0 4px color-mix(in srgb, var(--bad) 25%, transparent); }
@keyframes m-drive { to { transform: translate(var(--dx), var(--dy)); } }

/* narrow content area (side menu on a mid-size screen, or the phone view) */
@container (max-width: 560px) {
  .m-kpis { grid-template-columns: repeat(2, 1fr); }
  .m-hide { display: none; }
}
@container (max-width: 420px) {
  .m-table td:nth-child(2), .m-table th:nth-child(2) { display: none; }
  .m-steps { grid-template-columns: 1fr 1fr; row-gap: 14px; }
  .m-steps li:nth-child(2)::after { display: none; }
  .m-bars li { grid-template-columns: 90px 1fr 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .m-live::before, .m-map i, .m-table tr.moved td, .m-audit li.new { animation: none; }
}

/* ---------- phone preview (the Phone switch, and every real phone): the layout choice still shows ----------
   side menu -> tabs along the bottom; top menu -> a row of tabs under the name; focus mode -> no menu */
.device[data-view="phone"] .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; min-height: 620px; }
.device[data-view="phone"] .m-nav { flex-direction: column; align-items: stretch; gap: 10px; border-right: 0; border-bottom: 1px solid var(--line-app); padding: 12px 14px; }
.device[data-view="phone"] .m-links { flex-direction: row; overflow: hidden; }
.device[data-view="phone"] .m-links span { padding: 6px 10px; font-size: 12px; }
.device[data-view="phone"] .app[data-layout="sidebar"] { grid-template-rows: auto 1fr auto; }
.device[data-view="phone"] .app[data-layout="sidebar"] .m-nav { display: contents; }
.device[data-view="phone"] .app[data-layout="sidebar"] .m-logo { grid-row: 1; padding: 12px 14px; background: var(--panel); border-bottom: 1px solid var(--line-app); }
.device[data-view="phone"] .app[data-layout="sidebar"] .m-main { grid-row: 2; }
.device[data-view="phone"] .app[data-layout="sidebar"] .m-links {
  grid-row: 3; justify-content: space-around; padding: 8px 6px; background: var(--panel); border-top: 1px solid var(--line-app);
}
.device[data-view="phone"] .app[data-layout="sidebar"] .m-links span { font-size: 10px; padding: 6px 3px; overflow: hidden; text-overflow: ellipsis; }
.device[data-view="phone"] .m-main { padding: 14px; }
.device[data-view="phone"] .m-mods { grid-template-columns: 1fr; }

/* ---------- controls ---------- */
.controls { display: flex; flex-direction: column; gap: 14px; }
.controls-head h2 { margin: 0; font-size: 18px; font-weight: 600; color: #fff; }
.controls-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.controls fieldset { margin: 0; border: 1px solid var(--edge); border-radius: 12px; background: var(--surface); padding: 16px 18px 18px; }
.controls legend { padding: 0 6px; font-weight: 600; color: #fff; display: flex; align-items: center; gap: 8px; }
.controls .step-no { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line); color: var(--accent); font-size: 12px; }
.controls .field-label { display: block; margin-top: 12px; color: #c7ccd2; font-size: 14px; }
.controls input[type="text"] {
  width: 100%; margin-top: 6px; padding: 11px 13px; border-radius: 8px; border: 1px solid var(--edge); background: #121315;
  color: #fff; font: 15px 'Inter', sans-serif;
}
.controls input[type="text"]::placeholder { color: #7f8892; }
.controls .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.controls .row.stack { flex-direction: column; align-items: stretch; gap: 8px; margin-top: 14px; }
.controls .row .label { color: #c7ccd2; font-size: 14px; }
.seg { display: inline-flex; gap: 4px; padding: 3px; border: 1px solid var(--edge); border-radius: 8px; background: #17191c; }
.seg button { padding: 7px 12px; }
.swatches { display: flex; gap: 8px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #121315; background: var(--c); cursor: pointer; box-shadow: 0 0 0 1px #3a3f46; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px #fff; }
.features { display: grid; gap: 8px; margin-top: 6px; }
.controls .feature { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--edge); background: #17191c; cursor: pointer; }
.controls .feature input { width: 18px; height: 18px; accent-color: var(--accent); }
.start-over { display: block; margin-top: 2px; padding: 0; background: none; border: 0; color: #9fb4bf; font: 14px 'Inter', sans-serif; text-decoration: underline; cursor: pointer; }
.start-over:hover { color: #fff; }

@media (max-width: 1100px) {
  .demo { grid-template-columns: 1fr; }
  .stage { position: static; }
}
/* phones: always the phone preview (set in demo.js), pinned compactly under the top bar so every switch shows */
@media (max-width: 760px) {
  .demo-head { padding: 48px 16px 0 !important; }
  .view-switch { display: none; }
  .stage-bar { margin-bottom: 8px; }
  .stage-note, .role-switch .label { display: none; }
  .stage {
    position: sticky; top: 64px; z-index: 5; background: var(--bg); margin: 0 -16px; padding: 8px 16px 10px;
    box-shadow: 0 12px 20px -14px rgba(0,0,0,.8);
  }
  .device[data-view] { max-width: 100%; border-radius: 24px; border-width: 6px; max-height: 40vh; overflow: auto; overscroll-behavior: contain; }
}

/* executive trend chart */
.m-trend { display: flex; align-items: flex-end; gap: 4px; height: 96px; }
.m-trend i { flex: 1; border-radius: 3px 3px 0 0; background: color-mix(in srgb, var(--brand) 35%, transparent); transition: height .6s ease; }
.m-trend i.today { background: var(--brand); }
.m-facts { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.m-facts dt { color: var(--soft); font-size: 11px; }
.m-facts dd { margin: 0; font-weight: 600; }

/* the AI assistant modules */
.m-ai { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.m-draft { margin: 0; padding: 10px 12px; border-radius: calc(var(--r) * .7); background: color-mix(in srgb, var(--brand) 7%, var(--bg-app));
  border-left: 3px solid var(--brand); color: var(--ink); font-style: italic; }
.m-draft small { display: block; font-style: normal; color: var(--soft); font-size: 11px; margin-bottom: 4px; }
.m-tag { color: var(--soft); font-size: 11px; text-align: right; max-width: 45%; }
.m-risk li.moved { animation: m-flash 1.8s ease-out; }
@container (max-width: 560px) { .m-ai { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .m-risk li.moved { animation: none; } }

/* story cards: one per industry we've delivered in, each opening its natural system */
.stories-row { grid-column: 1 / -1; min-width: 0; }
.stories-title { margin: 0 0 12px; font-size: 18px; font-weight: 600; color: #fff; }
.stories { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.story { display: flex; flex-direction: column; justify-content: flex-start; text-align: left; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--edge); background: #17191c; color: #e6e9ec;
  cursor: pointer; font: inherit; transition: border-color .2s, background .2s; }
.story:hover { border-color: #33424a; }
.story small { display: block; margin-bottom: 4px; color: var(--accent); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.story b { display: block; font-weight: 600; line-height: 1.25; }
.story span { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; line-height: 1.35; }
.story[aria-pressed="true"] { border-color: #3d7f89; background: #102226; }
.expert-line { margin: 12px 0 0; color: var(--muted); font-size: 14px; max-width: 760px; }
@media (max-width: 1280px) { .stories { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
/* phones: the cards become one swipeable row so the preview stays close */
@media (max-width: 760px) {
  .stories { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: 16px; margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none; }
  .story { flex: 0 0 62%; scroll-snap-align: start; }
}
