/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Ensure the `hidden` attribute always wins over component display rules
   (e.g. #drop-zone { display: flex }), regardless of selector specificity. */
[hidden] { display: none !important; }

:root {
  --color-bg:         #f0f2f5;
  --color-surface:    #ffffff;
  --color-header:     #1a2744;
  --color-header-txt: #e8ecf4;
  --color-sidebar:    #ffffff;
  --color-sidebar-hover: #eef2ff;
  --color-sidebar-active: #dce6ff;
  --color-border:     #d4d8e1;
  --color-text:       #1f2937;
  --color-text-muted: #6b7280;
  --color-accent:     #3b5bdb;
  --color-code-bg:    #f3f4f6;
  --color-table-head: #f8f9fa;
  --radius-sm:        4px;
  --radius-md:        6px;
  --sidebar-width:    280px;
  --header-height:    56px;
  --font-mono:        'JetBrains Mono', 'Fira Code', Consolas, monospace;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans TC', sans-serif;
  font-size: 14px;
  color: var(--color-text);
  background: var(--color-bg);
  overflow: hidden;
  height: 100vh;
}

/* ============================================================
   Header
   ============================================================ */
#app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-height);
  background: var(--color-header);
  color: var(--color-header-txt);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

#header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

#app-logo { font-size: 22px; flex-shrink: 0; }

#header-doc-info {
  display: flex;
  align-items: baseline;
  gap: 8px;
  overflow: hidden;
}

#doc-title {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#doc-version {
  font-size: 12px;
  color: #9fb3d8;
  white-space: nowrap;
  background: rgba(255,255,255,.12);
  padding: 1px 7px;
  border-radius: 10px;
}

#header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

#search-input {
  width: 320px;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(255,255,255,.12);
  color: #fff;
  font-size: 13px;
  outline: none;
  transition: background .2s, border-color .2s;
}
#search-input::placeholder { color: rgba(255,255,255,.5); }
#search-input:focus {
  background: rgba(255,255,255,.2);
  border-color: rgba(255,255,255,.4);
}

#btn-reload {
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,.3);
  background: transparent;
  color: #d0d8ec;
  font-size: 12px;
  cursor: pointer;
  transition: background .15s;
}
#btn-reload:hover { background: rgba(255,255,255,.15); }

/* ============================================================
   Error banners
   ============================================================ */
.error-banner {
  margin: 70px 16px 0;
  padding: 14px 18px;
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-left: 4px solid #e67700;
  border-radius: var(--radius-md);
  color: #7c4a00;
  font-size: 14px;
  line-height: 1.5;
}

/* ============================================================
   Drop zone
   ============================================================ */
#drop-zone {
  position: fixed;
  top: var(--header-height);
  left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  z-index: 50;
}

#drop-zone-inner {
  text-align: center;
  max-width: 480px;
  padding: 48px 40px;
  background: var(--color-surface);
  border: 2px dashed var(--color-border);
  border-radius: 12px;
  transition: border-color .2s, background .2s;
}

#drop-zone.drag-over #drop-zone-inner {
  border-color: var(--color-accent);
  background: #eef3ff;
}

#drop-icon { font-size: 52px; margin-bottom: 16px; }

#drop-zone-inner h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--color-text);
}

#drop-zone-inner p {
  color: var(--color-text-muted);
  margin-bottom: 20px;
}

.btn-file-select {
  display: inline-block;
  padding: 10px 24px;
  background: var(--color-accent);
  color: #fff;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: opacity .15s;
  margin-bottom: 16px;
}
.btn-file-select:hover { opacity: .88; }

#file-input { display: none; }

.hint {
  font-size: 12px;
  color: #9ca3af;
  margin-top: 8px !important;
  margin-bottom: 0 !important;
}

/* ============================================================
   Main layout: sidebar + content
   ============================================================ */
#main-layout {
  position: fixed;
  top: var(--header-height);
  left: 0; right: 0; bottom: 0;
  display: flex;
}

/* Sidebar */
#sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--color-sidebar);
  border-right: 1px solid var(--color-border);
  overflow-y: auto;
  overflow-x: hidden;
}

#sidebar-inner { padding: 0 0 16px; }

#sidebar-header,
.sidebar-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 4px;
}

.sidebar-section-header { margin-bottom: 0; }

#btn-add-files {
  width: 22px;
  height: 22px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-accent);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}
#btn-add-files:hover { background: var(--color-sidebar-hover); }

