/* ═══════════════════════════════════════════════════════════
   ADT Studio 2026 — Design System
   Modern dark/light theme inspired by Linear, Vercel, Raycast
   ═══════════════════════════════════════════════════════════ */

/* ─── CSS Variables (Dark) ─── */
:root, [data-theme="dark"] {
  --bg-base: #0a0a0a;
  --bg-raised: #111111;
  --bg-surface: #161616;
  --bg-surface-hover: #1c1c1c;
  --bg-overlay: #1a1a1a;
  --bg-sidebar: #0d0d0d;
  --bg-input: #1a1a1a;

  --border: #222222;
  --border-light: #2a2a2a;
  --border-focus: #3b82f6;

  --text-primary: #ededed;
  --text-secondary: #aaaaaa;
  --text-muted: #777777;
  --text-inverse: #0a0a0a;

  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-soft: rgba(59, 130, 246, 0.12);
  --accent-glow: rgba(59, 130, 246, 0.25);

  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, 0.12);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.12);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.12);

  --terminal-bg: #0c0c0c;
  --terminal-text: #4ade80;
  --terminal-dim: #2a5a3a;

  --xml-tag: #3b82f6;
  --xml-attr: #f59e0b;
  --xml-value: #22c55e;
  --xml-comment: #555;
}

/* ─── Light Theme ─── */
[data-theme="light"] {
  --bg-base: #f5f5f5;
  --bg-raised: #ffffff;
  --bg-surface: #ffffff;
  --bg-surface-hover: #f0f0f0;
  --bg-overlay: #fafafa;
  --bg-sidebar: #eaeaea;
  --bg-input: #f0f0f0;

  --border: #e0e0e0;
  --border-light: #d0d0d0;

  --text-primary: #1a1a1a;
  --text-secondary: #666666;
  --text-muted: #999999;
  --text-inverse: #ffffff;

  --accent-soft: rgba(59, 130, 246, 0.08);
  --accent-glow: rgba(59, 130, 246, 0.15);
  --success-soft: rgba(34, 197, 94, 0.08);
  --warning-soft: rgba(245, 158, 11, 0.08);
  --danger-soft: rgba(239, 68, 68, 0.08);

  --terminal-bg: #1e1e1e;
  --terminal-text: #4ade80;
  --terminal-dim: #2a5a3a;

  --xml-tag: #2563eb;
  --xml-attr: #d97706;
  --xml-value: #16a34a;
  --xml-comment: #9ca3af;
}

/* ─── Shared ─── */
:root {
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.15);
  --shadow: 0 4px 12px rgba(0,0,0,0.2);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.3);
  --font: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'Cascadia Code', 'Consolas', 'SF Mono', monospace;
  --transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --titlebar-h: 38px;
  --sidebar-w: 56px;
}

/* ─── Reset ─── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.6;
  transition: background 0.3s, color 0.3s;
}

::selection { background: var(--accent-soft); color: var(--accent); }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── Animations ─── */
.anim-slide-up {
  animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.anim-delay-1 { animation-delay: 0.08s; }
.anim-delay-2 { animation-delay: 0.16s; }
.anim-delay-3 { animation-delay: 0.24s; }
.anim-delay-4 { animation-delay: 0.32s; }

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 4px var(--success); }
  50% { box-shadow: 0 0 12px var(--success); }
}

/* ─── Title Bar ─── */
.titlebar {
  height: var(--titlebar-h);
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  -webkit-app-region: drag;
  user-select: none;
  padding: 0 8px;
  position: relative;
  z-index: 100;
  transition: background 0.3s;
}
.titlebar-drag { display: flex; align-items: center; gap: 8px; padding-left: 4px; }
.titlebar-icon { color: var(--accent); display: flex; align-items: center; }
.titlebar-title { font-weight: 600; font-size: 12.5px; color: var(--text-primary); letter-spacing: 0.02em; }
.titlebar-version { font-size: 10px; color: var(--text-muted); background: var(--bg-surface); padding: 1px 6px; border-radius: 4px; font-weight: 500; }
.titlebar-controls { display: flex; -webkit-app-region: no-drag; }

.tb-btn {
  width: 40px; height: var(--titlebar-h); border: none; background: transparent;
  color: var(--text-secondary); cursor: pointer; display: flex; align-items: center;
  justify-content: center; transition: all var(--transition);
}
.tb-btn:hover { background: var(--bg-surface-hover); color: var(--text-primary); }
.tb-close:hover { background: var(--danger); color: white; }

/* ─── App Layout ─── */
.app-layout { display: flex; height: calc(100vh - var(--titlebar-h)); }

/* ─── Sidebar ─── */
.sidebar {
  width: var(--sidebar-w); background: var(--bg-sidebar); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 12px 0 16px; flex-shrink: 0; transition: background 0.3s;
}
.sidebar-top { display: flex; flex-direction: column; gap: 4px; }

.nav-btn {
  width: 40px; height: 40px; border: none; background: transparent; color: var(--text-muted);
  cursor: pointer; border-radius: var(--radius); display: flex; align-items: center;
  justify-content: center; transition: all var(--transition); position: relative;
}
.nav-btn:hover { background: var(--bg-surface); color: var(--text-secondary); }
.nav-btn.active { background: var(--accent-soft); color: var(--accent); }
.nav-btn.active::before {
  content: ''; position: absolute; left: -8px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; background: var(--accent); border-radius: 0 3px 3px 0;
}

