:root {
  color-scheme: dark;
  --bg-main: #090D16;
  --bg-card: #0F1626;
  --bg-card-hover: #141C30;
  --bg-card-subtle: #12192B;
  --border: #1F2A44;
  --border-light: rgba(255, 255, 255, 0.08);
  --text-main: #F1F5F9;
  --text-muted: #94A3B8;
  --text-dim: #64748B;
  --accent: #3B82F6;
  --accent-glow: rgba(59, 130, 246, 0.25);
  --accent-gradient: linear-gradient(135deg, #3B82F6 0%, #6366F1 100%);
  --success: #10B981;
  --success-glow: rgba(16, 185, 129, 0.2);
  --danger: #EF4444;
  --warning: #F59E0B;
  --purple: #8B5CF6;
  --radius: 14px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---- LOGIN EKRANI ---- */
.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: radial-gradient(circle at top, #162036 0%, #090D16 80%);
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 42px 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 40px rgba(59, 130, 246, 0.08);
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  background: var(--accent-gradient);
  border-radius: 14px;
  font-size: 26px;
  margin-bottom: 14px;
  box-shadow: 0 0 25px var(--accent-glow);
}

.login-header h2 {
  margin: 0 0 8px 0;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.login-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}

.form-group {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.form-group input {
  background: #090D16;
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.login-btn {
  width: 100%;
  background: var(--accent-gradient);
  color: white;
  border: none;
  padding: 14px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  box-shadow: 0 4px 15px var(--accent-glow);
}

.login-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
}

.login-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #F87171;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 18px;
  text-align: center;
}

/* ---- HEADER ---- */
.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 36px;
  background: rgba(15, 22, 38, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.brand-icon {
  width: 40px;
  height: 40px;
  background: var(--accent-gradient);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 0 20px var(--accent-glow);
}

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-title-row h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.version-tag {
  background: rgba(59, 130, 246, 0.15);
  color: #60A5FA;
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.brand-text p {
  margin: 2px 0 0 0;
  color: var(--text-dim);
  font-size: 12px;
}

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

.system-status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: #34D399;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 10px #10B981;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.user-badge {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-muted);
}

.trigger-btn {
  background: var(--accent-gradient);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 14px var(--accent-glow);
  transition: all 0.2s;
}

.trigger-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
}

.trigger-icon { font-size: 10px; }

.logout-btn {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #F87171;
  border-color: rgba(239, 68, 68, 0.3);
}

/* ---- NAV TABS ---- */
.main-nav {
  display: flex;
  gap: 8px;
  padding: 16px 36px;
  border-bottom: 1px solid var(--border);
  background: #0B101C;
}

.tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

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

.tab-btn.active {
  color: #60A5FA;
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.3);
}

/* ---- MAIN CONTENT ---- */
.main-content {
  padding: 30px 36px 60px 36px;
  max-width: 1440px;
  margin: 0 auto;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---- KPI CARDS ---- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s, border-color 0.2s;
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: rgba(59, 130, 246, 0.4);
}

.kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.kpi-title {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}

.kpi-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.icon-blue { background: rgba(59, 130, 246, 0.15); }
.icon-purple { background: rgba(139, 92, 246, 0.15); }
.icon-green { background: rgba(16, 185, 129, 0.15); }
.icon-amber { background: rgba(245, 158, 11, 0.15); }

.kpi-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
  margin-bottom: 10px;
  font-family: 'JetBrains Mono', monospace;
}

.kpi-provider {
  font-size: 20px;
  font-weight: 700;
  font-family: inherit;
  color: #60A5FA;
}

.kpi-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
}

.kpi-trend {
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
}

.kpi-trend.positive {
  background: rgba(16, 185, 129, 0.12);
  color: #34D399;
}

.kpi-trend.neutral {
  background: rgba(139, 92, 246, 0.12);
  color: #C084FC;
}

.kpi-trend.zero-cost {
  background: rgba(59, 130, 246, 0.15);
  color: #93C5FD;
}

.kpi-badge.dry-run {
  background: rgba(245, 158, 11, 0.12);
  color: #FBBF24;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 600;
}

.kpi-sub {
  color: var(--text-dim);
}

/* ---- PIPELINE STEPPER FLOW ---- */
.flow-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 28px;
}

.flow-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.flow-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.flow-status {
  background: rgba(59, 130, 246, 0.1);
  color: #60A5FA;
  border: 1px solid rgba(59, 130, 246, 0.25);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.stepper-track {
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow-x: auto;
  padding: 6px 0;
}

.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-width: 100px;
  gap: 8px;
}

.step-node {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-main);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  transition: all 0.3s;
}

.step-item.active .step-node {
  background: var(--accent);
  border-color: #60A5FA;
  color: white;
  box-shadow: 0 0 15px var(--accent-glow);
}

.step-item.completed .step-node {
  background: #10B981;
  border-color: #34D399;
  color: white;
}

