/* ============================================================================
   marketlens.css — Marketlens single global stylesheet
   ----------------------------------------------------------------------------
   Built ON TOP of the Huddle Design System tokens (colors/typography/spacing/
   radius/elevation) and component CSS (controls/display/navigation/overlay).
   This file holds ONLY Marketlens-specific additions that the base system
   does not yet ship — each block is annotated as a PROPOSED SYSTEM ADDITION
   where it extends Huddle. Implementable as one global CSS file + vanilla JS.
   ========================================================================== */

:root {
  /* --- Marketlens semantic additions (all derived from Huddle base tokens) --- */

  /* Draft-first content lifecycle. Draft = amber/neutral, Published = green. */
  --ml-draft:           var(--amber-500);
  --ml-draft-surface:   var(--amber-50);
  --ml-draft-border:    var(--amber-200);
  --ml-published:       var(--green-500);
  --ml-published-surface: var(--green-50);

  /* AI accent — stays inside the single-indigo palette, never a new hue.
     A soft indigo "chip" treatment distinguishes AI actions from primary. */
  --ml-ai-fg:      var(--indigo-700);
  --ml-ai-surface: var(--indigo-50);
  --ml-ai-surface-2: var(--indigo-100);
  --ml-ai-border:  var(--indigo-200);

  /* Relationship tokens (BI modules: Lookalike / Complementary / Alternative) */
  --ml-rel-look-fg: var(--blue-500);     --ml-rel-look-bg: var(--blue-50);
  --ml-rel-comp-fg: var(--green-500);    --ml-rel-comp-bg: var(--green-50);
  --ml-rel-alt-fg:  var(--amber-500);    --ml-rel-alt-bg:  var(--amber-50);

  /* Resizable sidebar runtime variable (set by JS drag handle) */
  --ml-sidebar-width: 264px;
}

/* ============================================================================
   APP SHELL  —  impersonation banner + shell scaffolding
   ========================================================================== */
.ml-shell { display: flex; min-height: 100vh; background: var(--bg-surface); }
.ml-shell__main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ml-shell__content { flex: 1; padding: var(--space-8); overflow-x: hidden; }
.ml-shell__content--flush { padding: 0; }

/* PROPOSED ADDITION: persistent "acting as tenant" banner, pinned above topbar */
.ml-impersonation {
  display: flex; align-items: center; gap: var(--space-3);
  background: var(--indigo-800); color: #fff;
  padding: 8px var(--space-6); font-size: var(--text-sm); font-weight: var(--weight-medium);
  position: sticky; top: 0; z-index: calc(var(--z-sticky) + 1);
}
.ml-impersonation svg { width: 16px; height: 16px; flex: 0 0 auto; }
.ml-impersonation strong { font-weight: var(--weight-bold); }
.ml-impersonation__spacer { flex: 1; }
.ml-impersonation__exit {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.28);
  border-radius: var(--radius-md); padding: 4px 12px; font-size: var(--text-sm);
  font-weight: var(--weight-semibold); cursor: pointer; transition: background-color .12s ease;
}
.ml-impersonation__exit:hover { background: rgba(255,255,255,.24); }

/* ============================================================================
   SIDEBAR  —  Marketlens extensions to hds-sidebar
   (site-context pill at top, account block at bottom, drag-resize handle)
   ========================================================================== */
.ml-sidebar:not(.hds-sidebar--collapsed) { width: var(--ml-sidebar-width); position: relative; }
.ml-sidebar.hds-sidebar--collapsed { position: relative; }

/* Brand lockup row (replaces hds default brand) */
.ml-brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; text-decoration: none; }
.ml-brand__mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--primary);
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.ml-brand__mark svg { width: 18px; height: 18px; color: #fff; }
.ml-brand__name { font-weight: 700; font-size: 17px; letter-spacing: -0.02em; color: var(--text-primary); white-space: nowrap; }
.ml-brand__by { font-size: 10px; color: var(--text-disabled); font-weight: var(--weight-medium); letter-spacing: .02em; }

/* PROPOSED ADDITION: site-context pill — which network edition you're operating on */
.ml-sitepill {
  margin: var(--space-3) var(--space-3) 0;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-md);
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  cursor: pointer; transition: background-color .12s ease, border-color .12s ease; text-align: left;
}
.ml-sitepill:hover { background: var(--bg-hover); border-color: var(--border-default); }
.ml-sitepill__flag {
  width: 26px; height: 26px; border-radius: 6px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; line-height: 1; background: var(--gray-100);
}
.ml-sitepill__meta { min-width: 0; flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
.ml-sitepill__name { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ml-sitepill__url  { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ml-sitepill > svg { width: 16px; height: 16px; color: var(--text-muted); flex: 0 0 auto; }

/* Nav badge tones (over base hds-navitem__badge) */
.hds-navitem__badge.ml-badge-amber { background: var(--amber-100); color: var(--amber-600); }

/* Account block (sidebar footer slot) */
.ml-account { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: var(--radius-md); cursor: pointer; transition: background-color .12s ease; }
.ml-account:hover { background: var(--bg-hover); }
.ml-account__meta { min-width: 0; flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
.ml-account__name { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ml-account__email { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ml-account > svg { width: 16px; height: 16px; color: var(--text-muted); flex: 0 0 auto; }
.ml-account-foot {
  margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border-subtle);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.ml-foundations-link {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: var(--weight-semibold);
  color: var(--text-muted); background: none; border: none; cursor: pointer; padding: 4px 6px; border-radius: 6px;
}
.ml-foundations-link:hover { color: var(--primary); background: var(--primary-tint); }
.ml-foundations-link svg { width: 13px; height: 13px; }

/* PROPOSED ADDITION: drag handle to resize sidebar (260–340px) */
.ml-resize-handle {
  position: absolute; top: 0; right: -3px; width: 6px; height: 100%;
  cursor: col-resize; z-index: 5;
}
.ml-resize-handle::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 3px; width: 1px; background: transparent; transition: background-color .12s ease;
}
.ml-resize-handle:hover::after, .ml-resize-handle--dragging::after { background: var(--primary); }

/* Collapsed rail: hide site pill text + account text */
.hds-sidebar--collapsed .ml-sitepill { justify-content: center; padding: 8px; }
.hds-sidebar--collapsed .ml-sitepill__meta,
.hds-sidebar--collapsed .ml-sitepill > svg,
.hds-sidebar--collapsed .ml-account__meta,
.hds-sidebar--collapsed .ml-account > svg,
.hds-sidebar--collapsed .ml-account-foot,
.hds-sidebar--collapsed .ml-brand__name,
.hds-sidebar--collapsed .ml-brand__by { display: none; }
.hds-sidebar--collapsed .ml-resize-handle { display: none; }

/* nicer thin scrollbar for the nav */
.hds-sidebar__nav { scrollbar-width: thin; scrollbar-color: var(--gray-300) transparent; }
.hds-sidebar__nav::-webkit-scrollbar { width: 8px; }
.hds-sidebar__nav::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 999px; border: 2px solid var(--bg-card); }
.hds-sidebar__nav:hover::-webkit-scrollbar-thumb { background: var(--gray-300); }

/* ============================================================================
   TOP BAR  —  Marketlens extensions to hds-topbar
   (site switcher, AI model badge, account menu, collapse toggle)
   ========================================================================== */
.ml-topbar__collapse { margin-right: -4px; }

/* Site switcher button (reuses hds-topbar__ws shape, adds a flag + sub-label) */
.ml-siteswitch { display: inline-flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: var(--radius-md); cursor: pointer; background: transparent; border: 1px solid transparent; transition: background-color .12s ease; max-width: 280px; }
.ml-siteswitch:hover { background: var(--bg-hover); }
.ml-siteswitch__flag { width: 24px; height: 24px; border-radius: 6px; background: var(--gray-100); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; flex: 0 0 auto; }
.ml-siteswitch__meta { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; text-align: left; }
.ml-siteswitch__name { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text-primary); white-space: nowrap; }
.ml-siteswitch__sub { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.ml-siteswitch > svg { width: 16px; height: 16px; color: var(--text-muted); }

/* PROPOSED ADDITION: AI model badge — current Anthropic model in use */
.ml-aibadge {
  display: inline-flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 10px 0 9px; border-radius: var(--radius-pill);
  background: var(--ml-ai-surface); border: 1px solid var(--ml-ai-border);
  color: var(--ml-ai-fg); font-size: var(--text-xs); font-weight: var(--weight-semibold); cursor: pointer;
  transition: background-color .12s ease;
}
.ml-aibadge:hover { background: var(--ml-ai-surface-2); }
.ml-aibadge svg { width: 14px; height: 14px; }
.ml-aibadge__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green-500); }

/* ============================================================================
   AI-ACCENT BUTTON  —  PROPOSED ADDITION to the button family
   (soft indigo chip; pairs with the sparkles icon for every AI action)
   ========================================================================== */
.hds-btn--ai { background: var(--ml-ai-surface); color: var(--ml-ai-fg); border-color: var(--ml-ai-border); }
.hds-btn--ai:hover:not(:disabled) { background: var(--ml-ai-surface-2); }
.hds-btn--ai:active:not(:disabled) { background: var(--indigo-200); }
.hds-btn--ai svg { color: var(--indigo-600); }

/* ============================================================================
   DROPDOWN MENU  —  shared popover for site switcher / account / AI badge
   PROPOSED ADDITION (Huddle ships Dialog/Drawer but no lightweight menu)
   ========================================================================== */
.ml-menu {
  position: absolute; min-width: 240px; background: var(--bg-card);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md); padding: 6px; z-index: var(--z-sticky);
  animation: ml-pop .14s cubic-bezier(.16,.84,.44,1);
}
.ml-menu__label { font-size: 11px; font-weight: var(--weight-semibold); letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--text-disabled); padding: 8px 10px 4px; }
.ml-menu__item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border-radius: var(--radius-sm); background: none; border: none;
  cursor: pointer; font-size: var(--text-sm); color: var(--text-secondary); text-align: left; font-family: var(--font-sans);
}
.ml-menu__item:hover { background: var(--bg-hover); color: var(--text-primary); }
.ml-menu__item--active { background: var(--primary-tint); color: var(--indigo-700); }
.ml-menu__item svg { width: 16px; height: 16px; flex: 0 0 auto; color: var(--text-muted); }
.ml-menu__item--active svg { color: var(--primary); }
.ml-menu__item--danger { color: var(--danger); }
.ml-menu__item--danger svg { color: var(--danger); }
.ml-menu__check { margin-left: auto; color: var(--primary); display: inline-flex; }
.ml-menu__sep { height: 1px; background: var(--border-subtle); margin: 6px 4px; }
.ml-menu__item-meta { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.ml-menu__item-meta small { font-size: 11px; color: var(--text-muted); }

@keyframes ml-pop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

/* lightweight click-away scrim for menus */
.ml-scrim { position: fixed; inset: 0; z-index: calc(var(--z-sticky) - 1); }

/* ============================================================================
   LIST-HEADER PATTERN  —  page title + right-aligned actions, optional subtitle
   ========================================================================== */
.ml-pagehead { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-6); margin-bottom: var(--space-5); }
.ml-pagehead__titles { min-width: 0; }
.ml-pagehead__title { margin: 0; font-size: var(--text-xl); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-snug); color: var(--text-primary); display: flex; align-items: center; gap: 10px; }
.ml-pagehead__sub { margin: 6px 0 0; font-size: var(--text-sm); color: var(--text-muted); max-width: 64ch; }
.ml-pagehead__actions { display: flex; align-items: center; gap: var(--space-2); flex: 0 0 auto; }

