:root {
  color-scheme: light;
  --bg: #f8fafc;
  --bg-soft: #eef2ff;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-emphasis: #eef2ff;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --text: #0f172a;
  --muted: #64748b;
  --muted-strong: #334155;
  --blue: #4f46e5;
  --blue-strong: #4338ca;
  --blue-soft: #eef2ff;
  --green: #059669;
  --green-soft: #ecfdf5;
  --amber: #f59e0b;
  --amber-soft: #fffbeb;
  --red: #e11d48;
  --red-soft: #fff1f2;
  --shadow: 0 22px 48px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 14px 32px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(180deg, #f8fafc 0%, #eef2ff 42%, #f8fafc 100%);
  color: var(--text);
}

button,
textarea,
input {
  font: inherit;
}

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

a:hover {
  text-decoration: underline;
}

.page {
  min-height: 100vh;
  padding: 28px 18px 48px;
}

.page-shell {
  max-width: 1560px;
  margin: 0 auto;
  display: grid;
  gap: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid rgba(203, 213, 225, 0.92);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-strong) 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.brand-label {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.brand-title {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.2;
  font-weight: 700;
}

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

.topnav-link {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  color: var(--muted);
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.topnav-link:hover {
  text-decoration: none;
  background: var(--surface-soft);
  border-color: var(--line);
  color: var(--muted-strong);
}

.topnav-link.active {
  background: var(--blue-soft);
  border-color: #c7d2fe;
  color: var(--blue-strong);
}

.container {
  display: grid;
  gap: 18px;
}

.hero {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1.8fr) minmax(260px, 0.9fr);
  align-items: start;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.07) 0%, transparent 42%, rgba(15, 23, 42, 0.03) 100%);
  pointer-events: none;
}

.hero > * {
  position: relative;
  z-index: 1;
}

.hero-copy {
  display: grid;
  gap: 12px;
  max-width: 760px;
}

.hero-actions,
.hero-side {
  display: grid;
  gap: 12px;
  align-content: start;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.hero h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.02;
}

.hero p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 15px;
}

.hero-stat-grid {
  display: grid;
  gap: 10px;
}

.hero-stat {
  border: 1px solid rgba(188, 204, 220, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  padding: 14px;
}

.hero-stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.hero-stat strong {
  display: block;
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.panel-header h2,
.panel-header h3 {
  margin: 0;
  font-size: 15px;
}

.panel-body {
  padding: 18px;
}

.button {
  min-height: 44px;
  padding: 9px 14px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.button:hover:not([disabled]):not([aria-disabled="true"]) {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
}

.button.primary {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.button.subtle {
  background: var(--surface-soft);
}

.button.warn {
  background: var(--red-soft);
  border-color: rgba(225, 29, 72, 0.2);
  color: var(--red);
}

.button[disabled] {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.button[aria-disabled="true"] {
  opacity: 0.7;
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
  box-shadow: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  white-space: nowrap;
}

.badge.live,
.badge.available,
.badge.active,
.badge.completed,
.badge.passed,
.badge.running {
  background: var(--green-soft);
  color: var(--green);
}

.badge.active {
  background: var(--blue-soft);
  color: var(--blue-strong);
}

.badge.fallback {
  background: var(--amber-soft);
  color: var(--amber);
}

.badge.blocked,
.badge.failed,
.badge.locked {
  background: var(--red-soft);
  color: var(--red);
}

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

.pill,
.small-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
}

.message {
  display: none;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 14px;
  line-height: 1.5;
}

.message.visible {
  display: block;
}

.message.info {
  background: var(--blue-soft);
  border-color: #c7d8ff;
}

.message.success {
  background: var(--green-soft);
  border-color: #bde5c7;
  color: var(--green);
}

.message.error {
  background: var(--red-soft);
  border-color: #ffc9b3;
  color: var(--red);
}

.summary-card,
.card,
.summary-item,
.deliverable-item,
.review-item,
.metric-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface);
}

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

.card-eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.summary-card h3,
.card h3,
.summary-item h4,
.deliverable-item h4,
.metric-item h4 {
  margin: 0 0 6px;
  font-size: 15px;
}

.summary-card p,
.card p,
.summary-item p,
.deliverable-item p,
.review-item p,
.metric-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

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

.hidden {
  display: none;
}

.empty {
  color: var(--muted);
}

code,
.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

pre {
  margin: 0;
  padding: 14px;
  border-radius: 8px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--muted-strong);
  line-height: 1.6;
}

.live-timeline-list {
  display: grid;
  gap: 10px;
  max-height: 520px;
  overflow: auto;
  padding-right: 6px;
}

.draft-live-timeline-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.draft-live-timeline-toolbar .field-hint {
  margin: 0;
}

.live-timeline-item {
  display: grid;
  gap: 8px;
}

.live-timeline-item-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.live-timeline-item-head strong {
  display: block;
}

.live-timeline-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.live-timeline-item-detail {
  margin: 0;
  color: var(--muted-foreground, #596579);
}

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 720px) {
  .page {
    padding: 22px 14px 36px;
  }

  .hero,
  .panel-body,
  .panel-header {
    padding-left: 14px;
    padding-right: 14px;
  }

  .draft-live-timeline-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}
