:root {
  color-scheme: light;
  --bg: #eef2fb;
  --bg2: #f7f9ff;
  --panel: #ffffff;
  --line: #dce4f1;
  --line-strong: #c9d6ea;
  --text: #0f1d33;
  --muted: #5f6f86;
  --blue: #2f67f6;
  --blue-soft: #edf3ff;
  --good: #198f69;
  --warn: #b17d00;
  --bad: #c83f3f;
  --radius-xl: 24px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --shadow: 0 14px 36px rgba(18, 35, 68, 0.08);
  --font: "Plus Jakarta Sans", "Segoe UI", "Inter", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(circle at 10% 10%, #dfe8ff 0%, transparent 38%),
    radial-gradient(circle at 90% 0%, #e7f1ff 0%, transparent 32%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
}

body {
  padding: 14px;
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.bg-glow {
  display: none;
}

.shell {
  width: min(1440px, 100%);
  height: calc(100svh - 28px);
  margin: 0 auto;
}

.login-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.login-card {
  width: min(960px, 100%);
  height: min(600px, calc(100svh - 28px));
  margin: 0 auto;
  padding: 20px;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
  gap: 16px;
  align-items: stretch;
  background:
    linear-gradient(165deg, #ffffff 0%, #f7fbff 55%, #f3f8ff 100%);
  border-color: #d6e3f9;
}

.brand-row,
.topbar,
.panel-head,
.stats-row,
.log-toolbar,
.profile-card,
.history-card,
.topbar-actions,
.panel-actions,
.action-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(145deg, #2f67f6, #6890ff);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 1.55rem;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.71rem;
  font-weight: 800;
  color: #2f67f6;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 4.2vw, 2.8rem);
  line-height: 1.08;
}

h2 {
  font-size: clamp(1.15rem, 2.1vw, 1.7rem);
  line-height: 1.18;
}

h3 {
  font-size: 1.14rem;
}

.lead,
.meta-line {
  color: var(--muted);
  line-height: 1.35;
  font-size: 0.95rem;
}

.login-hero {
  border: 1px solid #d9e6ff;
  border-radius: 16px;
  background:
    radial-gradient(circle at 0% 0%, #dbe7ff 0%, transparent 55%),
    linear-gradient(150deg, #f2f7ff 0%, #eef5ff 100%);
  padding: 26px;
  display: grid;
  align-content: center;
  gap: 12px;
}

.hero-points {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hero-points span {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid #cfe0ff;
  background: #ffffff;
  color: #2a4f9f;
}

.login-form-wrap {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff;
  padding: 18px;
  display: grid;
  align-content: center;
  gap: 12px;
}

.form-card,
.create-grid {
  display: grid;
  gap: 10px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.93rem;
  font-weight: 600;
}

input {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: #fbfdff;
  color: var(--text);
  padding: 9px 11px;
  outline: none;
}

input:focus {
  border-color: #6d93f8;
  box-shadow: 0 0 0 3px rgba(47, 103, 246, 0.14);
}

.primary-btn,
.secondary-btn,
.ghost-btn {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 9px 12px;
  font-size: 0.9rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: transform 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}

.primary-btn {
  background: linear-gradient(120deg, #2f67f6, #6189fb);
  color: #fff;
  box-shadow: 0 9px 20px rgba(47, 103, 246, 0.25);
}

.secondary-btn {
  background: #edf3ff;
  color: var(--text);
  border-color: #d8e4fb;
}

.ghost-btn {
  background: #f7f9fd;
  color: var(--text);
  border-color: var(--line);
}

.primary-btn:hover,
.secondary-btn:hover,
.ghost-btn:hover,
.profile-card:hover,
.history-card:hover {
  transform: translateY(-1px);
}

.btn-icon {
  width: 15px;
  height: 15px;
  display: inline-grid;
  place-items: center;
}

.btn-icon svg {
  width: 100%;
  height: 100%;
}

.error-box {
  margin: 0;
  color: #ad3030;
  background: #fff1f1;
  border: 1px solid #f3d0d0;
  padding: 10px 12px;
  border-radius: 12px;
}

.portal-view {
  height: 100%;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 10px;
  min-height: 0;
}

.tab-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f6f9ff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 5px;
  width: fit-content;
}

.tab-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 9px;
  padding: 7px 12px;
  font-size: 0.84rem;
  font-weight: 700;
}

.tab-btn.is-active {
  background: #ffffff;
  border-color: #d6e3fb;
  color: var(--text);
  box-shadow: 0 4px 12px rgba(18, 35, 68, 0.08);
}

.tab-panels {
  min-height: 0;
  height: 100%;
}

.tab-panel {
  min-height: 0;
  height: 100%;
  overflow: auto;
}

.tab-panel--activity {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(0, 1.1fr);
  gap: 10px;
  overflow: hidden;
}

.topbar {
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px;
}

.topbar-actions {
  gap: 8px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 0.78rem;
  font-weight: 800;
}

.status-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
}

.status-pill--idle,
.status-pill--queued {
  color: var(--warn);
}

.status-pill--running {
  color: var(--blue);
}

.status-pill--success {
  color: var(--good);
}

.status-pill--failed {
  color: var(--bad);
}

.status-pill--rolled_back {
  color: #7b5ad6;
}

.muted-count,
.user-chip,
.meta-line,
.stat-label,
.history-card__meta,
.profile-card__slug,
.profile-card__branch,
.history-card__time {
  color: var(--muted);
}

.create-panel {
  padding: 12px;
  border-radius: var(--radius-lg);
}

.create-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.create-grid .wide {
  grid-column: 1 / -1;
}

.switch {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 600;
}

.switch input {
  width: 17px;
  height: 17px;
  accent-color: var(--blue);
}

.pill {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.75rem;
  font-weight: 800;
  color: #2f67f6;
  background: var(--blue-soft);
  border: 1px solid #d8e4fb;
}

.action-row {
  justify-content: flex-end;
}

.panel {
  min-height: 0;
  padding: 12px;
  border-radius: var(--radius-lg);
  display: grid;
  gap: 10px;
}

.panel-head {
  justify-content: space-between;
  gap: 8px;
}

.profile-list,
.history-list {
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 8px;
  padding-right: 3px;
}

.profile-card,
.history-card {
  width: 100%;
  border: 1px solid var(--line);
  background: #f9fbff;
  border-radius: 12px;
  padding: 9px;
  text-align: left;
  justify-content: space-between;
}

.profile-card.is-active,
.history-card.is-active {
  border-color: #8aa9ff;
  box-shadow: 0 0 0 2px #e9f0ff inset;
}

.profile-card__main,
.history-card > div:first-child {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.profile-card__title,
.history-card__title {
  font-weight: 800;
  font-size: 0.9rem;
}

.profile-card__meta,
.history-card__tail {
  display: grid;
  justify-items: end;
  gap: 4px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.stats-row > div {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 7px 8px;
  background: #f8fbff;
  display: grid;
  gap: 4px;
}

.stat-label {
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.67rem;
  font-weight: 800;
}

.log-toolbar {
  justify-content: space-between;
}

.log-output {
  margin: 0;
  min-height: 0;
  height: 100%;
  overflow: auto;
  border-radius: 12px;
  border: 1px solid #17243a;
  background: #0f1726;
  color: #d5e3ff;
  padding: 11px;
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-size: 0.78rem;
  line-height: 1.4;
}

.log-panel {
  grid-template-rows: auto auto auto 1fr;
}

.empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}

@media (max-width: 980px) {
  body {
    overflow: auto;
    padding: 10px;
  }

  .shell {
    height: auto;
    min-height: calc(100svh - 20px);
  }

  .portal-view {
    height: auto;
    grid-template-rows: auto;
  }

  .login-card {
    width: min(560px, 100%);
    height: auto;
    grid-template-columns: 1fr;
  }

  .tab-nav {
    width: 100%;
    justify-content: space-between;
  }

  .tab-panels,
  .tab-panel {
    height: auto;
  }

  .tab-panel--activity {
    grid-template-columns: 1fr;
  }

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

  .stats-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .log-output {
    min-height: 260px;
  }
}
