/* ===================== Hero / priority banner ===================== */
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--brand-800) 0%, var(--brand-900) 62%, #0b1d38 100%);
  color: #e3ecf8; border-radius: var(--r-xl); padding: var(--s-7);
}
.hero::after {
  content: ""; position: absolute; right: -80px; top: -110px; width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(109,74,255,.34), transparent 66%); pointer-events: none;
}
.hero__grid { position: relative; display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: var(--s-7); align-items: center; }
@media (max-width: 1100px) { .hero__grid { grid-template-columns: minmax(0,1fr); } }
.hero .eyebrow { color: #86e0b6; }
.hero h2 { font-size: var(--t-2xl); color: #fff; letter-spacing: -.028em; }
.hero p { color: #b2c4dc; margin-top: var(--s-3); font-size: var(--t-md); line-height: 1.6; max-width: 66ch; }
.hero__stats { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: var(--s-3); }
.hero__stat { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.11); border-radius: var(--r-md); padding: var(--s-3) var(--s-4); }
.hero__stat b { display: block; font-size: var(--t-xl); color: #fff; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.hero__stat span { display: block; font-size: var(--t-xs); color: #93aac6; margin-top: 1px; }
.hero__actions { display: flex; gap: var(--s-3); flex-wrap: wrap; margin-top: var(--s-6); }
.hero .btn { border-color: rgba(255,255,255,.22); background: rgba(255,255,255,.1); color: #fff; }
.hero .btn:hover { background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.34); }
.hero .btn--primary { background: #fff; color: var(--brand-800); border-color: #fff; }
.hero .btn--primary:hover { background: #e8f0fb; border-color: #e8f0fb; }

/* ===================== Channel connection cards ===================== */
.channelgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: var(--s-4); }
.channelcard { padding: var(--s-4); display: flex; flex-direction: column; gap: var(--s-3); }
.channelcard__top { display: flex; align-items: center; gap: var(--s-3); }
.channelcard__top h3 { font-size: var(--t-sm); font-weight: 650; }
.channelcard__top p { font-size: var(--t-xs); color: var(--tx-3); }
.channelcard__caps { display: flex; flex-wrap: wrap; gap: 5px; }
.cap {
  font-size: 10.5px; font-weight: 650; padding: 2px 7px; border-radius: var(--r-sm);
  background: var(--ok-50); color: var(--ok-600); display: inline-flex; align-items: center; gap: 3px;
}
.cap--off { background: var(--surface-3); color: var(--tx-weak); text-decoration: line-through; }
.cap--partial { background: var(--warn-50); color: var(--warn-600); }
.channelcard__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); font-size: var(--t-xs); color: var(--tx-3); margin-top: auto; padding-top: var(--s-2); border-top: 1px solid var(--line-soft); }
.statusdot { display: inline-flex; align-items: center; gap: 5px; font-size: var(--t-xs); font-weight: 650; }
.statusdot i { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.statusdot--ok i { background: var(--ok-500); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok-500) 18%, transparent); }
.statusdot--warn i { background: var(--warn-500); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn-500) 18%, transparent); }
.statusdot--off i { background: var(--n-400); }
.statusdot--ok { color: var(--ok-600); }
.statusdot--warn { color: var(--warn-600); }
.statusdot--off { color: var(--tx-weak); }

