/* Agent Builder Studio styles: responsive, dark/light aware, zero-build plain CSS. */
:root {
  color-scheme: dark light;
  --bg: #090d16;
  --bg-soft: #0f172a;
  --card: rgba(15, 23, 42, 0.82);
  --ink: #e2e8f0;
  --muted: #94a3b8;
  --line: rgba(51, 65, 85, 0.72);
  --accent: #14b8a6;
  --accent-ink: #042f2e;
  --allow: #10b981;
  --deny: #f43f5e;
  --code-bg: #05080f;
  --code-ink: #e2e8f0;
  --radius: 12px;
}

body[data-theme="light"] {
  --bg: #f8fafc;
  --bg-soft: #f1f5f9;
  --card: rgba(255, 255, 255, 0.94);
  --ink: #0f172a;
  --muted: #475569;
  --line: #cbd5e1;
  --accent: #0d9488;
  --accent-ink: #ffffff;
  --code-bg: #0f172a;
  --code-ink: #f1f5f9;
}

body[data-theme="dark"] {
  --bg: #090d16;
  --bg-soft: #0f172a;
  --card: rgba(15, 23, 42, 0.82);
  --ink: #e2e8f0;
  --muted: #94a3b8;
  --line: rgba(51, 65, 85, 0.72);
  --accent: #14b8a6;
  --accent-ink: #042f2e;
  --code-bg: #05080f;
  --code-ink: #e2e8f0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--ink);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}

code, pre, .font-mono {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(15, 23, 42, 0.5); }
::-webkit-scrollbar-thumb { background: rgba(71, 85, 105, 0.75); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(100, 116, 139, 0.95); }

.glass-panel {
  background: var(--card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.input-field {
  background: rgba(9, 13, 22, 0.85);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

body[data-theme="light"] .input-field {
  background: #ffffff;
  color: #0f172a;
}

.input-field:focus {
  outline: none;
  border-color: #2dd4bf;
  box-shadow: 0 0 0 2px rgba(45, 212, 191, 0.18);
}

.tab-active, .preview-tab.active {
  background: rgba(20, 184, 166, 0.16);
  color: #2dd4bf;
  border-color: rgba(45, 212, 191, 0.45);
}

.muted { color: var(--muted); font-size: 0.82rem; }

/* Category Tree */
.category-tree ul { list-style: none; margin: 0; padding-left: 0.75rem; }
.category-tree > ul { padding-left: 0; }
.category-tree button {
  border: none;
  background: transparent;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  text-align: left;
  width: 100%;
  color: var(--ink);
  font-size: 0.78rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.12s ease, color 0.12s ease;
}
.category-tree button:hover {
  background: rgba(30, 41, 59, 0.75);
}
.category-tree button.active {
  background: rgba(20, 184, 166, 0.16);
  color: #2dd4bf;
  font-weight: 600;
  border-left: 2px solid #2dd4bf;
}

/* Cards container reserves layout space to bound registry-pop-in CLS */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(265px, 1fr));
  gap: 0.75rem;
  min-height: 200px;
}

.entry-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.85rem;
  background: rgba(9, 13, 22, 0.75);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: border-color 0.15s ease, transform 0.12s ease;
}
body[data-theme="light"] .entry-card {
  background: #ffffff;
}
.entry-card:hover {
  border-color: rgba(45, 212, 191, 0.5);
}
.entry-card.selected-card {
  border-color: rgba(20, 184, 166, 0.75);
  background: rgba(20, 184, 166, 0.06);
}
.entry-card h3 {
  margin: 0 0 0.25rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: #f8fafc;
}
body[data-theme="light"] .entry-card h3 { color: #0f172a; }
.entry-card .tagline {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0 0 0.55rem;
}
.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.65rem;
}
.badge {
  font-size: 0.68rem;
  font-family: 'JetBrains Mono', monospace;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.08rem 0.48rem;
  background: rgba(30, 41, 59, 0.7);
  color: #cbd5e1;
  cursor: pointer;
  transition: border-color 0.12s ease, color 0.12s ease, background 0.12s ease;
}
.badge:hover {
  border-color: #2dd4bf;
  color: #2dd4bf;
  background: rgba(20, 184, 166, 0.15);
}
body[data-theme="light"] .badge {
  background: #f1f5f9;
  color: #334155;
}
.badge.kind-mcp-server { border-color: rgba(45, 212, 191, 0.45); color: #5eead4; }
.badge.kind-skill { border-color: rgba(56, 189, 248, 0.45); color: #7dd3fc; }
.badge.kind-plugin { border-color: rgba(168, 85, 247, 0.45); color: #d8b4fe; }
.badge.kind-design-md { border-color: rgba(244, 114, 182, 0.45); color: #f9a8d4; }
.badge.kind-prompt { border-color: rgba(251, 191, 36, 0.45); color: #fde047; }
.badge.kind-agent { border-color: rgba(52, 211, 153, 0.55); color: #6ee7b7; }

.dropzone {
  border: 2px dashed var(--line);
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone:hover, .dropzone.dragover {
  border-color: #2dd4bf;
  background: rgba(20, 184, 166, 0.06);
}

/* Keep the native file control at least 24px tall (WCAG target-size). */
#fileInput { min-height: 24px; font-size: 0.78rem; }

.selected-list li {
  border: 1px solid rgba(45, 212, 191, 0.35);
  border-radius: 999px;
  padding: 0.2rem 0.45rem 0.2rem 0.75rem;
  font-size: 0.76rem;
  background: rgba(15, 23, 42, 0.9);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.selected-list button {
  border: none;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  padding: 0.1rem 0.3rem;
}
.selected-list button:hover { color: #fb7185; }

/* Scoping Matrix */
.scope-server {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.9rem;
  margin-bottom: 0.75rem;
  background: rgba(9, 13, 22, 0.7);
}
.scope-server h3 {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #f8fafc;
}
.tool-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.85rem;
  margin-bottom: 0.5rem;
}
.tool-grid label {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  font-size: 0.78rem;
  margin: 0;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(51, 65, 85, 0.65);
  cursor: pointer;
}
.tool-grid code { font-size: 0.75rem; }
.denied { text-decoration: line-through; color: var(--deny); }

.sim-result {
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  padding: 0.38rem 0.75rem;
  border-radius: 8px;
}
.sim-result.allow {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}
.sim-result.deny {
  background: rgba(244, 63, 94, 0.18);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.4);
}

.preview .k { color: #79c0ff; }
.preview .s { color: #5eead4; }
.preview .c { color: #64748b; }

/* Drawer: intentionally sets NO display property so UA [hidden] hiding applies */
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(440px, 100vw);
  height: 100vh;
  overflow: auto;
  background: #0b1120;
  border-left: 1px solid var(--line);
  padding: 1.25rem;
  box-shadow: -12px 0 32px rgba(0, 0, 0, 0.5);
  z-index: 40;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.78);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 1rem;
}
/* Must remain for stage4.test.js: overrides display:flex when [hidden] is present */
.modal-backdrop[hidden] { display: none; }

.modal {
  background: #0f172a;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  max-width: 680px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.6);
}
