/* ============================================
   ALT V2 — Engineering Editorial Design System
   Violet edition
   ============================================ */

/* ---------- Tokens ---------- */
:root {
  --bg: #fafaf8;
  --bg-alt: #f3f1ec;
  --surface: #ffffff;
  --text: #0e1116;
  --text-muted: #5a6168;
  --text-faint: #8b9199;
  --line: #e4e2dc;
  --line-strong: #c9c6bd;

  --accent: #7c5cff;
  --accent-hover: #6243db;
  --accent-bright: #9b85ff;
  --accent-soft: rgba(124, 92, 255, 0.10);

  --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-accent: linear-gradient(135deg, #f093fb 0%, #7c5cff 100%);

  --shadow-sm: 0 1px 2px rgba(10, 12, 16, 0.05);
  --shadow-md: 0 12px 28px -10px rgba(118, 75, 162, 0.20);
  --shadow-violet: 0 0 0 1px rgba(124, 92, 255, 0.18), 0 16px 36px -14px rgba(124, 92, 255, 0.40);

  --font-display: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --container: 1440px;
  --reading: 920px;
  --gutter: clamp(20px, 4vw, 56px);
  --hero-inset: clamp(14px, 3.5vw, 72px);
  --radius: 4px;
}

[data-theme='dark'] {
  --bg: #0b0c12;
  --bg-alt: #14161e;
  --surface: #181b24;
  --text: #f0ede6;
  --text-muted: #a0a6b3;
  --text-faint: #6b7280;
  --line: #21242d;
  --line-strong: #2d313c;

  --accent: #a78bfa;
  --accent-hover: #c4b5fd;
  --accent-bright: #c4b5fd;
  --accent-soft: rgba(167, 139, 250, 0.14);

  --gradient-primary: linear-gradient(135deg, #818cf8 0%, #a78bfa 100%);
  --gradient-accent: linear-gradient(135deg, #f0abfc 0%, #a78bfa 100%);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 12px 28px -10px rgba(0, 0, 0, 0.55);
  --shadow-violet: 0 0 0 1px rgba(167, 139, 250, 0.25), 0 16px 36px -14px rgba(167, 139, 250, 0.35);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0b0c12;
    --bg-alt: #14161e;
    --surface: #181b24;
    --text: #f0ede6;
    --text-muted: #a0a6b3;
    --text-faint: #6b7280;
    --line: #21242d;
    --line-strong: #2d313c;
    --accent: #a78bfa;
    --accent-hover: #c4b5fd;
    --accent-bright: #c4b5fd;
    --accent-soft: rgba(167, 139, 250, 0.14);
    --gradient-primary: linear-gradient(135deg, #818cf8 0%, #a78bfa 100%);
    --gradient-accent: linear-gradient(135deg, #f0abfc 0%, #a78bfa 100%);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 12px 28px -10px rgba(0, 0, 0, 0.55);
    --shadow-violet: 0 0 0 1px rgba(167, 139, 250, 0.25), 0 16px 36px -14px rgba(167, 139, 250, 0.35);
  }
}

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background-color 0.2s ease, color 0.2s ease;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--text);
}

h1 { font-size: clamp(2.6rem, 6vw, 4.6rem); line-height: 1.02; font-weight: 500; }
h2 { font-size: clamp(2rem, 4vw, 3rem); line-height: 1.1; }
h3 { font-size: clamp(1.4rem, 2.2vw, 1.75rem); line-height: 1.2; font-weight: 600; }
h4 { font-size: 1.1rem; line-height: 1.3; font-weight: 600; }

/* Prevent long/unbreakable tokens (URLs, joined words) from overflowing the viewport on mobile */
h1, h2, h3, h4, h5, h6 {
  overflow-wrap: anywhere;
}

.news-article__body,
.news-article__body * {
  overflow-wrap: anywhere;
}

p { margin: 0 0 1em 0; }
p:last-child { margin-bottom: 0; }

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s ease;
}

img { max-width: 100%; height: auto; display: block; }

::selection {
  background: var(--accent);
  color: #fff;
}

/* ---------- Layout ---------- */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.section {
  padding-top: clamp(80px, 12vh, 140px);
  padding-bottom: clamp(80px, 12vh, 140px);
  border-top: 1px solid var(--line);
}

.section--tight {
  padding-top: clamp(60px, 8vh, 90px);
  padding-bottom: clamp(60px, 8vh, 90px);
}

.section:first-of-type { border-top: 0; }

.hero.container,
.article-hero.container,
.mi-hero.container {
  padding-left: calc(var(--gutter) + var(--hero-inset));
  padding-right: calc(var(--gutter) + var(--hero-inset));
}

/* Horizontal-scroll wrapper for wide tables (mobile overflow containment) */
.scrollable {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.site-header.is-scrolled { border-bottom-color: var(--line); }

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  position: relative;
}

.brand {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gradient-primary);
  box-shadow: 0 0 12px var(--accent);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 20px;
}

.site-nav a {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}

.site-nav a:hover { color: var(--text); }
.site-nav a.is-active { color: var(--accent); }

.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.nav-toggle:hover {
  border-color: var(--accent);
  background: var(--bg-alt);
}

.nav-toggle__icon,
.nav-toggle__icon::before,
.nav-toggle__icon::after {
  display: block;
  width: 17px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle__icon {
  position: relative;
}

.nav-toggle__icon::before,
.nav-toggle__icon::after {
  content: '';
  position: absolute;
  left: 0;
}

.nav-toggle__icon::before { top: -6px; }
.nav-toggle__icon::after { top: 6px; }

.nav-toggle[aria-expanded='true'] .nav-toggle__icon {
  transform: rotate(45deg);
}

.nav-toggle[aria-expanded='true'] .nav-toggle__icon::before {
  transform: translateY(6px) rotate(90deg);
}

.nav-toggle[aria-expanded='true'] .nav-toggle__icon::after {
  opacity: 0;
}

.theme-toggle {
  background: transparent;
  border: 1px solid var(--line);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.theme-toggle:hover {
  border-color: var(--accent);
  background: var(--bg-alt);
}

.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-sun { display: none; }
[data-theme='dark'] .theme-toggle .icon-moon { display: none; }
[data-theme='dark'] .theme-toggle .icon-sun { display: block; }

@media (max-width: 1020px) {
  .site-nav { gap: 14px; }
}

@media (max-width: 860px) {
  .brand span:last-child {
    max-width: min(56vw, 260px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .nav-toggle {
    display: inline-flex;
    margin-left: auto;
  }

  .site-nav {
    position: absolute;
    top: calc(100% + 8px);
    left: var(--gutter);
    right: var(--gutter);
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 12px;
    background: color-mix(in srgb, var(--surface) 96%, transparent);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-md);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px);
    transition: opacity 0.16s ease, transform 0.16s ease;
  }

  .site-nav.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .site-nav a {
    min-height: 40px;
    display: flex;
    align-items: center;
    padding: 8px 10px;
  }

  .site-nav .theme-toggle {
    justify-self: start;
    margin: 6px 0 2px 10px;
  }
}

/* ---------- Hero ---------- */
.hero {
  padding: clamp(56px, 11vh, 120px) 0 clamp(56px, 10vh, 100px);
  position: relative;
  overflow: hidden;
}

.hero__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(40px, 6vw, 72px);
  align-items: center;
}

@media (min-width: 900px) {
  .hero__grid {
    grid-template-columns: minmax(0, 1.45fr) minmax(280px, 1fr);
  }
}

.hero__eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-faint);
  margin-bottom: 28px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.hero__eyebrow::before {
  content: '';
  width: 24px;
  height: 1px;
  background: var(--accent);
}

