:root {
  --bg: #0F0F0F;
  --bg-1: #141414;
  --card: #1A1A1A;
  --card-2: #222222;
  --line: #262626;
  --line-2: #303030;
  --text: #EDEDED;
  --text-dim: #A0A0A0;
  --text-mute: #6B6B6B;
  --primary: #6366F1;
  --primary-2: #8B5CF6;
  --primary-soft: rgba(99, 102, 241, 0.12);
  --primary-ring: rgba(99, 102, 241, 0.32);
  --success: #22C55E;
  --warn: #F59E0B;
  --danger: #EF4444;
  --gradient: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
  --gradient-soft: linear-gradient(135deg, rgba(99,102,241,0.16) 0%, rgba(139,92,246,0.16) 100%);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.005em;
}
.mono { font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace; }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea { font-family: inherit; }

/* ---------- App shell ---------- */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Prototype switcher */
.proto-switch {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  background: rgba(26,26,26,0.85);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  padding: 5px;
  border-radius: 999px;
  z-index: 100;
  box-shadow: 0 12px 40px rgba(0,0,0,0.6);
  font-size: 12px;
}
.proto-switch button {
  padding: 7px 14px;
  border-radius: 999px;
  color: var(--text-dim);
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: all 0.15s ease;
}
.proto-switch button:hover { color: var(--text); }
.proto-switch button.active {
  background: var(--gradient);
  color: white;
  box-shadow: 0 4px 12px rgba(99,102,241,0.4);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn-primary {
  background: var(--gradient);
  color: white;
  box-shadow: 0 1px 0 rgba(255,255,255,0.08) inset, 0 6px 20px rgba(99,102,241,0.28);
}
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 1px 0 rgba(255,255,255,0.1) inset, 0 8px 24px rgba(99,102,241,0.42); }
.btn-ghost {
  color: var(--text);
  background: transparent;
}
.btn-ghost:hover { background: var(--card); }
.btn-secondary {
  color: var(--text);
  background: var(--card-2);
  border-color: var(--line-2);
}
.btn-secondary:hover { background: #2a2a2a; border-color: #3a3a3a; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 6px; }
.btn-lg { padding: 13px 22px; font-size: 15px; border-radius: 10px; }
.btn-danger-ghost {
  color: #F87171;
}
.btn-danger-ghost:hover { background: rgba(239,68,68,0.1); }

/* ---------- Nav ---------- */
.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 40px;
  border-bottom: 1px solid transparent;
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
  background: rgba(15,15,15,0.75);
}
.topnav.scrolled { border-bottom-color: var(--line); }
.nav-links {
  display: flex;
  gap: 28px;
  font-size: 14px;
  color: var(--text-dim);
}
.nav-links a { cursor: pointer; transition: color 0.15s; }
.nav-links a:hover { color: var(--text); }

/* ---------- Logo ---------- */
.logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.02em;
  color: var(--text);
  cursor: pointer;
}
.logo-mark {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--gradient);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 13px;
  box-shadow: 0 2px 8px rgba(99,102,241,0.4);
  position: relative;
  overflow: hidden;
}
.logo-mark svg { display: block; }

/* ---------- Layout ---------- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 40px; }

/* ---------- Landing ---------- */
.hero {
  padding: 100px 0 80px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--text-dim);
  margin-bottom: 24px;
}
.hero-eyebrow .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #22C55E;
  box-shadow: 0 0 0 3px rgba(34,197,94,0.2);
}
.hero h1 {
  font-size: 68px;
  line-height: 1.02;
  letter-spacing: -0.035em;
  font-weight: 600;
  margin: 0 0 20px;
  text-wrap: balance;
}
.hero h1 .grad {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p.sub {
  font-size: 19px;
  color: var(--text-dim);
  max-width: 640px;
  margin: 0 auto 36px;
  line-height: 1.55;
  text-wrap: pretty;
}
.hero-ctas {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
}
.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(ellipse 60% 40% at 50% 0%, rgba(99,102,241,0.15), transparent 70%),
    radial-gradient(ellipse 40% 30% at 70% 20%, rgba(139,92,246,0.1), transparent 70%);
}
.hero-bg-grid {
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, black, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, black, transparent 80%);
}

/* Paths */
.paths {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 80px;
}
.path-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
  transition: border-color 0.2s, transform 0.2s;
  position: relative;
  overflow: hidden;
}
.path-card:hover { border-color: var(--line-2); }
.path-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 10px;
}
.path-card h3 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}
.path-card p.lede {
  color: var(--text-dim);
  font-size: 14.5px;
  margin: 0 0 20px;
  line-height: 1.5;
}

