/* Merchant API docs (resources/views/api-docs). Plain CSS; tokens follow DESIGN.md. */
:root {
    --bg: #ffffff; --surface: #f8fafc; --line: #e2e8f0; --ink: #0f172a; --body: #334155; --muted: #64748b;
    --brand: #2563eb; --brand-hover: #1d4ed8; --brand-tint: #eff6ff; --brand-line: #bfdbfe; --on-brand: #ffffff;
    --code-bg: #0f172a; --code-txt: #e2e8f0;
    --get: #047857; --get-bg: #ecfdf5; --post: #1d4ed8; --post-bg: #eff6ff; --put: #b45309; --put-bg: #fffbeb;
    --patch: #6d28d9; --patch-bg: #f5f3ff; --delete: #b91c1c; --delete-bg: #fef2f2; --hook: #475569; --hook-bg: #f1f5f9;
    --ok: #047857; --client: #b45309; --server: #b91c1c; --warn-bg: #fffbeb; --warn-txt: #92400e;
    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0b1120; --surface: #111a2e; --line: #1e293b; --ink: #f1f5f9; --body: #cbd5e1; --muted: #94a3b8;
        --brand: #60a5fa; --brand-hover: #93c5fd; --brand-tint: #172554; --brand-line: #1e3a8a; --on-brand: #0b1120;
        --code-bg: #020617; --get: #34d399; --get-bg: #052e22; --post: #93c5fd; --post-bg: #172554; --put: #fbbf24; --put-bg: #2b1d05;
        --patch: #c4b5fd; --patch-bg: #2e1065; --delete: #fca5a5; --delete-bg: #3b0a0a; --hook: #cbd5e1; --hook-bg: #1e293b;
        --ok: #34d399; --client: #fbbf24; --server: #fca5a5; --warn-bg: #2b1d05; --warn-txt: #fde68a;
        color-scheme: dark;
    }
}
:root[data-theme="dark"] {
    --bg: #0b1120; --surface: #111a2e; --line: #1e293b; --ink: #f1f5f9; --body: #cbd5e1; --muted: #94a3b8;
    --brand: #60a5fa; --brand-hover: #93c5fd; --brand-tint: #172554; --brand-line: #1e3a8a; --on-brand: #0b1120;
    --code-bg: #020617; --get: #34d399; --get-bg: #052e22; --post: #93c5fd; --post-bg: #172554; --put: #fbbf24; --put-bg: #2b1d05;
    --patch: #c4b5fd; --patch-bg: #2e1065; --delete: #fca5a5; --delete-bg: #3b0a0a; --hook: #cbd5e1; --hook-bg: #1e293b;
    --ok: #34d399; --client: #fbbf24; --server: #fca5a5; --warn-bg: #2b1d05; --warn-txt: #fde68a;
    color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--bg); color: var(--body); font: 15px/1.65 "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
h1, h2, h3 { font-family: "Plus Jakarta Sans", "Inter", sans-serif; color: var(--ink); letter-spacing: -0.01em; }
code, pre, textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
a { color: var(--brand); }
a:hover { color: var(--brand-hover); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

/* Top bar */
.docs-bar { position: sticky; top: 0; z-index: 20; height: 60px; padding: 0 20px; display: flex; align-items: center; gap: 14px; background: var(--bg); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 700 16px "Plus Jakarta Sans", sans-serif; }
.brand img { height: 28px; width: auto; }
.brand small { font: 500 13px "Inter", sans-serif; color: var(--muted); }
.spacer { flex: 1; }
.docs-bar label { font-size: 13px; color: var(--muted); }
.bar-link { font-size: 14px; color: var(--muted); text-decoration: none; }
.bar-link:hover { color: var(--ink); }
.bar-btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; font-weight: 500; color: var(--ink); text-decoration: none; }
.bar-btn:hover { border-color: var(--brand); color: var(--brand); }
.bar-btn svg { width: 16px; height: 16px; }
.download-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; margin: 6px 0 0; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--body); cursor: pointer; }
.icon-btn:hover { color: var(--ink); border-color: var(--muted); }
.icon-btn svg { width: 18px; height: 18px; }
.docs-select, input, textarea { font: inherit; font-size: 14px; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
input:focus, textarea:focus, .docs-select:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-tint); }
input, textarea, .settings-grid .docs-select { width: 100%; }
textarea { resize: vertical; font-size: 13px; line-height: 1.5; }

