/* ========================================
   API Platform — Dark Theme Stylesheet
   Design: "Terminal Noir" — Developer Console Aesthetic
   Base: Deep charcoal with warm neutral grays
   Accent: Teal/cyan for interactive elements
   Typography: Inter (UI) + JetBrains Mono (code)
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ---- Reset & Base ---- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --ap-bg: #0f0f0f;
  --ap-surface: #171717;
  --ap-elevated: #1e1e1e;
  --ap-elevated-2: #262626;
  --ap-border: rgba(255,255,255,0.08);
  --ap-border-strong: rgba(255,255,255,0.14);
  --ap-text: #e8e8e6;
  --ap-text-secondary: #a0a0a0;
  --ap-text-muted: #666;
  --ap-accent: #2dd4bf;
  --ap-accent-muted: rgba(45,212,191,0.12);
  --ap-accent-hover: rgba(45,212,191,0.18);
  --ap-nukta-blue: #4a90d9;
  --ap-nukta-blue-dark: #3578c4;
  --ap-input-bg: #111111;
  --ap-pink: #f43f5e;
  --ap-font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --ap-font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --ap-sidebar-w: 220px;
  --ap-radius: 6px;
  --ap-transition: 150ms ease;
}

html, body {
  height: 100%;
  font-family: var(--ap-font-ui);
  background: var(--ap-bg);
  color: var(--ap-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #444; }

::selection {
  background: rgba(45,212,191,0.25);
  color: #fff;
}

/* ---- Layout Shell ---- */
.ap-shell {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ---- Sidebar ---- */
.ap-sidebar {
  width: var(--ap-sidebar-w);
  background: var(--ap-surface);
  border-right: 1px solid var(--ap-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100vh;
  overflow: hidden;
}

.ap-sidebar-logo {
  padding: 16px 16px 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.ap-sidebar-logo svg {
  width: 20px;
  height: 20px;
  color: var(--ap-text);
}

.ap-sidebar-logo span {
  font-size: 15px;
  font-weight: 600;
  color: var(--ap-text);
  letter-spacing: -0.3px;
}

/* Org Selector */
.ap-org-selector {
  margin: 4px 12px 8px;
}

.ap-org-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  background: var(--ap-elevated);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius);
  color: var(--ap-text);
  font-size: 13px;
  font-family: var(--ap-font-ui);
  cursor: pointer;
  transition: border-color var(--ap-transition);
}

.ap-org-btn:hover {
  border-color: var(--ap-border-strong);
}

.ap-org-btn svg {
  width: 14px;
  height: 14px;
  color: var(--ap-text-muted);
  transition: transform var(--ap-transition);
}

.ap-org-btn.open svg {
  transform: rotate(180deg);
}

.ap-org-dropdown {
  margin-top: 4px;
  background: var(--ap-elevated);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius);
  padding: 4px 0;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.ap-org-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 6px 12px;
  font-size: 13px;
  font-family: var(--ap-font-ui);
  background: none;
  border: none;
  color: var(--ap-text-secondary);
  cursor: pointer;
  transition: all var(--ap-transition);
}

.ap-org-dropdown button:hover {
  background: var(--ap-accent-muted);
  color: var(--ap-text);
}

.ap-org-dropdown button.active {
  color: var(--ap-accent);
}

/* Sidebar Nav */
.ap-sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px;
}

.ap-nav-section {
  margin-bottom: 12px;
}

.ap-nav-section-label {
  padding: 6px 8px 4px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--ap-text-muted);
}

.ap-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: var(--ap-radius);
  font-size: 13px;
  color: var(--ap-text-secondary);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--ap-transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--ap-font-ui);
}

.ap-nav-item:hover {
  background: rgba(255,255,255,0.04);
  color: var(--ap-text);
}

.ap-nav-item.active {
  background: var(--ap-accent-muted);
  color: var(--ap-text);
}

.ap-nav-item svg,
.ap-nav-item .ap-nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  stroke-width: 1.8;
}

.ap-nav-item .ap-nav-label {
  flex: 1;
}

.ap-nav-item .ap-external-icon {
  width: 12px;
  height: 12px;
  color: var(--ap-text-muted);
  margin-left: auto;
}