/* Terminal / code */
.terminal {
  background: #0a0a0a;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  overflow: hidden;
}
.terminal-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  background: #0f0f0f;
}
.terminal-head .dots { display: flex; gap: 5px; }
.terminal-head .dots span { width: 9px; height: 9px; border-radius: 50%; background: #333; }
.terminal-head .dots span:nth-child(1) { background: #FF5F57; }
.terminal-head .dots span:nth-child(2) { background: #FEBC2E; }
.terminal-head .dots span:nth-child(3) { background: #28C840; }
.terminal-head .title { font-size: 11.5px; color: var(--text-mute); margin-left: auto; letter-spacing: 0.02em; }
.terminal-body { padding: 14px 16px; line-height: 1.7; color: #D4D4D4; }
.terminal-body .prompt { color: var(--primary); }
.terminal-body .c1 { color: #C586C0; } /* keyword */
.terminal-body .c2 { color: #9CDCFE; } /* var */
.terminal-body .c3 { color: #CE9178; } /* string */
.terminal-body .c4 { color: #DCDCAA; } /* function */
.terminal-body .c5 { color: #6A9955; font-style: italic; } /* comment */
.terminal-body .c6 { color: #B5CEA8; } /* number */
.terminal-body .dim { color: var(--text-mute); }

/* Install tabs */
.install-tabs {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: #0a0a0a;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 12px;
  width: fit-content;
}
.install-tabs button {
  padding: 5px 11px;
  border-radius: 5px;
  font-size: 12px;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
}
.install-tabs button.active { background: var(--card-2); color: var(--text); }

/* Chat preview */
.chat-preview {
  background: #0a0a0a;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.chat-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #0f0f0f;
  font-size: 12px;
  color: var(--text-mute);
}
.chat-head .brand-dot {
  width: 18px; height: 18px; border-radius: 5px;
  background: linear-gradient(135deg, #D97757, #B85A3B);
  display: inline-flex; align-items: center; justify-content: center;
  color: white; font-size: 10px; font-weight: 700;
}
.chat-body { padding: 14px 14px 4px; font-size: 13px; line-height: 1.55; display: flex; flex-direction: column; gap: 12px; }
.chat-msg { display: flex; gap: 10px; }
.chat-msg .avatar { flex: 0 0 22px; height: 22px; border-radius: 50%; font-size: 10px; display: flex; align-items: center; justify-content: center; font-weight: 600; }
.chat-msg.user .avatar { background: #333; color: var(--text); }
.chat-msg.ai .avatar { background: linear-gradient(135deg, #D97757, #B85A3B); color: white; }
.chat-msg .bubble { color: var(--text); flex: 1; }
.chat-msg.user .bubble { color: var(--text-dim); }
.tool-card {
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line-2);
  background: var(--card-2);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
}
.tool-card .tool-icon {
  width: 26px; height: 26px; border-radius: 6px;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 11px;
}
.tool-card .tool-meta { flex: 1; }
.tool-card .tool-name { font-weight: 500; font-size: 12.5px; color: var(--text); }
.tool-card .tool-sub { font-size: 11.5px; color: var(--text-mute); margin-top: 1px; }
.chat-input {
  margin: 8px 10px 10px;
  padding: 9px 12px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  font-size: 12.5px;
  color: var(--text-mute);
  display: flex;
  align-items: center;
  gap: 8px;
}
.chat-input .caret {
  width: 1px; height: 14px; background: var(--text-dim);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* Feature strip */
.strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  padding: 80px 0 40px;
  border-top: 1px solid var(--line);
  margin-top: 100px;
}
.strip .cell h4 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}
.strip .cell p {
  font-size: 13px;
  color: var(--text-dim);
  margin: 0;
  line-height: 1.55;
}
.strip .cell .ico {
  width: 28px; height: 28px;
  border-radius: 7px;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}

/* Footer */
.footer {
  border-top: 1px solid var(--line);
  padding: 32px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-mute);
  font-size: 13px;
  margin-top: 80px;
}
.footer-links { display: flex; gap: 22px; }
.footer-links a { cursor: pointer; transition: color 0.15s; }
.footer-links a:hover { color: var(--text); }

/* ---------- Auth ---------- */
.auth-wrap {
  min-height: calc(100vh - 0px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  position: relative;
  overflow: hidden;
}
.auth-wrap .hero-bg, .auth-wrap .hero-bg-grid { z-index: 0; }
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px;
  position: relative;
  z-index: 1;
  box-shadow: 0 24px 80px rgba(0,0,0,0.4);
}
.auth-logo { display: flex; justify-content: center; margin-bottom: 20px; }
.auth-h1 { text-align: center; font-size: 22px; font-weight: 600; margin: 0 0 4px; letter-spacing: -0.02em; }
.auth-sub { text-align: center; color: var(--text-dim); font-size: 14px; margin: 0 0 24px; }

.tabs {
  display: flex;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 22px;
}
.tabs button {
  flex: 1;
  padding: 8px 0;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-dim);
  transition: all 0.15s;
}
.tabs button.active {
  background: var(--card-2);
  color: var(--text);
  box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset;
}

.oauth-row { display: flex; flex-direction: column; gap: 9px; margin-bottom: 20px; }
.oauth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--line-2);
  transition: all 0.15s;
}
.oauth-btn.github { background: #111; color: #fff; }
.oauth-btn.github:hover { background: #1c1c1c; border-color: #3a3a3a; }
.oauth-btn.google { background: #fff; color: #111; border-color: #e3e3e3; }
.oauth-btn.google:hover { background: #f5f5f5; }

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--text-mute);
  font-size: 12px;
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-1);
  border: 1px solid var(--line-2);
  border-radius: 9px;
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.input::placeholder { color: var(--text-mute); }
.field-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.field-row label { margin-bottom: 0; }
.link { color: var(--primary); font-size: 12.5px; cursor: pointer; }
.link:hover { text-decoration: underline; }
.auth-submit { width: 100%; padding: 11px; margin-top: 6px; }
.auth-foot { text-align: center; margin-top: 18px; font-size: 13px; color: var(--text-dim); }

/* ---------- App shell with sidebar ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px;
  flex-shrink: 0;
  border-right: 1px solid var(--line);
  background: #0C0C0C;
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-head { padding: 6px 10px 18px; }
.sidebar-section {
  padding: 14px 10px 6px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 13.5px;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.1s;
}
.sidebar-item:hover { background: var(--card); color: var(--text); }
.sidebar-item.active { background: var(--primary-soft); color: var(--text); }
.sidebar-item.active .sb-ico { color: var(--primary); }
.sb-ico { width: 16px; height: 16px; color: var(--text-mute); display: flex; align-items: center; justify-content: center; }
.sb-count {
  margin-left: auto;
  font-size: 11px;
  background: var(--card-2);
  color: var(--text-dim);
  padding: 1px 7px;
  border-radius: 999px;
}
.sidebar-foot {
  margin-top: auto;
  padding: 10px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar-circ {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, #6366F1, #8B5CF6);
  color: white; font-size: 11px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-foot .meta { flex: 1; min-width: 0; }
.sidebar-foot .name { font-size: 13px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot .email { font-size: 11.5px; color: var(--text-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { flex: 1; min-width: 0; }
.main-head {
  padding: 24px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: rgba(15,15,15,0.85); backdrop-filter: blur(12px);
  z-index: 10;
}
.main-head h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
}
.main-head .sub {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 2px;
}
.main-body { padding: 32px 40px; }

/* Breadcrumb */
.crumb { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-mute); margin-bottom: 4px; }
.crumb .sep { opacity: 0.5; }

/* ---------- API Keys ---------- */
.new-key-box {
  background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(139,92,246,0.05));
  border: 1px solid var(--primary-ring);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
}
.new-key-box .warn-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: #FBBF24;
  margin-bottom: 12px;
}
.new-key-box .warn-icon {
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(245,158,11,0.15);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.new-key-box h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}
.new-key-box p.desc {
  font-size: 13px;
  color: var(--text-dim);
  margin: 0 0 14px;
}
.key-display {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #0a0a0a;
  border: 1px solid var(--line-2);
  border-radius: 9px;
  padding: 10px 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
}
.key-display .key-val { flex: 1; color: var(--text); overflow: hidden; text-overflow: ellipsis; }
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--card-2);
  border: 1px solid var(--line-2);
  font-size: 12px;
  color: var(--text);
  transition: all 0.15s;
}
.copy-btn:hover { background: #2a2a2a; }
.copy-btn.copied { color: #4ADE80; border-color: rgba(74,222,128,0.3); background: rgba(34,197,94,0.1); }

/* Table */
.table-wrap {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.table th {
  text-align: left;
  padding: 12px 18px;
  font-weight: 500;
  font-size: 11.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-mute);
  background: var(--bg-1);
  border-bottom: 1px solid var(--line);
}
.table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(255,255,255,0.015); }
.table .mono { font-size: 12.5px; color: var(--text-dim); }

/* Toggle */
.toggle {
  width: 30px; height: 18px;
  border-radius: 999px;
  background: #333;
  position: relative;
  transition: background 0.18s;
  cursor: pointer;
  display: inline-block;
}
.toggle::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  background: #ededed;
  border-radius: 50%;
  transition: transform 0.18s;
}
.toggle.on { background: var(--primary); }
.toggle.on::after { transform: translateX(12px); }

/* Status pill */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
}
.pill .pdot { width: 6px; height: 6px; border-radius: 50%; }
.pill.active { background: rgba(34,197,94,0.12); color: #4ADE80; }
.pill.active .pdot { background: #4ADE80; box-shadow: 0 0 0 3px rgba(74,222,128,0.15); }
.pill.revoked { background: rgba(239,68,68,0.1); color: #F87171; }
.pill.revoked .pdot { background: #F87171; }
.pill.idle { background: var(--card-2); color: var(--text-dim); }
.pill.idle .pdot { background: var(--text-mute); }

/* ---------- Dashboard cards ---------- */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 18px;
}
.section-head h2 {
  font-size: 17px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}
.section-head .subtle {
  font-size: 12.5px;
  color: var(--text-mute);
}
.apps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.app-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s, transform 0.15s;
  min-height: 180px;
}
.app-card:hover { border-color: var(--line-2); }
.app-icon {
  width: 38px; height: 38px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  margin-bottom: 14px;
}
.app-card h4 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 5px;
  letter-spacing: -0.01em;
}
.app-card p.dsc {
  font-size: 12.5px;
  color: var(--text-dim);
  margin: 0 0 auto;
  line-height: 1.5;
}
.app-card .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  gap: 8px;
}
.app-card a.open {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
}
.app-card a.open:hover { color: var(--primary); }
.app-card .chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 6px;
  background: var(--card-2);
  border: 1px solid var(--line-2);
  font-size: 11.5px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
}
.app-card .chip-btn:hover { border-color: var(--primary-ring); color: var(--primary); }
.app-empty {
  border: 1px dashed var(--line-2);
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text-dim);
}
.app-empty:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.app-empty .plus {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px dashed currentColor;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}

/* Workflows table */
.wf-table { margin-top: 40px; }
.wf-row-name { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.wf-row-name .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--primary);
}

/* ---------- Workflow Viewer ---------- */
.wf-viewer { height: 100vh; display: flex; flex-direction: column; background: #0a0a0a; }
.wf-topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-1);
  flex-shrink: 0;
  min-height: 58px;
}
.wf-topbar .back {
  width: 32px; height: 32px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s;
}
.wf-topbar .back:hover { background: var(--card); color: var(--text); }
.wf-title {
  font-size: 15px; font-weight: 500;
  background: transparent; border: 1px solid transparent;
  color: var(--text);
  padding: 6px 10px; border-radius: 7px;
  min-width: 240px;
  letter-spacing: -0.01em;
}
.wf-title:hover { background: var(--card); }
.wf-title:focus { outline: none; background: var(--card-2); border-color: var(--line-2); }
.wf-topbar .sep { width: 1px; height: 20px; background: var(--line-2); }
.wf-topbar .spacer { flex: 1; }
.wf-saved { font-size: 12px; color: var(--text-mute); display: flex; align-items: center; gap: 6px; }
.wf-canvas {
  flex: 1;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 30%, rgba(99,102,241,0.06), transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(139,92,246,0.05), transparent 40%),
    #0a0a0a;
}
.wf-canvas::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,0.08) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: 12px 12px;
  opacity: 0.5;
}
.wf-nodes {
  position: absolute;
  inset: 0;
}
.wf-node {
  position: absolute;
  background: #161616;
  border: 1px solid var(--line-2);
  border-radius: 11px;
  padding: 12px 14px;
  min-width: 180px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
}
.wf-node:hover { border-color: #444; transform: translateY(-1px); }
.wf-node.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring), 0 10px 28px rgba(99,102,241,0.2);
  background: #1a1a22;
}
.wf-node .node-row-top {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 6px;
}
.wf-node .node-icon {
  width: 24px; height: 24px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 12px;
}
.wf-node .node-title {
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text);
  flex: 1;
}
.wf-node .node-badge {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--card-2);
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
}
.wf-node .node-sub {
  font-size: 11.5px;
  color: var(--text-mute);
  font-family: 'JetBrains Mono', monospace;
  margin-top: 2px;
}
.wf-node .port {
  position: absolute;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #222;
  border: 2px solid #0a0a0a;
  top: 50%;
  transform: translateY(-50%);
}
.wf-node.selected .port { background: var(--primary); }
.wf-node .port.in { left: -5px; }
.wf-node .port.out { right: -5px; }

