:root {
  color-scheme: dark;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  background: #0b1020;
  color: #edf2ff;
  --surface: #131b2f;
  --surface-2: #19243d;
  --line: #2a3858;
  --muted: #9aa9c5;
  --accent: #7c9cff;
  --accent-strong: #9db4ff;
  --success: #72d6a0;
  --warning: #f7c76f;
  --danger: #ff8e9d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top right, #1b2850 0, transparent 35%),
    #0b1020;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar,
.layout {
  width: min(1440px, calc(100% - 32px));
  margin-inline: auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding: 34px 0 22px;
}

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

h1 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 5vw, 3.5rem);
  letter-spacing: -0.04em;
}

h2 {
  margin-bottom: 0;
  font-size: 1.35rem;
}

h3 {
  margin-bottom: 0;
}

.eyebrow {
  margin-bottom: 7px;
  color: var(--accent-strong);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.subtitle,
.project-description,
.task-prompt,
.notice,
.empty-state {
  color: var(--muted);
  line-height: 1.55;
}

.safety-chip,
.state-badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid #725f32;
  border-radius: 999px;
  background: #322a18;
  color: var(--warning);
  font-size: 0.82rem;
  font-weight: 750;
}

.safety-chip {
  padding: 10px 14px;
}

.safety-chip[data-execution="enabled"] {
  border-color: var(--danger);
  background: #401d25;
  color: var(--danger);
}

.state-badge {
  padding: 7px 11px;
}

.layout {
  padding-bottom: 48px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: 0 18px 60px rgb(0 0 0 / 16%);
}

.metric {
  padding: 17px 18px;
}

.metric span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.82rem;
}

.metric strong {
  font-size: 1.65rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 0.8fr) minmax(0, 1.5fr);
  gap: 18px;
}

.panel {
  padding: 20px;
}

.panel-heading,
.task-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.panel-heading {
  margin-bottom: 18px;
}

.task-heading {
  margin-top: 26px;
  margin-bottom: 12px;
}

.stack {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: #dce5f8;
  font-size: 0.86rem;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  background: #0e1628;
  color: #f4f7ff;
  padding: 11px 12px;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(124 156 255 / 14%);
}

.primary,
.secondary {
  border-radius: 11px;
  font-weight: 800;
}

.primary {
  border: 0;
  background: var(--accent);
  color: #081020;
  padding: 12px 15px;
}

.primary:hover {
  background: var(--accent-strong);
}

.secondary {
  border: 1px solid var(--line);
  background: transparent;
  color: #dce5f8;
  padding: 8px 11px;
}

.project-list,
.task-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.project-card,
.task-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-2);
  color: inherit;
  padding: 13px 14px;
  text-align: left;
}

.task-actions { display: flex; gap: 8px; margin-top: 4px; }
.run-detail { margin-top: 14px; max-height: 32rem; overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: #080d19; padding: 14px; white-space: pre-wrap; }

.project-card {
  display: grid;
  gap: 5px;
}

.project-card:hover,
.project-card.active {
  border-color: var(--accent);
}

.project-card.active {
  box-shadow: inset 3px 0 0 var(--accent);
}

.project-card small,
.task-meta {
  color: var(--muted);
}

.task-card {
  display: grid;
  gap: 8px;
}

.task-card-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.task-state {
  color: var(--success);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.project-summary,
.notice,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 14px;
}

.project-summary {
  margin-bottom: 18px;
  background: #101a2f;
}

.notice {
  background: #181e2f;
  color: var(--warning);
  font-size: 0.88rem;
}

.approval-panel {
  margin-top: 18px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: min(420px, calc(100% - 44px));
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #19243d;
  box-shadow: 0 16px 50px rgb(0 0 0 / 35%);
  padding: 13px 15px;
}

.toast.error {
  border-color: #794051;
  color: var(--danger);
}

@media (max-width: 900px) {
  .status-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .topbar {
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .topbar,
  .layout {
    width: min(100% - 20px, 1440px);
  }

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

  .panel {
    padding: 16px;
  }
}

.topbar-actions,
.auth-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-actions {
  flex-direction: column;
  align-items: flex-end;
}

.auth-user {
  color: var(--muted);
  font-size: 0.86rem;
}

.login-body {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 20px;
}

.login-shell {
  width: min(100%, 460px);
}

.login-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 24px 80px rgb(0 0 0 / 30%);
  padding: clamp(24px, 6vw, 38px);
}

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

.remember-row input {
  width: auto;
}

.login-error,
.login-security {
  border: 1px solid var(--line);
  border-radius: 11px;
  margin-top: 16px;
  padding: 11px 12px;
}

.login-error {
  color: var(--danger);
}

.login-security {
  color: var(--muted);
  font-size: 0.82rem;
}

button:disabled {
  opacity: 0.65;
}
