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

:root {
  --bg: #090d16;
  --bg-soft: #0f172a;
  --bg-card: rgba(15, 23, 42, 0.75);
  --bg-card-hover: rgba(30, 41, 59, 0.85);
  --border: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(56, 189, 248, 0.3);
  --text: #f8fafc;
  --muted: #94a3b8;
  --primary: #38bdf8;
  --primary-soft: rgba(56, 189, 248, 0.12);
  --primary-gradient: linear-gradient(135deg, #38bdf8 0%, #818cf8 100%);
  --green: #34d399;
  --green-soft: rgba(52, 211, 153, 0.12);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.12);
  --red: #f87171;
  --red-soft: rgba(248, 113, 113, 0.12);
  --radius: 16px;
  --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5), 0 0 20px rgba(56, 189, 248, 0.05);
  --shadow-glow: 0 0 25px rgba(56, 189, 248, 0.2);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(56, 189, 248, 0.08) 0%, transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(129, 140, 248, 0.08) 0%, transparent 45%);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* TOPBAR */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  background: rgba(9, 13, 22, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  font-size: 24px;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.4));
}

.topbar h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #fff;
}

.sub {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* BADGES */
.badge {
  font-size: 12px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.3px;
}

.badge.ok {
  background: var(--green-soft);
  color: var(--green);
  border: 1px solid rgba(52, 211, 153, 0.3);
  box-shadow: 0 0 12px rgba(52, 211, 153, 0.2);
}

.badge.warn {
  background: var(--amber-soft);
  color: var(--amber);
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.badge.err {
  background: var(--red-soft);
  color: var(--red);
  border: 1px solid rgba(248, 113, 113, 0.3);
}

/* BUTTONS */
.btn {
  border: 1px solid var(--border);
  background: rgba(30, 41, 59, 0.6);
  color: var(--text);
  padding: 9px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn:hover {
  background: rgba(51, 65, 85, 0.8);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.btn.primary {
  background: var(--primary-gradient);
  color: #fff;
  border: none;
  box-shadow: 0 4px 15px rgba(56, 189, 248, 0.3);
}

.btn.primary:hover {
  box-shadow: 0 6px 20px rgba(56, 189, 248, 0.5);
  transform: translateY(-1px);
}

.btn.ghost {
  background: transparent;
  border-color: var(--border);
}

.btn.ghost:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* TABS */
.tabs {
  display: flex;
  gap: 6px;
  padding: 12px 32px;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: thin;
}

.tab {
  border: none;
  background: transparent;
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-radius: 10px;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.tab:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.tab.active {
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid var(--border-highlight);
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.15);
}

/* MAIN CONTAINER */
main {
  padding: 28px 32px;
  max-width: 1280px;
  margin: 0 auto;
}

.view {
  display: none;
  animation: fade .25s ease-out;
}

.view.active {
  display: block;
}

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

/* CARDS & METRICS */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  transition: all 0.25s ease;
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.card h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 14px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.metric {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: all 0.2s ease;
}

.metric:hover {
  border-color: var(--border-highlight);
  transform: translateY(-2px);
}

.metric .num {
  font-family: 'Outfit', sans-serif;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -1px;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.metric .lbl {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 500;
}

/* AGENT CARD */
.agent {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.25s ease;
}

.agent:hover {
  border-color: var(--border-highlight);
  transform: translateY(-2px);
  box-shadow: var(--shadow), var(--shadow-glow);
}

.agent .head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.agent .name {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 17px;
  color: #fff;
}

.agent .cat {
  font-size: 10.5px;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
}

.pill {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.5px;
}

.pill.on {
  background: var(--green-soft);
  color: var(--green);
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.pill.off {
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  border: 1px solid var(--border);
}

.agent .desc {
  font-size: 13px;
  color: var(--muted);
}

.agent .actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

/* PIPELINE VISUALIZER */
.pipeline {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.node {
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid var(--border-highlight);
  font-weight: 700;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.1);
}

.arrow {
  color: var(--muted);
  font-size: 20px;
  font-weight: 700;
}

.exec-channels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.chan {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  transition: all 0.2s ease;
}

.chan:hover {
  border-color: var(--border-highlight);
}

.chan .nm {
  font-weight: 700;
  text-transform: capitalize;
  font-size: 14px;
  color: #fff;
}

.chan .st {
  font-size: 12px;
  color: var(--green);
  margin-top: 4px;
  font-weight: 500;
}

/* FORM ELEMENTS */
textarea, input, select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13.5px;
  font-family: inherit;
  color: #fff;
  background: rgba(15, 23, 42, 0.8);
  outline: none;
  transition: all 0.2s ease;
}

textarea:focus, input:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.2);
}

textarea {
  min-height: 84px;
  resize: vertical;
  margin-top: 10px;
}

.row {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

.row > * {
  flex: 1;
}

.row .btn {
  flex: 0 0 auto;
}

.result {
  background: rgba(9, 13, 22, 0.9);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-top: 14px;
  font-size: 12.5px;
  font-family: 'Fira Code', monospace, sans-serif;
  color: var(--primary);
  white-space: pre-wrap;
  max-height: 300px;
  overflow: auto;
}

/* FEEDS & TIMELINE */
.feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 460px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.feed-item {
  background: rgba(30, 41, 59, 0.4);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 13.5px;
  transition: all 0.2s ease;
}

.feed-item:hover {
  background: rgba(30, 41, 59, 0.7);
  border-color: rgba(255, 255, 255, 0.15);
}

.feed-item .meta {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 4px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 18px;
}

/* BARS & ANALYTICS */
.bars {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.bar-track {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--primary-gradient);
  border-radius: 999px;
}

/* TOAST */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(30px);
  background: rgba(15, 23, 42, 0.95);
  color: #fff;
  border: 1px solid var(--primary);
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), var(--shadow-glow);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 500;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 768px) {
  .two-col { grid-template-columns: 1fr; }
  .topbar { padding: 14px 20px; }
  .tabs { padding: 10px 20px; }
  main { padding: 20px; }
}
