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

:root {
  --bg-void: #04060b;
  --bg-primary: #080b14;
  --bg-secondary: #0c1019;
  --bg-card: #0f1420;
  --bg-card-hover: #131828;
  --bg-elevated: #151b2b;
  --border: rgba(56, 189, 248, 0.08);
  --border-glow: rgba(56, 189, 248, 0.15);
  --border-active: rgba(56, 189, 248, 0.35);
  --text-primary: #e2e8f0;
  --text-secondary: #7e8aa0;
  --text-muted: #4a5268;
  --text-bright: #f1f5f9;
  --cyan: #22d3ee;
  --cyan-dim: rgba(34, 211, 238, 0.1);
  --cyan-glow: rgba(34, 211, 238, 0.25);
  --blue: #3b82f6;
  --blue-dim: rgba(59, 130, 246, 0.12);
  --green: #10b981;
  --green-dim: rgba(16, 185, 129, 0.12);
  --red: #f43f5e;
  --red-dim: rgba(244, 63, 94, 0.12);
  --yellow: #f59e0b;
  --yellow-dim: rgba(245, 158, 11, 0.12);
  --orange: #f97316;
  --orange-dim: rgba(249, 115, 22, 0.12);
  --purple: #a78bfa;
  --purple-dim: rgba(167, 139, 250, 0.12);
  --radius: 6px;
  --radius-lg: 10px;
  --mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
  font-family: var(--sans);
  background: var(--bg-void);
  color: var(--text-primary);
  min-height: 100vh;
  font-size: 13px;
  line-height: 1.5;
  overflow: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    linear-gradient(180deg, transparent 0%, rgba(34, 211, 238, 0.01) 50%, transparent 100%),
    repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(34, 211, 238, 0.015) 2px, rgba(34, 211, 238, 0.015) 4px);
  pointer-events: none;
  z-index: 0;
}

::selection {
  background: var(--cyan-glow);
  color: var(--text-bright);
}

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(56, 189, 248, 0.15); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(56, 189, 248, 0.3); }

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 52px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(8, 11, 20, 0.95) 0%, rgba(12, 16, 25, 0.98) 100%);
  backdrop-filter: blur(12px);
  position: relative;
  z-index: 100;
}

header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--cyan) 50%, transparent 100%);
  opacity: 0.2;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-glow);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--cyan-dim) 0%, transparent 100%);
  position: relative;
}

.logo-icon::before {
  content: '';
  width: 10px;
  height: 10px;
  border: 2px solid var(--cyan);
  border-radius: 50%;
  opacity: 0.8;
}

.logo h1 {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-bright);
}

.logo .subtitle {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: all 0.4s ease;
}

.status-dot.online {
  background: var(--green);
  box-shadow: 0 0 8px var(--green), 0 0 16px rgba(16, 185, 129, 0.3);
  animation: pulse-dot 2s ease infinite;
}

.status-dot.offline {
  background: var(--red);
  box-shadow: 0 0 8px var(--red);
}

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

.header-actions {
  display: flex;
  gap: 8px;
}

.error-banner {
  background: linear-gradient(90deg, var(--red-dim) 0%, rgba(244, 63, 94, 0.05) 100%);
  border-bottom: 1px solid rgba(244, 63, 94, 0.2);
  color: var(--red);
  padding: 8px 20px;
  font-family: var(--mono);
  font-size: 11px;
  text-align: center;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  position: relative;
  z-index: 99;
}

.main-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  grid-template-rows: 1fr 260px;
  height: calc(100vh - 52px);
  position: relative;
  z-index: 1;
}

.panel {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-primary);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel-header h2 {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.panel-header .count {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--cyan);
  background: var(--cyan-dim);
  padding: 2px 6px;
  border-radius: 3px;
  margin-left: 8px;
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
}

.detail-area {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-primary);
}

.detail-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.bottom-bar {
  grid-column: 1 / -1;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  position: relative;
}

.bottom-bar::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--cyan) 50%, transparent 100%);
  opacity: 0.1;
}

.bottom-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  padding: 0 12px;
}

.tab-btn {
  padding: 10px 16px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  position: relative;
}

.tab-btn:hover { color: var(--text-secondary); }

.tab-btn.active {
  color: var(--cyan);
  border-bottom-color: var(--cyan);
}

.bottom-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px 16px;
}

.task-item {
  padding: 10px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid transparent;
  margin-bottom: 2px;
  transition: all 0.15s ease;
  position: relative;
}

.task-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--border);
}

.task-item.active {
  background: var(--bg-card);
  border-color: var(--border-active);
}

.task-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--cyan);
  border-radius: 2px;
  box-shadow: 0 0 6px var(--cyan-glow);
}