/* draft-first global notice strip used above editor / content surfaces */
.ml-draftnotice {
  display: inline-flex; align-items: center; gap: 8px; font-size: var(--text-xs); font-weight: var(--weight-medium);
  color: var(--amber-600); background: var(--ml-draft-surface); border: 1px solid var(--ml-draft-border);
  padding: 4px 10px; border-radius: var(--radius-pill);
}
.ml-draftnotice svg { width: 14px; height: 14px; }

/* ============================================================================
   STATUS / RELATIONSHIP TOKENS (badges) — extend hds-badge
   ========================================================================== */
.hds-badge--draft { background: var(--ml-draft-surface); color: var(--amber-600); }
.hds-badge--ai { background: var(--ml-ai-surface); color: var(--ml-ai-fg); }
.hds-badge--rel-look { background: var(--ml-rel-look-bg); color: var(--ml-rel-look-fg); }
.hds-badge--rel-comp { background: var(--ml-rel-comp-bg); color: var(--ml-rel-comp-fg); }
.hds-badge--rel-alt  { background: var(--ml-rel-alt-bg);  color: var(--ml-rel-alt-fg); }

/* a tiny ★ ours marker */
.ml-ours { display: inline-flex; align-items: center; gap: 4px; color: var(--indigo-600); font-weight: var(--weight-semibold); font-size: var(--text-xs); }
.ml-ours svg { width: 13px; height: 13px; fill: currentColor; }

/* ============================================================================
   DATA TABLE EXTENSIONS  (selectable rows, row actions, toolbar)
   ========================================================================== */
.ml-table-toolbar { display: flex; align-items: center; gap: var(--space-3); padding: 10px var(--space-4); border-bottom: 1px solid var(--border-subtle); background: var(--bg-card); }
.ml-table-toolbar--bulk { background: var(--primary-tint); color: var(--indigo-700); }
.ml-table-search { max-width: 280px; flex: 1; }
.hds-table tbody tr.ml-row--draft td:first-child { box-shadow: inset 3px 0 0 var(--ml-draft); }
.hds-table td .ml-rowtitle { color: var(--text-primary); font-weight: var(--weight-medium); }
.hds-table td .ml-rowsub { color: var(--text-muted); font-size: var(--text-xs); }
.ml-rowactions { display: flex; align-items: center; gap: 2px; justify-content: flex-end; opacity: 0; transition: opacity .1s ease; }
.hds-table tbody tr:hover .ml-rowactions { opacity: 1; }
.ml-checkcell { width: 40px; }
.ml-th-check { width: 40px; }

/* pagination footer */
.ml-pagination { display: flex; align-items: center; justify-content: space-between; padding: 12px var(--space-4); border-top: 1px solid var(--border-subtle); font-size: var(--text-sm); color: var(--text-muted); }
.ml-pagination__pages { display: flex; align-items: center; gap: 4px; }

/* ============================================================================
   FOUNDATIONS / DOC reading layout (used by the Foundations reference screen)
   ========================================================================== */
.ml-doc { max-width: 1040px; margin: 0 auto; }
.ml-doc__eyebrow { font-size: var(--text-xs); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--primary); }
.ml-doc__h1 { margin: 8px 0 6px; font-size: var(--text-2xl); font-weight: var(--weight-bold); letter-spacing: var(--tracking-tight); color: var(--text-primary); }
.ml-doc__lede { margin: 0 0 var(--space-8); font-size: var(--text-md); color: var(--text-secondary); max-width: 70ch; line-height: var(--leading-md); }
.ml-doc__section { margin-bottom: var(--space-10); }
.ml-doc__section > h2 { font-size: var(--text-lg); font-weight: var(--weight-semibold); color: var(--text-primary); margin: 0 0 4px; }
.ml-doc__section > p.ml-doc__note { font-size: var(--text-sm); color: var(--text-muted); margin: 0 0 var(--space-5); max-width: 70ch; }

.ml-swatchgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--space-3); }
.ml-swatch { border: 1px solid var(--border-subtle); border-radius: var(--radius-md); overflow: hidden; background: var(--bg-card); box-shadow: var(--shadow-xs); }
.ml-swatch__chip { height: 56px; }
.ml-swatch__meta { padding: 8px 10px; }
.ml-swatch__name { font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--text-primary); }
.ml-swatch__val { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }

.ml-typerow { display: flex; align-items: baseline; gap: var(--space-5); padding: 14px 0; border-bottom: 1px solid var(--border-subtle); }
.ml-typerow:last-child { border-bottom: none; }
.ml-typerow__meta { width: 150px; flex: 0 0 auto; font-size: var(--text-xs); color: var(--text-muted); font-family: var(--font-mono); }
.ml-typerow__sample { color: var(--text-primary); }

.ml-tokenrow { display: flex; align-items: center; gap: var(--space-4); padding: 10px 0; border-bottom: 1px solid var(--border-subtle); }
.ml-tokenrow:last-child { border-bottom: none; }
.ml-tokenrow__bar { background: var(--primary-tint); border-radius: 4px; height: 16px; flex: 0 0 auto; }
.ml-tokenrow__name { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-secondary); width: 130px; flex: 0 0 auto; }
.ml-tokenrow__val { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-muted); }

.ml-elevrow { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: var(--space-5); }
.ml-elevtile { height: 90px; border-radius: var(--radius-lg); background: var(--bg-card); border: 1px solid var(--border-subtle); display: flex; align-items: flex-end; justify-content: center; padding-bottom: 10px; font-size: 11px; font-family: var(--font-mono); color: var(--text-muted); }

/* ============================================================================
   NAV STATE MODEL reference (documentation of every nav-item state)
   ========================================================================== */
.ml-stategrid { display: grid; grid-template-columns: 132px 1fr; gap: var(--space-3) var(--space-5); align-items: center; }
.ml-stategrid__label { font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--text-muted); font-family: var(--font-mono); }
.ml-statebox { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 8px; max-width: 240px; }
/* forced state previews (so we can show hover/focus statically) */
.hds-navitem.is-hover { background: var(--bg-hover); color: var(--text-primary); }
.hds-navitem.is-hover svg { color: var(--text-secondary); }
.hds-navitem.is-focus { box-shadow: var(--focus-ring); }
.hds-navitem.is-disabled { opacity: .45; pointer-events: none; }

