:root {
  --ink: #101318;
  --muted: #667085;
  --subtle: #8d98aa;
  --line: rgba(120, 132, 152, 0.22);
  --panel: #ffffff;
  --soft: #f5f7fb;
  --page-start: #f7f9fc;
  --page-mid: #edf2f9;
  --page-end: #f8f8fb;
  --sidebar-bg: #ffffff;
  --sidebar-border: #e7ebf0;
  --nav-bg: #f2f4f8;
  --control-bg: #ffffff;
  --control-border: #e2e7ee;
  --row-hover: #fbfcfe;
  --dark-panel-start: #141821;
  --dark-panel-end: #2d3542;
  --brand: #007aff;
  --brand-2: #34c759;
  --warning: #ff9f0a;
  --danger: #ff3b30;
  --shadow: 0 24px 70px rgba(24, 31, 43, 0.14);
  --shadow-soft: 0 12px 32px rgba(24, 31, 43, 0.09);
  --radius-lg: 28px;
  --radius-md: 20px;
  --space-page: 18px;
  --space-section: 18px;
  --space-card: 20px;
  --ease-soft: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-smooth: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-settle: cubic-bezier(0.2, 0.8, 0.2, 1);
  --motion-fast: 220ms;
  --motion-med: 360ms;
  --motion-slow: 620ms;
  --motion-slide: 420ms;
  color-scheme: light;
}


body[data-theme="dark"] {
  --ink: #f5f7fb;
  --muted: #a7b0bf;
  --subtle: #7f8a9c;
  --line: rgba(209, 217, 230, 0.14);
  --panel: #171c25;
  --soft: #202633;
  --page-start: #080b10;
  --page-mid: #101722;
  --page-end: #0b0f16;
  --sidebar-bg: #121722;
  --sidebar-border: #242c3a;
  --nav-bg: #1b2230;
  --control-bg: #1d2532;
  --control-border: #30394a;
  --row-hover: #202838;
  --dark-panel-start: #10141d;
  --dark-panel-end: #1d2634;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
  --shadow-soft: 0 12px 32px rgba(0, 0, 0, 0.22);
  color-scheme: dark;
}

body[data-theme="dark"] .brand-mark {
  background: linear-gradient(145deg, #f5f7fb, #cdd6e4);
  color: #101318;
}

body[data-theme="dark"] .metric.accent {
  box-shadow: 0 18px 42px rgba(0, 122, 255, 0.18);
}

body[data-theme="dark"] .screenshot-strip img {
  filter: brightness(0.82) contrast(1.05);
}

body[data-theme="dark"] .nav-item {
  color: #b8c2d2;
}

body[data-theme="dark"] .nav-item.active,
body[data-theme="dark"] .nav-item:hover {
  background: #252d3b;
}

body[data-theme="dark"] .status-pill {
  color: #c7d0df;
}

body[data-theme="dark"] .lead-row.header,
body[data-theme="dark"] .journey-step,
body[data-theme="dark"] .task-row {
  background: #202633;
}

body[data-theme="dark"] .task-row span,
body[data-theme="dark"] .deal,
body[data-theme="dark"] .journey-step.active {
  background: #171c25;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", Inter, ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 6%, rgba(0, 122, 255, 0.08), transparent 28%),
    radial-gradient(circle at 84% 14%, rgba(52, 199, 89, 0.06), transparent 26%),
    linear-gradient(145deg, var(--page-start) 0%, var(--page-mid) 45%, var(--page-end) 100%);
  overflow-x: hidden;
  transition: background var(--motion-med) var(--ease-soft), color var(--motion-med) var(--ease-soft);
}

body::before,
body::after {
  content: "";
  position: fixed;
  width: 460px;
  aspect-ratio: 1;
  border-radius: 50%;
  pointer-events: none;
  z-index: -1;
  transition: transform 800ms var(--ease-soft), opacity var(--motion-med) ease;
}

body::before {
  left: -120px;
  top: 12vh;
  background: radial-gradient(circle, rgba(0, 122, 255, 0.12), transparent 65%);
  transform: translate3d(calc(var(--mx, 0) * -10px), calc(var(--my, 0) * -8px), 0);
}

body::after {
  right: -150px;
  bottom: -70px;
  background: radial-gradient(circle, rgba(52, 199, 89, 0.1), transparent 66%);
  transform: translate3d(calc(var(--mx, 0) * 14px), calc(var(--my, 0) * 10px), 0);
}

button {
  font: inherit;
  color: inherit;
  border-radius: 999px;
}

.context-trigger,
.context-hint,
.workflow-toast {
  position: fixed;
  left: 0;
  top: 0;
  opacity: 0;
  pointer-events: none;
}

.context-trigger {
  z-index: 221;
  width: 34px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  padding: 0;
  color: #ffffff;
  background: linear-gradient(145deg, #0a84ff, #0067d8);
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 50%;
  box-shadow: 0 12px 28px rgba(0, 122, 255, 0.28), 0 0 0 0 rgba(0, 122, 255, 0.24);
  font-size: 16px;
  font-weight: 850;
  cursor: pointer;
  transform: translate3d(var(--help-x, 18px), calc(var(--help-y, 18px) + 8px), 0) scale(0.72);
  filter: blur(2px);
  transition: opacity 320ms ease, transform 520ms var(--ease-smooth), filter 420ms ease, box-shadow 420ms ease;
}

.context-trigger.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate3d(var(--help-x, 18px), var(--help-y, 18px), 0) scale(1);
  filter: blur(0);
  animation: helpPulse 1.8s var(--ease-soft) infinite;
}

body:not(.touch-context-help) .context-trigger,
body:not(.touch-context-help) .context-trigger.is-visible {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.context-trigger:hover,
.context-trigger:focus-visible {
  box-shadow: 0 18px 42px rgba(0, 122, 255, 0.42), 0 0 0 7px rgba(0, 122, 255, 0.12);
  outline: 0;
  transform: translate3d(var(--help-x, 18px), var(--help-y, 18px), 0) scale(1.08);
}

.context-hint {
  z-index: 220;
  width: min(340px, calc(100vw - 28px));
  padding: 14px 16px;
  color: #ffffff;
  background: linear-gradient(145deg, rgba(16, 19, 24, 0.96), rgba(28, 35, 48, 0.96));
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 20px;
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(0, 122, 255, 0.1);
  font-size: 13px;
  font-weight: 680;
  line-height: 1.42;
  transform: translate3d(var(--hint-x, 18px), calc(var(--hint-y, 18px) + 14px), 0) scale(0.92);
  transform-origin: top center;
  filter: blur(8px) saturate(0.88);
  will-change: opacity, transform, filter;
  transition:
    opacity 420ms ease,
    transform 620ms var(--ease-smooth),
    filter 520ms ease,
    box-shadow 520ms ease;
}

.context-hint.is-visible {
  opacity: 1;
  transform: translate3d(var(--hint-x, 18px), var(--hint-y, 18px), 0) scale(1);
  filter: blur(0) saturate(1);
  animation: hintSettle 680ms var(--ease-smooth) both;
}

body[data-theme="dark"] .context-hint {
  background: linear-gradient(145deg, rgba(245, 247, 251, 0.97), rgba(226, 232, 240, 0.97));
  color: #101318;
  border-color: rgba(16, 19, 24, 0.1);
}

.workflow-toast {
  z-index: 230;
  left: 50%;
  top: auto;
  bottom: max(20px, env(safe-area-inset-bottom));
  width: min(520px, calc(100vw - 28px));
  padding: 14px 18px;
  color: #ffffff;
  background: linear-gradient(145deg, rgba(16, 19, 24, 0.96), rgba(28, 35, 48, 0.96));
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.28);
  font-size: 14px;
  font-weight: 760;
  line-height: 1.35;
  text-align: center;
  transform: translate(-50%, 18px) scale(0.96);
  filter: blur(6px);
  transition: opacity 320ms ease, transform 520ms var(--ease-smooth), filter 420ms ease;
}

.workflow-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
  filter: blur(0);
}