.hero__title {
  margin-bottom: 28px;
  max-width: 14ch;
}

.hero__title em {
  font-style: normal;
  background: var(--gradient-primary);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.hero__lead {
  font-size: clamp(1.05rem, 1.4vw, 1.2rem);
  line-height: 1.55;
  color: var(--text-muted);
  max-width: 56ch;
  margin-bottom: 40px;
}

.hero__cta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

/* Portrait */
.portrait {
  position: relative;
  width: 100%;
  max-width: 360px;
  margin-left: auto;
  aspect-ratio: 4 / 5;
}

.portrait__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
  filter: grayscale(0.35) contrast(1.05);
  transition: filter 0.5s ease;
  background: var(--bg-alt);
}

.portrait:hover .portrait__img { filter: grayscale(0) contrast(1); }

.portrait::before {
  content: '';
  position: absolute;
  inset: 18px -18px -18px 18px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  z-index: -1;
  pointer-events: none;
}

.portrait__caption {
  position: absolute;
  bottom: 14px;
  left: 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
  padding: 6px 10px;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  border-radius: 3px;
}

@media (max-width: 899px) {
  .portrait { max-width: 280px; margin: 0 auto; }
}

/* ---------- Fact Strip ---------- */
.fact-strip {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 28px 0;
  background: var(--bg-alt);
}

.fact-strip__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: baseline;
}

@media (min-width: 700px) {
  .fact-strip__grid { grid-template-columns: repeat(3, 1fr); gap: clamp(20px, 4vw, 56px); }
}

.fact {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.fact__num {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1;
}

.fact__num em {
  font-style: normal;
  color: var(--accent);
}

.fact__label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-faint);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  text-decoration: none;
}

.btn--primary {
  background: var(--text);
  color: var(--bg);
}

.btn--primary:hover {
  background: var(--accent);
  color: #fff;
}

.btn--gradient {
  background: var(--gradient-primary);
  color: #fff;
  border: 0;
}

.btn--gradient:hover {
  filter: brightness(1.08);
  box-shadow: var(--shadow-violet);
  color: #fff;
}

.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line-strong);
}

.btn--ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.btn__arrow {
  display: inline-block;
  transition: transform 0.2s ease;
}

.btn:hover .btn__arrow { transform: translateX(4px); }

.btn__icon {
  display: inline-flex;
  width: 16px;
  height: 16px;
}

/* ---------- Pillars ---------- */
.pillars {
  display: grid;
  gap: clamp(40px, 5vw, 64px);
}

.pillar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding-top: 36px;
  border-top: 1px solid var(--line);
}

@media (min-width: 900px) {
  .pillar {
    grid-template-columns: 80px minmax(0, 1.4fr) minmax(0, 1fr);
    gap: clamp(24px, 4vw, 56px);
  }
}

.pillar__num {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  letter-spacing: 0.06em;
  padding-top: 6px;
}

.pillar__title { margin-bottom: 14px; }

.pillar__body {
  color: var(--text-muted);
  font-size: 1.02rem;
  line-height: 1.6;
}

.pillar__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.tag {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 6px 10px;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  color: var(--text-muted);
  border-radius: 999px;
  transition: border-color .15s, color .15s;
}

.tag:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.pillar__anchor {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.pillar__anchor a {
  color: var(--accent);
  border-bottom: 1px solid currentColor;
  padding-bottom: 1px;
}

.pillar__anchor a:hover { color: var(--accent-hover); }

/* ---------- Section Header ---------- */
.section-head {
  display: grid;
  gap: 16px;
  margin-bottom: clamp(48px, 6vw, 80px);
}

@media (min-width: 800px) {
  .section-head {
    grid-template-columns: 1fr 2fr;
    align-items: end;
    gap: 56px;
  }
}

.section-head__kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-head__kicker::before {
  content: '';
  width: 24px;
  height: 1px;
  background: var(--accent);
}

.section-head__title { max-width: 18ch; }
.section-head__lead {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 56ch;
}

/* ---------- Featured Case ---------- */
.case-featured {
  display: grid;
  gap: clamp(28px, 4vw, 48px);
  padding: clamp(28px, 4vw, 48px);
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  transition: border-color 0.25s ease, transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  overflow: hidden;
}

.case-featured::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.case-featured:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.case-featured:hover::before { opacity: 1; }

@media (min-width: 900px) {
  .case-featured {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

.case-featured + .case-featured { margin-top: 24px; }

.case-featured__meta {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.case-featured__meta span + span { color: var(--text-faint); }

.case-featured__meta span + span::before {
  content: '·';
  margin-right: 12px;
  color: var(--text-faint);
}

.case-featured__title {
  margin-bottom: 18px;
  font-size: clamp(1.6rem, 2.6vw, 2.2rem);
  letter-spacing: -0.02em;
}

.case-featured__hook {
  color: var(--text-muted);
  font-size: 1.02rem;
  line-height: 1.6;
  margin-bottom: 24px;
}

.case-featured__link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: var(--text);
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 2px;
  transition: border-color 0.15s, color 0.15s;
}

.case-featured__link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.case-featured__link .btn__arrow { transition: transform .2s; }
.case-featured__link:hover .btn__arrow { transform: translateX(4px); }

.case-featured__specs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 24px;
  padding: 24px;
  background: var(--bg-alt);
  border-radius: 6px;
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 12px;
}

.case-featured__spec dt {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  font-size: 10px;
  margin-bottom: 4px;
}

.case-featured__spec dd { margin: 0; color: var(--text); }

/* ---------- Other Cases List ---------- */
.cases-list { display: grid; gap: 0; }

.cases-other {
  margin-top: clamp(60px, 8vw, 90px);
  padding-left: clamp(16px, 3vw, 48px);
}

.cases-other .case-row {
  margin-left: 0;
  margin-right: 0;
  padding-left: clamp(16px, 2vw, 28px);
  padding-right: clamp(16px, 2vw, 28px);
}

@media (max-width: 600px) {
  .cases-other { padding-left: 8px; }
}

.case-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 28px 0;
  border-top: 1px solid var(--line);
  transition: background 0.15s ease;
  margin: 0 calc(var(--gutter) * -1);
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

@media (min-width: 800px) {
  .case-row {
    grid-template-columns: 130px minmax(0, 2fr) minmax(0, 1.4fr) 80px;
    align-items: center;
    gap: 32px;
  }
}

.case-row:hover { background: var(--bg-alt); }
.case-row:last-child { border-bottom: 1px solid var(--line); }

.case-row__tag {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
}

.case-row__title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text);
}

