/* ============ EmailFlow — design tokens ============ */
:root {
  /* Accent (user-tweakable) */
  --accent-h: 42;        /* hue */
  --accent-c: 0.15;      /* chroma */
  --accent-l: 0.65;      /* lightness */

  --accent: oklch(var(--accent-l) var(--accent-c) var(--accent-h));
  --accent-hover: oklch(calc(var(--accent-l) - 0.04) var(--accent-c) var(--accent-h));
  --accent-soft: oklch(0.96 0.04 var(--accent-h));
  --accent-ring: oklch(var(--accent-l) var(--accent-c) var(--accent-h) / 0.3);
  --accent-fg: oklch(0.22 0.05 var(--accent-h));

  /* Neutrals — light */
  --bg: oklch(0.995 0.002 80);
  --bg-subtle: oklch(0.975 0.003 80);
  --bg-muted: oklch(0.955 0.004 80);
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --border: oklch(0.92 0.004 80);
  --border-strong: oklch(0.86 0.005 80);
  --text: oklch(0.22 0.006 80);
  --text-secondary: oklch(0.45 0.006 80);
  --text-muted: oklch(0.60 0.006 80);

  /* Semantic */
  --green: oklch(0.65 0.14 155);
  --green-soft: oklch(0.96 0.03 155);
  --red: oklch(0.60 0.19 27);
  --red-soft: oklch(0.96 0.03 27);
  --amber: oklch(0.75 0.15 70);
  --amber-soft: oklch(0.96 0.04 70);
  --blue: oklch(0.58 0.14 240);
  --blue-soft: oklch(0.96 0.03 240);

  /* Radii */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;

  /* Shadows (subtle, enterprise) */
  --shadow-xs: 0 1px 0 rgba(17, 17, 17, 0.03), 0 1px 2px rgba(17, 17, 17, 0.03);
  --shadow-sm: 0 1px 2px rgba(17, 17, 17, 0.04), 0 1px 3px rgba(17, 17, 17, 0.05);
  --shadow-md: 0 4px 8px -2px rgba(17, 17, 17, 0.06), 0 2px 4px -2px rgba(17, 17, 17, 0.05);
  --shadow-lg: 0 12px 24px -6px rgba(17, 17, 17, 0.08), 0 4px 8px -4px rgba(17, 17, 17, 0.06);
  --shadow-xl: 0 24px 48px -12px rgba(17, 17, 17, 0.12), 0 8px 16px -8px rgba(17, 17, 17, 0.08);

  /* Density */
  --row-h: 40px;
  --pad: 16px;

  /* Fonts */
  --font-sans: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

/* Dark mode */
html[data-theme="dark"] {
  --bg: oklch(0.14 0.004 80);
  --bg-subtle: oklch(0.17 0.004 80);
  --bg-muted: oklch(0.20 0.004 80);
  --surface: oklch(0.19 0.004 80);
  --surface-raised: oklch(0.22 0.004 80);
  --border: oklch(0.26 0.005 80);
  --border-strong: oklch(0.32 0.006 80);
  --text: oklch(0.96 0.003 80);
  --text-secondary: oklch(0.72 0.005 80);
  --text-muted: oklch(0.55 0.006 80);

  --accent-soft: oklch(0.28 0.06 var(--accent-h));
  --accent-fg: oklch(0.88 0.06 var(--accent-h));

  --green-soft: oklch(0.26 0.05 155);
  --red-soft: oklch(0.26 0.05 27);
  --amber-soft: oklch(0.28 0.06 70);
  --blue-soft: oklch(0.26 0.05 240);

  --shadow-xs: 0 1px 0 rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35), 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 8px -2px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 24px -6px rgba(0, 0, 0, 0.5), 0 4px 8px -4px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 24px 48px -12px rgba(0, 0, 0, 0.6), 0 8px 16px -8px rgba(0, 0, 0, 0.5);
}

/* Density modes */
html[data-density="compact"] { --row-h: 32px; --pad: 10px; }
html[data-density="cozy"]    { --row-h: 40px; --pad: 16px; }
html[data-density="spacious"]{ --row-h: 48px; --pad: 22px; }

