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

:root {
  --bg: #f3f5f2;
  --bg-elevated: #ffffff;
  --ink: #14201b;
  --muted: #5c6b63;
  --line: #d5ddd7;
  --teal: #0f766e;
  --teal-dark: #0b5a54;
  --teal-soft: #d8f0ec;
  --amber: #b45309;
  --amber-soft: #fef3c7;
  --red: #b91c1c;
  --red-soft: #fee2e2;
  --green: #166534;
  --green-soft: #dcfce7;
  --shadow: 0 12px 40px rgba(20, 32, 27, 0.08);
  --radius: 14px;
  --font: 'Sora', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, #cceae4 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #e8efe6 0%, transparent 50%),
    var(--bg);
  line-height: 1.45;
}

a { color: var(--teal); }
button, .btn { cursor: pointer; }
button:disabled, .btn:disabled { opacity: 0.55; cursor: not-allowed; }

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: min(420px, 100%);
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 32px;
  box-shadow: var(--shadow);
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.brand-mark span {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(145deg, var(--teal), #134e4a);
  display: grid; place-items: center; color: #fff; font-size: 14px;
}
.auth-card h1 { margin: 0 0 6px; font-size: 1.55rem; letter-spacing: -0.03em; }
.auth-card p.lead { margin: 0 0 22px; color: var(--muted); font-size: 0.95rem; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 0.82rem; font-weight: 600; margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  font: inherit;
  background: #fbfcfb;
  color: var(--ink);
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: 2px solid rgba(15, 118, 110, 0.35);
  border-color: var(--teal);
}
.field .hint { margin-top: 5px; font-size: 0.75rem; color: var(--muted); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 10px; padding: 11px 16px;
  font: inherit; font-weight: 600; text-decoration: none;
}
.btn-primary { background: var(--teal); color: #fff; width: 100%; }
.btn-primary:hover { background: var(--teal-dark); }
.btn-ghost {
  background: transparent; border: 1px solid var(--line); color: var(--ink);
}
.btn-ghost:hover { background: #eef2ef; }
.btn-danger { background: var(--red); color: #fff; }
.error-banner {
  background: var(--red-soft); color: var(--red);
  border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; font-size: 0.9rem;
}

.app-shell { max-width: 1240px; margin: 0 auto; padding: 20px 20px 48px; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: 22px;
}
.topbar nav { display: flex; gap: 8px; flex-wrap: wrap; }
.nav-btn {
  border: 1px solid transparent; background: transparent; color: var(--muted);
  padding: 8px 12px; border-radius: 999px; font-weight: 600; font-size: 0.9rem;
}
.nav-btn.active, .nav-btn:hover {
  background: var(--bg-elevated); color: var(--ink); border-color: var(--line);
}
.user-chip {
  font-family: var(--mono); font-size: 0.78rem; color: var(--muted);
  background: var(--bg-elevated); border: 1px solid var(--line);
  padding: 8px 12px; border-radius: 999px;
}

.panel { display: none; }
.panel.active { display: block; animation: rise 280ms ease; }
@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .panel.active { animation: none; }
}

.stats {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px;
  margin-bottom: 18px;
}
.stat {
  background: var(--bg-elevated); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
}
.stat .label { color: var(--muted); font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.stat .value { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.03em; margin-top: 4px; }

.card {
  background: var(--bg-elevated); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.card h2 { margin: 0 0 4px; font-size: 1.15rem; letter-spacing: -0.02em; }
.card .sub { margin: 0 0 16px; color: var(--muted); font-size: 0.9rem; }

.grid-2 { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.check-row { display: flex; gap: 16px; flex-wrap: wrap; margin: 8px 0 14px; }
.check-row label { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; font-weight: 500; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #eef4f1; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
tr:last-child td { border-bottom: none; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: #f5faf8; }

.badge {
  display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
}
.badge.queued { background: #e8eef2; color: #334155; }
.badge.running { background: var(--amber-soft); color: var(--amber); }
.badge.completed { background: var(--green-soft); color: var(--green); }
.badge.failed, .badge.cancelled { background: var(--red-soft); color: var(--red); }

.progress {
  height: 10px; background: #e6ece8; border-radius: 999px; overflow: hidden;
}
.progress > span {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--teal), #14b8a6);
  transition: width 400ms ease;
}

.log-box {
  font-family: var(--mono); font-size: 0.75rem; background: #101816; color: #d7ebe4;
  border-radius: 12px; padding: 12px; max-height: 280px; overflow: auto; white-space: pre-wrap;
}
.log-box .error { color: #fca5a5; }
.log-box .warn { color: #fcd34d; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.empty { color: var(--muted); padding: 24px; text-align: center; }

@media (max-width: 960px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: flex-start; }
}