/* Sidebar Footer / External Links */
.ap-sidebar-links {
  padding: 4px 8px 4px;
}

/* User Profile */
.ap-sidebar-user {
  padding: 12px;
  border-top: 1px solid var(--ap-border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.ap-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #92400e, #78350f);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}

.ap-user-info {
  min-width: 0;
}

.ap-user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--ap-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ap-user-email {
  font-size: 11px;
  color: var(--ap-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Main Content ---- */
.ap-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* Top Bar */
.ap-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 48px;
  border-bottom: 1px solid var(--ap-border);
  background: var(--ap-bg);
  flex-shrink: 0;
}

.ap-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.ap-breadcrumb-muted {
  color: var(--ap-text-secondary);
}

.ap-breadcrumb-sep {
  color: var(--ap-text-muted);
}

.ap-breadcrumb-current {
  color: var(--ap-text);
  font-weight: 500;
}

.ap-topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ap-btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  font-size: 13px;
  font-family: var(--ap-font-ui);
  color: var(--ap-text-secondary);
  background: none;
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius);
  cursor: pointer;
  transition: all var(--ap-transition);
}

.ap-btn-ghost:hover {
  background: var(--ap-elevated);
  color: var(--ap-text);
  border-color: var(--ap-border-strong);
}

.ap-btn-ghost svg {
  width: 14px;
  height: 14px;
}

/* ---- Split Pane ---- */
.ap-split {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.ap-panel-left {
  width: 420px;
  flex-shrink: 0;
  border-right: 1px solid var(--ap-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ap-panel-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ---- Tabs ---- */
.ap-tabs {
  display: flex;
  border-bottom: 1px solid var(--ap-border);
  padding: 0 16px;
  flex-shrink: 0;
}

.ap-tab {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--ap-font-ui);
  color: var(--ap-text-secondary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--ap-transition);
  margin-bottom: -1px;
}

.ap-tab:hover {
  color: var(--ap-text);
}

.ap-tab.active {
  color: var(--ap-text);
  border-bottom-color: var(--ap-text);
}

.ap-tabs-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ---- Form Elements ---- */
.ap-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--ap-text);
  margin-bottom: 6px;
}

.ap-label-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ap-info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid var(--ap-text-muted);
  font-size: 9px;
  color: var(--ap-text-muted);
  cursor: help;
}

.ap-input,
.ap-select,
.ap-textarea {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  font-family: var(--ap-font-ui);
  color: var(--ap-text);
  background: var(--ap-input-bg);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius);
  outline: none;
  transition: border-color var(--ap-transition);
}

.ap-input:focus,
.ap-select:focus,
.ap-textarea:focus {
  border-color: rgba(45,212,191,0.4);
}

.ap-input::placeholder,
.ap-textarea::placeholder {
  color: var(--ap-text-muted);
}

.ap-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 28px;
}

.ap-select option {
  background: var(--ap-elevated);
  color: var(--ap-text);
}

.ap-textarea {
  resize: none;
  min-height: 120px;
  line-height: 1.5;
}

.ap-sub-label {
  font-size: 11px;
  color: var(--ap-text-muted);
  margin-bottom: 4px;
}

/* Grid helpers */
.ap-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ap-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

/* ---- Toggle / Pill Group ---- */
.ap-pill-group {
  display: inline-flex;
  background: var(--ap-elevated);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius);
  overflow: hidden;
}

.ap-pill {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--ap-font-ui);
  color: var(--ap-text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  transition: all var(--ap-transition);
}

.ap-pill:hover {
  color: var(--ap-text);
}

.ap-pill.active {
  background: var(--ap-accent-muted);
  color: var(--ap-text);
}

/* ---- Toggle Switch ---- */
.ap-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
}

.ap-toggle-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--ap-text);
}