/* Reset-ish */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { height: 100%; overflow-x: hidden; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01", "ss03";
  overflow-x: clip; /* clip (not hidden) so it doesn't become a scroll container & break position:sticky */
  max-width: 100vw;
}
img, svg, video, canvas, iframe { max-width: 100%; height: auto; }
#root { max-width: 100%; overflow-x: hidden; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01", "ss03";
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
code, kbd, pre, samp { font-family: var(--font-mono); }

/* ============ Primitives ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--r-md);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: -0.005em;
  border: 1px solid transparent;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease, transform 80ms ease, box-shadow 120ms ease;
  white-space: nowrap;
  user-select: none;
}
.btn:active { transform: translateY(0.5px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: var(--accent-fg);
  box-shadow: 0 1px 0 rgba(0,0,0,0.06) inset, 0 1px 2px rgba(0,0,0,0.08);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:focus-visible { outline: 3px solid var(--accent-ring); outline-offset: 1px; }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover { background: var(--bg-subtle); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--bg-muted); color: var(--text); }

.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: var(--r-sm); }
.btn-lg { height: 42px; padding: 0 18px; font-size: 14px; }

.input,
.select {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  font-size: 14px;
  color: var(--text);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
/* Native select: room for the dropdown arrow + consistent cursor. */
.select { cursor: pointer; padding-right: 30px; }
.input:focus,
.select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.input::placeholder { color: var(--text-muted); }
.input.input-mono { font-family: var(--font-mono); font-size: 13px; }

.label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.005em;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
}

.divider { height: 1px; background: var(--border); width: 100%; }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  height: 22px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
  background: var(--bg-muted);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.badge-dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; display: inline-block; }
.badge-green { background: var(--green-soft); color: var(--green); border-color: transparent; }
.badge-red   { background: var(--red-soft); color: var(--red); border-color: transparent; }
.badge-amber { background: var(--amber-soft); color: oklch(0.55 0.14 70); border-color: transparent; }
.badge-blue  { background: var(--blue-soft); color: var(--blue); border-color: transparent; }
html[data-theme="dark"] .badge-green { color: oklch(0.82 0.14 155); }
html[data-theme="dark"] .badge-red   { color: oklch(0.80 0.15 27); }
html[data-theme="dark"] .badge-amber { color: oklch(0.85 0.14 70); }
html[data-theme="dark"] .badge-blue  { color: oklch(0.80 0.14 240); }

/* Kbd */
.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 20px;
  padding: 0 5px;
  font-size: 11px;
  font-family: var(--font-mono);
  background: var(--bg-muted);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  color: var(--text-secondary);
}

/* Mono stat */
.mono { font-family: var(--font-mono); font-feature-settings: "tnum"; }

/* Scrollbar */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-muted); background-clip: padding-box; border: 2px solid transparent; }

/* Screen switching */
.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; }

/* Utility */
.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-6 { gap: 24px; } .gap-8 { gap: 32px; }
.grow { flex: 1; }

