/* ==========================================================================
   SendBridge MCP documentation
   Tokens follow the SendBridge app (v5): Inter, accent #1f5eff, 8-10 px radius.
   Light by default, dark when the system asks for it or the reader picks it
   (html[data-theme] is set by theme.js from localStorage).
   ========================================================================== */

:root {
  --bg: #f3f6fb;
  --surface: #ffffff;
  --subtle: #f5f7fb;
  --border: #dce3ee;
  --border-2: #e8edf5;
  --text: #0b1b3f;
  --text-2: #52617f;
  --text-3: #8593ad;
  --accent: #1f5eff;
  --accent-hover: #1a4fd6;
  --accent-subtle: #e8efff;
  --accent-text: #1a4fd6;
  --on-accent: #ffffff;
  --success-text: #0b7a44;
  --success-subtle: #e7f6ee;
  --warning-text: #8a5a00;
  --warning-subtle: #fdf4e2;
  --danger-text: #b3261e;
  --danger-subtle: #fcebea;
  --code-bg: #0d1528;
  --code-head: #16203a;
  --code-text: #e6ecf7;
  --code-muted: #8a99b8;
  --shadow: 0 1px 2px rgba(11, 27, 63, .06);
  --focus: 0 0 0 3px rgba(31, 94, 255, .25);
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 10px;
  --top-h: 60px;
  --side-w: 272px;
  --logo-filter: none;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a1020;
    --surface: #111a2e;
    --subtle: #16203a;
    --border: #23304d;
    --border-2: #1c2742;
    --text: #e6ecf7;
    --text-2: #a3b0c9;
    --text-3: #6f7e9c;
    --accent: #4c7dff;
    --accent-hover: #6a93ff;
    --accent-subtle: #1a2a55;
    --accent-text: #8fb0ff;
    --on-accent: #ffffff;
    --success-text: #5cd192;
    --success-subtle: #12301f;
    --warning-text: #f5c563;
    --warning-subtle: #33270e;
    --danger-text: #ff8f86;
    --danger-subtle: #3a1614;
    --code-bg: #0b1222;
    --code-head: #131c33;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --focus: 0 0 0 3px rgba(76, 125, 255, .35);
    --logo-filter: invert(1) hue-rotate(180deg) brightness(1.1);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0a1020;
  --surface: #111a2e;
  --subtle: #16203a;
  --border: #23304d;
  --border-2: #1c2742;
  --text: #e6ecf7;
  --text-2: #a3b0c9;
  --text-3: #6f7e9c;
  --accent: #4c7dff;
  --accent-hover: #6a93ff;
  --accent-subtle: #1a2a55;
  --accent-text: #8fb0ff;
  --on-accent: #ffffff;
  --success-text: #5cd192;
  --success-subtle: #12301f;
  --warning-text: #f5c563;
  --warning-subtle: #33270e;
  --danger-text: #ff8f86;
  --danger-subtle: #3a1614;
  --code-bg: #0b1222;
  --code-head: #131c33;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --focus: 0 0 0 3px rgba(76, 125, 255, .35);
  --logo-filter: invert(1) hue-rotate(180deg) brightness(1.1);
  color-scheme: dark;
}

/* ---- Base ------------------------------------------------------------------ */

*, *::before, *::after { box-sizing: border-box; }

html { scroll-padding-top: calc(var(--top-h) + 16px); -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.65 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, summary:focus-visible, pre:focus-visible {
  outline: none; box-shadow: var(--focus); border-radius: var(--r-sm);
}

code, pre, kbd { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
code { font-size: .875em; background: var(--subtle); border: 1px solid var(--border-2); border-radius: 5px; padding: .08em .36em; overflow-wrap: anywhere; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--on-accent); padding: 8px 12px; border-radius: var(--r-md); z-index: 100; }
.skip:focus { left: 8px; }

.i { flex: none; vertical-align: -3px; }
.muted { color: var(--text-2); }

/* ---- Top bar ---------------------------------------------------------------- */

.top {
  position: sticky; top: 0; z-index: 40;
  height: var(--top-h);
  display: flex; align-items: center; gap: 20px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; line-height: 0; }
.brand img { height: 17px; width: auto; filter: var(--logo-filter); }
.brand-tag {
  font-size: 11px; font-weight: 600; letter-spacing: .06em; line-height: 1;
  color: var(--accent-text); background: var(--accent-subtle);
  padding: 5px 7px; border-radius: 5px;
}
.brand:hover { text-decoration: none; }
.top-nav { display: flex; gap: 4px; margin-left: 12px; }
.top-nav a { color: var(--text-2); font-size: 14px; font-weight: 500; padding: 7px 11px; border-radius: var(--r-md); }
.top-nav a:hover { color: var(--text); background: var(--subtle); text-decoration: none; }
.top-nav a[aria-current="page"] { color: var(--accent-text); background: var(--accent-subtle); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0;
  background: transparent; color: var(--text-2);
  border: 1px solid transparent; border-radius: var(--r-md); cursor: pointer;
}
.icon-btn:hover { background: var(--subtle); color: var(--text); }
.menu-btn { display: none; }
[data-theme-toggle] .i:last-child { display: none; }
:root[data-theme="dark"] [data-theme-toggle] .i:first-child { display: none; }
:root[data-theme="dark"] [data-theme-toggle] .i:last-child { display: inline; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) [data-theme-toggle] .i:first-child { display: none; }
  :root:not([data-theme="light"]) [data-theme-toggle] .i:last-child { display: inline; }
}

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font: 500 14px/1 "Inter", system-ui, sans-serif;
  padding: 10px 14px; border-radius: var(--r-md);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--subtle); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