.ap-toggle {
  position: relative;
  width: 36px;
  height: 20px;
  background: var(--ap-elevated);
  border: 1px solid var(--ap-border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 200ms ease;
  flex-shrink: 0;
}

.ap-toggle.on {
  background: var(--ap-accent);
  border-color: var(--ap-accent);
}

.ap-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  transition: transform 200ms ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.ap-toggle.on::after {
  transform: translateX(16px);
}

/* ---- Radio / Model Selector ---- */
.ap-radio-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ap-radio-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius);
  cursor: pointer;
  transition: all var(--ap-transition);
  background: none;
  text-align: left;
  width: 100%;
  font-family: var(--ap-font-ui);
}

.ap-radio-item:hover {
  border-color: var(--ap-border-strong);
  background: var(--ap-elevated);
}

.ap-radio-item.selected {
  border-color: var(--ap-accent);
  background: var(--ap-accent-muted);
}

.ap-radio-circle {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--ap-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
  transition: border-color var(--ap-transition);
}

.ap-radio-item.selected .ap-radio-circle {
  border-color: var(--ap-accent);
}

.ap-radio-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ap-accent);
  opacity: 0;
  transition: opacity var(--ap-transition);
}

.ap-radio-item.selected .ap-radio-dot {
  opacity: 1;
}

.ap-radio-text {
  min-width: 0;
}

.ap-radio-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--ap-text);
  display: flex;
  align-items: center;
  gap: 5px;
}

.ap-radio-desc {
  font-size: 12px;
  color: var(--ap-text-secondary);
  margin-top: 2px;
  line-height: 1.4;
}

/* ---- Role Selector (Messages mode) ---- */
.ap-role-group {
  display: flex;
  gap: 4px;
}

.ap-role-btn {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--ap-font-ui);
  border-radius: var(--ap-radius);
  border: 1px solid var(--ap-border);
  background: var(--ap-elevated);
  color: var(--ap-text-secondary);
  cursor: pointer;
  transition: all var(--ap-transition);
}

.ap-role-btn:hover {
  color: var(--ap-text);
}

.ap-role-btn.active {
  background: var(--ap-text);
  color: var(--ap-bg);
  border-color: var(--ap-text);
}

/* ---- Message Bubbles ---- */
.ap-messages-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ap-message {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  background: var(--ap-elevated);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius);
}

.ap-message-role {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.ap-message-role.user { background: rgba(59,130,246,0.15); color: #60a5fa; }
.ap-message-role.assistant { background: rgba(34,197,94,0.15); color: #4ade80; }
.ap-message-role.system { background: rgba(245,158,11,0.15); color: #fbbf24; }
.ap-message-role.developer { background: rgba(168,85,247,0.15); color: #c084fc; }

.ap-message-content {
  flex: 1;
  font-size: 13px;
  color: var(--ap-text-secondary);
  line-height: 1.5;
  min-width: 0;
  word-break: break-word;
}

.ap-message-delete {
  opacity: 0;
  background: none;
  border: none;
  color: rgba(244,63,94,0.5);
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  transition: all var(--ap-transition);
  flex-shrink: 0;
}

.ap-message:hover .ap-message-delete {
  opacity: 1;
}

.ap-message-delete:hover {
  color: #f43f5e;
  background: rgba(244,63,94,0.1);
}

.ap-message-delete svg {
  width: 14px;
  height: 14px;
}

/* ---- Composer Bar ---- */
.ap-composer {
  border-top: 1px solid var(--ap-border);
  padding: 12px 16px;
}

.ap-composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.ap-composer-link {
  font-size: 12px;
  color: var(--ap-text-muted);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--ap-font-ui);
  transition: color var(--ap-transition);
}

.ap-composer-link:hover {
  color: var(--ap-text);
}

.ap-composer-right {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--ap-text-secondary);
}

.ap-composer-kbd {
  font-size: 11px;
  color: var(--ap-text-muted);
}

/* ---- Submit Bar ---- */
.ap-submit-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--ap-border);
  flex-shrink: 0;
}

.ap-btn-submit {
  flex: 1;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 500;
  font-family: var(--ap-font-ui);
  background: var(--ap-text);
  color: var(--ap-bg);
  border: none;
  border-radius: var(--ap-radius);
  cursor: pointer;
  transition: opacity var(--ap-transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.ap-btn-submit:hover {
  opacity: 0.9;
}

.ap-btn-submit:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.ap-btn-submit .ap-kbd {
  font-size: 12px;
  color: var(--ap-text-muted);
}

.ap-btn-icon {
  position: relative;
  padding: 9px;
  background: var(--ap-elevated);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius);
  color: var(--ap-text-secondary);
  cursor: pointer;
  transition: all var(--ap-transition);
}

.ap-btn-icon:hover {
  color: var(--ap-text);
}

.ap-btn-icon svg {
  width: 16px;
  height: 16px;
}

.ap-badge-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 14px;
  height: 14px;
  background: var(--ap-pink);
  border-radius: 50%;
  font-size: 8px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- Response Area ---- */
.ap-response-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  color: var(--ap-text-secondary);
}

.ap-view-toggle {
  display: inline-flex;
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius);
  overflow: hidden;
}