/* Focus ring default */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulseDot { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

.animate-in { animation: slideUp 320ms cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.pulse-dot { animation: pulseDot 1.6s ease-in-out infinite; }
.spin { animation: spin 0.9s linear infinite; }


/* ============================================================
 * MOBILE RESPONSIVENESS LAYER
 *  - Forces inline-styled multi-column grids to single column
 *  - Wraps flex rows that were row-only
 *  - Tames padding and font sizes on small screens
 *  - Prevents horizontal overflow universally
 * ============================================================ */

/* Universal overflow guard for direct children of root that are wider than the viewport.
   These do NOT affect intentional horizontal scroll containers (which need overflow-x:auto). */
@media (max-width: 900px) {
  /* Multi-column grids → single column (catches inline repeat(2 .. 5, ...) ) */
  [style*="grid-template-columns: repeat(2"],
  [style*="grid-template-columns: repeat(3"],
  [style*="grid-template-columns: repeat(4"],
  [style*="grid-template-columns: repeat(5"],
  [style*="grid-template-columns: repeat(6"],
  [style*="gridTemplateColumns: repeat(2"],
  [style*="gridTemplateColumns: repeat(3"],
  [style*="gridTemplateColumns: repeat(4"],
  [style*="gridTemplateColumns: repeat(5"],
  [style*="gridTemplateColumns: repeat(6"] {
    grid-template-columns: 1fr !important;
  }

  /* Inline grids with explicit two-column shapes like "1fr 1fr", "1fr 1.2fr",
     "200px 1fr", "minmax(0, 1fr) minmax(0, 1.2fr)" — anything with a space and "fr" */
  [style*="grid-template-columns: 1fr 1"],
  [style*="grid-template-columns: minmax"],
  [style*="grid-template-columns: 200px"],
  [style*="grid-template-columns: 220px"],
  [style*="grid-template-columns: 240px"],
  [style*="grid-template-columns: 260px"],
  [style*="grid-template-columns: 280px"],
  [style*="grid-template-columns: 320px"],
  [style*="grid-template-columns: 360px"],
  [style*="grid-template-columns: 1.2fr"],
  [style*="grid-template-columns: 1.4fr"],
  [style*="grid-template-columns: 1.6fr"],
  [style*="grid-template-columns: 1.8fr"],
  [style*="grid-template-columns: 2fr"] {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  /* Section pads in console */
  main { padding-left: 0 !important; padding-right: 0 !important; }
}

/* ============ Marketing (mk-*) responsive overrides ============ */
@media (max-width: 760px) {
  .mk-section { padding: 56px 0 !important; }
  .mk-section-tight { padding: 40px 0 !important; }

  .mk-feature-grid,
  .mk-pricing-grid { grid-template-columns: 1fr !important; }

  .mk-logo-wall { grid-template-columns: repeat(3, 1fr) !important; gap: 16px !important; }

  .mk-stat-row { grid-template-columns: 1fr 1fr !important; }
  .mk-stat-row > div { padding: 18px 16px !important; }

  .mk-card { padding: 20px !important; }
  .mk-pricing-card { padding: 24px !important; }

  .mk-footer { padding: 48px 0 24px !important; margin-top: 56px !important; }
  .mk-footer-grid { grid-template-columns: 1fr 1fr !important; gap: 28px !important; margin-bottom: 32px !important; }
  .mk-footer-base { flex-direction: column; align-items: flex-start; gap: 12px; }
  .mk-footer-base > div { flex-wrap: wrap; gap: 14px !important; }

  /* Header */
  .mk-header-inner { gap: 12px !important; padding-left: 0 !important; padding-right: 0 !important; }
  .mk-header-inner > div { gap: 8px !important; }

  /* Display type */
  .mk-display { font-size: clamp(34px, 9vw, 48px) !important; }

  /* Tabs scroll horizontally instead of wrapping mid-text */
  .mk-tabs { max-width: 100%; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .mk-tabs button { white-space: nowrap; flex-shrink: 0; }

  /* Compare table scrolls horizontally on mobile (it's wrapped in .table-scroll)
     so every vendor column stays readable; min-width gives it a comfortable
     width, and overflow-wrap is a safety net for long single words. */
  .mk-compare-table { font-size: 12.5px; }
  .mk-compare-table th, .mk-compare-table td { padding: 10px 10px !important; overflow-wrap: anywhere; }
  .mk-card table.mk-compare-table { min-width: 720px; }

  /* Screenshot frames scale */
  .mk-screenshot-frame { padding: 6px !important; }

  /* Quotes */
  .mk-quote { font-size: clamp(18px, 4.5vw, 24px) !important; }

  /* Container padding tighter */
  .mk-container, .mk-container-narrow { padding: 0 16px !important; }
}

/* Very small phones */
@media (max-width: 480px) {
  .mk-footer-grid { grid-template-columns: 1fr !important; }
  .mk-stat-row { grid-template-columns: 1fr !important; }
  .mk-stat-row > div { border-right: 0 !important; border-bottom: 1px solid var(--border) !important; }
  .mk-stat-row > div:last-child { border-bottom: 0 !important; }
  .mk-logo-wall { grid-template-columns: repeat(2, 1fr) !important; }
}

/* ============ Console responsive ============ */

/* Horizontal scroll containers (must keep auto) */
.h-scroll, .table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

/* Horizontal-scroll affordance for a table card: a soft right-edge fade + a
   chevron that appear only while there's more to scroll. site.js (initTableScroll)
   toggles .can-scroll-right; the cue lives on the card (non-scrolling parent) so
   it stays pinned as the table scrolls, and never shows when the table fits. */
.mk-table-card { position: relative; }
.mk-table-card::after {
  content: "";
  position: absolute; top: 1px; right: 1px; bottom: 1px;
  width: 64px; border-radius: 0 var(--r-lg) var(--r-lg) 0;
  background: linear-gradient(to right, transparent, var(--surface) 78%);
  opacity: 0; transition: opacity 180ms ease;
  pointer-events: none; z-index: 1;
}
.mk-table-card::before {
  content: "";
  position: absolute; z-index: 2; top: 50%; right: 22px;
  width: 9px; height: 9px;
  border-top: 2px solid var(--text-muted);
  border-right: 2px solid var(--text-muted);
  transform: translateY(-50%) rotate(45deg);
  opacity: 0; transition: opacity 180ms ease;
  pointer-events: none;
}
.mk-table-card.can-scroll-right::after { opacity: 1; }
.mk-table-card.can-scroll-right::before { opacity: 0.85; }

/* Sidebar → off-canvas drawer below 900px */
@media (max-width: 900px) {
  .app-sidebar {
    position: fixed !important;
    inset: 0 auto 0 0 !important;
    z-index: 200 !important;
    transform: translateX(-100%);
    transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
    width: 280px !important;
    box-shadow: 8px 0 32px rgba(0,0,0,0.18);
  }
  .app-sidebar.is-open { transform: translateX(0); }
  .app-sidebar-scrim {
    position: fixed; inset: 0; z-index: 199;
    background: rgba(0,0,0,0.32);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
  }

  /* Top bar wraps better */
  .app-topbar { padding: 0 12px !important; gap: 8px !important; }
  .app-topbar .app-topbar-search { display: none !important; }
  .app-topbar .app-topbar-search-mobile { display: inline-flex !important; }

  /* Page padding */
  .page-pad { padding: 16px !important; }
  .page-pad-lg { padding: 18px 16px !important; }

  /* Page header */
  .page-header { padding: 14px 16px !important; flex-direction: column; align-items: flex-start; gap: 10px !important; }
  .page-header-actions { width: 100%; overflow-x: auto; flex-wrap: nowrap !important; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
  .page-header-actions .btn { flex-shrink: 0; }

  /* Drawer (subscriber) */
  .drawer {
    width: 100% !important;
    max-width: 100vw !important;
  }

  /* Auth split panes → single column */
  .auth-split { grid-template-columns: 1fr !important; min-height: auto !important; }
  .auth-split-right { display: none !important; }
  .auth-pane { padding: 28px 20px !important; }

  /* Onboarding wizard padding */
  .wizard-content { padding: 24px 16px !important; }
  .wizard-stepper { padding: 14px 16px !important; gap: 8px !important; flex-wrap: wrap; }
  .wizard-stepper > * { font-size: 11px; }

  /* Tables — make them scroll horizontally inside their card wrappers */
  table { font-size: 12.5px; }

  /* Buttons: reduce horizontal padding */
  .btn-xl { height: 44px !important; padding: 0 16px !important; font-size: 14px !important; }
  .btn-lg { height: 40px !important; padding: 0 14px !important; }

  /* Login & signup right pane testimonials hidden, left pane fills */
  .auth-decor { display: none !important; }

  /* Modal full width */
  .modal-shell { width: 100% !important; max-width: 100vw !important; height: 100vh !important; border-radius: 0 !important; }
}

@media (max-width: 480px) {
  /* Hide tenant-switcher labels in compact top bar */
  .app-topbar .topbar-label { display: none !important; }
  .auth-pane { padding: 20px 16px !important; }
}

/* Always: tables in cards become horizontally scrollable */
.card table, .mk-card table {
  display: block;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
.card thead, .card tbody, .card tr, .mk-card thead, .mk-card tbody, .mk-card tr { display: table; width: 100%; table-layout: auto; }

/* Page-level scroll containers (preserve in-page horizontal scroll when intentional) */
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
/* ============ Marketing site — overrides + components ============
   Loads AFTER styles.css so tokens cascade. Adds:
   - Editorial type scale (serif display optional)
   - Section primitives, big-type headers
   - Marketing-specific buttons, eyebrows, gradients
   - Header + footer chrome
============ */

:root {
  --max-w: 1200px;
  --max-w-narrow: 880px;
  --site-pad-x: 32px;
  --section-pad-y: 96px;

  --display: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;

  /* Editorial accent — soft warm grain on backgrounds */
  --bg-grain: radial-gradient(circle at 20% 10%,
    color-mix(in oklch, var(--accent) 7%, transparent), transparent 60%),
    radial-gradient(circle at 80% 90%,
      color-mix(in oklch, var(--accent) 5%, transparent), transparent 55%);

  --header-h: 64px;
}

@media (max-width: 760px) {
  :root {
    --site-pad-x: 20px;
    --section-pad-y: 64px;
  }
}

/* ===== Layout primitives ===== */
.mk-container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--site-pad-x);
  width: 100%;
  box-sizing: border-box;
}
.mk-container-narrow {
  max-width: var(--max-w-narrow);
  margin: 0 auto;
  padding: 0 var(--site-pad-x);
  width: 100%;
  box-sizing: border-box;
}
.mk-section {
  padding: var(--section-pad-y) 0;
  position: relative;
  overflow: hidden;
}
.mk-section-tight {
  padding: 56px 0;
  overflow: hidden;
}

/* ===== Type ===== */
.mk-eyebrow {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-fg);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.mk-eyebrow::before {
  content: "";
  width: 22px; height: 1px;
  background: var(--accent);
  display: inline-block;
}
.mk-display {
  font-family: var(--display);
  font-size: clamp(40px, 6vw, 72px);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.02;
  margin: 0;
  color: var(--text);
  text-wrap: balance;
}
.mk-h2 {
  font-family: var(--display);
  font-size: clamp(28px, 3.5vw, 44px);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin: 0;
  color: var(--text);
  text-wrap: balance;
}
.mk-h3 {
  font-size: clamp(20px, 2vw, 24px);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.2;
  margin: 0;
  color: var(--text);
}
.mk-lede {
  font-size: clamp(16px, 1.25vw, 19px);
  line-height: 1.55;
  color: var(--text-secondary);
  margin: 0;
  max-width: 56ch;
  text-wrap: pretty;
}
.mk-body {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-secondary);
  text-wrap: pretty;
}
.mk-mono-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* ===== Header ===== */
.mk-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 200ms ease, background 200ms ease;
}
.mk-header.is-scrolled {
  border-bottom-color: var(--border);
}
.mk-header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}
.mk-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.mk-nav-link {
  padding: 7px 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: 6px;
  transition: color 120ms ease, background 120ms ease;
  position: relative;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.mk-nav-link:hover { color: var(--text); background: var(--bg-muted); }
.mk-nav-link.is-active { color: var(--text); }
.mk-nav-link.is-active::after {
  content: ""; position: absolute; bottom: -22px;
  left: 12px; right: 12px; height: 2px;
  background: var(--accent);
  border-radius: 999px;
}

/* Mobile nav */
.mk-nav-mobile {
  display: none;
}
.mk-icon-btn {
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
  padding: 0;
}
.mk-icon-btn:hover { background: var(--bg-muted); }
.mk-nav-mobile-btn {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
}
@media (max-width: 900px) {
  .mk-nav { display: none; }
  .mk-nav-mobile { display: inline-flex; }
  .mk-hide-mobile { display: none !important; }
}

.mk-nav-scrim {
  position: fixed;
  inset: var(--header-h) 0 0 0;
  background: color-mix(in srgb, #000 35%, transparent);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 39;
  animation: mk-fade-in 180ms ease both;
}
.mk-nav-sheet {
  position: fixed;
  inset: var(--header-h) 0 auto 0;
  background: var(--surface);
  z-index: 40;
  padding: 16px var(--site-pad-x) 24px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 12px 32px rgba(0,0,0,0.12);
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: calc(100vh - var(--header-h));
  overflow-y: auto;
  animation: mk-slide-down 220ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.mk-nav-sheet a {
  padding: 14px 12px;
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
}
.mk-nav-sheet a:last-of-type { border-bottom: 0; }
.mk-nav-sheet-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.mk-nav-sheet-actions .btn { flex: 1; justify-content: center; }
@keyframes mk-slide-down { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes mk-fade-in    { from { opacity: 0; } to { opacity: 1; } }

/* ===== Footer ===== */
.mk-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
  padding: 64px 0 32px;
  margin-top: 80px;
}
.mk-footer-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(4, 1fr);
  gap: 48px;
  margin-bottom: 48px;
}
@media (max-width: 900px) {
  .mk-footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
}
.mk-footer h4 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin: 0 0 14px 0;
}
.mk-footer ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.mk-footer a {
  font-size: 14px;
  color: var(--text-secondary);
  transition: color 120ms ease;
}
.mk-footer a:hover { color: var(--text); }

.mk-footer-base {
  border-top: 1px solid var(--border);
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-muted);
}

/* ===== Cards & feature blocks ===== */
.mk-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 28px;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}
.mk-card-hover:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.mk-card-glass {
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}