/* ===================== AI visibility matrix ===================== */
.aimatrix { display: grid; gap: var(--s-3); }
.aimatrix__row { display: grid; grid-template-columns: minmax(0,1fr) repeat(var(--cols,5), 96px); gap: var(--s-2); align-items: center; }
.aimatrix__head { font-size: var(--t-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--tx-3); text-align: center; }
.aicell {
  border-radius: var(--r-md); padding: 8px 6px; text-align: center; border: 1px solid transparent;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
button.aicell:hover { transform: translateY(-1px); box-shadow: var(--sh-sm); }
.aicell b { display: block; font-size: var(--t-sm); font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.aicell span { display: block; font-size: 10px; margin-top: 1px; opacity: .85; }
.aicell--strong { background: var(--ok-50); color: var(--ok-600); border-color: color-mix(in srgb, var(--ok-500) 26%, transparent); }
.aicell--partial { background: var(--warn-50); color: var(--warn-600); border-color: color-mix(in srgb, var(--warn-500) 26%, transparent); }
.aicell--weak { background: var(--risk-50); color: var(--risk-600); border-color: color-mix(in srgb, var(--risk-500) 26%, transparent); }
.aicell--none { background: var(--surface-3); color: var(--tx-weak); border-color: var(--line); }
@media (max-width: 1100px) { .aimatrix__row { grid-template-columns: minmax(0,1fr) repeat(var(--cols,5), 60px); } .aicell span { display: none; } }
@media (max-width: 720px) { .aimatrix { display: none; } }

.answerbox {
  background: var(--surface-2); border: 1px solid var(--line); border-left: 3px solid var(--ai-500);
  border-radius: var(--r-md); padding: var(--s-4); font-size: var(--t-sm); line-height: 1.66; color: var(--tx-2);
}
.answerbox__src { margin-top: var(--s-3); padding-top: var(--s-3); border-top: 1px dashed var(--line); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: var(--t-xs); color: var(--tx-3); }

.gapitem { display: flex; gap: var(--s-3); padding: var(--s-3) 0; border-bottom: 1px solid var(--line-soft); }
.gapitem:last-child { border-bottom: 0; }
.gapitem__icon { width: 22px; height: 22px; flex: none; border-radius: var(--r-sm); display: grid; place-items: center; }
.gapitem__icon svg { width: 13px; height: 13px; }
.gapitem h4 { font-size: var(--t-sm); font-weight: 640; }
.gapitem p { font-size: var(--t-xs); color: var(--tx-3); margin-top: 2px; line-height: 1.55; }

/* ===================== Calendar / planner ===================== */
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); border-top: 1px solid var(--line); }
.calendar__dow { padding: 9px var(--s-3); font-size: var(--t-xs); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--tx-3); background: var(--surface-2); border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line); text-align: center; }
.calendar__dow:last-child { border-right: 0; }
.calday {
  min-height: 132px; padding: var(--s-2); border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft);
  display: flex; flex-direction: column; gap: 5px; transition: background var(--dur) var(--ease);
}
.calday:nth-child(7n) { border-right: 0; }
.calday.is-dragover { background: var(--brand-50); box-shadow: inset 0 0 0 2px var(--brand-400); }
.calday.is-outside { background: var(--surface-2); }
.calday.is-today .calday__num { background: var(--brand-600); color: #fff; }
.calday__num { align-self: flex-start; font-size: var(--t-xs); font-weight: 650; font-variant-numeric: tabular-nums; min-width: 22px; height: 22px; padding: 0 6px; border-radius: var(--r-full); display: grid; place-items: center; color: var(--tx-3); }
.calday__add { align-self: stretch; margin-top: auto; opacity: 0; border: 1px dashed var(--line-strong); background: transparent; border-radius: var(--r-sm); font-size: 11px; color: var(--tx-3); padding: 3px; transition: opacity var(--dur) var(--ease); }
.calday:hover .calday__add { opacity: 1; }
.calday__add:hover { border-color: var(--brand-400); color: var(--brand-600); }

.calpost {
  display: block; width: 100%; text-align: left; border: 1px solid var(--line);
  border-left: 3px solid var(--n-400); background: var(--surface);
  border-radius: var(--r-sm); padding: 5px 7px; cursor: grab; box-shadow: var(--sh-xs);
  transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.calpost:hover { box-shadow: var(--sh-sm); transform: translateY(-1px); }
.calpost.is-dragging { opacity: .4; cursor: grabbing; }
.calpost b { display: block; font-size: 11.5px; font-weight: 640; line-height: 1.32; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.calpost__meta { display: flex; align-items: center; gap: 4px; margin-top: 4px; }
.calpost__meta time { font-size: 10px; color: var(--tx-3); font-variant-numeric: tabular-nums; }
.calpost--draft { border-left-color: var(--n-400); }
.calpost--awaiting_approval { border-left-color: var(--warn-500); background: var(--warn-50); }
.calpost--approved { border-left-color: var(--ok-500); }
.calpost--scheduled { border-left-color: var(--brand-500); }
.calpost--published { border-left-color: var(--teal-500); opacity: .84; }
.calpost--failed { border-left-color: var(--risk-500); background: var(--risk-50); }

@media (max-width: 900px) {
  .calendar { grid-template-columns: minmax(0,1fr); }
  .calendar__dow { display: none; }
  .calday { min-height: 0; border-right: 0; }
  .calday.is-outside { display: none; }
  .calday--empty { display: none; }
  .calday__num { align-self: flex-start; }
}

/* Week timeline view */
.weekgrid { display: grid; grid-template-columns: 62px repeat(7, minmax(0,1fr)); }
.weekgrid__hour { font-size: 10.5px; color: var(--tx-weak); text-align: right; padding: 0 8px; height: 52px; border-top: 1px solid var(--line-soft); font-variant-numeric: tabular-nums; }
.weekgrid__cell { height: 52px; border-top: 1px solid var(--line-soft); border-left: 1px solid var(--line-soft); padding: 2px; }
.weekgrid__cell.is-dragover { background: var(--brand-50); }
@media (max-width: 900px) { .weekgrid { display: none; } }

/* ===================== Kanban ===================== */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(272px, 1fr); gap: var(--s-4); overflow-x: auto; padding-bottom: var(--s-3); align-items: start; }
.kancol { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-lg); display: flex; flex-direction: column; min-height: 140px; }
.kancol.is-dragover { border-color: var(--brand-400); background: var(--brand-50); }
.kancol__head { padding: var(--s-3) var(--s-4); display: flex; align-items: center; gap: var(--s-2); border-bottom: 1px solid var(--line); }
.kancol__head b { font-size: var(--t-sm); font-weight: 650; }
.kancol__head .count { margin-left: auto; font-size: var(--t-xs); font-weight: 700; color: var(--tx-3); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-full); padding: 0 7px; }
.kancol__body { padding: var(--s-3); display: flex; flex-direction: column; gap: var(--s-3); }
.kancard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s-3) var(--s-4); box-shadow: var(--sh-xs); cursor: grab; text-align: left; width: 100%; }
.kancard:hover { border-color: var(--brand-300); box-shadow: var(--sh-sm); }
.kancard.is-dragging { opacity: .4; }
.kancard h4 { font-size: var(--t-sm); font-weight: 640; line-height: 1.4; }
.kancard__meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: var(--s-2); font-size: var(--t-xs); color: var(--tx-3); }