body[data-theme="dark"] .workflow-toast {
  background: linear-gradient(145deg, rgba(245, 247, 251, 0.97), rgba(226, 232, 240, 0.97));
  color: #101318;
  border-color: rgba(16, 19, 24, 0.1);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 306px 1fr;
  gap: var(--space-page);
  padding: var(--space-page);
}

.sidebar {
  position: sticky;
  top: 18px;
  height: calc(100vh - 36px);
  color: var(--ink);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  background: var(--sidebar-bg);
  border: 1px solid var(--sidebar-border);
  border-radius: 32px;
  box-shadow: var(--shadow);
  transform: translate3d(calc(var(--mx, 0) * -4px), calc(var(--my, 0) * -3px), 0);
  transition: transform 720ms var(--ease-soft), box-shadow var(--motion-med) ease, border-color var(--motion-med) ease;
}

.brand-block {
  display: flex;
  gap: 13px;
  align-items: center;
  padding: 4px 2px 10px;
}

.mobile-menu-toggle {
  display: none;
}

.brand-mark {
  width: 48px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: linear-gradient(145deg, #111827, #303846);
  color: #ffffff;
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.22), 0 12px 26px rgba(16, 24, 40, 0.24);
  animation: markFloat 7s ease-in-out infinite;
}

.brand-block h1,
.topbar h2,
.section-intro h3,
.panel h3 {
  margin: 0;
  letter-spacing: 0;
}

.brand-block h1 {
  font-size: 18px;
  line-height: 1.1;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--subtle);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.nav-list {
  display: grid;
  gap: 8px;
  padding: 6px;
  background: var(--nav-bg);
  border: 1px solid var(--sidebar-border);
  border-radius: 24px;
}

.internal-only {
  display: none !important;
}

body.internal-mode .internal-only {
  display: revert !important;
}

body.internal-mode .nav-item.internal-only {
  display: flex !important;
}

body.internal-mode .view.internal-only {
  display: none !important;
}

body.internal-mode .view.internal-only.active {
  display: block !important;
}

.nav-item {
  width: 100%;
  border: 0;
  background: transparent;
  color: #4f5f73;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  cursor: pointer;
  text-align: left;
  font-weight: 700;
  transition: background var(--motion-fast) ease, color var(--motion-fast) ease, transform 260ms var(--ease-soft), box-shadow 260ms ease;
}

.nav-item b {
  font: inherit;
  min-width: 0;
}

.nav-short {
  display: none;
}

.nav-icon {
  width: 28px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  color: var(--brand);
  background: #eaf3ff;
  border-radius: 50%;
  flex: 0 0 auto;
}

