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

:root {
  --bg: #0a0a0f;
  --bg-card: #12121a;
  --bg-card-hover: #1a1a28;
  --border: #1e1e30;
  --border-focus: #6c5ce7;
  --text: #e8e8f0;
  --text-muted: #8888a0;
  --accent: #6c5ce7;
  --accent-glow: rgba(108, 92, 231, 0.25);
  --green: #00d68f;
  --green-glow: rgba(0, 214, 143, 0.2);
  --orange: #ff9f43;
  --red: #ff5e5e;
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-width: 240px;
  --topbar-height: 56px;
  --glass-bg: rgba(18, 18, 26, 0.8);
  --glass-border: rgba(30, 30, 48, 0.6);
}

html { font-size: 16px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

#particles {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.orb {
  position: fixed;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(108, 92, 231, 0.12), transparent 70%);
  top: -200px;
  right: -200px;
  z-index: 0;
  pointer-events: none;
  animation: orbFloat 20s ease-in-out infinite;
}

.orb-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle at 70% 70%, rgba(0, 214, 143, 0.08), transparent 70%);
  bottom: -200px;
  left: -200px;
  top: auto;
  right: auto;
  animation-delay: -10s;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(40px, -30px) scale(1.05); }
  66% { transform: translate(-20px, 20px) scale(0.95); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes spin { to { transform: rotate(360deg); } }

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInLeft { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes glitch { 0%, 100% { transform: translate(0); } 20% { transform: translate(-2px, 2px); } 40% { transform: translate(2px, -2px); } 60% { transform: translate(-1px, -1px); } 80% { transform: translate(1px, 1px); } }

/* ======= LAYOUT ======= */
.app-layout {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--glass-border);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.sidebar-logo .logo-icon { font-size: 1.5rem; }
.sidebar-logo .logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #a29bfe, #6c5ce7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-close {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem;
}

.sidebar-close:hover { color: var(--text); }

.sidebar-nav {
  flex: 1;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
  position: relative;
}

.sidebar-link:hover {
  color: var(--text);
  background: rgba(108, 92, 231, 0.08);
}

.sidebar-link.active {
  color: var(--text);
  background: rgba(108, 92, 231, 0.12);
}

.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: -0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

.sidebar-link-sm { font-size: 0.8rem; padding: 0.5rem 0.875rem; }

.sidebar-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar-link.active .sidebar-icon { opacity: 1; }

.sidebar-divider {
  height: 1px;
  background: var(--glass-border);
  margin: 0.5rem 0.875rem;
}

.sidebar-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--glass-border);
}

.sidebar-credits {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: rgba(108, 92, 231, 0.08);
  border: 1px solid rgba(108, 92, 231, 0.15);
  border-radius: var(--radius-sm);
}

.sidebar-credits-label { font-size: 0.75rem; color: var(--text-muted); }
.sidebar-credits-value { font-size: 0.95rem; font-weight: 700; color: var(--green); }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
  backdrop-filter: blur(4px);
}

/* MAIN WRAPPER */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* TOPBAR */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--topbar-height);
  padding: 0 1.5rem;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar-sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  width: 32px;
  height: 32px;
}

.topbar-sidebar-toggle:hover { color: var(--text); }
.topbar-sidebar-toggle svg { width: 20px; height: 20px; }

.topbar-breadcrumb {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Credit Badge */
.credit-badge {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  background: rgba(108, 92, 231, 0.1);
  border: 1px solid rgba(108, 92, 231, 0.2);
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.2s;
}

.credit-badge:hover { background: rgba(108, 92, 231, 0.15); border-color: var(--accent); }

.credit-badge-icon { width: 14px; height: 14px; color: #a29bfe; }

.credit-badge-value {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--green);
}

/* Notification Bell */
.notification-bell {
  position: relative;
  cursor: pointer;
  padding: 0.25rem;
  color: var(--text-muted);
  transition: color 0.2s;
}

.notification-bell:hover { color: var(--text); }
.notification-bell svg { width: 18px; height: 18px; }

.notification-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 6px rgba(255, 159, 67, 0.4);
  display: none;
}

.notification-dot.has-notifications { display: block; }