#sidebar-file-list { padding: 4px 8px 8px; border-bottom: 1px solid var(--color-border); }

.sidebar-file-item {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 5px 4px 5px 8px;
  border-left: 3px solid transparent;
  cursor: pointer;
}
.sidebar-file-item:hover { background: var(--color-sidebar-hover); }
.sidebar-file-item.active { background: var(--color-sidebar-active); border-left-color: var(--color-accent); }
.sidebar-file-name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-text);
}
.sidebar-file-item.dirty .sidebar-file-name::after { content: ' ●'; color: #d97706; }
.sidebar-edit-file {
  width: 25px;
  height: 24px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-accent);
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
}
.sidebar-edit-file:hover { background: rgba(59,91,219,.12); }

#btn-home {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  transition: background .15s;
}
#btn-home:hover { background: var(--color-sidebar-hover); }

/* Sidebar: Module */
.sidebar-module { margin-bottom: 2px; }

.sidebar-module-title {
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--color-header);
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 6px;
  border-left: 3px solid transparent;
  transition: background .15s;
}
.sidebar-module-title:hover { background: var(--color-sidebar-hover); }
.sidebar-module-title::before { content: '▾'; font-size: 11px; }
.sidebar-module-title.collapsed::before { content: '▸'; }

.sidebar-module-body.collapsed { display: none; }

/* Sidebar: Category */
.sidebar-category { margin: 1px 0; }

.sidebar-category-title {
  padding: 5px 14px 5px 24px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  transition: background .15s;
}
.sidebar-category-title:hover { background: var(--color-sidebar-hover); }
.sidebar-category-title::before { content: '▾'; font-size: 10px; color: var(--color-text-muted); }
.sidebar-category-title.collapsed::before { content: '▸'; }

.sidebar-category-body.collapsed { display: none; }

/* Sidebar: Endpoint */
.sidebar-endpoint {
  padding: 5px 12px 5px 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  border-left: 3px solid transparent;
  transition: background .15s;
}
.sidebar-endpoint:hover { background: var(--color-sidebar-hover); }
.sidebar-endpoint.active {
  background: var(--color-sidebar-active);
  border-left-color: var(--color-accent);
}
.sidebar-endpoint.filtered-out { display: none; }

.ep-path-sidebar {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Content area */
#content-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  min-width: 0;
}

/* ============================================================
   Method badges
   ============================================================ */
