/* AgentPress Studio — design tokens first; every view uses only these. */
:root {
  --bg: #f4f5f8;
  --bg-2: #eceef3;
  --panel: #ffffff;
  --panel-2: #fafbfc;
  --ink: #12151c;
  --ink-2: #454c5c;
  --ink-3: #7a8294;
  --line: #e2e5ec;
  --line-2: #eef0f4;
  --accent: #3b5bfd;
  --accent-2: #2a44d6;
  --accent-ink: #ffffff;
  --accent-soft: #edf1ff;
  --accent-line: #cdd7ff;
  --ok: #157347;
  --ok-soft: #e7f6ee;
  --warn: #9a5200;
  --warn-soft: #fff4e2;
  --bad: #c42b32;
  --bad-soft: #fdeeee;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(17, 24, 39, .04), 0 1px 1px rgba(17, 24, 39, .02);
  --shadow-lg: 0 12px 32px -12px rgba(17, 24, 39, .22), 0 2px 6px rgba(17, 24, 39, .06);
  --ring: 0 0 0 3px rgba(59, 91, 253, .18);
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --side: #0e1117;
  --side-2: #171b24;
  --side-ink: #aeb5c4;
  font: 14px/1.55 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; }
::selection { background: var(--accent-soft); }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.015em; color: var(--ink); }
h1 { font-size: 22px; line-height: 1.25; }
h2 { font-size: 15px; line-height: 1.35; }
h3 { font-size: 14px; }
p { margin: 0; }
code, .mono { font-family: var(--mono); font-size: 12px; }
code { background: var(--line-2); padding: 1px 5px; border-radius: 5px; color: var(--ink-2); }
.msg code { background: rgba(0, 0, 0, .06); }