/* ============================================================================
   GENERIC "designing next" placeholder for screens not yet built this stage
   ========================================================================== */
.ml-stub { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: 420px; gap: var(--space-4); border: 1px dashed var(--border-default); border-radius: var(--radius-lg); background: var(--bg-card); padding: var(--space-10); }
.ml-stub__icon { width: 56px; height: 56px; border-radius: var(--radius-lg); background: var(--primary-tint); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; }
.ml-stub__icon svg { width: 26px; height: 26px; }
.ml-stub__title { font-size: var(--text-lg); font-weight: var(--weight-semibold); color: var(--text-primary); }
.ml-stub__sub { font-size: var(--text-sm); color: var(--text-muted); max-width: 44ch; }
.ml-stub__stage { font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--primary); background: var(--primary-tint); padding: 3px 10px; border-radius: var(--radius-pill); }

/* ============================================================================
   RESPONSIVE  —  tablet & mobile (operator tool is desktop-first;
   shell collapses the sidebar off-canvas below 960px)
   ========================================================================== */
.ml-scrim-mobile { display: none; }

@media (max-width: 1100px) {
  .ml-shell__content { padding: var(--space-6); }
}

@media (max-width: 960px) {
  .ml-sidebar {
    position: fixed; left: 0; top: 0; height: 100vh; z-index: var(--z-drawer);
    transform: translateX(-100%); transition: transform .2s cubic-bezier(.16,.84,.44,1);
    box-shadow: var(--shadow-xl);
  }
  .ml-sidebar.ml-sidebar--open { transform: translateX(0); }
  .ml-resize-handle { display: none; }
  .ml-scrim-mobile { display: block; position: fixed; inset: 0; background: rgba(16,24,40,.5); z-index: calc(var(--z-drawer) - 1); }
  .ml-topbar__collapse { display: inline-flex !important; }
}

@media (max-width: 720px) {
  .ml-shell__content { padding: var(--space-4); }
  .ml-pagehead { flex-direction: column; align-items: stretch; }
  .ml-pagehead__actions { flex-wrap: wrap; }
  .ml-siteswitch__meta { display: none; }
  .ml-aibadge span.ml-aibadge__text { display: none; }
  .ml-topbar-search-hide { display: none !important; }
}

/* ============================================================================
   COMPONENT LIBRARY primitives (Stage 2) — all derived from Huddle tokens
   ========================================================================== */

/* ---- Spinner (PROPOSED ADDITION) ---- */
.ml-spinner {
  display: inline-block; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--gray-200); border-top-color: var(--primary);
  animation: ml-spin .7s linear infinite; vertical-align: -3px;
}
.ml-spinner--sm { width: 14px; height: 14px; border-width: 2px; }
.ml-spinner--lg { width: 28px; height: 28px; border-width: 3px; }
.ml-spinner--on-primary { border-color: rgba(255,255,255,.4); border-top-color: #fff; }
.ml-spinner--ai { border-color: var(--indigo-100); border-top-color: var(--indigo-600); }
@keyframes ml-spin { to { transform: rotate(360deg); } }

/* ---- Progress bar (PROPOSED ADDITION) ---- */
.ml-progress { height: 8px; border-radius: var(--radius-pill); background: var(--gray-100); overflow: hidden; width: 100%; }
.ml-progress__bar { height: 100%; border-radius: inherit; background: var(--primary); transition: width .3s cubic-bezier(.16,.84,.44,1); }
.ml-progress__bar--ai { background: var(--indigo-500); }
.ml-progress__bar--success { background: var(--success); }
.ml-progress--indeterminate .ml-progress__bar { width: 40% !important; animation: ml-indet 1.2s ease-in-out infinite; }
@keyframes ml-indet { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }
.ml-progress-row { display: flex; align-items: center; gap: 12px; }
.ml-progress-row__pct { font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--text-secondary); font-variant-numeric: tabular-nums; width: 38px; text-align: right; }

/* ---- Drag-drop upload zone (PROPOSED ADDITION) ---- */
.ml-dropzone {
  border: 1.5px dashed var(--border-default); border-radius: var(--radius-lg);
  background: var(--bg-subtle); padding: var(--space-10) var(--space-6);
  display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
  cursor: pointer; transition: border-color .12s ease, background-color .12s ease;
}
.ml-dropzone:hover { border-color: var(--border-strong); background: var(--gray-100); }
.ml-dropzone--active { border-color: var(--primary); background: var(--primary-tint); }
.ml-dropzone__icon { width: 44px; height: 44px; border-radius: var(--radius-lg); background: var(--bg-card); border: 1px solid var(--border-subtle); display: inline-flex; align-items: center; justify-content: center; color: var(--primary); }
.ml-dropzone__title { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text-primary); }
.ml-dropzone__title b { color: var(--primary); }
.ml-dropzone__hint { font-size: var(--text-xs); color: var(--text-muted); }

/* ---- SEO score gauge (PROPOSED ADDITION) ---- */
.ml-gauge { display: inline-flex; flex-direction: column; align-items: center; gap: 8px; }
.ml-gauge__ring { position: relative; }
.ml-gauge__num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ml-gauge__val { font-size: var(--text-xl); font-weight: var(--weight-bold); letter-spacing: var(--tracking-tight); color: var(--text-primary); line-height: 1; font-variant-numeric: tabular-nums; }
.ml-gauge__max { font-size: 10px; color: var(--text-muted); margin-top: 2px; }
.ml-gauge__label { font-size: var(--text-xs); font-weight: var(--weight-semibold); }