.ap-view-btn {
  padding: 3px 10px;
  font-size: 12px;
  font-family: var(--ap-font-ui);
  background: none;
  border: none;
  color: var(--ap-text-secondary);
  cursor: pointer;
  transition: all var(--ap-transition);
}

.ap-view-btn:hover {
  color: var(--ap-text);
}

.ap-view-btn.active {
  background: var(--ap-accent);
  color: var(--ap-bg);
}

/* Empty / Placeholder */
.ap-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--ap-text-muted);
  font-size: 14px;
}

.ap-empty-messages {
  text-align: center;
  padding: 32px 16px;
  color: var(--ap-text-muted);
  font-size: 13px;
}

/* ---- Code Block ---- */
.ap-code {
  background: var(--ap-surface);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius);
  padding: 14px;
  font-size: 12px;
  font-family: var(--ap-font-mono);
  color: var(--ap-text-secondary);
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
  tab-size: 2;
}

/* ---- Search Result Cards ---- */
.ap-result {
  display: flex;
  gap: 10px;
  padding-bottom: 16px;
}

.ap-result + .ap-result {
  border-top: 1px solid var(--ap-border);
  padding-top: 16px;
}

.ap-result-favicon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--ap-elevated);
  border: 1px solid var(--ap-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.ap-result-favicon svg {
  width: 12px;
  height: 12px;
  color: var(--ap-text-muted);
}

.ap-result-body {
  min-width: 0;
  flex: 1;
}

.ap-result-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--ap-text);
  margin-bottom: 2px;
}

.ap-result-url {
  font-size: 11px;
  color: var(--ap-text-muted);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ap-result-link {
  font-size: 13px;
  color: var(--ap-accent);
  text-decoration: none;
  display: inline-block;
  margin-bottom: 4px;
}

.ap-result-link:hover {
  text-decoration: underline;
}

.ap-result-snippet {
  font-size: 13px;
  color: var(--ap-text-secondary);
  line-height: 1.55;
}

/* ---- Scrollable Content ---- */
.ap-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.ap-scroll-padded {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* ---- Spinner ---- */
.ap-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(45,212,191,0.2);
  border-top-color: var(--ap-accent);
  border-radius: 50%;
  animation: ap-spin 0.6s linear infinite;
}

@keyframes ap-spin {
  to { transform: rotate(360deg); }
}

.ap-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 10px;
}

.ap-loading-text {
  font-size: 13px;
  color: var(--ap-text-muted);
}

/* ---- Dropdown ---- */
.ap-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--ap-elevated);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius);
  padding: 4px 0;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 50;
  min-width: 160px;
}

.ap-dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 6px 12px;
  font-size: 13px;
  font-family: var(--ap-font-ui);
  background: none;
  border: none;
  color: var(--ap-text-secondary);
  cursor: pointer;
  transition: all var(--ap-transition);
}

.ap-dropdown-item:hover {
  background: var(--ap-accent-muted);
  color: var(--ap-text);
}

/* ---- Section Heading ---- */
.ap-api-desc {
  font-size: 13px;
  color: var(--ap-text-secondary);
  line-height: 1.55;
  margin-bottom: 4px;
}

.ap-field-hint {
  font-size: 11px;
  color: var(--ap-text-muted);
  margin-top: 4px;
  line-height: 1.4;
}