/* System Health */
.system-health {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.health-text { white-space: nowrap; }

/* User Profile */
.user-profile {
  position: relative;
  cursor: pointer;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  transition: transform 0.2s, box-shadow 0.2s;
}

.user-avatar:hover { transform: scale(1.05); box-shadow: 0 0 16px var(--accent-glow); }

.user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 200;
  animation: fadeIn 0.15s ease;
  overflow: hidden;
}

.user-dropdown.show { display: block; }

.dropdown-header {
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
}

.dropdown-divider { height: 1px; background: var(--border); }

.dropdown-item {
  display: block;
  padding: 0.6rem 1rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.82rem;
  transition: all 0.15s;
}

.dropdown-item:hover { background: rgba(108, 92, 231, 0.08); color: var(--text); }

.dropdown-danger { color: var(--red); }
.dropdown-danger:hover { background: rgba(255, 94, 94, 0.08) !important; color: var(--red) !important; }

/* MAIN CONTENT */
main {
  flex: 1;
  padding: 1.5rem 2rem 4rem;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

main section { margin-bottom: 2rem; }

.view { display: none; animation: fadeIn 0.2s ease; }
.view.active { display: block; }

/* FOOTER */
footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  border-top: 1px solid var(--glass-border);
}

/* ======= EXISTING STYLES (PRESERVED) ======= */
.hero { text-align: center; padding: 2.5rem 0 2rem; }

.hero-badge {
  display: inline-block;
  padding: 0.35rem 1rem;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: rgba(108, 92, 231, 0.1);
  border: 1px solid rgba(108, 92, 231, 0.2);
  color: #a29bfe;
  margin-bottom: 1.5rem;
}

h1 {
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}

.hero-sub {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 480px;
  margin: 0 auto;
}

.input-section { padding: 0 0 2rem; }

.input-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.input-card:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 30px var(--accent-glow);
}

.input-row {
  display: flex;
  gap: 0.5rem;
}

.input-row input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 1rem;
  padding: 0.75rem 1rem;
  font-family: inherit;
}

.input-row input::placeholder { color: var(--text-muted); }

.input-row button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
  font-family: inherit;
  white-space: nowrap;
}

.input-row button:hover { transform: translateY(-1px); box-shadow: 0 4px 20px var(--accent-glow); }
.input-row button:active { transform: translateY(0); }
.input-row button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-icon { transition: transform 0.3s; }
.input-row button:not(:disabled):hover .btn-icon { transform: translateX(3px); }

.input-suggestions {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem 0.25rem;
  flex-wrap: wrap;
}

.suggestion {
  padding: 0.3rem 0.75rem;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.suggestion:hover {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(108, 92, 231, 0.08);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.section-header h2 { font-size: 1.1rem; font-weight: 700; }

.plan-id {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

.tasks-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.task-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: border-color 0.3s;
}

.task-card.pending { opacity: 0.6; }
.task-card.running { border-color: var(--accent); }
.task-card.done { border-color: var(--green); }

.task-status {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  flex-shrink: 0;
  transition: all 0.4s;
}

.task-card.running .task-status {
  border-color: var(--accent);
  animation: spin 1s linear infinite;
  border-top-color: transparent;
}

.task-card.done .task-status {
  background: var(--green);
  border-color: var(--green);
}

.task-type {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  background: rgba(108, 92, 231, 0.1);
  color: #a29bfe;
  flex-shrink: 0;
}

.task-desc {
  flex: 1;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.task-card.done .task-desc { color: var(--text); }

.progress-bar-container {
  height: 4px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #a29bfe, var(--green));
  border-radius: 4px;
  transition: width 0.5s ease;
}

.progress-status {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

.result-section { margin-top: 0; }

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.result-header h2 { font-size: 1.1rem; font-weight: 700; }

.result-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.78rem;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.meta-label { color: var(--text-muted); }
.meta-value { color: var(--text); font-weight: 600; }

.result-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  font-size: 0.9rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: var(--text);
}

/* CREDIT PACKS */
.credit-packs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.pack-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  transition: border-color 0.3s, transform 0.2s;
  cursor: pointer;
}

.pack-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.pack-card.featured {
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
}

.pack-name {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.pack-credits {
  font-size: 2.5rem;
  font-weight: 800;
  color: #a29bfe;
  margin: 0.5rem 0;
}

.pack-credits-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.pack-price {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--green);
  margin-bottom: 1rem;
}

.pack-btn {
  width: 100%;
  padding: 0.65rem;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.2s, box-shadow 0.2s;
}

.pack-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 20px var(--accent-glow); }
.pack-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* PAYMENT STATUS */
.payment-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  max-width: 400px;
  margin: 0 auto;
}