.case-row__desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.case-row__arrow {
  text-align: right;
  color: var(--text-faint);
  transition: transform 0.2s ease, color 0.2s ease;
}

.case-row:hover .case-row__arrow {
  color: var(--accent);
  transform: translateX(4px);
}

/* ---------- Security Principles ---------- */
.principles {
  display: grid;
  gap: clamp(28px, 3.5vw, 40px);
  margin-bottom: clamp(40px, 6vh, 60px);
}

@media (min-width: 720px) {
  .principles { grid-template-columns: 1fr 1fr; }
}

.principle {
  padding: 32px 0 0;
  border-top: 1px solid var(--line-strong);
  position: relative;
}

.principle::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 0;
  width: 48px;
  height: 1px;
  background: var(--accent);
}

.principle__label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
  background: var(--accent-soft);
  padding: 6px 10px;
  border-radius: 6px;
}

.principle__title {
  font-size: 1.45rem;
  margin-bottom: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.principle__body {
  color: var(--text-muted);
  font-size: 0.98rem;
  line-height: 1.6;
}

.principle__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  text-decoration: none;
}

.principle__link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* ---------- Tech Stack ---------- */
.stack { display: grid; gap: clamp(28px, 4vw, 48px); }

.stack-group {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

@media (min-width: 800px) {
  .stack-group {
    grid-template-columns: 200px 1fr;
    gap: 48px;
    align-items: baseline;
  }
}

.stack-group__label {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-faint);
}

.stack-group__items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--text);
  font-weight: 500;
  letter-spacing: -0.01em;
}

.stack-group__items span:not(:last-child)::after {
  content: '·';
  margin-left: 22px;
  color: var(--text-faint);
}

/* ---------- Contact Channels ---------- */
.channels {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr;
  max-width: 800px;
  margin: 0 auto 32px;
}

@media (min-width: 700px) {
  .channels { grid-template-columns: repeat(3, 1fr); }
}

.channel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 28px 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  text-align: left;
  text-decoration: none;
  position: relative;
  overflow: hidden;
  transition: border-color .25s ease, transform .3s cubic-bezier(.4,0,.2,1), box-shadow .3s ease;
}

.channel::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 12px;
  padding: 1px;
  background: linear-gradient(135deg, var(--accent), var(--accent-bright), transparent 60%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity .3s ease;
}

.channel:hover {
  border-color: transparent;
  transform: translateY(-4px);
  box-shadow: var(--shadow-violet);
}

.channel:hover::before {
  opacity: 1;
}

.channel__icon {
  width: 36px;
  height: 36px;
  margin-bottom: 10px;
  color: var(--accent);
  transition: transform .3s ease;
}

.channel:hover .channel__icon {
  transform: scale(1.1);
}

.channel__label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-faint);
}

.channel__value {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.channel__hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.45;
}

/* ---------- CTA Block ---------- */
.cta {
  text-align: center;
  padding: clamp(80px, 12vh, 120px) 0;
  border-top: 1px solid var(--line);
}

.cta__title {
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  margin-bottom: 18px;
  max-width: 22ch;
  margin-left: auto;
  margin-right: auto;
}

.cta__lead {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 54ch;
  margin: 0 auto 36px;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 48px 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 32px;
  justify-content: space-between;
  align-items: center;
}

.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--accent); }

/* ---------- Scroll-to-top ---------- */
.scroll-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 60;
  width: 44px;
  height: 44px;
  background: var(--text);
  color: var(--bg);
  border: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease, background 0.15s ease, color 0.15s ease;
  box-shadow: var(--shadow-md);
}

.scroll-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.scroll-top:hover {
  background: var(--accent);
  color: #fff;
}

.scroll-top svg { width: 16px; height: 16px; }

@media (max-width: 600px) {
  .scroll-top { width: 40px; height: 40px; bottom: 16px; right: 16px; }
}

/* ---------- Article (case detail pages) ---------- */
.article-hero {
  padding: clamp(80px, 12vh, 140px) 0 clamp(40px, 6vh, 60px);
}

.article-hero__meta {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin-bottom: 28px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.article-hero__meta span { color: var(--text-faint); }
.article-hero__meta a { color: var(--text-faint); }
.article-hero__meta a:hover { color: var(--accent); }

.article-hero__title {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  line-height: 1.05;
  max-width: 22ch;
  margin-bottom: 32px;
}

.article-hero__hook {
  font-size: clamp(1.05rem, 1.6vw, 1.3rem);
  line-height: 1.55;
  color: var(--text-muted);
  max-width: 60ch;
}

.article { padding-bottom: clamp(80px, 12vh, 140px); }

.article__body {
  max-width: var(--reading);
  margin: 0 auto;
  font-size: 1.05rem;
  line-height: 1.7;
}

.article__body h2 {
  margin: clamp(48px, 6vw, 72px) 0 20px;
  font-size: clamp(1.5rem, 2.5vw, 1.9rem);
}

.article__body h2::before {
  content: attr(data-num);
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-right: 14px;
  vertical-align: 0.18em;
  font-weight: 400;
}

.article__body h3 {
  margin: 32px 0 12px;
  font-size: 1.18rem;
  font-weight: 600;
}

.article__body p { margin: 0 0 18px; color: var(--text); }
.article__body p strong { color: var(--text); font-weight: 600; }
.article__body em { font-style: italic; color: var(--text-muted); }

.article__body ul,
.article__body ol {
  padding-left: 0;
  list-style: none;
  margin: 0 0 24px;
}

.article__body li {
  position: relative;
  padding-left: 28px;
  margin-bottom: 10px;
}

.article__body ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.85em;
  width: 14px;
  height: 1px;
  background: var(--accent);
}