.mk-feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
@media (max-width: 900px) {
  .mk-feature-grid { grid-template-columns: 1fr; }
}

/* Generic two-column split → single column on tablet and below.
   Reused by the hero, code/API section, and product feature splits. */
.mk-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 64px;
  align-items: center;
}
@media (max-width: 900px) {
  .mk-split { grid-template-columns: minmax(0, 1fr); gap: 40px; }
}

/* Hero card metric strip: 4-up with dividers on desktop, 2×2 on phones so
   no tile clips. minmax(0,1fr) lets tiles shrink instead of overflowing. */
.mk-hero-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
@media (max-width: 480px) {
  .mk-hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 16px; }
  .mk-hero-stats > div { padding-left: 0 !important; border-left: 0 !important; }
}

/* Recurring "copy + visual" feature row (product tabs, deliverability rows…):
   alternates sides on desktop, stacks copy-first on mobile. `display` is set
   here, but inline display still wins where product.js toggles panels. */
.mk-feature-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 56px;
  align-items: center;
}
.mk-feature-split.is-reversed { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
.mk-feature-split.is-even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; }
.mk-feature-split.is-wide { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
@media (max-width: 900px) {
  .mk-feature-split,
  .mk-feature-split.is-reversed,
  .mk-feature-split.is-even,
  .mk-feature-split.is-wide { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .mk-feature-split > * { order: 0 !important; } /* copy-first when stacked */
}

/* Generic: force any inline 2+col grid to one column on phones, keeping its
   desktop columns/gap/align inline. For one-off splits, card pairs, form rows. */
@media (max-width: 760px) {
  .mk-stack { grid-template-columns: 1fr !important; }
}

/* Screenshot mock: fixed height beside the copy on desktop (height stays inline
   since it varies per mock), natural height once the row stacks. */
@media (max-width: 900px) { .mk-mock { height: auto !important; } }

/* Auth pipeline: 5 steps in a row on desktop, 2-up then stacked on small
   screens; connector arrows hide once it's no longer a single row. */
.mk-auth-pipeline {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}
@media (max-width: 900px) {
  .mk-auth-pipeline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mk-pipeline-arrow { display: none; }
}
@media (max-width: 480px) {
  .mk-auth-pipeline { grid-template-columns: minmax(0, 1fr); }
}

/* Multi-card grid: 3-up desktop, 2-up tablet, 1-up phone. */
.mk-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 900px) { .mk-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .mk-card-grid { grid-template-columns: minmax(0, 1fr); } }

/* Featured case study: story + big stat side-by-side on desktop, stacked on
   mobile with the divider flipped to the top and the story padding tightened. */
.mk-featured-case {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 400px;
}
@media (max-width: 900px) {
  .mk-featured-case { grid-template-columns: 1fr; min-height: 0; }
  .mk-featured-case > div:first-child { padding: 36px 28px !important; }
  .mk-featured-case > div:last-child {
    border-left: 0 !important;
    border-top: 1px solid var(--border);
    padding: 40px 28px;
  }
}

/* Changelog timeline: date | dot-gutter | entry card on desktop; on phones the
   gutter + connecting line are dropped and the date sits above a full-width card. */
.mk-timeline-row {
  display: grid;
  grid-template-columns: 80px 24px 1fr;
  gap: 16px;
  margin-bottom: 36px;
  position: relative;
}
@media (max-width: 480px) {
  .mk-timeline-line { display: none; }
  .mk-timeline-row { grid-template-columns: 1fr; gap: 6px; margin-bottom: 24px; }
  .mk-timeline-row > div:nth-child(2) { display: none; }
  .mk-timeline-row > div:first-child { text-align: left !important; padding-top: 0 !important; }
}

.mk-feature-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

/* ===== Logo wall ===== */
.mk-logo-wall {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  align-items: center;
  padding: 24px 0;
  border-block: 1px solid var(--border);
}
@media (max-width: 900px) {
  .mk-logo-wall { grid-template-columns: repeat(3, 1fr); gap: 24px; }
}
.mk-logo-wall .mk-logo {
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: -0.015em;
  opacity: 0.75;
  transition: opacity 160ms ease, color 160ms ease;
  font-size: 16px;
}
.mk-logo-wall .mk-logo:hover { opacity: 1; color: var(--text); }

/* ===== Stat row ===== */
.mk-stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
}
.mk-stat-row > div {
  padding: 24px 28px;
  border-right: 1px solid var(--border);
}
.mk-stat-row > div:last-child { border-right: 0; }
@media (max-width: 760px) {
  .mk-stat-row { grid-template-columns: repeat(2, 1fr); }
  .mk-stat-row > div:nth-child(2) { border-right: 0; }
  .mk-stat-row > div:nth-child(1),
  .mk-stat-row > div:nth-child(2) { border-bottom: 1px solid var(--border); }
}