.payment-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.payment-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.5rem; }
.payment-desc { font-size: 0.85rem; color: var(--text-muted); }

/* ADMIN */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: #a29bfe;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.daily-table-wrap {
  overflow-x: auto;
}

.daily-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.daily-table th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.daily-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.daily-table tr:hover td { background: var(--bg-card-hover); }

/* AUTH */
.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.auth-tab {
  flex: 1;
  padding: 0.6rem 1rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.auth-tab.active {
  background: var(--accent);
  color: #fff;
}

.auth-card {
  max-width: 400px;
  margin: 0 auto 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.auth-card .input-row input {
  width: 100%;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.9rem;
  padding: 0.65rem 0.75rem;
  font-family: inherit;
  outline: none;
}

.auth-card .input-row input:focus { border-color: var(--accent); }

.auth-submit {
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.65rem;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.2s, box-shadow 0.2s;
}

.auth-submit:hover { transform: translateY(-1px); box-shadow: 0 4px 20px var(--accent-glow); }

.auth-error {
  text-align: center;
  color: var(--red);
  font-size: 0.82rem;
  min-height: 1.5rem;
  max-width: 400px;
  margin: 0 auto;
}

.apikey-card {
  max-width: 500px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--green);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
}

.apikey-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.apikey-value {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.95rem;
  color: var(--green);
  background: rgba(0, 214, 143, 0.06);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  word-break: break-all;
  margin-bottom: 0.75rem;
}

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

/* INPUT COLLECTION */
.input-requirement {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.input-req-label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.input-req-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.input-requirement input[type="text"],
.input-requirement input[type="file"] {
  width: 100%;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.9rem;
  padding: 0.65rem 0.75rem;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
}

.input-requirement input[type="text"]:focus { border-color: var(--accent); }

.mcq-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.mcq-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  cursor: pointer;
  transition: border-color 0.2s;
}

.mcq-option:hover { border-color: var(--accent); }
.mcq-option input[type="radio"] { accent-color: var(--accent); }

/* Attachments */
.attach-btn-header {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 1.2rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.attach-btn-header:hover { border-color: var(--accent); color: var(--accent); background: rgba(108, 92, 231, 0.06); }

.main-attach-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.25rem 0 0;
}

.attach-wrap { display: flex; flex-direction: column; gap: 0.5rem; }

.attach-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 1rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.attach-btn:hover { border-color: var(--accent); color: var(--accent); }

.attach-list { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.5rem 0.25rem 0.65rem;
  background: rgba(108, 92, 231, 0.08);
  border: 1px solid rgba(108, 92, 231, 0.2);
  border-radius: 999px;
  font-size: 0.78rem;
}

.attach-chip-name { color: var(--text); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-chip-status { font-size: 0.7rem; color: var(--text-muted); }

.attach-chip-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.15rem;
}

.attach-chip-remove:hover { color: var(--red); }

/* MANUAL PAYMENT */
.manual-payment { margin-bottom: 2rem; }

.manual-payment-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  max-width: 420px;
  margin: 0 auto;
}

.manual-payment-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.manual-payment-title { font-size: 1rem; font-weight: 700; margin-bottom: 0.4rem; }
.manual-payment-desc { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 1rem; line-height: 1.5; }

.manual-payment-number {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #a29bfe;
  padding: 0.6rem 1rem;
  background: rgba(108, 92, 231, 0.08);
  border-radius: var(--radius-sm);
  display: inline-block;
  margin-bottom: 0.75rem;
}