.article__body ol { counter-reset: list; }
.article__body ol li { counter-increment: list; }
.article__body ol li::before {
  content: counter(list, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.04em;
}

.pullquote {
  margin: 40px 0;
  padding: 28px 32px;
  border-left: 2px solid var(--accent);
  background: var(--bg-alt);
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 1.8vw, 1.35rem);
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--text);
  border-radius: 0 6px 6px 0;
}

.spec-table {
  margin: 24px 0 32px;
  padding: 18px 16px;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 13px;
  display: grid;
  gap: 10px 20px;
}

.spec-table dt + dd { margin-top: -4px; }

@media (min-width: 600px) {
  .spec-table {
    padding: 22px 24px;
    gap: 14px 24px;
    grid-template-columns: 140px 1fr;
  }
  .spec-table dt + dd { margin-top: 0; }
}

@media (min-width: 900px) {
  .spec-table {
    padding: 28px;
    gap: 16px 24px;
    grid-template-columns: 180px 1fr;
  }
}

.spec-table dt {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 11px;
  color: var(--text-faint);
}

.spec-table dd { margin: 0; color: var(--text); }

.callout {
  margin: 28px 0;
  padding: 20px 24px;
  background: var(--accent-soft);
  border-left: 2px solid var(--accent);
  border-radius: 0 6px 6px 0;
  font-size: 0.98rem;
  color: var(--text);
}

.callout__label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
  font-weight: 600;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.back-link:hover { color: var(--accent); }

/* ROI cards (case B) */
.roi-grid { display: grid; gap: 16px; margin: 28px 0 32px; }

.roi-card {
  padding: 24px;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.roi-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-bottom: 14px;
}

.roi-card__num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.08em;
}

.roi-card__title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  flex: 1;
}

.roi-card__risk {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text-muted);
}

.roi-card__risk--low { color: var(--accent); border-color: var(--accent); }
.roi-card__risk--mid { color: #f5a623; border-color: #f5a623; }
.roi-card__risk--high { color: #e94e4e; border-color: #e94e4e; }

.roi-card__body { font-size: 0.95rem; color: var(--text-muted); line-height: 1.55; margin-bottom: 16px; }

.roi-card__metrics {
  display: grid;
  gap: 8px 24px;
  font-family: var(--font-mono);
  font-size: 12px;
}

@media (min-width: 600px) { .roi-card__metrics { grid-template-columns: 1fr 1fr; } }

.roi-card__metrics dt {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 10px;
  color: var(--text-faint);
  margin-bottom: 2px;
}

.roi-card__metrics dd { margin: 0 0 6px; color: var(--text); }

/* ---------- Methodology timeline ---------- */
.timeline {
  display: grid;
  gap: 0;
  margin-bottom: clamp(48px, 6vw, 64px);
}

.phase {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 36px 0;
  border-top: 1px solid var(--line);
  position: relative;
}

@media (min-width: 800px) {
  .phase {
    grid-template-columns: 110px minmax(0, 1.4fr) minmax(0, 1fr);
    gap: clamp(24px, 4vw, 56px);
  }
}

.phase:last-child { border-bottom: 1px solid var(--line); }

.phase__num {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--accent);
  padding-top: 6px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.phase__num::before {
  content: '';
  width: 24px;
  height: 1px;
  background: var(--accent);
}

.phase__title { margin-bottom: 12px; }

.phase__body {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.6;
}

.phase__deliverables {
  font-family: var(--font-mono);
  font-size: 12px;
}

.phase__deliverables-label {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-faint);
  margin-bottom: 12px;
}

.phase__deliverables ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.phase__deliverables li {
  padding: 6px 0 6px 18px;
  position: relative;
  color: var(--text);
  font-size: 12.5px;
}

.phase__deliverables li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 14px;
  width: 8px;
  height: 1px;
  background: var(--accent);
}

/* ---------- Cooperation principles (methodology) ---------- */
.coop {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line);
}

.coop__row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}

@media (min-width: 800px) {
  .coop__row {
    grid-template-columns: 1fr 1.5fr 1.5fr;
    gap: 32px;
    align-items: baseline;
  }
}

.coop__label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-faint);
}

.coop__col h4 {
  margin-bottom: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font-body);
  color: var(--text);
}

.coop__col p {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0;
}

/* ---------- Utility ---------- */
.text-muted { color: var(--text-muted); }
.mono { font-family: var(--font-mono); }
.kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-faint);
}

/* ---------- Figure (screenshots / images in articles) ---------- */
.figure {
  margin: 32px 0;
}

.figure--wide {
  width: min(1180px, calc(100vw - var(--gutter) * 2));
  margin: 42px 0;
  margin-left: 50%;
  transform: translateX(-50%);
}

.figure__frame {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-alt);
  overflow: hidden;
}

.figure__frame img {
  display: block;
  width: 100%;
  height: auto;
}

@media (max-width: 700px) {
  .figure--wide .figure__frame {
    overflow: auto hidden;
  }

  .figure--wide .figure__frame img {
    min-width: 720px;
  }
}

.figure__placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 280px;
  padding: 40px 32px;
  text-align: center;
  background:
    repeating-linear-gradient(
      45deg,
      transparent 0,
      transparent 12px,
      var(--line) 12px,
      var(--line) 13px
    );
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
}

.figure__placeholder-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

.figure__placeholder-hint {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  max-width: 44ch;
  line-height: 1.5;
}

.figure__placeholder-path {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.figure__caption {
  margin-top: 14px;
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.55;
  padding-left: 16px;
  border-left: 2px solid var(--line);
}

.figure-grid {
  display: grid;
  gap: 20px;
  margin: 32px 0;
}

@media (min-width: 800px) {
  .figure-grid--2 { grid-template-columns: 1fr 1fr; }
}

.figure-grid .figure { margin: 0; }

/* ============================================
   Reusable case-page components
   (вынесены из inline-стилей, общие для всех кейсов)
   ============================================ */

/* ---------- cycle-flow: нумерованные карточки шагов процесса ---------- */
.cycle-flow {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, 1fr);
  margin: 28px 0 18px;
}
@media (max-width: 899px) { .cycle-flow { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .cycle-flow { grid-template-columns: 1fr; } }

.cycle-step {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  position: relative;
}
.cycle-step__num {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  text-align: center;
  line-height: 26px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}
.cycle-step__title {
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 15px;
  color: var(--text);
}
.cycle-step__desc {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}

/* ---------- compare-table: адаптивная сравнительная таблица ----------
   На мобильном (<=720px) каждая строка превращается в карточку, заголовок
   столбца берётся из data-label атрибута td. */
.compare-table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
  font-size: 14px;
}
.compare-table th,
.compare-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  color: var(--text);
}
.compare-table th {
  background: var(--bg-alt);
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}
.compare-table td:first-child {
  font-weight: 600;
  white-space: nowrap;
}
@media (max-width: 720px) {
  .compare-table {
    display: block;
    max-width: 100%;
  }
  .compare-table thead { display: none; }
  .compare-table tbody {
    display: block;
    width: 100%;
  }
  .compare-table tbody tr {
    display: block;
    margin-bottom: 18px;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 14px;
    box-sizing: border-box;
    max-width: 100%;
  }
  .compare-table tbody td,
  .compare-table tbody td:first-child {
    display: block;
    border: none;
    padding: 4px 0;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    max-width: 100%;
  }
  .compare-table tbody td:first-child {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 4px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--line);
  }
  .compare-table tbody td:not(:first-child)::before {
    content: attr(data-label) ": ";
    font-weight: 600;
    color: var(--text-muted);
  }
}

