/* ==========================================================================
   Docsecure Knowledge Base Portal — stylesheet
   Visual language: Google Cloud docs (docs.cloud.google.com) — white
   header, Google blue accents, rounded surfaces, Roboto/Google-Sans-ish
   type. Layout: fixed top bar, left sidebar (nav tree), scrolling main
   content, right-hand "on this page" TOC (desktop only). Collapses to a
   hamburger drawer + slide-in search below 900px, and tightens further
   below 640px / 480px.
   ========================================================================== */

:root {
  --paper: #ffffff;
  --surf: #ffffff;
  --surf2: #f8f9fa;
  --surf3: #f1f3f4;
  --ink: #202124;
  --ink2: #5f6368;
  --ink3: #80868b;
  --line: #e8eaed;
  --line2: #dadce0;
  --acc: #1a73e8;
  --acc-d: #1765cc;
  --acc-tint: #e8f0fe;
  --bar: #ffffff;
  --bar-ink: #202124;
  --ok: #188038;
  --ok-tint: #e6f4ea;
  --warn: #b06000;
  --warn-tint: #fef7e0;
  --bad: #d93025;
  --bad-tint: #fce8e6;
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-pill: 999px;
  --shadow-1: 0 1px 2px 0 rgba(60,64,67,0.30), 0 1px 3px 1px rgba(60,64,67,0.15);
  --shadow-2: 0 1px 3px 0 rgba(60,64,67,0.30), 0 4px 8px 3px rgba(60,64,67,0.15);
  --sidebar-w: 280px;
  --toc-w: 240px;
  --topbar-h: 64px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: "Google Sans Text", Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--acc); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: "Roboto Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; }

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
::selection { background: var(--acc-tint); color: var(--acc-d); }

/* ---------- Top bar ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h);
  background: var(--bar); color: var(--bar-ink);
  display: flex; align-items: center; gap: 8px;
  padding: 0 16px; z-index: 100;
  border-bottom: 1px solid var(--line);
}
.topbar-chrome { display: flex; align-items: center; gap: 8px; }
.brand {
  font-weight: 500; font-size: 18px; letter-spacing: 0;
  display: flex; align-items: center; gap: 10px; cursor: pointer; white-space: nowrap;
  color: var(--ink); padding: 6px 8px; border-radius: var(--radius-sm);
}
.brand:hover { background: var(--surf3); text-decoration: none; }
.brand-badge {
  width: 28px; height: 28px; border-radius: 50%; background: var(--acc); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700;
}
.brand-logo { height: 28px; width: auto; max-width: 130px; object-fit: contain; }

.topbar-search { flex: 1; max-width: 480px; position: relative; margin-left: 8px; }
.topbar-search .search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--ink3); pointer-events: none; display: flex;
}
.topbar-search .search-icon svg { width: 100%; height: 100%; }
.topbar-search input {
  width: 100%; padding: 9px 14px 9px 38px; font-size: 14px;
  background: var(--surf3); border: 1px solid transparent; color: var(--ink);
  border-radius: var(--radius-pill); transition: background 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.topbar-search input::placeholder { color: var(--ink3); }
.topbar-search input:hover { background: #eceef0; }
.topbar-search input:focus {
  outline: none; background: var(--surf); border-color: var(--line2);
  box-shadow: var(--shadow-1);
}
.search-close { display: none; }
.search-mobile-open { display: none; }

.search-results {
  position: absolute; top: 46px; left: 0; right: 0; background: var(--surf); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius); max-height: 360px; overflow-y: auto; z-index: 200;
  box-shadow: var(--shadow-2);
}
.search-results a { display: block; padding: 10px 14px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); font-size: 13px; }
.search-results a:last-child { border-bottom: none; }
.search-results a:hover { background: var(--surf2); }
.search-results .sr-title { font-weight: 600; font-size: 13.5px; color: var(--acc-d); }
.search-results .sr-snippet { color: var(--ink2); font-size: 12.5px; margin-top: 2px; }

.topbar-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.topbar-link {
  color: var(--ink2); text-decoration: none; font-size: 13.5px; font-weight: 500;
  padding: 8px 12px; border-radius: var(--radius-sm);
}
.topbar-link:hover { background: var(--surf3); color: var(--ink); text-decoration: none; }
.icon-btn {
  background: none; border: none; color: var(--ink2); font-size: 18px; padding: 8px;
  border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
}
.icon-btn:hover { background: var(--surf3); color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; }
.only-mobile { display: none; }

#auth-actions { display: flex; gap: 8px; align-items: center; font-size: 13px; margin-left: 6px; }
#auth-actions button {
  background: var(--acc); color: #fff; border: none; padding: 8px 18px; font-weight: 500; font-size: 13.5px;
  border-radius: var(--radius-sm); transition: background 0.15s ease, box-shadow 0.15s ease;
}
#auth-actions button:hover { background: var(--acc-d); box-shadow: var(--shadow-1); }
#auth-actions .ghost-btn { background: transparent; border: 1px solid var(--line2); color: var(--acc); }
#auth-actions .ghost-btn:hover { background: var(--acc-tint); box-shadow: none; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border-radius: var(--radius-pill); }
.user-chip:hover { background: var(--surf3); }
.user-chip .who { text-align: right; line-height: 1.25; }
.user-chip .who .name { font-size: 13px; font-weight: 600; color: var(--ink); }
.user-chip .who .role { font-size: 11px; color: var(--ink3); text-transform: capitalize; }
.user-chip .avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--acc-tint); color: var(--acc-d);
  display: inline-flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 700; flex-shrink: 0;
}

/* ---------- Shell layout ---------- */
.shell { display: flex; padding-top: var(--topbar-h); min-height: 100vh; }