/* ---- Selectable chips (PROPOSED ADDITION) ---- */
.ml-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px;
  border-radius: var(--radius-pill); border: 1px solid var(--border-default); background: var(--bg-card);
  color: var(--text-secondary); font-size: var(--text-sm); font-weight: var(--weight-medium); cursor: pointer;
  transition: background-color .12s ease, border-color .12s ease, color .12s ease;
}
.ml-chip:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.ml-chip svg { width: 14px; height: 14px; }
.ml-chip--selected { background: var(--primary-tint); border-color: var(--indigo-200); color: var(--indigo-700); }
.ml-chip--selected svg { color: var(--indigo-600); }
.ml-chip--ai.ml-chip--selected { background: var(--ml-ai-surface); border-color: var(--ml-ai-border); color: var(--ml-ai-fg); }
.ml-chip__x { display: inline-flex; margin-right: -4px; color: var(--text-muted); border-radius: 4px; }
.ml-chip__x:hover { color: var(--text-primary); }
.ml-chipset { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---- Chat bubbles + typing (PROPOSED ADDITION) ---- */
.ml-chat { display: flex; flex-direction: column; gap: 14px; }
.ml-msg { display: flex; gap: 10px; max-width: 80%; }
.ml-msg--user { align-self: flex-end; flex-direction: row-reverse; }
.ml-msg__avatar { width: 28px; height: 28px; border-radius: 50%; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; }
.ml-msg__avatar--ai { background: var(--ml-ai-surface); color: var(--ml-ai-fg); }
.ml-msg__avatar--user { background: var(--primary-tint); color: var(--indigo-700); font-size: 11px; font-weight: var(--weight-semibold); }
.ml-bubble { padding: 10px 14px; border-radius: var(--radius-lg); font-size: var(--text-sm); line-height: var(--leading-md); }
.ml-bubble--ai { background: var(--bg-card); border: 1px solid var(--border-subtle); color: var(--text-primary); border-top-left-radius: 4px; }
.ml-bubble--user { background: var(--primary); color: #fff; border-top-right-radius: 4px; }
.ml-typing { display: inline-flex; gap: 4px; align-items: center; padding: 12px 14px; }
.ml-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--gray-400); animation: ml-blink 1.2s infinite both; }
.ml-typing span:nth-child(2) { animation-delay: .2s; }
.ml-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes ml-blink { 0%, 60%, 100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
.ml-composer { display: flex; align-items: flex-end; gap: 8px; border: 1px solid var(--border-default); border-radius: var(--radius-lg); background: var(--bg-card); box-shadow: var(--shadow-xs); padding: 8px; }
.ml-composer textarea { flex: 1; border: none; outline: none; resize: none; font-family: var(--font-sans); font-size: var(--text-sm); color: var(--text-primary); background: none; min-height: 22px; max-height: 120px; line-height: var(--leading-sm); padding: 6px; }
.ml-composer__ctx { display: flex; gap: 6px; padding: 0 4px 8px; flex-wrap: wrap; }

/* ---- Lifecycle stat cards (clickable) (PROPOSED ADDITION) ---- */
.ml-lifecard {
  text-align: left; cursor: pointer; background: var(--bg-card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); padding: var(--space-4) var(--space-5);
  display: flex; flex-direction: column; gap: 6px; transition: border-color .12s ease, box-shadow .12s ease, background-color .12s ease; position: relative;
}
.ml-lifecard:hover { border-color: var(--border-default); box-shadow: var(--shadow-sm); }
.ml-lifecard--selected { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.ml-lifecard__top { display: flex; align-items: center; gap: 8px; }
.ml-lifecard__dot { width: 8px; height: 8px; border-radius: 50%; }
.ml-lifecard__label { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--text-muted); }
.ml-lifecard__value { font-size: var(--text-2xl); font-weight: var(--weight-bold); letter-spacing: var(--tracking-tight); color: var(--text-primary); line-height: 1; font-variant-numeric: tabular-nums; }

/* ---- Step indicator (multi-step destructive delete flow) ---- */
.ml-steps { display: flex; align-items: center; gap: 0; margin-bottom: var(--space-5); }
.ml-step { display: flex; align-items: center; gap: 8px; flex: 1; }
.ml-step__dot { width: 24px; height: 24px; border-radius: 50%; background: var(--gray-100); color: var(--text-muted); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: var(--weight-bold); flex: 0 0 auto; border: 1px solid var(--border-subtle); }
.ml-step__name { font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--text-muted); white-space: nowrap; }
.ml-step__line { flex: 1; height: 1px; background: var(--border-subtle); margin: 0 8px; }
.ml-step--active .ml-step__dot { background: var(--primary); color: #fff; border-color: var(--primary); }
.ml-step--active .ml-step__name { color: var(--text-primary); }
.ml-step--done .ml-step__dot { background: var(--primary-tint); color: var(--indigo-700); border-color: var(--indigo-200); }
.ml-step--danger.ml-step--active .ml-step__dot { background: var(--danger); border-color: var(--danger); }

/* type-to-confirm input echo */
.ml-confirm-strong { font-weight: var(--weight-bold); color: var(--danger); font-family: var(--font-mono); }

/* ---- Long-form prose / legal reading layout ---- */
.ml-prose { max-width: 72ch; color: var(--text-secondary); font-size: var(--text-md); line-height: 1.7; }
.ml-prose h2 { font-size: var(--text-xl); font-weight: var(--weight-semibold); color: var(--text-primary); letter-spacing: var(--tracking-snug); margin: 2em 0 .5em; }
.ml-prose h3 { font-size: var(--text-lg); font-weight: var(--weight-semibold); color: var(--text-primary); margin: 1.6em 0 .4em; }
.ml-prose p { margin: 0 0 1em; }
.ml-prose ul, .ml-prose ol { margin: 0 0 1em; padding-left: 1.4em; }
.ml-prose li { margin-bottom: .4em; }
.ml-prose a { color: var(--text-link); text-decoration: underline; text-underline-offset: 2px; }
.ml-prose code { font-family: var(--font-mono); font-size: .85em; background: var(--gray-100); padding: 2px 6px; border-radius: var(--radius-xs); color: var(--text-primary); }
.ml-prose blockquote { margin: 1.2em 0; padding: 4px 0 4px 16px; border-left: 3px solid var(--border-default); color: var(--text-muted); }
.ml-legal { display: grid; grid-template-columns: 220px 1fr; gap: var(--space-10); align-items: start; }
.ml-legal__toc { position: sticky; top: 88px; display: flex; flex-direction: column; gap: 2px; }
.ml-legal__toc a { font-size: var(--text-sm); color: var(--text-muted); text-decoration: none; padding: 6px 10px; border-radius: var(--radius-sm); }
.ml-legal__toc a:hover { background: var(--bg-hover); color: var(--text-primary); }
.ml-legal__toc a.is-active { background: var(--primary-tint); color: var(--indigo-700); font-weight: var(--weight-semibold); }
.ml-legal__updated { font-size: var(--text-xs); color: var(--text-muted); margin-bottom: var(--space-6); }
@media (max-width: 860px) { .ml-legal { grid-template-columns: 1fr; } .ml-legal__toc { position: static; flex-direction: row; flex-wrap: wrap; } }

/* ---- Component gallery layout (the Components reference screen) ---- */
.ml-gallery { display: flex; flex-direction: column; gap: var(--space-10); }
.ml-spec { }
.ml-spec__head { margin-bottom: var(--space-4); }
.ml-spec__title { font-size: var(--text-lg); font-weight: var(--weight-semibold); color: var(--text-primary); display: flex; align-items: center; gap: 8px; }
.ml-spec__note { font-size: var(--text-sm); color: var(--text-muted); margin: 4px 0 0; max-width: 72ch; }
.ml-spec__demo { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); padding: var(--space-6); }
.ml-spec__demo--plain { background: var(--bg-surface); border-style: dashed; }
.ml-specrow { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-4); }
.ml-specrow + .ml-specrow { margin-top: var(--space-5); padding-top: var(--space-5); border-top: 1px solid var(--border-subtle); }
.ml-specgrid { display: grid; gap: var(--space-4); }
.ml-statelabel { font-size: 11px; font-weight: var(--weight-semibold); letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--text-disabled); margin-bottom: 10px; }
.ml-speccol { display: flex; flex-direction: column; gap: 12px; min-width: 140px; }
.ml-addbadge { font-size: 10px; font-weight: var(--weight-bold); letter-spacing: .04em; text-transform: uppercase; color: var(--indigo-700); background: var(--primary-tint); border: 1px solid var(--indigo-100); padding: 2px 7px; border-radius: var(--radius-pill); }

/* warning toast icon color (DS ships only success/danger/info) */
.hds-toast--warning .hds-toast__icon { color: var(--warning); }

/* SEO tips list (used beside the gauge) */
.ml-tips { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.ml-tips li { display: flex; align-items: flex-start; gap: 8px; font-size: var(--text-sm); color: var(--text-secondary); }
.ml-tips li svg { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 2px; }
.ml-tips li.is-ok svg { color: var(--success); }
.ml-tips li.is-warn svg { color: var(--warning); }
.ml-tips li.is-bad svg { color: var(--danger); }

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  .ml-menu, .ml-sidebar { animation: none !important; transition: none !important; }
  .ml-spinner, .ml-typing span, .ml-progress--indeterminate .ml-progress__bar { animation: none !important; }
}

/* ============================================================================
   AUTH & ONBOARDING (Stage 3) — pre-auth full-screen surfaces
   Centered card on the gray field (Huddle's calm aesthetic); wizard is a
   split rail + panel. Responsive down to mobile.
   ========================================================================== */
.ml-auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg-surface); padding: 48px 20px; }
.ml-auth__card { width: 100%; max-width: 424px; background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-xl); box-shadow: var(--shadow-sm); padding: 36px 32px; }
.ml-auth__card--wide { max-width: 560px; }
.ml-auth__brand { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 26px; }
.ml-auth__brand .ml-brand__name { font-size: 19px; }
.ml-auth__statusicon { width: 52px; height: 52px; border-radius: var(--radius-pill); display: inline-flex; align-items: center; justify-content: center; margin: 0 auto 18px; }
.ml-auth__statusicon svg { width: 26px; height: 26px; }
.ml-auth__statusicon--success { background: var(--success-surface); color: var(--success); }
.ml-auth__statusicon--danger { background: var(--danger-surface); color: var(--danger); }
.ml-auth__statusicon--warning { background: var(--warning-surface); color: var(--warning); }
.ml-auth__statusicon--primary { background: var(--primary-tint); color: var(--primary); }
.ml-auth__title { font-size: var(--text-xl); font-weight: var(--weight-bold); letter-spacing: var(--tracking-tight); color: var(--text-primary); text-align: center; margin: 0; }
.ml-auth__sub { font-size: var(--text-sm); color: var(--text-muted); text-align: center; margin: 8px 0 26px; line-height: var(--leading-md); }
.ml-auth__sub strong { color: var(--text-secondary); }
.ml-auth__form { display: flex; flex-direction: column; gap: 16px; }
.ml-auth__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ml-auth__link { color: var(--text-link); font-weight: var(--weight-semibold); text-decoration: none; font-size: var(--text-sm); cursor: pointer; }
.ml-auth__link:hover { text-decoration: underline; }
.ml-auth__foot { text-align: center; font-size: var(--text-sm); color: var(--text-muted); margin-top: 22px; }
.ml-auth__legal { text-align: center; font-size: var(--text-xs); color: var(--text-disabled); margin-top: 18px; line-height: 1.6; }
.ml-auth__legal a { color: var(--text-muted); text-decoration: underline; }
.ml-auth__divider { display: flex; align-items: center; gap: 12px; color: var(--text-disabled); font-size: var(--text-xs); margin: 4px 0; }
.ml-auth__divider::before, .ml-auth__divider::after { content: ""; flex: 1; height: 1px; background: var(--border-subtle); }