/* ── shell ─────────────────────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); padding: 18px 12px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; overflow-y: auto; border-right: 1px solid #000; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 15px; letter-spacing: -.01em; padding: 2px 8px; }
.brand .dot { width: 22px; height: 22px; border-radius: 7px; background: linear-gradient(135deg, #6d8bff, var(--accent) 55%, #7b4dff); box-shadow: 0 0 0 1px rgba(255, 255, 255, .12) inset, 0 4px 12px rgba(59, 91, 253, .45); }
.side .group { display: flex; flex-direction: column; gap: 1px; }
.side .label { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: #5d6577; padding: 0 10px 6px; }
.side a { position: relative; color: var(--side-ink); padding: 7px 10px; border-radius: 8px; display: flex; align-items: center; gap: 10px; text-decoration: none; font-size: 13.5px; transition: background .12s, color .12s; }
.side a:hover { background: var(--side-2); color: #e7eaf0; }
.side a.on { background: #1d2330; color: #fff; }
.side a.on::before { content: ""; position: absolute; left: -12px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.side .swatch { width: 8px; height: 8px; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px rgba(255, 255, 255, .06); }
.side .pill { margin-left: auto; }
.side .foot { margin-top: auto; font-size: 12px; color: #6b7386; padding: 12px 10px 0; border-top: 1px solid #1c212b; line-height: 1.6; }
.side .foot button { margin-top: 10px; width: 100%; justify-content: center; }
.side .sub { color: #5d6577; }

.main { padding: 28px 36px 72px; max-width: 1480px; width: 100%; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.head .title { display: flex; align-items: center; gap: 12px; }
.head .title > span:first-child { width: 36px !important; height: 36px !important; border-radius: 10px !important; box-shadow: 0 0 0 1px rgba(0, 0, 0, .06) inset; }
.sub { color: var(--ink-3); font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.cols-2 { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; align-items: start; }
@media (max-width: 1000px) { .app { grid-template-columns: 1fr; } .side { position: static; height: auto; } .cols-2 { grid-template-columns: 1fr !important; } .main { padding: 20px 16px 60px; } }

/* ── surfaces ──────────────────────────────────────────────────────────── */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card.click { cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.card.click:hover { border-color: var(--accent-line); box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.card h3 + .sub { margin-top: 2px; }
.card-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.card-head h2 { margin-right: auto; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > table th:first-child, .card.flush > table td:first-child { padding-left: 16px; }
details summary { cursor: pointer; color: var(--ink-2); font-weight: 550; font-size: 13px; }
details summary:hover { color: var(--ink); }

.tabs { display: flex; gap: 2px; margin-bottom: 22px; overflow-x: auto; padding: 4px; background: var(--bg-2); border-radius: 12px; width: fit-content; max-width: 100%; }
.tabs a { padding: 6px 13px; color: var(--ink-2); border-radius: 9px; white-space: nowrap; text-decoration: none; font-size: 13.5px; font-weight: 500; transition: background .12s, color .12s; }
.tabs a:hover { color: var(--ink); background: rgba(255, 255, 255, .6); }
.tabs a.on { color: var(--ink); background: var(--panel); font-weight: 600; box-shadow: var(--shadow), 0 0 0 1px var(--line); }

/* ── controls ──────────────────────────────────────────────────────────── */
button, .btn { font: inherit; font-size: 13.5px; font-weight: 550; border: 1px solid var(--line); background: var(--panel); color: var(--ink); height: 34px; padding: 0 13px; border-radius: var(--radius-sm); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; white-space: nowrap; box-shadow: var(--shadow); transition: background .12s, border-color .12s, box-shadow .12s, color .12s; }
button:hover, .btn:hover { border-color: #c8cede; background: var(--panel-2); color: var(--ink); }
button:focus-visible, .btn:focus-visible, a:focus-visible { outline: none; box-shadow: var(--ring); }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 1px 2px rgba(59, 91, 253, .35), 0 0 0 1px rgba(255, 255, 255, .08) inset; }
button.primary:hover, .btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
button.danger { color: var(--bad); }
button.danger:hover { background: var(--bad-soft); border-color: #f2c4c6; }
button.ghost { border-color: transparent; background: transparent; box-shadow: none; color: var(--ink-2); padding: 0 9px; }
button.ghost:hover { background: var(--line-2); color: var(--ink); }
button.ghost.danger { color: var(--bad); }
button.sm, .btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
button:disabled, button:disabled:hover { opacity: .45; cursor: not-allowed; background: var(--panel); border-color: var(--line); }
button.primary:disabled, button.primary:disabled:hover { background: var(--accent); border-color: var(--accent); }
.side button { background: var(--side-2); border-color: #262c38; color: var(--side-ink); box-shadow: none; }
.side button:hover { background: #1f2531; color: #fff; border-color: #313949; }

label.field, div.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 12.5px; color: var(--ink-2); }
.field .help { font-weight: 400; color: var(--ink-3); font-size: 12px; margin-top: -3px; }
input, textarea, select { font: inherit; font-size: 13.5px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 7px 11px; background: var(--panel); color: var(--ink); width: 100%; transition: border-color .12s, box-shadow .12s; }
input, select { height: 36px; }
input::placeholder, textarea::placeholder { color: #a3a9b7; }
input:hover, textarea:hover, select:hover { border-color: #cfd4df; }
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
textarea.tall { min-height: 220px; }
textarea.code { font-family: var(--mono); font-size: 12.5px; background: var(--panel-2); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
input:disabled, textarea:disabled, select:disabled { background: var(--panel-2); color: var(--ink-2); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; flex: none; }
input[type=color] { padding: 3px; height: 36px; width: 56px; cursor: pointer; }
input[type=file] { height: auto; }
.check { display: inline-flex; gap: 8px; align-items: center; font-weight: 450; font-size: 13px; color: var(--ink); cursor: pointer; }
.checks { display: flex; flex-wrap: wrap; gap: 6px; }
.checks .check { padding: 5px 10px 5px 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); transition: border-color .12s, background .12s; }
.checks .check:has(input:checked) { border-color: var(--accent-line); background: var(--accent-soft); }

.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 550; padding: 2px 9px; border-radius: 999px; background: var(--line-2); color: var(--ink-2); white-space: nowrap; line-height: 1.5; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.pill.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.chip { height: auto; min-height: 30px; padding: 5px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); background: var(--panel); border: 1px solid var(--line); white-space: normal; text-align: left; box-shadow: none; }
.chip:hover { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }

/* ── data ──────────────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 600; color: var(--ink-3); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--panel-2); }
td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td, table tr:hover td { background: #fbfcfd; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .v { font-size: 26px; font-weight: 680; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat .k { color: var(--ink-3); font-size: 12.5px; }
.bar { height: 6px; background: var(--line-2); border-radius: 4px; overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, #6d8bff, var(--accent)); border-radius: 4px; }
.bar.warn > i { background: var(--warn); }
.bar.bad > i { background: var(--bad); }

.notice { padding: 11px 14px; border-radius: 11px; background: var(--accent-soft); color: #253f9e; font-size: 13px; border: 1px solid var(--accent-line); line-height: 1.55; }
.notice.warn { background: var(--warn-soft); color: var(--warn); border-color: #f5dcb5; }
.notice.bad { background: var(--bad-soft); color: var(--bad); border-color: #f4c9cb; }
.notice.ok { background: var(--ok-soft); color: var(--ok); border-color: #c4e8d4; }
.empty { color: var(--ink-3); text-align: center; padding: 32px 20px; font-size: 13px; }

.list-item { position: relative; display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-bottom: 1px solid var(--line-2); cursor: pointer; transition: background .1s; min-width: 0; }
.list-item:hover { background: var(--panel-2); }
.list-item.on { background: var(--accent-soft); }
.list-item.on::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.list-item:last-child { border-bottom: none; }
.list-item b { font-weight: 600; }
.list-item .sub { font-size: 12px; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scroll { overflow: auto; }

/* ── chat (playground, inbox, assistant) ───────────────────────────────── */
.chat { display: flex; flex-direction: column; gap: 12px; height: 560px; }
.chat .log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 14px; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 12px; }
.msg { max-width: 85%; padding: 9px 13px; border-radius: 14px; white-space: pre-wrap; word-wrap: break-word; font-size: 13.5px; line-height: 1.5; box-shadow: var(--shadow); }
.msg.user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 5px; }
.msg.assistant { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.msg.human { align-self: flex-start; background: var(--ok-soft); border: 1px solid #c4e8d4; }
.msg.system { align-self: center; background: transparent; color: var(--ink-3); font-size: 12px; box-shadow: none; text-align: center; max-width: 92%; padding: 4px 8px; }
.msg b { font-weight: 650; }
.trace { align-self: flex-start; font-size: 11.5px; color: var(--ink-3); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: -4px; }
form.row { flex-wrap: nowrap; }
form.row input { flex: 1; }
form.row button { flex: none; }

/* ── overlays ──────────────────────────────────────────────────────────── */
.modal-back { position: fixed; inset: 0; background: rgba(12, 15, 22, .5); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; z-index: 10; padding: 20px; animation: fade .15s ease-out; }
.modal { background: var(--panel); border-radius: 16px; padding: 24px; width: min(640px, 100%); max-height: 90vh; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; box-shadow: var(--shadow-lg); animation: pop .18s ease-out; }
.toast { position: fixed; bottom: 22px; right: 22px; background: #12151c; color: #fff; padding: 11px 16px; border-radius: 11px; z-index: 20; font-size: 13px; max-width: 440px; box-shadow: var(--shadow-lg); animation: pop .18s ease-out; }
.toast.bad { background: var(--bad); }
@keyframes fade { from { opacity: 0 } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98) } }

.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 600px at 10% -10%, #dfe6ff 0%, transparent 60%), radial-gradient(900px 500px at 110% 110%, #ece3ff 0%, transparent 55%), var(--bg); }
.login .card { width: min(420px, 100%); display: flex; flex-direction: column; gap: 16px; padding: 30px; box-shadow: var(--shadow-lg); border-radius: 18px; }
.login .brand { padding: 0; color: var(--ink); font-size: 17px; }
.login button.primary { height: 40px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; font-size: 13px; margin: 0; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; font-weight: 500; }

/* ── knowledge tab ─────────────────────────────────────────────────────── */
.kb-status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); font-size: 13px; color: var(--ink-2); }
.kb-status .metric { display: inline-flex; align-items: baseline; gap: 5px; padding-left: 12px; border-left: 1px solid var(--line); }
.kb-status .metric b { font-size: 15px; color: var(--ink); font-variant-numeric: tabular-nums; }
.kb-layout { display: grid; gap: 16px; grid-template-columns: 290px minmax(0, 1fr) 400px; align-items: start; }
.kb-layout.no-assistant { grid-template-columns: 290px minmax(0, 1fr); }
@media (max-width: 1360px) { .kb-layout { grid-template-columns: 270px minmax(0, 1fr); } .kb-assistant { grid-column: 1 / -1; position: static !important; } }
@media (max-width: 860px) { .kb-layout, .kb-layout.no-assistant { grid-template-columns: 1fr; } }
.kb-col-name { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.kb-col-name code { font-size: 11px; background: transparent; padding: 0; color: var(--ink-3); }
.kb-count { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--ink-3); background: var(--line-2); border-radius: 999px; padding: 1px 8px; font-variant-numeric: tabular-nums; flex: none; }
.list-item.on .kb-count { background: #fff; color: var(--accent); }
.kb-docs { max-height: 460px; overflow: auto; }
.kb-toolbar { display: flex; gap: 6px; padding: 10px 16px; border-bottom: 1px solid var(--line-2); background: var(--panel-2); flex-wrap: wrap; }
.kb-source { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.kb-source:last-of-type { border-bottom: none; }
.kb-source .icon { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--line-2); color: var(--ink-2); font-size: 12px; font-weight: 700; flex: none; }
.kb-source.on .icon { background: var(--ok-soft); color: var(--ok); }
.kb-hit { padding: 12px 0; border-top: 1px solid var(--line-2); }
.kb-hit:first-child { border-top: none; }
.kb-hit .meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.kb-hit .meta b { margin-right: 4px; }
.kb-hit .text { color: var(--ink-2); font-size: 13px; white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.kb-placeholder { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 28px 16px; color: var(--ink-3); }
.kb-placeholder .glyph { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 20px; }
.kb-placeholder .row { justify-content: center; }
.kb-assistant { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 12px; height: min(720px, calc(100vh - 150px)); min-height: 480px; padding: 0; overflow: hidden; }
.kb-assistant .card-head { background: linear-gradient(180deg, #f7f8ff, var(--panel)); }
.kb-assistant .avatar { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #fff; font-size: 14px; background: linear-gradient(135deg, #6d8bff, var(--accent) 55%, #7b4dff); flex: none; }
.kb-assistant .log { margin: 0 14px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 12px; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 12px; }
.kb-assistant .chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px; }
.kb-assistant form { padding: 0 14px 14px; }
.kb-assistant .msg { max-width: 92%; }
.kb-assistant .msg.system { text-align: left; background: var(--panel); border: 1px dashed var(--line); color: var(--ink-2); font-size: 12.5px; max-width: 100%; padding: 10px 12px; border-radius: 12px; }

/* agent cards */
.agent-card { gap: 16px; }
.agent-card .card-title { display: flex; align-items: center; gap: 10px; }
.agent-card .card-title .avatar { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 13px; flex: none; overflow: hidden; }
.agent-card .card-title .avatar img { width: 100%; height: 100%; object-fit: cover; }
.section-label { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); margin-top: 4px; }
.kb-hit .kb-count { margin-left: 0; }
.kb-hit .text { white-space: pre-line; }

/* network area + grouped client tabs */
.side .scope-title { padding: 0 10px; color: #e7eaf0; font-weight: 600; font-size: 14px; display: flex; flex-direction: column; gap: 2px; }
.side .scope-title span { color: #5d6577; font-weight: 400; font-size: 11.5px; }
.side .net-link { margin-top: auto; }
.side .net-link + .foot { margin-top: 0; }
.tabs.grouped { display: flex; flex-wrap: wrap; gap: 6px 14px; background: none; padding: 0; width: auto; overflow: visible; }
.tabs.grouped .tab-group { display: flex; flex-direction: column; gap: 4px; }
.tabs.grouped .tab-label { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); padding-left: 6px; opacity: .75; }
.tabs.grouped .tab-group:first-child { justify-content: flex-end; }
.tabs.grouped .tab-row { display: flex; gap: 2px; padding: 4px; background: var(--bg-2); border-radius: 12px; }
.scope-tag { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--bg-2); color: var(--ink-2); font-weight: 500; }
.plugin-section { display: flex; flex-direction: column; gap: 10px; }
.plugin-section > h3 { margin: 6px 0 0; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
.rules-list { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.rules-list li { padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-2); font-size: 13.5px; }

/* releases: rollout bar, live tracks, diffs */
.modal.wide { width: min(980px, 100%); }
.rollout-bar { display: flex; height: 30px; border-radius: 9px; overflow: hidden; border: 1px solid var(--line); font-size: 12px; font-weight: 600; }
.rollout-bar > span { display: flex; align-items: center; justify-content: center; white-space: nowrap; overflow: hidden; padding: 0 6px; min-width: 0; }
.rollout-bar .stable { background: var(--ok-soft); color: var(--ok); }
.rollout-bar .beta { background: var(--accent-soft); color: var(--accent); }
.rollout-bar .alpha { background: var(--warn-soft); color: var(--warn); }
.pill.stage-stable { background: var(--ok-soft); color: var(--ok); }
.pill.stage-beta { background: var(--accent-soft); color: var(--accent); }
.pill.stage-alpha { background: var(--warn-soft); color: var(--warn); }
.track-row { display: grid; grid-template-columns: 110px 70px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line-2); }
.track-row > .pill { justify-self: start; }
.track-row input[type=number] { width: 76px; height: 30px; }
.release-text { white-space: pre-wrap; font-size: 13px; color: var(--ink-2); background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; }
.diff { display: flex; flex-direction: column; gap: 8px; }
.diff-item { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.diff-head { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--panel-2); border-bottom: 1px solid var(--line-2); }
.diff-lines, .diff-vals { margin: 0; padding: 6px 0; font-family: var(--mono); font-size: 12px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; max-height: 320px; overflow: auto; display: flex; flex-direction: column; }
.diff-lines > span, .diff-vals > div { padding: 0 10px; }
.diff .add { background: #e9f7ef; color: #11613b; }
.diff .del { background: #fdeeee; color: #a3242a; }
.diff .ctx { color: var(--ink-3); }

/* ── agents: pipeline, team, read vs edit ─────────────────────────────── */
.avatar { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 12px; flex: none; overflow: hidden; line-height: 1; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.md { width: 40px; height: 40px; border-radius: 12px; font-size: 16px; }
.avatar.lg { width: 56px; height: 56px; border-radius: 16px; font-size: 22px; }
.team-row { display: flex; align-items: center; gap: 10px; padding: 8px; margin: 0 -8px; border-radius: 10px; text-decoration: none; color: inherit; min-width: 0; }
.team-row:hover { background: var(--panel-2); }
.team-row b { color: var(--ink); }

/* ── publication status strip: same shape on every page ─────────────────── */
.release-bar { --tone: var(--ink-3); --tone-soft: var(--line-2); display: flex; align-items: center; gap: 14px; padding: 12px 12px 12px 14px; border: 1px solid var(--line); border-left: 4px solid var(--tone); border-radius: 12px; background: var(--panel); box-shadow: var(--shadow); }
.release-bar.live { --tone: var(--ok); --tone-soft: var(--ok-soft); }
.release-bar.draft { --tone: var(--accent); --tone-soft: var(--accent-soft); background: linear-gradient(90deg, var(--accent-soft), var(--panel) 60%); }
.release-bar.review { --tone: var(--warn); --tone-soft: var(--warn-soft); background: linear-gradient(90deg, var(--warn-soft), var(--panel) 60%); }
.release-bar.empty { --tone: var(--ink-3); }
.release-icon { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--tone-soft); color: var(--tone); }
.release-icon svg { width: 17px; height: 17px; }
.release-text-col { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.release-kicker { font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); }
.release-text-col b { font-size: 14.5px; line-height: 1.3; color: var(--ink); }
.release-hint { color: var(--ink-2); font-size: 12.5px; line-height: 1.4; }
.release-actions { display: flex; gap: 6px; flex: none; align-items: center; }
.release-id { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.release-id span { font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); }
.release-id b { font-size: 14px; white-space: nowrap; }

/* Rascunho → Revisão → No ar */
.empty-state { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.empty-state > svg { width: 22px; height: 22px; color: var(--warn); }

/* Publication hub (Resumo) and pipeline (Versões) */
.pub-hub { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 18px; }
.pub-parts { display: flex; flex-direction: column; }
.pub-part { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line-2); color: inherit; text-decoration: none; }
.pub-part:first-child { border-top: 0; }
.pub-part .release-icon { width: 22px; height: 22px; }
.pub-part .release-icon svg { width: 13px; height: 13px; }
.pub-part.live { --tone: var(--ok); --tone-soft: var(--ok-soft); }
.pub-part.draft { --tone: var(--accent); --tone-soft: var(--accent-soft); }
.pub-part.review { --tone: var(--warn); --tone-soft: var(--warn-soft); }
.pub-part.empty { --tone: var(--ink-3); --tone-soft: var(--line-2); }
.pub-part b { font-size: 13.5px; }
.pub-part .sub { font-size: 12.5px; }
.pub-live { display: flex; flex-direction: column; gap: 10px; }
.pipeline { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.pipe { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border: 1px solid var(--line); border-top: 3px solid var(--tone); border-radius: 12px; background: var(--panel); box-shadow: var(--shadow); color: inherit; text-decoration: none; }
.pipe.draft { --tone: var(--accent); }
.pipe.review { --tone: var(--warn); }
.pipe.live { --tone: var(--ok); }
.pipe .n { font-size: 26px; font-weight: 700; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.pipe .k { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--tone); }
.pipe .sub { font-size: 12.5px; }
.pipe.zero .n { color: var(--ink-3); }
tr.live-row td { background: var(--ok-soft); }
tr.live-row td:first-child { box-shadow: inset 3px 0 0 var(--ok); }
.what-happens { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line-2); font-size: 13px; color: var(--ink-2); }
textarea[aria-invalid="true"], input[aria-invalid="true"] { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
button[aria-busy="true"] { cursor: progress; opacity: .75; }

.tab-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-left: 6px; background: var(--accent); vertical-align: 1px; }
.tab-dot.review { background: var(--warn); }

.persona-card { display: flex; flex-direction: column; gap: 10px; }
.persona-preview { color: var(--ink-2); font-size: 13.5px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.agent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.agent-tile { display: flex; flex-direction: column; gap: 10px; border-left-width: 3px; }
.agent-tile.kind-same { border-left-color: var(--ok); }
.agent-tile.kind-changed { border-left-color: var(--warn); }
.agent-tile.kind-new { border-left-color: var(--accent); }
.agent-tile.kind-removed { border-left-color: var(--bad); background: #fffafa; }
.agent-tile.add { border: 1px dashed var(--accent-line); align-items: center; justify-content: center; text-align: center; text-decoration: none; color: var(--ink); min-height: 220px; gap: 6px; background: linear-gradient(180deg, #f7f8ff, var(--panel)); }
.agent-tile.add:hover { border-color: var(--accent); background: var(--accent-soft); }
.agent-tile .plus { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 22px; font-weight: 600; line-height: 1; }
.tile-desc { margin: 0; color: var(--ink-2); font-size: 13px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tile-caps { display: flex; flex-wrap: wrap; gap: 6px; }
.tile-changes { font-size: 12.5px; color: var(--warn); }
.tile-foot { margin-top: auto; }
.metrics { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--ink-2); }
.metrics span { display: inline-flex; gap: 4px; align-items: baseline; }
.metrics b { color: var(--ink); font-variant-numeric: tabular-nums; }

.crumbs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--ink-3); font-size: 13px; margin-bottom: 12px; }
.crumbs a { color: var(--ink-2); }
.crumbs b { color: var(--ink); font-weight: 600; }
.agent-hero { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.read { display: grid; grid-template-columns: 148px minmax(0, 1fr); gap: 12px 16px; margin: 0; }
.read dt { color: var(--ink-3); font-size: 12.5px; font-weight: 600; padding-top: 2px; }
.read dd { margin: 0; min-width: 0; }
.read-text, .quote { margin: 0; white-space: pre-wrap; font: inherit; font-size: 13.5px; color: var(--ink-2); background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; max-height: 280px; overflow: auto; }
.quote { border-left: 3px solid var(--accent); max-height: none; }
.chat-preview { display: flex; gap: 10px; align-items: flex-start; padding: 12px; background: var(--panel-2); border-radius: 12px; border: 1px solid var(--line-2); max-width: 420px; }
.chat-preview .msg { margin-top: 6px; }

.timeline { display: flex; flex-direction: column; margin: 4px 0 0 4px; }
.tl-item { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 10px; position: relative; padding-bottom: 14px; }
.tl-item::before { content: ""; position: absolute; left: 5px; top: 16px; bottom: 0; width: 2px; background: var(--line); }
.tl-item:last-child { padding-bottom: 0; }
.tl-item:last-child::before { display: none; }
.tl-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--panel); border: 2px solid var(--ink-3); margin-top: 4px; position: relative; z-index: 1; }
.tl-item.draft .tl-dot { border-color: var(--warn); background: var(--warn); }
.tl-dot.stage-stable { border-color: var(--ok); background: var(--ok); }
.tl-dot.stage-beta { border-color: var(--accent); background: var(--accent); }
.tl-dot.stage-alpha { border-color: var(--warn); background: var(--warn); }
.tl-item.muted .tl-body { opacity: .7; }
.tl-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tl-note { font-size: 13px; color: var(--ink-2); }
.tl-actions { gap: 4px; }

.edit-bar { position: sticky; top: 10px; z-index: 6; display: flex; align-items: center; gap: 14px; margin-bottom: 16px; padding: 12px 12px 12px 14px;
  background: var(--accent-soft); border: 1px solid var(--accent-line); border-left: 4px solid var(--accent); border-radius: 12px; box-shadow: var(--shadow-lg);
  --tone: var(--accent); --tone-soft: #fff; }
.edit-bar .release-icon { background: #fff; color: var(--accent); }
.edit-what { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.edit-what b { font-size: 15.5px; line-height: 1.3; color: var(--ink); }
.edit-what > span:last-child { color: var(--ink-2); font-size: 12.5px; line-height: 1.4; }
.edit-what .release-kicker { color: var(--accent); }
.edit-count { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }
.edit-count.on { color: var(--accent); font-weight: 700; }
.edit-actions { display: flex; gap: 6px; flex: none; }
@media (max-width: 1100px) { .edit-bar { flex-wrap: wrap; } .edit-count { margin-left: 46px; } .edit-actions { margin-left: auto; } }
.edit-section { display: flex; flex-direction: column; gap: 12px; padding-top: 16px; margin-top: 8px; border-top: 1px solid var(--line-2); }
.edit-section:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.edit-section > h3 { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); }
.efield { padding: 8px 10px; border-radius: 12px; border: 1px solid transparent; transition: background .12s, border-color .12s; }
.efield-head { display: flex; align-items: center; gap: 8px; }
.efield-mark, .efield .efield-undo { display: none; }
.efield.dirty { background: var(--warn-soft); border-color: #f0d09a; }
.efield.dirty .efield-mark { display: inline; margin-left: auto; font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--warn); }
.efield.dirty .efield-undo { display: inline-flex; }
.flow-steps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; counter-reset: flow; }
.flow-steps li { counter-increment: flow; display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--ink-3); }
.flow-steps li::before { content: counter(flow); width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--line-2); color: var(--ink-2); flex: none; }
.flow-steps li.on { color: var(--ink); font-weight: 650; }
.flow-steps li.on::before { background: var(--accent); color: #fff; }
.change-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.danger-zone { border-color: #f4c9cb; background: #fffafa; }

.pg-toolbar { justify-content: flex-start; }
.pg-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; align-items: start; }
.pg-panes.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pg-pane.chat { height: min(560px, calc(100vh - 280px)); min-height: 420px; }

@media (max-width: 1100px) {
  .release-bar { flex-wrap: wrap; }
  .release-actions { margin-left: 46px; flex-wrap: wrap; }
  .pub-hub, .pipeline { grid-template-columns: 1fr; }
  .detail-layout, .pg-layout, .pg-panes.two { grid-template-columns: 1fr; }
  .read { grid-template-columns: 1fr; gap: 4px 0; }
  .read dt { padding-top: 8px; }
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.pill.accent.dot, a.pill { text-decoration: none; }

/* No ar / Rascunho: two rows, each with its own state, never a single progress line */
.release-facts { display: grid; gap: 4px; margin: 0; flex: none; min-width: 230px; padding: 6px 12px; border-left: 1px solid var(--line-2); font-size: 12.5px; }
.release-facts > div { display: grid; grid-template-columns: 116px minmax(0, 1fr); align-items: center; gap: 8px; }
.release-facts dt { white-space: nowrap; display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); }
.release-facts dt::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--line); flex: none; }
.release-facts .on dt { color: var(--ok); }
.release-facts .on dt::before { background: var(--ok); }
.release-facts .pending dt { color: var(--accent); }
.release-facts .pending dt::before { background: var(--accent); }
.release-facts .wait dt { color: var(--warn); }
.release-facts .wait dt::before { background: var(--warn); }
.release-facts dd { margin: 0; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.release-facts dd b { color: var(--ink); }
.release-discard { margin-right: 8px; }
@media (max-width: 1100px) {
  .release-facts { border-left: 0; padding: 0; margin-left: 46px; flex-basis: calc(100% - 46px); min-width: 0; }
}
.history-actions { gap: 4px; flex-wrap: wrap; justify-content: flex-end; max-width: 300px; margin-left: auto; }

/* One card per part: the publication state is the header, the content the body */
.part-card { overflow: hidden; }
.release-bar.embedded { border: 0; border-bottom: 1px solid var(--line-2); border-left: 4px solid var(--tone); border-radius: 0; box-shadow: none; }
.release-bar.embedded.live { background: var(--panel); }
.part-body { padding: 16px 18px 18px; }

/* ── Montar versão (cut composer) ─────────────────────────────────────────── */
.cut-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.cut-parts { display: flex; flex-direction: column; gap: 8px; }
.cut-part { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); transition: border-color .12s, background .12s; }
.cut-part > div > .sub { display: block; font-size: 12.5px; }
.cut-part label { cursor: pointer; }
.cut-part.in { border-color: var(--accent-line); background: var(--accent-soft); }
.cut-part.held { border-style: dashed; background: var(--panel-2); }
.cut-part.held b { color: var(--ink-2); }
.cut-part.off { opacity: .62; background: var(--panel-2); }
.cut-part input[type=checkbox] { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); cursor: pointer; }
.cut-box { width: 18px; height: 18px; margin-top: 2px; border-radius: 5px; border: 1.5px solid var(--line); display: inline-flex; align-items: center; justify-content: center; }
.cut-box.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.cut-box svg { width: 12px; height: 12px; }
.cut-diff { margin-top: 6px; font-size: 12.5px; }
.cut-diff summary { cursor: pointer; color: var(--accent); width: max-content; }
.cut-diff .diff { margin-top: 8px; }
.cut-aside { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--panel-2); border: 1px solid var(--line-2); position: sticky; top: 0; }
.cut-line { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.cut-step { position: relative; display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 12px; padding-bottom: 16px; }
.cut-step:last-child { padding-bottom: 0; }
.cut-step::before { content: ""; position: absolute; left: 6px; top: 16px; bottom: 0; width: 2px; background: var(--line); }
.cut-step:last-child::before { display: none; }
.cut-step > div { display: flex; flex-direction: column; min-width: 0; }
.cut-step b { font-size: 13.5px; }
.cut-step .sub { font-size: 12.5px; }
.cut-dot { width: 14px; height: 14px; margin-top: 3px; border-radius: 50%; border: 2px solid var(--line); background: var(--panel); z-index: 1; }
.cut-step.live .cut-dot { border-color: var(--ok); background: var(--ok); }
.cut-step.wait .cut-dot { border-color: var(--warn); background: var(--warn-soft); }
.cut-step.cut .cut-dot { border-color: var(--accent); background: var(--accent); box-shadow: var(--ring); }
.cut-step.cut b { color: var(--accent-2); }
.cut-step.held .cut-dot { border-style: dashed; }
.cut-step.held::before { background: repeating-linear-gradient(var(--line) 0 4px, transparent 4px 8px); }
.part-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.part-chip { display: inline-flex; font-size: 11px; font-weight: 550; padding: 1px 7px; border-radius: 6px; background: var(--line-2); color: var(--ink-2); white-space: nowrap; margin-left: 4px; }
.part-chips .part-chip { margin-left: 0; }
.mode-pick { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.mode-pick legend { padding: 0; margin-bottom: 4px; }
.mode-opt { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; }
.mode-opt:has(input:checked) { border-color: var(--accent-line); background: var(--accent-soft); }
.mode-opt input { margin-top: 3px; accent-color: var(--accent); }
.mode-opt > span { display: flex; flex-direction: column; gap: 2px; }
@media (max-width: 760px) { .cut-grid { grid-template-columns: 1fr; } .cut-aside { position: static; } }
.kb-drop { margin: 10px 16px; padding: 18px; border: 1.5px dashed var(--line); border-radius: 10px; text-align: center; cursor: pointer; color: var(--ink-2, inherit); transition: background .15s, border-color .15s; }
.kb-drop:hover, .kb-drop.over { border-color: var(--accent); background: var(--panel-2); }
.kb-drop .sub { margin-top: 4px; }