/* ---- Shell ------------------------------------------------------------------- */

.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); align-items: start; }

.side {
  position: sticky; top: var(--top-h);
  height: calc(100vh - var(--top-h));
  overflow-y: auto; overscroll-behavior: contain;
  padding: 20px 12px 40px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  font-size: 14px;
}
.side-group { margin-bottom: 14px; }
.side-title {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-3); padding: 6px 10px;
}
details.side-group > summary { cursor: pointer; list-style: none; border-radius: var(--r-md); }
details.side-group > summary::-webkit-details-marker { display: none; }
details.side-group > summary:hover { color: var(--text-2); background: var(--subtle); }
.side-title .count { font-weight: 500; letter-spacing: 0; color: var(--text-3); background: var(--subtle); border-radius: 20px; padding: 0 7px; font-size: 11px; line-height: 18px; }
.side a { display: block; color: var(--text-2); padding: 6px 10px; border-radius: var(--r-md); line-height: 1.35; }
.side a:hover { color: var(--text); background: var(--subtle); text-decoration: none; }
.side a[aria-current="page"] { color: var(--accent-text); background: var(--accent-subtle); }
.side a code { background: none; border: 0; padding: 0; font-size: 12.5px; color: inherit; }
.side a.tool { padding-left: 18px; }
.scrim { display: none; }

main { min-width: 0; padding: 36px 40px 0; }
.doc { max-width: 840px; margin: 0 auto; }

/* ---- Typography ---------------------------------------------------------------- */

.doc h1 { font-size: 32px; line-height: 1.2; font-weight: 700; letter-spacing: -.02em; margin: 0 0 12px; }
.doc h1 code { font-size: .88em; padding: .06em .32em; }
.doc h2 { font-size: 21px; line-height: 1.3; font-weight: 600; letter-spacing: -.01em; margin: 44px 0 12px; padding-top: 4px; }
.doc h2 a { color: inherit; }
.doc h3 { font-size: 16px; font-weight: 600; margin: 28px 0 8px; }
.doc p { margin: 0 0 14px; }
.doc ul, .doc ol { margin: 0 0 14px; padding-left: 22px; }
.doc li { margin-bottom: 6px; }
.lead { font-size: 18px; line-height: 1.6; color: var(--text-2); margin-bottom: 20px !important; }
.eyebrow { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: var(--accent-text); margin: 0 0 8px !important; }
.eyebrow a { color: inherit; }

.crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; color: var(--text-3); margin-bottom: 18px; }
.crumbs a { color: var(--text-2); }
.crumbs .sep { color: var(--text-3); }

/* ---- Hero, endpoint -------------------------------------------------------------- */

.hero { padding: 4px 0 8px; }
.hero h1 { font-size: 40px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 0 !important; }

.endpoint {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 10px 10px 10px 16px; box-shadow: var(--shadow); margin: 6px 0 16px;
}
.endpoint-label { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); }
.endpoint code { flex: 1 1 240px; background: none; border: 0; padding: 0; font-size: 15px; color: var(--text); }

.copy {
  font: 500 12px/1 "Inter", system-ui, sans-serif;
  padding: 7px 10px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--subtle); color: var(--text-2); cursor: pointer;
}
.copy:hover { color: var(--text); border-color: var(--text-3); }
.copy.done { color: var(--success-text); border-color: var(--success-text); }

