/* Simulation demos on pm-bot.html and invoice-automation.html (played by sim.js).
   Everything is scoped to .sim or .sim-page. Colours come from the theme variables in styles.css. */
.sim-page, .sim { --sim-warn: #b4441b; --sim-warn-soft: #fbe7de; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sim-page, :root:not([data-theme="light"]) .sim { --sim-warn: #ff9e74; --sim-warn-soft: #3a2119; }
}
:root[data-theme="dark"] .sim-page, :root[data-theme="dark"] .sim { --sim-warn: #ff9e74; --sim-warn-soft: #3a2119; }

.sim-section { padding-top: 1rem; padding-bottom: 2.5rem; }
/* Links to #demo must stop below the sticky menu (64px). Two classes, to outrank section[id] in styles.css. */
.sim-page .sim-section { scroll-margin-top: 72px; }
.sim-section > h2 { font-family: "Space Grotesk", Inter, sans-serif; font-size: 1.5rem; margin-bottom: .5rem; }
.sim-honest { max-width: 64ch; margin: 0 0 1.25rem; padding: .85rem 1rem; border: 1px solid var(--border); border-inline-start: 3px solid var(--accent); border-radius: 10px; background: var(--surface); font-size: .95rem; }
.sim-honest strong { color: var(--text); }
.sim-note { color: var(--muted); font-size: .9rem; margin-top: 1rem; }
.sim-cta { text-align: center; }
.sim-cta p { margin: 0 auto 1.25rem; max-width: 52ch; }

.sim { border: 1px solid var(--border); border-radius: 20px; background: var(--surface); padding: 1.25rem; box-shadow: var(--shadow-card); }
.sim [hidden] { display: none !important; }
.sim-pick { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.sim-pick button { min-height: 44px; padding: .5rem 1rem; border: 1px solid var(--border); border-radius: 999px; background: var(--bg); color: var(--text); font: inherit; font-size: .92rem; font-weight: 500; cursor: pointer; }
.sim-pick button:hover { border-color: var(--accent); }
.sim-pick button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.sim-pick .sim-replay { margin-left: auto; color: var(--muted); }
.sim button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sim-hint { color: var(--muted); font-size: .92rem; margin: 0 0 1rem; }
.sim:not(.sim-ready) .sim-hint, .sim:not(.sim-ready) .sim-pick { display: none; }

.sim-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.sim-scene h3 { font-family: "Space Grotesk", Inter, sans-serif; font-size: 1.05rem; margin: 0 0 .15rem; }
.sim-sub { color: var(--muted); font-size: .9rem; margin: 0 0 .9rem; }
.sim:not(.sim-ready) .sim-scene + .sim-scene { margin-top: 1.5rem; }

/* ---------- the steps: a chat-style list ---------- */
.sim-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.sim-steps li { max-width: 92%; padding: .65rem .85rem; border-radius: 14px 14px 14px 4px; background: var(--bg); border: 1px solid var(--border); font-size: .93rem; line-height: 1.5; }
.sim-steps li { color: var(--text); }
.sim-steps p { margin: 0; color: inherit; }  /* the site's paragraph colour would grey out the tinted steps */
.sim-who { display: block; font-size: .76rem; font-weight: 600; color: var(--muted); margin-bottom: .15rem; }
.sim-steps li[data-kind="in"] { justify-self: end; border-radius: 14px 14px 4px 14px; background: var(--accent-soft); border-color: transparent; }
.sim-steps li[data-kind="bot"] { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.sim-steps li[data-kind="bot"] .sim-who { color: var(--accent); }
.sim-steps li[data-kind="look"] { max-width: 100%; background: none; border-style: dashed; border-radius: 10px; color: var(--muted); font-size: .88rem; }
.sim-steps li[data-kind="done"] { max-width: 100%; border-radius: 10px; background: var(--ok-soft); border-color: transparent; color: var(--ok); font-weight: 500; }
.sim-steps li[data-kind="warn"] { max-width: 100%; border-radius: 10px; background: var(--sim-warn-soft); border-color: transparent; color: var(--sim-warn); font-weight: 500; }
/* Steps are hidden only once the script is running; without it they read as a plain list */
.sim-ready .sim-steps li { display: none; }
.sim-ready .sim-steps li.shown { display: block; animation: sim-in .3s ease; }
@keyframes sim-in { from { opacity: 0; transform: translateY(6px); } }

/* ---------- PM Bot: the task board ---------- */
.sim-board { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.sim-col { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: .6rem; min-height: 6.5rem; }
.sim-col > h4 { font-size: .74rem; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); margin: 0 0 .5rem; }
.sim-cards { display: grid; gap: .45rem; }
.sim-card { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--border); border-radius: 8px; padding: .45rem .55rem; font-size: .84rem; line-height: 1.35; }
.sim-card b { display: block; font-weight: 600; color: var(--text); }
.sim-card span { color: var(--muted); font-size: .78rem; }
.sim-card.is-flag { border-left-color: var(--sim-warn); background: var(--sim-warn-soft); }
.sim-card.is-flag [data-id$="-note"] { color: var(--sim-warn); font-weight: 600; }
.sim-card.is-ok { border-left-color: var(--ok); }
.sim-card.is-ok [data-id$="-note"] { color: var(--ok); font-weight: 600; }
.sim-card.is-moved { animation: sim-pop .5s ease; }
@keyframes sim-pop { from { transform: scale(.94); box-shadow: 0 0 0 3px var(--accent-soft); } }

/* ---------- Invoice: the paper ---------- */
.sim-paper { background: #fff; color: #16161a; border: 1px solid var(--border); border-radius: 10px; padding: 1.1rem 1.2rem; font-size: .86rem; line-height: 1.45; box-shadow: var(--shadow-card); }
.sim-paper-head { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: .9rem; }
.sim-paper-head strong { font-family: "Space Grotesk", Inter, sans-serif; font-size: 1.05rem; }
.sim-paper-head div:last-child { text-align: right; }
.sim-paper small { display: block; color: #5d5d66; font-size: .74rem; }
.sim-paper table { width: 100%; border-collapse: collapse; margin-bottom: .6rem; }
.sim-paper th { text-align: left; font-size: .72rem; font-weight: 600; color: #5d5d66; border-bottom: 1px solid #dde2ee; padding: .3rem 0; }
.sim-paper td { padding: .3rem 0; border-bottom: 1px solid #eef1f8; }
.sim-paper th:last-child, .sim-paper td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.sim-total { display: flex; justify-content: space-between; font-weight: 600; font-size: .95rem; color: #16161a; margin: 0; }
.sim-paper [data-id] { border-radius: 4px; padding: 0 .2rem; margin: 0 -.2rem; transition: background .3s, box-shadow .3s; }
.sim-paper .is-read { background: #dde4ff; box-shadow: 0 0 0 1px #3b5bdb; }
.sim-paper .is-ok { background: #d8f1e3; box-shadow: 0 0 0 1px #17734a; }
.sim-paper .is-bad { background: #fbe7de; box-shadow: 0 0 0 1px #b4441b; }

/* The summary email under the invoice demo */
.sim-mail { margin-top: 1.25rem; border: 1px solid var(--border); border-radius: 14px; background: var(--bg); padding: 1rem 1.1rem; font-size: .92rem; }
.sim-mail h3 { font-size: .95rem; margin: 0 0 .15rem; }
.sim-mail .sim-sub { margin-bottom: .6rem; }
.sim-mail ul { margin: 0; padding-left: 1.1rem; display: grid; gap: .25rem; }

@media (max-width: 760px) {
  .sim { padding: 1rem; border-radius: 16px; }
  .sim-grid { grid-template-columns: minmax(0, 1fr); }
  .sim-pick .sim-replay { margin-left: 0; }
  .sim-steps li { max-width: 96%; }
}
@media (prefers-reduced-motion: reduce) {
  .sim-ready .sim-steps li.shown, .sim-card.is-moved { animation: none; }
  .sim-paper [data-id] { transition: none; }
}

/* ---------- Knowledge assistant: the company documents panel ---------- */
.kb { display: grid; gap: .55rem; }
.kb-title { font-size: .74rem; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); margin: 0 0 .1rem; }
.kb-doc { background: var(--bg); border: 1px solid var(--border); border-left: 3px solid var(--border); border-radius: 10px; padding: .55rem .7rem; }
.kb-name { margin: 0; font-weight: 600; font-size: .9rem; color: var(--text); }
.kb-body { margin-top: .4rem; display: grid; gap: .35rem; }
.kb-body p { margin: 0; font-size: .84rem; line-height: 1.5; color: var(--muted); }
.kb-body b { color: var(--text); font-weight: 600; }
.kb-body [data-id] { border-radius: 4px; padding: .05rem .2rem; margin: 0 -.2rem; }
/* A document shows only its name until the assistant opens it. Without the script, all are open. */
.sim-ready .kb-doc:not(.is-open) .kb-body { display: none; }
.kb-doc.is-open { border-color: var(--accent); border-left-color: var(--accent); }
.kb-body .is-hit { background: var(--accent-soft); color: var(--text); box-shadow: 0 0 0 1px var(--accent); }