.step-connector {
  flex: 1;
  height: 2px;
  background: var(--border);
  min-width: 20px;
  margin-bottom: 28px;
}

.step-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.step-desc {
  font-size: 11px;
  color: var(--text-dim);
}

/* ---- CHARTS GRID ---- */
.charts-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}

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

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

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

.chart-header h3 {
  margin: 0 0 4px 0;
  font-size: 16px;
  font-weight: 700;
}

.chart-header p {
  margin: 0;
  font-size: 12px;
  color: var(--text-dim);
}

.badge-outline {
  border: 1px solid var(--border);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.chart-body {
  position: relative;
  height: 250px;
  width: 100%;
}

.chart-donut-body {
  height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- HEALTH METRICS ---- */
.health-metrics-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 10px;
}

.health-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.health-info {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.health-name { color: var(--text-muted); font-weight: 500; }
.health-val { font-weight: 700; color: var(--text-main); }
.text-green { color: #34D399; }

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: #090D16;
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

.fill-green { background: #10B981; }
.fill-blue { background: #3B82F6; }

/* ---- TABLES SECTION ---- */
.tables-section {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.table-card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.table-card-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

th {
  background: #0B101C;
  color: var(--text-dim);
  font-weight: 600;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-main);
  vertical-align: middle;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Status Badges */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.status-pill.success {
  background: rgba(16, 185, 129, 0.15);
  color: #34D399;
}

.status-pill.running {
  background: rgba(59, 130, 246, 0.15);
  color: #60A5FA;
}

.status-pill.failed {
  background: rgba(239, 68, 68, 0.15);
  color: #F87171;
}

.score-badge {
  display: inline-block;
  background: rgba(139, 92, 246, 0.15);
  color: #C084FC;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}

.btn-github {
  background: #24292E;
  color: white;
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s;
}

.btn-github:hover {
  background: #3B424A;
}

.btn-detail {
  background: transparent;
  color: var(--accent);
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-detail:hover {
  background: rgba(59, 130, 246, 0.15);
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
}

.empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-text { font-size: 15px; font-weight: 600; color: var(--text-main); margin-bottom: 6px; }
.empty-sub { font-size: 13px; color: var(--text-dim); }

/* ---- SETTINGS CARD ---- */
.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 28px;
  overflow: hidden;
}

.settings-card-header {
  padding: 22px 28px;
  border-bottom: 1px solid var(--border);
}

.settings-card-header h3 { margin: 0 0 6px 0; font-size: 18px; font-weight: 700; }
.settings-card-header p { margin: 0; font-size: 13px; color: var(--text-dim); }

.settings-card-body { padding: 28px; }

.time-picker-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.time-input, .text-input {
  background: #090D16;
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
}

.btn {
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-secondary { background: var(--bg-card-subtle); color: var(--text-muted); border: 1px solid var(--border); }
.btn-secondary:hover { color: var(--text-main); background: #182238; }

.next-run-badge {
  margin-top: 14px;
  font-size: 12px;
  color: #34D399;
  font-weight: 600;
}

.settings-list-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.setting-row {
  background: #0B101C;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

@media (max-width: 768px) {
  .setting-row { flex-direction: column; align-items: flex-start; }
}

.setting-info { flex: 1; }
.setting-label { font-size: 14px; font-weight: 700; color: var(--text-main); margin-bottom: 4px; }
.setting-desc { font-size: 12px; color: var(--text-dim); }

.setting-action {
  display: flex;
  align-items: center;
  gap: 10px;
}

.setting-input {
  background: #090D16;
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-family: 'JetBrains Mono', monospace;
  width: 240px;
}

.configured-badge {
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}

.configured-badge.yes { background: rgba(16, 185, 129, 0.15); color: #34D399; }
.configured-badge.no { background: rgba(245, 158, 11, 0.15); color: #FBBF24; }

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 24px;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 760px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(0,0,0,0.6);
}

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

.modal-header h3 { margin: 0; font-size: 18px; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text-dim); font-size: 24px; cursor: pointer; }
.modal-close:hover { color: var(--text-main); }

.modal-body {
  padding: 24px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.6;
}

.modal-json {
  background: #080C14;
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  color: #93C5FD;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1E293B;
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s;
  pointer-events: none;
  z-index: 1000;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* MessageBox Modal */
.messagebox-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px 36px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: 0 25px 60px rgba(0,0,0,0.7), 0 0 35px rgba(59, 130, 246, 0.15);
  animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  0% { transform: scale(0.92); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.messagebox-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  margin: 0 auto 18px auto;
}

.messagebox-icon.info {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.3);
}

.messagebox-title {
  margin: 0 0 10px 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.messagebox-text {
  margin: 0 0 24px 0;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
}

.messagebox-actions {
  display: flex;
  justify-content: center;
}

.messagebox-btn {
  min-width: 140px;
  padding: 12px 28px;
  font-size: 14px;
  font-weight: 700;
}