.wf-edges { position: absolute; inset: 0; pointer-events: none; }

.wf-detail {
  position: absolute;
  top: 12px; right: 12px; bottom: 12px;
  width: 360px;
  background: rgba(20,20,20,0.92);
  backdrop-filter: blur(20px);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: auto;
  box-shadow: 0 24px 70px rgba(0,0,0,0.5);
}
.wf-detail .dt-head {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
}
.wf-detail .dt-head .dt-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: white;
}
.wf-detail .dt-head .dt-meta { flex: 1; min-width: 0; }
.wf-detail .dt-head h3 { font-size: 15px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.wf-detail .dt-head .dt-type { font-size: 11.5px; color: var(--text-mute); font-family: 'JetBrains Mono', monospace; margin-top: 2px; }
.wf-detail .dt-head .close-btn {
  width: 26px; height: 26px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-mute);
}
.wf-detail .dt-head .close-btn:hover { background: var(--card); color: var(--text); }
.wf-detail .dt-body { padding: 16px 20px; }
.wf-detail .dt-section { margin-bottom: 18px; }
.wf-detail .dt-section h4 {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin: 0 0 8px;
}
.schema-field {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 8px 10px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  margin-bottom: 5px;
}
.schema-field .k { color: var(--text); }
.schema-field .t { color: var(--primary); font-size: 11px; }