.task-item .task-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-item .task-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.badge-backlog { background: var(--yellow-dim); color: var(--yellow); border: 1px solid rgba(245, 158, 11, 0.15); }
.badge-approved { background: var(--blue-dim); color: var(--blue); border: 1px solid rgba(59, 130, 246, 0.15); }
.badge-running { background: var(--orange-dim); color: var(--orange); border: 1px solid rgba(249, 115, 22, 0.15); }
.badge-completed { background: var(--green-dim); color: var(--green); border: 1px solid rgba(16, 185, 129, 0.15); }
.badge-failed { background: var(--red-dim); color: var(--red); border: 1px solid rgba(244, 63, 94, 0.15); }
.badge-rejected { background: var(--red-dim); color: var(--red); border: 1px solid rgba(244, 63, 94, 0.15); }
.badge-pending { background: var(--yellow-dim); color: var(--yellow); border: 1px solid rgba(245, 158, 11, 0.15); }

.btn {
  padding: 7px 14px;
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn:hover {
  background: var(--bg-elevated);
  border-color: var(--border-glow);
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.15) 0%, rgba(59, 130, 246, 0.15) 100%);
  border-color: rgba(34, 211, 238, 0.3);
  color: var(--cyan);
}

.btn-primary:hover {
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.25) 0%, rgba(59, 130, 246, 0.25) 100%);
  border-color: rgba(34, 211, 238, 0.5);
  box-shadow: 0 0 12px rgba(34, 211, 238, 0.1);
}

.btn-success {
  background: var(--green-dim);
  border-color: rgba(16, 185, 129, 0.25);
  color: var(--green);
}

.btn-success:hover {
  background: rgba(16, 185, 129, 0.2);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.1);
}

.btn-danger {
  background: var(--red-dim);
  border-color: rgba(244, 63, 94, 0.25);
  color: var(--red);
}

.btn-danger:hover {
  background: rgba(244, 63, 94, 0.2);
  box-shadow: 0 0 12px rgba(244, 63, 94, 0.1);
}

.btn-sm { padding: 5px 12px; font-size: 10px; }

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

.btn-ghost:hover {
  color: var(--text-secondary);
  background: var(--bg-card);
}

.form-group {
  margin-bottom: 10px;
}

.form-group label {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-void);
  color: var(--text-primary);
  font-family: var(--mono);
  font-size: 12px;
  outline: none;
  transition: all 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--border-active);
  box-shadow: 0 0 0 2px var(--cyan-dim);
}

.form-group textarea { resize: vertical; min-height: 56px; }

.form-group select { cursor: pointer; }

.create-task-form {
  padding: 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg-secondary);
}

.create-task-form h3 {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--cyan);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.create-task-form h3::before {
  content: '+';
  font-size: 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

th {
  text-align: left;
  padding: 6px 12px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: var(--mono);
  font-size: 11px;
}

tr { transition: background 0.1s ease; }
tr:hover td { background: rgba(34, 211, 238, 0.02); }

.detail-section {
  margin-bottom: 24px;
}

.detail-section h3 {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.detail-section h3::before {
  content: '';
  width: 3px;
  height: 12px;
  background: var(--cyan);
  border-radius: 2px;
  box-shadow: 0 0 6px var(--cyan-glow);
}

.detail-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.detail-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.6;
}

.detail-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.artifact-tree {
  font-family: var(--mono);
  font-size: 11px;
}

.artifact-run {
  margin-bottom: 8px;
}

.artifact-run-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 2px;
  color: var(--cyan);
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 11px;
}

.artifact-run-header:hover {
  border-color: var(--border-glow);
  background: var(--bg-card-hover);
}

.artifact-run-header::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 1px;
  background: var(--cyan);
  opacity: 0.5;
  flex-shrink: 0;
}

.artifact-file {
  padding: 4px 10px 4px 32px;
  color: var(--text-muted);
  border-radius: 3px;
  font-size: 11px;
  position: relative;
}

.artifact-file::before {
  content: '';
  position: absolute;
  left: 16px;
  top: 50%;
  width: 6px;
  height: 1px;
  background: var(--border-glow);
}

.artifact-file:hover {
  color: var(--text-secondary);
  background: var(--bg-card);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: var(--text-muted);
  text-align: center;
}

.empty-state .empty-icon {
  font-size: 28px;
  margin-bottom: 12px;
  opacity: 0.25;
}

.empty-state p {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 11, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 0 40px rgba(34, 211, 238, 0.05), 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal h3 {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-bright);
  margin-bottom: 8px;
}

.modal p {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 20px;
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.03em;
  z-index: 2000;
  animation: toast-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-success {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid rgba(16, 185, 129, 0.2);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.1);
}

.toast-error {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(244, 63, 94, 0.2);
  box-shadow: 0 0 20px rgba(244, 63, 94, 0.1);
}

@keyframes toast-in {
  from { transform: translateY(16px) scale(0.95); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

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

.clock {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}

@media (max-width: 768px) {
  .main-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
  }

  .panel {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 35vh;
  }

  .bottom-bar {
    max-height: 220px;
  }

  header {
    padding: 0 12px;
    height: 48px;
  }

  .logo h1 { font-size: 12px; }
  .detail-content { padding: 16px; }
  .status-indicator span { display: none; }

  .header-actions .btn span { display: none; }
}