.sidebar {
  position: fixed; top: var(--topbar-h); bottom: 0; left: 0; width: var(--sidebar-w);
  background: var(--surf); border-right: 1px solid var(--line);
  overflow-y: auto; padding: 16px 0 40px;
  z-index: 60;
}
.sidebar-scrim { position: fixed; inset: 0; top: var(--topbar-h); background: rgba(32,33,36,0.5); z-index: 55; }
.hidden { display: none !important; }

.main {
  margin-left: var(--sidebar-w);
  margin-right: var(--toc-w);
  flex: 1;
  min-width: 0;
  padding: 32px 48px 96px;
}

.page-toc {
  position: fixed; top: var(--topbar-h); right: 0; width: var(--toc-w); bottom: 0;
  overflow-y: auto; padding: 32px 24px; font-size: 12.5px;
}
.page-toc .toc-title { font-weight: 600; color: var(--ink); text-transform: none; font-size: 12.5px; letter-spacing: 0; margin-bottom: 12px; }
.page-toc a {
  display: block; color: var(--ink2); text-decoration: none; padding: 5px 0 5px 14px;
  border-left: 2px solid var(--line); line-height: 1.4;
}
.page-toc a:hover { color: var(--ink); text-decoration: none; }
.page-toc a.active { color: var(--acc); border-left-color: var(--acc); font-weight: 500; }
.page-toc a.lvl-3 { padding-left: 26px; font-size: 12px; }

/* ---------- Nav tree ---------- */
.nav-tree { padding: 0 12px; }
.nav-loading { padding: 20px; color: var(--ink3); font-size: 13px; }
.nav-section { margin-bottom: 8px; }
.nav-section-title {
  padding: 14px 12px 6px; font-size: 12px; font-weight: 600; letter-spacing: 0.15px;
  color: var(--ink2);
}
.nav-item {
  display: block; padding: 8px 12px; font-size: 13.5px; color: var(--ink2); text-decoration: none;
  border-radius: var(--radius-pill); margin: 1px 0;
}
.nav-item:hover { background: var(--surf3); color: var(--ink); text-decoration: none; }
.nav-item.active { background: var(--acc-tint); color: var(--acc-d); font-weight: 500; }
.nav-children { margin-left: 12px; padding-left: 10px; border-left: 1px solid var(--line); }

