/* =========================================================================
   GRAIPH DOCUMENTATION VIEWER — STYLES
   Uses the GRAIPH design system tokens for consistency.
   ========================================================================= */

/* ── Design Tokens (inline — standalone page) ── */
:root {
  --bg-primary: #141418;
  --bg-secondary: #1a1a1f;
  --bg-tertiary: #202025;
  --bg-surface: #24242a;
  --bg-elevated: #2c2c33;
  --bg-hover: #282830;

  --accent: #33CC66;
  --accent-hover: #2bb358;
  --accent-muted: rgba(51, 204, 102, 0.15);
  --accent-glow: rgba(51, 204, 102, 0.08);

  --text-primary: #E8E8EC;
  --text-secondary: #A0A0AA;
  --text-muted: #6B6B78;

  --border: #35353d;
  --border-hover: #45454f;
  --border-focus: #33CC66;

  --alert-warning: #F5A623;
  --alert-error: #E53935;
  --alert-info: #2196F3;
  --alert-success: #33CC66;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.45);

  --font: 'Nunito Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 6px;

  --sidebar-width: 260px;
}

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

html, body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  height: 100vh;
  overflow: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* =========================================================================
   LAYOUT: Sidebar + Main Content
   ========================================================================= */
body {
  display: flex;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  transition: width 0.25s ease, opacity 0.25s ease;
}

.sidebar.collapsed {
  width: 0;
  opacity: 0;
  pointer-events: none;
}

.sidebar-header {
  padding: 20px 16px 12px;
  border-bottom: 1px solid var(--border);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.logo-icon {
  width: auto;
  height: 22px;
}

.logo-text {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 1.5px;
}

.logo-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Language switcher ── */
.lang-toggle-btn {
  margin-left: auto;
  min-width: 32px;
  height: 26px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.lang-toggle-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--accent);
}

/* ── Search ── */
.sidebar-search {
  padding: 12px 16px;
  position: relative;
}

.sidebar-search input {
  width: 100%;
  padding: 8px 12px;
  padding-right: 56px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}

.sidebar-search input:focus {
  border-color: var(--accent);
}

.sidebar-search input::placeholder {
  color: var(--text-muted);
}

.sidebar-search kbd {
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  padding: 2px 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  pointer-events: none;
}

/* ── Navigation ── */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.nav-section {
  margin-bottom: 4px;
}

.nav-section-title {
  padding: 8px 16px 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 600;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  color: var(--text-secondary);
  font-size: 13px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  border-left: 2px solid transparent;
}

.nav-link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  text-decoration: none;
}

.nav-link.active {
  background: var(--accent-muted);
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 500;
}

.nav-link svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-link.active svg {
  opacity: 1;
}

/* ── Main Content ── */
.content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
}

.content::-webkit-scrollbar { width: 6px; }
.content::-webkit-scrollbar-track { background: transparent; }
.content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.content::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* ── Sidebar Toggle ── */
.sidebar-toggle {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 50;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  display: none;
}

.sidebar-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar.collapsed ~ .content .sidebar-toggle {
  display: flex;
}

/* =========================================================================
   SECTIONS
   ========================================================================= */
.doc-section {
  display: none;
  padding: 32px 48px;
  max-width: 1100px;
  margin: 0 auto;
  animation: fadeIn 0.2s ease;
}

.doc-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-header {
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.section-header h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.section-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
}

h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 32px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 12px 0 6px;
}

p {
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.7;
}

ul, ol {
  color: var(--text-secondary);
  padding-left: 20px;
  margin-bottom: 12px;
}

li { margin-bottom: 4px; }

code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--accent);
}

strong { color: var(--text-primary); }

/* =========================================================================
   BANNERS
   ========================================================================= */
.info-banner, .warning-banner {
  display: flex;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
}

.info-banner {
  background: rgba(33, 150, 243, 0.08);
  border: 1px solid rgba(33, 150, 243, 0.2);
}

.info-banner svg { color: var(--alert-info); flex-shrink: 0; margin-top: 2px; }

.warning-banner {
  background: rgba(245, 166, 35, 0.08);
  border: 1px solid rgba(245, 166, 35, 0.2);
}

.warning-banner svg { color: var(--alert-warning); flex-shrink: 0; margin-top: 2px; }

.info-banner p, .warning-banner p { margin-bottom: 0; }
/* Only the banner title (direct child) is a block; inline <strong> inside the body stays inline */
.info-banner > div > strong, .warning-banner > div > strong { display: block; margin-bottom: 4px; color: var(--text-primary); }

/* =========================================================================
   CARDS
   ========================================================================= */
.card-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 24px;
}

.card-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.card-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }

.info-card, .model-card, .user-card, .category-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color 0.15s;
}