/* ===================== Content studio ===================== */
.studio { display: grid; grid-template-columns: 232px minmax(0,1fr) 290px; gap: var(--s-5); align-items: start; }
@media (max-width: 1180px) { .studio { grid-template-columns: 210px minmax(0,1fr); } .studio__aside { grid-column: 1 / -1; } }
@media (max-width: 940px) { .studio { grid-template-columns: minmax(0,1fr); } }
.variantlist { display: flex; flex-direction: column; }
.variantitem {
  display: flex; align-items: center; gap: var(--s-3); padding: 10px var(--s-4);
  border: 0; border-bottom: 1px solid var(--line-soft); background: transparent; text-align: left; width: 100%;
  transition: background var(--dur) var(--ease);
}
.variantitem:hover { background: var(--surface-2); }
.variantitem[aria-selected="true"] { background: var(--brand-50); box-shadow: inset 3px 0 0 var(--brand-600); }
.variantitem b { font-size: var(--t-sm); font-weight: 600; display: block; }
.variantitem span { font-size: var(--t-xs); color: var(--tx-3); display: block; }
.variantitem__state { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--line-strong); }
.variantitem__state--ready { background: var(--ok-500); }
.variantitem__state--gen { background: var(--ai-500); }

.editor { border: 1px solid var(--line-strong); border-radius: var(--r-md); overflow: hidden; background: var(--surface); }
.editor__bar { display: flex; align-items: center; gap: var(--s-2); padding: 7px var(--s-3); background: var(--surface-2); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.editor__bar .spacer { flex: 1; }
.editor textarea { width: 100%; border: 0; padding: var(--s-4); font-size: var(--t-base); line-height: 1.68; resize: vertical; min-height: 190px; background: transparent; }
.editor textarea:focus { outline: none; }
.editor__count { font-size: var(--t-xs); color: var(--tx-3); font-variant-numeric: tabular-nums; }
.editor__count.is-over { color: var(--risk-600); font-weight: 700; }

.phonepreview {
  background: var(--n-900); border-radius: 22px; padding: 10px; box-shadow: var(--sh-lg); max-width: 280px; margin: 0 auto;
}
.phonepreview__screen { background: #fff; border-radius: 15px; overflow: hidden; color: var(--n-900); }
.phonepreview__bar { display: flex; align-items: center; gap: 7px; padding: 9px 11px; border-bottom: 1px solid #eceff4; }
.phonepreview__bar b { font-size: 11.5px; font-weight: 650; }
.phonepreview__media { aspect-ratio: 4/5; background: linear-gradient(135deg,#dbe7f5,#eef4fd); display: grid; place-items: center; color: #7f93ad; font-size: 11px; text-align: center; padding: var(--s-4); }
.phonepreview__media--video { aspect-ratio: 9/16; background: linear-gradient(160deg,#1d2b3f,#38506e); color: #cfdcec; }
.phonepreview__cap { padding: 10px 11px; font-size: 11.5px; line-height: 1.5; color: #262d37; }
.phonepreview__cap b { font-weight: 650; }
.phonepreview__tags { color: #2563c4; }

/* ===================== Storyboard ===================== */
.storyboard { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px,1fr)); gap: var(--s-4); }
.shot { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--surface); }
.shot__frame { aspect-ratio: 9/16; background: linear-gradient(165deg, var(--brand-900), var(--brand-700)); color: #b9cee8; display: flex; flex-direction: column; justify-content: space-between; padding: var(--s-3); position: relative; }
.shot__no { font-size: 10px; font-weight: 800; letter-spacing: .1em; color: #7f9cc0; }
.shot__frame p { font-size: var(--t-xs); line-height: 1.45; color: #dce8f6; }
.shot__time { position: absolute; top: var(--s-3); right: var(--s-3); font-size: 10px; font-variant-numeric: tabular-nums; background: rgba(255,255,255,.14); border-radius: var(--r-sm); padding: 1px 5px; }
.shot__body { padding: var(--s-3); }
.shot__body b { font-size: var(--t-xs); font-weight: 650; display: block; }
.shot__body p { font-size: var(--t-xs); color: var(--tx-3); margin-top: 3px; line-height: 1.5; }

/* ===================== Inbox ===================== */
.inbox { display: grid; grid-template-columns: 386px minmax(0,1fr); align-items: start; }
@media (max-width: 1160px) { .inbox { grid-template-columns: minmax(0,1fr); } .inbox__detail { border-left: 0; border-top: 1px solid var(--line); } }
.inbox__list { border-right: 1px solid var(--line); max-height: calc(100vh - 210px); overflow-y: auto; }
.inbox__detail { display: flex; flex-direction: column; min-height: 520px; }
.msgrow { width: 100%; display: flex; gap: var(--s-3); padding: var(--s-4); border: 0; border-bottom: 1px solid var(--line-soft); background: transparent; text-align: left; position: relative; transition: background var(--dur) var(--ease); }
.msgrow:hover { background: var(--surface-2); }
.msgrow[aria-selected="true"] { background: var(--brand-50); }
.msgrow[aria-selected="true"]::before { content:""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--brand-600); }
.msgrow__body { flex: 1; min-width: 0; }
.msgrow__top { display: flex; align-items: center; gap: 6px; }
.msgrow__top b { font-size: var(--t-sm); font-weight: 650; }
.msgrow__top time { margin-left: auto; font-size: 11px; color: var(--tx-weak); white-space: nowrap; }
.msgrow p { font-size: var(--t-xs); color: var(--tx-2); margin-top: 4px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.msgrow__tags { display: flex; gap: 5px; margin-top: 7px; flex-wrap: wrap; }

.slapill { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: var(--r-full); }
.slapill--ok { background: var(--ok-50); color: var(--ok-600); }
.slapill--soon { background: var(--warn-50); color: var(--warn-600); }
.slapill--late { background: var(--risk-50); color: var(--risk-600); }

.replybox { border: 1px solid var(--line-strong); border-radius: var(--r-md); overflow: hidden; }
.replybox__head { display: flex; align-items: center; gap: var(--s-2); padding: 8px var(--s-3); background: var(--ai-50); border-bottom: 1px solid var(--line); font-size: var(--t-xs); font-weight: 650; color: var(--ai-600); }
.replybox__head svg { width: 14px; height: 14px; }
.replybox textarea { width: 100%; border: 0; padding: var(--s-4); font-size: var(--t-base); line-height: 1.65; resize: vertical; min-height: 130px; background: var(--surface); }
.replybox textarea:focus { outline: none; }
.replybox__foot { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-3); border-top: 1px solid var(--line); background: var(--surface-2); flex-wrap: wrap; }

/* ===================== Knowledge readiness ===================== */
.readyrow { display: grid; grid-template-columns: minmax(0,1.5fr) 120px repeat(5, 74px) 110px; gap: var(--s-3); align-items: center; padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--line-soft); }
.readyrow:last-child { border-bottom: 0; }
.readyrow--head { font-size: var(--t-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--tx-3); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.readyrow--head > * { text-align: center; }
.readyrow--head > *:first-child { text-align: left; }
.signal { width: 26px; height: 26px; margin: 0 auto; border-radius: var(--r-sm); display: grid; place-items: center; }
.signal svg { width: 14px; height: 14px; }
.signal--yes { background: var(--ok-50); color: var(--ok-600); }
.signal--partial { background: var(--warn-50); color: var(--warn-600); }
.signal--no { background: var(--risk-50); color: var(--risk-600); }
@media (max-width: 1240px) { .readyrow { grid-template-columns: minmax(0,1fr) 100px; } .readyrow .signal, .readyrow__sigh { display: none; } }

/* ===================== Executive report ===================== */
.report { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.report__cover { padding: var(--s-9) var(--s-8) var(--s-7); border-bottom: 3px solid var(--brand-600); }
.report__cover .eyebrow { color: var(--tx-3); }
.report__cover h1 { font-family: var(--font-editorial); font-size: var(--t-4xl); font-weight: 600; letter-spacing: -.02em; line-height: 1.12; }
.report__cover p { margin-top: var(--s-4); color: var(--tx-2); font-size: var(--t-md); max-width: 62ch; }
.report__meta { display: flex; gap: var(--s-7); flex-wrap: wrap; margin-top: var(--s-6); padding-top: var(--s-5); border-top: 1px solid var(--line); font-size: var(--t-sm); }
.report__meta b { display: block; font-size: var(--t-xs); color: var(--tx-3); font-weight: 650; text-transform: uppercase; letter-spacing: .06em; }
.report__section { padding: var(--s-7) var(--s-8); border-bottom: 1px solid var(--line-soft); }
.report__section:last-child { border-bottom: 0; }
.report__section > h2 { font-family: var(--font-editorial); font-size: var(--t-xl); font-weight: 600; margin-bottom: var(--s-4); }
.report__lede { font-family: var(--font-editorial); font-size: var(--t-lg); line-height: 1.58; color: var(--tx); }
@media (max-width: 760px) { .report__cover, .report__section { padding: var(--s-6) var(--s-5); } .report__cover h1 { font-size: var(--t-2xl); } }

/* ===================== RFP alignment ===================== */
.rfprow { display: grid; grid-template-columns: 46px minmax(0,1fr) minmax(0,1fr); gap: var(--s-4); padding: var(--s-5); border-bottom: 1px solid var(--line-soft); }
.rfprow:last-child { border-bottom: 0; }
.rfprow__no { width: 34px; height: 34px; border-radius: 9px; background: var(--brand-50); color: var(--brand-700); display: grid; place-items: center; font-size: var(--t-xs); font-weight: 800; }
.rfprow__q { font-size: var(--t-sm); }
.rfprow__q b { display: block; font-weight: 640; margin-bottom: 5px; }
.rfprow__q blockquote { margin: 0; font-size: var(--t-xs); color: var(--tx-3); border-left: 2px solid var(--line-strong); padding-left: var(--s-3); line-height: 1.55; font-style: italic; }
.rfprow__a { font-size: var(--t-sm); }
.rfprow__a b { display: block; font-weight: 640; margin-bottom: 5px; color: var(--brand-700); }
.rfprow__a p { color: var(--tx-2); font-size: var(--t-xs); line-height: 1.6; }
@media (max-width: 900px) { .rfprow { grid-template-columns: minmax(0,1fr); } .rfprow__no { display: none; } }

/* ===================== Permission matrix ===================== */
.permtable th:first-child, .permtable td:first-child { position: sticky; left: 0; background: var(--surface); z-index: 2; }
.permtable th:first-child { background: var(--surface-2); z-index: 3; }
.permtable td { text-align: center; }
.permtable td:first-child { text-align: left; }
.permmark { width: 20px; height: 20px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; }
.permmark svg { width: 12px; height: 12px; }
.permmark--on { background: var(--ok-50); color: var(--ok-600); }
.permmark--off { background: var(--surface-3); color: var(--n-400); }

/* ===================== Loop diagram ===================== */
.loop { display: flex; align-items: stretch; gap: 0; flex-wrap: wrap; }
.loopstep { flex: 1; min-width: 128px; padding: var(--s-4) var(--s-3); text-align: center; position: relative; border-radius: var(--r-md); transition: background var(--dur) var(--ease); }
.loopstep:hover { background: var(--surface-2); }
.loopstep__ring { width: 40px; height: 40px; margin: 0 auto var(--s-2); border-radius: 50%; display: grid; place-items: center; background: var(--brand-50); color: var(--brand-600); }
.loopstep__ring svg { width: 19px; height: 19px; }
.loopstep b { display: block; font-size: var(--t-sm); font-weight: 650; }
.loopstep span { display: block; font-size: var(--t-xs); color: var(--tx-3); margin-top: 3px; line-height: 1.45; }
.loopstep::after { content: ""; position: absolute; top: 34px; right: -6px; width: 12px; height: 12px; border-top: 2px solid var(--line-strong); border-right: 2px solid var(--line-strong); transform: rotate(45deg); }
.loopstep:last-child::after { display: none; }
@media (max-width: 860px) { .loopstep::after { display: none; } .loopstep { min-width: 45%; } }

/* ===================== Charts ===================== */
.chart { width: 100%; overflow: visible; }
.chart text { font-family: var(--font); fill: var(--tx-3); font-size: 11px; }
.chart .tick { font-variant-numeric: tabular-nums; }
.chart .axis line, .chart .axis path { stroke: var(--line); }
.chart .gridline { stroke: var(--viz-grid); stroke-width: 1; }
.chart .series-line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart .series-area { opacity: .1; }
.chart .dot { stroke: var(--viz-surface); stroke-width: 2; }
.chart .bar { transition: opacity var(--dur) var(--ease); }
.chart .bar:hover { opacity: .8; }
.chart .value-label { fill: var(--tx); font-weight: 650; font-variant-numeric: tabular-nums; }
.chartlegend { display: flex; flex-wrap: wrap; gap: var(--s-4); margin-top: var(--s-3); font-size: var(--t-xs); color: var(--tx-2); }
.chartlegend button { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; color: inherit; font-size: inherit; padding: 0; }
.chartlegend button[aria-pressed="false"] { opacity: .38; }
.chartlegend i { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.charttip {
  position: fixed; z-index: 120; pointer-events: none;
  background: var(--n-900); color: #fff; border-radius: var(--r-md); padding: 8px 11px;
  font-size: var(--t-xs); box-shadow: var(--sh-lg); line-height: 1.5; white-space: nowrap;
}
[data-theme="dark"] .charttip { background: var(--n-700); border: 1px solid var(--line); }
.charttip b { font-weight: 650; }
.charttip__row { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.charttip__row i { width: 7px; height: 7px; border-radius: 2px; flex: none; }
.charttip__row em { font-style: normal; margin-left: auto; font-weight: 650; font-variant-numeric: tabular-nums; padding-left: var(--s-3); }

/* ===================== Print ===================== */
@media print {
  .sidebar, .topbar, .notice, .copilot-fab, .copilot, .toaststack, .pagehead__actions, .no-print { display: none !important; }
  .main { margin-left: 0; }
  .page { padding: 0; max-width: none; }
  .card, .report { box-shadow: none; border-color: #d0d0d0; break-inside: avoid; }
  .report__section { break-inside: avoid; }
  body { background: #fff; }
  a { color: inherit; text-decoration: none; }
}

/* Chart boxes reserve height, then draw at measured width (never stretched). */
.chartbox { width: 100%; overflow: hidden; }
.chartbox > svg { display: block; }
.chartfig { display: block; }

/* ===================== Answer engine test ===================== */
.simrig { padding: var(--s-5); background: linear-gradient(140deg, var(--brand-900), #10294a 55%, #16203f); border-color: transparent; }
.simrig__bar {
  display: flex; align-items: center; gap: var(--s-3);
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16);
  border-radius: var(--r-lg); padding: 7px 7px 7px var(--s-4);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.simrig__bar:focus-within { border-color: rgba(255,255,255,.4); background: rgba(255,255,255,.12); }
.simrig__icon { color: #8fb0d6; display: grid; place-items: center; flex: none; }
.simrig__icon svg { width: 20px; height: 20px; }
.simrig__input {
  flex: 1; min-width: 0; background: transparent; border: 0; outline: none;
  color: #fff; font-size: var(--t-lg); font-weight: 500; padding: 10px 0;
}
.simrig__input::placeholder { color: #7f9cc0; font-weight: 400; }
.simrig .btn--primary { background: #fff; color: var(--brand-800); border-color: #fff; flex: none; }
.simrig .btn--primary:hover { background: #e6eefb; border-color: #e6eefb; }
.simrig__suggest { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; margin-top: var(--s-4); }
.simrig__suggest .chip { background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.16); color: #cfdcec; }
.simrig__suggest .chip:hover { background: rgba(255,255,255,.15); color: #fff; border-color: rgba(255,255,255,.3); }
.simrig__suggest .chip[aria-pressed="true"] { background: #fff; color: var(--brand-800); border-color: #fff; }
.simrig__suggest .muted { color: #8fb0d6; }
.simrig__note {
  display: flex; gap: var(--s-3); align-items: flex-start; margin-top: var(--s-4);
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14);
  border-radius: var(--r-md); padding: var(--s-3) var(--s-4);
  font-size: var(--t-sm); line-height: 1.6; color: #c3d4e8;
}
.simrig__note svg { width: 16px; height: 16px; flex: none; color: #86e0b6; margin-top: 2px; }
.simrig__note b { color: #fff; }
@media (max-width: 720px) {
  .simrig { padding: var(--s-4); }
  .simrig__bar { flex-wrap: wrap; padding: var(--s-3); gap: var(--s-2); }
  .simrig__icon { display: none; }
  .simrig__input { font-size: var(--t-base); width: 100%; min-width: 0; padding: 4px 0; }
  .simrig .btn--primary { width: 100%; justify-content: center; min-width: 0; padding: 11px var(--s-3); }
  .simstage { grid-template-columns: minmax(0,1fr); }
}

.simstage { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: var(--s-4); align-items: start; }
.enginecard {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--sh-xs); overflow: hidden; display: flex; flex-direction: column;
  animation: blockIn 420ms var(--ease) both; animation-delay: var(--delay, 0ms);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.enginecard.is-running { border-color: var(--brand-400); box-shadow: var(--sh-md); }
.enginecard.is-waiting { opacity: .55; }
.enginecard.is-done { border-color: var(--line); }
.enginecard__head { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-4); border-bottom: 1px solid var(--line-soft); }
.enginecard__head b { display: block; font-size: var(--t-sm); font-weight: 650; }
.enginecard__state { display: flex; align-items: center; gap: 5px; font-size: var(--t-xs); color: var(--tx-3); margin-top: 2px; }
.enginecard__score {
  flex: none; font-size: var(--t-xl); font-weight: 700; letter-spacing: -.03em;
  color: var(--tx); font-variant-numeric: tabular-nums; min-width: 34px; text-align: right;
}
.enginecard__body { padding: var(--s-4); flex: 1; }
.enginecard__answer {
  font-size: var(--t-sm); line-height: 1.66; color: var(--tx-2); min-height: 92px;
  border-left: 2px solid var(--line-strong); padding-left: var(--s-3);
}
.enginecard.is-running .enginecard__answer { border-left-color: var(--brand-500); }
.enginecard__verdict { display: flex; flex-wrap: wrap; gap: 5px; padding: var(--s-3) var(--s-4); border-top: 1px solid var(--line-soft); background: var(--surface-2); }

/* ===================== Story mode ===================== */
body.story-on { padding-bottom: var(--storybar-h, 200px); }
body.story-on .copilot-fab, body.story-on .copilot { bottom: calc(var(--storybar-h, 200px) + 12px); }

.story-spot {
  position: fixed; z-index: 108; border-radius: var(--r-lg); pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(8,14,24,.58), 0 0 0 2px var(--brand-400), 0 0 44px rgba(74,132,218,.42);
  transition: all 420ms var(--ease), opacity 260ms var(--ease);
}

.storybar {
  position: fixed; inset: auto 0 0 0; z-index: 112;
  background: linear-gradient(180deg, #0d1a2e 0%, #091524 100%);
  border-top: 1px solid rgba(255,255,255,.1);
  box-shadow: 0 -18px 50px rgba(5,10,18,.45);
  display: grid; grid-template-columns: minmax(0,1fr) auto;
  grid-template-areas: "rail rail" "body controls";
  gap: 0 var(--s-6); padding: 0 var(--s-6) var(--s-5);
  animation: storyIn 380ms var(--ease);
  color: #dbe6f2;
}
@keyframes storyIn { from { transform: translateY(100%); } }

.storybar__rail { grid-area: rail; display: flex; gap: 4px; padding: var(--s-4) 0 var(--s-4); }
.storybar__tick {
  flex: 1; height: 4px; border: 0; padding: 0; border-radius: var(--r-full);
  background: rgba(255,255,255,.16); overflow: hidden; cursor: pointer; position: relative;
  transition: height var(--dur) var(--ease), background var(--dur) var(--ease);
}
.storybar__tick:hover { background: rgba(255,255,255,.3); height: 7px; margin-top: -1.5px; }
.storybar__tick[aria-selected="true"] { height: 7px; margin-top: -1.5px; }
.storybar__fill { display: block; height: 100%; background: #86e0b6; border-radius: var(--r-full); }
@keyframes storyFill { from { width: 0; } to { width: 100%; } }

.storybar__body { grid-area: body; min-width: 0; }
.storybar__meta { display: flex; align-items: center; gap: var(--s-3); }
.storybar__chapter {
  font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #86e0b6;
}
.storybar__count { font-size: var(--t-xs); color: #7f9cc0; font-variant-numeric: tabular-nums; }
.storybar__body h3 { font-size: var(--t-lg); color: #fff; margin-top: 5px; letter-spacing: -.02em; }
.storybar__body p { font-size: var(--t-sm); line-height: 1.6; color: #b5c8de; margin-top: 6px; max-width: 108ch; }

.storybar__controls { grid-area: controls; display: flex; align-items: center; gap: var(--s-2); align-self: center; }
.storybar__controls .iconbtn { color: #b5c8de; }
.storybar__controls .iconbtn:hover { background: rgba(255,255,255,.1); color: #fff; }
.storybar__controls .iconbtn[disabled] { opacity: .3; pointer-events: none; }
.storybar__play {
  width: 46px; height: 46px; border-radius: 50%; border: 0; flex: none;
  background: #fff; color: var(--brand-800); display: grid; place-items: center;
  box-shadow: 0 4px 16px rgba(0,0,0,.3); transition: transform var(--dur) var(--ease);
}
.storybar__play:hover { transform: scale(1.06); }
.storybar__play svg { width: 19px; height: 19px; }
.storybar__sep { width: 1px; height: 26px; background: rgba(255,255,255,.16); margin: 0 var(--s-2); }
.storybar__controls .btn { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.2); color: #dbe6f2; }
.storybar__controls .btn:hover { background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.34); }

@media (max-width: 900px) {
  body.story-on { padding-bottom: var(--storybar-h, 270px); }
  .storybar { grid-template-columns: minmax(0,1fr); grid-template-areas: "rail" "body" "controls"; padding: 0 var(--s-4) var(--s-4); }
  .storybar__controls { justify-content: center; margin-top: var(--s-4); }
  .storybar__body p { font-size: var(--t-xs); max-height: 88px; overflow: hidden; }
  .story-spot { display: none; }
}

/* ===================== Welcome gate ===================== */
.welcome {
  position: fixed; inset: 0; z-index: 130; display: grid; place-items: center; padding: var(--s-6);
  background: radial-gradient(1200px 700px at 70% 10%, #1b3d6b 0%, #0d1f38 45%, #070e1a 100%);
  animation: fadeIn 420ms var(--ease);
}
.welcome__panel { width: min(960px, 100%); color: #dbe6f2; animation: blockIn 620ms var(--ease) both; }
.welcome__eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: #86e0b6;
  display: flex; align-items: center; gap: 9px;
}
.welcome__panel h1 {
  font-size: clamp(2rem, 4.6vw, 3.4rem); color: #fff; letter-spacing: -.032em;
  line-height: 1.08; margin-top: var(--s-4);
}
.welcome__panel h1 em { font-style: normal; color: #86e0b6; }
.welcome__panel > p { font-size: var(--t-md); line-height: 1.62; color: #a9bfd8; margin-top: var(--s-5); max-width: 74ch; }
.welcome__stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: var(--s-4); margin-top: var(--s-7); }
.welcome__stat { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); border-radius: var(--r-lg); padding: var(--s-4); }
.welcome__stat b { display: block; font-size: var(--t-2xl); color: #fff; font-weight: 700; letter-spacing: -.03em; }
.welcome__stat span { display: block; font-size: var(--t-xs); color: #8fb0d6; margin-top: 4px; line-height: 1.45; }
.welcome__actions { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-7); align-items: center; }
.welcome__actions .btn--primary { background: #fff; color: var(--brand-800); border-color: #fff; }
.welcome__actions .btn--primary:hover { background: #e6eefb; border-color: #e6eefb; }
.welcome__actions .btn { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.22); color: #fff; }
.welcome__actions .btn:hover { background: rgba(255,255,255,.18); }
.welcome__foot { margin-top: var(--s-7); padding-top: var(--s-4); border-top: 1px solid rgba(255,255,255,.12); font-size: var(--t-xs); color: #7f9cc0; line-height: 1.6; }
@media (max-width: 760px) {
  .welcome__stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .welcome__actions .btn { width: 100%; justify-content: center; }
}

/* ===================== Live activity feed ===================== */
.feed { max-height: 340px; overflow-y: auto; }
.feeditem {
  display: flex; gap: var(--s-3); padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--line-soft); align-items: flex-start;
}
.feeditem:last-child { border-bottom: 0; }
.feeditem.is-new { animation: slideInRight 420ms var(--ease) both; }
.feeditem__dot { width: 8px; height: 8px; border-radius: 50%; flex: none; margin-top: 6px; }
.feeditem__dot--live { background: var(--ok-500); animation: pulseRing 2.2s infinite; }
.feeditem b { font-size: var(--t-sm); font-weight: 620; display: block; line-height: 1.4; }
.feeditem p { font-size: var(--t-xs); color: var(--tx-3); margin-top: 2px; line-height: 1.5; }
.feeditem time { font-size: 11px; color: var(--tx-weak); flex: none; font-variant-numeric: tabular-nums; margin-left: auto; padding-left: var(--s-3); }
.livedot { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-xs); font-weight: 650; color: var(--ok-600); }
.livedot i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok-500); animation: pulseRing 2.2s infinite; }

/* ===================== Capability map ===================== */
.capgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: var(--s-4); }
.capcard {
  border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s-4);
  background: var(--surface-2); display: flex; flex-direction: column; gap: var(--s-3);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.capcard:hover { border-color: var(--brand-300); box-shadow: var(--sh-sm); }
.capcard__top { display: flex; align-items: center; gap: var(--s-3); }
.capcard__icon {
  width: 36px; height: 36px; flex: none; border-radius: 10px; display: grid; place-items: center;
  background: var(--brand-50); color: var(--brand-600);
}
.capcard__icon svg { width: 18px; height: 18px; }
.capcard__top b { display: block; font-size: var(--t-sm); font-weight: 650; line-height: 1.3; }
.capcard__top span { display: block; font-size: var(--t-xs); color: var(--tx-3); margin-top: 2px; }
.capcard p { font-size: var(--t-xs); color: var(--tx-2); line-height: 1.6; flex: 1; }
.capcard .chiprow { gap: 5px; }
.capcard .chip { font-size: 11px; padding: 3px 8px; }