.manual-payment-note {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ADMIN MANUAL CREDIT */
.admin-manual-credit {
  margin-top: 2rem;
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.admin-manual-credit h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.admin-credit-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.admin-credit-row input {
  flex: 1;
  min-width: 120px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  color: var(--text);
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
}

.admin-credit-row input:focus { border-color: var(--accent); }

.admin-credit-row button {
  padding: 0.6rem 1.25rem;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}

.admin-credit-row button:hover { box-shadow: 0 4px 20px var(--accent-glow); }
.admin-credit-row button:disabled { opacity: 0.5; cursor: not-allowed; }

.admin-credit-result {
  margin-top: 0.5rem;
  font-size: 0.82rem;
  color: var(--green);
}

.error-section {
  text-align: center;
  padding: 2rem;
  background: var(--bg-card);
  border: 1px solid rgba(255, 94, 94, 0.2);
  border-radius: var(--radius);
}

.error-icon { font-size: 2rem; margin-bottom: 0.75rem; }
.error-message { color: var(--red); font-size: 0.9rem; margin-bottom: 1rem; }

.retry-btn {
  padding: 0.6rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.retry-btn:hover {
  border-color: var(--accent);
  background: rgba(108, 92, 231, 0.08);
}

/* ======= NEW COMPONENT STYLES ======= */

/* Page Header */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
  animation: fadeIn 0.3s ease;
}

.page-header h1 { font-size: 1.75rem; margin-bottom: 0.25rem; }

.page-subtitle {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

/* Search Box */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box .search-icon {
  position: absolute;
  left: 0.75rem;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-box input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.85rem;
  padding: 0.55rem 0.75rem 0.55rem 2.25rem;
  font-family: inherit;
  outline: none;
  width: 100%;
  transition: border-color 0.2s;
}

.search-box input:focus { border-color: var(--accent); }
.search-box input::placeholder { color: var(--text-muted); }

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.25rem;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 20px var(--accent-glow); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.btn-secondary:hover { border-color: var(--accent); color: var(--text); background: rgba(108, 92, 231, 0.06); }

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.9rem;
  border: 1px solid rgba(255, 94, 94, 0.3);
  border-radius: var(--radius-sm);
  background: rgba(255, 94, 94, 0.08);
  color: var(--red);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.btn-danger:hover { background: rgba(255, 94, 94, 0.15); border-color: var(--red); }

/* ======= EXECUTION TIMELINE ======= */
.timeline-section { padding: 0 0 1.5rem; }

.execution-timeline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  animation: fadeIn 0.3s ease;
}

.timeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  min-width: 70px;
}

.step-indicator {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: all 0.3s;
  position: relative;
}

.timeline-step.active .step-indicator {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 16px var(--accent-glow);
}

.timeline-step.done .step-indicator {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.timeline-step.done .step-indicator::after {
  content: '✓';
  font-size: 0.7rem;
}

.step-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-align: center;
  font-weight: 500;
  white-space: nowrap;
}

.timeline-step.active .step-label { color: var(--text); font-weight: 600; }
.timeline-step.done .step-label { color: var(--green); }

.timeline-connector {
  width: 40px;
  height: 2px;
  background: var(--border);
  transition: background 0.3s;
}

.timeline-step.active + .timeline-connector,
.timeline-step.done ~ .timeline-step.done + .timeline-connector { background: var(--accent); }

.timeline-step.done + .timeline-connector { background: var(--green); }

/* ======= AGENTS PAGE ======= */
.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.agent-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: all 0.2s;
  animation: fadeInUp 0.3s ease;
  position: relative;
  overflow: hidden;
}

.agent-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), #a29bfe);
  opacity: 0;
  transition: opacity 0.2s;
}

.agent-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 4px 24px rgba(108, 92, 231, 0.08); }
.agent-card:hover::before { opacity: 1; }

.agent-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.agent-card-name {
  font-size: 1rem;
  font-weight: 700;
}

.agent-card-status {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 600;
}

.agent-status-active { background: rgba(0, 214, 143, 0.1); color: var(--green); }
.agent-status-paused { background: rgba(255, 159, 67, 0.1); color: var(--orange); }
.agent-status-idle { background: rgba(136, 136, 160, 0.1); color: var(--text-muted); }

.agent-card-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.agent-stat {
  text-align: center;
}

