:root {
  color-scheme: light;
  --bg: #f2f4f6;
  --bg-accent: #e8edf2;
  --surface: #ffffff;
  --surface-strong: #f8fafc;
  --surface-ink: #1f2937;
  --border: #cdd3d8;
  --text: #1c1c1c;
  --text-strong: #1f2937;
  --muted: #4c4c4c;
  --subtle: #6c7883;
  --brand: #0091ac;
  --brand-dark: #006a7e;
  --brand-soft: #47b8cd;
  --ok: #2ca58d;
  --warning: #8b5e00;
  --danger: #b82831;
  --shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
  --shadow-strong: 0 18px 36px rgba(15, 23, 42, 0.12);
  --radius-xl: 20px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

body.pub-pv {
  --bg: #f7f1f2;
  --bg-accent: #f6e6e8;
  --surface: #fffdfd;
  --surface-strong: #fff5f6;
  --surface-ink: #3b1d22;
  --border: #e6c9ce;
  --text: #2e171b;
  --text-strong: #3b1d22;
  --muted: #72535a;
  --subtle: #8f7078;
  --brand: #b82831;
  --brand-dark: #8e1d25;
  --brand-soft: #df6d74;
  --ok: #b82831;
  --warning: #8b5e00;
  --danger: #8e1d25;
  --shadow: 0 12px 28px rgba(122, 29, 35, 0.08);
  --shadow-strong: 0 18px 36px rgba(122, 29, 35, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Roboto Slab", serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(0, 145, 172, 0.08), transparent 24%),
    radial-gradient(circle at 12% 0%, rgba(71, 184, 205, 0.06), transparent 20%),
    linear-gradient(180deg, #f7f9fb 0%, #eef2f6 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

body.pub-pv {
  background:
    radial-gradient(circle at top right, rgba(184, 40, 49, 0.1), transparent 24%),
    radial-gradient(circle at 12% 0%, rgba(223, 109, 116, 0.08), transparent 20%),
    linear-gradient(180deg, #fff9fa 0%, #f7eef0 100%);
}

code,
pre {
  font-family: "Roboto Mono", monospace;
}

.app-shell {
  width: min(1320px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 18px 0 40px;
}

.hosted-env-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(90deg, #8e1d25 0%, #b82831 50%, #8e1d25 100%);
  color: #fff7f8;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
}

body.env-staging .app-shell {
  padding-top: 34px;
}

body.env-staging .app-home-button {
  top: 28px;
}

.app-home-button {
  position: fixed;
  top: 12px;
  right: 14px;
  z-index: 40;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 13px;
  color: var(--text-strong);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.app-home-button:hover,
.app-home-button:focus-visible {
  transform: translateY(-1px);
  border-color: var(--brand);
  background: #ffffff;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 18px;
  align-items: stretch;
}

.hero-copy,
.hero-card,
.panel {
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 28px;
  border-radius: var(--radius-xl);
  position: relative;
  overflow: hidden;
}

.hero-copy::after {
  content: "";
  position: absolute;
  inset: auto -40px -40px auto;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 145, 172, 0.14), transparent 70%);
  pointer-events: none;
}

.eyebrow,
.hero-card-label,
.section-kicker {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  color: var(--brand);
  font-weight: 700;
}

.hero-copy h1,
.panel-header h2,
.story-title,
.workspace-card h2 {
  margin: 0;
  font-family: "Playfair Display", serif;
  letter-spacing: -0.02em;
}

.hero-copy h1 {
  font-size: clamp(36px, 5vw, 58px);
  line-height: 1.02;
}

.hero-text {
  max-width: 56ch;
  margin: 18px 0 0;
  font-size: 17px;
  line-height: 1.6;
  color: var(--muted);
}

.hero-stack {
  display: grid;
  gap: 18px;
}

.hero-card {
  border-radius: var(--radius-lg);
  padding: 22px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbfd 100%);
  animation: float-up 420ms ease-out both;
}

.hero-card-value {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  color: var(--text-strong);
}

.hero-card-value-compact {
  font-size: 22px;
}

.hero-card-meta {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.hero-card-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.hero-card-accent {
  background: linear-gradient(180deg, #f8fbfd 0%, #eff7fa 100%);
}

body.pub-pv .hero-card-accent {
  background: linear-gradient(180deg, #fff8f8 0%, #fbeff1 100%);
}

.hero-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.ghost-button {
  border: 1px solid var(--brand);
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #ffffff;
  border-radius: 999px;
  padding: 10px 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  min-height: 42px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease;
  box-shadow: 0 10px 22px rgba(0, 145, 172, 0.18);
}

.ghost-button:hover,
.ghost-button:focus-visible {
  transform: translateY(-1px);
  border-color: var(--brand-dark);
  background: var(--brand-dark);
  box-shadow: 0 14px 28px rgba(0, 145, 172, 0.22);
  outline: none;
}

body.pub-pv .ghost-button:hover,
body.pub-pv .ghost-button:focus-visible {
  box-shadow: 0 14px 28px rgba(184, 40, 49, 0.22);
}

.ghost-button:disabled,
.ghost-button[aria-disabled="true"] {
  cursor: not-allowed;
  transform: none;
  background: linear-gradient(180deg, #c7d2da 0%, #aebcc7 100%);
  border-color: #aebcc7;
  box-shadow: none;
  opacity: 0.72;
}

.hosted-auth-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
  max-width: 460px;
}

.hosted-auth-field {
  display: grid;
  gap: 8px;
}

.hosted-auth-field span {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.hosted-auth-field input {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--text);
  font: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.hosted-auth-field input:focus {
  outline: 2px solid rgba(0, 145, 172, 0.18);
  outline-offset: 1px;
}

.layout {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

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

.module-card {
  min-height: 198px;
}

.panel {
  border-radius: var(--radius-md);
  padding: 22px;
  animation: float-up 420ms ease-out both;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.panel-text {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.6;
}

.status-line {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

.status-line.ok {
  color: var(--brand-dark);
}

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

.status-line.warning {
  color: var(--warning);
}

.status-line-detail {
  margin-top: 4px;
  font-size: 11px;
  color: var(--subtle);
}

.checklist {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.7;
}

.checklist li + li,
.mini-checklist li + li {
  margin-top: 8px;
}

.story-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 20px;
}

.rail {
  display: grid;
  gap: 20px;
}

.story-panel {
  min-height: 540px;
}

.chip-row,
.story-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.meta-chip,
.story-meta span {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 12px;
  background: rgba(0, 145, 172, 0.08);
  color: var(--surface-ink);
  font-size: 13px;
}

.story-state,
.story-dek,
.workspace-copy {
  color: var(--muted);
  line-height: 1.65;
}

.story-state {
  margin: 0 0 14px;
}

.story-overline {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
}

.story-title {
  margin-top: 12px;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.06;
}

.story-dek {
  margin: 16px 0 18px;
  font-size: 17px;
}

.story-body {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.story-body p {
  margin: 0;
  padding-left: 16px;
  border-left: 3px solid rgba(0, 145, 172, 0.18);
  line-height: 1.7;
}

.story-link {
  display: inline-flex;
  margin-top: 22px;
  color: var(--brand);
  font-weight: 700;
  text-decoration: none;
}

.story-link-disabled {
  pointer-events: none;
  opacity: 0.65;
}

.metric-list {
  display: grid;
  gap: 14px;
}

.metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(205, 211, 216, 0.85);
}

.metric-label {
  color: var(--muted);
}

.metric-value {
  font-weight: 700;
}

.workspace-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.workspace-card {
  min-height: 280px;
}

.mini-checklist {
  margin: 16px 0 0;
  padding-left: 20px;
  line-height: 1.7;
  color: var(--muted);
}

.placeholder-stack {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.placeholder-slot {
  min-height: 58px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px dashed rgba(0, 145, 172, 0.2);
  background: rgba(248, 250, 252, 0.92);
  color: var(--muted);
}

.inspector-panel {
  overflow: hidden;
}

.payload-view {
  margin: 0;
  min-height: 220px;
  padding: 18px;
  border-radius: var(--radius-sm);
  border: 1px dashed rgba(0, 145, 172, 0.24);
  background: var(--surface-strong);
  color: var(--surface-ink);
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 110px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(0, 145, 172, 0.1);
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
}

.badge[data-state="ok"] {
  background: rgba(44, 165, 141, 0.12);
  color: var(--ok);
}

@keyframes float-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 860px) {
  .hero,
  .story-layout,
  .module-grid,
  .workspace-board {
    grid-template-columns: 1fr;
  }

  .app-shell {
    width: min(100vw - 16px, 1320px);
    padding-top: 16px;
  }

  .hero-copy,
  .hero-card,
  .panel {
    padding: 18px;
  }

  .panel-header,
  .hero-card-row {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  .panel,
  .hero-card,
  .ghost-button {
    animation: none;
    transition: none;
  }
}