.method-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  flex-shrink: 0;
  letter-spacing: .03em;
}
.method-badge.lg {
  font-size: 13px;
  padding: 4px 10px;
}
.method-get    { background: #dbeafe; color: #1d4ed8; }
.method-post   { background: #dcfce7; color: #166534; }
.method-put    { background: #fef9c3; color: #854d0e; }
.method-patch  { background: #fff7ed; color: #9a3412; }
.method-delete { background: #fee2e2; color: #991b1b; }
.method-head   { background: #f3e8ff; color: #6b21a8; }
.method-options{ background: #e0f2fe; color: #0c4a6e; }

/* Category role badges */
.role-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  flex-shrink: 0;
}
.role-gateway  { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.role-abstract { background: #e0e7ff; color: #3730a3; border: 1px solid #c7d2fe; }

/* ============================================================
   Doc info page
   ============================================================ */
.doc-home-page { max-width: 100%; }

.doc-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin-bottom: 20px;
}

.doc-section h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-header);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border);
}

.tag-item { margin-bottom: 12px; }
.tag-item strong { font-size: 14px; color: var(--color-text); }

/* ============================================================
   Endpoint detail page
   ============================================================ */
.endpoint-page { max-width: 100%; }

.endpoint-hero {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.ep-path-hero {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text);
  word-break: break-all;
}

.op-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.operation-id-badge {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-text-muted);
  background: var(--color-code-bg);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.tag-chip {
  display: inline-block;
  padding: 2px 8px;
  background: #eef2ff;
  color: #3730a3;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}

.op-summary {
  font-size: 16px;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 12px;
}

/* Section blocks */
.ep-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  margin-bottom: 18px;
}

.ep-section h3 {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--color-header);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border);
}

.ep-section h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  margin: 14px 0 8px;
}

.ep-section h5 {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
  margin: 10px 0 6px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.required-badge {
  font-size: 11px;
  color: #dc2626;
  background: #fee2e2;
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 4px;
}

/* Response blocks */
.response-block {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 12px;
}

.response-block h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px !important;
  font-size: 14px !important;
  border: none !important;
  padding: 0 !important;
}

.status-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
}
.status-2xx { background: #dcfce7; color: #166534; }
.status-3xx { background: #dbeafe; color: #1e40af; }
.status-4xx { background: #fee2e2; color: #991b1b; }
.status-5xx { background: #fef3c7; color: #92400e; }

/* ============================================================
   Tables
   ============================================================ */
.params-table,
.schema-table,
.info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 8px 0;
}

.params-table th,
.schema-table th,
.info-table th {
  background: var(--color-table-head);
  padding: 8px 10px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  white-space: nowrap;
}

.params-table td,
.schema-table td,
.info-table td {
  padding: 7px 10px;
  border: 1px solid var(--color-border);
  vertical-align: top;
  line-height: 1.5;
}

.params-table tr:nth-child(even) td,
.schema-table tr:nth-child(even) td { background: #fafafa; }

td.req  { color: #dc2626; font-weight: 600; white-space: nowrap; }
td.opt  { color: var(--color-text-muted); white-space: nowrap; }

.addl-props {
  font-style: italic;
  color: var(--color-text-muted);
  font-size: 12px;
}

.ref-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #6d28d9;
  background: #f5f3ff;
  padding: 1px 5px;
  border-radius: var(--radius-sm);
}

/* ============================================================
   Schema expand/collapse (details/summary)
   ============================================================ */
.nested-schema {
  margin-top: 8px;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.nested-schema summary {
  padding: 7px 12px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-accent);
  background: var(--color-code-bg);
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.nested-schema summary::before { content: '▸ 展開 '; }
.nested-schema[open] summary::before { content: '▾ 收合 '; }
.nested-schema summary::-webkit-details-marker { display: none; }

.nested-schema-body {
  padding: 10px 12px;
  background: var(--color-surface);
}

.combinator-block {
  padding: 8px;
  border: 1px dashed #d1d5db;
  border-radius: var(--radius-md);
  margin: 6px 0;
}
.combinator-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 6px;
}

.combinator-option {
  margin-bottom: 8px;
  padding: 8px;
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-sm);
}
.combinator-option strong { font-size: 12px; color: var(--color-text-muted); display: block; margin-bottom: 4px; }

.array-items-wrap {
  margin: 6px 0;
  padding: 8px 10px;
  background: #f8f9fa;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--color-border);
}
.array-items-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}

/* ============================================================
   Code blocks & Examples
   ============================================================ */
.example-block,
.named-example {
  background: #1e1e2e;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: 8px 0;
}

.example-block .ex-label,
.named-example .ex-label {
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  color: #9aa0c0;
  background: #2a2a3e;
  border-bottom: 1px solid #3a3a50;
  display: flex;
  align-items: center;
  gap: 6px;
}

.named-example .ex-summary {
  font-size: 11px;
  font-style: italic;
  color: #7a7f9a;
  margin-left: 4px;
}

.example-block pre,
.named-example pre {
  margin: 0;
  padding: 12px 14px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  color: #cdd6f4;
  line-height: 1.5;
  white-space: pre;
}

/* Inline code */
code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--color-code-bg);
  padding: 1px 5px;
  border-radius: 3px;
  color: #be185d;
  word-break: break-all;
}

.example-block pre code,
.named-example pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: inherit;
  word-break: normal;
}

/* Ref / error inline */
.circular-ref {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #d97706;
  background: #fef3c7;
  padding: 1px 6px;
  border-radius: 3px;
}

.error-ref {
  color: #dc2626;
  font-size: 12px;
}

/* No schema text */
.no-schema { font-style: italic; color: var(--color-text-muted); font-size: 13px; }

/* ============================================================
   Markdown body
   ============================================================ */
