:root {
  --bg: #f4f6f3;
  --card: #ffffff;
  --soft-bg: #eef1ec;
  --line: #dde2db;
  --ink: #172033;
  --soft: #5b6474;
  --brand: #1d3461;
  --brand-bg: #e8edf6;
  --good: #1e7b4f;
  --good-bg: #e9f5ee;
  --warn: #a15c07;
  --warn-bg: #fdf5e6;
  --bad: #b42318;
  --bad-bg: #fcefed;
  --ask: #2558b5;
  --ask-bg: #ebf1fb;
  --shadow: 0 1px 2px rgba(23, 32, 51, .06);
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 "Public Sans", system-ui, sans-serif; overflow-x: hidden; }
svg.ic { width: 1em; height: 1em; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -0.125em; }
h2 { font-size: 16px; margin: 0; }
h3 { font-size: 14px; margin: 0 0 10px; }
.soft { color: var(--soft); }
[hidden] { display: none !important; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 28px; background: var(--card); border-bottom: 1px solid var(--line); flex-wrap: wrap; position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 16px; }
.brand-sub { font-weight: 500; color: var(--soft); font-size: 14px; padding-left: 12px; border-left: 1px solid var(--line); }
.logo { width: 24px; height: 24px; fill: var(--brand); stroke: none; }
.logo .tick { fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.guard-label { color: var(--soft); font-weight: 600; }
.switch { display: inline-flex; background: var(--soft-bg); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.switch button { border: 0; background: transparent; color: var(--soft); font: inherit; font-weight: 600; padding: 6px 14px; border-radius: 7px; cursor: pointer; }
.switch button[aria-checked="true"] { background: var(--card); box-shadow: 0 1px 3px rgba(16, 24, 40, .12); }
.switch button[aria-checked="true"][data-mode="observing"] { color: var(--warn); }
.switch button[aria-checked="true"][data-mode="enforcement"] { color: var(--good); }
.switch button:disabled { cursor: not-allowed; }
.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; border-radius: 8px; padding: 8px 16px; cursor: pointer; border: 1px solid var(--line); background: var(--card); color: var(--ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.quiet { background: var(--card); }
.btn.small { padding: 5px 12px; font-size: 13px; }
.btn.link { border: 0; background: none; color: var(--brand); padding: 4px 6px; }

.page { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; padding: 20px 28px 40px; max-width: 1400px; margin: 0 auto; align-items: start; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px; box-shadow: var(--shadow); }
.main-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.side-col { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 74px; }
.sec-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.num { width: 24px; height: 24px; border-radius: 50%; background: var(--brand-bg); color: var(--brand); font-weight: 800; font-size: 13px; display: grid; place-items: center; }

/* upload */
.drop { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 26px; border: 2px dashed var(--line); border-radius: 12px; cursor: pointer; text-align: center; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-bg); }
.drop-ic { width: 40px; height: 40px; border-radius: 10px; background: var(--brand-bg); margin-bottom: 6px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234f46e5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 16V4M7 9l5-5 5 5'/%3E%3Cpath d='M4 16v3a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-3'/%3E%3C/svg%3E"); background-size: 22px; background-repeat: no-repeat; background-position: center; }
.drop-t { font-weight: 600; font-size: 15px; }
.drop-t u { color: var(--brand); text-decoration: none; }
.drop-s { color: var(--soft); font-size: 13px; }
.upload.compact .drop { display: none; }
.docs-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.docs { display: flex; gap: 8px; flex-wrap: wrap; }
.doc { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 13px; background: var(--soft-bg); }
.doc .pdf { font-size: 10px; font-weight: 800; color: #fff; background: #d92d20; border-radius: 3px; padding: 1px 4px; }
.doc .sz { color: var(--soft); }
.start-row { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }

/* message trace */
.counts { color: var(--soft); font-size: 13px; }
.trace-tools { margin-left: auto; }
.messages { display: flex; flex-direction: column; gap: 6px; }
.empty { color: var(--soft); text-align: center; padding: 36px 10px; border: 1px dashed var(--line); border-radius: 10px; }
.msg { border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 10px; background: var(--card); animation: in .3s ease-out; }
.msg.allowed { border-left-color: #12b76a; }
.msg.flagged { border-left-color: #f79009; background: #fffcf5; }
.msg.blocked { border-left-color: #f04438; background: #fffbfa; }
.msg.held, .msg.approved { border-left-color: #2e90fa; background: #f8fbff; }
.msg summary { list-style: none; cursor: pointer; padding: 10px 14px; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.msg summary::-webkit-details-marker { display: none; }
.m-n { font-family: var(--mono); font-size: 12px; color: var(--soft); }
.m-main { min-width: 0; }
.route { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-family: var(--mono); font-size: 13px; }
.node { padding: 2px 8px; border-radius: 6px; background: var(--soft-bg); border: 1px solid var(--line); }
.node.agent { background: var(--brand-bg); border-color: #c7d7fe; color: #3538cd; }
.node.ext { background: #fff4ed; border-color: #f9dbaf; color: #b93815; }
.node.model { background: #f4f3ff; border-color: #d9d6fe; color: #5925dc; }
.arrow { color: var(--soft); }
.kind { font-family: var(--mono); font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--soft); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }
.m-sub { margin-top: 3px; font-size: 13px; color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-sub .path { font-family: var(--mono); color: var(--ink); }
.m-why { margin-top: 4px; font-size: 13px; font-weight: 600; }
.flagged .m-why { color: var(--warn); }
.blocked .m-why { color: var(--bad); }
.held .m-why, .approved .m-why { color: var(--ask); }
.chips { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.chip { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; border: 1px solid transparent; }
.chip.allowed { background: var(--good-bg); color: var(--good); border-color: #abefc6; }
.chip.flagged { background: var(--warn-bg); color: var(--warn); border-color: #fedf89; }
.chip.blocked { background: var(--bad-bg); color: var(--bad); border-color: #fecdca; }
.chip.held, .chip.approved { background: var(--ask-bg); color: var(--ask); border-color: #b2ddff; }
.chip.pii { background: #fff; color: var(--bad); border-color: #fecdca; }
.chip.status { background: var(--soft-bg); color: var(--soft); font-family: var(--mono); }
.m-body { padding: 0 14px 14px 52px; display: grid; gap: 10px; }
.block-h { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--soft); margin-bottom: 4px; display: flex; justify-content: space-between; }
pre.json { margin: 0; background: #0f172a; color: #e2e8f0; font: 12.5px/1.55 var(--mono); padding: 12px 14px; border-radius: 8px; overflow: auto; max-height: 420px; white-space: pre-wrap; word-break: break-word; }
.j-k { color: #93c5fd; }
.j-s { color: #a7f3d0; }
.j-n { color: #fcd34d; }
.j-b { color: #f9a8d4; }
.j-pii { background: #7f1d1d; color: #fecaca; border-radius: 3px; padding: 0 2px; }
.guard-note { border-radius: 8px; padding: 10px 12px; font-size: 13px; display: grid; gap: 4px; }
.guard-note.flagged { background: var(--warn-bg); border: 1px solid #fedf89; }
.guard-note.blocked { background: var(--bad-bg); border: 1px solid #fecdca; }
.guard-note.held, .guard-note.approved { background: var(--ask-bg); border: 1px solid #b2ddff; }
.guard-note code { font-family: var(--mono); font-size: 12px; color: var(--soft); }
.grant { font-size: 13px; }
.grant code { font-family: var(--mono); font-size: 12px; background: var(--soft-bg); padding: 1px 6px; border-radius: 4px; margin: 2px 4px 2px 0; display: inline-block; }
.grant code.dropped { background: var(--bad-bg); color: var(--bad); text-decoration: line-through; }
.end-row { margin-top: 8px; border-radius: 10px; padding: 14px 16px; font-weight: 700; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.end-row.bad { background: var(--bad-bg); color: var(--bad); border: 1px solid #fecdca; }
.end-row.good { background: var(--good-bg); color: var(--good); border: 1px solid #abefc6; }
.end-row span { font-weight: 500; color: var(--ink); }
@keyframes in { from { opacity: 0; transform: translateY(4px); } }

/* side */
.mode-line { font-size: 13px; color: var(--soft); margin-bottom: 12px; }
.mode-line b { color: var(--ink); }
.find { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--line); }
.find:first-of-type { border-top: 0; }
.find-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; flex: none; background: var(--line); }
.find.flagged .find-dot { background: #f79009; }
.find.blocked .find-dot { background: #12b76a; }
.find.approved .find-dot, .find.held .find-dot { background: #2e90fa; }
.find-t { font-weight: 600; font-size: 13px; }
.find-s { font-size: 12px; color: var(--soft); }
.find.flagged .find-s { color: var(--warn); }
.find.blocked .find-s { color: var(--good); }
.find.approved .find-s, .find.held .find-s { color: var(--ask); }
button.find { width: 100%; text-align: left; background: none; border-left: 0; border-right: 0; border-bottom: 0; font: inherit; color: inherit; cursor: pointer; }
button.find:disabled { cursor: default; }
#outcome-card.bad { border-color: #fecdca; background: var(--bad-bg); }
#outcome-card.good { border-color: #abefc6; background: var(--good-bg); }
.out-big { font-size: 17px; font-weight: 800; }
#outcome-card.bad .out-big { color: var(--bad); }
#outcome-card.good .out-big { color: var(--good); }
.out-row { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; padding: 5px 0; border-top: 1px solid rgba(16, 24, 40, .08); }
.out-row:first-of-type { margin-top: 8px; }
.runs { display: flex; flex-direction: column; gap: 6px; }
.run { text-align: left; font: inherit; color: inherit; background: var(--soft-bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; cursor: pointer; }
.run.sel { border-color: var(--brand); background: var(--brand-bg); }
.run-top { font-size: 12px; color: var(--soft); }
.run-big { font-weight: 700; font-size: 13px; }
.run-big.bad { color: var(--bad); }
.run-big.good { color: var(--good); }
.links { margin-top: 8px; }

/* approval */
.notify { position: fixed; bottom: 24px; right: 24px; width: 360px; max-width: calc(100vw - 32px); background: var(--card); border: 1px solid #b2ddff; border-radius: 14px; padding: 16px; box-shadow: 0 16px 40px rgba(16, 24, 40, .18); z-index: 30; animation: in .3s ease-out; }
.n-app { font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--soft); }
.n-who { display: flex; gap: 10px; align-items: center; margin-top: 10px; }
.n-face { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, #f59e0b, #ef4444); color: #fff; font-weight: 800; display: grid; place-items: center; font-size: 13px; }
.n-name { font-weight: 700; }
.n-role { font-size: 12px; color: var(--soft); }
.n-msg { margin-top: 10px; }
.n-row { display: flex; gap: 8px; margin-top: 12px; }
.n-row .btn { flex: 1; }

/* drawer, modal */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 440px; max-width: 100vw; background: var(--card); padding: 22px; overflow: auto; z-index: 40; border-left: 1px solid var(--line); box-shadow: -16px 0 40px rgba(16, 24, 40, .12); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 6px; }
.rule { border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-top: 10px; }
.rule-title { font-weight: 700; }
.rule-desc { color: var(--soft); font-size: 13px; margin: 2px 0 8px; }
.picks { display: flex; flex-wrap: wrap; gap: 6px; }
.pick { border: 1px solid var(--line); background: var(--card); color: var(--soft); border-radius: 999px; padding: 4px 10px; font: inherit; font-size: 13px; cursor: pointer; }
.pick.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.stepper { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.modal { position: fixed; inset: 0; background: rgba(16, 24, 40, .45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal-card { background: var(--card); border-radius: 14px; padding: 22px; width: 820px; max-width: 100%; max-height: 86vh; overflow: auto; }
.kv { display: grid; grid-template-columns: 200px 1fr; gap: 8px 14px; }
.kv div:nth-child(odd) { color: var(--soft); }

@media (max-width: 1000px) {
  .page { grid-template-columns: minmax(0, 1fr); }
  .side-col { position: static; }
}
@media (max-width: 640px) {
  .top, .page { padding-left: 16px; padding-right: 16px; }
  .brand-sub { display: none; }
  .msg summary { grid-template-columns: minmax(0, 1fr); }
  .m-n { display: none; }
  .chips { justify-content: flex-start; }
  .m-body { padding-left: 14px; }
  .kv { grid-template-columns: 1fr; }
}

/* platform mode: the console owns mode, rules, approvals and audit */
body.platform .local-only { display: none !important; }
.platform-links { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 13px; color: var(--soft); }
.platform-links a { color: var(--brand); font-weight: 600; text-decoration: none; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.platform-links a:hover { background: var(--brand-bg); }
.notify a.btn { text-align: center; text-decoration: none; }

.nav-link { font-size: 13px; font-weight: 600; color: var(--brand); text-decoration: none; margin-left: 6px; padding: 5px 10px; border-radius: 8px; border: 1px solid var(--line); }
.nav-link:hover { background: var(--brand-bg); }

:focus-visible { outline: 2px solid var(--ask); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* Earlier runs in this browser, listed on the start pages. */
.earlier { margin-top: 28px; }
.earlier h3 { margin: 0 0 8px; font-size: 15px; }
.er { display: grid; grid-template-columns: 110px 1fr auto auto; gap: 12px; align-items: center; padding: 10px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--ink); margin-bottom: 6px; }
.er:hover { border-color: var(--brand); }
.er-m { font-size: 12.5px; font-weight: 700; }
.er-m.watch { color: var(--bad); } .er-m.guard { color: var(--good); }
.er-t { font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .er { grid-template-columns: 1fr auto; } .er .soft:not(.er-t) { display: none; } }