/* segmented OTP / TOTP code input */
.ml-otp { display: flex; gap: 10px; justify-content: center; }
.ml-otp input {
  width: 46px; height: 54px; text-align: center; font-size: var(--text-xl); font-weight: var(--weight-semibold);
  border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--bg-card);
  box-shadow: var(--shadow-xs); color: var(--text-primary); font-variant-numeric: tabular-nums;
}
.ml-otp input:focus { outline: none; border-color: var(--border-focus); box-shadow: var(--focus-ring); }
.ml-otp input.is-filled { border-color: var(--indigo-200); background: var(--primary-tint); }

/* QR (TOTP setup) — faux scannable block */
.ml-qr { width: 168px; height: 168px; background: #fff; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 10px; display: grid; }
.ml-qr div { background: var(--gray-900); border-radius: 1px; }
.ml-secret { font-family: var(--font-mono); font-size: var(--text-sm); letter-spacing: .08em; color: var(--text-primary); background: var(--bg-subtle); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 10px 12px; text-align: center; }

/* ---- Onboarding wizard ---- */
.ml-wizard { min-height: 100vh; display: flex; background: var(--bg-surface); }
.ml-wizard__rail { width: 312px; flex: 0 0 auto; background: var(--bg-card); border-right: 1px solid var(--border-subtle); padding: 36px 28px; display: flex; flex-direction: column; }
.ml-wizard__brand { margin-bottom: 36px; }
.ml-wizard__steps { display: flex; flex-direction: column; gap: 0; flex: 1; }
.ml-wizardstep { display: flex; gap: 14px; position: relative; padding-bottom: 26px; }
.ml-wizardstep:last-child { padding-bottom: 0; }
.ml-wizardstep__dot { width: 30px; height: 30px; border-radius: 50%; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; font-size: var(--text-sm); font-weight: var(--weight-bold); background: var(--bg-card); border: 1px solid var(--border-default); color: var(--text-muted); z-index: 1; }
.ml-wizardstep__line { position: absolute; left: 15px; top: 30px; bottom: 0; width: 1px; background: var(--border-subtle); }
.ml-wizardstep--active .ml-wizardstep__dot { background: var(--primary); border-color: var(--primary); color: #fff; }
.ml-wizardstep--done .ml-wizardstep__dot { background: var(--primary-tint); border-color: var(--indigo-200); color: var(--indigo-700); }
.ml-wizardstep--done .ml-wizardstep__line { background: var(--indigo-200); }
.ml-wizardstep__title { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text-primary); }
.ml-wizardstep--pending .ml-wizardstep__title { color: var(--text-muted); }
.ml-wizardstep__desc { font-size: var(--text-xs); color: var(--text-muted); margin-top: 2px; }
.ml-wizard__main { flex: 1; min-width: 0; display: flex; align-items: flex-start; justify-content: center; padding: 64px 24px; overflow-y: auto; }
.ml-wizard__panel { width: 100%; max-width: 520px; }
.ml-wizard__eyebrow { font-size: var(--text-xs); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--primary); }
.ml-wizard__h { font-size: var(--text-xl); font-weight: var(--weight-bold); letter-spacing: var(--tracking-snug); color: var(--text-primary); margin: 8px 0 6px; }
.ml-wizard__lede { font-size: var(--text-sm); color: var(--text-muted); margin: 0 0 26px; line-height: var(--leading-md); }
.ml-wizard__actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 28px; }

/* connect cards (WordPress / API key / GSC / discovered sites) */
.ml-connect { display: flex; align-items: center; gap: 14px; padding: 16px; border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); background: var(--bg-card); }
.ml-connect__logo { width: 44px; height: 44px; border-radius: var(--radius-md); flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; background: var(--bg-subtle); color: var(--text-secondary); }
.ml-connect__logo svg { width: 22px; height: 22px; }
.ml-connect__meta { flex: 1; min-width: 0; }
.ml-connect__name { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text-primary); }
.ml-connect__sub { font-size: var(--text-xs); color: var(--text-muted); margin-top: 2px; }
.ml-connect--done { border-color: var(--success-border); background: var(--success-surface); }
.ml-connect--done .ml-connect__logo { background: #fff; color: var(--success); }

.ml-sitediscover { display: flex; flex-direction: column; gap: 10px; }
.ml-siterow { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--bg-card); cursor: pointer; transition: border-color .12s ease, background-color .12s ease; }
.ml-siterow:hover { border-color: var(--border-default); }
.ml-siterow--selected { border-color: var(--indigo-200); background: var(--primary-tint); }
.ml-siterow__flag { width: 30px; height: 30px; border-radius: 6px; background: var(--gray-100); display: inline-flex; align-items: center; justify-content: center; font-size: 15px; flex: 0 0 auto; }
.ml-siterow__meta { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.ml-siterow__name { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text-primary); }
.ml-siterow__url { font-size: var(--text-xs); color: var(--text-muted); }

/* auth screen switcher (review-only nav for the click-through) */
.ml-authnav { position: fixed; top: 0; left: 0; bottom: 0; width: 248px; background: var(--bg-card); border-right: 1px solid var(--border-subtle); padding: 20px 14px; overflow-y: auto; z-index: 50; }
.ml-authnav__brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; }
.ml-authnav__group { font-size: 11px; font-weight: var(--weight-semibold); letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--text-disabled); padding: 12px 10px 4px; }
.ml-authnav__item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 8px 10px; border: none; background: none; border-radius: var(--radius-sm); cursor: pointer; font-size: var(--text-sm); color: var(--text-secondary); font-family: var(--font-sans); }
.ml-authnav__item:hover { background: var(--bg-hover); color: var(--text-primary); }
.ml-authnav__item--active { background: var(--primary-tint); color: var(--indigo-700); font-weight: var(--weight-semibold); }
.ml-authnav__item svg { width: 16px; height: 16px; flex: 0 0 auto; color: var(--text-muted); }
.ml-authnav__item--active svg { color: var(--primary); }
.ml-authstage { margin-left: 248px; }

@media (max-width: 760px) {
  .ml-authnav { display: none; }
  .ml-authstage { margin-left: 0; }
  .ml-wizard { flex-direction: column; }
  .ml-wizard__rail { width: auto; border-right: none; border-bottom: 1px solid var(--border-subtle); padding: 24px; }
  .ml-wizard__steps { flex-direction: row; gap: 6px; overflow-x: auto; }
  .ml-wizardstep { flex-direction: column; align-items: center; padding-bottom: 0; flex: 1; text-align: center; min-width: 80px; }
  .ml-wizardstep__line { display: none; }
  .ml-wizardstep__desc { display: none; }
  .ml-wizard__main { padding: 32px 20px; }
}
@media (prefers-reduced-motion: reduce) { .ml-auth__card, .ml-wizard__panel { animation: none !important; } }

/* ============================================================================
   WORKSPACE CONSOLE & AGENCY DASHBOARD (Stage 4)
   ========================================================================== */

/* Console header + tab bar */
.ml-console-head { padding: var(--space-6) var(--space-8) 0; background: var(--bg-card); border-bottom: 1px solid var(--border-subtle); position: sticky; top: var(--topbar-height); z-index: 40; }
.ml-console-head__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.ml-console-tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.ml-console-tabs::-webkit-scrollbar { display: none; }
.ml-console-tabs .hds-tab { white-space: nowrap; }

/* generic section spacing inside console */
.ml-section { margin-bottom: var(--space-8); }
.ml-section__h { font-size: var(--text-lg); font-weight: var(--weight-semibold); color: var(--text-primary); margin: 0 0 4px; }
.ml-section__sub { font-size: var(--text-sm); color: var(--text-muted); margin: 0 0 16px; }

/* Site cards (console → Sites) */
.ml-sitecard { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); padding: var(--space-5); display: flex; flex-direction: column; gap: 14px; }
.ml-sitecard__top { display: flex; align-items: center; gap: 12px; }
.ml-sitecard__flag { width: 38px; height: 38px; border-radius: 8px; background: var(--gray-100); display: inline-flex; align-items: center; justify-content: center; font-size: 18px; flex: 0 0 auto; }
.ml-sitecard__name { font-size: var(--text-md); font-weight: var(--weight-semibold); color: var(--text-primary); }
.ml-sitecard__url { font-size: var(--text-xs); color: var(--text-muted); }
.ml-sitecard__conns { display: flex; gap: 8px; flex-wrap: wrap; }
.ml-conn-pill { display: inline-flex; align-items: center; gap: 5px; font-size: var(--text-xs); font-weight: var(--weight-medium); padding: 3px 9px; border-radius: var(--radius-pill); border: 1px solid var(--border-subtle); color: var(--text-muted); }
.ml-conn-pill svg { width: 13px; height: 13px; }
.ml-conn-pill--ok { color: var(--success); background: var(--success-surface); border-color: var(--success-border); }
.ml-conn-pill--off { color: var(--text-muted); }