/* ===== Code blocks ===== */
.mk-code {
  background: oklch(0.18 0.01 240);
  color: oklch(0.92 0.01 240);
  border-radius: var(--r-md);
  padding: 18px 20px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.65;
  overflow: auto;
  border: 1px solid oklch(0.25 0.01 240);
}
html[data-theme="dark"] .mk-code { background: #0a0a0a; }
.mk-code .tk-key { color: oklch(0.78 0.13 60); }
.mk-code .tk-str { color: oklch(0.78 0.12 150); }
.mk-code .tk-comment { color: oklch(0.55 0.01 240); font-style: italic; }
.mk-code .tk-fn { color: oklch(0.78 0.14 230); }

/* ===== Blockquote / testimonial ===== */
.mk-quote {
  font-family: var(--display);
  font-size: clamp(22px, 2.4vw, 30px);
  font-weight: 500;
  letter-spacing: -0.018em;
  line-height: 1.32;
  color: var(--text);
  text-wrap: balance;
}
.mk-quote::before { content: "\201C"; color: var(--accent); margin-right: 4px; }
.mk-quote::after { content: "\201D"; color: var(--accent); margin-left: 4px; }

/* ===== Pill / badge variants for marketing ===== */
.mk-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}
.mk-pill .mk-pill-dot {
  width: 6px; height: 6px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--green) 25%, transparent);
}

