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

:root {
  --teal-50: #f0fdfa;
  --teal-100: #ccfbf1;
  --teal-200: #99f6e4;
  --teal-300: #5eead4;
  --teal-400: #2dd4bf;
  --teal-500: #14b8a6;
  --teal-600: #0d9488;
  --teal-700: #0f766e;
  --teal-800: #115e59;
  --teal-900: #134e4a;
  --teal-950: #042f2e;

  --bg: #070d19;
  --panel: #0e1729;
  --panel-muted: #121d32;
  --surface: #0b1424;
  --card: #111c2f;
  --card-alt: #0d1727;
  --border: #1f2b3d;
  --border-strong: #2d3b52;
  --text: #e3ecff;
  --muted: #9fb3c8;
  --muted-strong: #cdd6e3;
  --shadow: 0 25px 60px rgba(0, 0, 0, 0.35);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --glow: 0 0 0 1px rgba(45, 212, 191, 0.15), 0 15px 45px rgba(0, 0, 0, 0.45);
}

:root[data-theme='light'] {
  --bg: #f8fbff;
  --panel: #ffffff;
  --panel-muted: #f4f7fb;
  --surface: #eef4ff;
  --card: #ffffff;
  --card-alt: #f7fbff;
  --border: #d9e4f2;
  --border-strong: #c4d5e8;
  --text: #0f172a;
  --muted: #4b5563;
  --muted-strong: #1f2937;
  --shadow: 0 15px 40px rgba(0, 35, 83, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Space Grotesk', 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: radial-gradient(circle at 20% 20%, rgba(20, 184, 166, 0.08), transparent 30%),
    radial-gradient(circle at 80% 0%, rgba(45, 212, 191, 0.08), transparent 25%),
    linear-gradient(145deg, #050912 0%, #0b1220 50%, #050912 100%);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.app-shell {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: 100vh;
  background: linear-gradient(180deg, rgba(17, 25, 40, 0.75), rgba(9, 12, 20, 0.95));
}

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 28px 24px;
  position: sticky;
  top: 0;
  height: 100vh;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.02);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.1), rgba(20, 184, 166, 0));
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: radial-gradient(circle at 30% 30%, rgba(240, 253, 250, 0.25), rgba(20, 184, 166, 0.85)), #0b141f;
  border: 1px solid rgba(45, 212, 191, 0.4);
  display: grid;
  place-items: center;
  color: var(--teal-50);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand h1 {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.2;
  color: var(--text);
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.sidebar-section {
  background: var(--panel-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 14px;
  box-shadow: var(--shadow);
}

.section-title {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.78rem;
  color: var(--muted);
}

.field-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted-strong);
  font-size: 0.95rem;
}

.input-wrap {
  position: relative;
}

.input-wrap .input-icon {
  position: absolute;
  inset: 0 0 0 12px;
  width: 16px;
  height: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  display: grid;
  place-items: center;
}

.input {
  width: 100%;
  padding: 12px 12px 12px 36px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.98rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.input:focus {
  outline: none;
  border-color: var(--teal-400);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15);
}

.select {
  width: 100%;
  padding: 11px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted-strong);
  font-size: 0.95rem;
}

.filter-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat-card {
  background: linear-gradient(140deg, rgba(20, 184, 166, 0.08), rgba(17, 24, 39, 0.55));
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
}

.stat-card .label {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0 6px;
}

.stat-card .value {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--teal-100);
}

.content {
  padding: 28px 34px;
  background: var(--surface);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 6px;
}

.page-title {
  margin: 0;
  font-size: 1.9rem;
  letter-spacing: -0.02em;
}

.page-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  max-width: 720px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  color: var(--muted-strong);
  font-size: 0.86rem;
}

.pill.teal {
  background: rgba(20, 184, 166, 0.12);
  color: var(--teal-100);
  border-color: rgba(45, 212, 191, 0.4);
}

.pill.gray {
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted-strong);
}

.results-pill {
  align-self: flex-end;
}

.state {
  padding: 26px;
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border);
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  text-align: left;
}

.state .icon {
  font-size: 2.1rem;
  margin-bottom: 10px;
}

.workflow-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
  margin-top: 4px;
}

.workflow-card {
  background: linear-gradient(145deg, var(--card), var(--card-alt));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  position: relative;
  overflow: hidden;
}

.workflow-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 20%, rgba(45, 212, 191, 0.07), transparent 35%);
  pointer-events: none;
}

.workflow-card:hover {
  transform: translateY(-3px);
  border-color: rgba(45, 212, 191, 0.5);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.card-header,
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.card-title {
  margin: 10px 0 6px;
  font-size: 1.15rem;
}

.card-description {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted-strong);
  font-size: 0.88rem;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--muted);
}

.dot.active {
  background: var(--teal-400);
  box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.12);
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  color: var(--muted-strong);
  font-size: 0.85rem;
}

.badge.complexity-low {
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.5);
  background: rgba(52, 211, 153, 0.08);
}

.badge.complexity-medium {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.1);
}

.badge.complexity-high {
  color: #fb7185;
  border-color: rgba(251, 113, 133, 0.35);
  background: rgba(251, 113, 133, 0.12);
}

.badge.integrations {
  background: rgba(20, 184, 166, 0.08);
  border-color: rgba(45, 212, 191, 0.45);
  color: var(--teal-50);
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted-strong);
  font-size: 0.85rem;
  border: 1px solid var(--border);
}

.tag.ghost {
  background: rgba(45, 212, 191, 0.08);
  color: var(--teal-50);
  border-color: rgba(45, 212, 191, 0.45);
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.btn {
  border: 1px solid var(--border);
  background: var(--panel-muted);
  color: var(--text);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--teal-500), var(--teal-600));
  color: #effdf7;
  border-color: rgba(45, 212, 191, 0.6);
  box-shadow: 0 10px 30px rgba(13, 148, 136, 0.35);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.06);
}

.btn-text {
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--muted-strong);
}

.load-more {
  text-align: center;
  margin: 22px 0;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 19, 0.7);
  backdrop-filter: blur(12px);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 50;
}

.modal-panel {
  background: var(--panel);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  width: min(1100px, 100%);
  max-height: 90vh;
  overflow: hidden;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-rows: auto 1fr;
}

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-title {
  margin: 0;
  font-size: 1.3rem;
  letter-spacing: -0.01em;
}

.modal-close {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
}

.modal-body {
  padding: 18px 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

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

.detail-card {
  background: var(--panel-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
}

.detail-card .label {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

.detail-card .value {
  margin: 0;
  font-weight: 700;
  color: var(--text);
}

.json-viewer,
.diagram-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  color: #b0c4e0;
  overflow: auto;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.section-header h4 {
  margin: 0;
  font-size: 1rem;
}

.workflow-detail {
  background: var(--panel-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
}

.diagram-container {
  min-height: 280px;
  background: #0c1220;
  position: relative;
}

.diagram-container.dragging {
  cursor: grabbing;
}

.diagram-controls {
  display: inline-flex;
  gap: 8px;
}

.zoom-btn,
.copy-btn {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
}

.workflow-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.copied {
  background: rgba(20, 184, 166, 0.12) !important;
  border-color: rgba(45, 212, 191, 0.6) !important;
  color: var(--teal-50) !important;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
}

::-webkit-scrollbar-thumb {
  background: rgba(45, 212, 191, 0.35);
  border-radius: 999px;
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .content {
    padding: 22px 16px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  .workflow-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    padding: 18px 16px;
  }
}
