:root {
  --bg-primary: #0a0d14;
  --bg-secondary: #121622;
  --bg-tertiary: #1a2030;
  --accent-cyan: #00f0ff;
  --accent-blue: #3b82f6;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --accent-amber: #f59e0b;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --border-color: #242e42;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Authentication Overlay */
.auth-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(10, 13, 20, 0.95);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.auth-overlay.hidden {
  display: none !important;
}

.auth-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 2.2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 10px 40px rgba(0, 240, 255, 0.08);
}

.auth-header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.auth-header h2 {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  letter-spacing: 1.5px;
  color: var(--accent-cyan);
}

.auth-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  line-height: 1.4;
}

.auth-field {
  margin-bottom: 1rem;
}

.auth-field input {
  width: 100%;
  padding: 0.85rem 1rem;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.auth-field input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
}

.auth-error {
  color: var(--accent-red);
  font-size: 0.8rem;
  margin-bottom: 1rem;
  min-height: 1.2rem;
}

.btn-primary {
  width: 100%;
  padding: 0.85rem;
  background: linear-gradient(135deg, #00f0ff, #3b82f6);
  color: #0a0d14;
  border: none;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  letter-spacing: 0.5px;
}

.btn-primary:hover {
  opacity: 0.92;
}

/* Header */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 1.5rem;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: #64748b;
}

.status-indicator.active {
  background-color: var(--accent-green);
  box-shadow: 0 0 10px var(--accent-green);
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

.brand-badge {
  font-size: 0.65rem;
  background-color: var(--bg-tertiary);
  color: var(--text-muted);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-family: var(--font-mono);
}

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

.metrics-bar {
  display: flex;
  gap: 0.8rem;
}

.metric-pill {
  background: var(--bg-tertiary);
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.metric-label {
  color: var(--text-muted);
  margin-right: 0.4rem;
}

.metric-val {
  color: var(--accent-cyan);
  font-weight: 600;
}

.btn-logout {
  background: rgba(239, 68, 68, 0.15) !important;
  color: #fca5a5 !important;
  border: 1px solid rgba(239, 68, 68, 0.3) !important;
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.3) !important;
  color: #fff !important;
}

/* Content Grid */
.content-grid {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 1rem;
  padding: 1rem;
  flex: 1;
  overflow: hidden;
}

@media (max-width: 900px) {
  .content-grid {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }
}

.card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.card-header {
  padding: 0.75rem 1rem;
  background-color: rgba(26, 32, 48, 0.5);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header h2, .card-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tag {
  font-size: 0.7rem;
  background: rgba(59, 130, 246, 0.2);
  color: var(--accent-blue);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-family: var(--font-mono);
}

.badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 12px;
  font-weight: 700;
}

.badge.danger {
  background: rgba(239, 68, 68, 0.2);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.4);
}

/* Chat Panel */
.chat-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-messages {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.message {
  display: flex;
  flex-direction: column;
  max-width: 85%;
}

.message.user {
  align-self: flex-end;
}

.message.assistant {
  align-self: flex-start;
}

.message .bubble {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.message.user .bubble {
  background-color: #1e3a8a;
  color: #eff6ff;
  border-bottom-right-radius: 2px;
}

.message.assistant .bubble {
  background-color: var(--bg-tertiary);
  color: var(--text-main);
  border-bottom-left-radius: 2px;
  border: 1px solid var(--border-color);
}

.chat-input-bar {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
}

.chat-input-bar input {
  flex: 1;
  padding: 0.75rem 1rem;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.9rem;
}

.chat-input-bar input:focus {
  outline: none;
  border-color: var(--accent-cyan);
}

.chat-input-bar button {
  padding: 0 1.25rem;
  background-color: var(--accent-blue);
  color: white;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}

.chat-input-bar button:hover {
  background-color: #2563eb;
}

/* Side Panel */
.side-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
}

.side-panel .card {
  max-height: 320px;
}

.empty-state {
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 1rem;
  text-align: center;
}

.btn-xs {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
}

.btn-xs:hover {
  color: var(--text-main);
}

/* Approvals Card */
.approval-item {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.85rem;
}

.approval-meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-amber);
}

.approval-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.3rem;
}

.btn-approve {
  background: var(--accent-green);
  color: black;
  border: none;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.75rem;
  cursor: pointer;
}

.btn-reject {
  background: var(--accent-red);
  color: white;
  border: none;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.75rem;
  cursor: pointer;
}

/* Tasks */
.task-item, .audit-item {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.task-status {
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.task-status.queued { background: #334155; color: #cbd5e1; }
.task-status.running { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.task-status.completed { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.task-status.failed { background: rgba(239, 68, 68, 0.2); color: #f87171; }