/* Layout */
.docs-layout { display: grid; grid-template-columns: 272px minmax(0, 1fr); max-width: 1320px; margin: 0 auto; }
.docs-side { border-right: 1px solid var(--line); }
.side-nav { position: sticky; top: 60px; max-height: calc(100vh - 60px); overflow-y: auto; padding: 18px 12px 48px; }
.side-nav summary { display: none; }
.side-nav nav { display: flex; flex-direction: column; gap: 1px; }
.nav-section { margin-top: 16px; padding: 6px 10px; font-size: 14px; font-weight: 600; color: var(--ink); text-decoration: none; border-radius: 8px; }
.nav-section:first-child { margin-top: 0; }
.nav-op { display: flex; gap: 10px; align-items: baseline; padding: 6px 10px; border-radius: 8px; font-size: 14px; color: var(--body); text-decoration: none; }
.nav-section:hover, .nav-op:hover { background: var(--surface); color: var(--ink); }
/* The section or endpoint currently on screen (api-docs.js). */
.side-nav a[aria-current="true"] { background: var(--brand-tint); color: var(--brand); }
.docs-main { padding: 40px 48px 96px; min-width: 0; max-width: 960px; }

/* Content */
h1 { font-size: 34px; line-height: 1.15; font-weight: 800; margin: 0 0 12px; }
h2 { font-size: 24px; line-height: 1.25; font-weight: 700; margin: 0 0 10px; }
h3 { font-size: 19px; line-height: 1.3; font-weight: 700; margin: 12px 0 6px; }
h4 { font-size: 15px; font-weight: 600; color: var(--ink); margin: 24px 0 8px; }
.muted { color: var(--muted); font-size: 13px; }
.prose p { margin: 0 0 10px; }
.prose ul, .prose ol { padding-left: 20px; margin: 0 0 10px; }
.prose h2, .prose h3 { font-size: 17px; margin: 20px 0 8px; }
.prose code, td code, .op-path { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; font-size: 13px; color: var(--ink); }
.prose code { overflow-wrap: anywhere; }
.prose pre { background: var(--code-bg); color: var(--code-txt); border-radius: 10px; padding: 14px 16px; overflow-x: auto; }
.prose pre code { background: none; border: 0; padding: 0; color: inherit; }
.prose table, .table-wrap table { border-collapse: collapse; width: 100%; font-size: 14px; }
/* Tables written in spec Markdown scroll on their own instead of widening the page. */
.prose table { display: block; overflow-x: auto; }
.prose th, .prose td, .table-wrap th, .table-wrap td { border-bottom: 1px solid var(--line); padding: 9px 12px; text-align: left; vertical-align: top; }
.prose th, .table-wrap th { font-weight: 600; color: var(--ink); background: var(--surface); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.table-wrap tr:last-child td { border-bottom: 0; }
.table-wrap td .prose p, td.prose p { margin: 0; }
.req { margin-left: 6px; font-size: 12px; font-weight: 500; color: var(--server); }

.intro { padding-bottom: 32px; }
.intro .lead { font-size: 17px; color: var(--body); max-width: 680px; }
.download { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 14px; font-weight: 500; }
.docs-section { padding: 40px 0; border-top: 1px solid var(--line); }
.section-lead { max-width: 720px; }

/* Try-it settings: the one brand-tinted block, because every panel below depends on it. */
.try-settings { margin-top: 28px; padding: 20px 22px; background: var(--brand-tint); border: 1px solid var(--line); border-radius: 12px; }
.try-settings h2 { font-size: 17px; margin-bottom: 4px; }
.try-settings .muted { color: var(--body); }
.settings-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 14px; margin-top: 14px; }
.settings-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink); }
.warn { margin: 14px 0 0; padding: 9px 12px; border-radius: 8px; background: var(--warn-bg); color: var(--warn-txt); font-size: 13px; font-weight: 500; }

