:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --panel: #11151b;
  --panel-2: #151b23;
  --text: #f3f6f8;
  --muted: #94a0ad;
  --line: #26313d;
  --accent: #4fd1c5;
  --accent-2: #f4b860;
  --danger: #ff6b6b;
  --ok: #6ee7a8;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.36);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 20% 0%, rgba(79, 209, 197, 0.14), transparent 30%),
    radial-gradient(circle at 90% 10%, rgba(244, 184, 96, 0.10), transparent 28%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: rgba(9, 12, 15, 0.82);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}

.mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #061012;
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand small,
.muted,
.form-note,
.timestamp {
  color: var(--muted);
}

nav {
  display: grid;
  gap: 6px;
}

nav a,
.ghost-button,
.subtle-button,
.icon-button {
  border: 1px solid transparent;
  color: var(--muted);
  background: transparent;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 8px;
  cursor: pointer;
}

nav a:hover,
nav a.active,
.ghost-button:hover,
.subtle-button:hover,
.icon-button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.08);
}

svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.sidebar form {
  margin-top: auto;
}

.workspace {
  padding: 28px;
  display: grid;
  gap: 22px;
  max-width: 1520px;
  width: 100%;
}

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

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

h1 {
  font-size: 34px;
  line-height: 1.08;
}

h2 {
  font-size: 20px;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 800;
}

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

.live-pill,
.status-pill {
  border: 1px solid rgba(110, 231, 168, 0.24);
  background: rgba(110, 231, 168, 0.09);
  color: var(--ok);
  border-radius: 999px;
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
}

.live-pill span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 6px rgba(110, 231, 168, 0.10);
}

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

.metrics article,
.panel,
.login-card,
.login-brand {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(21, 27, 35, 0.94), rgba(13, 17, 22, 0.94));
  box-shadow: var(--shadow);
  border-radius: 8px;
}

.metrics article {
  padding: 18px;
  min-height: 104px;
  display: grid;
  align-content: end;
}

.metrics span {
  font-size: 36px;
  font-weight: 900;
}

.metrics small {
  color: var(--muted);
  font-weight: 700;
}

.panel {
  padding: 20px;
  display: grid;
  gap: 18px;
}

.agent-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.agent-card {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  border-radius: 8px;
  padding: 18px;
  display: grid;
  gap: 16px;
}

.agent-top {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.agent-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.agent-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(79, 209, 197, 0.12);
  color: var(--accent);
}

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

.chip {
  color: #c7d0da;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

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

.health-item,
.list-item,
.timeline-item {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.035);
  border-radius: 8px;
  padding: 12px;
}

.health-item {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}

.health-item strong {
  color: var(--text);
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 22px;
}

.list,
.timeline {
  display: grid;
  gap: 10px;
}

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.list-item p,
.timeline-item p {
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.45;
}

.status-pill.neutral {
  border-color: rgba(244, 184, 96, 0.26);
  background: rgba(244, 184, 96, 0.10);
  color: var(--accent-2);
}

.status-pill.danger {
  border-color: rgba(255, 107, 107, 0.26);
  background: rgba(255, 107, 107, 0.10);
  color: var(--danger);
}

.job-status {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.job-status article {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.035);
  border-radius: 8px;
  padding: 12px;
}

.job-status strong {
  display: block;
  font-size: 24px;
}

.job-status span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.subtle-button {
  background: rgba(79, 209, 197, 0.10);
  color: var(--accent);
  border-color: rgba(79, 209, 197, 0.18);
}

.subtle-button.primary {
  background: linear-gradient(135deg, rgba(79, 209, 197, 0.94), rgba(244, 184, 96, 0.94));
  color: #061012;
  border-color: transparent;
  font-weight: 900;
}

.icon-button {
  width: 42px;
  justify-content: center;
  padding: 0;
}

.profile-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.timestamp[data-tone="danger"] {
  color: var(--danger);
}

.timestamp[data-tone="neutral"] {
  color: var(--accent-2);
}

.profile-builder {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 16px;
  min-height: 620px;
}

.profile-list {
  display: grid;
  align-content: start;
  gap: 10px;
}

.profile-card {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  border-radius: 8px;
  padding: 14px;
  text-align: left;
  cursor: pointer;
  display: grid;
  gap: 12px;
}

.profile-card:hover,
.profile-card.active {
  border-color: rgba(79, 209, 197, 0.42);
  background: rgba(79, 209, 197, 0.08);
}

.profile-card p,
.profile-card small {
  color: var(--muted);
  line-height: 1.4;
}

.profile-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.profile-editor {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  padding: 16px;
  display: grid;
  gap: 14px;
  min-width: 0;
}

.profile-editor-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.profile-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.profile-tab {
  min-height: 38px;
  flex: 0 0 auto;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  padding: 0 12px;
  cursor: pointer;
  font-weight: 800;
}

.profile-tab:hover,
.profile-tab.active {
  color: var(--text);
  border-color: rgba(79, 209, 197, 0.34);
  background: rgba(79, 209, 197, 0.10);
}

.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 14px;
  min-height: 470px;
}

.editor-pane,
.preview-pane {
  min-width: 0;
}

.editor-pane span,
.preview-head {
  color: #c7d0da;
  font-weight: 900;
}

textarea {
  width: 100%;
  min-height: 430px;
  resize: vertical;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #090c10;
  color: var(--text);
  padding: 14px;
  outline: none;
  line-height: 1.5;
}

textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(79, 209, 197, 0.12);
}

.preview-pane {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #090c10;
  border-radius: 8px;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.preview-head {
  min-height: 46px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.preview-head small {
  color: var(--muted);
}

.preview-pane pre {
  margin: 0;
  padding: 14px;
  white-space: pre-wrap;
  overflow: auto;
  color: #dbe5ee;
  font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.login-shell {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 18px;
  max-width: 980px;
  width: 100%;
}

.login-brand,
.login-card {
  padding: 28px;
}

.login-brand {
  min-height: 440px;
  align-content: end;
  display: grid;
  gap: 14px;
}

.login-brand h1 {
  font-size: 56px;
}

.login-card {
  display: grid;
  gap: 18px;
  align-content: center;
}

label {
  display: grid;
  gap: 8px;
  color: #c7d0da;
  font-weight: 800;
}

input {
  min-height: 48px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #090c10;
  color: var(--text);
  padding: 0 14px;
  outline: none;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(79, 209, 197, 0.12);
}

.login-card button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #061012;
  font-weight: 900;
  cursor: pointer;
}

@media (max-width: 980px) {
  .app-shell,
  .split-grid,
  .login-panel,
  .profile-builder,
  .editor-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

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

@media (max-width: 640px) {
  .workspace,
  .sidebar {
    padding: 16px;
  }

  .metrics,
  .agent-grid,
  .job-status,
  .health-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  h1,
  .login-brand h1 {
    font-size: 34px;
  }
}