.ap-endpoint-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--ap-font-mono);
  font-size: 12px;
  color: var(--ap-accent);
  background: var(--ap-accent-muted);
  padding: 6px 10px;
  border-radius: var(--ap-radius);
  margin-bottom: 8px;
}

.ap-endpoint-badge .ap-method {
  font-weight: 600;
  color: var(--ap-text);
}

.ap-section-heading {
  font-size: 13px;
  font-weight: 500;
  color: var(--ap-text);
  margin-bottom: 10px;
}

/* ---- Placeholder Pages ---- */
.ap-placeholder {
  padding: 40px;
  max-width: 640px;
}

.ap-placeholder h1 {
  font-size: 20px;
  font-weight: 600;
  color: var(--ap-text);
  margin-bottom: 4px;
}

.ap-placeholder p {
  font-size: 14px;
  color: var(--ap-text-secondary);
  margin-bottom: 24px;
}

.ap-placeholder-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: var(--ap-surface);
  border: 1px solid var(--ap-border);
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--ap-transition);
}

.ap-placeholder-card:hover {
  border-color: var(--ap-border-strong);
  background: var(--ap-elevated);
}

.ap-placeholder-card + .ap-placeholder-card {
  margin-top: 8px;
}

.ap-placeholder-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--ap-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ap-placeholder-icon svg {
  width: 20px;
  height: 20px;
  color: var(--ap-text-secondary);
}

.ap-placeholder-card-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--ap-text);
}

.ap-placeholder-card-desc {
  font-size: 12px;
  color: var(--ap-text-secondary);
  margin-top: 2px;
}

/* ---- Guide & Help (doc pages) ---- */
.ap-doc {
  max-width: 820px;
  padding-bottom: 48px;
}

.ap-doc-hero h1 {
  font-size: 22px;
  font-weight: 600;
  color: var(--ap-text);
  letter-spacing: -0.3px;
  margin-bottom: 8px;
}

.ap-doc-hero p {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ap-text-secondary);
}

.ap-doc-section {
  margin-top: 32px;
}

.ap-doc-section h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--ap-text);
  margin-bottom: 12px;
}

.ap-doc-section--muted {
  padding-top: 8px;
  border-top: 1px solid var(--ap-border);
}

.ap-doc-lead {
  font-size: 13px;
  color: var(--ap-text-secondary);
  margin-bottom: 12px;
}

.ap-doc-steps {
  margin: 0;
  padding-left: 20px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ap-text-secondary);
}

.ap-doc-steps li + li {
  margin-top: 10px;
}

.ap-doc-steps strong {
  color: var(--ap-text);
  font-weight: 500;
}

.ap-doc-list {
  margin: 0;
  padding-left: 20px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ap-text-secondary);
}

.ap-doc-list li + li {
  margin-top: 8px;
}

.ap-doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.ap-doc-grid--2 {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.ap-doc-card {
  background: var(--ap-surface);
  border: 1px solid var(--ap-border);
  border-radius: 8px;
  padding: 14px 16px;
}

.ap-doc-card--warn {
  border-color: rgba(244, 63, 94, 0.25);
}

.ap-doc-card h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--ap-text);
  margin-bottom: 6px;
}

.ap-doc-card p {
  font-size: 12px;
  line-height: 1.5;
  color: var(--ap-text-secondary);
}

.ap-doc-card-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ap-text-muted);
  margin-bottom: 8px;
}

.ap-doc-card-tag--public {
  color: var(--ap-accent);
}

.ap-inline-code {
  font-family: var(--ap-font-mono);
  font-size: 12px;
  color: var(--ap-accent);
  background: var(--ap-accent-muted);
  padding: 1px 5px;
  border-radius: 3px;
}

.ap-doc-link {
  color: var(--ap-accent);
  text-decoration: none;
  font-weight: 500;
}

.ap-doc-link:hover {
  text-decoration: underline;
}

.ap-doc-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--ap-border);
  border-radius: 8px;
  background: var(--ap-surface);
}

.ap-doc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.ap-doc-table th,
.ap-doc-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--ap-border);
}

