@font-face {
  font-family: 'Barlow Semi Condensed';
  src: url('../assets/fonts/barlow-semi-condensed-600.woff2') format('woff2');
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Barlow Semi Condensed';
  src: url('../assets/fonts/barlow-semi-condensed-700.woff2') format('woff2');
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'Source Sans 3';
  src: url('../assets/fonts/source-sans-3-400.woff2') format('woff2');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Source Sans 3';
  src: url('../assets/fonts/source-sans-3-600.woff2') format('woff2');
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

:root {
  --ink: #142b34;
  --ink-deep: #0c2028;
  --paper: #f5f3ee;
  --white: #fff;
  --teal: #087f75;
  --teal-light: #74d1c3;
  --slate: #53656c;
  --line: #cfd8d6;
  --soft: #e4efeb;
  --display: 'Barlow Semi Condensed', 'Arial Narrow', sans-serif;
  --body: 'Source Sans 3', 'Segoe UI', sans-serif;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.5; }
button { font: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: fixed; z-index: 100; top: 8px; left: 8px; padding: 10px 16px; border: 1px solid var(--line); background: var(--white); transform: translateY(-150%); }
.skip-link:focus { transform: none; }

/* ---------- shell: the landing hero's topbar + rail, full screen ---------- */
.app { min-height: 100vh; display: grid; grid-template-columns: 216px minmax(0, 1fr); grid-template-rows: 58px minmax(0, 1fr); }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; padding: 0 20px; background: var(--ink-deep); color: #dfe9e7; font-size: 13px; }
.logo-chip { flex: none; padding: 5px 9px; border-radius: 5px; background: #fff; font-size: 20px; }
/* The ArqDocs logo is an SVG cropped to the mark + wordmark, so it just scales with the chip's font size. */
.logo { display: block; width: auto; height: 1em; }
.crumb { overflow: hidden; color: #dfe9e7; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.view-as { display: flex; flex: none; align-items: center; gap: 6px; color: #b6cac8; font-size: 12px; }
.view-as select { width: auto; padding: 4px 8px; border: 1px solid #36525b; border-radius: 5px; background: #17323b; color: #fff; font-size: 13px; }
.demo-badge { flex: none; padding: 3px 9px; border: 1px solid #74d1c3; border-radius: 999px; color: #74d1c3; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.notice { flex: 1; margin: 0; color: #74d1c3; font-size: 13px; text-align: right; }
.top-btn { flex: none; padding: 6px 11px; border: 1px solid #36525b; border-radius: 5px; background: none; color: #dfe9e7; cursor: pointer; }
.top-btn:hover { background: #17323b; }
.avatar { width: 32px; height: 32px; display: grid; flex: none; place-items: center; border-radius: 50%; background: #d7e9e5; color: #142b34; font-size: 11px; font-weight: 600; }
.rail { display: flex; flex-direction: column; gap: 3px; padding: 18px 12px; border-right: 1px solid var(--line); background: var(--soft); }
.rail small { margin: 18px 10px 4px; color: var(--slate); font-size: 10px; font-weight: 600; letter-spacing: .13em; text-transform: uppercase; }
.rail a { display: flex; align-items: center; justify-content: space-between; padding: 9px 10px; border-radius: 5px; color: var(--slate); font-size: 15px; text-decoration: none; }
.rail a:hover { background: var(--paper); color: var(--ink); }
.rail a[aria-current="page"] { background: var(--white); color: var(--teal); font-weight: 600; box-shadow: inset 3px 0 0 var(--teal); }
.count { min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--teal); color: #fff; font-size: 12px; font-weight: 600; text-align: center; }
.view { min-width: 0; padding: 32px clamp(16px, 3vw, 44px) 64px; }
.view:focus { outline: none; }

/* ---------- shared pieces ---------- */
.view-heading { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 20px; margin-bottom: 24px; }
.view-heading small, .label { color: var(--teal); font-size: 11px; font-weight: 600; letter-spacing: .13em; text-transform: uppercase; }
.view-heading h1 { margin: 4px 0 0; font: 600 clamp(30px, 3.4vw, 44px)/1.05 var(--display); letter-spacing: -.02em; }
.view-aside { padding: 5px 10px; border: 1px solid var(--line); border-radius: 4px; color: var(--slate); font-size: 12px; }
.section-title { margin: 34px 0 12px; font: 600 24px/1.1 var(--display); }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.card { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); }
.card h2 { margin: 0 0 10px; font: 600 22px/1.15 var(--display); }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.ok { background: var(--soft); color: var(--teal); }
.pill.rev { background: #f6ecd9; color: #8a6424; }
.pill.act { background: #f5e2df; color: #94473f; }
.pill.draft { border: 1px solid var(--line); background: var(--paper); color: var(--slate); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chip { padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--white); color: var(--slate); font-size: 13px; cursor: pointer; }
.chip[aria-pressed="true"] { border-color: var(--teal); background: var(--soft); color: var(--teal); font-weight: 600; }
.source-chip { padding: 2px 8px; border: 1px solid var(--line); border-radius: 4px; background: var(--paper); color: var(--teal); font-size: 12px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.source-chip:hover { border-color: var(--teal); }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 1px solid var(--teal); border-radius: 5px; background: var(--teal); color: #fff; font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--teal); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.linkish { padding: 0; border: 0; background: none; color: var(--teal); font-weight: 600; text-decoration: underline; cursor: pointer; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--white); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { padding: 10px 12px; background: var(--soft); color: var(--slate); font-size: 11px; letter-spacing: .1em; text-align: left; text-transform: uppercase; }
td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: top; }
td b { color: var(--teal); }
.empty { padding: 24px; color: var(--slate); text-align: center; }
.muted { color: var(--slate); font-size: 13px; }
.error { color: #b3473d; font-weight: 600; }
.field { display: grid; gap: 5px; margin-bottom: 12px; font-size: 14px; font-weight: 600; }
input[type="text"], input[type="search"], input[type="password"], textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 5px; background: var(--white); color: var(--ink); font: inherit; font-weight: 400; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.list { margin: 0; padding: 0; list-style: none; }
.list li { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list li > span { flex: 1 1 260px; }
.fields { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 12px 0; font-size: 14px; }
.fields dt { color: var(--slate); }
.fields dd { margin: 0; }

@media (max-width: 800px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr); }
  .topbar { flex-wrap: wrap; gap: 8px; padding: 8px 16px; }
  .avatar { display: none; }
  .notice { flex-basis: 100%; order: 9; text-align: left; }
  .rail { flex-direction: row; overflow-x: auto; padding: 8px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .rail small { display: none; }
  .rail a { flex: none; gap: 6px; white-space: nowrap; }
  .view { padding: 22px 16px 48px; }
}

/* ---------- overview ---------- */
.counts { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.counts a { padding: 10px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); color: var(--slate); text-decoration: none; }
.counts a:hover { border-color: var(--teal); }
.counts b { margin-right: 4px; color: var(--teal); font: 700 26px/1 var(--display); }
.overview-grid { display: grid; align-items: start; gap: 14px; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.zone-attention { grid-row: span 2; border-top: 3px solid var(--teal); }
.refs { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
@media (max-width: 1000px) { .overview-grid { grid-template-columns: minmax(0, 1fr); } .zone-attention { grid-row: auto; } }

/* ---------- data hub ---------- */
.toolbar input[type="search"] { max-width: 460px; }
.row-link { padding: 0; border: 0; background: none; color: inherit; text-align: left; cursor: pointer; }
.row-link:hover b, .row-link:focus-visible b { text-decoration: underline; }
tr.is-highlight td { background: var(--soft); }
tr.is-highlight td:first-child { box-shadow: inset 3px 0 0 var(--teal); }
.temp-upload { margin-top: 18px; }
.temp-upload summary { font-weight: 600; cursor: pointer; }
.temp-upload .btn { position: relative; }

/* ---------- shared side panel (records and reviews) ---------- */
.drawer { position: fixed; z-index: 20; top: 58px; right: 0; bottom: 0; width: min(440px, 100%); display: flex; flex-direction: column; border-left: 1px solid var(--line); background: var(--white); box-shadow: -18px 0 40px rgba(17, 54, 60, .12); }
.drawer-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.drawer-head .label { flex: 1; }
.drawer-icon { width: 34px; height: 34px; border: 0; border-radius: 5px; background: none; color: var(--slate); font-size: 22px; line-height: 1; cursor: pointer; }
.drawer-icon:hover { background: var(--paper); color: var(--ink); }
.drawer-body { overflow-y: auto; padding: 18px; }
.drawer-body h2 { margin: 0 0 8px; font: 600 26px/1.1 var(--display); }
.drawer-body h3 { margin: 22px 0 8px; color: var(--slate); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
.linked { margin: 0; padding: 0; list-style: none; }
.linked li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 14px; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
@media (min-width: 1200px) { body.has-drawer .view { padding-right: 480px; } }
@media (max-width: 800px) { .drawer { top: 0; } }
@media (prefers-reduced-motion: no-preference) {
  .drawer:not([hidden]) { animation: drawer-in .18s ease-out; }
  @keyframes drawer-in { from { opacity: 0; transform: translateX(24px); } }
}

/* ---------- assistant ---------- */
.question-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin-bottom: 14px; }
.question { min-height: 74px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); color: var(--ink); font-size: 16px; font-weight: 600; text-align: left; cursor: pointer; }
.question:hover { border-color: var(--teal); }
.question.is-on { border-color: var(--teal); background: var(--soft); box-shadow: inset 3px 0 0 var(--teal); }
.ask-form { display: flex; gap: 8px; max-width: 640px; margin-bottom: 18px; }
.sim-label { display: inline-block; margin: 0 0 12px; padding: 3px 9px; border: 1px dashed var(--slate); border-radius: 4px; color: var(--slate); font-size: 12px; font-weight: 600; }
.answer-parts { display: grid; gap: 18px; grid-template-columns: 1.2fr 1fr 1fr; }
.answer-parts > div + div { padding-left: 18px; border-left: 1px solid var(--line); }
.answer-parts h2 { color: var(--teal); font-size: 18px; }
@media (max-width: 1000px) { .answer-parts { grid-template-columns: minmax(0, 1fr); } .answer-parts > div + div { padding: 14px 0 0; border-left: 0; border-top: 1px solid var(--line); } }

/* ---------- agent ---------- */
.request { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 18px; padding: 10px 14px; border-radius: 8px; background: var(--ink-deep); color: #dfe9e7; }
.request .label { color: #74d1c3; }
.flow-cards { display: grid; gap: 34px; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; padding: 0; list-style: none; }
.flow-card { position: relative; display: grid; align-content: start; gap: 4px; padding: 14px; border: 1px solid var(--line); border-top: 3px solid var(--teal); border-radius: 8px; background: var(--white); }
.flow-card p { margin: 4px 0 6px; }
.flow-card .source-chip { justify-self: start; }
.flow-card + .flow-card::before { content: '→'; position: absolute; top: 42%; left: -26px; color: var(--teal); font-size: 22px; font-weight: 700; }
.flow-card:last-child { background: var(--soft); }
.skipped { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0 0; padding: 10px 14px; border: 1px dashed var(--line); border-radius: 8px; color: var(--slate); font-size: 14px; }
.proposal.is-sent { border-color: #d9c49a; background: #fdfaf3; }
@media (max-width: 1000px) {
  .flow-cards { gap: 30px; grid-template-columns: minmax(0, 1fr); }
  .flow-card + .flow-card::before { content: '↓'; top: -28px; left: 20px; }
}

/* ---------- reviews ---------- */
.list.card { padding: 4px 18px; }
.proposal-text { padding: 12px 14px; border-left: 3px solid #b88b3d; border-radius: 4px; background: var(--paper); }
.note { padding: 10px 12px; border-radius: 6px; background: var(--soft); font-size: 14px; }
blockquote { margin: 8px 0 0; padding: 8px 12px; border-left: 3px solid var(--line); color: var(--slate); }

/* ---------- platform controls and pilot ---------- */
.lead { max-width: 70ch; margin: 0 0 18px; font-size: 18px; }
.path { margin: 0; padding-left: 18px; font-size: 14px; }
.path li { padding: 3px 0; }

/* ---------- sign-in, top bar chip and account menu ---------- */
body.is-signin .topbar, body.is-signin .rail { display: none; }
body.is-signin .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
body.is-signin .view { padding: 0; }
.signin { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.signin-brand { display: flex; flex-direction: column; justify-content: center; gap: 24px; padding: clamp(28px, 6vw, 80px); background: var(--ink-deep); color: #dfe9e7; }
.signin-brand h1 { max-width: 14ch; margin: 0; color: #fff; font: 600 clamp(36px, 4.4vw, 60px)/1.02 var(--display); letter-spacing: -.02em; }
.signin-brand ul { display: grid; gap: 8px; margin: 0; padding: 0; color: #74d1c3; font-weight: 600; list-style: none; }
.signin-brand li::before { content: '▸ '; }
.logo-chip.big { align-self: flex-start; font-size: 34px; }
.signin-card { align-self: center; justify-self: center; width: min(420px, 100% - 32px); padding: 32px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); box-shadow: 0 24px 60px rgba(17, 54, 60, .1); }
.signin-card h2 { margin: 0 0 8px; font: 600 30px/1.1 var(--display); }
.btn.sso { width: 100%; justify-content: center; margin: 18px 0 10px; padding: 12px; font-size: 16px; }
.role-cards { display: grid; gap: 10px; margin: 18px 0 14px; }
.role-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); color: var(--ink); text-align: left; cursor: pointer; }
.role-card:hover, .role-card:focus-visible { border-color: var(--teal); background: var(--soft); }
.role-initials { width: 38px; height: 38px; display: grid; flex: none; place-items: center; border-radius: 50%; background: #d7e9e5; color: #142b34; font-size: 13px; font-weight: 700; }
.small { font-size: 12px; }
.topbar { position: relative; }
.sample-chip { flex: none; padding: 2px 8px; border: 1px solid #36525b; border-radius: 999px; color: #9fb8b6; font-size: 11px; white-space: nowrap; }
button.avatar { border: 0; cursor: pointer; }
.user-menu { position: absolute; z-index: 30; top: 52px; right: 16px; display: grid; min-width: 230px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); color: var(--ink); box-shadow: 0 16px 40px rgba(17, 54, 60, .18); }
.user-menu p { margin: 4px 8px 8px; font-size: 13px; }
.user-menu p span { color: var(--slate); }
.user-menu button { padding: 8px; border: 0; border-radius: 5px; background: none; color: var(--ink); text-align: left; cursor: pointer; }
.user-menu button:hover { background: var(--soft); }
@media (max-width: 800px) {
  .signin { grid-template-columns: minmax(0, 1fr); }
  .signin-brand { padding: 28px 16px; }
  .topbar .avatar { display: grid; }
  .sample-chip { display: none; }
}

/* ---------- assistant chat ---------- */
.btn:disabled { cursor: default; opacity: .5; }
.chat-page { display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto auto; gap: 12px; height: calc(100vh - 58px - 96px); min-height: 520px; }
.chat-page .view-heading { margin-bottom: 0; }
.chat-thread { display: flex; flex-direction: column; gap: 14px; margin: 0; padding: 18px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--white); list-style: none; }
.msg { max-width: min(760px, 88%); padding: 12px 16px; border-radius: 12px; }
.msg p { margin: 0; white-space: pre-line; }
.msg.user { align-self: flex-end; border-bottom-right-radius: 4px; background: var(--ink-deep); color: #eef4f3; }
.msg.bot { align-self: flex-start; border: 1px solid var(--line); border-bottom-left-radius: 4px; background: var(--paper); }
.bot-name { display: block; margin-bottom: 4px; color: var(--teal); font-size: 12px; font-weight: 700; }
.thinking { margin: 0; padding: 0; color: var(--slate); font-size: 14px; list-style: none; }
.thinking li { padding: 2px 0; }
.thinking li.done::before { content: '✓ '; color: var(--teal); }
.thinking li.active::before { content: ''; display: inline-block; width: 10px; height: 10px; margin-right: 6px; border: 2px solid var(--teal); border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.evidence-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.ev { display: inline-flex; align-items: center; gap: 4px; }
.msg .next { margin-top: 10px; font-size: 14px; }
.msg .next .label { margin-right: 6px; }
.msg.bot .btn, .msg.bot .chips { margin-top: 10px; }
.caption { display: block; margin-top: 8px; color: var(--slate); font-size: 11px; }
.chat-suggest { display: flex; flex-wrap: wrap; gap: 8px; }
.suggest { padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--white); color: var(--ink); font-size: 14px; font-weight: 600; cursor: pointer; }
.suggest:hover:not(:disabled) { border-color: var(--teal); background: var(--soft); }
.suggest:disabled { cursor: default; opacity: .5; }
.composer { display: flex; gap: 8px; }
.composer input { flex: 1; padding: 12px 14px; border-radius: 8px; }
.chat-empty { margin: auto; color: var(--slate); text-align: center; }
@media (prefers-reduced-motion: reduce) { .thinking li.active::before { animation: none; } }
@media (max-width: 800px) { .chat-page { height: auto; } .chat-thread { max-height: 60vh; } .msg { max-width: 100%; } }

/* ---------- agent tabs ---------- */
.subtabs { display: flex; flex-wrap: wrap; gap: 2px; margin: -6px 0 18px; border-bottom: 1px solid var(--line); }
.subtabs a { padding: 10px 14px; border-bottom: 3px solid transparent; color: var(--slate); font-weight: 600; text-decoration: none; }
.subtabs a:hover { color: var(--ink); }
.subtabs a[aria-current="page"] { border-bottom-color: var(--teal); color: var(--teal); }
.subtabs a.is-skill::before { content: '✦ '; color: var(--teal); }
.subtabs a.is-new { color: var(--teal); }
.agent-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.agent-about { flex: 1 1 320px; }
.agent-head p { margin: 4px 0; }
.reads { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.sys, .tag { padding: 2px 8px; border-radius: 4px; background: var(--soft); color: var(--ink); font-size: 12px; font-weight: 600; }
.run-box { display: grid; flex: 0 1 340px; align-content: start; justify-items: start; gap: 10px; }
.run-box .request { margin: 0; }
.result { margin-bottom: 8px; border-top: 3px solid var(--teal); }
.today { margin: 0; padding-left: 20px; }
.today li { padding: 8px 0; }
@media (prefers-reduced-motion: no-preference) {
  @keyframes step-in { from { opacity: 0; transform: translateY(6px); } }
}

/* ---------- skill creator ---------- */
.creator { max-width: 760px; }
.creator-form { display: grid; gap: 4px; margin-top: 14px; }
.creator select { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 5px; background: var(--white); color: var(--ink); font: inherit; font-weight: 400; }
.creator fieldset { margin: 0 0 12px; padding: 0; border: 0; }
.creator legend { margin-bottom: 6px; font-weight: 600; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks label { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--white); font-size: 14px; font-weight: 400; cursor: pointer; }
.checks label:has(input:checked) { border-color: var(--teal); background: var(--soft); color: var(--teal); font-weight: 600; }
.creator .btn { justify-self: start; margin-top: 6px; }
.checklist { margin: 8px 0 0; padding: 0; list-style: none; }
.checklist li { padding: 6px 0; border-top: 1px solid var(--line); }
.checklist li:first-child { border-top: 0; }
.email { margin: 8px 0 0; padding: 14px; border-radius: 6px; background: var(--paper); font: inherit; white-space: pre-wrap; }
.skill-foot { margin-top: 18px; font-size: 13px; }

/* ---------- assistant: Claude-style layout (centred thread, questions above a rounded composer) ---------- */
.chat-page { display: flex; flex-direction: column; gap: 0; height: calc(100vh - 58px - 96px); min-height: 520px; }
.chat-page .view-heading { margin-bottom: 8px; }
.chat-thread { flex: 1; display: flex; flex-direction: column; gap: 24px; width: 100%; max-width: 780px; margin: 0 auto; padding: 12px 4px 28px; overflow-y: auto; border: 0; border-radius: 0; background: none; }
.msg { max-width: none; padding: 0; border-radius: 0; }
.msg.user { align-self: flex-end; max-width: 80%; padding: 10px 16px; border-radius: 18px; background: var(--soft); color: var(--ink); }
.msg.bot { align-self: stretch; display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; border: 0; background: none; }
.msg.bot p { font-size: 16px; line-height: 1.65; }
.bot-avatar { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--teal); color: #fff; font: 700 15px/1 var(--display); }
.bot-avatar.big { width: 48px; height: 48px; font-size: 24px; }
.bot-body { min-width: 0; }
.bot-name { margin-bottom: 2px; }
.chat-empty { display: grid; justify-items: center; gap: 8px; margin: auto; color: var(--slate); text-align: center; }
.chat-empty b { color: var(--ink); font: 600 26px/1.2 var(--display); }
.chat-dock { display: grid; gap: 10px; width: 100%; max-width: 780px; margin: 0 auto; padding-top: 8px; }
.chat-suggest { display: flex; flex-wrap: wrap; gap: 8px; }
.suggest { padding: 8px 12px; border-radius: 10px; font-weight: 500; text-align: left; }
.composer { display: grid; gap: 6px; padding: 12px 14px 10px; border: 1px solid var(--line); border-radius: 18px; background: var(--white); box-shadow: 0 6px 24px rgba(17, 54, 60, .08); }
.composer:focus-within { border-color: var(--teal); }
.composer textarea { width: 100%; min-height: 28px; max-height: 180px; padding: 4px 2px; border: 0; border-radius: 0; background: none; color: var(--ink); font: inherit; font-size: 16px; resize: none; }
.composer textarea:focus-visible { outline: none; }
.composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.composer-scope { color: var(--slate); font-size: 12px; font-weight: 600; }
.send { width: 36px; height: 36px; flex: none; border: 0; border-radius: 10px; background: var(--teal); color: #fff; font-size: 18px; font-weight: 700; cursor: pointer; }
.send:hover:not(:disabled) { background: #066b62; }
.send:disabled { cursor: default; opacity: .45; }
.chat-foot { margin: 0; color: var(--slate); font-size: 11px; text-align: center; }
@media (max-width: 800px) { .chat-page { height: auto; } .chat-thread { max-height: 60vh; } .msg.user { max-width: 92%; } }

/* ---------- overview dashboard ---------- */
:root {
  --surface: #ffffff;
  --viz-blue: #2a78d6; --viz-red: #e34948; --viz-muted: #898781; --viz-draft: #8a877f; --viz-grid: #e1e0d9; --viz-axis: #c3c2b7;
  --st-good: #0ca30c; --st-warning: #fab219; --st-serious: #ec835a; --st-critical: #d03b3b;
}
.decisions-pill { padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--white); color: var(--slate); font-size: 13px; font-weight: 600; text-decoration: none; }
.decisions-pill.has { border-color: #f1c35b; background: #fff6df; color: #7a5410; }
.kpis { display: grid; gap: 14px; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 16px; }
.kpi-tile { position: relative; display: grid; gap: 4px; align-content: start; min-height: 150px; padding: 16px 16px 14px 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); color: var(--ink); text-decoration: none; overflow: hidden; transition: transform .15s, box-shadow .15s; }
.kpi-tile::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--tone); }
.kpi-tile:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(17, 54, 60, .12); }
.kpi-tile.tone-serious { --tone: var(--st-serious); --tint: #fdefe8; }
.kpi-tile.tone-warning { --tone: var(--st-warning); --tint: #fff6df; }
.kpi-tile.tone-good { --tone: var(--st-good); --tint: #e8f6e8; }
.kpi-tile.tone-blue { --tone: var(--viz-blue); --tint: #e8f1fb; }
.kpi-top { display: flex; align-items: center; gap: 8px; }
.kpi-icon { width: 30px; height: 30px; display: grid; flex: none; place-items: center; border-radius: 8px; background: var(--tint); color: var(--ink); font-size: 16px; }
.kpi-label { color: var(--slate); font-size: 13px; font-weight: 600; }
.kpi-value { margin-top: 6px; font: 700 38px/1 var(--display); letter-spacing: -.01em; }
.kpi-sub { color: var(--slate); font-size: 13px; }
.kpi-delta { font-size: 13px; font-weight: 700; }
.kpi-delta.good { color: #006300; }
.kpi-delta.bad { color: #b3261e; }
.kpi-tile .spark { position: absolute; right: 12px; bottom: 12px; }
.dash-grid { display: grid; gap: 16px; grid-template-columns: repeat(12, minmax(0, 1fr)); align-items: start; }
.span-4 { grid-column: span 4; } .span-6 { grid-column: span 6; } .span-8 { grid-column: span 8; }
.dash-card { padding: 18px 18px 12px; border-radius: 12px; }
.dash-head h2 { margin: 0; font: 600 20px/1.2 var(--display); }
.takeaway { margin: 4px 0 12px; color: var(--slate); font-size: 14px; }
.takeaway b { color: var(--ink); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 4px; color: var(--slate); font-size: 13px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart.timeline { margin-bottom: 16px; } /* the lookahead chart kept this spacing from the old agent .timeline rule */
.chart text { fill: var(--slate); font-family: var(--body); font-size: 12px; }
.chart .grid { stroke: var(--viz-grid); stroke-width: 1; }
.chart .zero { stroke: var(--viz-axis); stroke-width: 1; }
.chart .end-label, .chart .val { fill: var(--ink); font-weight: 600; }
.chart .cat { fill: var(--ink); font-size: 13px; }
.chart .hit { fill: transparent; }
.chart .bar.over { fill: var(--viz-red); }
.chart .bar.under { fill: var(--viz-blue); }
.chart .row[data-action], .chart .seg[data-action] { cursor: pointer; }
.chart .row:hover .cat { font-weight: 700; }
.chart .row:hover .bar, .chart .seg:hover { opacity: .85; }
.chart .span.ready { fill: var(--st-good); }
.chart .span.risk { fill: var(--st-warning); }
.chart .span.blocked { fill: var(--st-critical); }
.chart .status { fill: var(--ink); font-weight: 600; }
.donut-wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 16px; }
.chart.donut { width: 180px; flex: none; }
.chart .donut-total { fill: var(--ink); font: 700 36px/1 var(--display); }
.donut-legend { display: grid; gap: 6px; flex: 1 1 150px; }
.legend-item { display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: 8px; padding: 6px 8px; border: 0; border-radius: 6px; background: none; color: var(--ink); font-size: 14px; text-align: left; cursor: pointer; }
.legend-item:hover { background: var(--soft); }
.chart-data { margin-top: 8px; font-size: 13px; }
.chart-data summary { color: var(--teal); font-weight: 600; cursor: pointer; }
.chart-data .table-wrap { margin-top: 8px; }
.decision-list { margin: 0; padding: 0; list-style: none; }
.decision-list li { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 10px 0 10px 10px; border-top: 1px solid var(--line); border-left: 3px solid transparent; }
.decision-list li:first-child { border-top: 0; }
.decision-list li.mine { border-left-color: var(--st-warning); background: #fffaf0; }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .span-4, .span-6, .span-8 { grid-column: 1 / -1; } }
@media (max-width: 560px) { .kpis { grid-template-columns: minmax(0, 1fr); } .kpi-tile .spark { position: static; } }
@media (prefers-reduced-motion: reduce) { .kpi-tile { transition: none; } .kpi-tile:hover { transform: none; } }

/* ---------- roles: fixed role label and the Project Manager's preview bar ---------- */
.role-fixed { color: #dfe9e7; font-size: 13px; font-weight: 600; }
.preview-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: -12px 0 18px; padding: 10px 14px; border: 1px solid #f1c35b; border-radius: 8px; background: #fff6df; color: #5c3f08; font-size: 14px; }
.preview-bar .linkish { color: #5c3f08; }

/* ---------- access: lock cards and blocked agent steps ---------- */
.lock-card { max-width: 680px; border-top: 3px solid var(--st-warning); }
.lock-icon { font-size: 28px; }
.lock-card h2 { margin: 6px 0; }
.request-form { display: grid; gap: 8px; max-width: 520px; margin-top: 10px; }
.request-form .btn { justify-self: start; }

/* ---------- skill creator tab ---------- */
.skill-list { margin-bottom: 8px; }
.skill-card { color: var(--ink); text-decoration: none; transition: border-color .15s; }
.skill-card:hover { border-color: var(--teal); }
.skill-card h2 { margin: 4px 0 6px; }

/* ---------- control tab ---------- */
.span-12 { grid-column: 1 / -1; }
.kpi-tile.static { min-height: 110px; }
.kpi-tile.static:hover { transform: none; box-shadow: none; }
.access-table th, .access-table td { text-align: center; white-space: nowrap; }
.access-table th[scope="row"], .access-table thead tr:first-child th:first-child { text-align: left; }
.switch { position: relative; display: inline-block; width: 38px; height: 22px; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: #c9cfcc; transition: background .15s; pointer-events: none; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + span { background: var(--st-good); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 3px solid var(--teal); outline-offset: 2px; }
.chart .link { stroke: var(--viz-blue); opacity: .45; }
.chart .link.blocked { stroke: var(--st-critical); opacity: .85; }
.chart .link:hover { opacity: .8; }
.chart .node { fill: var(--soft); stroke: var(--line); }
.chart .node-label { fill: var(--ink); font-size: 12px; font-weight: 600; }
tr.is-blocked td { background: #fdf1f1; }
@media (prefers-reduced-motion: reduce) { .switch span, .switch span::after { transition: none; } }

/* ---------- workflow blocks and summary ---------- */
.wf-name { font: 600 18px/1.2 var(--display); }
.wf-name::first-letter { text-transform: uppercase; }
.wf-blocks { display: flex; flex-wrap: wrap; gap: 28px; margin: 0 0 16px; padding: 0; list-style: none; }
.wf-blocks li { position: relative; flex: 1 1 170px; display: flex; }
.wf-blocks li + li::before { content: '→'; position: absolute; top: 50%; left: -21px; transform: translateY(-50%); color: var(--slate); font-weight: 700; }
.wf-block { display: grid; align-content: start; gap: 4px; width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.wf-block:hover { border-color: var(--teal); }
.wf-block[aria-pressed="true"] { border-color: var(--teal); box-shadow: inset 0 0 0 2px var(--teal); }
.wf-block small { color: var(--slate); }
.wf-n { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--soft); font-size: 12px; font-weight: 700; }
.wf-status { color: var(--slate); font-size: 12px; font-weight: 700; }
.wf-block.is-waiting { opacity: .6; }
.wf-block.is-running { border-color: var(--teal); }
.wf-block.is-running .wf-status::before { content: ''; display: inline-block; width: 10px; height: 10px; margin-right: 6px; border: 2px solid var(--teal); border-right-color: transparent; border-radius: 50%; vertical-align: -1px; animation: spin .8s linear infinite; }
.wf-block.is-done .wf-n { background: var(--teal); color: #fff; }
.wf-block.is-skipped { border-style: dashed; background: var(--paper); color: var(--slate); }
.wf-block.is-skipped .wf-n { background: var(--st-critical); color: #fff; }
.wf-detail, .wf-summary { margin-bottom: 16px; }
.wf-detail h3 { margin: 4px 0 0; font: 600 20px/1.2 var(--display); }
.wf-summary { border-top: 3px solid var(--teal); }
.wf-summary.is-partial { border-top-color: var(--st-warning); }
.wf-summary ul { margin: 0; padding-left: 18px; }
.wf-hint { margin: 0 0 16px; }
@media (max-width: 800px) {
  .wf-blocks { flex-direction: column; gap: 24px; }
  .wf-blocks li + li::before { content: '↓'; top: -22px; left: 20px; transform: none; }
}
@media (prefers-reduced-motion: reduce) { .wf-block.is-running .wf-status::before { animation: none; } }
@media (prefers-reduced-motion: no-preference) { .wf-block.is-running { animation: step-in .25s ease-out; } }

/* ---------- agent chat ---------- */
.agent-chat { display: grid; gap: 10px; margin-bottom: 8px; }
.agent-chat-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.agent-chat-head h2 { margin: 0; font: 600 22px/1.2 var(--display); }
.chat-people { margin: 0; color: var(--slate); font-size: 13px; }
.chat-people .label { margin-right: 6px; }
.agent-thread { max-width: none; min-height: 180px; max-height: 440px; margin: 0; padding: 8px 4px 12px; gap: 18px; }
.agent-chat .bot-avatar { font-size: 11px; }
.msg.event { align-self: center; padding: 4px 12px; border-radius: 999px; background: var(--soft); color: var(--slate); font-size: 13px; font-weight: 600; }
.msg.event span::before { content: '↪ '; }
.msg-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.msg-actions .chips { margin: 0; }
.inline-request { margin-top: 10px; }
@media (max-width: 800px) { .agent-thread { max-height: 60vh; } }

/* ---------- Workflows: toolbar with Edit, run bar, and edit mode ---------- */
.wf-toolbar { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 0 0 14px; }
.wf-toolbar p { margin: 4px 0 0; }
.wf-edit-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.wf-runbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 0 0 18px; }
.wf-blocks.is-editing { align-items: stretch; }
.wf-block.is-editing { cursor: default; gap: 8px; }
.wf-block.is-editing.is-off { border-style: dashed; background: var(--paper); }
.wf-block.is-editing.is-off .wf-drag strong { color: var(--slate); text-decoration: line-through; }
.wf-drag { display: grid; gap: 4px; padding: 2px; border-radius: 6px; cursor: grab; }
.wf-drag:hover { background: var(--soft); }
.wf-drag:active { cursor: grabbing; }
.wf-grip { color: var(--slate); font-size: 16px; line-height: 1; letter-spacing: -1px; }
.wf-field { display: grid; gap: 4px; color: var(--slate); font-size: 12px; font-weight: 600; }
.wf-field textarea { width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--white); color: var(--ink); font: inherit; font-size: 13px; resize: vertical; }
.wf-on { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.wf-move { display: flex; gap: 6px; }
.wf-blocks li.is-dragging { opacity: .45; }
.wf-blocks li.is-drop-target .wf-block { border-color: var(--teal); box-shadow: inset 0 0 0 2px var(--teal); }

/* ---------- boxed step fields (block detail and Edit workflow) ---------- */
.wf-boxes { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-top: 12px; }
.wf-box { display: grid; align-content: start; gap: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); font-size: 14px; }
.wf-box-title { color: var(--teal); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.wf-box .inline-request, .wf-box .btn { justify-self: start; margin-top: 4px; }
.wf-checks { margin: 0; padding: 0; list-style: none; }
.wf-checks li { padding: 1px 0; }
.wf-checks li.off { color: var(--slate); }
.wf-checks li.off::before { content: '○ '; }
.wf-block.is-editing .wf-box { padding: 8px 10px; background: var(--white); }
.wf-block.is-editing .wf-box textarea { width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--white); color: var(--ink); font: inherit; font-size: 13px; resize: vertical; }
.wf-block.is-editing .wf-on { font-size: 13px; }
.wf-block.is-editing .wf-on input:disabled + * , .wf-block.is-editing .wf-on:has(input:disabled) { color: var(--slate); }
.wf-summary .inline-request, .wf-summary .btn { margin-top: 8px; }

/* ---------- identity: one colour + icon per agent/team, used everywhere ---------- */
.id-planning { --id: #2a78d6; --id-tint: #e8f1fb; }
.id-bim { --id: #7a4fd0; --id-tint: #f1ebfc; }
.id-pm { --id: #087f75; --id-tint: #e1f2ef; }
.id-procurement { --id: #b7740c; --id-tint: #fdf3e1; }
.id-site { --id: #cf5527; --id-tint: #fcebe4; }
.id-skills { --id: #53656c; --id-tint: #edf1f1; }
.msg.bot[data-from="planning"] .bot-avatar { background: #2a78d6; }
.msg.bot[data-from="bim"] .bot-avatar { background: #7a4fd0; }
.msg.bot[data-from="pm"] .bot-avatar { background: #087f75; }
.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; }

/* ---------- Platform controls ---------- */
.pc-map { margin-bottom: 8px; }
.pc-map h2 { margin: 0; }
.pc-map > .muted { margin: 4px 0 16px; }
.pc-flow { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: center; gap: 14px; }
.pc-col { display: grid; gap: 8px; align-content: start; }
.pc-arrow { display: grid; justify-items: center; gap: 4px; color: var(--slate); font-size: 22px; font-weight: 700; }
.pc-guard { color: var(--teal); }
.pc-guard .icon { width: 26px; height: 26px; }
.pc-guard small { max-width: 84px; font-size: 11px; font-weight: 600; line-height: 1.2; text-align: center; }
.pc-sys, .pc-agent, .pc-team { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); font-size: 14px; font-weight: 600; }
.pc-agent, .pc-team { border-color: transparent; border-left: 4px solid var(--id); background: var(--id-tint); }
.pc-agent .icon, .pc-team .icon { color: var(--id); width: 20px; height: 20px; }
.pc-mono { display: inline-grid; flex: none; place-items: center; min-width: 34px; height: 26px; padding: 0 6px; border-radius: 6px; background: var(--ink); color: #fff; font: 700 12px/1 var(--display); letter-spacing: .03em; }
.pc-mono + .pc-mono { margin-left: 4px; }
.pc-mono.is-model { background: var(--slate); }
.pc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-bottom: 8px; }
.pc-agent-card, .pc-role { position: relative; display: grid; align-content: start; gap: 8px; border-top: 4px solid var(--id); }
.pc-agent-card p, .pc-role p { margin: 0; }
.pc-card-head { display: flex; align-items: center; gap: 12px; }
.pc-card-head h3 { margin: 0; font: 600 20px/1.15 var(--display); }
.pc-badge { display: grid; flex: none; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--id-tint, var(--soft)); color: var(--id, var(--teal)); }
.pc-badge .icon { width: 24px; height: 24px; }
.pc-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; }
.pc-row .label { min-width: 64px; }
.pc-chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; background: var(--id-tint); color: var(--ink); font-size: 12px; font-weight: 600; }
.pc-chip .icon { color: var(--id); }
.pc-tag { padding: 2px 8px; border-radius: 4px; background: var(--id-tint); font-size: 12px; font-weight: 600; }
.pc-links { display: flex; gap: 8px; margin-top: 4px !important; }
.pc-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; margin-top: 18px; }
.pc-two h2 { margin-top: 0; }
.pc-list { display: grid; gap: 4px; margin: 0 0 10px; padding: 0; list-style: none; }
.pc-list li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.pc-list li:last-child { border-bottom: 0; }
.pc-env { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 12px; }
.pc-env-card { display: grid; align-content: start; gap: 8px; }
.pc-env-card h3 { margin: 0; font: 600 18px/1.2 var(--display); }
.pc-env-card p { margin: 0; }
@media (max-width: 800px) {
  .pc-flow { grid-template-columns: 1fr; }
  .pc-arrow { transform: rotate(90deg); }
  .pc-guard { transform: none; grid-auto-flow: column; justify-content: center; }
}

/* ---------- agent portraits (fictional AI personas) ---------- */
.portrait { display: inline-block; flex: none; border-radius: 50%; object-fit: cover; background: var(--soft); vertical-align: middle; }
.portrait-xs { width: 22px; height: 22px; }
.portrait-sm { width: 30px; height: 30px; }
.portrait-md { width: 48px; height: 48px; }
.portrait-xl { width: 112px; height: 112px; box-shadow: 0 0 0 4px var(--white), 0 0 0 7px var(--id, var(--teal)); }
.ai-tag { padding: 1px 7px; border-radius: 999px; background: var(--soft); color: var(--teal); font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.pc-portrait { justify-self: center; margin: 6px 0 4px; border-radius: 50%; transition: transform .15s; }
.pc-portrait:hover { transform: scale(1.04); }
.pc-agent .portrait { box-shadow: 0 0 0 2px var(--id); }
.pc-also { display: flex; align-items: center; gap: 14px; margin: 0 0 8px; border-left: 4px solid var(--id); }
.pc-also p { margin: 0; }
.agent-who { display: flex; align-items: center; gap: 12px; }
.agent-who h2 { margin: 0; }
.agent-who .portrait { box-shadow: 0 0 0 3px var(--white), 0 0 0 5px var(--teal); }
.online { color: var(--st-good); font-weight: 600; }
.msg.bot img.bot-avatar { width: 30px; height: 30px; }
.msg.event { display: inline-flex; align-items: center; gap: 6px; }
.msg.event span::before { content: none; }
.wf-owner { display: flex; align-items: center; gap: 12px; }
.wf-owner .portrait { box-shadow: 0 0 0 3px var(--white), 0 0 0 5px var(--teal); }
.wf-who { display: flex; align-items: center; gap: 6px; }
.wf-who .portrait { box-shadow: 0 0 0 2px var(--white); }
.wf-detail > .portrait { float: left; margin: -2px 8px 0 0; }

/* ---------- Your pilot: choose a team, live plan ---------- */
.pilot-n { display: inline-grid; place-items: center; width: 28px; height: 28px; margin-right: 10px; border-radius: 50%; background: var(--teal); color: #fff; font: 700 15px/1 var(--display); vertical-align: 2px; }
.pilot-choose h2, .pilot-step h2 { margin: 0 0 12px; font: 600 22px/1.2 var(--display); }
.pilot-teams { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 20px; }
.pilot-team { display: grid; justify-items: start; gap: 6px; padding: 14px; border: 2px solid var(--line); border-radius: 12px; background: var(--white); color: var(--ink); text-align: left; cursor: pointer; transition: border-color .15s, transform .15s; }
.pilot-team:hover { border-color: var(--id); transform: translateY(-2px); }
.pilot-team[aria-checked="true"] { border-color: var(--id); background: var(--id-tint); box-shadow: 0 6px 18px rgba(17, 54, 60, .1); }
.pilot-team b { font: 600 18px/1.2 var(--display); }
.pilot-team .muted { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.pilot-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; margin-bottom: 14px; }
.pilot-steps { display: grid; gap: 14px; }
.pilot-step > .muted { margin: -4px 0 10px; }
.pilot-sources, .pilot-tasks { display: grid; gap: 8px; }
.pilot-source, .pilot-task { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); cursor: pointer; font-size: 14px; }
.pilot-source:has(input:checked), .pilot-task:has(input:checked) { border-color: var(--teal); background: var(--white); }
.pilot-source span:not(.pc-mono):not(.tag) { flex: 1; }
.pilot-source .tag { display: inline-flex; align-items: center; gap: 4px; background: #fdefe8; color: #8a3a1b; }
.pilot-task { align-items: flex-start; }
.pilot-task input { margin-top: 4px; }
.pilot-perms { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.pilot-perms li { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.pilot-perms .icon { margin-top: 2px; color: var(--teal); }
.pilot-path { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.pilot-path li { counter-increment: step; padding: 8px 12px; border-radius: 8px; background: var(--soft); font-size: 14px; font-weight: 600; }
.pilot-path li::before { content: counter(step) '. '; color: var(--teal); }
.pilot-path li + li::after { content: none; }
.pilot-summary { position: sticky; top: 74px; display: grid; gap: 10px; border-top: 5px solid var(--id); }
.pilot-who { display: flex; align-items: center; gap: 12px; }
.pilot-who .portrait { box-shadow: 0 0 0 3px var(--white), 0 0 0 5px var(--id); }
.pilot-summary .fields { margin: 4px 0; }
@media (max-width: 1000px) { .pilot-layout { grid-template-columns: 1fr; } .pilot-summary { position: static; } }
@media print {
  .topbar, .rail, .skip-link, #notice, .pilot-choose, .pilot-summary .btn { display: none !important; }
  .app { display: block; }
  .pilot-layout { grid-template-columns: 1fr; }
  .pilot-summary { position: static; }
}

/* Your pilot: short guide and the pilot as four phases */
.pilot-guide { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; padding: 0; list-style: none; counter-reset: guide; }
.pilot-guide-step { counter-increment: guide; display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: 999px; background: var(--white); border: 1px solid var(--line); font-size: 14px; font-weight: 600; }
.pilot-guide-step::before { content: counter(guide); display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--teal); color: #fff; font: 700 13px/1 var(--display); }
.pilot-flow { margin-bottom: 16px; }
.pilot-flow h2 { margin: 0 0 14px; font: 600 22px/1.2 var(--display); }
.pilot-flow .small { margin: 10px 0 0; font-size: 12px; }
.pilot-phases { display: flex; flex-wrap: wrap; gap: 28px; margin: 0; padding: 0; list-style: none; }
.pilot-phase { position: relative; flex: 1 1 180px; display: grid; align-content: start; gap: 4px; padding: 14px; border: 1px solid var(--line); border-top: 4px solid var(--teal); border-radius: 10px; background: var(--paper); font-size: 14px; }
.pilot-phase b { font: 600 19px/1.2 var(--display); }
.pilot-phase .pc-badge { margin-bottom: 4px; }
.pilot-phase + .pilot-phase::before { content: '→'; position: absolute; top: 50%; left: -21px; transform: translateY(-50%); color: var(--slate); font-weight: 700; }
@media (max-width: 800px) {
  .pilot-phases { flex-direction: column; gap: 24px; }
  .pilot-phase + .pilot-phase::before { content: '↓'; top: -22px; left: 20px; transform: none; }
}
@media print { .pilot-guide, .pilot-flow { display: none !important; } }

/* ---------- dark mode (top-bar button; saved per browser, else the device setting) ---------- */
.theme-toggle { width: 32px; height: 32px; display: grid; flex: none; place-items: center; border: 1px solid #36525b; border-radius: 50%; background: #17323b; color: #dfe9e7; font-size: 15px; line-height: 1; cursor: pointer; }
.theme-toggle:hover { border-color: #74d1c3; color: #74d1c3; }
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e3ecea; --ink-deep: #07151a; --paper: #0e1c21; --white: #15262c; --surface: #15262c;
  --teal: #3dbcad; --slate: #9fb2b5; --line: #2b4147; --soft: #1c3438;
  --viz-grid: #2b4147; --viz-axis: #46606a; --viz-muted: #8f9d9f;
}
/* Filled teal controls keep dark text, so they stay readable on the brighter dark-mode teal. */
:root[data-theme="dark"] :is(.btn:not(.ghost), .send, .count, .pilot-n, .wf-block.is-done .wf-n, .bot-avatar) { color: #04221e; }
:root[data-theme="dark"] .pilot-guide-step::before { color: #04221e; }
:root[data-theme="dark"] .pill.rev { background: #3a2f17; color: #f0c674; }
:root[data-theme="dark"] .pill.act { background: #3d211e; color: #f4a59a; }
:root[data-theme="dark"] .proposal.is-sent { border-color: #6b5a33; background: #1f1c14; }
:root[data-theme="dark"] .decisions-pill.has, :root[data-theme="dark"] .preview-bar { border-color: #8a6a1e; background: #2c2412; color: #f3d38a; }
:root[data-theme="dark"] .preview-bar .linkish { color: #f3d38a; }
:root[data-theme="dark"] .kpi-delta.good { color: #5fd38a; }
:root[data-theme="dark"] .kpi-delta.bad { color: #ff8a80; }
:root[data-theme="dark"] .decision-list li.mine { background: #241f12; }
:root[data-theme="dark"] .switch span { background: #44585e; }
:root[data-theme="dark"] tr.is-blocked td { background: #2a1717; }
:root[data-theme="dark"] .pilot-source .tag { background: #3a2016; color: #f5a582; }
:root[data-theme="dark"] .avatar, :root[data-theme="dark"] .role-initials { background: #1c3438; color: #e3ecea; }
:root[data-theme="dark"] .error { color: #ff8a80; }
:root[data-theme="dark"] .id-planning { --id: #5aa0f0; --id-tint: #16283f; }
:root[data-theme="dark"] .id-bim { --id: #a585ec; --id-tint: #241a3a; }
:root[data-theme="dark"] .id-pm { --id: #3dbcad; --id-tint: #12302c; }
:root[data-theme="dark"] .id-procurement { --id: #e0a53c; --id-tint: #33270f; }
:root[data-theme="dark"] .id-site { --id: #f08458; --id-tint: #3a1d12; }
:root[data-theme="dark"] .id-skills { --id: #9fb2b5; --id-tint: #1f2a2d; }
:root[data-theme="dark"] .kpi-tile.tone-serious { --tint: #3a2318; }
:root[data-theme="dark"] .kpi-tile.tone-warning { --tint: #33290f; }
:root[data-theme="dark"] .kpi-tile.tone-good { --tint: #13301a; }
:root[data-theme="dark"] .kpi-tile.tone-blue { --tint: #16283f; }
:root[data-theme="dark"] .pc-mono { background: #2e4a52; }