.nav-icon svg {
  width: 16px;
  height: 16px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-icon svg path:first-child:last-child,
.nav-icon svg path:first-child {
  fill: currentColor;
  stroke: none;
}

.nav-item.active,
.nav-item:hover {
  background: var(--control-bg);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
  transform: translateX(2px);
}

.sidebar-panel {
  margin-top: auto;
  padding: 18px;
  background: linear-gradient(145deg, var(--dark-panel-start), var(--dark-panel-end));
  color: #ffffff;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 26px;
  box-shadow: 0 18px 42px rgba(16, 24, 40, 0.22);
  position: relative;
  overflow: hidden;
}

.sidebar-panel::before {
  content: "";
  position: absolute;
  inset: -80px auto auto -80px;
  width: 180px;
  aspect-ratio: 1;
  background: radial-gradient(circle, rgba(255,255,255,0.18), transparent 60%);
  transform: translate3d(calc(var(--mx, 0) * 18px), calc(var(--my, 0) * 14px), 0);
  transition: transform 720ms var(--ease-soft), opacity var(--motion-med) ease;
}

.panel-label {
  margin: 0 0 8px;
  font-weight: 800;
}

.sidebar-panel p:last-of-type {
  color: rgba(255, 255, 255, 0.76);
  line-height: 1.48;
}

.flow-controls {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.main {
  padding: 8px 8px 28px;
  overflow: hidden;
}

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

.topbar {
  min-height: 74px;
  margin-bottom: var(--space-section);
  padding: 6px 8px;
}

.topbar h2 {
  font-size: 34px;
  line-height: 1.05;
  font-weight: 780;
}

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

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  background: var(--control-bg);
  border: 1px solid var(--control-border);
  border-radius: 999px;
  font-weight: 760;
  color: #5b6472;
  box-shadow: var(--shadow-soft);
}

.status-pill span {
  width: 8px;
  aspect-ratio: 1;
  background: var(--warning);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(255, 159, 10, 0.15);
}

.primary-button,
.ghost-button,
.theme-toggle,
.icon-button,
.card-actions button {
  border: 1px solid var(--control-border);
  background: var(--control-bg);
  padding: 10px 15px;
  cursor: pointer;
  font-weight: 760;
  box-shadow: var(--shadow-soft);
  transition: transform 260ms var(--ease-soft), box-shadow 260ms ease, background var(--motion-fast) ease, border-color var(--motion-fast) ease;
}

.primary-button:hover,
.ghost-button:hover,
.theme-toggle:hover,
.icon-button:hover,
.card-actions button:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(24, 31, 43, 0.13);
}

.primary-button:active,
.ghost-button:active,
.theme-toggle:active,
.icon-button:active,
.card-actions button:active,
.nav-item:active,
.task-row:active {
  transform: scale(0.985);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 41px;
}

.theme-icon {
  display: grid;
  place-items: center;
  width: 22px;
  aspect-ratio: 1;
  color: var(--brand);
}

.primary-button {
  background: var(--brand);
  color: white;
  border-color: rgba(255,255,255,0.3);
  box-shadow: 0 12px 28px rgba(0, 122, 255, 0.28);
}

.ghost-button.small {
  padding: 8px 12px;
  font-size: 13px;
}

.icon-button {
  width: 42px;
  padding: 10px 0;
}

.view {
  display: none;
  animation: viewIn 640ms var(--ease-smooth) both;
}

.view.active { display: block; }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-section);
  margin-bottom: var(--space-section);
}

.metric,
.panel,
.approval-card,
.lane,
.engine-flow article,
.lead-table,
.screenshot-strip figure,
.setup-card,
.setup-runbook,
.connection-table {
  background: var(--panel);
  border: 1px solid var(--sidebar-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  transition: transform 320ms var(--ease-soft), box-shadow 320ms ease, border-color 260ms ease, background 260ms ease;
}

.metric:hover,
.panel:hover,
.approval-card:hover,
.lane:hover,
.engine-flow article:hover,
.lead-table:hover,
.screenshot-strip figure:hover,
.setup-card:hover,
.setup-runbook:hover,
.connection-table:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: #dce3ec;
}

.metric {
  padding: var(--space-card);
  min-height: 150px;
  animation: cardIn 680ms var(--ease-smooth) both;
}

.metric p,
.metric span {
  margin: 0;
  color: var(--muted);
}

.metric p {
  font-weight: 760;
}

.metric strong {
  display: block;
  font-size: 38px;
  line-height: 1;
  margin: 13px 0 9px;
  font-weight: 820;
}

.metric.accent {
  border-color: #007aff;
  background: linear-gradient(145deg, #007aff, #34aadc);
  color: white;
  box-shadow: 0 18px 42px rgba(0, 122, 255, 0.25);
}

.metric.accent p,
.metric.accent span {
  color: rgba(255,255,255,0.84);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.6fr 0.8fr;
  gap: var(--space-section);
  animation: cardIn 720ms var(--ease-smooth) both;
}

.presentation-panel {
  display: grid;
  grid-template-columns: minmax(260px, 0.7fr) minmax(320px, 1.3fr);
  gap: var(--space-card);
  align-items: center;
  margin-bottom: var(--space-section);
  padding: calc(var(--space-card) + 2px);
  background: linear-gradient(145deg, var(--dark-panel-start), var(--dark-panel-end));
  color: #ffffff;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  animation: cardIn 700ms var(--ease-smooth) both;
}

.presentation-copy h3,
.presentation-copy p {
  margin: 0;
}

.presentation-copy h3 {
  font-size: 26px;
  line-height: 1.12;
  letter-spacing: 0;
}

.presentation-copy p:not(.eyebrow) {
  margin: 12px 0 18px;
  color: rgba(255,255,255,0.78);
  line-height: 1.5;
}

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

.presentation-copy .primary-button,
.presentation-copy .ghost-button {
  width: max-content;
  text-decoration: none;
}

.presentation-copy .ghost-button {
  border-color: rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.video-frame {
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: var(--radius-md);
  background: #090d14;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
}

.video-frame video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #090d14;
}

.panel {
  padding: calc(var(--space-card) + 2px);
}

.journey {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: var(--space-section);
}

.journey-step {
  border: 1px solid var(--sidebar-border);
  background: var(--soft);
  border-radius: var(--radius-md);
  padding: 16px;
  min-height: 172px;
  animation: cardIn 660ms var(--ease-smooth) both;
}

.journey-step:nth-child(2) { animation-delay: 60ms; }
.journey-step:nth-child(3) { animation-delay: 120ms; }
.journey-step:nth-child(4) { animation-delay: 180ms; }

.journey-step span,
.engine-flow span {
  display: inline-grid;
  place-items: center;
  width: 36px;
  aspect-ratio: 1;
  background: #eaf3ff;
  color: var(--brand);
  border-radius: 50%;
  font-weight: 820;
  margin-bottom: 14px;
}

.journey-step.active {
  background: var(--panel);
  box-shadow: inset 0 0 0 1px rgba(0, 122, 255, 0.22), 0 14px 30px rgba(0, 122, 255, 0.11);
  animation: cardIn 660ms var(--ease-smooth) both, softPulse 4.4s ease-in-out infinite;
}

.journey-step.done span {
  background: #eaf8ef;
  color: var(--brand-2);
}

.journey-step h4,
.approval-card h4,
.engine-flow h4,
.lane h4 {
  margin: 0 0 8px;
  color: var(--ink);
  font-weight: 780;
}

.journey-step p,
.approval-card p,
.engine-flow p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.task-list {
  display: grid;
  gap: 12px;
  margin-top: var(--space-section);
}

.task-row {
  border: 1px solid var(--sidebar-border);
  background: var(--soft);
  border-radius: var(--radius-md);
  padding: 13px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  text-align: left;
  font-weight: 760;
  transition: transform 300ms var(--ease-soft), background 240ms ease, box-shadow 300ms ease;
}

.task-row:hover {
  transform: translateX(3px);
  background: var(--control-bg);
  box-shadow: 0 10px 24px rgba(24, 31, 43, 0.08);
}

.task-row span {
  display: grid;
  place-items: center;
  width: 36px;
  aspect-ratio: 1;
  background: #ffffff;
  border-radius: 50%;
  font-weight: 820;
  box-shadow: inset 0 0 0 1px var(--line);
}

.task-row.hot span { color: var(--danger); }

.section-intro {
  margin-bottom: var(--space-section);
  padding: 0 4px;
}

.lead-table {
  overflow: hidden;
}

.lead-row {
  display: grid;
  grid-template-columns: 1.1fr 1fr 0.8fr 1.2fr;
  gap: 16px;
  padding: 17px 20px;
  border-top: 1px solid var(--line);
  align-items: center;
  transition: background 240ms ease, transform 300ms var(--ease-soft);
}

.setup-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--space-section);
  margin-bottom: var(--space-section);
}

