/* Recall Relay design system, shared by the hub and every API site built by agentic-api-site. */
:root {
  --brand: #2563eb; --brand-deep: #1d4ed8; --brand-tint: #eef2ff;
  --ink: #16181d; --ink-2: #3d4350; --muted: #5d6472; --line: #dfe2e8; --line-2: #eceef2;
  --paper: #ffffff; --canvas: #f6f7f9; --ok: #11683f; --ok-tint: #e8f5ee; --warn: #8a5200; --warn-tint: #fff4df;
  --danger: #a1161b; --danger-tint: #fdecec; --radius: 14px; --shadow: 0 1px 2px rgba(16,24,40,.05), 0 4px 16px rgba(16,24,40,.06);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font: 16px/1.55 var(--font); color: var(--ink); background: var(--canvas); }
a { color: var(--brand-deep); text-underline-offset: 2px; }
a:hover { color: var(--brand); }
code { font-family: var(--mono); font-size: .88em; background: var(--line-2); padding: .1em .35em; border-radius: 5px; overflow-wrap: anywhere; }
h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -.01em; margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 5vw, 3rem); font-weight: 800; }
h2 { font-size: 1.5rem; font-weight: 750; }
h3 { font-size: 1.1rem; }
.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; background: #fff; padding: 8px 12px; border-radius: 8px; z-index: 10; }
.muted { color: var(--muted); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, white); outline-offset: 2px; }