.adt-status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--text-muted); transition: all 0.3s; }
.adt-status-dot.running { background: var(--success); box-shadow: 0 0 8px var(--success); animation: pulse 2s infinite; }

.engine-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: middle;
}
.engine-dot.offline { background: var(--text-muted); }
.engine-dot.online { background: var(--success); box-shadow: 0 0 6px var(--success); }

/* ─── Content ─── */
.content { flex: 1; overflow-y: auto; padding: 28px 36px 40px; background: var(--bg-base); transition: background 0.3s; }
.page { display: none; }
.page.active { display: block; animation: fadeIn 0.2s ease; }

/* ─── Hero ─── */
.hero {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 28px; padding-bottom: 24px; border-bottom: 1px solid var(--border);
}
.hero h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; color: var(--text-primary); line-height: 1.2; }
.hero-year { background: linear-gradient(135deg, var(--accent), #8b5cf6); -webkit-background-clip: text; -webkit-text-fill-color: transparent; font-weight: 800; }
.hero-subtitle { color: var(--text-secondary); font-size: 14px; margin-top: 4px; }
.hero-actions { display: flex; gap: 10px; }

/* ─── Buttons ─── */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 18px;
  border-radius: var(--radius); font-size: 13px; font-weight: 500; cursor: pointer;
  transition: all var(--transition); border: 1px solid transparent; font-family: var(--font); white-space: nowrap;
}
.btn-primary { background: var(--accent); color: white; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 4px 12px var(--accent-glow); }
.btn-glow { box-shadow: 0 0 20px var(--accent-glow); }
.btn-outline { background: transparent; color: var(--text-secondary); border-color: var(--border-light); }
.btn-outline:hover { background: var(--bg-surface); color: var(--text-primary); border-color: var(--border-light); }
.btn-remove { color: var(--danger, #f87171) !important; border-color: var(--danger, #f87171) !important; }
.btn-remove:hover { background: var(--danger, #f87171) !important; color: #fff !important; }
.btn-sm { padding: 5px 12px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.btn-danger:hover { background: var(--danger); color: white; }
.btn-success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.btn-success:hover { background: var(--success); color: white; }

/* ─── Stats Row ─── */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 32px; }
.stat-card {
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 20px; text-align: center; transition: all var(--transition);
}
.stat-card:hover { border-color: var(--border-light); background: var(--bg-surface-hover); }
.stat-value { font-size: 24px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-top: 4px; font-weight: 500; }

/* ─── Section Headers ─── */
.section-header { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.section-header h2 { font-size: 15px; font-weight: 600; color: var(--text-primary); letter-spacing: -0.01em; }
.badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }

/* ─── Project Cards ─── */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.project-card {
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px; cursor: pointer; transition: all var(--transition); position: relative;
}
.project-card:hover { border-color: var(--accent); background: var(--bg-surface-hover); transform: translateY(-2px); box-shadow: var(--shadow), 0 0 0 1px var(--accent-glow); }
.project-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.project-name { font-size: 16px; font-weight: 600; color: var(--text-primary); letter-spacing: -0.01em; }
.project-status { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; padding: 3px 8px; border-radius: 999px; }
.project-status.valid { background: var(--success-soft); color: var(--success); }
.project-status.unknown { background: var(--warning-soft); color: var(--warning); }
.project-meta { display: flex; gap: 16px; margin-bottom: 14px; }
.project-meta-item { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-secondary); }
.project-meta-item .meta-value { color: var(--text-primary); font-weight: 600; }
.project-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--bg-overlay); color: var(--text-secondary); border: 1px solid var(--border); }
.project-actions { display: flex; gap: 6px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); flex-wrap: wrap; }

/* ─── Action Cards ─── */
.actions-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.action-card {
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; cursor: pointer; display: flex; flex-direction: column; align-items: center;
  gap: 10px; transition: all var(--transition); color: var(--text-secondary); font-size: 12px;
  font-weight: 500; font-family: var(--font);
}
.action-card:hover { background: var(--bg-surface-hover); border-color: var(--border-light); color: var(--text-primary); transform: translateY(-2px); box-shadow: var(--shadow-sm); }

/* ─── Project List ─── */
.project-list { display: flex; flex-direction: column; gap: 1px; background: var(--border); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.project-row { background: var(--bg-surface); padding: 14px 20px; display: grid; grid-template-columns: 1fr auto auto auto; align-items: center; gap: 16px; transition: background var(--transition); cursor: pointer; }
.project-row:hover { background: var(--bg-surface-hover); }
.project-row-name { font-weight: 600; color: var(--text-primary); }
.project-row-meta { font-size: 12px; color: var(--text-secondary); }

/* ─── Schema Explorer ─── */
.explorer-layout { display: flex; gap: 1px; background: var(--border); border-radius: var(--radius); overflow: hidden; height: calc(100vh - 180px); border: 1px solid var(--border); }
.explorer-sidebar {
  width: 260px; background: var(--bg-surface); overflow-y: auto; flex-shrink: 0;
}
.explorer-content { flex: 1; background: var(--bg-raised); overflow-y: auto; padding: 0; }

.tree-project { padding: 8px 0; }
.tree-project-name {
  font-weight: 600; font-size: 14px; color: var(--text-primary); padding: 6px 16px;
  cursor: pointer; display: flex; align-items: center; gap: 6px; transition: background var(--transition);
}
.tree-project-name:hover { background: var(--bg-surface-hover); }
.tree-project-name .arrow { font-size: 11px; color: var(--text-muted); transition: transform 0.15s; display: inline-block; }
.tree-project-name.expanded .arrow { transform: rotate(90deg); }

.tree-children { display: none; padding-left: 12px; }
.tree-children.open { display: block; }

.tree-item {
  font-size: 13px; padding: 5px 16px; cursor: pointer; color: var(--text-secondary);
  display: flex; align-items: center; gap: 6px; transition: all var(--transition);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tree-item:hover { background: var(--bg-surface-hover); color: var(--text-primary); }
.tree-item.active { background: var(--accent-soft); color: var(--accent); }
.tree-item .file-icon { font-size: 12px; flex-shrink: 0; }

.xml-viewer {
  font-family: var(--font-mono); font-size: 12.5px; line-height: 1.8; padding: 20px 24px;
  white-space: pre-wrap; word-break: break-all; color: var(--text-secondary);
}
.xml-viewer .xml-tag { color: var(--xml-tag); }
.xml-viewer .xml-attr { color: var(--xml-attr); }
.xml-viewer .xml-value { color: var(--xml-value); }
.xml-viewer .xml-comment { color: var(--xml-comment); font-style: italic; }
.xml-line-num { color: var(--text-muted); user-select: none; display: inline-block; width: 40px; text-align: right; margin-right: 16px; font-size: 11px; }

/* ─── Terminal ─── */
.terminal-container {
  background: var(--terminal-bg); border: 1px solid var(--border); border-radius: var(--radius);
  height: calc(100vh - 180px); overflow: hidden; position: relative;
}

/* ═══════════════════════════════════════════════════════════
   EDITOR STYLES — Project Editor UI
   ═══════════════════════════════════════════════════════════ */

/* Editor Header */
.editor-header { display: flex; justify-content: space-between; align-items: center; padding: 0 0 12px; border-bottom: 1px solid var(--border); margin-bottom: 0; }
.editor-header-left { display: flex; align-items: center; gap: 12px; }
.editor-header-left h2 { margin: 0; font-size: 18px; font-weight: 600; }
.editor-header-right { display: flex; gap: 8px; }
.editor-dirty-badge { color: var(--warning); font-size: 12px; font-weight: 600; background: rgba(234,179,8,0.1); padding: 2px 8px; border-radius: 10px; }

/* Editor Layout — Tree + Main */
.editor-layout { display: grid; grid-template-columns: 240px 1fr; height: calc(100vh - 130px); overflow: hidden; }
.editor-tree { background: var(--bg-surface); border-right: 1px solid var(--border); overflow-y: auto; display: flex; flex-direction: column; transition: width 0.2s ease, min-width 0.2s ease; min-width: 240px; }
.editor-tree.collapsed { min-width: 0; width: 0; overflow: hidden; border-right: none; }
.editor-layout.sidebar-collapsed { grid-template-columns: 0px 1fr; }
.editor-tree-header { padding: 10px 14px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-secondary); border-bottom: 1px solid var(--border); flex-shrink: 0; display: flex; justify-content: space-between; align-items: center; }
.btn-icon-sm { background: none; border: 1px solid var(--border); border-radius: 4px; cursor: pointer; font-size: 10px; padding: 2px 6px; color: var(--text-secondary); transition: all 0.15s; }
.btn-icon-sm:hover { background: var(--bg-hover); color: var(--text-primary); }
.sidebar-expand-btn { position: absolute; left: 0; top: 50%; transform: translateY(-50%); z-index: 10; background: var(--bg-surface); border: 1px solid var(--border); border-left: none; border-radius: 0 4px 4px 0; padding: 8px 4px; cursor: pointer; font-size: 10px; color: var(--text-secondary); transition: all 0.15s; }
.sidebar-expand-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.editor-tree-content { flex: 1; overflow-y: auto; padding: 4px 0; }

/* Tree Nodes */
.etree-section { margin-bottom: 2px; }
.etree-section-header { display: flex; align-items: center; gap: 6px; padding: 6px 12px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-primary); transition: background 0.12s; user-select: none; }
.etree-section-header:hover { background: var(--bg-surface-hover); }
.etree-section-header .etree-arrow { font-size: 9px; color: var(--text-muted); transition: transform 0.15s; display: inline-block; width: 10px; }
.etree-section-header .etree-arrow.open { transform: rotate(90deg); }
.etree-section-header .etree-icon { font-size: 13px; }
.etree-section-header .etree-count { font-size: 11px; color: var(--text-muted); margin-left: auto; background: var(--bg-input); padding: 1px 6px; border-radius: 8px; }
.etree-children { display: none; padding-left: 10px; }
.etree-children.open { display: block; }
.etree-item { display: flex; align-items: center; gap: 6px; padding: 5px 12px 5px 22px; cursor: pointer; font-size: 13px; color: var(--text-secondary); transition: all 0.12s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.etree-item:hover { background: var(--bg-surface-hover); color: var(--text-primary); }
.etree-item.active { background: var(--accent-soft); color: var(--accent); border-left: 2px solid var(--accent); }
.etree-item .etree-chip { font-size: 9px; padding: 1px 5px; border-radius: 6px; font-weight: 600; text-transform: uppercase; }
.etree-item .etree-chip.account { background: rgba(59,130,246,0.15); color: #60a5fa; }
.etree-item .etree-chip.service { background: rgba(168,85,247,0.15); color: #c084fc; }
.etree-item .etree-chip.support { background: rgba(34,197,94,0.15); color: #4ade80; }
.etree-item .etree-chip.op { background: rgba(249,115,22,0.15); color: #fb923c; }
.etree-item .etree-chip.form { background: rgba(236,72,153,0.15); color: #f472b6; }
.etree-item .etree-chip.hook { background: rgba(139,92,246,0.15); color: #a78bfa; }

/* Editor Main (right side) */
.editor-main { display: flex; flex-direction: column; overflow: hidden; }

/* Editor Tabs */
.editor-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); padding: 0; margin: 0; flex-shrink: 0; }
.editor-tab {
  padding: 10px 20px; background: none; border: none; color: var(--text-secondary); cursor: pointer;
  font-size: 13px; font-weight: 500; border-bottom: 2px solid transparent; transition: all 0.2s;
}
.editor-tab:hover { color: var(--text-primary); background: var(--bg-surface-hover); }
.editor-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Editor Content */
.editor-tab-content { padding: 20px; overflow-y: auto; flex: 1; }

/* Overview Stats */
.editor-overview { }
.editor-stats-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 24px; }
.editor-stat { text-align: center; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 8px; }
.editor-stat-val { font-size: 28px; font-weight: 700; color: var(--accent); }
.editor-stat-lbl { font-size: 12px; color: var(--text-secondary); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.05em; }

/* Cards */
.editor-cards-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.editor-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.editor-card h3 { margin: 0 0 12px; font-size: 14px; font-weight: 600; color: var(--text-primary); }
.editor-card-list { display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow-y: auto; }
.editor-card-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; font-size: 13px; }
.editor-card-item:hover { background: var(--bg-surface-hover); }

/* Chips */
.editor-chip { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; text-transform: uppercase; letter-spacing: 0.03em; }
.editor-chip.account { background: rgba(59,130,246,0.15); color: #60a5fa; }
.editor-chip.service { background: rgba(168,85,247,0.15); color: #c084fc; }
.editor-chip.support { background: rgba(34,197,94,0.15); color: #4ade80; }
.editor-chip.operation { background: rgba(249,115,22,0.15); color: #fb923c; }
.editor-chip.form { background: rgba(236,72,153,0.15); color: #f472b6; }
.editor-chip.simple { background: rgba(34,197,94,0.15); color: #4ade80; }
.editor-chip.advanced { background: rgba(234,179,8,0.15); color: #facc15; }
.editor-chip:not([class*=" "]) { background: var(--accent-soft); color: var(--accent); }

/* Schema Editor */
.schema-editor { display: flex; flex-direction: column; gap: 20px; }
.schema-class { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.schema-class-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.schema-class-name { font-weight: 600; font-size: 15px; margin-left: 8px; }
.schema-class-actions { display: flex; gap: 8px; }

/* Tables */
.schema-table, .mapping-table, .params-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.schema-table th, .mapping-table th, .params-table th { text-align: left; padding: 8px 12px; font-weight: 500; color: var(--text-secondary); border-bottom: 1px solid var(--border); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.schema-table td, .mapping-table td, .params-table td { padding: 6px 12px; border-bottom: 1px solid var(--border-light); }
.schema-table tr:hover td, .mapping-table tr:hover td, .params-table tr:hover td { background: var(--bg-surface-hover); }
.schema-table code, .mapping-table code, .params-table code { font-family: 'JetBrains Mono', 'Cascadia Code', 'Consolas', monospace; font-size: 12px; color: var(--text-primary); }
.schema-table input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }

/* Operations — Redesigned with sub-tabs */
.operations-editor { display: flex; flex-direction: column; gap: 12px; }

/* Operation selector strip */
.op-selector-strip { display: flex; gap: 4px; flex-wrap: wrap; padding: 8px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); }
.op-selector-btn {
  display: flex; align-items: center; gap: 6px; padding: 6px 12px; background: transparent; border: 1px solid transparent;
  border-radius: 6px; cursor: pointer; font-size: 12px; font-weight: 500; color: var(--text-secondary); transition: all 0.15s;
}
.op-selector-btn:hover { background: var(--bg-surface-hover); color: var(--text-primary); }
.op-selector-btn.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }

/* Operation detail panel */
.op-detail-panel { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.op-detail-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.op-detail-header h3 { margin: 0; font-size: 16px; font-weight: 600; }

/* Sub-tabs */
.op-sub-tabs { display: flex; border-bottom: 1px solid var(--border); background: var(--bg-raised); }
.op-sub-tab {
  padding: 8px 16px; background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--text-secondary); font-size: 12px; font-weight: 500; cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.op-sub-tab:hover { color: var(--text-primary); background: var(--bg-surface-hover); }
.op-sub-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.op-sub-content { padding: 16px; }
.op-identity .field-row label { font-size: 12px; font-weight: 600; color: var(--text-secondary); display: block; margin-bottom: 4px; }
.op-identity input[type="text"] {
  background: var(--bg-input); border: 1px solid var(--border); border-radius: 6px; padding: 8px 12px;
  color: var(--text-primary); font-size: 13px; width: 100%;
}
.op-identity input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 2px var(--accent-soft); }
.op-connector-config .field-row label { font-size: 12px; font-weight: 600; color: var(--text-secondary); display: block; margin-bottom: 4px; }
.op-connector-config select {
  background: var(--bg-input); border: 1px solid var(--border); border-radius: 6px; padding: 8px 12px;
  color: var(--text-primary); font-size: 13px; width: 100%;
}

/* Empty state inline */
.empty-state-inline { text-align: center; padding: 24px; }
.empty-state-inline .muted { margin-bottom: 12px; }

/* Test panel */
.op-test-panel .test-param-field {
  background: var(--bg-input); border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px;
  color: var(--text-primary); font-size: 12px; font-family: 'JetBrains Mono', 'Cascadia Code', monospace; width: 100%; max-width: 400px;
}
.op-test-panel .test-param-field:focus { border-color: var(--accent); outline: none; }
.test-output-log {
  background: var(--bg-base); border: 1px solid var(--border); border-radius: 6px; padding: 12px 16px;
  font-family: 'JetBrains Mono', 'Cascadia Code', monospace; font-size: 11px; line-height: 1.6;
  color: var(--text-primary); max-height: 320px; overflow-y: auto; white-space: pre-wrap; word-break: break-all;
}

/* Legacy compat */
.operation-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.operation-section { margin-top: 16px; }
.operation-section h4 { font-size: 13px; font-weight: 600; color: var(--text-primary); margin: 0 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border-light); }
.connector-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }

/* Hooks */
.hook-item { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border-light); }
.hook-name { font-weight: 500; font-size: 13px; color: var(--text-primary); min-width: 140px; }
.hook-preview { font-family: 'JetBrains Mono', 'Cascadia Code', 'Consolas', monospace; font-size: 11px; color: var(--text-muted); background: var(--bg-input); border-radius: 4px; padding: 6px 10px; margin: 4px 0 0; width: 100%; white-space: pre; overflow-x: auto; max-height: 60px; }

/* Hook toggle grid */
.hooks-grid { display: flex; flex-direction: column; gap: 2px; }
.hook-toggle-item { padding: 8px 12px; border-radius: 6px; border: 1px solid var(--border-light); transition: all 0.15s; }
.hook-toggle-item.enabled { background: var(--bg-surface); border-color: var(--border); }
.hook-toggle-item.disabled { background: transparent; opacity: 0.6; }
.hook-toggle-item.disabled:hover { opacity: 0.8; }
.hook-toggle-row { display: flex; align-items: center; gap: 10px; }
.hook-badge { font-size: 10px; padding: 2px 6px; border-radius: 3px; font-weight: 500; }
.hook-badge.has-script { background: #e8f5e9; color: #2e7d32; }
[data-theme="dark"] .hook-badge.has-script { background: #1b3a1e; color: #81c784; }

/* Toggle switch */
.hook-toggle-switch { position: relative; display: inline-block; width: 36px; height: 20px; flex-shrink: 0; }
.hook-toggle-switch input { opacity: 0; width: 0; height: 0; }
.hook-toggle-slider { position: absolute; cursor: pointer; inset: 0; background-color: var(--border); border-radius: 20px; transition: 0.2s; }
.hook-toggle-slider:before { content: ""; position: absolute; height: 14px; width: 14px; left: 3px; bottom: 3px; background-color: white; border-radius: 50%; transition: 0.2s; }
.hook-toggle-switch input:checked + .hook-toggle-slider { background-color: #0f62fe; }
.hook-toggle-switch input:checked + .hook-toggle-slider:before { transform: translateX(16px); }

/* Param inputs */
.param-input { background: var(--bg-input); border: 1px solid var(--border); border-radius: 4px; padding: 4px 8px; color: var(--text-primary); font-size: 12px; font-family: 'JetBrains Mono', 'Cascadia Code', monospace; width: 100%; max-width: 320px; }
.param-input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 2px var(--accent-soft); }

/* Forms Editor */
.forms-editor { display: flex; flex-direction: column; gap: 16px; }
.form-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.form-header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.required-badge { font-size: 10px; background: rgba(239,68,68,0.15); color: #f87171; padding: 2px 6px; border-radius: 8px; font-weight: 600; }

/* Scripts Browser */
.scripts-browser { display: grid; grid-template-columns: 260px 1fr; gap: 0; height: calc(100vh - 240px); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.scripts-list { background: var(--bg-surface); border-right: 1px solid var(--border); overflow-y: auto; }
.scripts-list-header { padding: 12px 14px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-secondary); border-bottom: 1px solid var(--border); }
.script-group-header { padding: 8px 14px 8px 12px; font-size: 12px; font-weight: 700; color: var(--text-primary); background: var(--bg-surface); border-bottom: 1px solid var(--border-light); margin-top: 4px; display: flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.script-group-header:hover { background: var(--bg-surface-hover); }
.script-group-arrow { font-size: 10px; color: var(--text-muted); transition: transform 0.15s; display: inline-block; }
.script-group-arrow.open { transform: rotate(90deg); }
.script-group-children { overflow: hidden; }
.script-group-children.collapsed { display: none; }
.script-list-item { padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--border-light); transition: background 0.15s; }
.script-list-item:hover { background: var(--bg-surface-hover); }
.script-list-item.active { background: var(--accent-soft); border-left: 3px solid var(--accent); }
.script-item-name { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.script-item-source { font-size: 12px; }

.scripts-editor-pane { display: flex; flex-direction: column; background: var(--bg-base); }
.script-toolbar { display: flex; justify-content: space-between; align-items: center; padding: 8px 16px; border-bottom: 1px solid var(--border); background: var(--bg-surface); }
.script-editor-title { font-weight: 600; font-size: 13px; color: var(--text-primary); }
.script-textarea {
  flex: 1; width: 100%; border: none; background: var(--bg-base); color: var(--text-primary);
  font-family: 'JetBrains Mono', 'Cascadia Code', 'Consolas', monospace; font-size: 13px; line-height: 1.6;
  padding: 16px; resize: none; outline: none; tab-size: 2;
}

/* Ace Editor */
.ace-editor-container { flex: 1; min-height: 300px; }
.ace-editor-container .ace_editor { font-size: 13px !important; }

.script-status-bar {
  display: flex; gap: 16px; align-items: center; padding: 4px 16px;
  background: var(--bg-surface); border-top: 1px solid var(--border);
  font-family: var(--font-mono); font-size: 11px; color: var(--text-secondary);
}
.delim-ok { color: var(--success); }
.delim-error { color: var(--danger); font-weight: 600; }

/* Icon buttons */
.btn-icon-danger { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px; padding: 2px 6px; border-radius: 4px; transition: all 0.15s; }
.btn-icon-danger:hover { background: rgba(239,68,68,0.15); color: #f87171; }

/* Slide up animation */
.anim-slide-up { animation: slideUp 0.3s ease-out forwards; opacity: 0; }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ─── Custom Dialog System ─── */
.dialog-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.15s ease;
  backdrop-filter: blur(4px);
}
.dialog-overlay.visible { opacity: 1; }
.dialog-box {
  background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; min-width: 380px; max-width: 520px; box-shadow: var(--shadow-lg);
  transform: translateY(10px); transition: transform 0.15s ease;
}
.dialog-overlay.visible .dialog-box { transform: translateY(0); }
.dialog-title { font-size: 15px; font-weight: 600; margin-bottom: 16px; color: var(--text-primary); }
.dialog-body { margin-bottom: 20px; }
.dialog-field { margin-bottom: 12px; }
.dialog-field label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; font-weight: 500; }
.dialog-field input[type="hidden"] { display: none; }
.dialog-input {
  width: 100%; padding: 8px 12px; background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary); font-size: 13px; font-family: var(--font);
  outline: none; transition: border-color 0.15s;
}
.dialog-input:focus { border-color: var(--accent); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; position: relative; z-index: 10; }
.dialog-actions .btn { pointer-events: auto; cursor: pointer; }
.btn-danger { background: var(--danger); color: white; border: none; }
.btn-danger:hover { background: #dc2626; }

/* Responsive */
@media (max-width: 900px) {
  .editor-stats-row { grid-template-columns: repeat(3, 1fr); }
  .editor-cards-row { grid-template-columns: 1fr; }
  .scripts-browser { grid-template-columns: 200px 1fr; }
}

/* Section Toolbars */
.section-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.section-toolbar h3 { margin: 0; font-size: 15px; font-weight: 600; }
.section-toolbar-sm { display: flex; justify-content: space-between; align-items: center; margin: 12px 0 6px; }
.section-toolbar-sm h4, .section-toolbar-sm h5 { margin: 0; }

/* Groups Editor */
.groups-editor { display: flex; flex-direction: column; gap: 16px; }
.group-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.group-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.group-fields { padding: 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row { display: flex; flex-direction: column; gap: 4px; }
.field-row label { font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; }
.field-row input, .field-row select { background: var(--bg-input); border: 1px solid var(--border); border-radius: 4px; padding: 6px 10px; color: var(--text-primary); font-size: 13px; }
.field-row input:focus, .field-row select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 2px var(--accent-soft); }

/* Validation */
.validate-results { max-width: 640px; }
.validate-summary { display: flex; gap: 12px; margin-bottom: 20px; }
.validate-badge { padding: 8px 16px; border-radius: var(--radius); font-weight: 600; font-size: 13px; }
.validate-badge.error { background: rgba(239,68,68,0.12); color: #f87171; }
.validate-badge.warn { background: rgba(234,179,8,0.12); color: #facc15; }
.validate-badge.ok { background: rgba(34,197,94,0.12); color: #4ade80; }
.validate-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border-light); font-size: 13px; }
.validate-item.error .validate-icon { color: #f87171; font-weight: 700; }
.validate-item.warn .validate-icon { color: #facc15; font-weight: 700; }
.validate-pass { text-align: center; padding: 40px 20px; }
.validate-pass h3 { color: var(--success); margin-bottom: 8px; }

/* Empty state inline */
.empty-state-inline { padding: 20px; text-align: center; }

/* Small icon buttons */
.btn-icon-sm { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 14px; padding: 1px 4px; border-radius: 3px; }
.btn-icon-sm:hover { background: var(--accent-soft); color: var(--accent); }

.terminal-output {
  font-family: var(--font-mono); font-size: 12px; line-height: 1.7; padding: 16px 20px;
  color: var(--terminal-text); background: transparent; height: 100%; overflow-y: auto;
  white-space: pre-wrap; word-break: break-all;
}
.terminal-output .log-error { color: var(--danger); }
.terminal-output .log-warn { color: var(--warning); }
.terminal-output .log-info { color: var(--accent); }
.terminal-output .log-timestamp { color: var(--terminal-dim); }

/* ─── Log Viewer ─── */
.log-viewer {
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 20px; font-family: var(--font-mono); font-size: 12px; line-height: 1.7;
  color: var(--text-secondary); max-height: calc(100vh - 200px); overflow-y: auto;
  white-space: pre-wrap; word-break: break-all;
}

/* ─── Settings Grid ─── */
.settings-grid { display: flex; flex-direction: column; gap: 1px; background: var(--border); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.settings-row { background: var(--bg-surface); padding: 14px 20px; display: flex; justify-content: space-between; align-items: center; }
.settings-key { font-weight: 500; color: var(--text-secondary); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.settings-value { color: var(--text-primary); font-family: var(--font-mono); font-size: 12px; }

/* ─── Settings Options ─── */
.settings-option-row { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--border); }
.settings-option-row:last-child { border-bottom: none; }
.settings-option-label { font-weight: 500; color: var(--text-primary); font-size: 13px; }
.settings-option-desc { color: var(--text-muted); font-size: 11px; margin-top: 2px; }
.toggle-switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; inset: 0; background: var(--bg-tertiary, #555); border-radius: 22px; transition: background 0.25s; }
.toggle-slider::before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: transform 0.25s; }
.toggle-switch input:checked + .toggle-slider { background: var(--primary, #3b82f6); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ─── Misc ─── */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px; color: var(--text-muted); gap: 12px; }
.muted { color: var(--text-secondary); font-size: 13px; }

/* ─── Toast ─── */
.toast-container { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 9999; pointer-events: none; }
.toast {
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 18px; font-size: 13px; color: var(--text-primary); box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s; pointer-events: auto; max-width: 360px;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--accent); }

@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }

/* ═══════════════════════════════════════════════════════════
   MODAL / WIZARD
   ═══════════════════════════════════════════════════════════ */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.55); backdrop-filter: blur(4px); z-index: 10000; display: flex; align-items: center; justify-content: center; }
.modal-dialog { background: var(--bg-raised); border: 1px solid var(--border); border-radius: 12px; width: 580px; max-width: 90vw; max-height: 85vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.4); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px 16px; border-bottom: 1px solid var(--border); }
.modal-header h2 { margin: 0; font-size: 17px; font-weight: 600; }
.modal-body { padding: 24px; }

.wizard-step h3 { margin: 0 0 16px; font-size: 15px; font-weight: 600; color: var(--accent); }
.wizard-fields { display: flex; flex-direction: column; gap: 14px; margin-bottom: 20px; }
.wizard-fields .field-row { }
.wizard-fields .field-row label { font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; display: block; }
.wizard-fields .field-row input { width: 100%; background: var(--bg-input); border: 1px solid var(--border); border-radius: 6px; padding: 9px 12px; color: var(--text-primary); font-size: 14px; }
.wizard-fields .field-row input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.wizard-fields .field-row input::placeholder { color: var(--text-muted); }

.wizard-nav { display: flex; justify-content: space-between; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border-light); }

.wizard-connector-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.wizard-connector-card { background: var(--bg-surface); border: 2px solid var(--border); border-radius: 10px; padding: 16px 14px; text-align: center; cursor: pointer; transition: all 0.15s; }
.wizard-connector-card:hover { border-color: var(--accent); background: var(--bg-surface-hover); }
.wizard-connector-card.selected { border-color: var(--accent); background: var(--accent-soft); }
.wizard-connector-card[data-type="__custom__"] { border-style: dashed; }
.wizard-connector-card[data-type="__custom__"].selected { border-style: solid; }
.wcc-icon { font-size: 24px; margin-bottom: 6px; }
.wcc-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.wcc-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.wizard-ops-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.wizard-checkbox { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 6px; font-size: 13px; color: var(--text-secondary); cursor: pointer; transition: background 0.12s; }
.wizard-checkbox:hover { background: var(--bg-surface-hover); color: var(--text-primary); }
.wizard-checkbox input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }

/* ─── Workflow Progress Guide ─── */
.wf-progress { display: flex; align-items: flex-start; gap: 0; overflow-x: auto; padding: 16px 4px 8px; }
.wf-step { display: flex; flex-direction: column; align-items: center; min-width: 80px; position: relative; cursor: pointer; transition: transform 0.15s; }
.wf-step:hover { transform: translateY(-2px); }
.wf-step:hover .wf-circle { box-shadow: 0 2px 8px rgba(59,130,246,0.25); }
.wf-step:active { transform: translateY(0); }
.wf-circle { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; border: 2px solid var(--border); background: var(--bg-surface); color: var(--text-muted); transition: all 0.2s; }
.wf-label { font-size: 12px; color: var(--text-secondary); text-align: center; margin-top: 6px; max-width: 90px; line-height: 1.3; }
.wf-connector-line { flex: 1; min-width: 16px; height: 2px; background: var(--border); margin-top: 16px; align-self: flex-start; }
.wf-done .wf-circle { background: var(--success, #22c55e); border-color: var(--success, #22c55e); color: #fff; }
.wf-done .wf-label { color: var(--success, #22c55e); font-weight: 600; }
.wf-done ~ .wf-connector-line { background: var(--success, #22c55e); }
.wf-current .wf-circle { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 0 0 4px var(--accent-soft); }
.wf-current .wf-label { color: var(--accent); font-weight: 600; }
.wf-available .wf-circle { border-color: var(--accent); color: var(--accent); background: var(--accent-soft, rgba(59,130,246,0.1)); }
.wf-available .wf-label { color: var(--text-secondary); }
.wf-pending .wf-circle { opacity: 0.5; }
.wf-pending .wf-label { opacity: 0.5; }

/* ─── Responsive ─── */
@media (max-width: 800px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .hero { flex-direction: column; align-items: flex-start; gap: 16px; }
  .content { padding: 20px; }
  .editor-layout { grid-template-columns: 1fr; }
  .editor-tree { display: none; }
  .wizard-connector-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Health check rows — clickable navigation */
.health-check-row:hover {
  background: var(--bg-surface-hover);
  padding-left: 4px;
  transition: background 0.15s, padding-left 0.15s;
}
.health-check-row:active {
  background: var(--accent-soft);
}

/* ═══════════════════════════════════════════════════════════
   Test Lab
   ═══════════════════════════════════════════════════════════ */
.testlab-container { display: flex; flex-direction: column; gap: 16px; }
.testlab-header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 20px; background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.testlab-section {
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
.testlab-section-title {
  font-size: 13px; font-weight: 600; color: var(--text-primary);
  padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer;
  user-select: none;
}
.testlab-params-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 8px; padding: 12px 16px;
}
.testlab-param-row {
  display: flex; align-items: center; gap: 8px;
}
.testlab-param-label {
  font-size: 12px; font-weight: 500; color: var(--text-secondary); min-width: 140px;
  font-family: 'JetBrains Mono', 'Cascadia Code', monospace; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.testlab-param-input, .testlab-entry-input {
  flex: 1; background: var(--bg-input); border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 10px; color: var(--text-primary); font-size: 12px;
  font-family: 'JetBrains Mono', 'Cascadia Code', monospace;
}
.testlab-param-input:focus, .testlab-entry-input:focus {
  border-color: var(--accent); outline: none; box-shadow: 0 0 0 2px var(--accent-soft);
}

/* Operation Cards */
.testlab-ops-grid { display: flex; flex-direction: column; }
.testlab-op-card {
  border-bottom: 1px solid var(--border-light);
}
.testlab-op-card:last-child { border-bottom: none; }
.testlab-op-header {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px; cursor: pointer;
  transition: background 0.15s;
}
.testlab-op-header:hover { background: var(--bg-surface-hover); }
.testlab-op-icon { font-size: 18px; }
.testlab-op-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.testlab-op-info strong { font-size: 13px; }
.testlab-op-chevron {
  font-size: 14px; color: var(--text-muted); transition: transform 0.2s;
}
.testlab-op-body {
  padding: 0 16px 16px 46px;
}
.testlab-entry-fields {
  background: var(--bg-base); border: 1px solid var(--border-light); border-radius: 8px;
  padding: 12px 16px;
}
.testlab-entry-fields .testlab-param-row { margin-bottom: 6px; }

/* Log Container */
.testlab-log-container {
  max-height: 400px; overflow-y: auto; background: #0d0d0d;
  border-top: 1px solid var(--border);
  scroll-behavior: smooth;
}
[data-theme="light"] .testlab-log-container { background: #f8f9fa; }
.testlab-log {
  padding: 12px 16px; font-family: 'JetBrains Mono', 'Cascadia Code', 'Consolas', monospace;
  font-size: 11.5px; line-height: 1.7; white-space: pre-wrap; word-break: break-all;
  min-height: 100px;
}
.testlab-log-status {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 16px; border-top: 1px solid var(--border); font-size: 11px;
  color: var(--text-muted); background: var(--bg-surface);
}

/* Log line colors — Dark theme */
.log-error { color: #f87171; }
.log-warn { color: #fbbf24; }
.log-success { color: #4ade80; font-weight: 600; }
.log-info { color: #60a5fa; }
.log-script { color: #34d399; }
.log-debug { color: #6b7280; }
.log-timestamp { color: #9ca3af; }
.log-default { color: #d1d5db; }
.log-noise { color: #374151; font-size: 10px; }

/* Log line colors — Light theme */
[data-theme="light"] .log-error { color: #dc2626; }
[data-theme="light"] .log-warn { color: #d97706; }
[data-theme="light"] .log-success { color: #16a34a; font-weight: 600; }
[data-theme="light"] .log-info { color: #2563eb; }
[data-theme="light"] .log-script { color: #059669; }
[data-theme="light"] .log-debug { color: #9ca3af; }
[data-theme="light"] .log-timestamp { color: #6b7280; }
[data-theme="light"] .log-default { color: #374151; }
[data-theme="light"] .log-noise { color: #d1d5db; font-size: 10px; }

/* Result badges */
.testlab-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: 10px; font-size: 11px; font-weight: 600;
}
.testlab-badge-success { background: rgba(34,197,94,0.15); color: #4ade80; }
.testlab-badge-warn { background: rgba(234,179,8,0.15); color: #facc15; }
.testlab-badge-error { background: rgba(239,68,68,0.15); color: #f87171; }
[data-theme="light"] .testlab-badge-success { background: rgba(22,163,74,0.12); color: #16a34a; }
[data-theme="light"] .testlab-badge-warn { background: rgba(217,119,6,0.12); color: #d97706; }
[data-theme="light"] .testlab-badge-error { background: rgba(220,38,38,0.12); color: #dc2626; }
