:root {
  color-scheme: light;
  font-family: "Inter", "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg-top: #eef2ff;
  --bg-mid: #f8fafc;
  --panel: #ffffff;
  --border: rgba(148, 163, 184, 0.32);
  --text: #0f172a;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-2: #7c3aed;
  --success: #16a34a;
  --danger: #dc2626;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-family, "Inter", sans-serif);
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-mid) 40%, #fff 100%);
  color: var(--text);
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 10% 20%, rgba(124, 58, 237, 0.12), transparent 45%),
    radial-gradient(circle at 80% 0%, rgba(37, 99, 235, 0.1), transparent 35%);
  pointer-events: none;
  z-index: 0;
}

a {
  color: var(--accent-2);
  text-decoration: none;
}

.page {
  position: relative;
  z-index: 1;
}

.page-wrapper {
  width: min(1200px, 100%);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.top-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  background: rgba(255, 255, 255, 0.85);
  padding: 1.4rem 1.6rem;
  border-radius: 24px;
  border: 1px solid var(--border);
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(12px);
  margin-bottom: 1.5rem;
}

.top-bar__title h1 {
  margin: 0.1rem 0 0.3rem;
  font-size: 1.85rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.25em;
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0;
}

.muted {
  color: var(--muted);
  font-size: 0.95rem;
}

.small {
  font-size: 0.85rem;
}

.nav-tabs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  background: #f1f5f9;
  padding: 0.4rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.nav-tabs a {
  padding: 0.45rem 1.1rem;
  border-radius: 999px;
  font-weight: 600;
  color: #475569;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.nav-tabs a.active {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 10px 25px rgba(124, 58, 237, 0.35);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.header-actions .chip {
  margin-right: 0.5rem;
}

.notice {
  margin-bottom: 1.5rem;
  padding: 0.95rem 1.2rem;
  border-radius: 16px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  background: rgba(37, 99, 235, 0.08);
  color: var(--accent);
  font-weight: 500;
}

.notice.success {
  border-color: rgba(34, 197, 94, 0.3);
  background: rgba(34, 197, 94, 0.1);
  color: var(--success);
}

.notice.error {
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.1);
  color: var(--danger);
}

.hidden {
  display: none !important;
}

.panel {
  background: var(--panel);
  border-radius: 28px;
  padding: 2rem;
  border: 1px solid var(--border);
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.08);
  margin-bottom: 2rem;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.panel-head h2 {
  margin: 0.2rem 0;
}

.chip {
  border-radius: 999px;
  padding: 0.35rem 1rem;
  background: rgba(37, 99, 235, 0.1);
  color: var(--accent);
  font-weight: 600;
  font-size: 0.9rem;
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(320px, 0.9fr);
  gap: 1.5rem;
  align-items: start;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

label {
  font-weight: 600;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.95rem;
}

input,
textarea,
select {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  padding: 0.9rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
  transition: border 0.2s, box-shadow 0.2s;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

textarea {
  min-height: 130px;
  resize: vertical;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 999px;
  background: linear-gradient(130deg, var(--accent), var(--accent-2));
  color: #fff;
  font-weight: 600;
  padding: 0.85rem 1.9rem;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 18px 30px rgba(37, 99, 235, 0.25);
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 22px 35px rgba(37, 99, 235, 0.3);
}

.btn-stretch {
  width: 100%;
}

button.ghost {
  background: transparent;
  border: 1px solid rgba(148, 163, 184, 0.6);
  color: var(--text);
  box-shadow: none;
  padding: 0.7rem 1.4rem;
}

button.pill {
  border-radius: 999px;
}

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

.tasks-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.history-panel {
  background: rgba(255, 255, 255, 0.94);
}

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

.api-table article {
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 18px;
  padding: 1rem 1.2rem;
  background: #f8fafc;
}

.api-table pre {
  background: #0f172a;
  color: #cbd5f5;
  padding: 0.8rem;
  border-radius: 10px;
  font-size: 0.85rem;
  overflow-x: auto;
}

.task {
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 18px;
  padding: 1rem 1.2rem;
  background: #fdfdff;
  box-shadow: 0 12px 25px rgba(15, 23, 42, 0.05);
}

.task-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.task strong {
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  color: #0f172a;
}

.task .badge {
  text-transform: none;
}

.badge.status-queued {
  background: #fef3c7;
  color: #92400e;
}

.badge.status-running {
  background: #dbeafe;
  color: #1e3a8a;
}

.badge.status-done {
  background: #dcfce7;
  color: #15803d;
}

.badge.status-failed {
  background: #fee2e2;
  color: #b91c1c;
}

.task a {
  margin-top: 0.6rem;
  display: inline-flex;
  color: var(--accent);
  font-weight: 600;
}

.error-text {
  color: var(--danger);
  font-weight: 500;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.5rem;
}

.actions {
  display: flex;
  gap: 0.75rem;
}

.pagination button {
  width: auto;
  min-width: 120px;
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.login-wrapper {
  width: min(420px, 100%);
}

.login-panel {
  padding: 2.5rem;
}

.login-panel h1 {
  margin: 0.5rem 0 0.8rem;
}

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

  .nav-tabs {
    width: 100%;
  }

  .panel {
    padding: 1.5rem;
  }

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

  button {
    width: 100%;
  }

  .pagination {
    flex-direction: column;
    gap: 0.8rem;
  }
}