.site-header { background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.logo { display: inline-flex; gap: 10px; align-items: center; font-weight: 800; color: var(--ink); text-decoration: none; }
.logo-mark { width: 26px; height: 26px; border-radius: 8px; background: var(--brand) url("favicon.svg") center/cover; }
.site-header nav { display: flex; gap: 4px; flex-wrap: wrap; }
.site-header nav a { color: var(--ink-2); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: .95rem; }
.site-header nav a:hover { background: var(--brand-tint); color: var(--brand-deep); }

.hero { background: linear-gradient(160deg, var(--brand-tint), var(--canvas) 70%); padding: 48px 0 32px; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; font-weight: 700; color: var(--brand-deep); margin: 0 0 8px; }
.lede { font-size: 1.15rem; color: var(--ink-2); max-width: 60ch; margin: 0 0 12px; }
.source-line { color: var(--muted); font-size: .92rem; margin: 0; }

.panel, .assistant { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(18px, 3vw, 32px); margin-top: 24px; margin-bottom: 24px; }
.assistant { margin-top: 24px; }
.assistant-note { color: var(--muted); font-size: .92rem; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.api-tab { border: 1px solid var(--line); background: var(--paper); color: var(--ink-2); border-radius: 999px; padding: 7px 14px; font: 600 .92rem var(--font); cursor: pointer; }
.api-tab[aria-selected="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 14px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field-small { max-width: 220px; }
.field label { font-weight: 650; font-size: .92rem; }
.field small { color: var(--muted); font-size: .8rem; }
.req { color: var(--danger); }
input[type="text"], input[type="number"], select, textarea {
  font: inherit; color: var(--ink); background: #fff; border: 1px solid #c9ced8; border-radius: 10px; padding: 10px 12px; width: 100%;
}
textarea { resize: vertical; min-height: 160px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
button.primary, .btn { font: 700 1rem var(--font); background: var(--brand); color: #fff; border: 0; border-radius: 10px; padding: 11px 18px; cursor: pointer; }
button.primary:hover, .btn:hover { background: var(--brand-deep); }
button.primary:disabled { opacity: .6; cursor: progress; }
.btn-ghost { font: 600 .95rem var(--font); background: transparent; color: var(--brand-deep); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; cursor: pointer; }
.btn-ghost:hover { background: var(--brand-tint); }
.examples { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { font: 600 .85rem var(--font); border: 1px dashed color-mix(in srgb, var(--brand) 45%, white); background: var(--brand-tint); color: var(--brand-deep); padding: 6px 12px; border-radius: 999px; cursor: pointer; }
.chip:hover { border-style: solid; }
.status { min-height: 1.4em; color: var(--muted); font-size: .92rem; }
.results-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--line-2); padding-top: 16px; }
.cards { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 12px; }
.card { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: #fff; }
.card h4 { font-size: 1.02rem; margin: 6px 0 8px; }
.card h4 a { color: var(--ink); }
.card-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }
.rid { font-family: var(--mono); }
.flag { background: var(--line-2); color: var(--ink-2); border-radius: 6px; padding: 1px 7px; font-weight: 650; }
.flag.danger { background: var(--danger-tint); color: var(--danger); }
.card dl, .facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; font-size: .92rem; }
.card dt, .facts dt { color: var(--muted); font-weight: 600; }
.card dd, .facts dd { margin: 0; overflow-wrap: anywhere; }
.source-link { display: inline-block; margin-top: 8px; font-weight: 650; font-size: .9rem; }
.cite { margin-top: 10px; font-size: .85rem; color: var(--muted); }
.cite a { overflow-wrap: anywhere; }
.empty { background: var(--warn-tint); color: var(--warn); padding: 12px 14px; border-radius: 10px; }
.error { background: var(--danger-tint); color: var(--danger); padding: 12px 14px; border-radius: 10px; }
.site-footer { color: var(--muted); font-size: .88rem; padding: 12px 0 40px; }

@media (max-width: 640px) {
  .card dl, .facts { grid-template-columns: 1fr; gap: 0; }
  .card dd, .facts dd { margin-bottom: 6px; }
  .field-small { max-width: none; }
  .hero { padding-top: 32px; }
}

/* Assistant layout. Append to the site's stylesheet and set the colors to the site's palette. */
.assistant { margin-top: 48px; }

/* The runtime reads these variables for its chat, settings and agent panels.
   The chat background below also uses --ns-bg. White text sits on --ns-primary (the
   visitor's messages, Send, and the chat form and settings buttons) and on --ns-accent
   (Send while a turn is steered), so give both at least 4.5:1 contrast with white.
   --ns-accent also underlines the chat header. */
#agent-app {
  --ns-font: system-ui, sans-serif;
  --ns-bg: #ffffff;
  --ns-fg: #1f2328;
  --ns-primary: #2563eb;
  --ns-accent: #2563eb;
  --ns-border: #d0d7de;
  --ns-panelbg: #ffffff;
  --ns-msgbg: #f6f8fa;
  --ns-muted: #59636e;
}

.assistant-panels {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 16px;
  margin-top: 16px;
}

/* Set the height once the runtime has mounted the chat, so a failed load leaves no
   empty box. */
#agent-app.ns-composed-app [data-ns-slot="chat"] { height: 720px; }
/* The runtime gives the chat no background of its own. Keep --ns-msgbg different from
   --ns-bg, or bot replies lose their bubble. */
#agent-app .ns-chat { background: var(--ns-bg); }

/* Site-wide form rules often stretch the runtime's own controls. Undo them here. */
#agent-app input[type="checkbox"],
#agent-app input[type="radio"] { width: auto; }
#agent-app .ns-header { flex-wrap: wrap; }
/* Site label rules add margins and bold text, and the inputs inside the labels inherit
   the weight. */
#agent-app .ns-settings-body label { margin: 4px 0; font-weight: 400; }
/* Chat forms label radio groups with a legend, so site legend fonts would reach them. */
#agent-app .ns-w-label { font-family: inherit; }
/* Site label rules add margins to chat form fields and make their options bold. */
#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; }
/* The runtime sizes radio and multi-choice options but not the checkbox label. */
#agent-app .ns-w-toggle { font-size: 13px; }
/* The runtime spaces its buttons with gap. A site's button margin pushes Send below the input. */
#agent-app button { margin: 0; }
/* Chat choices are buttons with a light background. A site's button color can hide their
   titles. */
#agent-app .ns-w-choice { color: var(--ns-fg); }
/* A site's button:hover background also reaches the runtime's plain buttons, behind
   their dark text. Keep the runtime's own backgrounds. */
#agent-app .ns-devtoggle:not(.on):hover,
#agent-app .ns-modal-close:hover { background: transparent; }
#agent-app .ns-w-choice:disabled:hover { background: #fafbfc; }
/* The runtime's message rule hides the partner consent card's own background, and its
   Decline label then has too little contrast. */
#agent-app .ns-consent { background: #fffbeb; }
/* While a consent card waits, the status line above it already says "Contacting", though
   nothing has been sent. Hide it until the visitor answers. */
#agent-app .ns-msgs:has(.ns-consent-actions) > .ns-turn-status { display: none; }
/* Long links in a reply would run out of the bubble on a phone. "anywhere" would also
   let the consent card's buttons shrink and split their labels. */
#agent-app .ns-msg { overflow-wrap: break-word; }
/* On a phone the consent card is too narrow for its three buttons in one row, and
   "Always allow" breaks onto two lines. Keep each label whole and wrap the row. */
#agent-app .ns-consent-actions { flex-wrap: wrap; }
#agent-app .ns-consent-actions button { white-space: nowrap; }

/* site.js and the runtime add their confirmation dialogs to <body>, outside #agent-app.
   Site h2 rules reach the heading, and the two buttons touch. A right margin keeps
   wrapped buttons lined up on the left. */
body > dialog h2 { margin: 0 0 12px; font: 700 1.25em system-ui, sans-serif; }
body > dialog button { margin-right: 8px; }
/* site.js's dialog: the details in two columns, and a plain decline button, so the two
   choices do not look the same. */
.assistant-review { max-width: 640px; width: 85%; max-height: 85vh; overflow: auto; border: 1px solid #888; border-radius: 12px; padding: 24px; font: 16px system-ui, sans-serif; }
.assistant-review dl { display: grid; grid-template-columns: fit-content(40%) 1fr; gap: 4px 16px; margin: 12px 0; }
.assistant-review dt { font-weight: 600; }
.assistant-review dd { margin: 0; overflow-wrap: anywhere; }
.assistant-review details { margin: 12px 0; }
.assistant-review pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.assistant-review .assistant-decline { background: transparent; color: inherit; border: 1px solid currentColor; }

@media (max-width: 760px) {
  .assistant-panels { grid-template-columns: 1fr; }
  /* On a phone, each detail goes under its label, so an email is not split. */
  .assistant-review dl { grid-template-columns: 1fr; gap: 0; }
  .assistant-review dd { margin-bottom: 8px; }
}

/* Map the runtime's --ns-* variables onto the site's brand. */
#agent-app {
  --ns-font: var(--font);
  --ns-bg: #ffffff; --ns-fg: var(--ink); --ns-primary: var(--brand-deep); --ns-accent: var(--brand-deep);
  --ns-border: var(--line); --ns-panelbg: #ffffff; --ns-msgbg: #f3f4f7; --ns-muted: var(--muted);
}
#agent-app.ns-composed-app [data-ns-slot="chat"] { height: min(640px, 80vh); }
#agent-app [data-ns-slot="chat"] > * { border-radius: 12px; }

/* Recall Relay hub */
.hub-hero { padding-bottom: 40px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 32px; align-items: center; }
.hero-points { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 6px; color: var(--ink-2); }
.hero-points li::before { content: "\2713"; color: var(--brand); font-weight: 800; margin-right: 8px; }
.hero-diagram { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; position: relative; }
.node { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-weight: 750; font-size: .92rem; box-shadow: var(--shadow); }
.node small { display: block; font-weight: 500; color: var(--muted); font-size: .76rem; margin-top: 2px; }
.hub-node { grid-column: 1 / -1; text-align: center; background: var(--brand); color: #fff; border-color: var(--brand); }
.hub-node small { color: #d6efe8; }
.src-cpsc-node { border-top: 4px solid #9f1d20; }
.src-openfda-node { border-top: 4px solid #14506e; }
.src-nhtsa-node { border-top: 4px solid #1f4b99; }
.check-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 28px; }
.inventory label { display: block; color: var(--ink-2); margin-bottom: 8px; }
.inv-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 10px 0 16px; }
.inv-tools .muted { margin-right: auto; }
.receipt { border: 1px dashed var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; background: var(--canvas); }
.receipt-label { font-weight: 650; }
.pill { font-size: .72rem; font-weight: 700; background: var(--brand-tint); color: var(--brand-deep); padding: 2px 8px; border-radius: 999px; margin-left: 6px; }
.small { font-size: .85rem; margin: 6px 0 0; }
.big { width: 100%; padding: 14px 18px; font-size: 1.05rem; }
.routing-box h3 { font-size: .95rem; margin-top: 4px; }
.routing { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 6px; max-height: 260px; overflow: auto; }
.routing li { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: .9rem; }
.route-item { margin-right: auto; }
.src { font-size: .72rem; font-weight: 750; border-radius: 6px; padding: 2px 7px; color: #fff; white-space: nowrap; }
.src-cpsc { background: #9f1d20; }
.src-openfda { background: #14506e; }
.src-nhtsa { background: #1f4b99; }
.peers { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.peer { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: .88rem; background: #fff; }
.peer-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.peer-status { font-weight: 700; color: var(--muted); font-size: .8rem; }
.peer-ready .peer-status { color: var(--ok); }
.peer-error .peer-status, .peer-declined .peer-status { color: var(--danger); }
.peer-url { display: block; margin: 6px 0; font-size: .78rem; }
.peer-detail { margin: 4px 0; color: var(--ink-2); }
.peer-error { color: var(--danger); margin: 4px 0; }
.results-wrap { margin-top: 28px; border-top: 1px solid var(--line-2); padding-top: 20px; }
.results-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.results-list { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 14px; }
.result { border: 1px solid var(--line); border-left: 6px solid var(--line); border-radius: 12px; padding: 14px 16px; background: #fff; }
.result-likely { border-left-color: var(--danger); }
.result-possible { border-left-color: #c77700; }
.result-none { border-left-color: var(--ok); }
.result-unknown { border-left-color: var(--muted); }
.result-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.result-head h3 { margin: 0; }
.verdict { font-size: .8rem; font-weight: 800; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.v-likely { background: var(--danger-tint); color: var(--danger); }
.v-possible { background: var(--warn-tint); color: var(--warn); }
.v-none { background: var(--ok-tint); color: var(--ok); }
.v-unknown { background: var(--line-2); color: var(--ink-2); }
.matches { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 10px; }
.match { border-top: 1px solid var(--line-2); padding-top: 10px; }
.match-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: .78rem; color: var(--muted); }
.match-title { display: block; font-weight: 700; margin: 4px 0; color: var(--ink); }
.match-hazard, .match-remedy { margin: 2px 0; font-size: .9rem; color: var(--ink-2); }
.trace-box { margin-top: 10px; font-size: .85rem; }
.trace { font-family: var(--mono); font-size: .78rem; color: var(--ink-2); padding-left: 18px; overflow-wrap: anywhere; }
dialog.consent { border: 1px solid var(--line); border-radius: 16px; padding: 24px; max-width: 520px; width: calc(100% - 32px); box-shadow: 0 20px 60px rgba(0,0,0,.2); }
dialog.consent::backdrop { background: rgba(16, 24, 40, .45); }
dialog.consent h2 { font-size: 1.25rem; }
.consent-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; counter-reset: s; }
.steps li { background: var(--canvas); border-radius: 12px; padding: 16px; counter-increment: s; }
.steps li h3::before { content: counter(s); display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff; font-size: .85rem; margin-right: 8px; }
.steps p { margin: 0; color: var(--ink-2); font-size: .93rem; }
@media (max-width: 860px) {
  .hero-grid, .check-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .hero-diagram { grid-template-columns: 1fr; }
}