.agent-stat-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.agent-stat-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.agent-card-actions {
  display: flex;
  gap: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.agent-card-actions button {
  flex: 1;
  padding: 0.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.agent-card-actions button:hover { border-color: var(--accent); color: var(--text); }

/* ======= WORKFLOWS PAGE ======= */
.workflow-templates {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.workflow-template {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  animation: fadeInUp 0.3s ease;
}

.workflow-template:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 4px 20px var(--accent-glow); }

.template-icon { font-size: 2rem; margin-bottom: 0.5rem; }

.template-name {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.template-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.workflows-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.workflow-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: all 0.2s;
  animation: fadeInUp 0.3s ease;
}

.workflow-card:hover { border-color: var(--accent); }

.workflow-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.workflow-card-name { font-size: 0.95rem; font-weight: 700; }

.workflow-card-status {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 100px;
}

.wf-status-active { background: rgba(0, 214, 143, 0.1); color: var(--green); }
.wf-status-draft { background: rgba(136, 136, 160, 0.1); color: var(--text-muted); }
.wf-status-error { background: rgba(255, 94, 94, 0.1); color: var(--red); }

.workflow-card-nodes {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.node-chip {
  padding: 0.2rem 0.5rem;
  background: rgba(108, 92, 231, 0.08);
  border: 1px solid rgba(108, 92, 231, 0.15);
  border-radius: 4px;
  font-size: 0.68rem;
  color: #a29bfe;
}

.workflow-card-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ======= MEMORY PAGE ======= */
.memory-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.memory-tab {
  padding: 0.45rem 1rem;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.memory-tab:hover { border-color: var(--accent); color: var(--text); }
.memory-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.memory-visualization {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.memory-viz-placeholder {
  text-align: center;
  color: var(--text-muted);
}

.memory-viz-placeholder svg { margin-bottom: 0.75rem; opacity: 0.3; }
.memory-viz-placeholder p { font-size: 0.85rem; }

.memory-entries {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.memory-entry {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  transition: border-color 0.2s;
  animation: fadeInUp 0.2s ease;
}

.memory-entry:hover { border-color: var(--accent); }

.memory-entry-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(108, 92, 231, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.7rem;
}

.memory-entry-content { flex: 1; }

.memory-entry-text {
  font-size: 0.85rem;
  color: var(--text);
  margin-bottom: 0.15rem;
}

.memory-entry-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.memory-entry-score {
  font-size: 0.7rem;
  color: var(--green);
  font-weight: 600;
  flex-shrink: 0;
}

/* ======= MARKETPLACE PAGE ======= */
.marketplace-categories {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.category-chip {
  padding: 0.4rem 1rem;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.category-chip:hover { border-color: var(--accent); color: var(--text); }
.category-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.marketplace-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.marketplace-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: all 0.2s;
  animation: fadeInUp 0.3s ease;
  position: relative;
}

.marketplace-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 4px 24px rgba(108, 92, 231, 0.08); }

.mktp-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.mktp-card-name { font-size: 0.95rem; font-weight: 700; }

.mktp-card-rating {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: var(--orange);
}

.mktp-card-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

.mktp-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mktp-card-stats {
  display: flex;
  gap: 0.75rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.mktp-card-price {
  font-size: 1rem;
  font-weight: 700;
  color: var(--green);
}

.mktp-install-btn {
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.mktp-install-btn:hover { background: var(--accent); color: #fff; }

/* ======= ANALYTICS PAGE ======= */
.analytics-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.analytics-select {
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  outline: none;
}

.analytics-select:focus { border-color: var(--accent); }

.analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.analytics-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  animation: fadeInUp 0.3s ease;
}

.analytics-card-full { grid-column: 1 / -1; }

.analytics-card-header {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.analytics-chart-container {
  position: relative;
  width: 100%;
  min-height: 250px;
}

.analytics-chart-container canvas { width: 100% !important; height: 100% !important; }

/* ======= BILLING PAGE ======= */
.billing-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.billing-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  text-align: center;
}

.billing-stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.25rem;
}

.billing-stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
}

.current-credits-display {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  background: rgba(0, 214, 143, 0.06);
  border: 1px solid rgba(0, 214, 143, 0.15);
  border-radius: var(--radius-sm);
}

.credits-display-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.credits-display-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--green);
}

/* ======= SETTINGS PAGE ======= */
.settings-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-wrap: wrap;
}

.settings-tab {
  padding: 0.6rem 1.25rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  border-right: 1px solid var(--border);
}

.settings-tab:last-child { border-right: none; }
.settings-tab:hover { color: var(--text); background: rgba(108, 92, 231, 0.04); }
.settings-tab.active { color: #fff; background: var(--accent); }

.settings-content {
  min-height: 300px;
}

.settings-panel {
  animation: fadeIn 0.2s ease;
}

.settings-panel h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.settings-panel p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.settings-field {
  margin-bottom: 1rem;
  max-width: 400px;
}

.settings-field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.settings-field input,
.settings-field select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
}

.settings-field input:focus,
.settings-field select:focus { border-color: var(--accent); }

.settings-field select { cursor: pointer; }

.settings-toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  max-width: 400px;
}

.settings-toggle-label { font-size: 0.85rem; }
.settings-toggle-desc { font-size: 0.75rem; color: var(--text-muted); }

.toggle-switch {
  position: relative;
  width: 40px;
  height: 22px;
  background: var(--border);
  border-radius: 11px;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}

.toggle-switch.active { background: var(--accent); }

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}

.toggle-switch.active::after { transform: translateX(18px); }

.api-key-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  background: rgba(108, 92, 231, 0.06);
  border: 1px solid rgba(108, 92, 231, 0.15);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
}