.ap-doc-table th {
  font-weight: 500;
  color: var(--ap-text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ap-doc-table tr:last-child td {
  border-bottom: none;
}

.ap-doc-table td {
  color: var(--ap-text-secondary);
}

.ap-method-pill {
  display: inline-block;
  font-family: var(--ap-font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--ap-text);
  background: var(--ap-elevated);
  padding: 2px 6px;
  border-radius: 4px;
}

.ap-doc-faq {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ap-doc-faq-item {
  background: var(--ap-surface);
  border: 1px solid var(--ap-border);
  border-radius: 8px;
  padding: 0 14px;
}

.ap-doc-faq-item summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--ap-text);
  padding: 12px 0;
  list-style: none;
}

.ap-doc-faq-item summary::-webkit-details-marker {
  display: none;
}

.ap-doc-faq-item summary::after {
  content: '+';
  float: right;
  color: var(--ap-text-muted);
  font-weight: 400;
}

.ap-doc-faq-item[open] summary::after {
  content: '−';
}

.ap-doc-faq-item p {
  font-size: 13px;
  line-height: 1.55;
  color: var(--ap-text-secondary);
  padding-bottom: 14px;
  margin-top: -4px;
}

/* ---- Resources float (Guide / Help) ---- */
.ap-resources-float {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 148px;
  padding: 12px 14px;
  background: linear-gradient(155deg, var(--ap-nukta-blue) 0%, var(--ap-nukta-blue-dark) 100%);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow:
    0 10px 36px rgba(74, 144, 217, 0.42),
    0 4px 14px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
}

.ap-resources-float-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.75px;
  color: rgba(255, 255, 255, 0.88);
}

.ap-resources-float-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ap-resources-float-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.14);
  transition: background var(--ap-transition), transform var(--ap-transition);
}

.ap-resources-float-link:hover {
  background: rgba(255, 255, 255, 0.24);
  color: #fff;
}

.ap-resources-float-link.active {
  background: rgba(255, 255, 255, 0.3);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}

.ap-resources-float-icon {
  display: inline-flex;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .ap-resources-float {
    bottom: 16px;
    right: 16px;
    min-width: 132px;
    padding: 10px 12px;
  }

  .ap-resources-float-link {
    padding: 7px 10px;
    font-size: 12px;
  }
}

/* ---- Crawlable SEO (hidden after Vue mounts; stays in HTML source) ---- */
.ap-seo-crawl {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.ap-seo-crawl[hidden] {
  display: none !important;
}

a.ap-doc-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
  transition: background var(--ap-transition), border-color var(--ap-transition);
}

a.ap-doc-card-link:hover {
  border-color: var(--ap-border-strong);
  background: var(--ap-elevated-2);
}

.ap-partner-cta {
  background: linear-gradient(135deg, rgba(74, 144, 217, 0.14), rgba(45, 212, 191, 0.08));
  border: 1px solid rgba(74, 144, 217, 0.35);
  border-radius: 10px;
  padding: 20px 22px;
}

.ap-partner-cta-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ap-nukta-blue);
  margin-bottom: 8px;
}

.ap-partner-cta h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--ap-text);
  margin-bottom: 8px;
}

.ap-partner-cta-lead {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ap-text-secondary);
  max-width: 52rem;
  margin-bottom: 14px;
}

.ap-partner-cta-points {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.ap-partner-cta-points li {
  position: relative;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ap-text);
}

.ap-partner-cta-points li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ap-accent);
}

.ap-partner-cta-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
}

.ap-partner-cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--ap-nukta-blue);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background var(--ap-transition);
}

.ap-partner-cta-btn:hover {
  background: var(--ap-nukta-blue-dark);
}

.ap-partner-cta-email {
  font-size: 12px;
  font-family: var(--ap-font-mono);
  color: var(--ap-text-muted);
}

/* ---- Utility ---- */
.ap-gap-4 { display: flex; flex-direction: column; gap: 16px; }
.ap-gap-3 { display: flex; flex-direction: column; gap: 12px; }
.ap-mt-auto { margin-top: auto; }
.ap-flex-1 { flex: 1; min-height: 0; }
.ap-relative { position: relative; }