.jump { font-size: 14px; color: var(--text-2); display: flex; flex-wrap: wrap; gap: 6px 14px; }

/* ---- Cards ------------------------------------------------------------------------ */

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin: 16px 0 8px; }
.card {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 18px; box-shadow: var(--shadow); color: var(--text);
}
a.card:hover { border-color: var(--accent); text-decoration: none; }
.card strong { font-size: 16px; font-weight: 600; }
.card span { font-size: 14px; line-height: 1.5; color: var(--text-2); }
.card em { margin-top: auto; padding-top: 8px; font-style: normal; font-size: 13px; font-weight: 500; color: var(--accent-text); display: flex; align-items: center; gap: 6px; }
.product-icon { width: 36px; height: 36px; border-radius: var(--r-md); background: var(--accent-subtle); color: var(--accent-text) !important; display: flex !important; align-items: center; justify-content: center; margin-bottom: 4px; }

.link-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; margin: 14px 0; }
.link-card { display: flex; flex-direction: column; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 14px 16px; }
.link-card:hover { border-color: var(--accent); text-decoration: none; }
.link-card strong { font-size: 14.5px; font-weight: 600; color: var(--accent-text); display: flex; align-items: center; gap: 6px; }
.link-card span { font-size: 13.5px; line-height: 1.45; color: var(--text-2); }

/* ---- Lists -------------------------------------------------------------------------- */

.ask { list-style: none; padding: 0 !important; display: grid; gap: 10px; }
.ask li, .prompts li {
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: var(--r-md); padding: 12px 16px; margin: 0; box-shadow: var(--shadow);
}
.ask li span { display: block; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); margin-bottom: 2px; }
.prompts { list-style: none; padding: 0 !important; display: grid; gap: 8px; }
.prompts li::before { content: "\201C"; color: var(--text-3); }
.prompts li::after { content: "\201D"; color: var(--text-3); }

.steps { counter-reset: step; list-style: none; padding: 0 !important; display: grid; gap: 12px; }
.steps li { counter-increment: step; position: relative; padding-left: 44px; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent-subtle); color: var(--accent-text);
  font-weight: 600; font-size: 14px; display: flex; align-items: center; justify-content: center;
}

/* ---- Badges, notes -------------------------------------------------------------------- */

.badges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px !important; }
.badge { display: inline-flex; align-items: center; font-size: 12.5px; font-weight: 500; line-height: 1; padding: 6px 9px; border-radius: 20px; white-space: nowrap; border: 1px solid transparent; }
.badge.sm { font-size: 11px; padding: 3px 7px; vertical-align: 1px; }
.b-read { background: var(--success-subtle); color: var(--success-text); }
.b-action { background: var(--accent-subtle); color: var(--accent-text); }
.b-danger { background: var(--danger-subtle); color: var(--danger-text); }
.b-free { background: var(--subtle); color: var(--text-2); border-color: var(--border); }
.b-cost { background: var(--warning-subtle); color: var(--warning-text); white-space: normal; line-height: 1.3; }
.b-scope { background: var(--subtle); color: var(--text-2); border-color: var(--border); }
.b-confirm { background: var(--warning-subtle); color: var(--warning-text); }

.note { background: var(--accent-subtle); border: 1px solid transparent; border-radius: var(--r-lg); padding: 14px 16px; margin: 14px 0; font-size: 15px; }
.note-confirm { background: var(--warning-subtle); }

blockquote.llm { margin: 0 0 14px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); font-size: 14.5px; color: var(--text-2); }

/* ---- Tables ---------------------------------------------------------------------------- */

.table-wrap { overflow-x: auto; margin: 12px 0 16px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th, td { text-align: left; vertical-align: top; padding: 10px 14px; border-bottom: 1px solid var(--border-2); }
thead th { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); background: var(--subtle); border-bottom-color: var(--border); white-space: nowrap; }
tbody tr:last-child > * { border-bottom: 0; }
tbody th { font-weight: 600; white-space: nowrap; width: 1%; color: var(--text-2); }
.fields .f-name { white-space: nowrap; }
.fields .f-name code, .tools td code { background: none; border: 0; padding: 0; font-size: 13.5px; }
.fields .f-name.d1 { padding-left: 26px; }
.fields .f-name.d2 { padding-left: 38px; }
.fields .f-name.d3 { padding-left: 50px; }
.fields .f-type { white-space: nowrap; color: var(--text-2); font-size: 13.5px; }
.fields .f-req { white-space: nowrap; }
.req { color: var(--danger-text); font-size: 13px; font-weight: 500; }
.opt { color: var(--text-3); font-size: 13px; }
.enum { color: var(--text-2); }
.tool-link code { color: var(--accent-text); font-weight: 500; }
.tools td:first-child { white-space: nowrap; }

