/* Overlap. One family (Inter), cool near-white, navy for actions; amber lives only in the mark. */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --sunken: #f0f2f5;
  --line: #e3e6eb;
  --line-strong: #cfd4dc;
  --ink: #111827;
  --ink-2: #374151;
  --muted: #5b6474;
  --navy: #1f2a44;
  --navy-hover: #2c3a5c;
  --amber: #e8a33d;
  --yes: #13744a;
  --yes-bg: #ecf7f1;
  --no: #b3261e;
  --no-bg: #fcefee;
  --person: #2f6f5e;
  --radius: 12px;
  --z-sticky: 10;
  --z-menu: 20;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); }
body { margin: 0; color: var(--ink); background: var(--bg); font: 15px/1.55 Inter, system-ui, -apple-system, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--navy); text-underline-offset: 2px; }
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.pre { white-space: pre-line; }
h1, h2, h3 { font-family: inherit; text-wrap: balance; }
h1 { font-size: 34px; font-weight: 700; letter-spacing: -0.025em; line-height: 1.1; margin: 0; }
h2 { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 6px; }
.hint { font-size: 13px; color: var(--muted); margin: 8px 0 0; }

/* Top bar and demo strip */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 56px; padding: 0 28px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: var(--z-sticky); }
.wordmark { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 17px; letter-spacing: -0.015em; text-decoration: none; color: var(--ink); }
.mark { width: 24px; height: 15px; position: relative; display: inline-block; }
.mark::before, .mark::after { content: ""; position: absolute; top: 0; width: 15px; height: 15px; border-radius: 50%; }
.mark::before { left: 0; background: var(--navy); }
.mark::after { left: 9px; background: var(--amber); mix-blend-mode: multiply; }
.topbar nav { display: flex; gap: 14px; align-items: center; }
.link-button { background: none; border: 0; padding: 6px 2px; font: 500 14px Inter, sans-serif; cursor: pointer; color: var(--muted); }
.link-button:hover { color: var(--ink); background: none; }