.triplet {
  background: #0a0a0a;
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}
.triplet .trow {
  display: grid;
  grid-template-columns: 80px 1fr;
  border-bottom: 1px solid var(--line);
}
.triplet .trow:last-child { border-bottom: none; }
.triplet .tkey {
  padding: 8px 10px;
  background: rgba(255,255,255,0.02);
  color: var(--text-mute);
  border-right: 1px solid var(--line);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
}
.triplet .tval {
  padding: 8px 10px;
  color: var(--text);
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 12px;
  width: 100%;
}
.triplet .tval:focus { outline: none; background: rgba(99,102,241,0.06); }

.wf-edit-in-claude {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 13px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  background: var(--gradient);
  color: white;
  box-shadow: 0 4px 14px rgba(99,102,241,0.35);
  transition: all 0.15s;
}
.wf-edit-in-claude:hover { filter: brightness(1.08); }

.wf-minimap {
  position: absolute;
  bottom: 12px; left: 12px;
  width: 180px; height: 110px;
  background: rgba(20,20,20,0.9);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  backdrop-filter: blur(10px);
  overflow: hidden;
}
.wf-minimap .mini-label { font-size: 10px; color: var(--text-mute); letter-spacing: 0.06em; text-transform: uppercase; position: absolute; top: 6px; left: 10px; }
.wf-minimap .mini-box {
  position: absolute;
  background: var(--primary-soft);
  border: 1px solid var(--primary-ring);
  border-radius: 3px;
}

.wf-controls {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 3px;
  padding: 4px;
  background: rgba(20,20,20,0.9);
  border: 1px solid var(--line);
  border-radius: 8px;
  backdrop-filter: blur(12px);
}
.wf-controls button {
  width: 30px; height: 30px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim);
  font-size: 13px;
}
.wf-controls button:hover { background: var(--card); color: var(--text); }
.wf-controls .zoom-val { padding: 0 10px; font-size: 11.5px; color: var(--text-dim); display: flex; align-items: center; font-family: 'JetBrains Mono', monospace; }

.wf-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-mute);
}
.wf-breadcrumb .cr { color: var(--text-dim); cursor: pointer; }
.wf-breadcrumb .cr:hover { color: var(--text); }

/* Utilities */
.sp-4 { height: 4px; } .sp-8 { height: 8px; } .sp-16 { height: 16px; } .sp-24 { height: 24px; } .sp-32 { height: 32px; }
.flex { display: flex; } .flex-center { display: flex; align-items: center; }
.gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.muted { color: var(--text-mute); }
.dim { color: var(--text-dim); }