/* usage meter rows */
.ml-usage { display: flex; flex-direction: column; gap: 6px; }
.ml-usage__row { display: flex; align-items: center; justify-content: space-between; font-size: var(--text-xs); color: var(--text-muted); }
.ml-usage__row b { color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.ml-progress__bar--warn { background: var(--warning); }
.ml-progress__bar--danger { background: var(--danger); }

/* seats indicator */
.ml-seats { display: flex; align-items: center; gap: 12px; }
.ml-seats__bar { flex: 1; max-width: 220px; }

/* approvals */
.ml-approval { display: flex; align-items: flex-start; gap: 14px; padding: 16px; border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); background: var(--bg-card); }
.ml-approval__icon { width: 38px; height: 38px; border-radius: var(--radius-md); background: var(--warning-surface); color: var(--warning); display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.ml-approval__meta { flex: 1; min-width: 0; }
.ml-approval__title { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text-primary); }
.ml-approval__sub { font-size: var(--text-xs); color: var(--text-muted); margin-top: 3px; }
.ml-approval__actions { display: flex; gap: 8px; flex: 0 0 auto; }

/* plan / pricing cards */
.ml-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.ml-plan { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: var(--space-6); display: flex; flex-direction: column; gap: 14px; position: relative; }
.ml-plan--current { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.ml-plan__badge { position: absolute; top: -10px; left: var(--space-6); font-size: 10px; font-weight: var(--weight-bold); letter-spacing: .04em; text-transform: uppercase; color: #fff; background: var(--primary); padding: 3px 9px; border-radius: var(--radius-pill); }
.ml-plan__name { font-size: var(--text-md); font-weight: var(--weight-semibold); color: var(--text-primary); }
.ml-plan__price { font-size: var(--text-2xl); font-weight: var(--weight-bold); letter-spacing: var(--tracking-tight); color: var(--text-primary); }
.ml-plan__price span { font-size: var(--text-sm); font-weight: var(--weight-regular); color: var(--text-muted); letter-spacing: 0; }
.ml-plan__feats { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.ml-plan__feats li { display: flex; align-items: flex-start; gap: 8px; font-size: var(--text-sm); color: var(--text-secondary); }
.ml-plan__feats li svg { width: 16px; height: 16px; color: var(--success); flex: 0 0 auto; margin-top: 2px; }

/* simple bar chart (reports / agency stats) */
.ml-bars { display: flex; align-items: flex-end; gap: 12px; height: 180px; padding-top: 10px; }
.ml-bars__col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.ml-bars__bar { width: 100%; max-width: 44px; border-radius: 6px 6px 0 0; background: var(--primary); transition: height .4s cubic-bezier(.16,.84,.44,1); }
.ml-bars__bar--soft { background: var(--primary-tint); }
.ml-bars__label { font-size: var(--text-xs); color: var(--text-muted); }
.ml-bars__val { font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--text-secondary); font-variant-numeric: tabular-nums; }

/* line/area chart via SVG container */
.ml-chartcard { padding: var(--space-5) var(--space-6); }
.ml-legendrow { display: flex; gap: 16px; align-items: center; font-size: var(--text-xs); color: var(--text-muted); }
.ml-legendrow span { display: inline-flex; align-items: center; gap: 6px; }
.ml-legendrow i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* activity timeline */
.ml-timeline { display: flex; flex-direction: column; }
.ml-tl { display: flex; gap: 14px; position: relative; padding-bottom: 18px; }
.ml-tl:last-child { padding-bottom: 0; }
.ml-tl__dot { width: 30px; height: 30px; border-radius: 50%; background: var(--bg-subtle); border: 1px solid var(--border-subtle); display: inline-flex; align-items: center; justify-content: center; color: var(--text-muted); flex: 0 0 auto; z-index: 1; }
.ml-tl__dot svg { width: 15px; height: 15px; }
.ml-tl__line { position: absolute; left: 15px; top: 30px; bottom: 0; width: 1px; background: var(--border-subtle); }
.ml-tl__body { padding-top: 4px; }
.ml-tl__text { font-size: var(--text-sm); color: var(--text-secondary); }
.ml-tl__text b { color: var(--text-primary); font-weight: var(--weight-semibold); }
.ml-tl__time { font-size: var(--text-xs); color: var(--text-muted); margin-top: 2px; }

/* doc library (console → Documentation) */
.ml-doclib { display: grid; grid-template-columns: 240px 1fr; gap: var(--space-8); align-items: start; }
.ml-doclib__nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 150px; }
.ml-doclib__group { font-size: 11px; font-weight: var(--weight-semibold); letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--text-disabled); padding: 12px 10px 4px; }
.ml-doclib__item { text-align: left; border: none; background: none; padding: 7px 10px; border-radius: var(--radius-sm); cursor: pointer; font-size: var(--text-sm); color: var(--text-secondary); font-family: var(--font-sans); }
.ml-doclib__item:hover { background: var(--bg-hover); color: var(--text-primary); }
.ml-doclib__item--active { background: var(--primary-tint); color: var(--indigo-700); font-weight: var(--weight-semibold); }
@media (max-width: 860px) { .ml-doclib { grid-template-columns: 1fr; } .ml-doclib__nav { position: static; } }

/* tenant drill-down (agency) */
.ml-tenant-banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--primary-tint); border: 1px solid var(--indigo-200); border-radius: var(--radius-lg); margin-bottom: var(--space-6); }
.ml-tenant-banner__meta { flex: 1; }
.ml-readonly-tag { font-size: 11px; font-weight: var(--weight-semibold); color: var(--text-muted); background: var(--gray-100); padding: 2px 9px; border-radius: var(--radius-pill); border: 1px solid var(--border-subtle); }

/* MRR / big number row */
.ml-bignum { font-size: var(--text-2xl); font-weight: var(--weight-bold); letter-spacing: var(--tracking-tight); color: var(--text-primary); font-variant-numeric: tabular-nums; }

@media (max-width: 760px) {
  .ml-console-head { padding: var(--space-4) var(--space-4) 0; }
}

/* ============================================================================
   CONTENT EDITOR & SEO PANEL (Stage 5)
   ========================================================================== */
.ml-editor { display: grid; grid-template-columns: minmax(0, 1fr) 376px; gap: var(--space-6); align-items: start; }
@media (max-width: 1080px) { .ml-editor { grid-template-columns: 1fr; } }

.ml-editor-bar { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-4); flex-wrap: wrap; }
.ml-editor-bar__spacer { flex: 1; }
.ml-editor-meta { font-size: var(--text-xs); color: var(--text-muted); white-space: nowrap; }