.demo-bar { background: var(--navy); color: #e6e9f0; }
.demo-inner { max-width: 1120px; margin: 0 auto; padding: 10px 28px; display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; }
.demo-copy { margin: 0; font-size: 14px; display: flex; align-items: center; gap: 10px; }
.demo-tag { font-size: 12px; font-weight: 600; color: var(--navy); background: var(--amber); border-radius: 6px; padding: 1px 7px; }
.demo-actions { display: flex; gap: 8px; align-items: center; }
.demo-actions > button { padding: 7px 14px; font-size: 14px; border-radius: 8px; }
.demo-actions #demo-run { background: #fff; color: var(--navy); border-color: #fff; font-weight: 600; }
.demo-actions #demo-run:hover { background: #eef1f6; }
.demo-actions .quiet { background: transparent; color: #fff; border-color: rgba(255,255,255,.28); }
.demo-actions .quiet:hover { border-color: rgba(255,255,255,.6); background: transparent; }
.demo-more { position: relative; }
.demo-more summary { list-style: none; cursor: pointer; padding: 7px 12px; font-size: 14px; border-radius: 8px; color: #fff; border: 1px solid rgba(255,255,255,.28); }
.demo-more summary::-webkit-details-marker { display: none; }
.demo-more summary::after { content: ""; display: inline-block; margin-left: 8px; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-3px) rotate(45deg); }
.demo-more[open] summary { border-color: rgba(255,255,255,.6); }
.demo-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: var(--z-menu); width: 280px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 8px; box-shadow: 0 8px 24px rgba(17,24,39,.14); display: grid; gap: 2px; }
.menu-label { font-size: 12px; color: var(--muted); padding: 8px 10px 2px; }
.menu-item { display: grid; text-align: left; gap: 1px; background: transparent; color: var(--ink); border: 0; padding: 8px 10px; border-radius: 6px; font-size: 14px; font-weight: 500; }
.menu-item span { font-size: 12.5px; font-weight: 400; color: var(--muted); }
.menu-item:hover { background: var(--sunken); }
.menu-links { display: flex; gap: 14px; padding: 4px 10px 8px; }
.menu-links a { font-size: 14px; font-weight: 500; }

/* Page layout */
.layout { max-width: 1120px; margin: 0 auto; padding: 64px 28px 24px; display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 28px 56px; align-items: start; }
.layout > .assistant { margin-top: 56px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.assistant { grid-column: 1 / -1; }
.owner { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.owner .receipts { grid-column: 1 / -1; }

/* Profile: on the page, not in a box */
.profile { padding-top: 6px; }
.profile-row { display: flex; gap: 18px; align-items: center; }
.avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--person); color: #fff; display: inline-grid; place-items: center; font-weight: 600; font-size: 22px; letter-spacing: .01em; flex: none; }
.avatar.small { width: 32px; height: 32px; font-size: 12px; }
.headline { margin: 6px 0 0; font-size: 16px; color: var(--muted); }
.about { font-size: 18px; line-height: 1.6; color: var(--ink-2); max-width: 34em; margin: 30px 0 0; text-wrap: pretty; }
.topics { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 16px 0 0; font-size: 13.5px; color: var(--ink-2); }
.topics li { background: #e9ecf1; border-radius: 6px; padding: 3px 9px; }
.facts { display: flex; flex-wrap: wrap; gap: 14px 32px; margin: 30px 0 0; padding-top: 22px; border-top: 1px solid var(--line); }
.facts dt { font-size: 13px; color: var(--muted); }
.facts dd { margin: 3px 0 0; font-weight: 500; font-size: 15px; }

/* The check panel: the page's main affordance */
.check h2 { font-size: 20px; letter-spacing: -0.015em; }
.answer-rule { margin: 0 0 18px; color: var(--ink-2); font-size: 14.5px; }
.yes, .yes-text { color: var(--yes); font-weight: 600; }
.no, .no-text { color: var(--no); font-weight: 600; }
.check-form { display: grid; grid-template-columns: 1.35fr 1fr 1fr; gap: 10px; align-items: end; }
.check-form label { display: grid; gap: 5px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.check-form label > * { width: 100%; min-width: 0; }
.check-form button { grid-column: 1 / -1; padding: 10px; font-size: 15px; }
#manual-result:empty { display: none; }
#manual-result { margin: 14px 0 0; padding: 10px 12px; border-radius: 8px; font-size: 14px; background: var(--sunken); color: var(--ink-2); font-weight: 500; }
#manual-result.yes-text { background: var(--yes-bg); color: var(--yes); }
#manual-result.no-text { background: var(--no-bg); color: var(--no); }
.rules-more { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 14px; }
.rules-more summary { cursor: pointer; font-weight: 500; color: var(--ink-2); }
.rules-more summary:hover { color: var(--ink); }
.rules { margin: 10px 0 0; padding-left: 18px; display: grid; gap: 6px; color: var(--ink-2); }

.section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px 24px; flex-wrap: wrap; }
.assistant-note { margin: 0; color: var(--muted); font-size: 14px; max-width: 60ch; }
.status-line { margin: 2px 0 0; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.status-line::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); }

/* Controls */
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.inline-form label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
input, select { font: inherit; font-size: 15px; height: 40px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); }
input[type="file"] { height: auto; padding: 6px; }
input:focus-visible, select:focus-visible, button:focus-visible, summary:focus-visible, a:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.inline-form input[type="url"] { flex: 1; min-width: 220px; }
button { font: inherit; font-weight: 500; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--navy); background: var(--navy); color: #fff; cursor: pointer; transition: background-color .15s ease-out, border-color .15s ease-out; }
button:hover { background: var(--navy-hover); }
button.secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
button.secondary:hover { background: var(--sunken); }
button:disabled { opacity: .55; cursor: default; }
.small-btn { padding: 4px 10px; font-size: 13px; }
.field-error { color: var(--no); margin: 6px 0 0; font-size: 14px; }

/* Owner panels */
.people-list, .request-list { list-style: none; padding: 0; margin: 14px 0; display: grid; gap: 8px; }
.person { display: flex; gap: 12px; align-items: center; justify-content: space-between; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.person > div { flex: 1; min-width: 0; }
.person .mono { font-family: inherit; font-size: 13px; color: var(--muted); }
.request { border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.request.pending { border-color: var(--amber); background: #fffaf0; }
.request .actions { display: flex; gap: 6px; }
.pill { font-size: 12px; border-radius: 999px; padding: 2px 8px; border: 1px solid var(--line); white-space: nowrap; }
.pill.accepted { color: var(--yes); border-color: currentColor; }
.pill.declined { color: var(--no); border-color: currentColor; }
.people-list > .muted, .request-list > .muted { border: 1px dashed var(--line-strong); border-radius: 10px; padding: 14px; font-size: 14px; }
.meter { display: flex; gap: 10px; align-items: center; color: var(--muted); }
.bar { width: 140px; height: 6px; background: var(--sunken); border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--navy); }
.mode-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 12px 0 16px; font-size: 14px; color: var(--ink-2); }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; background: var(--surface); color: var(--ink); font-size: 13px; padding: 7px 12px; }
.seg button:hover { background: var(--sunken); }
.seg button[aria-checked="true"] { background: var(--navy); color: #fff; }
.receipt-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.receipt-table th { text-align: left; font-size: 13px; font-weight: 500; color: var(--muted); border-bottom: 1px solid var(--line); padding: 8px; }
.receipt-table td { border-bottom: 1px solid var(--line); padding: 10px 8px; vertical-align: top; }
.receipt-table td.mono { font-family: inherit; }
.receipt-table tbody tr:only-child td { color: var(--muted); }
.sub { font-size: 14px; font-weight: 600; margin: 16px 0 8px; color: var(--ink); }
.grant-list { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 6px; }
.grant-list > .muted { font-size: 14px; }
.grant { display: flex; justify-content: space-between; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.signed { color: var(--yes); font-weight: 600; }
.owner-foot { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

.small-dialog, .request-dialog { border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; max-width: 520px; width: calc(100% - 32px); background: var(--surface); color: var(--ink); box-shadow: 0 8px 24px rgba(17,24,39,.16); }
.small-dialog label { display: grid; gap: 4px; margin: 12px 0; font-size: 14px; }
.small-dialog .actions, .window .actions { display: flex; gap: 8px; margin-top: 14px; }
dialog::backdrop { background: rgba(17,24,39,.4); }

/* Request window (bridge) and in-page request dialog */
.window-page { background: var(--bg); }
.window { max-width: 560px; margin: 0 auto; padding: 20px; display: grid; gap: 12px; }
.window-head { display: flex; gap: 10px; align-items: center; font-weight: 600; font-size: 16px; }
.window .panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.request-dialog .window { padding: 0; }
.panel h1 { font-size: 22px; margin-bottom: 6px; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px; padding: 4px 0; }
.kv .k { color: var(--muted); font-size: 13px; }
fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 10px; }
legend { font-weight: 600; margin-bottom: 6px; }
.field { display: grid; gap: 4px; }
.field label { font-size: 13px; color: var(--muted); }
.confirmation h2 { color: var(--yes); }

.foot { max-width: 1180px; margin: 8px auto 40px; padding: 0 24px; color: var(--muted); font-size: 13px; }

/* Runtime (nsDeploy) chat, from the agentify-website template, in this page's palette */
#agent-app {
  --ns-font: Inter, system-ui, sans-serif;
  --ns-bg: #ffffff;
  --ns-fg: #111827;
  --ns-primary: #1f2a44;
  --ns-accent: #1f2a44;
  --ns-border: #e3e6eb;
  --ns-panelbg: #f8f9fb;
  --ns-msgbg: #f0f2f5;
  --ns-muted: #5b6474;
  margin-top: 18px;
}
.assistant-panels { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 16px; margin-top: 12px; }
#agent-app.ns-composed-app [data-ns-slot="chat"] { height: 600px; }
#agent-app .ns-chat { background: var(--ns-bg); }
#agent-app input[type="checkbox"], #agent-app input[type="radio"] { width: auto; height: auto; }
#agent-app input, #agent-app select { height: auto; padding: 8px 10px; font-size: 14px; }
#agent-app .ns-header { flex-wrap: wrap; }
#agent-app .ns-settings-body label { margin: 4px 0; font-weight: 400; }
#agent-app .ns-w-label { font-family: inherit; }
#agent-app .ns-widget label { margin: 0; }
#agent-app .ns-w-radio label, #agent-app .ns-w-multi label, #agent-app .ns-w-toggle { font-weight: 400; }
#agent-app button { margin: 0; }
#agent-app .ns-w-choice { color: var(--ns-fg); }
#agent-app .ns-devtoggle:not(.on):hover, #agent-app .ns-modal-close:hover { background: transparent; }
#agent-app .ns-msg { overflow-wrap: break-word; line-height: 1.5; }
#agent-app .ns-msg table { font-size: 14px; }
#agent-app .ns-consent { background: #f5f7fb; border: 1px solid #c9d1e2; }
#agent-app .ns-consent-sub { font-family: inherit; color: var(--ns-muted); }
#agent-app .ns-consent-req { color: #374151; }
#agent-app .ns-consent-actions button.ghost { color: var(--ns-fg); border-color: #c9d1e2; }
#agent-app .ns-consent-done { color: var(--yes); }
#agent-app .ns-msgs:has(.ns-consent-actions) > .ns-turn-status { display: none; }
#agent-app .ns-consent-actions { flex-wrap: wrap; }
#agent-app .ns-consent-actions button { white-space: nowrap; }
#agent-app .ns-agents h3 { text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 600; color: var(--ink-2); }
#agent-app .ns-anode { border-radius: 8px; }
#agent-app .ns-anode .ns-aicon { display: none; }
#agent-app .ns-anode.done .ns-adot { background: var(--yes); }
body > dialog h2 { margin: 0 0 12px; }
.assistant-review { max-width: 640px; width: 85%; max-height: 85vh; overflow: auto; border: 1px solid var(--line); border-radius: 12px; padding: 24px; }
.assistant-review dl { display: grid; grid-template-columns: fit-content(40%) 1fr; gap: 4px 16px; margin: 12px 0; }
.assistant-review dd { margin: 0; overflow-wrap: anywhere; }
.assistant-review pre { white-space: pre-wrap; overflow-wrap: anywhere; }

.foot { max-width: 1120px; margin: 12px auto 48px; padding: 0 28px; color: var(--muted); font-size: 13px; }
.foot p { margin: 4px 0; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

@media (max-width: 900px) {
  .topbar { padding: 0 16px; }
  .demo-inner { padding: 10px 16px; }
  .demo-copy { font-size: 13px; }
  .demo-copy { font-size: 13px; align-items: flex-start; }
  .demo-actions { width: 100%; flex-wrap: wrap; }
  .demo-actions #demo-run { flex: 1 1 100%; }
  .demo-actions .quiet, .demo-more { flex: 1; }
  .demo-more summary { text-align: center; }
  .demo-menu { right: 0; }
  .layout { grid-template-columns: minmax(0, 1fr); padding: 28px 16px 16px; gap: 28px; }
  .layout > .assistant { margin-top: 0; }
  h1 { font-size: 28px; }
  .about { font-size: 16.5px; margin-top: 18px; }
  .facts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; margin-top: 22px; padding-top: 18px; }
  .facts > div:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .panel, .card { padding: 18px; }
  .owner > * { min-width: 0; }
  .receipts { overflow-x: auto; }
  .request { flex-wrap: wrap; }
  .kv { grid-template-columns: 1fr; gap: 0; }
  .owner { grid-template-columns: minmax(0, 1fr); }
  .assistant-panels { grid-template-columns: 1fr; }
}

/* The runtime's own header repeats our heading; keep only its model badge and developer toggle. */
#agent-app .ns-header { border-bottom: 0; padding: 0; min-height: 0; }
#agent-app .ns-header .ns-title, #agent-app .ns-header .ns-logo { display: none; }
#agent-app .ns-llmbadge { font-weight: 600; border-radius: 999px; }
#agent-app .ns-llmbadge.error { background: var(--no-bg); color: var(--no); border-color: #efc6c2; }
#agent-app .ns-llmbadge.real { background: var(--yes-bg); color: var(--yes); border-color: #bfe0cd; }

/* Quieter runtime chrome: the status line above already says whether the assistant is ready. */
#agent-app .ns-llmbadge.pending { display: none; }
#agent-app .ns-devtoggle { border: 0; padding: 2px 4px; font-size: 12.5px; color: var(--muted); }
#agent-app .ns-devtoggle:hover { color: var(--ink); }
#agent-app .ns-action-status { font-size: 12.5px; color: var(--muted); }
#agent-app .ns-action-status summary { cursor: pointer; }
#agent-app .ns-agents { background: transparent; border: 0; border-left: 1px solid var(--line); border-radius: 0; padding: 4px 0 4px 16px; }
#agent-app .ns-anode { background: var(--surface); }
#agent-app [data-ns-slot="chat"] .ns-chat { border-radius: 10px; }
@media (max-width: 900px) { #agent-app .ns-agents { border-left: 0; border-top: 1px solid var(--line); padding: 12px 0 0; } }
#agent-app .ns-header { justify-content: flex-end; }
.status-line.ready::before { background: var(--yes); }
.grant .mono, .grant span { font-family: inherit; font-size: 14px; }
.grant select { height: 34px; font-size: 13.5px; width: auto; }
.owner-settings { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; flex-basis: 100%; margin-top: 4px; }
.owner-settings label { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; color: var(--ink-2); font-size: 14px; }
.owner-settings input[type="checkbox"] { width: 16px; height: 16px; margin: 0; }
.owner-settings input[type="number"] { height: 32px; padding: 0 8px; font-size: 14px; }