.setup-card {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 292px;
  padding: var(--space-card);
  animation: cardIn 680ms var(--ease-smooth) both;
}

.setup-card:nth-child(2) { animation-delay: 60ms; }
.setup-card:nth-child(3) { animation-delay: 120ms; }
.setup-card:nth-child(4) { animation-delay: 180ms; }
.setup-card:nth-child(5) { animation-delay: 240ms; }

.setup-card h4,
.setup-card p,
.setup-card ul {
  margin: 0;
}

.setup-card h4 {
  font-size: 20px;
  line-height: 1.15;
}

.setup-card p,
.setup-card li {
  color: var(--muted);
  line-height: 1.45;
}

.setup-card ul {
  display: grid;
  gap: 8px;
  padding-left: 18px;
}

.setup-state {
  width: max-content;
  max-width: 100%;
  padding: 7px 10px;
  color: var(--brand);
  background: #eaf3ff;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 820;
}

.setup-card.ready .setup-state {
  color: #157a32;
  background: #eaf8ef;
}

.setup-card.sandbox .setup-state {
  color: #a45c00;
  background: #fff3df;
}

body[data-theme="dark"] .setup-state,
body[data-theme="dark"] .setup-card.ready .setup-state {
  background: #202f44;
  color: #9dc5ff;
}

body[data-theme="dark"] .setup-card.sandbox .setup-state {
  color: #ffd08a;
  background: rgba(255, 159, 10, 0.15);
}

.setup-runbook {
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(420px, 1.28fr);
  gap: var(--space-section);
  align-items: start;
  margin-bottom: var(--space-section);
  padding: calc(var(--space-card) + 2px);
  animation: cardIn 720ms var(--ease-smooth) both;
}

.runbook-copy h3,
.runbook-copy p {
  margin: 0;
}

.runbook-copy h3 {
  font-size: 26px;
  line-height: 1.12;
}

.runbook-copy p:not(.eyebrow) {
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.5;
}

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

.runbook-list div {
  padding: 16px;
  background: var(--soft);
  border: 1px solid var(--sidebar-border);
  border-radius: var(--radius-md);
}

.runbook-list span {
  display: inline-grid;
  place-items: center;
  width: 34px;
  aspect-ratio: 1;
  margin-bottom: 12px;
  color: var(--brand);
  background: #eaf3ff;
  border-radius: 50%;
  font-weight: 820;
}

.runbook-list strong {
  display: block;
  margin-bottom: 6px;
}

.runbook-list p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.connection-table {
  overflow: hidden;
  animation: cardIn 740ms var(--ease-smooth) both;
}

.approval-card,
.output-card,
.creative-card,
.deployment-composer,
.setup-card,
.setup-runbook,
.connection-table {
  position: relative;
}

[data-workflow-state] {
  border-color: rgba(0, 122, 255, 0.42);
}

[data-workflow-state]::after {
  content: attr(data-state-label);
  position: absolute;
  right: 14px;
  top: 14px;
  z-index: 2;
  padding: 6px 9px;
  color: var(--brand);
  background: #eaf3ff;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.02em;
  box-shadow: 0 8px 18px rgba(0, 122, 255, 0.14);
  animation: stateBadgeIn 420ms var(--ease-smooth) both;
}

.state-approved,
.state-checked {
  border-color: rgba(52, 199, 89, 0.48);
}

.state-approved::after,
.state-checked::after {
  color: #157a32;
  background: #eaf8ef;
}

.state-queued::after {
  color: #a45c00;
  background: #fff3df;
}

body[data-theme="dark"] [data-workflow-state]::after {
  background: #202f44;
  color: #9dc5ff;
}

.connection-row {
  display: grid;
  grid-template-columns: 0.75fr 0.85fr 1.35fr 1.5fr;
  gap: 16px;
  align-items: center;
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  transition: background 240ms ease, transform 300ms var(--ease-soft);
}

.connection-row:not(.header):hover {
  background: var(--row-hover);
  transform: translateX(4px);
}