.markdown-body {
  font-size: 13px;
  line-height: 1.7;
  color: var(--color-text);
}
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4 {
  font-weight: 700;
  margin: 14px 0 6px;
  color: var(--color-header);
}
.markdown-body h1 { font-size: 17px; }
.markdown-body h2 { font-size: 15px; }
.markdown-body h3 { font-size: 14px; }
.markdown-body p  { margin: 6px 0; }
.markdown-body ul, .markdown-body ol { margin: 6px 0 6px 18px; }
.markdown-body li { margin: 3px 0; }
.markdown-body strong { font-weight: 700; }
.markdown-body em    { font-style: italic; }
.markdown-body code  { background: var(--color-code-bg); }
.markdown-body blockquote {
  border-left: 3px solid var(--color-accent);
  padding: 4px 10px;
  color: var(--color-text-muted);
  margin: 8px 0;
  background: #f8f9fa;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.markdown-body table {
  border-collapse: collapse;
  width: 100%;
  margin: 10px 0;
  font-size: 12px;
}
.markdown-body th, .markdown-body td {
  border: 1px solid var(--color-border);
  padding: 6px 10px;
  text-align: left;
}
.markdown-body th { background: var(--color-table-head); font-weight: 700; }
.markdown-body tr:nth-child(even) td { background: #fafafa; }
.markdown-body pre {
  background: #1e1e2e;
  color: #cdd6f4;
  padding: 12px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-size: 12px;
}
.markdown-body pre code { background: transparent; color: inherit; }

/* ============================================================
   Search highlight
   ============================================================ */
.search-highlight { background: #fef08a; color: #78350f; border-radius: 2px; }

/* ============================================================
   Scrollbar styling (WebKit)
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* ============================================================
   Utility
   ============================================================ */
.text-muted { color: var(--color-text-muted); }
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }

/* ============================================================
   Toolbar buttons (edit mode / export / sidebar toggle)
   ============================================================ */
#btn-export {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,.3);
  background: transparent;
  color: #d0d8ec;
  font-size: 12px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
}
#btn-export:hover { background: rgba(255,255,255,.15); }

#link-storage-portal {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,.3);
  background: transparent;
  color: #d0d8ec;
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
}
#link-storage-portal:hover { background: rgba(255,255,255,.15); }

#btn-sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  color: var(--color-header-txt);
  font-size: 18px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
#btn-sidebar-toggle:hover { background: rgba(255,255,255,.12); }

#sidebar-backdrop {
  display: none;
  position: fixed;
  top: var(--header-height);
  left: 0; right: 0; bottom: 0;
  background: rgba(15,23,42,.45);
  z-index: 80;
}
#sidebar-backdrop.visible { display: block; }

/* Endpoint navigation is disabled while the raw YAML editor is open. */
#sidebar.nav-disabled #sidebar-tree {
  pointer-events: none;
  opacity: .5;
}

/* ============================================================
   Raw YAML editor (edit mode)
   ============================================================ */
.yaml-editor-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 1100px;
}

.yaml-editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.yaml-status {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  background: var(--color-code-bg);
  color: var(--color-text-muted);
}
.yaml-status.status-ok    { background: #dcfce7; color: #166534; }
.yaml-status.status-dirty { background: #fef3c7; color: #92400e; }
.yaml-status.status-error { background: #fee2e2; color: #991b1b; }

.yaml-editor-actions { display: flex; gap: 8px; }

.yaml-editor-actions button {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.yaml-editor-actions button:hover { background: var(--color-sidebar-hover); }
#btn-yaml-apply {
  background: var(--color-accent) !important;
  border-color: var(--color-accent) !important;
  color: #fff !important;
}
#btn-yaml-apply:hover { opacity: .9; }

#yaml-editor {
  flex: 1;
  min-height: 420px;
  width: 100%;
  padding: 16px 18px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: #1e1e2e;
  color: #cdd6f4;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  tab-size: 2;
}
#yaml-editor:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px rgba(59,91,219,.25);
}

/* ============================================================
   Table horizontal scroll (mobile-friendly)
   ============================================================ */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-scroll table { min-width: 480px; }

/* ============================================================
   Responsive layout
   ============================================================ */
@media (max-width: 860px) {
  #btn-sidebar-toggle { display: flex; }

  #sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    z-index: 90;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 2px 0 16px rgba(0,0,0,.2);
  }
  #sidebar.open { transform: translateX(0); }

  #content-area { padding: 16px; }

  #search-input { width: 180px; }
}

@media (max-width: 640px) {
  #search-input { width: 130px; font-size: 12px; }
  #doc-version { display: none; }
  .btn-label { display: none; }
  #btn-export, #btn-reload, #link-storage-portal { padding: 5px 8px; }
  .yaml-editor-toolbar { flex-direction: column; align-items: stretch; }
}

@media (max-width: 480px) {
  #app-logo { display: none; }
  #search-input { width: 100px; }
  #content-area { padding: 12px; }
  .doc-home-page, .endpoint-page { max-width: 100%; }
  .ep-path-hero { font-size: 15px; }
  #yaml-editor { min-height: 320px; font-size: 12px; }
}