.api-key-display code {
  flex: 1;
  font-size: 0.8rem;
  color: var(--green);
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

/* ======= API CATALOG PAGE ======= */
.api-categories {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.api-cat-chip {
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.api-cat-chip:hover { border-color: var(--accent); color: var(--text); }
.api-cat-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.api-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
}

.api-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  animation: fadeInUp 0.3s ease;
}

.api-card:hover { border-color: var(--accent); transform: translateY(-1px); }

.api-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.4rem;
}

.api-card-name {
  font-size: 0.85rem;
  font-weight: 700;
}

.api-card-category {
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  background: rgba(108, 92, 231, 0.08);
  border-radius: 4px;
  color: #a29bfe;
}

.api-card-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.api-card-meta {
  display: flex;
  gap: 0.75rem;
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* ======= ADMIN TABS ======= */
.admin-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-wrap: wrap;
}

.admin-tab {
  padding: 0.6rem 1rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  border-right: 1px solid var(--border);
}

.admin-tab:last-child { border-right: none; }
.admin-tab:hover { color: var(--text); background: rgba(108, 92, 231, 0.04); }
.admin-tab.active { color: #fff; background: var(--accent); }

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

.page-btn {
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.page-btn:hover { border-color: var(--accent); color: var(--text); }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ======= GLASSMORPHISM COMPONENTS ======= */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
}

.glass-card:hover { border-color: rgba(108, 92, 231, 0.3); }

/* Status Badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 600;
}

.status-badge.active { background: rgba(0, 214, 143, 0.1); color: var(--green); }
.status-badge.paused { background: rgba(255, 159, 67, 0.1); color: var(--orange); }
.status-badge.inactive { background: rgba(136, 136, 160, 0.1); color: var(--text-muted); }
.status-badge.error { background: rgba(255, 94, 94, 0.1); color: var(--red); }

/* Loading Spinner */
.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-muted);
}

.empty-state svg { width: 48px; height: 48px; opacity: 0.3; margin-bottom: 1rem; }
.empty-state p { font-size: 0.9rem; }

/* Tooltip */
[data-tooltip] {
  position: relative;
}

[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 0.3rem 0.6rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.72rem;
  color: var(--text);
  white-space: nowrap;
  z-index: 300;
  pointer-events: none;
}

/* ======= ANALYTICS SUMMARY ======= */
.analytics-summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  transition: all 0.2s;
  animation: fadeInUp 0.3s ease;
}

.analytics-summary-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.summary-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.2;
}

.summary-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 0.25rem;
}

/* ======= API KEY MANAGEMENT ======= */
.api-key-row {
  transition: border-color 0.2s;
}

.api-key-row:hover {
  border-color: var(--accent) !important;
}

/* ======= SETTINGS BILLING PANEL ======= */
.settings-panel h4 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

/* ======= RESPONSIVE ======= */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 260px;
  }

  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open { transform: translateX(0); }

  .sidebar-close { display: block; }

  .sidebar-overlay.open { display: block; }

  .topbar-sidebar-toggle { display: block; }

  .main-wrapper { margin-left: 0; }

  h1 { font-size: 2rem; }

  .page-header { flex-direction: column; }
  .page-header h1 { font-size: 1.5rem; }

  main { padding: 1rem 1rem 3rem; }

  .hero { padding: 2rem 0 1.5rem; }
  .input-row { flex-direction: column; }
  .input-row button { justify-content: center; }

  .analytics-grid { grid-template-columns: 1fr; }

  .agents-grid { grid-template-columns: 1fr; }
  .workflows-grid { grid-template-columns: 1fr; }
  .marketplace-grid { grid-template-columns: 1fr; }
  .api-grid { grid-template-columns: 1fr; }

  .credit-packs { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .billing-summary { grid-template-columns: 1fr 1fr; }

  .execution-timeline {
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
  }

  .timeline-connector { width: 20px; }

  .topbar-right .system-health { display: none; }
  .topbar-right .health-text { display: none; }

  .settings-tabs { flex-direction: column; }
  .settings-tab { border-right: none; border-bottom: 1px solid var(--border); }
  .settings-tab:last-child { border-bottom: none; }

  .admin-tabs { flex-direction: column; }
  .admin-tab { border-right: none; border-bottom: 1px solid var(--border); }
  .admin-tab:last-child { border-bottom: none; }

  .workflow-templates { grid-template-columns: 1fr 1fr; }

  .memory-tabs { flex-wrap: wrap; }
}