.connection-row.header {
  border-top: 0;
  color: var(--subtle);
  background: var(--soft);
  font-size: 12px;
  font-weight: 780;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.connection-row strong {
  color: var(--ink);
}

.lead-row > * {
  min-width: 0;
}

.lead-row:not(.header):hover {
  background: var(--row-hover);
  transform: translateX(4px);
}

.lead-row.header {
  border-top: 0;
  background: var(--soft);
  color: var(--subtle);
  font-size: 12px;
  font-weight: 780;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge {
  width: max-content;
  padding: 7px 11px;
  background: #eaf3ff;
  border-radius: 999px;
  font-weight: 780;
  color: var(--brand);
}

.badge.high {
  background: #fff3df;
  color: #a45c00;
}

.approval-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-section);
  margin-bottom: var(--space-section);
}

.approval-card {
  padding: var(--space-card);
  animation: cardIn 660ms var(--ease-smooth) both;
}

.approval-card:nth-child(2) { animation-delay: 70ms; }
.approval-card:nth-child(3) { animation-delay: 140ms; }

.channel {
  display: inline-block;
  margin-bottom: 14px;
  color: var(--brand);
  font-weight: 820;
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.content-studio {
  padding: calc(var(--space-card) + 2px);
  background: var(--panel);
  border: 1px solid var(--sidebar-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  animation: cardIn 680ms var(--ease-smooth) both;
}

.studio-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-section);
  margin-bottom: var(--space-section);
}

.studio-header h3,
.studio-header p {
  margin: 0;
}

.studio-header h3 {
  font-size: 24px;
  line-height: 1.16;
}

.studio-header p:not(.eyebrow) {
  max-width: 760px;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.5;
}

.studio-grid,
.generated-output,
.creative-output {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-section);
}

.studio-grid {
  margin-bottom: var(--space-section);
}

.studio-card,
.output-card {
  padding: var(--space-card);
  background: var(--soft);
  border: 1px solid var(--sidebar-border);
  border-radius: var(--radius-md);
}

.signal-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.target-profile + .target-profile {
  margin-top: 14px;
}

.target-profile strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
}

.target-profile p,
.output-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.compliance-card {
  display: grid;
  gap: 10px;
}

.compliance-card label {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  color: var(--muted);
  line-height: 1.35;
}

.compliance-card input {
  margin-top: 2px;
  accent-color: var(--brand);
}

.output-card {
  background: var(--control-bg);
}

.output-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.output-head span {
  font-weight: 820;
  color: var(--brand);
}

.output-head small {
  color: var(--subtle);
  font-weight: 760;
}

.output-card h4 {
  margin: 0 0 10px;
  color: var(--ink);
  line-height: 1.25;
}

.publish-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.publish-row span {
  padding: 7px 10px;
  border-radius: 999px;
  background: #eaf3ff;
  color: var(--brand);
  font-size: 13px;
  font-weight: 780;
}

body[data-theme="dark"] .publish-row span {
  background: #202f44;
}

.generated-output.is-refreshing .output-card {
  animation: cardIn 560ms var(--ease-smooth) both;
}

.creative-output {
  grid-template-columns: 1.35fr 0.65fr;
  margin-top: var(--space-section);
}

.deployment-composer {
  display: grid;
  gap: var(--space-section);
  margin-top: var(--space-section);
  padding: var(--space-card);
  background: var(--control-bg);
  border: 1px solid var(--sidebar-border);
  border-radius: var(--radius-md);
}

.composer-head {
  display: flex;
  justify-content: space-between;
  gap: var(--space-section);
  align-items: flex-start;
}

.composer-head h4,
.composer-head p {
  margin: 0;
}

.composer-head h4 {
  font-size: 22px;
  color: var(--ink);
  line-height: 1.18;
}

.composer-head p {
  max-width: 720px;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.45;
}

.composer-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-section);
}

.composer-card {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 178px;
  padding: var(--space-card);
  background: var(--soft);
  border: 1px solid var(--sidebar-border);
  border-radius: var(--radius-md);
}

.composer-card strong {
  font-size: 15px;
  color: var(--ink);
}

.option-grid,
.platform-grid,
.emoji-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.option-pill,
.platform-pill,
.emoji-pill {
  border: 1px solid var(--control-border);
  border-radius: 999px;
  padding: 9px 11px;
  background: var(--control-bg);
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 780;
  cursor: pointer;
  transition: transform 300ms var(--ease-soft), border-color 240ms ease, color 240ms ease, background 240ms ease;
}

.option-pill:hover,
.platform-pill:hover,
.emoji-pill:hover {
  transform: translateY(-1px);
  border-color: rgba(0, 122, 255, 0.42);
  color: var(--ink);
}

.option-pill.active,
.platform-pill.active,
.emoji-pill.active {
  border-color: rgba(0, 122, 255, 0.45);
  background: #eaf3ff;
  color: var(--brand);
}

body[data-theme="dark"] .option-pill.active,
body[data-theme="dark"] .platform-pill.active,
body[data-theme="dark"] .emoji-pill.active {
  background: #202f44;
}

.media-drop {
  display: grid;
  gap: 10px;
  min-height: 118px;
  padding: 14px;
  border: 1px dashed rgba(0, 122, 255, 0.38);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(0, 122, 255, 0.08), rgba(52, 199, 89, 0.06));
}

.media-drop.has-media {
  border-style: solid;
  border-color: rgba(52, 199, 89, 0.5);
  background: linear-gradient(145deg, rgba(52, 199, 89, 0.12), rgba(0, 122, 255, 0.07));
}

.media-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.media-drop span {
  color: var(--brand);
  font-weight: 820;
}

.media-drop p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.42;
}

.deployment-summary {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.9fr);
  gap: var(--space-section);
  align-items: center;
  padding: 16px;
  border-radius: 20px;
  background: var(--soft);
  border: 1px solid var(--sidebar-border);
}