/* ---------- protocol-cycle: блок с цветной полосой и нумерованным списком ---------- */
.protocol-cycle {
  margin: 20px 0;
  padding: 14px 14px;
  background: var(--bg-alt);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
}
.protocol-cycle ol {
  margin: 0;
  padding-left: 0;
}
.protocol-cycle ol li {
  margin-bottom: 10px;
  line-height: 1.55;
}
.protocol-cycle ol li strong { color: var(--text); }
@media (min-width: 600px) {
  .protocol-cycle { padding: 18px 22px; }
}

/* ---------- status-pill: статус-бейджи ---------- */
.status-pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.status-pill--ok   { background: #d1fae5; color: #065f46; }
.status-pill--warn { background: #fef3c7; color: #92400e; }
.status-pill--build { background: #dbeafe; color: #1e40af; }
.status-pill--note { background: #e5e7eb; color: #374151; }

/* ---------- draft-banner: плашка-уведомление наверху страницы ---------- */
.draft-banner {
  padding: 12px 18px;
  border-radius: 8px;
  margin: 18px 0 24px;
  font-size: 14px;
  line-height: 1.5;
}
.draft-banner--note    { background: linear-gradient(135deg, #e0e7ff, #c7d2fe); color: #312e81; }
.draft-banner--note strong    { color: #1e1b4b; }
.draft-banner--warn    { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #92400e; }
.draft-banner--warn strong    { color: #78350f; }

/* ---------- arch-ascii: блок ASCII-схемы ---------- */
.arch-ascii {
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre;
  margin: 18px 0;
  color: var(--text);
}
@media (max-width: 600px) {
  .arch-ascii { font-size: 10px; padding: 12px; }
}

/* ---------- feature-grid / feature-card: сетка с карточками возможностей ---------- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin: 24px 0;
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
}
.feature-card h4 {
  margin: 0 0 10px;
  font-size: 16px;
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--text);
}
.feature-card ul {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 14px;
}
.feature-card li { margin-bottom: 4px; }

/* ============================================
   /Reusable case-page components
   ============================================ */

/* ---------- Marketing insights dashboard ---------- */
.mi-page {
  --mi-danger: #c9362b;
  --mi-danger-soft: rgb(201 54 43 / 0.10);
  --mi-warn: #b97809;
  --mi-warn-soft: rgb(185 120 9 / 0.12);
  --mi-ok: #17885c;
  --mi-ok-soft: rgb(23 136 92 / 0.12);
  --mi-info: #1c6fb8;
  --mi-info-soft: rgb(28 111 184 / 0.12);
  --mi-ink: #111827;
}

[data-theme='dark'] .mi-page {
  --mi-danger: #ff7a6f;
  --mi-danger-soft: rgb(255 122 111 / 0.14);
  --mi-warn: #f1b653;
  --mi-warn-soft: rgb(241 182 83 / 0.15);
  --mi-ok: #5ad19a;
  --mi-ok-soft: rgb(90 209 154 / 0.15);
  --mi-info: #74b8ff;
  --mi-info-soft: rgb(116 184 255 / 0.15);
  --mi-ink: #f0ede6;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .mi-page {
    --mi-danger: #ff7a6f;
    --mi-danger-soft: rgb(255 122 111 / 0.14);
    --mi-warn: #f1b653;
    --mi-warn-soft: rgb(241 182 83 / 0.15);
    --mi-ok: #5ad19a;
    --mi-ok-soft: rgb(90 209 154 / 0.15);
    --mi-info: #74b8ff;
    --mi-info-soft: rgb(116 184 255 / 0.15);
    --mi-ink: #f0ede6;
  }
}

.mi-page h1,
.mi-page h2,
.mi-page h3 {
  letter-spacing: 0;
}

.mi-hero {
  padding-top: 42px;
  padding-bottom: 18px;
}

.mi-hero__grid {
  display: grid;
  gap: 28px;
  align-items: end;
}

.mi-hero__title {
  max-width: 16ch;
  margin-bottom: 16px;
  font-size: 2.85rem;
  line-height: 1.04;
}

.mi-hero__lead {
  max-width: 66ch;
  margin: 0;
  color: var(--text-muted);
  font-size: 1.02rem;
  line-height: 1.58;
}

.mi-page .back-link {
  margin-bottom: 22px;
}

.mi-page .article-hero__meta {
  margin-bottom: 18px;
}

.mi-meta-panel {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.mi-meta-panel__row {
  display: grid;
  gap: 4px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
}

.mi-meta-panel__row:last-child {
  border-bottom: 0;
}

.mi-meta-panel__row span,
.mi-kpi-card__label,
.mi-cadence-card span,
.mi-evidence-card span,
.mi-tool span,
.mi-action-item span,
.mi-next-step span,
.mi-confidence {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.35;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.mi-meta-panel__row strong {
  font-size: 0.92rem;
  line-height: 1.45;
}

.mi-control-bar {
  display: grid;
  gap: 8px;
  padding-top: 10px;
  padding-bottom: 12px;
}

.mi-filter {
  display: grid;
  gap: 3px;
  min-height: 64px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.mi-filter__label,
.mi-panel__eyebrow,
.mi-meter__head span,
.mi-funnel-step span,
.mi-status,
.mi-alert span {
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.3;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.mi-filter strong {
  font-size: 0.9rem;
  line-height: 1.35;
}

.mi-cockpit {
  display: grid;
  gap: 18px;
  padding-top: 10px;
  padding-bottom: 22px;
}

.mi-decision,
.mi-action-stack {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.mi-decision {
  position: relative;
  padding: 24px;
  overflow: hidden;
}

.mi-decision::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--mi-danger);
}

.mi-decision__top {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  margin-bottom: 18px;
}

.mi-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  background: var(--bg-alt);
}

.mi-badge--danger {
  color: var(--mi-danger);
  border-color: color-mix(in srgb, var(--mi-danger) 45%, var(--line));
  background: var(--mi-danger-soft);
}

.mi-decision h2,
.mi-action-stack h2,
.mi-section__head h2 {
  margin: 0;
  font-size: 2rem;
  line-height: 1.14;
}

.mi-decision p {
  max-width: 78ch;
  margin: 14px 0 0;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.65;
}

.mi-next-step {
  display: grid;
  gap: 7px;
  margin-top: 20px;
  padding: 16px;
  border-radius: 8px;
  background: var(--bg-alt);
  border: 1px solid var(--line);
}

.mi-next-step strong {
  font-size: 1rem;
  line-height: 1.5;
}

.mi-action-stack {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 20px;
}

.mi-action-stack h2 {
  font-size: 1.25rem;
}

.mi-action-item {
  display: grid;
  gap: 5px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}

.mi-action-item strong {
  font-size: 0.96rem;
  line-height: 1.4;
}

.mi-kpi {
  display: grid;
  gap: 12px;
  padding-top: 8px;
  padding-bottom: 24px;
}

.mi-kpi-card {
  min-height: 138px;
  padding: 18px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}

.mi-kpi-card::before {
  content: '';
  width: 38px;
  height: 3px;
  border-radius: 999px;
  background: var(--mi-ok);
}

.mi-kpi-card--warn::before {
  background: var(--mi-warn);
}

.mi-kpi-card--info::before {
  background: var(--mi-info);
}

.mi-kpi-card__value {
  display: block;
  font-family: var(--font-display);
  font-size: 1.45rem;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.mi-kpi-card__note {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.mi-section {
  padding-top: 68px;
  padding-bottom: 72px;
}

.mi-section--band {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--bg-alt) 80%, transparent), var(--bg-alt));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.mi-section__head {
  max-width: 760px;
  margin-bottom: 28px;
}

.mi-section__head .kicker {
  display: block;
  margin-bottom: 12px;
}

.mi-section__head p {
  margin: 12px 0 0;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.65;
}

.mi-ops-grid {
  display: grid;
  gap: 16px;
}

.mi-mode-grid,
.mi-workbench-grid {
  display: grid;
  gap: 14px;
}

.mi-mode-card,
.mi-workbench {
  padding: 20px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.mi-mode-card {
  border-top-width: 4px;
}

.mi-mode-card--active {
  border-top-color: var(--mi-info);
  background: linear-gradient(180deg, var(--surface), var(--mi-info-soft));
}

.mi-mode-card--danger {
  border-top-color: var(--mi-danger);
  background: linear-gradient(180deg, var(--surface), var(--mi-danger-soft));
}

.mi-mode-card span {
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.3;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  overflow-wrap: anywhere;
}

.mi-mode-card h3,
.mi-workbench h3 {
  margin: 12px 0 0;
  font-size: 1.08rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.mi-mode-card p,
.mi-panel__body {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.mi-workbench-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.mi-workbench-list div {
  display: grid;
  gap: 3px;
  padding: 12px;
  border-radius: 8px;
  background: var(--bg-alt);
  border: 1px solid var(--line);
}

.mi-workbench-list strong {
  font-size: 0.95rem;
  line-height: 1.35;
}

.mi-workbench-list span {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.mi-panel--wide {
  margin-top: 14px;
}

.mi-panel {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.mi-panel h3 {
  max-width: 32ch;
  margin: 12px 0 0;
  font-size: 1.28rem;
  line-height: 1.25;
}

.mi-meter {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.mi-meter__head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.mi-meter__head strong {
  font-size: 0.95rem;
}

.mi-meter__track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--bg-alt);
  border: 1px solid var(--line);
}

.mi-meter__fill {
  display: block;
  height: 100%;
  width: 34%;
  background: var(--mi-ok);
}

.mi-meter__fill--warn {
  background: linear-gradient(90deg, var(--mi-ok), var(--mi-warn));
}

.mi-metric-list {
  display: grid;
  gap: 9px 20px;
  margin: 22px 0 0;
}

.mi-metric-list dt {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.mi-metric-list dd {
  margin: -5px 0 0;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.45;
}

.mi-trust-list {
  display: grid;
  gap: 12px;
  padding: 0;
  margin: 20px 0 0;
  list-style: none;
}

.mi-trust-list li {
  padding-left: 18px;
  position: relative;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.mi-trust-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.78em;
  width: 8px;
  height: 2px;
  background: var(--mi-info);
}

.mi-trust-list strong {
  color: var(--text);
}

.mi-funnel {
  display: grid;
  gap: 12px;
}

.mi-funnel-step {
  min-height: 150px;
  padding: 18px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  display: grid;
  align-content: space-between;
  gap: 16px;
}

.mi-funnel-step strong {
  display: block;
  font-family: var(--font-display);
  font-size: 2rem;
  line-height: 1;
  overflow-wrap: anywhere;
}

.mi-funnel-step p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.mi-funnel-step--missing {
  border-style: dashed;
}

.mi-funnel-step--danger {
  border-color: color-mix(in srgb, var(--mi-danger) 40%, var(--line));
  background: var(--mi-danger-soft);
}

.mi-lanes,
.mi-cadence,
.mi-insights,
.mi-evidence,
.mi-tool-grid,
.mi-alert-feed {
  display: grid;
  gap: 14px;
}

.mi-lane,
.mi-cadence-card,
.mi-insight,
.mi-evidence-card,
.mi-tool {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.mi-lane {
  padding: 20px;
  border-top-width: 4px;
}

.mi-lane--danger {
  border-top-color: var(--mi-danger);
}

.mi-lane--warn {
  border-top-color: var(--mi-warn);
}

.mi-lane--ok {
  border-top-color: var(--mi-ok);
}

.mi-lane h3,
.mi-cadence-card h3,
.mi-insight h3,
.mi-evidence-card h3,
.mi-tool h3 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.3;
}

.mi-lane p,
.mi-cadence-card p,
.mi-insight p,
.mi-evidence-card p,
.mi-tool p {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.58;
}

.mi-lane dl {
  display: grid;
  gap: 9px;
  margin: 18px 0 0;
}

.mi-lane dt {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.mi-lane dd {
  margin: -6px 0 0;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.45;
}

.mi-cadence-card {
  min-height: 176px;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.mi-cadence-card::after {
  content: '';
  position: absolute;
  right: 18px;
  bottom: 18px;
  width: 52px;
  height: 52px;
  border: 1px solid currentcolor;
  border-radius: 50%;
  opacity: 0.2;
}

.mi-cadence-card--danger {
  color: var(--mi-danger);
  background: linear-gradient(180deg, var(--surface), var(--mi-danger-soft));
}

.mi-cadence-card--warn {
  color: var(--mi-warn);
  background: linear-gradient(180deg, var(--surface), var(--mi-warn-soft));
}

.mi-cadence-card--ok {
  color: var(--mi-ok);
  background: linear-gradient(180deg, var(--surface), var(--mi-ok-soft));
}

.mi-cadence-card h3,
.mi-cadence-card p {
  color: var(--text);
}

.mi-cadence-card h3 {
  margin-top: 18px;
}

.mi-cadence-card p {
  color: var(--text-muted);
}

.mi-insight {
  padding: 22px;
  border-left-width: 4px;
}

.mi-insight--danger {
  border-left-color: var(--mi-danger);
}

.mi-insight--warn {
  border-left-color: var(--mi-warn);
}

.mi-insight--info {
  border-left-color: var(--mi-info);
}

.mi-insight__label {
  margin-bottom: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.mi-insight p strong {
  color: var(--text);
  font-weight: 600;
}

.mi-evidence-card,
.mi-tool {
  padding: 18px;
  min-width: 0;
}

.mi-evidence-card span,
.mi-tool span {
  color: var(--mi-info);
}

.mi-evidence-card h3,
.mi-tool h3 {
  margin-top: 12px;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.mi-evidence-card p,
.mi-tool p {
  overflow-wrap: anywhere;
}

.mi-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.mi-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 0.94rem;
}

.mi-table--wide {
  min-width: 1080px;
}

.mi-table th,
.mi-table td {
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.mi-table th {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  background: var(--bg-alt);
}

.mi-table td:first-child {
  font-weight: 700;
  color: var(--mi-ink);
}

.mi-table tr:last-child td {
  border-bottom: 0;
}

.mi-status {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-alt);
}

.mi-status--danger {
  color: var(--mi-danger);
  border-color: color-mix(in srgb, var(--mi-danger) 45%, var(--line));
  background: var(--mi-danger-soft);
}

.mi-status--warn {
  color: var(--mi-warn);
  border-color: color-mix(in srgb, var(--mi-warn) 45%, var(--line));
  background: var(--mi-warn-soft);
}

.mi-status--info {
  color: var(--mi-info);
  border-color: color-mix(in srgb, var(--mi-info) 45%, var(--line));
  background: var(--mi-info-soft);
}

.mi-alert-feed {
  margin-top: 16px;
}

.mi-alert {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  border-left-width: 4px;
}

.mi-alert--danger {
  border-left-color: var(--mi-danger);
}

.mi-alert--warn {
  border-left-color: var(--mi-warn);
}

.mi-alert--info {
  border-left-color: var(--mi-info);
}

.mi-alert__title {
  display: block;
  margin-top: 8px;
  font-size: 1rem;
  line-height: 1.35;
}

.mi-alert p {
  margin: 7px 0 0;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

@media (min-width: 760px) {
  .mi-control-bar {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .mi-ops-grid {
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  }

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

  .mi-lanes,
  .mi-cadence {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .mi-tool-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 760px) and (max-width: 1099px) {
  .mi-kpi {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .mi-funnel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .mi-insight {
    min-width: 0;
  }
}

@media (min-width: 520px) and (max-width: 759px) {
  .mi-kpi {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .mi-funnel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .mi-lanes,
  .mi-cadence,
  .mi-tool-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .mi-lane,
  .mi-cadence-card,
  .mi-tool {
    min-width: 0;
  }
}

@media (min-width: 1100px) {
  .mi-kpi {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .mi-mode-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .mi-funnel {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .mi-insights {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .mi-evidence {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 960px) {
  .mi-hero__grid {
    grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.78fr);
  }

  .mi-cockpit {
    grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.75fr);
  }
}

@media (max-width: 759px) {
  .mi-hero {
    padding-top: 34px;
  }

  .mi-hero__title {
    font-size: 2.05rem;
  }

  .mi-hero__lead {
    display: none;
  }

  .mi-meta-panel {
    grid-template-columns: 1fr 1fr;
  }

  .mi-meta-panel__row {
    padding: 9px 10px;
    border-right: 1px solid var(--line);
  }

  .mi-meta-panel__row:nth-child(2n) {
    border-right: 0;
  }

  .mi-meta-panel__row:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .mi-meta-panel__row span {
    font-size: 9px;
  }

  .mi-meta-panel__row strong {
    font-size: 0.78rem;
    line-height: 1.35;
  }

  .mi-control-bar {
    grid-template-columns: 1fr 1fr;
  }

  .mi-filter {
    min-height: 54px;
    padding: 8px 10px;
  }

  .mi-decision,
  .mi-action-stack,
  .mi-lane,
  .mi-cadence-card,
  .mi-insight,
  .mi-evidence-card,
  .mi-tool,
  .mi-panel,
  .mi-mode-card,
  .mi-workbench {
    padding: 18px;
  }

  .mi-panel h3 {
    font-size: 1.1rem;
  }

  .mi-funnel-step {
    min-height: 120px;
  }

  .mi-funnel-step strong {
    font-size: 1.65rem;
  }

  .mi-decision h2,
  .mi-section__head h2 {
    font-size: 1.55rem;
  }

  .mi-kpi-card {
    min-height: 116px;
  }

  .mi-table {
    min-width: 0;
  }

  .mi-table thead {
    display: none;
  }

  .mi-table,
  .mi-table tbody,
  .mi-table tr,
  .mi-table td {
    display: block;
  }

  .mi-table tr {
    border-bottom: 1px solid var(--line);
  }

  .mi-table tr:last-child {
    border-bottom: 0;
  }

  .mi-table td {
    display: grid;
    grid-template-columns: minmax(96px, 0.42fr) minmax(0, 1fr);
    gap: 12px;
    border-bottom: 1px solid var(--line);
    padding: 12px 14px;
  }

  .mi-table td:last-child {
    border-bottom: 0;
  }

  .mi-table td::before {
    content: attr(data-label);
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-faint);
  }
}

/* ---------- Marketing workbench page ---------- */
.mw-page-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 26px;
}

.mw-page-switch a {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.3;
  text-decoration: none;
}

.mw-page-switch a[aria-current='page'] {
  color: var(--mi-info);
  border-color: color-mix(in srgb, var(--mi-info) 45%, var(--line));
  background: var(--mi-info-soft);
}

.mw-hero__title {
  max-width: 12ch;
}

.mw-status-strip {
  display: grid;
  gap: 10px;
  padding-top: 8px;
  padding-bottom: 24px;
}

.mw-status-cell {
  min-height: 118px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  border-top-width: 4px;
}

.mw-status-cell--ok {
  border-top-color: var(--mi-ok);
}

.mw-status-cell--warn {
  border-top-color: var(--mi-warn);
}

.mw-status-cell--info {
  border-top-color: var(--mi-info);
}

.mw-status-cell span,
.mw-field span,
.mw-draft span,
.mw-match span,
.mw-evidence-grid span {
  display: block;
  margin-bottom: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.3;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.mw-status-cell strong {
  display: block;
  font-size: 1rem;
  line-height: 1.35;
}

.mw-status-cell small {
  display: block;
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.mw-workspace {
  display: grid;
  gap: 18px;
  padding-top: 10px;
  padding-bottom: 48px;
}

.mw-insight-card,
.mw-side-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.mw-insight-card {
  padding: 24px;
  border-left-width: 5px;
  border-left-color: var(--mi-danger);
}

.mw-insight-card__head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  margin-bottom: 18px;
}

.mw-insight-card h2,
.mw-side-panel h2 {
  margin: 0;
  font-size: 1.75rem;
  line-height: 1.16;
}

.mw-insight-card p {
  max-width: 78ch;
  margin: 14px 0 0;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.62;
}

.mw-insight-grid {
  display: grid;
  gap: 0;
  margin-top: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.mw-field {
  min-height: 108px;
  padding: 15px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-alt);
}

.mw-field:last-child {
  border-bottom: 0;
}

.mw-field strong {
  display: block;
  font-size: 0.95rem;
  line-height: 1.45;
}

.mw-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.mw-action-row button {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  cursor: default;
}

.mw-action-row button:first-child {
  color: var(--mi-info);
  border-color: color-mix(in srgb, var(--mi-info) 45%, var(--line));
  background: var(--mi-info-soft);
}

.mw-side-panel {
  align-self: start;
  padding: 22px;
}

.mw-side-panel h2 {
  margin-top: 12px;
  font-size: 1.3rem;
}

.mw-creative-grid,
.mw-match-grid,
.mw-evidence-layout,
.mw-history {
  display: grid;
  gap: 14px;
}

.mw-draft,
.mw-match,
.mw-evidence-drawer,
.mw-rules,
.mw-history article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.mw-draft {
  padding: 20px;
  border-top-width: 4px;
}

.mw-draft--active {
  border-top-color: var(--mi-info);
  background: linear-gradient(180deg, var(--surface), var(--mi-info-soft));
}

.mw-draft h3,
.mw-match strong,
.mw-history strong {
  display: block;
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.32;
}

.mw-draft p,
.mw-match p,
.mw-history p,
.mw-evidence-grid p {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: 0.94rem;
  line-height: 1.55;
}

.mw-draft dl {
  display: grid;
  gap: 8px;
  margin: 18px 0 0;
}

.mw-draft dt {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.mw-draft dd {
  margin: -5px 0 0;
  font-size: 0.9rem;
  line-height: 1.45;
}

.mw-match {
  min-height: 160px;
  padding: 20px;
  border-left-width: 4px;
  border-left-color: var(--mi-ok);
}

.mw-match--warn {
  border-left-color: var(--mi-warn);
}

.mw-evidence-drawer {
  overflow: hidden;
}

.mw-evidence-drawer summary {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
  cursor: pointer;
}

.mw-evidence-grid {
  display: grid;
  gap: 0;
}

.mw-evidence-grid div {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.mw-evidence-grid div:last-child {
  border-bottom: 0;
}

.mw-evidence-grid strong {
  display: block;
  font-size: 1rem;
  line-height: 1.35;
}

.mw-rules {
  align-self: start;
  padding: 20px;
}

.mw-rules ul {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 16px 0 0;
  list-style: none;
}

.mw-rules li {
  position: relative;
  padding-left: 18px;
  color: var(--text-muted);
  font-size: 0.94rem;
  line-height: 1.5;
}

.mw-rules li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.75em;
  width: 8px;
  height: 2px;
  background: var(--mi-danger);
}

.mw-history article {
  display: grid;
  gap: 10px;
  padding: 18px;
}

.mw-tool-locked {
  border-style: dashed;
}

.mw-tool-locked::after {
  content: 'roadmap';
  display: inline-flex;
  width: max-content;
  margin-top: 14px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}

@media (min-width: 760px) {
  .mw-status-strip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .mw-insight-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .mw-field {
    border-right: 1px solid var(--line);
  }

  .mw-field:nth-child(4n) {
    border-right: 0;
  }

  .mw-field:nth-last-child(-n + 4) {
    border-bottom: 0;
  }

  .mw-creative-grid,
  .mw-match-grid,
  .mw-history {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .mw-evidence-grid div {
    border-right: 1px solid var(--line);
  }

  .mw-evidence-grid div:nth-child(2n) {
    border-right: 0;
  }

  .mw-evidence-grid div:nth-last-child(-n + 2) {
    border-bottom: 0;
  }
}

@media (min-width: 520px) and (max-width: 759px) {
  .mw-status-strip,
  .mw-creative-grid,
  .mw-match-grid,
  .mw-history {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .mw-page .mi-tool-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mw-status-cell,
  .mw-draft,
  .mw-match,
  .mw-history article,
  .mi-tool {
    min-width: 0;
  }

  .mw-status-cell strong,
  .mw-draft h3,
  .mw-match strong,
  .mw-history strong,
  .mi-tool h3 {
    overflow-wrap: anywhere;
  }
}

@media (min-width: 760px) and (max-width: 1099px) {
  .mw-page .mi-tool-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 960px) {
  .mw-workspace {
    grid-template-columns: minmax(0, 1.42fr) minmax(300px, 0.68fr);
  }

  .mw-evidence-layout {
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  }
}

@media (max-width: 759px) {
  .mw-page-switch {
    margin-bottom: 18px;
  }

  .mw-page-switch a {
    min-height: 34px;
    font-size: 0.82rem;
  }

  .mw-insight-card,
  .mw-side-panel,
  .mw-status-cell,
  .mw-draft,
  .mw-match,
  .mw-rules,
  .mw-history article {
    padding: 18px;
  }

  .mw-insight-card h2 {
    font-size: 1.45rem;
  }

  .mw-field {
    min-height: auto;
  }

  .mw-action-row button {
    width: 100%;
  }
}

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

/* ---------- Lead Form ---------- */
.lead-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 640px;
  margin: 0 auto 32px;
}

.lead-form__row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lead-form label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.lead-form input[type="text"],
.lead-form textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.lead-form textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.5;
}

.lead-form ::placeholder {
  color: var(--text-faint);
  opacity: 1;
}

.lead-form input[type="text"]:focus,
.lead-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.lead-form .btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.lead-form__status {
  min-height: 1.4em;
  margin-top: 4px;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.lead-form__hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

@media (max-width: 600px) {
  .lead-form input[type="text"],
  .lead-form textarea {
    padding: 12px 14px;
  }

  .lead-form .btn {
    width: 100%;
  }
}