@media (max-width: 480px) {
  h1 { font-size: 1.5rem; }

  .stats-grid { grid-template-columns: 1fr 1fr; }
  .billing-summary { grid-template-columns: 1fr; }

  .topbar-right .credit-badge-value { font-size: 0.72rem; }
  .topbar { padding: 0 0.75rem; }

  .workflow-templates { grid-template-columns: 1fr; }

  .marketplace-categories { gap: 0.35rem; }
  .category-chip { font-size: 0.72rem; padding: 0.3rem 0.75rem; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Selection */
::selection { background: rgba(108, 92, 231, 0.3); color: #fff; }

/* Focus */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* MCP CONNECTIONS */
.mcp-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.mcp-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  transition: all 0.2s;
}

.mcp-stat-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.mcp-stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.mcp-stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.mcp-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.mcp-services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.mcp-service-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}

.mcp-service-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(108, 92, 231, 0.15);
}

.mcp-service-card.connected {
  border-color: var(--green);
}

.mcp-service-card.connected::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--green), var(--accent));
}

.mcp-service-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.mcp-service-icon {
  width: 48px;
  height: 48px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  border: 1px solid var(--border);
}

.mcp-service-info {
  flex: 1;
}

.mcp-service-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.mcp-service-category {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.mcp-service-description {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  line-height: 1.5;
}

.mcp-service-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.mcp-tool-badge {
  background: rgba(108, 92, 231, 0.15);
  color: var(--accent);
  font-size: 0.72rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-family: monospace;
}

.mcp-service-auth {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.mcp-auth-icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.mcp-service-actions {
  display: flex;
  gap: 0.5rem;
}

.mcp-connect-btn {
  flex: 1;
  padding: 0.6rem 1rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.mcp-connect-btn:hover {
  background: #5a4bd1;
  transform: translateY(-1px);
}

.mcp-connect-btn.connected {
  background: var(--green);
}

.mcp-connect-btn.connected:hover {
  background: #00b87a;
}

.mcp-disconnect-btn {
  padding: 0.6rem 1rem;
  background: transparent;
  color: var(--red);
  border: 1px solid var(--red);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.mcp-disconnect-btn:hover {
  background: rgba(255, 94, 94, 0.1);
}

.mcp-test-btn {
  padding: 0.6rem 1rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.mcp-test-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.mcp-oauth-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s;
}

.mcp-oauth-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.mcp-oauth-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.mcp-oauth-title {
  font-size: 1.25rem;
  font-weight: 600;
}

.mcp-oauth-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.mcp-oauth-close:hover {
  color: var(--text);
}

.mcp-oauth-steps {
  margin-bottom: 1.5rem;
}

.mcp-oauth-step {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.mcp-oauth-step-number {
  width: 24px;
  height: 24px;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}

.mcp-oauth-step-content {
  flex: 1;
}

.mcp-oauth-step-title {
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.mcp-oauth-step-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.mcp-api-key-input {
  width: 100%;
  padding: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.mcp-api-key-input:focus {
  outline: none;
  border-color: var(--accent);
}

.mcp-oauth-submit {
  width: 100%;
  padding: 0.75rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.mcp-oauth-submit:hover {
  background: #5a4bd1;
}

.mcp-oauth-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 768px) {
  .mcp-stats {
    grid-template-columns: 1fr;
  }

  .mcp-services-grid {
    grid-template-columns: 1fr;
  }

  .mcp-categories {
    gap: 0.35rem;
  }

  .category-chip {
    font-size: 0.72rem;
    padding: 0.3rem 0.75rem;
  }
}