.deployment-summary span {
  display: block;
  margin-bottom: 6px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 820;
}

.deployment-summary strong {
  display: block;
  line-height: 1.32;
}

.deployment-summary p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.creative-card {
  display: grid;
  gap: var(--space-card);
  padding: var(--space-card);
  background: var(--control-bg);
  border: 1px solid var(--sidebar-border);
  border-radius: var(--radius-md);
}

.creative-preview {
  min-height: 250px;
  display: flex;
  align-items: flex-end;
  padding: 22px;
  overflow: hidden;
  color: #ffffff;
  border-radius: var(--radius-md);
  background:
    radial-gradient(circle at 80% 18%, rgba(255,255,255,0.22), transparent 24%),
    linear-gradient(145deg, #0e6dfd, #12223c 64%, #0f1722);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.24);
}

.creative-preview div {
  max-width: 520px;
}

.creative-preview span {
  display: inline-block;
  margin-bottom: 10px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.16);
  font-size: 12px;
  font-weight: 820;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.creative-preview strong {
  display: block;
  font-size: 32px;
  line-height: 1.05;
  letter-spacing: 0;
}

.creative-preview p,
.creative-details p,
.cta-card p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.creative-preview p {
  color: rgba(255,255,255,0.82);
}

.creative-details h4 {
  margin: 8px 0 0;
  color: var(--ink);
}

.cta-card {
  align-content: start;
}

.cta-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.cta-list a {
  display: block;
  padding: 12px 14px;
  color: var(--brand);
  text-decoration: none;
  font-weight: 820;
  background: #eaf3ff;
  border-radius: 999px;
}

body[data-theme="dark"] .cta-list a {
  background: #202f44;
}

.kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-section);
}

.lane {
  min-height: 360px;
  padding: var(--space-card);
}

.deal {
  background: var(--control-bg);
  border: 1px solid var(--sidebar-border);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-top: 10px;
  font-weight: 800;
  box-shadow: 0 8px 22px rgba(24, 31, 43, 0.08);
  transition: transform 300ms var(--ease-soft), box-shadow 300ms ease;
}

.deal:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 28px rgba(24, 31, 43, 0.12);
}

.deal span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-weight: 680;
}

.deal.won {
  background: #eaf8ef;
  border-color: #ccebd6;
}

.engine-flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--space-section);
}

.engine-flow article {
  padding: var(--space-card);
  min-height: 260px;
  animation: cardIn 680ms var(--ease-smooth) both;
}

.engine-flow article:nth-child(2) { animation-delay: 60ms; }
.engine-flow article:nth-child(3) { animation-delay: 120ms; }
.engine-flow article:nth-child(4) { animation-delay: 180ms; }
.engine-flow article:nth-child(5) { animation-delay: 240ms; }

.sync-branch {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: var(--space-section);
  align-items: center;
  margin-top: var(--space-section);
  padding: var(--space-card);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-soft);
}

.sync-branch h3 {
  margin: 0 0 8px;
  color: var(--ink);
}

.sync-branch > div:first-child > p:last-child {
  max-width: 62ch;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.sync-steps {
  display: grid;
  gap: 10px;
}

.sync-steps span {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 14px;
  color: var(--ink);
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-weight: 700;
}

.sync-steps span::before {
  content: "";
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(0, 122, 255, 0.12);
}

.screenshot-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-section);
  margin-top: var(--space-section);
}

.screenshot-strip figure {
  margin: 0;
  overflow: hidden;
  animation: cardIn 680ms var(--ease-smooth) both;
}

.screenshot-strip img {
  display: block;
  width: 100%;
  height: 190px;
  object-fit: cover;
  object-position: top left;
  border-bottom: 1px solid var(--line);
  transition: transform 600ms var(--ease-smooth);
}

.screenshot-strip figure:hover img {
  transform: scale(1.035);
}

.screenshot-strip figcaption {
  padding: 13px 15px;
  font-weight: 780;
  color: var(--muted);
}

.walkthrough-highlight {
  outline: 4px solid rgba(0, 122, 255, 0.32);
  outline-offset: 4px;
}

.parallax-soft {
  transform: translate3d(calc(var(--mx, 0) * 6px), calc(var(--my, 0) * 5px), 0);
}