/* Operation */
.op { margin-top: 24px; padding: 24px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.op-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.op-path { font-size: 14px; word-break: break-all; }
.method { flex-shrink: 0; min-width: 48px; text-align: center; font: 700 11px/1 ui-monospace, monospace; letter-spacing: .02em; padding: 5px 7px; border-radius: 6px; }
.method-get { color: var(--get); background: var(--get-bg); } .method-post { color: var(--post); background: var(--post-bg); }
.method-put { color: var(--put); background: var(--put-bg); } .method-patch { color: var(--patch); background: var(--patch-bg); }
.method-delete { color: var(--delete); background: var(--delete-bg); }
.method-hook { color: var(--hook); background: var(--hook-bg); }
.tag { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; }

.code-block { position: relative; margin-top: 8px; }
.code { margin: 0; background: var(--code-bg); color: var(--code-txt); border-radius: 10px; padding: 14px 16px; overflow-x: auto; font-size: 13px; line-height: 1.55; }
.copy-code { position: absolute; top: 8px; right: 8px; font: 500 12px "Inter", sans-serif; padding: 4px 9px; border-radius: 6px; border: 1px solid #334155; background: #1e293b; color: #e2e8f0; cursor: pointer; }
.copy-code:hover { background: #334155; }
.response { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-top: 8px; }
.response[open] { padding-bottom: 14px; }
.response summary { cursor: pointer; font-size: 14px; color: var(--ink); }
.status { font: 700 12px ui-monospace, monospace; margin-right: 8px; }
.status-2 { color: var(--ok); } .status-4 { color: var(--client); } .status-5 { color: var(--server); }
.note { margin-top: 18px; }

/* Try it */
.try { margin-top: 24px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.try h4 { margin-top: 0; }
.try-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.try-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; font-size: 13px; color: var(--ink); }
.try-grid .try-field { margin-bottom: 0; }
.try-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.btn { font: 600 14px "Inter", sans-serif; padding: 9px 18px; border-radius: 8px; border: 1px solid var(--brand); background: var(--brand); color: var(--on-brand); cursor: pointer; }
.btn:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn-ghost { background: transparent; color: var(--brand); border-color: var(--line); }
.btn-ghost:hover { background: var(--bg); color: var(--brand-hover); border-color: var(--brand); }
.try-status { margin: 16px 0 8px; font-size: 14px; font-weight: 600; }

/* Phone and small tablet */
@media (max-width: 900px) {
    .docs-layout { grid-template-columns: 1fr; }
    .docs-side { border-right: 0; border-bottom: 1px solid var(--line); }
    .side-nav { position: static; max-height: none; padding: 6px 16px 10px; }
    .side-nav summary { display: block; cursor: pointer; font-weight: 600; color: var(--ink); padding: 10px 0; }
    .docs-main { padding: 28px 16px 64px; }
    .settings-grid { grid-template-columns: 1fr; }
    .op { padding: 18px 16px; }
    h1 { font-size: 28px; }
    .bar-link, .brand small, .docs-bar label, .bar-btn span { display: none; }
    .bar-btn { padding: 0 9px; }
}

/* Floating try-it dock: server and key within reach while reading an endpoint. */
/* Same tint as the settings box it stands in for, so the two read as one control. */
.try-dock { position: fixed; z-index: 30; bottom: 16px; left: calc(50% + 136px); transform: translateX(-50%); width: min(760px, calc(100vw - 272px - 64px));
    display: flex; align-items: flex-end; gap: 12px; padding: 12px 14px; background: var(--brand-tint); border: 1px solid var(--brand-line); border-radius: 12px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .12); }
.try-dock[hidden] { display: none; }
.dock-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--ink); min-width: 0; }
.dock-field .docs-select { width: 200px; }
.dock-key { flex: 1; }
.dock-state { align-self: center; font-size: 12px; font-weight: 500; white-space: nowrap; color: var(--body); }
.dock-state[data-prod] { color: var(--warn-txt); background: var(--warn-bg); padding: 4px 8px; border-radius: 6px; }
/* Keep scrolled-to content and the page end clear of the dock. */
html.dock-open { scroll-padding-bottom: 120px; }
html.dock-open .docs-main { padding-bottom: 140px; }
@media (max-width: 900px) {
    .try-dock { left: 8px; right: 8px; bottom: 8px; transform: none; width: auto; flex-wrap: wrap; }
    .dock-field .docs-select { width: 100%; }
    .dock-field { flex: 1 1 140px; }
    .dock-state { flex-basis: 100%; }
}