/* ===== Hover-grow CTA ===== */
.mk-cta-row { display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.btn-xl { height: 48px; padding: 0 20px; font-size: 15px; font-weight: 500; border-radius: 8px; }

/* Final call-to-action banner (homepage): roomy on desktop, tighter on phones. */
.mk-cta-banner {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 72px 56px;
  background: linear-gradient(135deg, var(--accent-soft), var(--surface) 70%);
  text-align: center;
}
@media (max-width: 760px) {
  .mk-cta-banner { padding: 44px 20px; }
}

/* ===== Tab nav (for product page) ===== */
.mk-tabs {
  display: inline-flex;
  background: var(--bg-muted);
  padding: 4px;
  border-radius: 10px;
  gap: 2px;
}
.mk-tabs button {
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: 7px;
  transition: all 120ms ease;
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent; border: 0; cursor: pointer;
}
.mk-tabs button.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* ===== Pricing card ===== */
.mk-pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  align-items: stretch;
}
@media (max-width: 900px) { .mk-pricing-grid { grid-template-columns: 1fr; } }
.mk-pricing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
  position: relative;
}
.mk-pricing-card.is-featured {
  border-color: transparent;
  background: linear-gradient(180deg, var(--accent-soft), var(--surface));
  box-shadow: 0 0 0 1.5px var(--accent), var(--shadow-lg);
}
.mk-pricing-features { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.mk-pricing-features li {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 14px; color: var(--text-secondary);
}
.mk-pricing-features li svg { flex-shrink: 0; margin-top: 2px; color: var(--green); }

/* ===== Compare table ===== */
.mk-compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.mk-compare-table th,
.mk-compare-table td {
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.mk-compare-table th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  background: var(--bg-subtle);
}
.mk-compare-table .col-us {
  background: var(--accent-soft);
  position: relative;
}
/* The comparison table must stay a real, column-aligned table. The global
   ".mk-card table { display:block }" + ".mk-card tr { display:table }" rule
   (which makes wide data tables horizontally scrollable) otherwise gives every
   row its own auto width, so the columns stop lining up with the headers. */
.mk-card table.mk-compare-table {
  display: table;
  table-layout: fixed;
  width: 100%;
  white-space: normal;
  overflow: visible;
}
.mk-card .mk-compare-table thead { display: table-header-group; }
.mk-card .mk-compare-table tbody { display: table-row-group; width: auto; min-width: 0; }
.mk-card .mk-compare-table tr { display: table-row; width: auto; }

/* ===== Skeleton / placeholder ===== */
.mk-screenshot-frame {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 8px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
.mk-screenshot-frame::before {
  content: "";
  display: block;
  height: 24px;
  background: var(--bg-muted);
  border-radius: 4px 4px 0 0;
  margin: -8px -8px 8px;
  border-bottom: 1px solid var(--border);
}

/* Faux product-dashboard mock (homepage "Less spreadsheet" band): a decorative
   sidebar + content panel. At the marketing mobile breakpoint the decorative
   sidebar is dropped and the content fills the frame, so it never crushes. */
.mk-dash-mock {
  display: grid;
  grid-template-columns: 180px 1fr;
  height: 520px;
  background: var(--bg-subtle);
  border-radius: 6px;
  overflow: hidden;
}
@media (max-width: 760px) {
  .mk-dash-mock { grid-template-columns: minmax(0, 1fr); height: auto; }
  .mk-dash-mock-nav { display: none; }
}
/* Stat tiles inside the mock: 4-up on desktop, 2×2 on mobile so none clip. */
.mk-dash-mock-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
@media (max-width: 760px) {
  .mk-dash-mock-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ===== Animations ===== */
@keyframes mk-rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.mk-rise { animation: mk-rise 600ms cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.mk-rise-1 { animation-delay: 60ms; }
.mk-rise-2 { animation-delay: 120ms; }
.mk-rise-3 { animation-delay: 180ms; }
.mk-rise-4 { animation-delay: 240ms; }

@keyframes mk-pulse-line {
  0% { stroke-dashoffset: 800; }
  100% { stroke-dashoffset: 0; }
}

/* ===== Utilities ===== */
.mk-divider {
  height: 1px;
  background: var(--border);
  width: 100%;
}
.mk-tag-list { display: flex; gap: 8px; flex-wrap: wrap; }
.mk-bg-grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: var(--bg-grain);
  z-index: 0;
}
.mk-relative-z { position: relative; z-index: 1; }


/* ===== Mobile screenshot frame & code blocks ===== */
@media (max-width: 760px) {
  .mk-screenshot-frame { padding: 4px !important; border-radius: 10px !important; }
  .mk-screenshot-frame > * { max-width: 100%; }
  .mk-screenshot-frame [style*="height: 360px"],
  .mk-screenshot-frame [style*="height: 320px"],
  .mk-screenshot-frame [style*="height: 280px"] {
    height: auto !important;
    min-height: 280px;
  }
  .mk-screenshot-frame [style*="display: grid"] { gap: 8px !important; }
  .mk-screenshot-frame [style*="padding: 18px"] { padding: 12px !important; }
  .mk-screenshot-frame [style*="padding: 14px"] { padding: 10px !important; }
  .mk-code { padding: 14px !important; font-size: 11.5px !important; line-height: 1.55 !important; word-break: break-all; }

  /* SVG charts inside cards should be responsive */
  .mk-card svg, .mk-screenshot-frame svg { max-width: 100%; height: auto; }

  /* Hero device mockups & similar fixed widths */
  [style*="width: 380px"], [style*="width: 360px"], [style*="width: 320px"] {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Compare table stays a fixed-layout table on mobile — compact but aligned. */
  .mk-compare-table th, .mk-compare-table td { padding: 10px 12px !important; }
}

/* Make sure direct children of #root and main never overflow horizontally */
#root, #root > * { max-width: 100vw; }
main { overflow-x: clip; }

/* Marketing nav-sheet links should be solid + readable in BOTH themes */
.mk-nav-sheet { background: var(--surface) !important; color: var(--text); }
.mk-nav-sheet a { color: var(--text) !important; }
.mk-nav-sheet a:hover { background: var(--bg-subtle); }