/* ---- Code ------------------------------------------------------------------------------- */

.code { margin: 12px 0 18px; border-radius: var(--r-lg); overflow: hidden; background: var(--code-bg); border: 1px solid var(--border); }
.code-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 8px 7px 14px; background: var(--code-head); color: var(--code-muted); font-size: 12px; font-weight: 500; }
.code-head .copy { background: transparent; border-color: #2c3b5e; color: var(--code-muted); }
.code-head .copy:hover { color: #fff; border-color: #50608a; }
.code-head .copy.done { color: #5cd192; border-color: #5cd192; }
.code pre { margin: 0; padding: 14px 16px; overflow-x: auto; max-height: 520px; font-size: 13px; line-height: 1.6; color: var(--code-text); tab-size: 2; }
.code pre code { background: none; border: 0; padding: 0; font-size: inherit; color: inherit; overflow-wrap: normal; }
.code .k { color: #8fb0ff; }
.code .s { color: #9fe0b5; }
.code .n { color: #f5c563; }
.code .b { color: #f0a0c0; }

/* ---- Pager, footer ------------------------------------------------------------------------ */

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 56px 0 0; }
.pager a { display: flex; flex-direction: column; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 12px 16px; color: var(--text); min-width: 0; }
.pager a:hover { border-color: var(--accent); text-decoration: none; }
.pager span { font-size: 12px; color: var(--text-3); }
.pager strong { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pager .next { text-align: right; grid-column: 2; }

.foot { max-width: 840px; margin: 40px auto 0; padding: 20px 0 32px; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 13px; color: var(--text-3); }
.foot a { color: var(--text-2); }
.foot span { margin-right: auto; }

/* ---- Small screens --------------------------------------------------------------------------- */

@media (max-width: 960px) {
  .shell { display: block; }
  .menu-btn { display: inline-flex; margin-left: -8px; }
  .top { gap: 10px; padding: 0 14px; }
  .top-nav { display: none; }
  .side {
    position: fixed; top: var(--top-h); left: 0; bottom: 0; z-index: 50;
    width: min(86vw, 320px); height: auto;
    transform: translateX(-102%); transition: transform .18s ease;
    box-shadow: 0 8px 24px rgba(11, 27, 63, .18);
  }
  body.menu-open .side { transform: none; }
  body.menu-open .scrim { display: block; position: fixed; inset: var(--top-h) 0 0 0; background: rgba(11, 27, 63, .4); z-index: 45; }
  main { padding: 24px 18px 0; }
  .doc h1 { font-size: 27px; }
  .hero h1 { font-size: 30px; }
  .lead { font-size: 17px; }
  .nowrap-md { white-space: normal; }
  .tools td:first-child, .fields .f-name { white-space: normal; }
}
/* Narrow screens: tables turn into stacked rows, so long field names never squeeze the text. */
@media (max-width: 700px) {
  table.fields thead, table.tools thead { display: none; }
  table.fields, table.fields tbody, table.fields tr,
  table.tools, table.tools tbody, table.tools tr { display: block; }
  table.fields tr, table.tools tr { padding: 11px 14px; border-bottom: 1px solid var(--border-2); }
  table.fields tbody tr:last-child, table.tools tbody tr:last-child { border-bottom: 0; }
  table.fields tr > *, table.tools tr > * { display: block; padding: 0; border: 0; width: auto; white-space: normal; }
  table.fields tr > * + *, table.tools tr > * + * { margin-top: 4px; }
  table.fields .f-name, table.fields .f-type, table.fields .f-req { display: inline-block; margin: 0 10px 0 0; padding: 0; vertical-align: baseline; }
  table.fields .f-name.d1, table.fields .f-name.d2, table.fields .f-name.d3 { padding-left: 0; }
  table.fields .f-name code { font-weight: 500; color: var(--text); overflow-wrap: anywhere; }
  table.tools td:last-child { font-size: 13.5px; color: var(--text-2); }
  table.tools td:first-child { white-space: normal; }
}
@media (max-width: 520px) {
  .top-right .btn { display: none; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { grid-column: 1; text-align: left; }
  th, td { padding: 9px 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .side { transition: none; }
}
@media print {
  .top, .side, .pager, .foot, .copy { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
}