/* ---------- Breadcrumb ---------- */
.breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; font-size: 12.5px; color: var(--ink3); margin-bottom: 14px; }
.breadcrumb a { color: var(--ink3); text-decoration: none; }
.breadcrumb a:hover { color: var(--acc); text-decoration: none; }
.breadcrumb .crumb-sep { color: var(--line2); }
.breadcrumb .crumb-current { color: var(--ink2); }

/* ---------- Markdown content ---------- */
.markdown-body h1 { font-size: 32px; font-weight: 500; margin: 0 0 8px; letter-spacing: -0.2px; color: var(--ink); }
.markdown-body h2 { font-size: 22px; font-weight: 500; margin-top: 40px; margin-bottom: 12px; color: var(--ink); }
.markdown-body h3 { font-size: 17px; font-weight: 600; margin-top: 28px; margin-bottom: 8px; color: var(--ink); }
.markdown-body p { font-size: 14.5px; color: var(--ink); }
.markdown-body ul, .markdown-body ol { font-size: 14.5px; }
.markdown-body li { margin-bottom: 4px; }
.markdown-body code { background: var(--surf2); border: 1px solid var(--line); padding: 1px 6px; font-size: 0.88em; border-radius: var(--radius-sm); color: #c5221f; }
.markdown-body pre { background: var(--surf2); padding: 16px 18px; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.markdown-body pre code { background: none; padding: 0; border: none; color: inherit; }
.markdown-body table { border-collapse: collapse; width: 100%; font-size: 13.5px; margin: 18px 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.markdown-body th, .markdown-body td { border-bottom: 1px solid var(--line); padding: 10px 14px; text-align: left; }
.markdown-body th { background: var(--surf2); font-weight: 600; color: var(--ink2); }
.markdown-body tr:last-child td { border-bottom: none; }
.markdown-body blockquote {
  border-left: 4px solid var(--acc); margin: 16px 0; padding: 10px 18px; color: var(--ink);
  background: var(--acc-tint); border-radius: 0 var(--radius) var(--radius) 0;
}
.markdown-body img, .markdown-body video { max-width: 100%; border-radius: var(--radius); }
.markdown-body .mermaid { background: var(--surf); border: 1px solid var(--line); padding: 20px; text-align: center; border-radius: var(--radius); }
.markdown-body hr { border: none; border-top: 1px solid var(--line); margin: 32px 0; }
.markdown-body a { text-decoration: underline; text-decoration-color: rgba(26,115,232,0.35); text-underline-offset: 2px; }
.markdown-body a:hover { text-decoration-color: var(--acc); }
.page-meta { color: var(--ink3); font-size: 12.5px; margin-bottom: 6px; }
.page-desc { color: var(--ink2); font-size: 15px; margin-top: -2px; }

/* ---------- Cards / generic components ---------- */
.card { background: var(--surf); border: 1px solid var(--line); padding: 20px; margin-bottom: 16px; border-radius: var(--radius); }
.card h3 { margin-top: 0; }
.btn {
  background: var(--acc); color: #fff; border: none; padding: 9px 20px; font-weight: 500; font-size: 13.5px;
  border-radius: var(--radius-sm); transition: background 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { background: var(--acc-d); box-shadow: var(--shadow-1); }
.btn.secondary { background: transparent; color: var(--acc); border: 1px solid var(--line2); }
.btn.secondary:hover { background: var(--acc-tint); box-shadow: none; }
.btn.danger { background: var(--bad); }
.btn.danger:hover { background: #b3261e; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.form-row { margin-bottom: 14px; display: flex; flex-direction: column; gap: 5px; }
.form-row label { font-size: 12.5px; font-weight: 600; color: var(--ink2); }
.form-row input, .form-row select, .form-row textarea {
  padding: 9px 12px; font-size: 13.5px; border: 1px solid var(--line2); font-family: inherit; background: var(--surf);
  border-radius: var(--radius-sm); color: var(--ink);
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  outline: none; border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-tint);
}
.badge { display: inline-block; padding: 3px 10px; font-size: 11px; font-weight: 600; border-radius: var(--radius-pill); border: none; }
.badge.pending { color: var(--warn); background: var(--warn-tint); }
.badge.approved { color: var(--ok); background: var(--ok-tint); }
.badge.rejected, .badge.suspended { color: var(--bad); background: var(--bad-tint); }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { border-bottom: 1px solid var(--line); padding: 10px 12px; text-align: left; }
.table th { color: var(--ink2); text-transform: none; font-size: 12px; font-weight: 600; }
.empty-state { color: var(--ink3); font-style: italic; padding: 24px 0; }
.alert { padding: 12px 16px; font-size: 13.5px; margin-bottom: 14px; border-radius: var(--radius); }
.alert.error { background: var(--bad-tint); color: #7a1f16; border: 1px solid #f6c3bd; }
.alert.ok { background: var(--ok-tint); color: #0d652d; border: 1px solid #b7dfc0; }
.tag-tabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.tag-tab {
  padding: 7px 16px; border: 1px solid var(--line2); background: var(--surf); font-size: 12.5px; font-weight: 500;
  cursor: pointer; border-radius: var(--radius-pill); color: var(--ink2);
}
.tag-tab:hover { background: var(--surf3); }
.tag-tab.active { background: var(--acc-tint); color: var(--acc-d); border-color: var(--acc-tint); }

/* ---------- Sandbox ---------- */
.sandbox-shell { border: 1px solid var(--line); background: var(--surf); border-radius: var(--radius); overflow: hidden; }
.sandbox-toolbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--surf2);
}
.sandbox-toolbar-group { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink2); }
.sandbox-toolbar-group label { font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--ink3); }
.api-key-input-wrap { position: relative; display: flex; align-items: center; }
.api-key-input-wrap input { font-family: monospace; font-size: 12px; padding: 6px 32px 6px 10px; width: 260px; border-radius: var(--radius-sm); }
.api-key-input-wrap .toggle-visibility { position: absolute; right: 4px; background: none; border: none; font-size: 11px; color: var(--ink3); padding: 4px 6px; }
.key-status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 4px; }
.key-status-dot.unknown { background: var(--ink3); }
.key-status-dot.ok { background: var(--ok); }
.key-status-dot.bad { background: var(--bad); }
.sandbox-env-select { font-size: 12.5px; padding: 7px 10px; min-width: 240px; border-radius: var(--radius-sm); border: 1px solid var(--line2); background: var(--surf); }

.sandbox-layout { display: grid; grid-template-columns: 280px 1fr 320px; gap: 0; min-height: 640px; }

.sandbox-catalog { border-right: 1px solid var(--line); overflow-y: auto; max-height: 80vh; background: var(--surf); }
.sandbox-catalog-search { padding: 10px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surf); z-index: 2; }
.sandbox-catalog-search input { width: 100%; font-size: 12.5px; padding: 7px 10px; border-radius: var(--radius-sm); border: 1px solid var(--line2); }
.sandbox-folder-title {
  padding: 10px 14px; font-weight: 600; font-size: 11.5px; background: var(--surf2);
  text-transform: uppercase; letter-spacing: 0.5px; color: var(--ink2);
  position: sticky; cursor: default; display: flex; align-items: center; justify-content: space-between;
}
.sandbox-folder-count { color: var(--ink3); font-weight: 400; font-size: 10.5px; }
.sandbox-req-item {
  display: flex; gap: 8px; align-items: center; padding: 9px 14px 9px 16px; font-size: 12.5px;
  cursor: pointer; border-bottom: 1px solid var(--line); border-left: 3px solid transparent;
}
.sandbox-req-item:hover { background: var(--surf2); }
.sandbox-req-item.active { background: var(--acc-tint); font-weight: 600; border-left-color: var(--acc); color: var(--acc-d); }
.sandbox-req-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sandbox-empty-catalog { padding: 30px 16px; color: var(--ink3); font-size: 12.5px; text-align: center; font-style: italic; }