.ml-edcard { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); overflow: hidden; }
.ml-edtitle { width: 100%; border: none; outline: none; font-size: 28px; font-weight: var(--weight-bold); letter-spacing: var(--tracking-tight); color: var(--text-primary); padding: var(--space-6) var(--space-6) var(--space-2); font-family: var(--font-sans); background: none; }
.ml-edtitle::placeholder { color: var(--text-disabled); }
.ml-edslug { padding: 0 var(--space-6) var(--space-4); font-size: var(--text-sm); color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.ml-edslug code { color: var(--text-link); font-family: var(--font-mono); font-size: var(--text-xs); }
.ml-toolbar { display: flex; align-items: center; gap: 2px; padding: 8px var(--space-4); border-top: 1px solid var(--border-subtle); border-bottom: 1px solid var(--border-subtle); background: var(--bg-subtle); flex-wrap: wrap; }
.ml-toolbar__btn { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border: none; background: none; border-radius: var(--radius-sm); color: var(--text-muted); cursor: pointer; font-weight: var(--weight-semibold); }
.ml-toolbar__btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.ml-toolbar__sep { width: 1px; height: 20px; background: var(--border-subtle); margin: 0 6px; }
.ml-body { padding: var(--space-5) var(--space-6) var(--space-8); min-height: 440px; }
.ml-body.ml-prose { max-width: none; }
.ml-body:focus { outline: none; }

/* SEO panel */
.ml-seopanel { position: sticky; top: var(--space-6); background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); overflow: hidden; display: flex; flex-direction: column; max-height: calc(100vh - 130px); }
@media (max-width: 1080px) { .ml-seopanel { position: static; max-height: none; } }
.ml-seohead { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border-subtle); flex: 0 0 auto; }
.ml-seohead__title { font-size: var(--text-md); font-weight: var(--weight-semibold); color: var(--text-primary); display: flex; align-items: center; gap: 8px; }
.ml-seo-scroll { padding: 18px 16px; display: flex; flex-direction: column; gap: 20px; overflow-y: auto; }
.ml-seosection { display: flex; flex-direction: column; gap: 8px; }
.ml-seosection__label { font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--text-secondary); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ml-counter { font-size: 11px; font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; color: var(--text-muted); }
.ml-counter--ok { color: var(--success); }
.ml-counter--warn { color: var(--warning); }
.ml-counter--bad { color: var(--danger); }
.ml-seo-gaugewrap { display: flex; gap: 16px; align-items: center; }
.ml-seo-collapse { width: 100%; display: flex; align-items: center; justify-content: space-between; background: none; border: none; cursor: pointer; padding: 0; font-family: var(--font-sans); }
.ml-jsonld { background: var(--gray-900); color: #D7DCEC; border-radius: var(--radius-md); padding: 12px 14px; font-family: var(--font-mono); font-size: 11px; line-height: 1.65; overflow-x: auto; white-space: pre; margin: 0; }
.ml-jsonld .k { color: #A5B4FC; }
.ml-jsonld .s { color: #ABEFC6; }

/* AI-fill states on the SEO panel */
.ml-seo-fillbar { padding: 0 16px 16px; flex: 0 0 auto; }
.ml-aiflash { animation: ml-aiflash 1.4s ease; }
@keyframes ml-aiflash { 0% { background: var(--ml-ai-surface); } 100% { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .ml-aiflash { animation: none; } }
.ml-seo-applied { display: inline-flex; align-items: center; gap: 5px; font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--ml-ai-fg); }
.ml-seo-applied svg { width: 14px; height: 14px; }

/* generator modal bits */
.ml-gen-locked { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--bg-subtle); font-size: var(--text-sm); color: var(--text-primary); }
.ml-gen-locked svg { width: 15px; height: 15px; color: var(--text-muted); }
.ml-gen-locked .ml-lockchip { margin-left: auto; }

/* ============================================================================
   BUSINESS INTELLIGENCE (Stage 6) — shared module template
   ========================================================================== */
.ml-marketchip { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 8px; border-radius: var(--radius-pill); background: var(--primary-tint); border: 1px solid var(--indigo-200); color: var(--indigo-700); font-size: var(--text-sm); font-weight: var(--weight-semibold); cursor: pointer; }
.ml-marketchip:hover { background: var(--primary-tint-2); }
.ml-marketchip__flag { font-size: 15px; }
.ml-marketchip svg { width: 14px; height: 14px; opacity: .7; }

.ml-bi-lifecards { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; max-width: 560px; }

.ml-grow-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: var(--weight-semibold); color: var(--info); background: var(--info-surface); border: 1px solid var(--info-border); padding: 2px 8px; border-radius: var(--radius-pill); }
.ml-grow-badge svg { width: 12px; height: 12px; }

.ml-entgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.ml-entcard { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); padding: 16px; display: flex; flex-direction: column; gap: 12px; cursor: pointer; transition: border-color .12s ease, box-shadow .12s ease; position: relative; }
.ml-entcard:hover { border-color: var(--border-default); box-shadow: var(--shadow-sm); }
.ml-entcard--selected { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.ml-entcard--archived { opacity: .72; background: var(--bg-subtle); }
.ml-entcard__top { display: flex; align-items: flex-start; gap: 10px; }
.ml-entcard__logo { width: 38px; height: 38px; border-radius: var(--radius-md); background: var(--gray-100); color: var(--text-secondary); display: inline-flex; align-items: center; justify-content: center; font-weight: var(--weight-bold); flex: 0 0 auto; font-size: var(--text-md); }
.ml-entcard__name { font-size: var(--text-md); font-weight: var(--weight-semibold); color: var(--text-primary); display: flex; align-items: center; gap: 6px; }
.ml-entcard__url { font-size: var(--text-xs); color: var(--text-muted); }
.ml-entcard__rels { display: flex; flex-wrap: wrap; gap: 6px; }
.ml-entcard__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--text-muted); padding-top: 10px; border-top: 1px solid var(--border-subtle); }
.ml-prov { display: inline-flex; align-items: center; gap: 5px; }
.ml-prov svg { width: 12px; height: 12px; }
.ml-entcard__check { position: absolute; top: 12px; right: 12px; opacity: 0; transition: opacity .1s ease; }
.ml-entcard:hover .ml-entcard__check, .ml-entcard--selected .ml-entcard__check { opacity: 1; }

/* products: providers + coverage + variant tree */
.ml-provider { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--bg-card); }
.ml-provider--ours { border-color: var(--indigo-200); background: var(--primary-tint); }
.ml-provider__logo { width: 30px; height: 30px; border-radius: 6px; background: var(--gray-100); display: inline-flex; align-items: center; justify-content: center; font-weight: var(--weight-bold); font-size: var(--text-xs); flex: 0 0 auto; }
.ml-provider__name { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--text-primary); flex: 1; }
.ml-provider__price { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text-primary); font-variant-numeric: tabular-nums; }
.ml-provider__src { font-size: 11px; color: var(--text-muted); }
.ml-vtree { display: flex; flex-direction: column; gap: 6px; }
.ml-vrow { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--radius-md); background: var(--bg-subtle); }
.ml-vrow--child { margin-left: 26px; position: relative; background: var(--bg-card); border: 1px solid var(--border-subtle); }
.ml-vrow--child::before { content: ""; position: absolute; left: -14px; top: 50%; width: 12px; height: 1px; background: var(--border-default); }
.ml-vrow__name { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--text-primary); flex: 1; }
.ml-vrow__roll { font-size: var(--text-xs); color: var(--text-muted); }

/* business profile rollup */
.ml-rollup { display: flex; flex-wrap: wrap; gap: 8px; }
.ml-pipeline { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ml-pipeline__step { font-size: 11px; font-weight: var(--weight-semibold); padding: 3px 10px; border-radius: var(--radius-pill); background: var(--gray-100); color: var(--text-muted); }
.ml-pipeline__step--active { background: var(--primary); color: #fff; }
.ml-pipeline svg { width: 13px; height: 13px; color: var(--text-disabled); }

/* ============================================================================
   RESEARCH & SEO / PERFORMANCE (Stage 7)
   ========================================================================== */
/* kanban planner board */
.ml-board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(248px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.ml-board__col { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 160px; }
.ml-board__h { display: flex; align-items: center; gap: 8px; font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text-secondary); padding: 2px 4px; }
.ml-board__h .ml-board__count { margin-left: auto; font-size: 11px; font-weight: var(--weight-semibold); background: var(--gray-100); color: var(--text-muted); padding: 0 7px; border-radius: var(--radius-pill); }
.ml-board__card { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); box-shadow: var(--shadow-xs); padding: 12px; display: flex; flex-direction: column; gap: 8px; cursor: grab; }
.ml-board__card:active { cursor: grabbing; }
.ml-board__card-title { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text-primary); }
.ml-board__meta { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-muted); }

/* GSC line/area chart (SVG) */
.ml-linechart { width: 100%; height: 190px; display: block; }
.ml-linechart .area { fill: var(--primary-tint); }
.ml-linechart .line { fill: none; stroke: var(--primary); stroke-width: 2; }
.ml-linechart .grid { stroke: var(--border-subtle); stroke-width: 1; stroke-dasharray: 3 3; }
.ml-linechart .dot { fill: #fff; stroke: var(--primary); stroke-width: 2; }

/* audit severity rows */
.ml-auditrow { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border-subtle); }
.ml-auditrow:last-child { border-bottom: none; }
.ml-auditrow__icon { width: 32px; height: 32px; border-radius: var(--radius-md); display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.ml-auditrow__icon svg { width: 17px; height: 17px; }
.ml-auditrow__icon--bad { background: var(--danger-surface); color: var(--danger); }
.ml-auditrow__icon--warn { background: var(--warning-surface); color: var(--warning); }
.ml-auditrow__icon--ok { background: var(--success-surface); color: var(--success); }
.ml-auditrow__meta { flex: 1; min-width: 0; }
.ml-auditrow__title { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text-primary); }
.ml-auditrow__desc { font-size: var(--text-xs); color: var(--text-muted); margin-top: 2px; }

/* internal-linking suggestion rows */
.ml-linksugg { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border-subtle); }
.ml-linksugg:last-child { border-bottom: none; }
.ml-linksugg__side { flex: 1; min-width: 0; }
.ml-linksugg__t { font-size: var(--text-sm); color: var(--text-primary); font-weight: var(--weight-medium); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ml-linksugg__u { font-size: 11px; color: var(--text-muted); }
.ml-linksugg__arrow { color: var(--text-disabled); flex: 0 0 auto; }
.ml-linksugg__anchor { font-size: var(--text-xs); color: var(--text-link); background: var(--primary-tint); padding: 2px 8px; border-radius: var(--radius-sm); white-space: nowrap; }

/* analysis result layout */
.ml-analysis { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 940px) { .ml-analysis { grid-template-columns: 1fr; } }
.ml-faq { display: flex; flex-direction: column; gap: 10px; }
.ml-faq__q { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text-primary); display: flex; gap: 8px; }
.ml-faq__q svg { color: var(--primary); flex: 0 0 auto; margin-top: 2px; }