@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.985);
    filter: blur(8px);
  }
  55% {
    opacity: 0.82;
    filter: blur(2px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
    filter: blur(5px);
  }
  60% {
    opacity: 0.86;
    filter: blur(1px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes markFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@keyframes softPulse {
  0%, 100% { box-shadow: inset 0 0 0 1px rgba(0, 122, 255, 0.22), 0 14px 30px rgba(0, 122, 255, 0.11); }
  50% { box-shadow: inset 0 0 0 1px rgba(0, 122, 255, 0.36), 0 18px 38px rgba(0, 122, 255, 0.16); }
}

@keyframes helpPulse {
  0%, 100% {
    box-shadow: 0 12px 28px rgba(0, 122, 255, 0.28), 0 0 0 0 rgba(0, 122, 255, 0.18);
  }
  50% {
    box-shadow: 0 18px 42px rgba(0, 122, 255, 0.4), 0 0 0 8px rgba(0, 122, 255, 0.08);
  }
}

@keyframes hintSettle {
  0% {
    opacity: 0;
    transform: translate3d(var(--hint-x, 18px), calc(var(--hint-y, 18px) + 18px), 0) scale(0.92);
    filter: blur(8px) saturate(0.88);
  }
  58% {
    opacity: 1;
    transform: translate3d(var(--hint-x, 18px), calc(var(--hint-y, 18px) - 3px), 0) scale(1.012);
    filter: blur(0) saturate(1);
  }
  100% {
    opacity: 1;
    transform: translate3d(var(--hint-x, 18px), var(--hint-y, 18px), 0) scale(1);
    filter: blur(0) saturate(1);
  }
}

@keyframes stateBadgeIn {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.nav-item,
.primary-button,
.ghost-button,
.theme-toggle,
.icon-button,
.card-actions button,
.task-row,
.option-pill,
.platform-pill,
.emoji-pill {
  transition-duration: var(--motion-med);
  transition-timing-function: var(--ease-soft);
}

.metric,
.panel,
.approval-card,
.lead-table,
.lane,
.engine-flow article,
.screenshot-strip figure,
.setup-card,
.setup-runbook,
.connection-table,
.journey-step,
.studio-card,
.output-card,
.creative-card,
.composer-card,
.deal {
  transition: opacity var(--motion-fast) ease, transform var(--motion-slide) var(--ease-soft), box-shadow var(--motion-med) ease, border-color var(--motion-med) ease, background var(--motion-med) ease, filter var(--motion-med) ease;
}

.studio-card:hover,
.output-card:hover,
.creative-card:hover,
.composer-card:hover,
.journey-step:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 32px rgba(24, 31, 43, 0.1);
}

.option-pill:hover,
.platform-pill:hover,
.emoji-pill:hover {
  box-shadow: 0 10px 22px rgba(24, 31, 43, 0.08);
}

.setup-card:hover .setup-state,
.setup-card.is-tapping .setup-state {
  opacity: 0.94;
  transform: translateX(3px);
}

.setup-state {
  transition: opacity var(--motion-fast) ease, transform var(--motion-med) var(--ease-soft), background var(--motion-fast) ease, color var(--motion-fast) ease;
}

.is-tapping {
  animation: tapSettle 420ms var(--ease-soft) both;
}

.metric.is-tapping,
.panel.is-tapping,
.approval-card.is-tapping,
.lane.is-tapping,
.engine-flow article.is-tapping,
.lead-table.is-tapping,
.screenshot-strip figure.is-tapping,
.setup-card.is-tapping,
.setup-runbook.is-tapping,
.connection-table.is-tapping,
.journey-step.is-tapping,
.studio-card.is-tapping,
.output-card.is-tapping,
.creative-card.is-tapping,
.composer-card.is-tapping,
.deal.is-tapping {
  animation-name: cardTap;
}

.lead-row.is-tapping,
.connection-row.is-tapping,
.task-row.is-tapping {
  animation-name: rowTap;
}

@keyframes tapSettle {
  0% {
    opacity: 0.88;
    transform: translateY(1px) scale(0.975);
  }
  62% {
    opacity: 1;
    transform: translateY(-1px) scale(1.012);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes cardTap {
  0% {
    opacity: 0.9;
    transform: translateY(2px) scale(0.988);
    filter: brightness(0.98);
  }
  64% {
    opacity: 1;
    transform: translateY(-2px) scale(1.006);
    filter: brightness(1.01);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: brightness(1);
  }
}

@keyframes rowTap {
  0% {
    opacity: 0.88;
    transform: translateX(2px) scale(0.99);
  }
  68% {
    opacity: 1;
    transform: translateX(5px) scale(1.002);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }

  .sidebar,
  body::before,
  body::after,
  .sidebar-panel::before,
  .parallax-soft {
    transform: none !important;
  }
}

@media (max-width: 1050px) {
  :root {
    --space-page: 14px;
    --space-section: 16px;
    --space-card: 18px;
  }

  .app-shell {
    grid-template-columns: 1fr;
    padding: var(--space-page);
  }

  .sidebar {
    position: static;
    height: auto;
    gap: 16px;
  }

  .nav-list {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .nav-item {
    justify-content: center;
    padding: 10px;
  }

  .nav-item span {
    width: 26px;
  }

  .sidebar-panel {
    margin-top: 0;
  }

  .mobile-menu-toggle {
    width: 44px;
    aspect-ratio: 1;
    position: fixed;
    right: 14px;
    top: auto;
    bottom: max(14px, env(safe-area-inset-bottom));
    z-index: 100;
    margin-left: 0;
    border: 1px solid var(--control-border);
    background: var(--control-bg);
    display: inline-grid;
    place-items: center;
    gap: 4px;
    padding: 11px;
    box-shadow: var(--shadow-soft);
    cursor: pointer;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
    transition: opacity 260ms ease, transform 320ms var(--ease-soft), box-shadow 180ms ease;
  }

  body.is-at-top .mobile-menu-toggle {
    top: max(14px, env(safe-area-inset-top));
    bottom: auto;
  }

  .mobile-menu-toggle span {
    width: 18px;
    height: 2px;
    display: block;
    border-radius: 999px;
    background: var(--ink);
    transition: transform 300ms var(--ease-soft), opacity 240ms ease;
  }

  body.nav-open .mobile-menu-toggle span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
  }

  body.nav-open .mobile-menu-toggle span:nth-child(2) {
    opacity: 0;
  }

  body.nav-open .mobile-menu-toggle span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
  }

  .nav-list {
    position: fixed;
    top: auto;
    left: auto;
    right: 14px;
    bottom: max(72px, calc(env(safe-area-inset-bottom) + 72px));
    z-index: 90;
    width: min(280px, calc(100vw - 28px));
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 8px;
    border-radius: 24px;
    box-shadow: 0 18px 42px rgba(24, 31, 43, 0.2);
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px) scale(0.98);
    transform-origin: bottom right;
    transition: opacity 260ms ease, transform 320ms var(--ease-soft);
  }

  body.is-at-top .nav-list {
    top: max(68px, calc(env(safe-area-inset-top) + 68px));
    bottom: auto;
    transform: translateY(-8px) scale(0.98);
    transform-origin: top right;
  }

  body.nav-open .nav-list {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
  }

  .nav-item {
    min-height: 48px;
    justify-content: flex-start;
    flex-direction: row;
    gap: 10px;
    padding: 10px 12px;
    font-size: 14px;
    line-height: 1.1;
    text-align: left;
  }

  .nav-item span {
    width: 30px;
  }

  .metric-grid,
  .dashboard-grid,
  .journey,
  .approval-grid,
  .kanban,
  .engine-flow,
  .screenshot-strip,
  .studio-grid,
  .generated-output,
  .creative-output,
  .composer-grid,
  .deployment-summary,
  .setup-grid,
  .setup-runbook,
  .runbook-list { grid-template-columns: 1fr 1fr; }

  .sync-branch { grid-template-columns: 1fr; }

  .connection-row {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  :root {
    --space-page: 10px;
    --space-section: 14px;
    --space-card: 16px;
    --radius-lg: 24px;
    --radius-md: 18px;
  }

  body::before,
  body::after {
    width: 320px;
  }

  .app-shell {
    gap: 12px;
  }

  .sync-branch { grid-template-columns: 1fr; }

  .main {
    padding: 0 0 96px;
  }

  .sidebar {
    padding: 14px;
    border-radius: 26px;
    padding-bottom: 14px;
    position: relative;
  }

  .brand-block {
    align-items: center;
    padding-bottom: 0;
  }

  .brand-mark {
    width: 44px;
    border-radius: 14px;
  }

  .mobile-menu-toggle {
    width: 44px;
    aspect-ratio: 1;
    position: fixed;
    right: 14px;
    top: auto;
    bottom: max(14px, env(safe-area-inset-bottom));
    z-index: 100;
    margin-left: 0;
    border: 1px solid var(--control-border);
    background: var(--control-bg);
    display: inline-grid;
    place-items: center;
    gap: 4px;
    padding: 11px;
    box-shadow: var(--shadow-soft);
    cursor: pointer;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
    transition: opacity 260ms ease, transform 320ms var(--ease-soft), box-shadow 180ms ease;
  }

  body.is-at-top .mobile-menu-toggle {
    top: max(10px, env(safe-area-inset-top));
    bottom: auto;
  }

  body.is-at-top .mobile-menu-toggle,
  body.has-scrolled .mobile-menu-toggle,
  body.nav-open .mobile-menu-toggle {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
  }

  .mobile-menu-toggle span {
    width: 18px;
    height: 2px;
    display: block;
    border-radius: 999px;
    background: var(--ink);
    transition: transform 300ms var(--ease-soft), opacity 240ms ease;
  }

  body.nav-open .mobile-menu-toggle span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
  }

  body.nav-open .mobile-menu-toggle span:nth-child(2) {
    opacity: 0;
  }

  body.nav-open .mobile-menu-toggle span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
  }

  .nav-list {
    position: fixed;
    top: auto;
    left: auto;
    right: 14px;
    bottom: max(72px, calc(env(safe-area-inset-bottom) + 72px));
    z-index: 90;
    width: min(280px, calc(100vw - 28px));
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 8px;
    border-radius: 24px;
    box-shadow: 0 18px 42px rgba(24, 31, 43, 0.2);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px) scale(0.98);
    transform-origin: top right;
    transition: opacity 260ms ease, transform 320ms var(--ease-soft);
  }

  body.is-at-top .nav-list {
    top: max(62px, calc(env(safe-area-inset-top) + 62px));
    bottom: auto;
    transform: translateY(-8px) scale(0.98);
    transform-origin: top right;
  }

  body.nav-open .nav-list {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
  }

  .nav-item {
    min-height: 48px;
    justify-content: flex-start;
    flex-direction: row;
    gap: 10px;
    padding: 10px 12px;
    font-size: 14px;
    line-height: 1.1;
    text-align: left;
  }

  .nav-full {
    display: none;
  }

  .nav-short {
    display: inline;
  }

  .nav-item:hover,
  .nav-item.active {
    transform: translateX(2px);
  }

  .nav-icon {
    width: 26px;
  }

  .nav-icon svg {
    width: 15px;
    height: 15px;
  }

  .sidebar-panel {
    padding: 16px;
  }

  .metric-grid,
  .dashboard-grid,
  .journey,
  .approval-grid,
  .kanban,
  .engine-flow,
  .screenshot-strip,
  .studio-grid,
  .generated-output,
  .creative-output,
  .composer-grid,
  .deployment-summary,
  .presentation-panel,
  .setup-grid,
  .setup-runbook,
  .runbook-list,
  .connection-row { grid-template-columns: 1fr; }

  .connection-row.header {
    display: none;
  }

  .connection-row {
    gap: 8px;
    padding: 16px;
  }

  .creative-preview {
    min-height: 220px;
  }

  .creative-preview strong {
    font-size: 26px;
  }

  .studio-header {
    flex-direction: column;
  }

  .composer-head {
    flex-direction: column;
  }

  .studio-header .primary-button {
    width: 100%;
  }

  .lead-row {
    grid-template-columns: 1fr;
    gap: 9px;
    padding: 16px;
  }

  .topbar,
  .section-intro,
  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar {
    padding: 4px 2px;
    margin-bottom: 16px;
  }

  .topbar h2 { font-size: 30px; }

  .topbar-actions {
    width: 100%;
    justify-content: stretch;
  }

  .status-pill,
  .theme-toggle,
  .ghost-button,
  .primary-button {
    justify-content: center;
  }

  .topbar-actions > * {
    flex: 1 1 auto;
  }

  .section-intro {
    gap: 12px;
  }

  .section-intro .primary-button {
    width: 100%;
  }

  .presentation-copy .primary-button {
    width: 100%;
  }

  .metric {
    min-height: 132px;
  }

  .journey-step,
  .engine-flow article,
  .lane {
    min-height: auto;
  }

  .card-actions button {
    flex: 1 1 120px;
  }

  .screenshot-strip img {
    height: 210px;
  }
}

@media (max-width: 420px) {
  .flow-controls {
    flex-direction: column;
  }

  .icon-button,
  #next-step {
    width: 100%;
  }

  .topbar-actions {
    flex-direction: column;
  }

  .topbar-actions > * {
    width: 100%;
  }
}