.method-chip { font-size: 10px; font-weight: 700; padding: 2px 7px; min-width: 46px; text-align: center; color: #fff; border-radius: var(--radius-sm); letter-spacing: 0.3px; flex-shrink: 0; }
.method-GET { background: #188038; }
.method-POST { background: #1a73e8; }
.method-PUT { background: #b06000; }
.method-PATCH { background: #8430ce; }
.method-DELETE { background: #d93025; }

.sandbox-main { overflow-y: auto; max-height: 80vh; background: var(--surf); }
.sandbox-request-header { padding: 18px 22px 0; }
.sandbox-request-title-row { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.sandbox-request-title-row .method-chip { font-size: 11px; padding: 3px 9px; min-width: 52px; }
.sandbox-request-title-row h3 { margin: 0; font-size: 16px; font-weight: 600; }
.sandbox-request-path { font-family: monospace; font-size: 12.5px; color: var(--ink2); background: var(--surf2); padding: 8px 12px; margin: 10px 0 4px; word-break: break-all; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.sandbox-request-summary { font-size: 13px; color: var(--ink2); margin: 8px 0 0; line-height: 1.5; }
.sandbox-auth-note { font-size: 11.5px; color: var(--ink3); margin-top: 6px; display: flex; align-items: center; gap: 5px; }

.sandbox-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 22px; margin-top: 18px; }
.sandbox-tab { padding: 10px 14px; font-size: 12.5px; font-weight: 500; color: var(--ink2); cursor: pointer; border-bottom: 2px solid transparent; background: none; border-top: none; border-left: none; border-right: none; }
.sandbox-tab:hover { color: var(--ink); }
.sandbox-tab.active { color: var(--acc); border-bottom-color: var(--acc); font-weight: 600; }
.sandbox-tab-panel { padding: 20px 22px 26px; }

.doc-section { margin-bottom: 22px; }
.doc-section h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--ink3); margin: 0 0 8px; font-weight: 600; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.doc-table th, .doc-table td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc-table th { color: var(--ink3); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.3px; font-weight: 700; }
.doc-table code { font-size: 11.5px; }
.doc-required { color: var(--bad); font-weight: 700; font-size: 10px; }
.doc-optional { color: var(--ink3); font-size: 10px; }
.doc-param-in { display: inline-block; font-size: 9.5px; font-weight: 700; text-transform: uppercase; color: var(--ink3); background: var(--surf2); padding: 1px 6px; margin-left: 6px; border-radius: var(--radius-sm); }
.doc-response-block { margin-bottom: 14px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.doc-response-header { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--surf2); font-size: 12px; }
.doc-response-header .status-pill { font-size: 10.5px; padding: 2px 8px; }
.doc-example { margin: 0; padding: 12px; font-size: 11.5px; font-family: monospace; overflow-x: auto; background: var(--surf); max-height: 220px; overflow-y: auto; }

.sandbox-field-group { margin-bottom: 16px; }
.sandbox-field-group-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.sandbox-field-group-header label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: var(--ink3); }
.json-editor { width: 100%; font-family: monospace; font-size: 12.5px; padding: 10px 12px; border: 1px solid var(--line2); background: var(--surf); resize: vertical; line-height: 1.5; border-radius: var(--radius-sm); }
.json-editor:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-tint); }
.json-editor.invalid { border-color: var(--bad); background: var(--bad-tint); }
.field-hint { font-size: 11px; color: var(--ink3); margin-top: 3px; }

.sandbox-send-row { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.sandbox-send-row .btn { min-width: 100px; }

.response-panel { margin-top: 20px; }
.response-meta-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.response-meta-row .meta-item { font-size: 12px; color: var(--ink2); }
.response-tabs { display: flex; gap: 2px; margin-bottom: 0; }
.response-tab { padding: 7px 14px; font-size: 11.5px; font-weight: 600; color: var(--ink3); cursor: pointer; background: var(--surf2); border: 1px solid var(--line); border-bottom: none; border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.response-tab.active { color: var(--ink); background: var(--surf); }
.response-box { background: var(--surf2); color: var(--ink); font-family: monospace; font-size: 12.5px; padding: 16px; white-space: pre-wrap; word-break: break-word; max-height: 420px; overflow-y: auto; border: 1px solid var(--line); margin: 0; border-radius: 0 0 var(--radius-sm) var(--radius-sm); }
.response-box .hljs { background: transparent; }
.response-headers-table { width: 100%; font-size: 11.5px; font-family: monospace; border-collapse: collapse; }
.response-headers-table td { padding: 5px 8px; border-bottom: 1px solid var(--line); word-break: break-all; }
.response-headers-table td:first-child { color: var(--ink3); white-space: nowrap; width: 220px; }
.status-pill { display: inline-block; padding: 3px 10px; font-weight: 700; font-size: 12px; color: #fff; border-radius: var(--radius-sm); }
.status-2xx { background: var(--ok); }
.status-4xx { background: var(--warn); }
.status-5xx { background: var(--bad); }
.quick-save-row { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.quick-save-btn { font-size: 10.5px; padding: 5px 10px; margin: 0 6px 6px 0; }

.sandbox-vars { padding: 16px 18px; border-left: 1px solid var(--line); overflow-y: auto; max-height: 80vh; background: var(--surf); }
.sandbox-vars h4 { margin: 0 0 4px; font-size: 12.5px; font-weight: 600; }
.sandbox-vars .hint { font-size: 11px; color: var(--ink3); margin: 0 0 12px; line-height: 1.4; }
.var-row { display: flex; gap: 6px; margin-bottom: 6px; align-items: center; }
.var-row input { flex: 1; font-size: 12px; padding: 6px 8px; border-radius: var(--radius-sm); }
.var-row input.var-key { max-width: 100px; font-family: monospace; }
.var-row .var-remove { background: none; border: none; color: var(--ink3); font-size: 14px; padding: 2px 5px; }
.var-row .var-remove:hover { color: var(--bad); }
.history-list { margin-top: 8px; }
.history-item { padding: 9px 11px; border: 1px solid var(--line); margin-bottom: 6px; cursor: pointer; font-size: 11.5px; border-radius: var(--radius-sm); }
.history-item:hover { background: var(--surf2); }
.history-item .hist-top { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.history-item .hist-path { font-family: monospace; color: var(--ink2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-item .hist-time { color: var(--ink3); font-size: 10px; margin-left: auto; }
.copy-curl-btn { font-size: 11px; }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(32,33,36,0.5); display: flex; align-items: center; justify-content: center; z-index: 300; padding: 16px; }
.modal { background: var(--surf); padding: 28px; width: 420px; max-width: 92vw; max-height: 88vh; overflow-y: auto; border-radius: var(--radius-lg); box-shadow: var(--shadow-2); }
.modal h2 { margin-top: 0; font-size: 19px; font-weight: 500; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ---------- Responsive ---------- */
@media (max-width: 1150px) {
  .page-toc { display: none; }
  .main { margin-right: 0; }
  .sandbox-layout { grid-template-columns: 240px 1fr; }
  .sandbox-vars { display: none; }
}
@media (max-width: 900px) {
  .only-mobile { display: inline-flex; }
  .sidebar { transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: var(--shadow-2); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; padding: 22px 20px 60px; }
  .brand span:last-child, .topbar-search { display: none; }
  .search-mobile-open { display: inline-flex; }
  .topbar.search-open .topbar-chrome,
  .topbar.search-open .topbar-actions,
  .topbar.search-open .search-mobile-open { display: none; }
  .topbar.search-open .topbar-search {
    display: block; position: static; flex: 1; max-width: none; margin-left: 0;
  }
  .search-close { display: inline-flex; }
  .sandbox-layout { grid-template-columns: 1fr; }
  .sandbox-catalog { max-height: 220px; }
  .sandbox-toolbar { gap: 10px; }
}
@media (max-width: 640px) {
  .topbar { padding: 0 10px; gap: 4px; }
  .brand { padding: 6px; font-size: 16px; }
  .main { padding: 18px 14px 60px; }
  .markdown-body h1 { font-size: 26px; }
  .markdown-body h2 { font-size: 19px; margin-top: 30px; }
  .modal { padding: 20px; }
  .user-chip .who { display: none; }
  #auth-actions button, #auth-actions .ghost-btn { padding: 7px 12px; font-size: 12.5px; }
  .sandbox-tabs { overflow-x: auto; }
  .sandbox-request-header, .sandbox-tab-panel { padding-left: 16px; padding-right: 16px; }
}