/* bulk meta inline-edit cells */
.ml-metacell { position: relative; }
.ml-metacell input, .ml-metacell textarea { width: 100%; border: 1px solid transparent; background: transparent; border-radius: var(--radius-sm); padding: 6px 8px; font-family: var(--font-sans); font-size: var(--text-sm); color: var(--text-primary); resize: none; line-height: 1.4; }
.ml-metacell input:hover, .ml-metacell textarea:hover { border-color: var(--border-subtle); background: var(--bg-card); }
.ml-metacell input:focus, .ml-metacell textarea:focus { outline: none; border-color: var(--border-focus); box-shadow: var(--focus-ring); background: var(--bg-card); }
.ml-metacell--dirty input, .ml-metacell--dirty textarea { border-color: var(--warning); background: var(--warning-surface); }
.ml-savebar { position: sticky; bottom: 0; display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--bg-card); border-top: 1px solid var(--border-subtle); }

/* keyword library helpers */
.ml-kwstats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 20px; }

/* ============================================================================
   PIPELINE & ASSISTANTS (Stage 8)
   ========================================================================== */
/* inbox capture + cards */
.ml-capture { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); padding: 16px; margin-bottom: 20px; }
.ml-capture__tabs { display: flex; gap: 2px; margin-bottom: 12px; }
.ml-inboxcard { display: flex; gap: 14px; padding: 16px; }
.ml-inboxcard__icon { width: 38px; height: 38px; border-radius: var(--radius-md); background: var(--primary-tint); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.ml-inboxcard__meta { flex: 1; min-width: 0; }
.ml-inboxcard__src { font-size: var(--text-xs); color: var(--text-muted); display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.ml-inboxcard__title { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text-primary); }
.ml-inboxcard__sum { font-size: var(--text-sm); color: var(--text-secondary); margin-top: 4px; line-height: var(--leading-md); }

/* to-do list */
.ml-todo { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border-subtle); }
.ml-todo:last-child { border-bottom: none; }
.ml-todo__title { flex: 1; font-size: var(--text-sm); color: var(--text-primary); font-weight: var(--weight-medium); }
.ml-todo--done .ml-todo__title { color: var(--text-muted); text-decoration: line-through; }
.ml-todogroup__h { font-size: var(--text-xs); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--text-disabled); padding: 14px 16px 6px; }

/* chat assistant surface */
.ml-chatsurface { display: flex; flex-direction: column; height: calc(100vh - var(--topbar-height) - 64px); background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); overflow: hidden; }
.ml-chatsurface__head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border-subtle); flex: 0 0 auto; }
.ml-chatsurface__scroll { flex: 1; overflow-y: auto; padding: 24px; }
.ml-chatsurface__foot { flex: 0 0 auto; padding: 14px 18px; border-top: 1px solid var(--border-subtle); }
.ml-chat-empty { max-width: 460px; margin: 32px auto; text-align: center; }
.ml-chat-suggest { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.ml-chat-suggest button { text-align: left; padding: 12px 14px; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--bg-card); cursor: pointer; font-size: var(--text-sm); color: var(--text-secondary); font-family: var(--font-sans); display: flex; align-items: center; gap: 10px; }
.ml-chat-suggest button:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-default); }
.ml-chat-suggest button svg { color: var(--primary); flex: 0 0 auto; }

/* report document */
.ml-report-section { margin-bottom: 24px; }
.ml-report-section__h { display: flex; align-items: center; gap: 8px; font-size: var(--text-md); font-weight: var(--weight-semibold); color: var(--text-primary); margin-bottom: 12px; }
.ml-report-section__h svg { color: var(--primary); }
.ml-spark { width: 120px; height: 36px; }
.ml-spark path { fill: none; stroke: var(--primary); stroke-width: 2; }

/* ============================================================================
   PUBLIC / MARKETING + SYSTEM (Stage 9)
   ========================================================================== */
.ml-pub { background: var(--bg-app); min-height: 100vh; }
.ml-pubnav { position: sticky; top: 0; z-index: 50; background: var(--bg-app); border-bottom: 1px solid var(--border-subtle); }
.ml-pubnav__inner { max-width: 1140px; margin: 0 auto; display: flex; align-items: center; gap: 20px; padding: 14px 24px; }
.ml-pubnav__links { display: flex; gap: 2px; margin-left: 8px; }
.ml-pubnav__link { padding: 8px 12px; border-radius: var(--radius-md); font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--text-secondary); background: none; border: none; cursor: pointer; font-family: var(--font-sans); }
.ml-pubnav__link:hover { background: var(--bg-hover); color: var(--text-primary); }
.ml-pubnav__link--active { color: var(--primary); }
.ml-pubnav__cta { margin-left: auto; display: flex; gap: 8px; align-items: center; }
@media (max-width: 720px) { .ml-pubnav__links { display: none; } }

.ml-pubwrap { max-width: 1140px; margin: 0 auto; padding: 0 24px; }
.ml-pubwrap--narrow { max-width: 820px; }

.ml-hero { text-align: center; padding: 84px 0 56px; }
.ml-hero__eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--primary); background: var(--primary-tint); border: 1px solid var(--indigo-100); padding: 5px 12px; border-radius: var(--radius-pill); }
.ml-hero__title { font-size: 54px; font-weight: var(--weight-bold); letter-spacing: -0.03em; line-height: 1.04; color: var(--text-primary); max-width: 17ch; margin: 20px auto 0; }
.ml-hero__sub { font-size: var(--text-lg); color: var(--text-secondary); max-width: 60ch; margin: 18px auto 28px; line-height: 1.5; }
.ml-hero__cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
@media (max-width: 640px) { .ml-hero__title { font-size: 38px; } .ml-hero { padding: 56px 0 40px; } }

.ml-hero__shot { margin: 48px auto 0; max-width: 980px; border: 1px solid var(--border-subtle); border-radius: var(--radius-xl); box-shadow: var(--shadow-xl); overflow: hidden; background: var(--bg-card); }
.ml-hero__shotbar { display: flex; gap: 6px; padding: 12px 16px; border-bottom: 1px solid var(--border-subtle); background: var(--bg-subtle); }
.ml-hero__shotbar span { width: 11px; height: 11px; border-radius: 50%; background: var(--gray-300); }

.ml-logos { display: flex; gap: 36px; align-items: center; justify-content: center; flex-wrap: wrap; padding: 32px 0; opacity: .65; }
.ml-logos span { font-size: var(--text-lg); font-weight: var(--weight-bold); color: var(--text-muted); letter-spacing: -0.01em; }

.ml-secpub { padding: 64px 0; }
.ml-secpub__head { text-align: center; max-width: 60ch; margin: 0 auto 44px; }
.ml-secpub__eyebrow { font-size: var(--text-xs); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--primary); }
.ml-secpub__title { font-size: 36px; font-weight: var(--weight-bold); letter-spacing: -0.02em; color: var(--text-primary); margin: 10px 0 0; }
.ml-secpub__sub { font-size: var(--text-md); color: var(--text-muted); margin: 12px 0 0; line-height: 1.5; }

.ml-fegrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.ml-fecard { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); padding: 24px; }
.ml-fecard__icon { width: 44px; height: 44px; border-radius: var(--radius-md); background: var(--primary-tint); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 16px; }
.ml-fecard__title { font-size: var(--text-lg); font-weight: var(--weight-semibold); color: var(--text-primary); margin-bottom: 6px; }
.ml-fecard__text { font-size: var(--text-sm); color: var(--text-muted); line-height: 1.6; }

.ml-cta-band { background: var(--gray-900); border-radius: var(--radius-xl); padding: 56px 32px; text-align: center; color: #fff; }
.ml-cta-band h2 { font-size: 34px; font-weight: var(--weight-bold); letter-spacing: -0.02em; margin: 0 0 10px; }
.ml-cta-band p { color: var(--gray-400); font-size: var(--text-md); margin: 0 0 24px; }

.ml-pubfoot { border-top: 1px solid var(--border-subtle); margin-top: 56px; }
.ml-pubfoot__inner { max-width: 1140px; margin: 0 auto; padding: 40px 24px; display: flex; gap: 40px; flex-wrap: wrap; justify-content: space-between; }
.ml-pubfoot__col { display: flex; flex-direction: column; gap: 10px; }
.ml-pubfoot__col h4 { font-size: var(--text-xs); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--text-disabled); margin: 0 0 4px; }
.ml-pubfoot a { font-size: var(--text-sm); color: var(--text-muted); text-decoration: none; cursor: pointer; }
.ml-pubfoot a:hover { color: var(--text-primary); }

.ml-statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 16px; text-align: center; }
.ml-statgrid__n { font-size: 40px; font-weight: var(--weight-bold); letter-spacing: -0.02em; color: var(--primary); }
.ml-statgrid__l { font-size: var(--text-sm); color: var(--text-muted); margin-top: 4px; }

/* system / error pages */
.ml-syscode { font-size: 88px; font-weight: var(--weight-bold); letter-spacing: -0.04em; color: var(--primary); line-height: 1; }