.info-card:hover, .model-card:hover {
  border-color: var(--border-hover);
}

.info-card.wide {
  grid-column: 1 / -1;
}

.info-card ul {
  margin-bottom: 0;
}

/* ── Metric Cards ── */
.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
}

.metric-value {
  font-size: 36px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 4px;
}

.metric-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.metric-detail {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── User Cards ── */
.user-card {
  text-align: center;
}

.user-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-muted);
  border-radius: 50%;
  color: var(--accent);
}

.user-card h4 {
  text-transform: none;
  font-size: 15px;
  margin-bottom: 4px;
}

/* ── Category Cards ── */
/* Category cards: uniform neutral border (no colored top accents) */

/* =========================================================================
   WORKFLOW STEPS
   ========================================================================= */
.workflow-steps {
  margin-bottom: 24px;
}

.workflow-step {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.workflow-step:last-child { border-bottom: none; }

.step-number {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 50%;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}

.step-content h3 { margin-bottom: 4px; }
.step-content p { margin-bottom: 0; }

.workflow-steps.compact .workflow-step {
  padding: 12px 0;
}

/* =========================================================================
   TABLES
   ========================================================================= */
.tech-table, .coord-table {
  margin-bottom: 24px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

thead th {
  background: var(--bg-elevated);
  padding: 10px 16px;
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-secondary);
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Badges are monochrome by default — the label carries the meaning */
.badge-blue, .badge-green, .badge-amber, .badge-red, .badge-purple {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

/* =========================================================================
   CODE BLOCKS
   ========================================================================= */
.code-block {
  margin: 12px 0;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow-x: auto;
}

.code-block pre {
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-secondary);
  white-space: pre;
  margin: 0;
}

/* =========================================================================
   OBJECT GALLERY
   ========================================================================= */
.object-gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.object-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.object-card:hover {
  border-color: var(--border-hover);
}

.object-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  color: var(--obj-color, var(--accent));
}

/* Real annotated capture inside an object detail card */
.object-photo {
  display: block;
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  background: var(--bg-tertiary);
}

.object-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.object-badge.polygon { background: rgba(33, 150, 243, 0.15); color: #64B5F6; }
.object-badge.line { background: rgba(244, 67, 54, 0.15); color: #EF9A9A; }

.object-fields {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.object-fields ul {
  list-style: none;
  padding: 0;
}

.object-fields li {
  padding: 3px 0;
  font-size: 12px;
  color: var(--text-muted);
}

.object-fields code {
  color: var(--text-primary);
  font-size: 11px;
}

/* =========================================================================
   HIERARCHY DIAGRAM
   ========================================================================= */
.hierarchy-diagram {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  margin: 24px 0;
  padding: 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.hierarchy-level {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.hierarchy-node {
  padding: 8px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.hierarchy-node.root {
  background: var(--accent-muted);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.hierarchy-connector {
  width: 2px;
  height: 20px;
  background: var(--border);
  margin: 0 auto;
}

.diagram-caption {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

/* =========================================================================
   FLOW DIAGRAM
   ========================================================================= */
.flow-diagram {
  display: flex;
  align-items: flex-start;
  gap: 0;
  margin: 24px 0;
  padding: 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow-x: auto;
}

.flow-stage {
  flex: 1;
  min-width: 140px;
  text-align: center;
  padding: 0 8px;
}

.flow-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: white;
}

.flow-icon.capture { background: var(--alert-info); }
.flow-icon.segment { background: #9C27B0; }
.flow-icon.classify { background: #FF9800; }
.flow-icon.review { background: var(--accent); }
.flow-icon.export { background: #607D8B; }
.flow-icon svg { color: white; }

.flow-stage h3 {
  font-size: 14px;
  margin-bottom: 4px;
}

.flow-stage p {
  font-size: 12px;
  margin-bottom: 0;
}

.flow-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-top: 16px;
}

/* ── Auth Flow ── */
.auth-flow {
  display: flex;
  align-items: flex-start;
  gap: 0;
  margin: 24px 0;
  padding: 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.auth-flow .flow-stage { flex: 1; }
.auth-flow .flow-icon {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--accent);
}

/* =========================================================================
   ARCHITECTURE DIAGRAM
   ========================================================================= */
.architecture-diagram {
  margin: 24px 0;
  padding: 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.arch-layer {
  margin-bottom: 16px;
}

.arch-layer-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 600;
}

.arch-node {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  transition: border-color 0.2s;
}

.arch-node.clickable {
  cursor: pointer;
}

.arch-node.clickable:hover {
  border-color: var(--accent);
}

.arch-node-header {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.arch-node-detail {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.arch-node-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.arch-node-children {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.arch-child {
  padding: 4px 10px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--text-secondary);
  cursor: default;
}

.arch-child[data-tooltip]:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.arch-nodes-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.arch-connectors {
  display: flex;
  justify-content: space-around;
  padding: 0 40px;
  margin: 8px 0;
}

.arch-connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.conn-label {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.conn-line {
  width: 2px;
  height: 20px;
  background: var(--accent);
  opacity: 0.5;
}

.conn-line.dashed {
  background: repeating-linear-gradient(
    to bottom,
    var(--border) 0px,
    var(--border) 3px,
    transparent 3px,
    transparent 6px
  );
  opacity: 1;
}

.arch-main {
  border-color: var(--accent);
  border-width: 2px;
}

.arch-ml-node,
.arch-cloud-node {
  border-left: 1px solid var(--border);
}

/* =========================================================================
   SERVICE HEADER BAR
   ========================================================================= */
.service-header-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.service-badge {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.service-badge.fastapi, .service-badge.flask {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.service-port {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
}

.service-repo {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  margin-left: auto;
}

/* =========================================================================
   ENDPOINTS
   ========================================================================= */
.endpoint-list {
  margin-bottom: 24px;
}

.endpoint-list.compact { margin-bottom: 12px; }

.endpoint {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.endpoint:first-child { border-radius: var(--radius-md) var(--radius-md) 0 0; }
.endpoint:last-child { border-bottom: none; border-radius: 0 0 var(--radius-md) var(--radius-md); }
.endpoint:only-child { border-radius: var(--radius-md); }

.endpoint:hover { background: var(--bg-surface); }

.endpoint-method {
  padding: 3px 8px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
  min-width: 52px;
  text-align: center;
}

/* HTTP methods: neutral pill, subtle hue on the text only (aids scanning without shouting) */
.endpoint-method { background: var(--bg-tertiary); color: var(--text-secondary); }
.endpoint-method.get { color: #7FA98C; }
.endpoint-method.post { color: #7E97B3; }
.endpoint-method.patch { color: #B79A6B; }
.endpoint-method.delete { color: #B98686; }

.endpoint-path {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-primary);
  flex-shrink: 0;
}

.endpoint-desc {
  font-size: 12px;
  color: var(--text-muted);
}

/* =========================================================================
   PIPELINE VISUAL
   ========================================================================= */
.pipeline-visual {
  margin: 24px 0;
}

.pipeline-step {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  overflow: hidden;
  transition: border-color 0.2s;
}

.pipeline-step:hover {
  border-color: var(--border-hover);
}

.step-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
}

.step-indicator {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 50%;
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}

.step-info h3 {
  margin-bottom: 0;
  font-size: 15px;
}

.step-info code {
  font-size: 11px;
}

.step-status {
  margin-left: auto;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 3px;
}

.step-status.default-off {
  background: rgba(245, 166, 35, 0.15);
  color: #FFB74D;
}

.step-body {
  padding: 0 20px 20px;
  border-top: 1px solid var(--border);
  margin-top: -1px;
  padding-top: 16px;
}

.step-body ol {
  margin-bottom: 16px;
}

.substep-list li {
  padding: 3px 0;
  font-size: 13px;
}

.flag-cascade {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.flag {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
}

.flag.set { background: rgba(76, 175, 80, 0.15); color: #81C784; }
.flag.clear { background: rgba(244, 67, 54, 0.15); color: #EF9A9A; }

/* ── Flags Cascade ── */
.flags-cascade-visual {
  padding: 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  overflow-x: auto;
}

.flag-row {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.flag-name {
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.flag-arrow {
  color: var(--text-muted);
  font-size: 16px;
}

/* =========================================================================
   MODULE DIAGRAM
   ========================================================================= */
.module-diagram {
  margin: 24px 0;
}

.module-layer {
  margin-bottom: 12px;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

/* Module layers share the uniform neutral border (no colored left accents) */

.layer-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 8px;
}

.module-nodes {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.module-node {
  padding: 4px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
}

/* =========================================================================
   INTERFACE PREVIEW
   ========================================================================= */
.interface-preview {
  margin-bottom: 24px;
}

.preview-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 24px;
  background: var(--bg-surface);
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
  text-align: center;
}

.preview-placeholder svg { opacity: 0.3; }
.preview-placeholder p { font-size: 12px; margin: 0; }

/* =========================================================================
   MODE GRID
   ========================================================================= */
.mode-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.mode-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  transition: border-color 0.15s;
}

.mode-card:hover { border-color: var(--border-hover); }
.mode-card h3 { font-size: 13px; }
.mode-card p { font-size: 12px; margin: 0; }

/* =========================================================================
   PANEL LAYOUT
   ========================================================================= */
.panel-layout {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.panel-item {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}

.panel-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.panel-item p { font-size: 12px; margin: 0; }

/* =========================================================================
   MODEL CARDS
   ========================================================================= */
.model-classes {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 8px 0;
}

.class-tag {
  padding: 3px 8px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  font-size: 11px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.model-note {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 0;
}

/* =========================================================================
   GLOSSARY
   ========================================================================= */
.glossary-list {
  column-count: 1;
}

.glossary-item {
  break-inside: avoid;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.glossary-item dt {
  font-weight: 600;
  color: var(--accent);
  font-size: 14px;
  margin-bottom: 4px;
}

.glossary-item dd {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}

/* =========================================================================
   LOGIN OVERLAY
   ========================================================================= */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.overlay.hidden {
  display: none !important;
}

.login-container {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}

.login-header {
  text-align: center;
  margin-bottom: 24px;
}

.login-header svg {
  width: 48px;
  height: 48px;
  color: var(--accent);
  margin-bottom: 16px;
}

.login-header h2 {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
  border-bottom: none;
}

.login-header p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 0;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.input-group {
  position: relative;
}

.input-group svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  z-index: 1;
  pointer-events: none;
}

.input-group input {
  width: 100%;
  padding: 12px 12px 12px 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: var(--font);
  background: var(--bg-elevated);
  color: var(--text-primary);
  transition: border-color 0.2s ease;
}

.input-group input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(51, 204, 102, 0.2);
}

.input-group input::placeholder {
  color: var(--text-muted);
}

.btn-login {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: white;
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}

.btn-login:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-md);
}

.btn-login:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-login svg {
  pointer-events: none;
}

.error-message {
  color: var(--alert-error);
  font-size: 12px;
  margin-top: 8px;
  text-align: center;
}

.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 13px;
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideIn 0.3s ease;
}

.notification-success { background: var(--accent); color: white; }
.notification-error { background: var(--alert-error); color: white; }
.notification-warning { background: var(--alert-warning); color: white; }
.notification-info { background: var(--alert-info); color: white; }

.notification-close {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 0;
  margin-left: 8px;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

.graiph-spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: middle;
  animation: graiph-spin 1s linear infinite;
}

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

/* =========================================================================
   RESPONSIVE
   ========================================================================= */
@media (max-width: 1200px) {
  .object-gallery { grid-template-columns: 1fr; }
  .card-grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
  .mode-grid { grid-template-columns: repeat(2, 1fr); }
  .panel-layout { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    z-index: 100;
    box-shadow: var(--shadow-lg);
  }

  .sidebar.collapsed {
    width: 0;
  }

  .sidebar-toggle { display: flex !important; }

  .doc-section { padding: 24px 20px; }
  .card-grid.cols-2, .card-grid.cols-3 { grid-template-columns: 1fr; }
  .mode-grid { grid-template-columns: 1fr; }
  .panel-layout { grid-template-columns: 1fr; }
  .flow-diagram { flex-direction: column; align-items: center; }
  .flow-arrow { transform: rotate(90deg); }
  .arch-nodes-row { grid-template-columns: 1fr; }
}

/* =========================================================================
   SMOOTH SCROLL
   ========================================================================= */
.content {
  scroll-behavior: smooth;
}

/* =========================================================================
   DOC FIGURES (example images + placeholders)
   ========================================================================= */
.doc-figure {
  margin: 20px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  overflow: hidden;
  max-width: 760px;
}
.doc-figure img {
  display: block;
  width: 100%;
  height: auto;
  background: var(--bg-tertiary);
}
/* Small portrait screenshots (UI panels): cap width so they aren't upscaled/blurry */
.doc-figure.narrow {
  max-width: 360px;
}
.doc-figure figcaption {
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-secondary);
  border-top: 1px solid var(--border);
  background: var(--bg-tertiary);
}
.doc-figure figcaption code {
  font-size: 11px;
}
/* Side-by-side figure rows */
.figure-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 20px 0;
}
.figure-row .doc-figure {
  margin: 0;
  flex: 1 1 220px;
}
/* Placeholder for screenshots to be supplied later */
.doc-figure.placeholder {
  background: var(--bg-tertiary);
}
.doc-figure.placeholder .placeholder-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 150px;
  padding: 24px;
  border: 2px dashed var(--border-hover);
  border-radius: var(--radius-md);
  margin: 8px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}
.doc-figure.placeholder .placeholder-body svg {
  width: 28px;
  height: 28px;
  opacity: 0.6;
}

/* =========================================================================
   PRINT STYLES
   ========================================================================= */
@media print {
  .sidebar { display: none; }
  .sidebar-toggle { display: none; }
  .doc-section { display: block !important; padding: 20px 0; }
  .content { overflow: visible; }
  body { background: white; color: black; }
}
