/* ─────────────────────────────────────────────────────────────
   Mangochat — design system
   ───────────────────────────────────────────────────────────── */
:root {
  /* Neutrals (Cal.com-style) */
  --gray-0: #ffffff;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;
  /* Semantic */
  --ink: var(--gray-900);
  --ink-2: var(--gray-700);
  --muted: var(--gray-500);
  --faint: var(--gray-400);
  --line: var(--gray-200);
  --line-soft: var(--gray-100);
  --bg: var(--gray-50);
  --surface: var(--gray-0);
  /* Brand = ink. Old --blue-* names kept as aliases. */
  --blue: var(--gray-900);
  --blue-600: #1f2937;
  --blue-700: var(--gray-900);
  --blue-50: var(--gray-100);
  --blue-100: var(--gray-200);
  /* Status only */
  --green: #16a34a;
  --green-ink: #15803d;
  --green-50: #f0fdf4;
  --amber: #d97706;
  --amber-ink: #92400e;
  --amber-50: #fffbeb;
  --red: #dc2626;
  --red-ink: #b91c1c;
  --red-50: #fef2f2;
  --violet: var(--gray-700);
  --violet-50: var(--gray-100);
  --ig: linear-gradient(45deg, #f9ce34 0%, #ee2a7b 52%, #6228d7 100%);
  /* Scales */
  --text-xs: 12px;
  --text-sm: 14px;
  --text-md: 16px;
  --text-lg: 20px;
  --text-xl: 24px;
  --radius-sm: 6px;
  --radius: 8px;
  --radius-full: 999px;
  --shadow-xs: none;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, .08);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, .12);
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-synthesis: none;
}
img { max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p { margin: 0; }
svg { display: block; }
.hidden { display: none !important; }
::selection { background: var(--blue-100); }

.icon { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ── Auth ─────────────────────────────────────────────────── */
.auth { min-height: 100vh; display: grid; place-items: center; background: var(--bg); }
.auth-brand {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 44px 60px 40px;
  background:
    radial-gradient(120% 90% at 100% 0%, var(--gray-900) 0%, transparent 55%),
    radial-gradient(90% 80% at 0% 100%, var(--gray-900) 0%, transparent 60%),
    var(--gray-900);
  color: var(--gray-0);
  isolation: isolate;
}
.auth-brand-top { display: flex; align-items: center; gap: 11px; font-weight: 600; font-size: var(--text-md); letter-spacing: -.02em; }
.auth-brand-top img { border-radius: var(--radius); }
.auth-brand-copy { position: relative; z-index: 2; max-width: 480px; padding: 40px 0; }
.auth-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: var(--text-xs); font-weight: 600; letter-spacing: 0;
  color: var(--gray-400); margin-bottom: 22px;
}
.auth-eyebrow::before { content: ""; width: 22px; height: 1px; background: var(--gray-700); }
.auth-brand h1 {
  font-size: clamp(38px, 4.2vw, 58px);
  line-height: 1.02;
  letter-spacing: -.045em;
  font-weight: 600;
  margin-bottom: 22px;
}
.auth-brand-copy > p { color: var(--gray-400); font-size: var(--text-md); line-height: 1.6; max-width: 430px; }
.auth-points { list-style: none; margin: 34px 0 0; padding: 0; display: grid; gap: 14px; }
.auth-points li { display: flex; align-items: center; gap: 12px; font-size: var(--text-sm); color: var(--gray-300); }
.auth-check {
  width: 20px; height: 20px; border-radius: 50%; flex: none;
  background: rgba(17, 24, 39, .18); border: 1px solid rgba(255, 255, 255, .45);
  position: relative;
}
.auth-check::after {
  content: ""; position: absolute; left: 6px; top: 4px; width: 5px; height: 9px;
  border: solid var(--gray-400); border-width: 0 2px 2px 0; transform: rotate(42deg);
}
.auth-brand-foot {
  position: relative; z-index: 2;
  display: flex; justify-content: space-between; gap: 16px;
  font-size: var(--text-xs); color: var(--gray-500); border-top: 1px solid rgba(255,255,255,.08); padding-top: 20px;
}
.auth-glow { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .5; z-index: 0; }
.auth-glow-a { width: 420px; height: 420px; right: -140px; top: 12%; background: var(--gray-500); }
.auth-glow-b { width: 360px; height: 360px; left: -120px; bottom: 4%; background: var(--gray-500); opacity: .35; }
.auth-panel { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 32px 0; }
.auth-card { width: min(400px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 32px; }
.auth-card-logo { margin-bottom: 18px; }
.auth-card-logo img { border-radius: var(--radius); }
.auth-card h2 { font-size: var(--text-xl); letter-spacing: -.03em; font-weight: 600; }
.auth-sub { color: var(--muted); margin: 8px 0 24px; font-size: var(--text-sm); line-height: 1.55; }
.auth-note {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--gray-100); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 12px 13px; margin-top: 18px;
  color: var(--ink-2);
}
.auth-note-ico { color: var(--blue); margin-top: 1px; }
.auth-note p { font-size: var(--text-xs); line-height: 1.55; }
.auth-note strong { color: var(--ink); font-weight: 600; }
.auth-legal { margin-top: 20px; font-size: var(--text-xs); color: var(--faint); line-height: 1.6; text-align: center; }
.auth-legal a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.auth-support { font-size: var(--text-xs); color: var(--faint); }
.auth-support a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }

/* ── App frame ────────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  background: transparent;
  border-right: 1px solid var(--line);
  padding: 14px 10px 12px;
  z-index: 40;
}
.ws { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; }
.ws-logo { border-radius: var(--radius); flex: none; }
.ws-copy { min-width: 0; flex: 1; }
.ws-name { font-weight: 600; font-size: var(--text-sm); letter-spacing: -.025em; line-height: 1.2; }
.ws-sub { font-size: var(--text-xs); color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-chevron { color: var(--faint); }
.search-trigger {
  display: flex; align-items: center; gap: 9px;
  width: 100%; height: 36px; padding: 0 10px; margin-bottom: 14px;
  background: var(--gray-100); border: 1px solid var(--line-soft);
  border-radius: var(--radius); color: var(--muted); font-size: var(--text-sm);
  transition: background .15s, border-color .15s;
}
.search-trigger:hover { background: var(--gray-100); border-color: var(--line); }
.search-trigger span:nth-child(2) { flex: 1; text-align: left; }
.search-trigger kbd {
  font-family: var(--font); font-size: var(--text-xs); color: var(--faint);
  background: var(--gray-0); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1px 5px;
}
.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; margin: 0 -4px; padding: 0 4px; }
.nav-label {
  font-size: var(--text-xs); font-weight: 500; letter-spacing: 0;
  color: var(--faint); padding: 14px 10px 6px;
}
.nav-label:first-child { padding-top: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  height: 36px; padding: 0 10px; border-radius: var(--radius);
  font-size: var(--text-sm); font-weight: 500; color: var(--ink-2);
  transition: background .13s, color .13s;
  position: relative;
}
.nav-item:hover { background: rgba(255, 255, 255, .72); color: var(--ink); }
.nav-item.active { background: var(--gray-0); color: var(--blue-700); font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .07); }
.nav-item.active .nav-ico { color: var(--blue); }
.nav-ico { color: var(--gray-500); display: grid; place-items: center; }
.nav-count {
  margin-left: auto; font-size: var(--text-xs); font-weight: 500; color: var(--blue-700);
  background: var(--gray-0); border: 1px solid var(--gray-200); border-radius: var(--radius-full); padding: 0 6px; min-width: 20px; text-align: center;
}
.nav-dot { margin-left: auto; width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
.sidebar-foot { margin-top: 10px; display: grid; gap: 10px; }
.scope-card {
  background: var(--gray-0);
  display: flex; align-items: center; gap: 10px; text-align: left;
  width: 100%; padding: 11px; border-radius: var(--radius);
  background: linear-gradient(135deg, var(--gray-50), var(--gray-50));
  border: 1px solid var(--gray-200); color: var(--ink);
}
.scope-card:hover { border-color: var(--gray-300); }
.scope-badge {
  font-size: var(--text-xs); font-weight: 600; letter-spacing: 0; color: var(--gray-0);
  background: var(--blue); border-radius: var(--radius-sm); padding: 3px 5px; align-self: flex-start; margin-top: 1px;
}
.scope-copy { flex: 1; display: grid; line-height: 1.35; }
.scope-copy strong { font-size: var(--text-xs); font-weight: 500; }
.scope-copy small { font-size: var(--text-xs); color: var(--muted); }
.scope-arrow { color: var(--faint); }
.profile { display: flex; align-items: center; gap: 9px; padding: 8px 6px 2px; border-top: 1px solid var(--line-soft); }
.profile-copy { min-width: 0; flex: 1; display: grid; line-height: 1.35; }
.profile-copy strong { font-size: var(--text-xs); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-copy small { font-size: var(--text-xs); color: var(--faint); }
.avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--blue-50); color: var(--blue-700);
  font-weight: 600; font-size: var(--text-xs); letter-spacing: .02em;
  border: 1px solid var(--gray-200);
}
.avatar-ws { width: 30px; height: 30px; }
.avatar-btn {
  width: 34px; height: 34px; border: 1px solid var(--gray-200); cursor: pointer;
  transition: box-shadow .15s;
}
.avatar-btn:hover { box-shadow: 0 0 0 4px var(--gray-100); }

.workarea { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: 60px; flex: none;
  display: flex; align-items: center; gap: 12px;
  padding: 0 26px;
  background: rgba(245, 248, 252, .9);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.crumbs { display: flex; align-items: center; gap: 7px; font-size: var(--text-xs); color: var(--muted); min-width: 0; }
.crumbs a:hover { color: var(--ink); }
.crumbs .crumb-sep { color: var(--gray-400); }
.crumbs .crumb-current { color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.icon-btn {
  position: relative;
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; border-radius: var(--radius);
  border: 1px solid transparent; background: transparent; color: var(--gray-500);
  transition: background .13s, color .13s;
}
.icon-btn:hover { background: var(--gray-100); color: var(--ink); }
.icon-dot { position: absolute; top: 8px; right: 8px; width: 6px; height: 6px; border-radius: 50%; background: var(--blue); border: 1.5px solid var(--gray-0); }
.menu-btn { display: none; }
.user-menu-wrap { position: relative; margin-left: 4px; }
.user-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60;
  width: 232px; background: var(--gray-0); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-md); padding: 6px;
  animation: pop .14s ease-out;
}
.user-menu-head { display: flex; gap: 10px; align-items: center; padding: 9px 9px 11px; border-bottom: 1px solid var(--line-soft); margin-bottom: 5px; }
.user-menu-head div { display: grid; line-height: 1.3; }
.user-menu-head strong { font-size: var(--text-xs); }
.user-menu-head small { color: var(--faint); font-size: var(--text-xs); }
.user-menu a, .user-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 9px; border: 0; background: transparent; border-radius: var(--radius-sm);
  font-size: var(--text-sm); color: var(--ink-2); text-align: left;
}
.user-menu a:hover, .user-menu button:hover { background: var(--gray-100); color: var(--ink); }
.user-menu .icon { width: 16px; height: 16px; color: var(--muted); }

.view { flex: 1; min-width: 0; outline: none; }
.page { max-width: 1280px; margin: 0 auto; padding: 28px 32px 72px; animation: rise .22s ease-out; }
.page-wide { max-width: 1440px; }

/* ── Page header ──────────────────────────────────────────── */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head-copy { min-width: 0; }
.eyebrow { font-size: var(--text-xs); font-weight: 500; letter-spacing: 0; color: var(--faint); margin-bottom: 6px; }
.page-title { font-size: var(--text-xl); font-weight: 600; letter-spacing: -.035em; line-height: 1.15; }
.page-sub { color: var(--muted); font-size: var(--text-sm); margin-top: 6px; max-width: 660px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 13px;
  border-radius: var(--radius); border: 1px solid transparent;
  font-size: var(--text-sm); font-weight: 600; white-space: nowrap;
  transition: background .14s, border-color .14s, box-shadow .14s, transform .06s;
}
.btn:active { transform: translateY(.5px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn .icon { width: 16px; height: 16px; }
.btn-ico { display: inline-grid; place-items: center; }
.btn-primary { background: var(--blue); color: var(--gray-0); }
.btn-primary:hover { background: var(--blue-600); }
.btn-secondary { background: var(--gray-0); color: var(--ink); border-color: var(--gray-300); box-shadow: var(--shadow-xs); }
.btn-secondary:hover { background: var(--gray-50); border-color: var(--gray-300); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--gray-100); }
.btn-danger { background: var(--gray-0); color: var(--red-ink); border-color: var(--red); }
.btn-danger:hover { background: var(--red-50); }
.btn-danger-solid { background: var(--red); color: var(--gray-0); }
.btn-danger-solid:hover { background: var(--red); }
.btn-lg { height: 44px; padding: 0 18px; border-radius: var(--radius); font-size: var(--text-sm); }
.btn-sm { height: 30px; padding: 0 10px; font-size: var(--text-xs); border-radius: var(--radius); }
.btn-block { width: 100%; }
.btn .spinner { width: 14px; height: 14px; border-width: 2px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--blue-700); font-size: var(--text-xs); font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.link-btn:hover { text-decoration: underline; text-underline-offset: 2px; }

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
}
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 18px; border-bottom: 1px solid var(--line-soft); }
.card-title { font-size: var(--text-sm); font-weight: 600; letter-spacing: -.015em; display: flex; align-items: center; gap: 8px; }
.card-sub { color: var(--faint); font-size: var(--text-xs); }
.card-body { padding: 18px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; }
.grid-2-even { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.stack { display: grid; gap: 16px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

/* ── Stat cards ───────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 17px; box-shadow: var(--shadow-xs);
  position: relative; overflow: hidden;
}
.stat-label { font-size: var(--text-xs); color: var(--muted); font-weight: 500; }
.stat-value { font-size: var(--text-xl); font-weight: 600; letter-spacing: -.02em; margin-top: 8px; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-foot { font-size: var(--text-xs); color: var(--faint); margin-top: 8px; display: flex; align-items: center; gap: 5px; }
.stat-foot .up { color: var(--green-ink); font-weight: 600; }

/* ── Hero ─────────────────────────────────────────────────── */
.hero {
  position: relative; overflow: hidden;
  border: 1px solid var(--gray-200); border-radius: var(--radius);
  background:
    radial-gradient(80% 130% at 100% 0%, var(--gray-200) 0%, transparent 60%),
    linear-gradient(120deg, var(--gray-50) 0%, var(--gray-0) 55%);
  padding: 26px 28px;
  display: flex; align-items: center; gap: 28px; justify-content: space-between;
}
.hero-copy { max-width: 620px; }
.hero h2 { font-size: var(--text-lg); letter-spacing: -.03em; font-weight: 600; margin-bottom: 7px; }
.hero p { color: var(--muted); font-size: var(--text-sm); line-height: 1.55; }
.hero .page-actions { margin-top: 16px; }
.hero-art { position: relative; width: 210px; height: 120px; flex: none; display: none; }
@media (min-width: 1080px) { .hero-art { display: block; } }
.hero-bubble {
  position: absolute; background: var(--gray-0); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 9px 12px; font-size: var(--text-xs); display: flex; align-items: center; gap: 7px;
}
.hero-bubble b { font-weight: 500; }
.hero-bubble.one { right: 0; top: 0; }
.hero-bubble.two { left: 0; bottom: 4px; }
.hero-bubble .mini-dot { width: 18px; height: 18px; border-radius: var(--radius-sm); background: var(--ig); }
.hero-bubble .mini-dot.green { background: var(--green-50); border: 1px solid var(--green); }

/* ── Banners ──────────────────────────────────────────────── */
.banner {
  display: flex; gap: 12px; align-items: flex-start;
  border-radius: var(--radius); padding: 13px 15px; margin-bottom: 16px;
  border: 1px solid; font-size: var(--text-sm); line-height: 1.5;
}
.banner .icon { margin-top: 1px; }
.banner-body { flex: 1; min-width: 0; }
.banner strong { font-weight: 500; }
.banner p { color: inherit; opacity: .86; font-size: var(--text-xs); margin-top: 2px; }
.banner-actions { display: flex; gap: 7px; margin-top: 9px; flex-wrap: wrap; }
.banner.info { background: var(--gray-50); border-color: var(--gray-200); color: var(--gray-700); }
.banner.warn { background: var(--amber-50); border-color: var(--amber); color: var(--amber-ink); }
.banner.danger { background: var(--red-50); border-color: var(--red); color: var(--red-ink); }
.banner.success { background: var(--green-50); border-color: var(--green); color: var(--green-ink); }
.banner .btn { margin-top: 0; }
.banner .btn-secondary { background: rgba(255,255,255,.7); }

/* ── Pills & status ───────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  height: 23px; padding: 0 8px; border-radius: var(--radius-full);
  font-size: var(--text-xs); font-weight: 600; letter-spacing: .005em;
  background: var(--gray-100); color: var(--muted); white-space: nowrap;
}
.pill .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.pill.green { background: var(--green-50); color: var(--green-ink); }
.pill.blue { background: var(--blue-50); color: var(--blue-700); }
.pill.amber { background: var(--amber-50); color: var(--amber-ink); }
.pill.red { background: var(--red-50); color: var(--red-ink); }
.pill.violet { background: var(--violet-50); color: var(--gray-500); }
.pill.gray { background: var(--gray-100); color: var(--gray-700); }
.pill.outline { background: var(--gray-0); border: 1px solid var(--line); color: var(--muted); }
.tag-mono { font-family: var(--mono); font-size: var(--text-xs); color: var(--muted); background: var(--gray-100); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 2px 6px; }

/* ── Switch ───────────────────────────────────────────────── */
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  width: 34px; height: 20px; border-radius: var(--radius-full); background: var(--gray-300); position: relative;
  transition: background .16s; flex: none;
}
.switch-track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  background: var(--gray-0); border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.18);
  transition: transform .16s;
}
.switch input:checked + .switch-track { background: var(--blue); }
.switch input:checked + .switch-track::after { transform: translateX(14px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--blue); outline-offset: 2px; }
.switch input:disabled + .switch-track { opacity: .5; }
.switch-label { font-size: var(--text-xs); font-weight: 600; color: var(--ink-2); }

/* ── Tables ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table th {
  text-align: left; font-size: var(--text-xs); font-weight: 600; letter-spacing: 0;
  color: var(--faint); padding: 10px 18px; border-bottom: 1px solid var(--line-soft); background: var(--gray-50);
  white-space: nowrap;
}
.table td { padding: 12px 18px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover { background: var(--gray-50); }
.table .cell-main { display: flex; align-items: center; gap: 11px; min-width: 0; }
.table .cell-title { font-weight: 600; color: var(--ink); line-height: 1.3; }
.table .cell-sub { font-size: var(--text-xs); color: var(--faint); margin-top: 2px; }
.table .num { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.table .actions { text-align: right; white-space: nowrap; }
.row-chevron { color: var(--gray-400); }

.ch-icon {
  width: 34px; height: 34px; border-radius: var(--radius); flex: none;
  display: grid; place-items: center; color: var(--gray-0); font-weight: 600; font-size: var(--text-sm);
  background: var(--ig); box-shadow: inset 0 0 0 1px rgba(0,0,0,.05);
}
.ch-icon .icon { width: 17px; height: 17px; }
.ch-icon.blue { background: linear-gradient(135deg, var(--gray-500), var(--gray-700)); }
.ch-icon.dark { background: linear-gradient(135deg, var(--gray-700), var(--gray-900)); }
.ch-icon.soft { background: var(--blue-50); color: var(--blue-700); }

/* ── Empty states ─────────────────────────────────────────── */
.empty {
  text-align: center; padding: 40px 24px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.empty-art {
  width: 118px; height: 78px; margin-bottom: 14px; position: relative;
}
.empty-art .n {
  position: absolute; background: var(--gray-0); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-xs); width: 78px; height: 30px;
  display: flex; align-items: center; gap: 6px; padding: 0 8px;
  font-size: var(--text-xs); font-weight: 500; color: var(--muted); letter-spacing: 0;
}
.empty-art .n::before { content: ""; width: 14px; height: 14px; border-radius: var(--radius-sm); background: var(--blue-50); border: 1px solid var(--gray-200); }
.empty-art .n1 { left: 0; top: 6px; }
.empty-art .n2 { right: 0; bottom: 2px; }
.empty-art .n2::before { background: var(--ig); border: 0; }
.empty-art .line { position: absolute; left: 50%; top: 36px; width: 1.5px; height: 12px; background: var(--gray-300); }
.empty h3 { font-size: var(--text-sm); font-weight: 600; letter-spacing: -.015em; }
.empty p { color: var(--muted); font-size: var(--text-sm); max-width: 380px; line-height: 1.55; }
.empty .btn { margin-top: 12px; }

/* ── Checklist ────────────────────────────────────────────── */
.checklist { display: grid; gap: 0; }
.check-row { display: flex; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--line-soft); align-items: flex-start; }
.check-row:first-child { border-top: 0; }
.check-mark {
  width: 22px; height: 22px; border-radius: 50%; flex: none; margin-top: 1px;
  display: grid; place-items: center; border: 1.5px solid var(--gray-300); color: transparent;
  background: var(--gray-0); font-size: var(--text-xs);
}
.check-row.done .check-mark { background: var(--green); border-color: var(--green); color: var(--gray-0); }
.check-mark .icon { width: 12px; height: 12px; stroke-width: 2.6; }
.check-copy { flex: 1; min-width: 0; }
.check-copy strong { font-size: var(--text-sm); font-weight: 600; display: block; }
.check-row.done .check-copy strong { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--gray-400); }
.check-copy p { font-size: var(--text-xs); color: var(--faint); margin-top: 2px; }
.check-row .btn { align-self: center; }

/* ── Channel rows / cards ─────────────────────────────────── */
.ch-row { display: flex; align-items: center; gap: 12px; padding: 13px 18px; border-top: 1px solid var(--line-soft); }
.ch-row:first-child { border-top: 0; }
.ch-row-main { flex: 1; min-width: 0; }
.ch-row-main strong { font-size: var(--text-sm); font-weight: 600; display: block; }
.ch-row-main small { font-size: var(--text-xs); color: var(--faint); }
.ch-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.tk-video-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(190px,1fr)); gap: 14px; padding: 16px; }
.tk-video { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; color: inherit; text-decoration: none; background: var(--surface); }
.tk-video img { display: block; width: 100%; aspect-ratio: 9/12; object-fit: cover; background: var(--gray-100); }
.tk-video-copy { display: grid; gap: 8px; padding: 12px; }
.tk-video-copy strong { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 13px; line-height: 1.4; }
.tk-video-copy small { color: var(--muted); }
.tk-video-metrics { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 11px; }
.tk-growth-up { color: var(--green-ink); }
.tk-growth-down { color: var(--red-ink); }
.ch-card { padding: 20px; }
.ch-card-head { display: flex; align-items: flex-start; gap: 12px; }
.ch-card-head .ch-icon { width: 44px; height: 44px; border-radius: var(--radius); }
.ch-card-name { flex: 1; min-width: 0; }
.ch-card-name h3 { font-size: var(--text-md); font-weight: 600; letter-spacing: -.02em; }
.ch-card-name .muted { font-size: var(--text-xs); }
.ch-meta { margin: 16px 0; display: grid; gap: 8px; padding: 13px 0; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.ch-meta-row { display: flex; justify-content: space-between; gap: 14px; font-size: var(--text-xs); }
.ch-meta-row dt { color: var(--faint); }
.ch-meta-row dd { margin: 0; color: var(--ink-2); text-align: right; font-weight: 500; word-break: break-all; }
.ch-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Forms ────────────────────────────────────────────────── */
.field { display: grid; gap: 6px; }
.field-label { font-size: var(--text-xs); font-weight: 600; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.field-hint { font-size: var(--text-xs); color: var(--faint); line-height: 1.45; }
.field input, .field select, .field textarea {
  width: 100%; height: 38px; padding: 0 11px;
  border: 1px solid var(--gray-300); border-radius: var(--radius); background: var(--gray-0);
  font-size: var(--text-sm); color: var(--ink); transition: border-color .14s, box-shadow .14s;
}
.field textarea { height: auto; min-height: 106px; padding: 10px 11px; resize: vertical; line-height: 1.55; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(17, 24, 39, .12);
}
.field input::placeholder, .field textarea::placeholder { color: var(--gray-400); }
.field select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236c7583' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 32px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-error {
  background: var(--red-50); border: 1px solid var(--red); color: var(--red-ink);
  border-radius: var(--radius); padding: 9px 11px; font-size: var(--text-xs); margin-top: 12px;
}
.form-success { background: var(--green-50); border: 1px solid var(--green); color: var(--green-ink); border-radius: var(--radius); padding: 9px 11px; font-size: var(--text-xs); }
.counter { font-size: var(--text-xs); color: var(--faint); text-align: right; margin-top: -2px; }
.counter.warn { color: var(--amber-ink); }

/* ── Filters ──────────────────────────────────────────────── */
.toolbar { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.seg { display: inline-flex; padding: 3px; background: var(--gray-100); border-radius: var(--radius); gap: 2px; }
.seg button {
  border: 0; background: transparent; border-radius: var(--radius-sm); height: 26px; padding: 0 10px;
  font-size: var(--text-xs); font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; gap: 6px;
}
.seg button.active { background: var(--gray-0); color: var(--ink); box-shadow: 0 1px 2px rgba(16,24,40,.09); }
.seg .n { font-size: var(--text-xs); color: var(--faint); font-weight: 600; }
.seg button.active .n { color: var(--blue-700); }
.input-search { position: relative; flex: 1; min-width: 160px; max-width: 280px; margin-left: auto; }
.input-search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--faint); }
.input-search input {
  width: 100%; height: 32px; padding: 0 10px 0 32px;
  border: 1px solid var(--gray-300); border-radius: var(--radius); background: var(--gray-0); font-size: var(--text-xs);
}
.input-search input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(17, 24, 39,.12); }
.select-sm { height: 32px; border: 1px solid var(--gray-300); border-radius: var(--radius); background: var(--gray-0); font-size: var(--text-xs); padding: 0 8px; }

/* ── Flow builder ─────────────────────────────────────────── */
.flow-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 22px; background: var(--gray-0); border-bottom: 1px solid var(--line);
  position: sticky; top: 60px; z-index: 20;
}
.flow-head-main { min-width: 0; flex: 1; display: flex; align-items: center; gap: 12px; }
.flow-title { min-width: 0; }
.flow-title .crumb-line { font-size: var(--text-xs); color: var(--faint); display: flex; gap: 5px; align-items: center; }
.flow-title h1 { font-size: var(--text-md); font-weight: 600; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flow-actions { display: flex; align-items: center; gap: 10px; }
.save-state { display: inline-flex; align-items: center; gap: 5px; font-size: var(--text-xs); color: var(--faint); }
.save-state .icon { width: 13px; height: 13px; color: var(--green); }
.flow-body { display: grid; grid-template-columns: 148px minmax(0, 1fr) minmax(300px, 360px); min-height: calc(100vh - 60px - 61px); }
.palette { border-right: 1px solid var(--line); background: var(--gray-0); padding: 16px 12px; overflow-y: auto; }
.palette-label { font-size: var(--text-xs); font-weight: 500; letter-spacing: 0; color: var(--faint); padding: 0 8px 9px; }
.palette-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 8px; border: 1px solid transparent; border-radius: var(--radius);
  background: transparent; font-size: var(--text-xs); font-weight: 500; color: var(--ink-2); text-align: left;
  margin-bottom: 2px;
}
.palette-item:hover { background: var(--gray-50); }
.palette-item .p-ico { width: 26px; height: 26px; border-radius: var(--radius-sm); background: var(--gray-100); color: var(--gray-700); display: grid; place-items: center; flex: none; }
.palette-item .p-ico .icon { width: 14px; height: 14px; }
.palette-item.active { background: var(--blue-50); border-color: var(--gray-200); color: var(--blue-700); }
.palette-item.active .p-ico { background: var(--gray-0); color: var(--blue); }
.palette-item .soon { margin-left: auto; font-size: var(--text-xs); font-weight: 500; color: var(--faint); background: var(--gray-100); border-radius: var(--radius-sm); padding: 1px 4px; }
.palette-note { margin: 16px 8px 0; font-size: var(--text-xs); line-height: 1.5; color: var(--faint); border-top: 1px solid var(--line-soft); padding-top: 12px; }

.canvas {
  background-color: var(--gray-50);
  background-image: radial-gradient(var(--gray-300) 1px, transparent 1px);
  background-size: 18px 18px;
  overflow: auto; position: relative;
  padding: 28px 16px 36px;
  display: flex; flex-direction: column; align-items: center;
}
.flow-stack { display: flex; flex-direction: column; align-items: center; width: min(100%, 420px); }
.node {
  width: 100%; background: var(--gray-0); border: 1px solid var(--gray-300); border-radius: var(--radius);
  box-shadow: 0 4px 14px -6px rgba(16, 24, 40, .14), var(--shadow-xs);
  padding: 14px 15px;
  position: relative;
}
.node.selected { border-color: var(--gray-400); box-shadow: 0 0 0 3px rgba(17, 24, 39, .1), 0 4px 14px -6px rgba(16, 24, 40, .14); }
.node-top { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.node-kind {
  font-size: var(--text-xs); font-weight: 600; letter-spacing: 0; color: var(--faint);
  background: var(--gray-100); border-radius: var(--radius-sm); padding: 2px 5px;
}
.node-kind.trigger { color: var(--gray-700); background: var(--gray-100); }
.node-badge { margin-left: auto; font-size: var(--text-xs); font-weight: 600; color: var(--green-ink); background: var(--green-50); border-radius: var(--radius-full); padding: 1px 7px; display: inline-flex; gap: 4px; align-items: center; }
.node-title { display: flex; align-items: center; gap: 9px; font-size: var(--text-sm); font-weight: 500; letter-spacing: -.01em; }
.node-title .n-ico { width: 26px; height: 26px; border-radius: var(--radius); display: grid; place-items: center; color: var(--gray-0); background: var(--ig); flex: none; }
.node-title .n-ico .icon { width: 14px; height: 14px; }
.node-title .n-ico.blue { background: linear-gradient(135deg, var(--gray-400), var(--gray-500)); }
.node-copy { font-size: var(--text-xs); color: var(--muted); line-height: 1.5; margin-top: 8px; }
.node-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.node-meta .mini { font-size: var(--text-xs); color: var(--muted); background: var(--gray-100); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 2px 6px; display: inline-flex; align-items: center; gap: 4px; }
.node-meta .mini .icon { width: 11px; height: 11px; }
.bubble-preview {
  margin-top: 11px; background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: var(--radius) var(--radius) var(--radius) var(--radius-sm);
  padding: 9px 11px; font-size: var(--text-xs); color: var(--gray-700); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap;
}
.flow-link-preview { display: block; margin-top: 4px; padding: 7px 10px; text-align: center; border: 1px solid var(--line); border-radius: var(--radius); font-size: var(--text-xs); font-weight: 600; overflow-wrap: anywhere; }
.flow-buttons { margin: 12px 0; }
.flow-buttons summary { cursor: pointer; font-size: var(--text-sm); font-weight: 600; }
.flow-buttons fieldset { min-width: 0; margin-top: 10px; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius); }
.flow-buttons legend { font-size: var(--text-xs); color: var(--muted); }
.connector { width: 1.5px; height: 24px; background: var(--gray-300); position: relative; }
.connector::after {
  content: ""; position: absolute; bottom: 0; left: 50%; transform: translate(-50%, 50%);
  width: 6px; height: 6px; border-radius: 50%; background: var(--gray-300);
}
.add-step {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 22px; padding: 7px 12px; border-radius: var(--radius-full);
  border: 1px dashed var(--gray-400); background: rgba(255,255,255,.8);
  font-size: var(--text-xs); font-weight: 600; color: var(--muted);
}
.add-step:hover { border-color: var(--blue); color: var(--blue-700); background: var(--gray-0); }
.canvas-note {
  margin-top: 30px; max-width: 420px; text-align: center;
  font-size: var(--text-xs); color: var(--faint); line-height: 1.55;
  background: rgba(255,255,255,.72); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 8px 12px;
}
.inspector { border-left: 1px solid var(--line); background: var(--gray-0); padding: 18px 18px 30px; overflow-y: auto; }
.insp-section { padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--line-soft); }
.insp-section:last-child { border-bottom: 0; margin-bottom: 0; }
.insp-title { font-size: var(--text-xs); font-weight: 600; letter-spacing: .02em; color: var(--ink-2); margin-bottom: 12px; display: flex; align-items: center; gap: 7px; }
.insp-title .icon { width: 14px; height: 14px; color: var(--faint); }
.kv { display: grid; gap: 10px; }
.kv-row { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 8px; font-size: var(--text-xs); align-items: baseline; }
.kv-row dt { color: var(--faint); }
.kv-row dd { margin: 0; color: var(--ink-2); font-weight: 500; word-break: break-word; }
.insp-message { background: var(--gray-50); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 11px; font-size: var(--text-xs); line-height: 1.55; color: var(--ink-2); white-space: pre-wrap; max-height: 168px; overflow: auto; }
.insp-actions { display: grid; gap: 8px; }
.insp-actions .btn { width: 100%; }
.insp-note { font-size: var(--text-xs); color: var(--faint); line-height: 1.55; margin-top: 10px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 12px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--gray-50); }
.toggle-row strong { font-size: var(--text-xs); display: block; }
.toggle-row small { font-size: var(--text-xs); color: var(--faint); }

/* ── Insights ─────────────────────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi { padding: 17px 18px; }
.kpi-label { font-size: var(--text-xs); color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi-value { font-size: var(--text-xl); font-weight: 600; letter-spacing: -.04em; margin-top: 9px; font-variant-numeric: tabular-nums; }
.kpi-foot { font-size: var(--text-xs); color: var(--faint); margin-top: 5px; }
.chart { display: flex; align-items: flex-end; gap: 7px; height: 150px; padding: 8px 2px 0; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.chart-bar { width: 100%; max-width: 34px; border-radius: var(--radius-sm) var(--radius-sm) var(--radius-sm) var(--radius-sm); background: linear-gradient(180deg, var(--gray-400), var(--gray-500)); min-height: 3px; transition: opacity .14s; }
.chart-col:hover .chart-bar { opacity: .8; }
.chart-col .d { font-size: var(--text-xs); color: var(--faint); white-space: nowrap; }
.chart-col .v { font-size: var(--text-xs); font-weight: 500; color: var(--ink-2); opacity: 0; transition: opacity .12s; }
.chart-col:hover .v { opacity: 1; }
.donut-wrap { display: flex; align-items: center; gap: 22px; }
.donut { width: 108px; height: 108px; border-radius: 50%; position: relative; flex: none; background: conic-gradient(var(--green) calc(var(--v, 0) * 1%), var(--gray-200) 0); }
.donut::after { content: ""; position: absolute; inset: 11px; background: var(--gray-0); border-radius: 50%; }
.donut-label { position: absolute; inset: 0; display: grid; place-items: center; z-index: 2; font-size: var(--text-lg); font-weight: 600; letter-spacing: -.03em; }
.legend { display: grid; gap: 8px; font-size: var(--text-xs); }
.legend-row { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.legend-dot { width: 8px; height: 8px; border-radius: var(--radius-sm); }
.legend-row strong { color: var(--ink); font-weight: 500; margin-left: auto; }

/* ── Settings ─────────────────────────────────────────────── */
.setting-row { display: flex; gap: 20px; align-items: flex-start; padding: 18px; border-top: 1px solid var(--line-soft); }
.setting-row:first-child { border-top: 0; }
.setting-copy { flex: 1; min-width: 0; }
.setting-copy strong { font-size: var(--text-sm); font-weight: 600; display: block; }
.setting-copy p { font-size: var(--text-xs); color: var(--muted); margin-top: 3px; line-height: 1.5; }
.setting-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.legal-links { display: flex; flex-wrap: wrap; gap: 14px; font-size: var(--text-xs); color: var(--muted); padding: 16px 18px; }
.legal-links a { display: inline-flex; align-items: center; gap: 5px; }
.legal-links a:hover { color: var(--ink); }
.legal-links .icon { width: 13px; height: 13px; color: var(--faint); }

/* ── Modal ────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(17, 24, 39, .44);
  backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 7vh 18px 30px;
  animation: fade .16s ease-out;
  overflow-y: auto;
}
.modal {
  width: min(560px, 100%);
  background: var(--gray-0); border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  animation: pop .18s cubic-bezier(.2, .9, .3, 1.1);
  margin: auto 0;
}
.modal.modal-sm { width: min(440px, 100%); }
.modal.modal-lg { width: min(680px, 100%); }
.modal-head { display: flex; align-items: flex-start; gap: 14px; padding: 20px 22px 0; }
.modal-head-copy { flex: 1; min-width: 0; }
.modal-head h2 { font-size: var(--text-lg); font-weight: 600; letter-spacing: -.025em; }
.modal-head p { font-size: var(--text-xs); color: var(--muted); margin-top: 4px; line-height: 1.5; }
.modal-close { margin: -2px -6px 0 0; }
.modal-body { padding: 18px 22px 4px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 22px 20px; }
.modal-foot .left { margin-right: auto; }
.modal-icon { width: 38px; height: 38px; border-radius: var(--radius); display: grid; place-items: center; flex: none; background: var(--blue-50); color: var(--blue-700); }
.modal-icon.danger { background: var(--red-50); color: var(--red-ink); }
.modal-icon.warn { background: var(--amber-50); color: var(--amber-ink); }
.modal-icon .icon { width: 18px; height: 18px; }
.modal-note { font-size: var(--text-xs); color: var(--muted); line-height: 1.55; background: var(--gray-50); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 10px 12px; margin-top: 14px; }
.modal-note strong { color: var(--ink-2); }

/* ── Toasts ───────────────────────────────────────────────── */
.toast-stack { position: fixed; top: 16px; right: 16px; z-index: 200; display: grid; gap: 8px; width: min(340px, calc(100vw - 32px)); }
.toast {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--gray-900); color: var(--gray-0);
  border-radius: var(--radius); padding: 11px 12px;
  box-shadow: var(--shadow-md);
  animation: slideIn .22s cubic-bezier(.2, .9, .3, 1.1);
  font-size: var(--text-xs); line-height: 1.45;
}
.toast .t-ico { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--gray-400); }
.toast.success .t-ico { color: var(--green); }
.toast.error .t-ico { color: var(--red); }
.toast.warn .t-ico { color: var(--amber); }
.toast-body { flex: 1; min-width: 0; }
.toast strong { display: block; font-weight: 600; }
.toast small { color: var(--gray-400); font-size: var(--text-xs); display: block; margin-top: 2px; }
.toast button { background: transparent; border: 0; color: var(--gray-400); font-size: var(--text-xs); font-weight: 500; padding: 0; margin-top: 6px; }
.toast-close { color: var(--gray-500) !important; margin: 0 0 0 auto !important; font-size: var(--text-sm) !important; padding: 0 2px !important; }

/* ── Skeletons ────────────────────────────────────────────── */
.skeleton { background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 37%, var(--gray-200) 63%); background-size: 400% 100%; animation: shimmer 1.3s infinite; border-radius: var(--radius-sm); }
.sk-line { height: 10px; margin: 6px 0; }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(0,0,0,.12); border-top-color: var(--blue); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
.btn-primary .spinner { border-color: rgba(255,255,255,.35); border-top-color: var(--gray-0); }

/* ── Search palette ───────────────────────────────────────── */
.search-input-wrap { position: relative; }
.search-input-wrap .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search-input-wrap input {
  width: 100%; height: 46px; padding: 0 14px 0 40px; border: 1px solid var(--line);
  border-radius: var(--radius); font-size: var(--text-sm); background: var(--gray-50);
}
.search-input-wrap input:focus { outline: none; border-color: var(--blue); background: var(--gray-0); box-shadow: 0 0 0 3px rgba(17, 24, 39,.1); }
.search-results { margin-top: 8px; max-height: 340px; overflow-y: auto; }
.search-group-label { font-size: var(--text-xs); font-weight: 500; letter-spacing: 0; color: var(--faint); padding: 12px 8px 5px; }
.search-result { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; background: transparent; border: 0; border-radius: var(--radius); padding: 9px 8px; }
.search-result:hover, .search-result.active { background: var(--gray-100); }
.search-result .sr-copy { flex: 1; min-width: 0; }
.search-result strong { display: block; font-size: var(--text-sm); font-weight: 600; }
.search-result small { display: block; font-size: var(--text-xs); color: var(--faint); }
.search-empty { padding: 26px 10px; text-align: center; color: var(--faint); font-size: var(--text-xs); }
.kbd-hint { font-size: var(--text-xs); color: var(--faint); display: flex; gap: 5px; align-items: center; }
.kbd-hint kbd { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0 4px; font-family: var(--font); font-size: var(--text-xs); background: var(--gray-0); }

/* ── Utility ──────────────────────────────────────────────── */
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: var(--text-xs); }
.mono { font-family: var(--mono); font-size: var(--text-xs); }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-split { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.divider { height: 1px; background: var(--line-soft); }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.mobile-only { display: none; }

/* ── Animations ───────────────────────────────────────────── */
@keyframes rise { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 1180px) {
  .flow-body { grid-template-columns: minmax(0, 1fr) 300px; }
  .palette { display: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .grid-2, .grid-2-even, .ch-grid { grid-template-columns: minmax(0, 1fr); }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-brand { min-height: 300px; padding: 32px; }
  .auth-brand-copy { padding: 26px 0 6px; }
  .auth-brand-copy > p, .auth-points, .hero-art { display: none; }
  .auth-brand h1 { font-size: 38px; }
  .auth-panel { padding: 34px 20px 46px; }
  .flow-body { grid-template-columns: minmax(0, 1fr); }
  .inspector { border-left: 0; border-top: 1px solid var(--line); }
  .canvas { min-height: 0; }
}
@media (max-width: 840px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 262px;
    transform: translateX(-104%); transition: transform .22s ease;
    box-shadow: var(--shadow-lg);
  }
  .app.sidebar-open .sidebar { transform: none; }
  .sidebar-scrim { position: fixed; inset: 0; background: rgba(15, 20, 28, .4); z-index: 35; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 0 14px; }
  .page { padding: 20px 16px 56px; }
  .page-title { font-size: var(--text-lg); }
  .flow-head { padding: 10px 12px; flex-wrap: wrap; }
  .flow-actions { width: 100%; justify-content: flex-end; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .modal-backdrop { padding-top: 4vh; }
  .stat-value { font-size: var(--text-xl); }
  .hero { padding: 20px; }
  .ch-card { padding: 16px; }
  .setting-row { flex-direction: column; gap: 10px; }
  .setting-actions { justify-content: flex-start; }
  .btn { white-space: nowrap; }
  .table th, .table td { padding-left: 14px; padding-right: 14px; }
  .mobile-only { display: initial; }
}
@media (max-width: 520px) {
  .stats { grid-template-columns: minmax(0, 1fr); }
  .kpi-grid { grid-template-columns: minmax(0, 1fr); }
  .page-head { align-items: flex-start; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .toolbar { gap: 8px; }
  .input-search { max-width: none; width: 100%; margin-left: 0; }
  .seg { width: 100%; overflow-x: auto; scrollbar-width: none; }
  .seg::-webkit-scrollbar { display: none; }
  .seg button { flex: 0 0 auto; justify-content: center; }
  .auth-card { padding: 26px 20px 22px; }
  .flow-title h1 { font-size: var(--text-sm); }
  .flow-actions .btn span:not(.icon) { display: none; }
}

/* ── Layout refinements ───────────────────────────────────── */
.view { min-height: calc(100vh - 60px); }
.progress { width: 110px; height: 6px; border-radius: var(--radius-full); background: var(--gray-200); overflow: hidden; flex: none; }
.progress span { display: block; height: 100%; border-radius: var(--radius-full); background: var(--blue); transition: width .3s ease; }
@media (min-width: 1181px) {
  .inspector { position: sticky; top: 121px; height: calc(100vh - 121px); }
}
@media (max-width: 840px) {
  .progress { display: none; }
  .flow-body { min-height: 0; }
}

/* ── Modal viewport fit ───────────────────────────────────── */
.modal-backdrop { padding: 28px 18px; align-items: center; }
.modal {
  display: flex; flex-direction: column;
  max-height: calc(100vh - 56px);
  max-height: calc(100dvh - 56px);
  margin: 0;
}
.modal-body { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; }
.modal-head, .modal-foot { flex: none; }
.modal-foot { border-top: 1px solid var(--line-soft); padding-top: 14px; }
@media (max-width: 840px) {
  .modal-backdrop { padding: 16px 12px; }
  .modal { max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); }
  .flow-actions { flex-wrap: wrap; }
}
@media (max-width: 520px) {
  .flow-actions { gap: 6px; }
  .flow-actions .save-state { display: none; }
}

/* ── Direct preview ───────────────────────────────────────── */
.dm-preview {
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  background: linear-gradient(180deg, var(--gray-50), var(--gray-0)); margin-bottom: 4px;
}
.dm-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); background: var(--gray-0); }
.dm-head .ch-icon { width: 34px; height: 34px; border-radius: 50%; }
.dm-head-copy { flex: 1; display: grid; line-height: 1.3; }
.dm-head-copy strong { font-size: var(--text-sm); }
.dm-head-copy small { font-size: var(--text-xs); color: var(--faint); }
.dm-body { padding: 16px 14px 14px; display: grid; gap: 16px; background: radial-gradient(circle at 80% 0%, var(--gray-100), transparent 60%); }
.dm-label { display: block; font-size: var(--text-xs); font-weight: 500; letter-spacing: 0; color: var(--faint); margin-bottom: 6px; }
.dm-incoming { max-width: 88%; }
.dm-outgoing { max-width: 92%; margin-left: auto; text-align: right; }
.dm-bubble { border-radius: var(--radius); padding: 9px 12px; font-size: var(--text-xs); line-height: 1.5; white-space: pre-wrap; text-align: left; }
.dm-bubble-in { background: var(--gray-0); border: 1px solid var(--line); border-bottom-left-radius: 4px; color: var(--ink-2); display: inline-block; }
.dm-bubble-out { background: var(--blue); color: var(--gray-0); border-bottom-right-radius: 4px; display: inline-block; box-shadow: 0 2px 8px -2px rgba(17, 24, 39,.5); }
.dm-foot { display: flex; align-items: center; gap: 7px; padding: 10px 14px; border-top: 1px solid var(--line-soft); font-size: var(--text-xs); color: var(--faint); background: var(--gray-50); }
.dm-foot .icon { width: 13px; height: 13px; }

/* ── Automations: grid view ───────────────────────────────── */
.view-toggle { display: inline-flex; border: 1px solid var(--gray-300); border-radius: var(--radius); overflow: hidden; background: var(--gray-0); flex: none; }
.view-toggle button { width: 31px; height: 31px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; }
.view-toggle button:hover { background: var(--gray-100); }
.view-toggle button.active { background: var(--gray-100); color: var(--blue-700); }
.view-toggle button + button { border-left: 1px solid var(--line-soft); }
.view-toggle .icon { width: 15px; height: 15px; }
.automation-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(262px, 1fr)); gap: 14px; padding: 16px; }
.auto-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--gray-0); padding: 15px; cursor: pointer; transition: border-color .15s, box-shadow .15s; display: flex; flex-direction: column; gap: 12px; }
.auto-card:hover { border-color: var(--gray-300); box-shadow: var(--shadow-sm); }
.auto-card-top { display: flex; align-items: center; gap: 8px; }
.auto-card-top .ch-icon { width: 32px; height: 32px; }
.auto-card h3 { font-size: var(--text-sm); font-weight: 600; letter-spacing: -.02em; line-height: 1.3; }
.auto-sub { font-size: var(--text-xs); color: var(--faint); margin-top: 3px; }
.auto-card-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.auto-card-account { font-size: var(--text-xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 520px) {
  .toolbar .view-toggle { margin-left: auto; }
}

/* ── Compact tables on phones ─────────────────────────────── */
@media (max-width: 700px) {
  #automationTableWrap th:nth-child(2), #automationTableWrap td:nth-child(2),
  #automationTableWrap th:nth-child(4), #automationTableWrap td:nth-child(4),
  #automationTableWrap th:nth-child(6), #automationTableWrap td:nth-child(6) { display: none; }
  #activityZone th:nth-child(2), #activityZone td:nth-child(2),
  #activityZone th:nth-child(4), #activityZone td:nth-child(4),
  #activityZone th:nth-child(6), #activityZone td:nth-child(6) { display: none; }
  #automationTableWrap .table, #activityZone .table { table-layout: auto; }
  #automationTableWrap .table td:first-child, #activityZone .table td:first-child { padding-right: 6px; }
  .table th, .table td { padding-left: 12px; padding-right: 12px; }
}

/* ── Boot splash ──────────────────────────────────────────── */
.boot {
  position: fixed; inset: 0; z-index: 300;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: var(--gray-0); color: var(--muted); font-size: var(--text-xs);
}
.boot img { border-radius: var(--radius); }
.boot .spinner { width: 20px; height: 20px; border-width: 2px; }

@media (max-width: 380px) {
  #activityZone th:nth-child(5), #activityZone td:nth-child(5) { display: none; }
  #activityZone .table th, #activityZone .table td { padding-left: 10px; padding-right: 10px; }
  .topbar { gap: 6px; }
  .crumbs { font-size: var(--text-xs); }
}

/* ── ManyChat-style chrome ────────────────────────────────── */
.top-search {
  display: flex; align-items: center; gap: 8px;
  height: 32px; width: min(320px, 32vw); min-width: 120px;
  padding: 0 10px; margin-left: 14px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: rgba(255, 255, 255, .85);
  color: var(--muted); font-size: var(--text-xs);
  transition: border-color .14s, box-shadow .14s, background .14s;
}
.top-search:hover { background: var(--gray-0); border-color: var(--gray-300); }
.top-search .icon { width: 15px; height: 15px; color: var(--faint); flex: none; }
.top-search-label { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-search kbd {
  font-family: var(--font); font-size: var(--text-xs); color: var(--faint);
  background: var(--gray-100); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1px 4px;
}
@media (max-width: 1180px) { .top-search { width: 220px; } }
@media (max-width: 980px) { .top-search { width: 180px; } .top-search kbd { display: none; } }
@media (max-width: 840px) {
  .top-search { width: 34px; min-width: 34px; padding: 0; justify-content: center; margin-left: 6px; }
  .top-search-label { display: none; }
}
@media (max-width: 520px) { .top-actions a[href^="mailto"] { display: none; } }

/* ── Automation folder rail ───────────────────────────────── */
.automation-layout { display: grid; grid-template-columns: 218px minmax(0, 1fr); align-items: stretch; }
.filter-rail {
  border-right: 1px solid var(--line-soft);
  padding: 14px 10px 18px;
  background: var(--gray-50);
  border-radius: var(--radius) 0 0 var(--radius);
  min-width: 0;
}
.automation-main { min-width: 0; }
.rail-heading {
  font-size: var(--text-xs); font-weight: 600; letter-spacing: 0;
  color: var(--faint); padding: 3px 9px 9px;
}
.rail-label {
  font-size: var(--text-xs); font-weight: 500; letter-spacing: 0;
  color: var(--gray-400); padding: 16px 9px 6px;
}
.rail-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 7px 9px; margin-bottom: 1px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; font-size: var(--text-xs); font-weight: 500; color: var(--ink-2);
  text-align: left; min-width: 0;
}
.rail-item:hover { background: var(--gray-100); }
.rail-item.active { background: var(--gray-0); border-color: var(--line); color: var(--blue-700); font-weight: 600; box-shadow: var(--shadow-xs); }
.rail-ico { width: 22px; height: 22px; border-radius: var(--radius-sm); display: grid; place-items: center; color: var(--gray-500); background: var(--gray-100); flex: none; }
.rail-ico .icon { width: 13px; height: 13px; }
.rail-ico.soft { background: linear-gradient(135deg, var(--gray-200), var(--gray-100)); color: var(--gray-500); }
.rail-item.active .rail-ico { background: var(--blue-50); color: var(--blue-700); }
.rail-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-count { font-size: var(--text-xs); font-weight: 500; color: var(--faint); background: var(--gray-0); border: 1px solid var(--line-soft); border-radius: var(--radius-full); padding: 0 6px; min-width: 20px; text-align: center; }
.rail-item.active .rail-count { color: var(--blue-700); border-color: var(--gray-200); background: var(--gray-50); }
.rail-note { font-size: var(--text-xs); line-height: 1.5; color: var(--faint); padding: 18px 9px 0; margin-top: 14px; border-top: 1px solid var(--line-soft); }
.automation-mobile-tabs { display: none; }
.filter-chipbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 16px; border-bottom: 1px solid var(--line-soft);
  background: var(--gray-50); font-size: var(--text-xs); color: var(--muted);
}
.filter-chipbar span { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.filter-chipbar .icon { width: 13px; height: 13px; }
.filter-chipbar strong { color: var(--ink-2); font-weight: 600; }
@media (max-width: 1180px) {
  .automation-layout { grid-template-columns: minmax(0, 1fr); }
  .filter-rail { display: none; }
  .automation-mobile-tabs { display: inline-flex; }
}
@media (max-width: 520px) {
  .automation-mobile-tabs { width: 100%; overflow-x: auto; scrollbar-width: none; }
}

/* ── Insights channel cards ───────────────────────────────── */
.insight-channels {
  display: flex; gap: 10px; overflow-x: auto;
  padding: 14px 16px; border-bottom: 1px solid var(--line-soft);
  scrollbar-width: thin;
}
.insight-channel {
  display: flex; align-items: center; gap: 10px;
  width: 250px; min-width: 250px; max-width: 250px; flex: 0 0 250px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--gray-0); text-align: left;
  transition: border-color .14s, box-shadow .14s, background .14s;
}
.insight-channel:hover { border-color: var(--gray-300); box-shadow: var(--shadow-xs); }
.insight-channel.active { border-color: var(--gray-300); background: var(--gray-50); box-shadow: 0 0 0 3px rgba(17, 24, 39, .07); }
.insight-channel .ch-icon { width: 34px; height: 34px; border-radius: var(--radius); }
.insight-channel-copy { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.insight-channel-copy strong { font-size: var(--text-sm); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.insight-channel-copy small { font-size: var(--text-xs); color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.insight-check {
  width: 20px; height: 20px; border-radius: 50%; flex: none;
  background: var(--blue); color: var(--gray-0); display: grid; place-items: center;
}
.insight-check .icon { width: 11px; height: 11px; stroke-width: 2.8; }
.insight-channels .pill { flex: none; }
@media (max-width: 520px) {
  .insight-channel { width: 232px; min-width: 232px; max-width: 232px; flex-basis: 232px; }
  .insight-channels { padding: 12px; }
}

.automation-toolbar .input-search { margin-left: 0; }
.automation-toolbar .view-toggle { margin-left: auto; }
@media (max-width: 840px) {
  .sidebar { background: var(--gray-0); }
}

/* Keep breadcrumbs on one line */
.crumbs { white-space: nowrap; overflow: hidden; }
.crumbs a { white-space: nowrap; }
@media (max-width: 560px) {
  .crumbs a, .crumbs .crumb-sep { display: none; }
  .crumbs .crumb-current { max-width: 100%; }
}
@media (max-width: 360px) {
  #automationTableWrap th:nth-child(3), #automationTableWrap td:nth-child(3) { display: none; }
  #activityZone th:nth-child(3), #activityZone td:nth-child(3) { display: none; }
}

.ws { border-bottom: 1px solid var(--line-soft); margin-bottom: 8px; }

/* ── Flow steps ───────────────────────────────────────────── */
.palette-item.is-soon { color: var(--faint); }
.palette-item.is-soon .p-ico { color: var(--faint); background: var(--gray-100); }
.palette-item .soon.add { color: var(--blue-700); background: var(--blue-50); font-weight: 500; }
.node-kind.condition { color: var(--gray-500); background: var(--gray-100); }
.node-kind.delay { color: var(--amber-ink); background: var(--amber-50); }
.node-kind.tag { color: var(--green-ink); background: var(--green-50); }
.node-kind.action { color: var(--blue-700); background: var(--blue-50); }
.n-ico.violet { background: linear-gradient(135deg, var(--gray-400), var(--gray-500)); }
.n-ico.amber { background: linear-gradient(135deg, var(--amber), var(--amber)); }
.n-ico.green { background: linear-gradient(135deg, var(--green), var(--green-ink)); }
.step-node { cursor: pointer; }
.node-edit { margin-left: auto; color: var(--gray-400); opacity: 0; transition: opacity .12s; display: grid; place-items: center; }
.node-edit .icon { width: 14px; height: 14px; }
.step-node:hover .node-edit, .step-node.selected .node-edit { opacity: 1; }
.step-node.selected { border-color: var(--gray-400); box-shadow: 0 0 0 3px rgba(17, 24, 39, .1), 0 4px 14px -6px rgba(16, 24, 40, .14); }
.step-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 10px; }
.step-grid-wide { grid-column: 1 / -1; }
.step-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.step-actions .btn { padding: 0 9px; }
.step-actions .btn-danger { margin-left: auto; }
.delay-presets { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.inspector .field-label { font-size: var(--text-xs); }
.inspector .field input, .inspector .field select { height: 34px; font-size: var(--text-xs); }
.inspector .field textarea { min-height: 120px; font-size: var(--text-xs); }
.inspector .counter { font-size: var(--text-xs); }
.inspector .form-error { font-size: var(--text-xs); }
.inspector .field-hint { font-size: var(--text-xs); }
@media (max-width: 1280px) {
  .inspector .step-actions .btn-danger { margin-left: 0; }
}
.block-choices { display: grid; gap: 8px; margin-bottom: 6px; }
.block-choice {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 12px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--gray-0); text-align: left; transition: border-color .14s, background .14s, box-shadow .14s;
}
.block-choice:hover { border-color: var(--gray-300); background: var(--gray-50); box-shadow: var(--shadow-xs); }
.block-choice > .icon:last-child { color: var(--gray-400); margin-left: auto; }
.block-choice-ico { width: 34px; height: 34px; border-radius: var(--radius); background: var(--blue-50); color: var(--blue-700); display: grid; place-items: center; flex: none; }
.block-choice span:nth-child(2) { flex: 1; display: grid; gap: 2px; }
.block-choice strong { font-size: var(--text-sm); font-weight: 600; }
.block-choice small { font-size: var(--text-xs); color: var(--faint); line-height: 1.4; }

/* ── Contacts ─────────────────────────────────────────────── */
.contact-summary { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.contact-summary .pill .icon { width: 12px; height: 12px; }
.contact-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--gray-200), var(--gray-100));
  color: var(--gray-700); font-size: var(--text-sm); font-weight: 600;
  border: 1px solid var(--gray-200);
}
.tag-list { display: flex; flex-wrap: wrap; gap: 4px; }
.contacts-table td { vertical-align: middle; }
.contact-skeletons { display: grid; gap: 16px; }
.skeleton-row { display: flex; align-items: center; gap: 12px; }
.skeleton-row > span:nth-child(2) { flex: 1; display: grid; gap: 6px; }
.contacts-table .pill { height: 21px; font-size: var(--text-xs); }
@media (max-width: 700px) {
  #contactsZone .contacts-table th:nth-child(2), #contactsZone .contacts-table td:nth-child(2),
  #contactsZone .contacts-table th:nth-child(4), #contactsZone .contacts-table td:nth-child(4),
  #contactsZone .contacts-table th:nth-child(5), #contactsZone .contacts-table td:nth-child(5) { display: none; }
  .toolbar .contact-summary { width: 100%; }
}

.node-title { overflow-wrap: anywhere; }

/* ── Minimal additions ── */
.stats.stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.empty.empty-sm { padding: 32px 20px; gap: 12px; }
.card-head { padding: 14px 16px; }
.link-btn { font-size: var(--text-xs); color: var(--muted); font-weight: 500; }
.link-btn:hover { color: var(--ink); }
@media (max-width: 720px) {
  .stats.stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .stats.stats-3 .stat { padding: 12px; }
  .stats.stats-3 .stat-value { font-size: var(--text-lg); }
  .hide-sm { display: none; }
}

/* ── Utilities (replace inline styles) ── */
.u-lh { line-height: 1.6; } .u-mt4 { margin-top: 4px; } .u-mt8 { margin-top: 8px; } .u-mt12 { margin-top: 12px; }
.u-mt0 { margin-top: 0; } .u-m0 { margin: 0; } .u-mb0 { margin-bottom: 0; } .u-mb8 { margin-bottom: 8px; }
.u-minw0 { min-width: 0; } .u-right { text-align: right; } .u-mlauto { margin-left: auto; }
.u-pad { padding: 16px; } .u-pad-lg { padding: 32px 20px; } .u-gap12 { gap: 12px; }
.u-foot { padding: 12px 16px; border-top: 1px solid var(--line-soft); }
.u-text-xs { font-size: var(--text-xs); } .u-text-sm { font-size: var(--text-sm); } .u-radius { border-radius: var(--radius); }
.u-bg-gray { background: var(--gray-300); } .u-bg-red { background: var(--red); } .u-bg-green { background: var(--green); }
.u-stack-end { text-align: right; display: grid; gap: 4px; justify-items: end; }
.u-row38 { height: 38px; display: flex; align-items: center; gap: 8px; }

/* ── Consistency pass: one look for every component ── */
.table th, .insp-title, .node-kind, .palette-label, .search-group-label, .dm-label { color: var(--muted); font-weight: 500; }
.insp-title .icon { display: none; }
.node { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: none; }
.node.selected { border-color: var(--ink); box-shadow: none; }
.node-kind, .node-kind.trigger { background: none; padding: 0; }
.node-title .n-ico, .node-title .n-ico.blue { background: var(--gray-100); color: var(--ink); }
.canvas { background: var(--bg); background-image: none; }
.chart-bar { background: var(--ink); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.donut { background: conic-gradient(var(--ink) calc(var(--v, 0) * 1%), var(--gray-200) 0); }
.insight-channel { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: none; min-width: 220px; }
.insight-channel:hover { box-shadow: none; }
.insight-channel.active, .insight-channel[aria-pressed="true"] { border-color: var(--ink); box-shadow: none; }
.modal, .dialog { border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.banner { border-radius: var(--radius); }
.insight-channel { flex: none; }
.insight-check { color: var(--surface); }

/* Flat icon tiles everywhere */
.ch-icon.blue, .ch-icon.dark, .ch-icon.soft, .rail-ico.soft, .n-ico.violet, .n-ico.amber, .n-ico.green { background: var(--gray-100); color: var(--ink); }

/* ── Cal.com-style shell ── */
.sidebar { background: var(--surface); padding: 12px 8px; }
.ws { padding: 4px 8px 12px; gap: 8px; }
.ws .avatar { width: 24px; height: 24px; font-size: var(--text-xs); }
.ws-name { font-size: var(--text-sm); font-weight: 600; }
.side-search { display: flex; align-items: center; gap: 8px; width: 100%; height: 32px; padding: 0 10px; margin-bottom: 8px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--muted); font-size: var(--text-sm); }
.side-search .icon { width: 15px; height: 15px; }
.side-search span:nth-child(2) { flex: 1; text-align: left; }
.side-search kbd { font: inherit; font-size: var(--text-xs); color: var(--faint); }
.side-search:hover { border-color: var(--gray-300); }
.nav-item { height: 32px; gap: 8px; font-weight: 500; color: var(--ink-2); width: 100%; border: 0; background: none; text-align: left; }
.nav-item .icon { width: 16px; height: 16px; }
.nav-item:hover { background: var(--gray-100); }
.nav-item.active { background: var(--gray-100); color: var(--ink); font-weight: 500; box-shadow: none; }
.nav-item.active .nav-ico { color: var(--ink); }
.nav-count { color: var(--muted); background: none; border: 0; }
.sidebar-foot { margin-top: auto; gap: 0; }
.topbar { background: var(--surface); height: 52px; padding: 0 16px; }
.topbar .crumbs, .topbar .top-search, .topbar .top-actions a[href^="mailto"] { display: none; }
@media (min-width: 841px) { .topbar { display: none; } }
.brand-mono { filter: grayscale(1) contrast(1.4) brightness(.55); }
/* Minimal Instagram mark: outline glyph on a plain tile */
:root { --ig: var(--surface); }
.ch-icon, .node-title .n-ico { color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.ch-icon .icon { width: 16px; height: 16px; stroke-width: 1.6; }
/* Instagram glyph keeps its brand gradient, no filled tile */
.ch-icon:not(.blue):not(.soft):not(.dark) .icon, .node-title .n-ico:not(.blue):not(.violet):not(.amber):not(.green) .icon { stroke: url(#igGrad); }

/* ═════════════════════════════════════════════════════════════
   Cal.com parity layer — values copied from calcom/cal.com
   packages/config/theme/tokens.css + packages/ui/components/*
   ═════════════════════════════════════════════════════════════ */
:root {
  --cal-bg: hsla(0, 0%, 100%, 1);
  --cal-bg-muted: hsla(210, 20%, 97%, 1);
  --cal-bg-subtle: hsla(220, 14%, 94%, 1);
  --cal-bg-emphasis: hsla(220, 13%, 91%, 1);
  --cal-brand: hsla(214, 30%, 16%, 1);
  --cal-brand-emphasis: hsla(220, 6%, 25%, 1);
  --cal-border: hsla(216, 12%, 84%, 1);
  --cal-border-subtle: hsla(220, 13%, 91%, 1);
  --cal-border-emphasis: hsla(218, 11%, 65%, 1);
  --cal-text-emphasis: hsla(210, 30%, 4%, 1);
  --cal-text: hsla(220, 6%, 25%, 1);
  --cal-text-subtle: hsla(220, 9%, 46%, 1);
  --cal-text-muted: hsla(218, 11%, 65%, 1);
  --cal-success-bg: hsla(142, 76%, 94%, 1);  --cal-success-text: hsla(144, 34%, 24%, 1);
  --cal-error-bg: hsla(3, 66%, 93%, 1);      --cal-error-text: hsla(0, 63%, 31%, 1);
  --cal-attention-bg: hsla(33, 100%, 92%, 1);--cal-attention-text: hsla(16, 62%, 28%, 1);
  --cal-info-bg: hsla(221, 91%, 93%, 1);     --cal-info-text: hsla(225, 57%, 33%, 1);
  --shadow-outline-gray-rested: 0 2px 3px 0 rgba(0,0,0,.03), 0 2px 2px -1px rgba(0,0,0,.03);
  --shadow-outline-gray-active: 0 2px 1px 0 rgba(0,0,0,.05) inset;
  --shadow-outline-gray-focused: 0 0 0 1px rgba(255,255,255,.2), 0 0 0 2px rgba(0,0,0,.1);
  --shadow-brand: 0 2px 3px 0 rgba(0,0,0,.06), 0 1px 1px 0 rgba(0,0,0,.08), 1px 4px 8px 0 rgba(0,0,0,.12), 0 2px .4px 0 rgba(255,255,255,.12) inset, 0 -3px 2px 0 rgba(0,0,0,.04) inset;
  --shadow-brand-hover: 0 1px 1px 0 rgba(0,0,0,.1), 0 2px 3px 0 rgba(0,0,0,.08), 1px 4px 8px 0 rgba(0,0,0,.12), 0 -3px 2px 0 rgba(0,0,0,.1) inset, 0 2px .4px 0 rgba(255,255,255,.24) inset;
  --shadow-brand-active: 0 3px 1px 0 rgba(0,0,0,.1) inset, 0 0 2px 0 rgba(0,0,0,.1) inset;

  /* remap app tokens onto Cal tokens */
  --ink: var(--cal-text-emphasis);
  --ink-2: var(--cal-text);
  --muted: var(--cal-text-subtle);
  --faint: var(--cal-text-muted);
  --line: var(--cal-border-subtle);
  --line-soft: var(--cal-border-subtle);
  --bg: var(--cal-bg);
  --surface: var(--cal-bg);
  --blue: var(--cal-brand);
  --blue-600: var(--cal-brand-emphasis);
  --blue-700: var(--cal-text-emphasis);
  --green-50: var(--cal-success-bg); --green-ink: var(--cal-success-text);
  --red-50: var(--cal-error-bg);     --red-ink: var(--cal-error-text);
  --amber-50: var(--cal-attention-bg); --amber-ink: var(--cal-attention-text);
}
body { background: var(--cal-bg); color: var(--cal-text); }

/* Shell: muted sidebar, white content (Cal Shell) */
.sidebar { background: var(--cal-bg-muted); border-right: 1px solid var(--cal-border-subtle); }
.nav-item { height: 34px; padding: 0 8px; border-radius: 6px; font-size: 14px; font-weight: 500; color: var(--cal-text); }
.nav-item:hover { background: var(--cal-bg-subtle); color: var(--cal-text-emphasis); }
.nav-item.active { background: var(--cal-bg-emphasis); color: var(--cal-text-emphasis); }
.nav-ico, .nav-item.active .nav-ico { color: inherit; }
.side-search { border-radius: 10px; border-color: var(--cal-border); box-shadow: var(--shadow-outline-gray-rested); background: var(--cal-bg); }

/* Page heading (Cal: text-xl font-semibold, subtitle text-sm subtle) */
.page { padding: 32px 32px 72px; }
.page-title { font-size: 20px; font-weight: 600; letter-spacing: 0; color: var(--cal-text-emphasis); line-height: 1.4; }
.page-head { margin-bottom: 24px; align-items: center; }

/* Button — Cal buttonClasses */
.btn { height: 36px; padding: 0 10px; gap: 4px; border-radius: 10px; font-size: 14px; font-weight: 500; line-height: 1; border: 1px solid transparent; transition: box-shadow .1s, background .1s; }
.btn:active { transform: none; }
.btn:disabled { opacity: .3; }
.btn-sm { height: 28px; padding: 0 8px; font-size: 14px; border-radius: 10px; }
.btn-lg { height: 40px; padding: 0 12px; border-radius: 10px; font-size: 14px; }
.btn-primary { background: var(--cal-brand); color: #fff; border-color: var(--cal-brand); box-shadow: var(--shadow-brand); }
.btn-primary:hover { background: var(--cal-brand-emphasis); box-shadow: var(--shadow-brand-hover); }
.btn-primary:active { box-shadow: var(--shadow-brand-active); }
.btn-secondary { background: var(--cal-bg); color: var(--cal-text); border-color: var(--cal-border); box-shadow: var(--shadow-outline-gray-rested); }
.btn-secondary:hover { background: var(--cal-bg-muted); color: var(--cal-text-emphasis); border-color: var(--cal-border); }
.btn-secondary:active { box-shadow: var(--shadow-outline-gray-active); }
.btn-ghost { color: var(--cal-text-subtle); border-color: transparent; }
.btn-ghost:hover { background: var(--cal-bg-subtle); color: var(--cal-text-emphasis); border-color: var(--cal-border-subtle); }
.btn-danger { background: var(--cal-bg); color: var(--cal-error-text); border-color: var(--cal-border); box-shadow: var(--shadow-outline-gray-rested); }
.btn-danger:hover { background: var(--cal-error-bg); border-color: hsla(0, 96%, 89%, 1); }
.btn-danger-solid { background: hsla(0, 63%, 31%, 1); color: #fff; border-color: transparent; }
.icon-btn { border-radius: 10px; }
.icon-btn:hover { background: var(--cal-bg-subtle); }

/* Badge — Cal badgeStyles (rounded-[4px], text-xs, py-1 px-1.5) */
.pill { border-radius: 4px; padding: 4px 6px; font-size: 12px; font-weight: 500; line-height: 1; gap: 4px; border: 0; }
.pill .dot { display: none; }
.pill.green { background: var(--cal-success-bg); color: var(--cal-success-text); }
.pill.red { background: var(--cal-error-bg); color: var(--cal-error-text); }
.pill.amber { background: var(--cal-attention-bg); color: var(--cal-attention-text); }
.pill.blue { background: var(--cal-info-bg); color: var(--cal-info-text); }
.pill.gray, .pill.violet, .pill.outline { background: var(--cal-bg-emphasis); color: var(--cal-text-emphasis); border: 0; }

/* Inputs — Cal inputStyles (rounded-[10px], border-default, shadow rested) */
.field input, .field select, .field textarea, input[type="search"], .search-input, .list-search input {
  border-radius: 10px; border: 1px solid var(--cal-border); background: var(--cal-bg); color: var(--cal-text);
  box-shadow: var(--shadow-outline-gray-rested); font-size: 14px;
}
.field input, .field select { height: 36px; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--cal-border-emphasis); }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--cal-border-emphasis); box-shadow: var(--shadow-outline-gray-focused); outline: none; }
.field input::placeholder, .field textarea::placeholder { color: var(--cal-text-muted); }
.field-label { font-size: 14px; font-weight: 500; color: var(--cal-text-emphasis); }
.field-hint { font-size: 14px; color: var(--cal-text-subtle); }

/* Switch — Cal Switch (brand track, white thumb) */
.switch input:checked + .switch-track { background: var(--cal-brand); }
.switch-track { background: var(--cal-bg-emphasis); }

/* Segmented control / tabs — Cal SegmentedControl */
.seg { background: var(--cal-bg-muted); border: 1px solid var(--cal-border-subtle); border-radius: 10px; padding: 2px; }
.seg button { border-radius: 8px; font-size: 14px; font-weight: 500; color: var(--cal-text-subtle); }
.seg button.active { background: var(--cal-bg); color: var(--cal-text-emphasis); box-shadow: var(--shadow-outline-gray-rested); }
.seg button.active .n, .seg .n { color: var(--cal-text-muted); font-weight: 500; }

/* Cards / lists — Cal: rounded-md border-subtle, no shadow, list rows divided */
.card, .stat, .node, .insight-channel, .ch-card { border: 1px solid var(--cal-border-subtle); border-radius: 12px; box-shadow: none; background: var(--cal-bg); }
.card-head { border-bottom: 1px solid var(--cal-border-subtle); }
.card-title { font-size: 14px; font-weight: 600; color: var(--cal-text-emphasis); }
.stat-label { font-size: 14px; color: var(--cal-text-subtle); font-weight: 500; }
.stat-value { color: var(--cal-text-emphasis); font-weight: 600; }
.table th { background: var(--cal-bg-muted); font-size: 12px; font-weight: 500; color: var(--cal-text-subtle); border-bottom: 1px solid var(--cal-border-subtle); }
.table td { border-bottom: 1px solid var(--cal-border-subtle); }
.cell-title { font-size: 14px; font-weight: 600; color: var(--cal-text-emphasis); }
.cell-sub { font-size: 14px; color: var(--cal-text-subtle); }

/* Empty screen — Cal EmptyScreen (72px round icon, text-xl heading) */
.empty { border: 1px dashed var(--cal-border-subtle); border-radius: 8px; margin: 16px; padding: 28px; }
.empty h3 { font-size: 20px; font-weight: 600; color: var(--cal-text-emphasis); }
.empty p { font-size: 14px; color: var(--cal-text); line-height: 1.5rem; }

/* Banner — Cal Alert (rounded-md, semantic subtle bg, no border) */
.banner { border-radius: 10px; border: 0; }
.banner.info { background: var(--cal-bg-muted); color: var(--cal-text); }
.banner.warn { background: var(--cal-attention-bg); color: var(--cal-attention-text); }
.banner.danger { background: var(--cal-error-bg); color: var(--cal-error-text); }
.banner.success { background: var(--cal-success-bg); color: var(--cal-success-text); }

/* Dialog — Cal Dialog (rounded-2xl, p-6) */
.modal { border-radius: 16px; border: 0; }
.modal-backdrop { background: rgba(0, 0, 0, .4); }
.modal-note { background: var(--cal-bg-muted); border: 0; border-radius: 10px; color: var(--cal-text-subtle); }

/* Avatar — Cal Avatar (rounded-full, bg-emphasis) */
.avatar { background: var(--cal-bg-emphasis); color: var(--cal-text-emphasis); border: 0; }

/* Focus ring — Cal shadow-outline-gray-focused */
:where(a, button, input, select, textarea, [tabindex]):focus-visible { outline: none; box-shadow: var(--shadow-outline-gray-focused); }

/* Display font for headings — Cal Sans-like geometric sans (Plus Jakarta Sans, OFL) */
:root { --font-display: "Plus Jakarta Sans", var(--font); }
.page-title, .auth-card h2, .empty h3, .modal-head h2, .modal-title, .stat-value {
  font-family: var(--font-display); font-weight: 700; letter-spacing: -0.02em;
}
.page-title { font-size: 22px; }

/* Keep the message editor visible before the flow on narrow screens. */
.flow-body > * { min-width: 0; }
#stepForm > .field + .field { margin-top: 14px; }
.step-node .node-top > .btn { margin-left: auto; }
@media (max-width: 980px) {
  .flow-body .inspector { grid-row: 1; border-top: 0; }
  .flow-body .canvas { padding: 20px 12px 28px; }
}

/* Automation detail */
.flow-head { position: static; padding: 16px clamp(16px, 4vw, 48px); }
.flow-title h1 { font-size: clamp(18px, 3vw, 24px); white-space: normal; }
.flow-title .crumb-line { margin-top: 4px; }
.flow-body {
  grid-template-columns: minmax(0, 560px) minmax(260px, 420px);
  align-items: start;
  gap: clamp(16px, 4vw, 48px);
  max-width: 1120px;
  min-height: 0;
  margin: 0 auto;
  padding: clamp(16px, 4vw, 48px);
}
.flow-body .inspector {
  position: static;
  height: auto;
  padding: clamp(16px, 3vw, 28px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: visible;
}
.flow-body .canvas { padding: 0; overflow: visible; }
.flow-body .insp-title { font-size: 16px; }
.flow-buttons [hidden] { display: none; }
.flow-buttons fieldset { display: grid; gap: 8px; padding: 12px; margin-bottom: 10px; }
.flow-buttons fieldset button { justify-self: start; }
@media (max-width: 980px) {
  .flow-body { grid-template-columns: minmax(0, 1fr); max-width: 620px; }
  .flow-body .canvas { padding: 0; }
}

.flow-reaction { margin-top: 14px; }
.flow-reaction input { flex: none; accent-color: var(--ink); }

.public-reply-variants { min-width: 0; display: grid; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.public-reply-variants legend { padding: 0 4px; }
.inspector .public-reply-variants textarea { min-height: 64px; }

/* ── Inbox ─────────────────────────────────────────────────── */
.inbox { display: grid; grid-template-columns: minmax(240px, 320px) 1fr; min-height: 560px; height: calc(100vh - 190px); overflow: hidden; padding: 0; }
.inbox-list { border-right: 1px solid var(--line-soft); display: flex; flex-direction: column; min-height: 0; }
.inbox-list #inboxListZone { overflow-y: auto; flex: 1; }
.inbox-items { list-style: none; margin: 0; padding: 4px; }
.inbox-item { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--radius); color: inherit; text-decoration: none; }
.inbox-item:hover { background: var(--gray-50); }
.inbox-item.active { background: var(--gray-100); }
.inbox-item-copy { flex: 1; min-width: 0; display: grid; gap: 2px; }
.inbox-item-top { display: flex; justify-content: space-between; gap: 8px; font-size: var(--text-sm); }
.inbox-item-top small { color: var(--faint); font-size: var(--text-xs); white-space: nowrap; }
.inbox-item-text { font-size: var(--text-xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.inbox-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
.inbox-head > div { display: grid; line-height: 1.35; }
.inbox-head small { font-size: var(--text-xs); }
.inbox-banner { display: flex; align-items: center; gap: 8px; padding: 8px 16px; font-size: var(--text-xs); color: var(--muted); background: var(--gray-50); border-bottom: 1px solid var(--line-soft); }
.inbox-banner .icon { width: 14px; height: 14px; }
.inbox-messages { flex: 1; overflow-y: auto; padding: 16px; display: grid; gap: 12px; align-content: start; }
.inbox-time { display: block; font-size: 11px; margin-top: 3px; }
.inbox-compose { display: flex; gap: 8px; align-items: flex-end; padding: 12px 16px; border-top: 1px solid var(--line-soft); }
.inbox-compose textarea { flex: 1; resize: vertical; min-height: 44px; }
@media (max-width: 840px) {
  .inbox { grid-template-columns: 1fr; height: auto; }
  .inbox-list { border-right: 0; border-bottom: 1px solid var(--line-soft); max-height: 280px; }
  .inbox-messages { max-height: 60vh; }
}

.field[hidden], .modal-note[hidden], #naInsight[hidden] { display: none !important; }

/* ── Flow editor ───────────────────────────────────────────── */
.fe { display: flex; flex-direction: column; height: calc(100vh - 60px); min-height: 520px; min-width: 0; max-width: 100%; }
.fe-top { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line-soft); background: var(--gray-0); flex-wrap: wrap; }
.fe-title { flex: 1; min-width: 180px; display: grid; line-height: 1.3; }
.fe-title h1 { font-size: var(--text-md, 16px); margin: 0; }
.fe-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fe-state { font-size: var(--text-xs); color: var(--faint); }
.fe-main { flex: 1; display: flex; min-height: 0; position: relative; }
.fe-canvas { flex: 1; min-width: 0; overflow: auto; position: relative; cursor: grab; user-select: none; background-color: var(--gray-50); background-image: radial-gradient(var(--gray-300) 1px, transparent 1px); background-size: 18px 18px; }
.fe-columns { display: flex; gap: 72px; padding: 32px; align-items: flex-start; position: relative; z-index: 1; width: max-content; min-height: 100%; }
.fe-col { display: flex; flex-direction: column; gap: 24px; }
.fe-edges { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 0; overflow: visible; }
.fe-edges path { fill: none; stroke: var(--gray-400, #9ca3af); stroke-width: 1.6; }
.fe-edges path.back { stroke-dasharray: 5 4; }
.fe-node { width: 260px; background: var(--gray-0); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 2px 10px -6px rgba(17, 24, 39, .35); cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.fe-node:hover { border-color: var(--gray-400, #9ca3af); }
.fe-node.selected { border-color: var(--gray-900); box-shadow: 0 0 0 3px var(--gray-200, #e5e7eb); }
.fe-node.orphan { opacity: .75; border-style: dashed; }
.fe-node:focus-visible { outline: 2px solid var(--gray-900); outline-offset: 2px; }
.fe-node header { display: flex; align-items: center; gap: 8px; padding: 10px 12px 6px; font-size: var(--text-sm); }
.fe-node header .pill { margin-left: auto; }
.fe-ico { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--gray-100); color: var(--gray-700); }
.fe-ico .icon { width: 15px; height: 15px; }
.fe-ico.blue { background: #e8efff; color: #2453d6; }
.fe-ico.violet { background: #f1e9ff; color: #7c3aed; }
.fe-ico.green { background: var(--green-50); color: var(--green-ink); }
.fe-ico.amber { background: var(--amber-50); color: var(--amber-ink); }
.fe-ico.pink { background: #fde8f1; color: #c2185b; }
.fe-body { padding: 2px 12px 10px; display: grid; gap: 8px; }
.fe-bubble { background: var(--gray-100); border-radius: 12px; padding: 8px 10px; font-size: var(--text-xs); line-height: 1.5; white-space: pre-wrap; max-height: 9.5em; overflow: hidden; }
.fe-btns { display: grid; gap: 4px; }
.fe-btn { display: flex; align-items: center; justify-content: center; gap: 4px; border: 1px solid var(--line); border-radius: 8px; padding: 5px; font-size: var(--text-xs); font-weight: 500; color: #2453d6; }
.fe-btn .icon { width: 12px; height: 12px; }
.fe-copy { margin: 0; font-size: var(--text-xs); color: var(--ink-2, inherit); line-height: 1.5; }
.fe-when { font-size: var(--text-xs); line-height: 1.5; background: #fff5f9; border: 1px solid #f9d3e3; border-radius: 10px; padding: 8px 10px; }
.fe-ports { border-top: 1px solid var(--line-soft); padding: 4px 0; }
.fe-port { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 18px 5px 12px; font-size: var(--text-xs); color: var(--muted); }
.fe-port-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fe-goto { display: inline-flex; align-items: center; gap: 2px; color: var(--faint); white-space: nowrap; }
.fe-goto .icon { width: 11px; height: 11px; }
.fe-dot { position: absolute; right: -6px; top: 50%; width: 11px; height: 11px; margin-top: -5.5px; border-radius: 50%; background: var(--gray-0); border: 2px solid var(--gray-500, #6b7280); }
.fe-add { width: 22px; height: 22px; border-radius: 50%; border: 1px dashed var(--gray-400, #9ca3af); background: var(--gray-0); display: grid; place-items: center; color: var(--muted); cursor: pointer; }
.fe-add:hover { border-style: solid; color: var(--gray-900); }
.fe-add .icon { width: 12px; height: 12px; }
.fe-panel { width: 340px; flex: none; border-left: 1px solid var(--line-soft); background: var(--gray-0); overflow-y: auto; }
.fe-panel-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); position: sticky; top: 0; background: var(--gray-0); z-index: 1; }
.fe-panel-head h2 { font-size: var(--text-sm); margin: 0; flex: 1; }
.fe-panel-body { padding: 16px; display: grid; gap: 14px; }
.fe-panel-body textarea { resize: vertical; }
.fe-section { display: grid; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.fe-button-edit { display: grid; grid-template-columns: 1fr auto auto; gap: 6px; align-items: center; }
.fe-button-edit input[data-key="url"] { grid-column: 1 / -1; grid-row: 2; }
.fe-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.fe-check { display: flex; gap: 8px; align-items: flex-start; font-size: var(--text-xs); color: var(--muted); }
.fe-menu { position: fixed; z-index: 50; width: 250px; background: var(--gray-0); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px -12px rgba(17, 24, 39, .35); padding: 6px; display: grid; gap: 4px; }
.fe-menu-title { font-size: 11px; color: var(--faint); padding: 6px 8px 2px; text-transform: uppercase; letter-spacing: .04em; }
.fe-menu button { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; border: 0; background: transparent; border-radius: 8px; padding: 7px 8px; cursor: pointer; }
.fe-menu button:hover, .fe-menu button:focus-visible { background: var(--gray-100); outline: none; }
.fe-menu button span:last-child { display: grid; line-height: 1.3; font-size: var(--text-sm); }
.fe-menu small { color: var(--faint); font-size: 11px; }
@media (max-width: 840px) {
  .fe { height: auto; }
  .fe-main { flex-direction: column; }
  .fe-columns { flex-direction: column; align-items: stretch; gap: 16px; padding: 16px; width: auto; }
  .fe-col { gap: 16px; width: 100%; }
  .fe-node { width: 100%; }
  .fe-edges { display: none; }
  .fe-panel { width: auto; border-left: 0; border-top: 1px solid var(--line-soft); }
}

/* ── Instagram analytics ───────────────────────────────────── */
.ig-label { font-size: var(--text-xs); color: var(--muted); }
.ig-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.ig-hero { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 8px 32px; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--gray-0); }
.ig-profile { display: flex; align-items: center; gap: 12px; grid-column: 1 / -1; padding-bottom: 12px; border-bottom: 1px solid var(--line-soft); }
.ig-profile img, .ig-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--gray-100); display: grid; place-items: center; font-weight: 600; }
.ig-profile div { display: grid; line-height: 1.35; }
.ig-profile span { font-size: var(--text-xs); color: var(--muted); }
.ig-growth { display: grid; gap: 16px; align-content: start; padding-top: 8px; }
.ig-big { display: grid; gap: 2px; }
.ig-big strong { font-size: 40px; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.ig-mini { display: grid; gap: 6px; font-size: var(--text-xs); color: var(--muted); }
.ig-mini strong { color: var(--ink, inherit); margin-left: 4px; }
.ig-hero-chart { min-width: 0; padding-top: 8px; }
.ig-delta { font-size: var(--text-xs); font-weight: 600; font-variant-numeric: tabular-nums; }
.ig-delta.up { color: var(--green-ink); }
.ig-delta.down { color: #b42318; }
.ig-delta.flat { color: var(--faint); }
.ig-chart { width: 100%; height: 160px; display: block; }
.ig-chart .grid { stroke: var(--line-soft); stroke-width: 1; }
.ig-chart .area { fill: var(--gray-900); opacity: .06; }
.ig-chart .line { fill: none; stroke: var(--gray-900); stroke-width: 2; vector-effect: non-scaling-stroke; }
.ig-chart .end { fill: var(--gray-0); stroke: var(--gray-900); stroke-width: 2; vector-effect: non-scaling-stroke; }
.ig-chart-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); margin-top: 4px; }
.ig-chart-empty { font-size: var(--text-xs); color: var(--faint); padding: 32px 0; text-align: center; }
.ig-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0; background: var(--gray-0); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin-top: 16px; }
.ig-kpi { background: var(--gray-0); padding: 14px 16px; display: grid; gap: 2px; box-shadow: 0 0 0 .5px var(--line); }
.ig-kpi strong { font-size: 22px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.ig-section { margin-top: 28px; }
.ig-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.ig-section-head h2 { font-size: var(--text-md, 16px); margin: 0; }
.ig-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.ig-bars { display: flex; align-items: flex-end; gap: 3px; }
.ig-bars span { flex: 1; background: var(--gray-900); opacity: .22; border-radius: 3px 3px 0 0; min-width: 2px; }
.ig-bars span:hover { opacity: .7; }
.ig-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.ig-link { color: inherit; text-decoration: none; }
.ig-tile { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--gray-0); height: 100%; display: flex; flex-direction: column; }
.ig-link:hover .ig-tile { border-color: var(--gray-400, #9ca3af); }
.ig-thumb { position: relative; aspect-ratio: 4 / 5; background: var(--gray-100); display: grid; place-items: center; color: var(--faint); }
.ig-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ig-kind { position: absolute; left: 8px; top: 8px; display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; color: #fff; background: rgba(0, 0, 0, .55); padding: 2px 7px; border-radius: 99px; }
.ig-kind .icon { width: 10px; height: 10px; }
.ig-check { position: absolute; right: 8px; top: 8px; width: 24px; height: 24px; border-radius: 50%; background: var(--gray-900); color: #fff; display: grid; place-items: center; }
.ig-check .icon { width: 14px; height: 14px; }
.ig-tile-body { padding: 10px 12px 12px; display: grid; gap: 8px; }
.ig-caption { margin: 0; font-size: var(--text-xs); color: var(--muted); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ig-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px 6px; margin: 0; }
.ig-metrics div { display: grid; }
.ig-metrics dt { font-size: 10px; color: var(--faint); }
.ig-metrics dd { margin: 0; font-size: var(--text-sm); font-weight: 600; font-variant-numeric: tabular-nums; }
.ig-date { font-size: 11px; color: var(--faint); }
.ig-skeleton { display: grid; gap: 12px; }
.ig-skeleton .skeleton { height: 140px; border-radius: 14px; display: block; }
/* picker */
.ig-picker-tabs { margin-bottom: 8px; }
.ig-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; max-height: 300px; overflow-y: auto; padding: 2px; }
.ig-pick { border: 0; padding: 0; background: none; text-align: left; cursor: pointer; border-radius: 12px; }
.ig-pick .ig-tile-body { padding: 6px 8px 8px; }
.ig-pick .ig-caption { -webkit-line-clamp: 1; font-size: 11px; }
.ig-pick .ig-tile.selected { border-color: var(--gray-900); box-shadow: 0 0 0 2px var(--gray-900); }
.ig-pick:focus-visible { outline: 2px solid var(--gray-900); outline-offset: 2px; }
.ig-selected { display: flex; gap: 12px; margin-top: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--gray-50); }
.ig-selected img { width: 72px; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 8px; flex: none; }
.ig-selected div { min-width: 0; display: grid; gap: 4px; align-content: start; font-size: var(--text-xs); }
.ig-selected p { margin: 0; color: var(--muted); line-height: 1.45; }
.ig-selected a { display: inline-flex; gap: 4px; align-items: center; color: inherit; font-weight: 500; }
.ig-selected a .icon { width: 12px; height: 12px; }
/* home */
.home { max-width: 960px; }
.ig-home { border: 1px solid var(--line); border-radius: 14px; background: var(--gray-0); padding: 20px; display: grid; gap: 12px; }
.ig-home-main { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.ig-home-number { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.ig-home-number strong { font-size: 40px; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ig-home-chart .ig-chart { height: 110px; }
.ig-home-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.ig-home-stats div { display: grid; gap: 2px; }
.ig-home-stats strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.home-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 16px 0; }
.home-summary a { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: grid; gap: 2px; color: inherit; text-decoration: none; background: var(--gray-0); }
.home-summary a:hover { border-color: var(--gray-400, #9ca3af); }
.home-summary strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.home-summary .icon { width: 18px; height: 18px; }
/* automations without the side rail */
.automation-layout-flat { display: block; }
@media (max-width: 840px) {
  .ig-hero { grid-template-columns: 1fr; }
  .ig-home-stats { grid-template-columns: repeat(2, 1fr); }
  .home-summary { grid-template-columns: 1fr 1fr; }
  .ig-metrics { grid-template-columns: repeat(4, 1fr); }
}
.ig-count { font-size: var(--text-xs); color: var(--muted); margin: 0 0 10px; }

.fe-canvas.panning { cursor: grabbing; }
.fe-stage { position: relative; }
.fe-world { position: absolute; left: 0; top: 0; transform: scale(var(--zoom, 1)); transform-origin: 0 0; }
.fe-world .fe-node { position: absolute; }
.fe-world .fe-edges { position: absolute; left: 0; top: 0; }
.fe-node.dragging { cursor: grabbing; box-shadow: 0 16px 32px -12px rgba(17, 24, 39, .4); z-index: 3; transition: none; }
.fe-node header { cursor: grab; }
.fe-zoom { position: sticky; left: 16px; bottom: 16px; float: left; margin-top: -60px; display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px; background: var(--gray-0); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 4px 16px -8px rgba(17, 24, 39, .3); z-index: 4; font-size: var(--text-xs); cursor: default; }
.fe-zoom span { min-width: 40px; text-align: center; font-variant-numeric: tabular-nums; color: var(--muted); }
.fe-zoom .icon-btn { width: 28px; height: 28px; font-size: 16px; }
.fe-panel input, .fe-panel textarea { user-select: text; }
@media (max-width: 840px) {
  .fe-canvas { cursor: default; }
  .fe-stage { width: auto !important; height: auto !important; }
  .fe-world { position: static; transform: none; width: auto !important; height: auto !important; display: flex; flex-direction: column; gap: 16px; padding: 16px; }
  .fe-world .fe-node { position: static; }
  .fe-zoom { display: none; }
}

/* live followers and daily chart */
.ig-live { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; font-size: 10px; font-weight: 600; color: var(--green-ink); text-transform: uppercase; letter-spacing: .04em; }
.ig-live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); animation: ig-pulse 2s infinite; }
.ig-live.stale { color: var(--faint); }
.ig-live.stale .ig-live-dot { background: var(--gray-400, #9ca3af); animation: none; }
@keyframes ig-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .ig-live-dot { animation: none; } }
.ig-fchart { display: flex; align-items: flex-end; gap: 3px; margin-top: 8px; }
.ig-fbar { position: relative; flex: 1; height: 100%; display: flex; align-items: flex-end; outline: none; }
.ig-fbar::before { content: ""; display: block; width: 100%; height: var(--h); background: var(--gray-900); opacity: .78; border-radius: 3px 3px 0 0; }
.ig-fbar:hover::before, .ig-fbar:focus-visible::before { opacity: 1; background: var(--green-ink); }
.ig-tip { display: none; position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); white-space: nowrap; background: var(--gray-900); color: #fff; font-size: 11px; line-height: 1.45; padding: 6px 8px; border-radius: 8px; z-index: 5; pointer-events: none; }
.ig-tip strong { display: block; }
.ig-fbar:hover .ig-tip, .ig-fbar:focus-visible .ig-tip { display: block; }
.ig-fbar:first-child .ig-tip { left: 0; transform: none; }
.ig-fbar:last-child .ig-tip { left: auto; right: 0; transform: none; }
.ig-fstats { display: flex; gap: 16px; flex-wrap: wrap; font-size: var(--text-xs); color: var(--muted); margin-top: 8px; }
.ig-fstats strong { color: var(--ink, inherit); margin-left: 4px; font-variant-numeric: tabular-nums; }
.ig-daily { margin-top: 10px; font-size: var(--text-xs); }
.ig-daily summary { cursor: pointer; color: var(--muted); }
.ig-daily .table-wrap { max-height: 260px; overflow-y: auto; margin-top: 6px; }
.ig-home-number { align-items: baseline; }

/* new automation: trigger options */
.seg-wide { display: flex; width: 100%; }
.seg-wide button { flex: 1; }
.na-more summary { cursor: pointer; font-size: var(--text-sm); color: var(--muted); }
.na-more[open] summary { margin-bottom: 8px; }
.chip-btn { border: 1px solid var(--line); background: var(--gray-0); border-radius: 99px; padding: 1px 8px; font-size: 11px; cursor: pointer; color: inherit; }
.chip-btn:hover { border-color: var(--gray-400, #9ca3af); }
details.field[hidden], #naScopeField[hidden], #naMatchAny[hidden] { display: none !important; }

.fe-kw { display: inline-block; background: var(--gray-0); border: 1px solid #f3c4d7; border-radius: 6px; padding: 0 6px; margin: 1px 0; font-weight: 600; }
.fe-kw.muted { font-weight: 500; color: var(--muted); border-color: var(--line); }
.fe-when-sub { margin-top: 6px; color: var(--muted); }
.fe-media { display: grid; gap: 8px; margin-top: 8px; }
.fe-media .ig-selected { margin-top: 0; }
.fe-port-note { color: var(--faint); font-style: italic; }

/* phase 2 editor pieces */
.fe-row { display: flex; align-items: center; gap: 8px; }
.fe-row > input, .fe-row > select { flex: 1; min-width: 0; }
.fe-meta { font-size: 11px; color: var(--faint); }
.fe-qrs { display: flex; flex-wrap: wrap; gap: 4px; }
.fe-qr { border: 1px solid var(--line); border-radius: 99px; padding: 2px 8px; font-size: 11px; color: #2453d6; }
.fe-media-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); background: var(--gray-100); border-radius: 6px; padding: 2px 6px; width: fit-content; }
.fe-media-chip .icon { width: 12px; height: 12px; }
.fe-cards { display: flex; gap: 6px; overflow: hidden; }
.fe-card { flex: 0 0 120px; border: 1px solid var(--line); border-radius: 10px; padding: 6px; display: grid; gap: 4px; font-size: 11px; }
.fe-card img, .fe-card-img { width: 100%; aspect-ratio: 1.9 / 1; object-fit: cover; border-radius: 6px; background: var(--gray-100); display: block; }
.fe-card-edit { border: 1px solid var(--line-soft); border-radius: 10px; padding: 10px; }
.fe-card-edit .fe-row { justify-content: space-between; }
.fe-ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fe-menu { max-height: min(560px, calc(100vh - 24px)); overflow-y: auto; }
.fe-button-edit { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.fe-button-edit > input:first-child { flex: 1 1 110px; min-width: 0; }
.fe-button-edit > select { flex: 0 1 140px; min-width: 0; }
.fe-button-edit > input[type="url"] { flex: 1 1 100%; order: 3; min-width: 0; }
.fe-panel-body input, .fe-panel-body select, .fe-panel-body textarea { max-width: 100%; box-sizing: border-box; }
.fe-panel { overflow-x: hidden; }

/* contacts */
.ct-toolbar .input-search { flex: 1 1 260px; }
.ct-filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); background: var(--gray-50); align-items: end; }
.ct-filter-actions { display: flex; gap: 8px; justify-content: flex-end; }
.ct-row { display: flex; gap: 6px; align-items: center; }
.ct-row > input, .ct-row > select { flex: 1; min-width: 0; }
.ct-bulk { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 16px; background: var(--gray-50); border-bottom: 1px solid var(--line-soft); font-size: var(--text-sm); }
.ct-check { width: 36px; }
.ct-profile { display: grid; gap: 16px; }
.ct-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line-soft); }
.ct-stats div { display: grid; gap: 2px; }
.ct-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.ct-col { display: grid; gap: 8px; align-content: start; min-width: 0; }
.ct-tags .pill { display: inline-flex; align-items: center; gap: 4px; }
.ct-x { border: 0; background: none; cursor: pointer; padding: 0 2px; color: var(--muted); font-size: 14px; line-height: 1; }
.ct-key { flex: 0 0 110px; font-size: var(--text-xs); color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.ct-thread { max-height: 360px; overflow-y: auto; display: grid; gap: 10px; padding: 10px; border: 1px solid var(--line-soft); border-radius: 10px; background: var(--gray-50); align-content: start; }
@media (max-width: 840px) { .ct-columns { grid-template-columns: 1fr; } }
.ct-row > input, .ct-row > select { width: auto; }
.ct-row > button { flex: none; }
.ct-col textarea { width: 100%; box-sizing: border-box; }
.ct-filters .field:has([data-ct-filter="field_key"]) { grid-column: span 2; }
.ct-col > * { min-width: 0; max-width: 100%; }
.ct-row { min-width: 0; width: 100%; box-sizing: border-box; }
.ct-row > input { flex: 1 1 0; }

.fe-stat { margin-left: auto; font-size: 10px; font-weight: 600; color: var(--green-ink); background: var(--green-50); border-radius: 99px; padding: 2px 7px; white-space: nowrap; }
.fe-stat-inline { margin-left: 6px; font-size: 10px; font-weight: 600; color: var(--green-ink); }
.btn.active { background: var(--gray-100); }

/* inbox tools and templates */
.inbox-tools { flex-direction: column; align-items: stretch; }
.inbox-tools .seg button { font-size: var(--text-xs); }
.inbox-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.inbox-compose-main { flex: 1; display: grid; gap: 6px; min-width: 0; }
.inbox-compose-main textarea { width: 100%; box-sizing: border-box; }
.inbox-compose-tools { display: flex; gap: 6px; }
.inbox-saved { width: 300px; }
.inbox-saved-row { display: flex; align-items: center; gap: 4px; }
.inbox-saved-row > button:first-child { flex: 1; min-width: 0; }
.inbox-saved-row small { display: block; color: var(--faint); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-saved-new { display: grid; gap: 6px; padding: 8px; border-top: 1px solid var(--line-soft); }
.na-templates { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 16px; }
.na-template { text-align: left; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--gray-0); cursor: pointer; display: grid; gap: 2px; color: inherit; font: inherit; }
.na-template strong { font-size: var(--text-sm); }
.na-template small { font-size: 11px; color: var(--muted); }
.na-template.active { border-color: var(--gray-900); box-shadow: 0 0 0 1px var(--gray-900); }
.field[hidden] { display: none !important; }
.inbox-saved-row .icon-btn { width: 28px; flex: none; justify-content: center; }
.inbox-saved-row > button:first-child span { display: grid; min-width: 0; }

/* Flow editor: connect by dragging, history, live preview */
.fe-dot { cursor: crosshair; transition: transform .12s, border-color .12s; }
.fe-dot:hover { transform: scale(1.35); border-color: var(--blue); }
.fe-canvas.wiring, .fe-canvas.wiring * { cursor: crosshair !important; user-select: none; }
.fe-edges path.fe-wire { stroke: var(--blue); stroke-dasharray: 6 4; stroke-width: 2; }
.fe-node.drop-target { outline: 2px solid var(--blue); outline-offset: 3px; }
.fe-zoom .icon-btn:disabled { opacity: .35; cursor: default; }
.fe-zoom-sep { display: block; width: 1px; height: 18px; background: var(--line); margin: 0 4px; }
.pv-body { max-height: 52vh; overflow-y: auto; gap: 10px; }
.pv-sys { justify-self: center; font-size: var(--text-xs); color: var(--faint); background: var(--gray-50); border: 1px solid var(--line-soft); border-radius: 999px; padding: 3px 10px; text-align: center; }
.pv-cards { display: flex; gap: 8px; overflow-x: auto; justify-content: flex-end; text-align: left; }
.pv-card { flex: 0 0 160px; display: grid; gap: 3px; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--gray-0); font-size: var(--text-xs); }
.pv-card img { width: 100%; aspect-ratio: 1.9; object-fit: cover; border-radius: 6px; }
.pv-card small { color: var(--muted); }
.pv-choices { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; padding: 10px 14px; border-top: 1px solid var(--line-soft); }
.pv-choice { border: 1px solid var(--blue); color: var(--blue); background: var(--gray-0); border-radius: 999px; padding: 5px 12px; font-size: var(--text-xs); font-weight: 600; cursor: pointer; }
.pv-choice:hover { background: var(--blue); color: var(--gray-0); }
.pv-choice.system { border-color: var(--line); color: var(--ink-2); }
.pv-choice.system:hover { background: var(--gray-100); color: var(--ink-2); }

/* Keyword chips (Cal.com input look) */
.kw-box { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 36px; padding: 4px 6px;
  border: 1px solid var(--cal-border); border-radius: 10px; background: var(--cal-bg); box-shadow: var(--shadow-outline-gray-rested); cursor: text; }
.kw-box:hover { border-color: var(--cal-border-emphasis); }
.kw-box:focus-within { border-color: var(--cal-border-emphasis); box-shadow: var(--shadow-outline-gray-focused); }
.kw-box input { flex: 1; min-width: 120px; border: 0; outline: none; background: none; height: 26px; font-size: 14px; color: var(--cal-text); box-shadow: none; padding: 0 2px; }
.kw-box input::placeholder { color: var(--cal-text-muted); }
.kw-chip { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 4px 0 8px; border-radius: 6px;
  background: var(--cal-bg-emphasis); color: var(--cal-text-emphasis); font-size: 13px; font-weight: 500; }
.kw-chip button { border: 0; background: none; color: var(--cal-text-subtle); width: 18px; height: 18px; border-radius: 4px; line-height: 1; padding: 0; }
.kw-chip button:hover { background: var(--cal-bg-subtle); color: var(--cal-text-emphasis); }
.kw-suggest { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.kw-suggest-label { font-size: 12px; color: var(--cal-text-subtle); margin-right: 2px; }
.kw-idea { height: 24px; padding: 0 8px; border-radius: 6px; border: 1px dashed var(--cal-border); background: var(--cal-bg); color: var(--cal-text); font-size: 12px; font-weight: 500; }
.kw-idea:hover { border-style: solid; background: var(--cal-bg-muted); }
.kw-idea.kw-all { border-style: solid; color: var(--cal-text-emphasis); }
.kw-test-row { display: flex; align-items: center; gap: 8px; }
.kw-test-row input { flex: 1; }
.kw-test-row .pill { flex: none; min-width: 72px; justify-content: center; }
#naMatchField { align-self: start; }

/* Home: growth + what automations produced */
.home .ig-home + .ig-home { margin-top: 16px; }
.home-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.home-kpis > div { display: grid; gap: 2px; min-width: 0; }
.home-kpi { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.home-kpi strong { font-size: 26px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.home-kpis small { font-size: var(--text-xs); color: var(--faint); }
.home-bars { display: flex; align-items: flex-end; gap: 3px; height: 40px; margin-top: 8px; }
.home-bars .ig-fbar::before, .home-bars .ig-fbar { opacity: .45; }
.home-bars .ig-fbar:hover, .home-bars .ig-fbar:focus { opacity: 1; }
.home-bars .ig-fbar { flex: 1; }
.home-top { margin-top: 4px; border-top: 1px solid var(--line-soft); }
.home-top th:first-child { text-transform: none; }
.home-empty { padding-top: 12px; border-top: 1px solid var(--line-soft); }
.home-attention { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.home-attention a { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--gray-0); color: inherit; text-decoration: none; font-size: var(--text-sm); }
.home-attention a:hover { border-color: var(--gray-400, #9ca3af); }
.home-attention .icon { width: 15px; height: 15px; }
.home-attention .icon:last-child { color: var(--faint); }
.home .page-head .seg { margin-right: 8px; }
@media (max-width: 720px) { .home-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Home uses the full content width: insights + results side by side on wide screens */
.home { max-width: 1440px; }

/* E-mail login */
.auth-or { display: flex; align-items: center; gap: 10px; margin: 18px 0 14px; color: var(--faint); font-size: var(--text-xs); }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-or[hidden], .auth-form[hidden], #loginBtn[hidden], .auth-note[hidden], .auth-sub[hidden] { display: none !important; }
.auth-form { display: grid; gap: 12px; }
.auth-forgot { justify-self: center; font-size: var(--text-xs); }
.auth-ok { margin-top: 12px; font-size: var(--text-sm); color: var(--ink-2); background: var(--gray-50); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; line-height: 1.5; }
.ig-home-stats strong .ig-delta { font-size: 12px; margin-left: 4px; }

/* Direct-message features waiting for Meta approval */
.no-messaging [data-nav="inbox"], .no-messaging [data-nav="broadcasts"] { display: none; }

/* Sign-up, plan and usage */
.auth-alt { margin-top: 14px; text-align: center; font-size: var(--text-xs); color: var(--muted); }
.check-line { display: flex; gap: 8px; align-items: flex-start; font-size: var(--text-xs); line-height: 1.5; color: var(--muted); }
.check-line input { margin-top: 2px; }
.plan-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.usage { display: grid; gap: 6px; margin-bottom: 12px; }
.usage-row { display: flex; justify-content: space-between; gap: 8px; font-size: var(--text-sm); }
.usage-bar { height: 6px; }
.usage-bar.warn span { background: var(--warn, #b45309); }
.usage-bar.danger span { background: var(--danger, #b91c1c); }
.plan-toggle { margin: 16px 0 12px; }
.plan-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.plan-tile { display: grid; gap: 8px; align-content: start; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--gray-0); }
.plan-tile.current { border-color: var(--ink); }
.plan-price { display: flex; align-items: baseline; gap: 4px; }
.plan-price span { font-size: 24px; font-weight: 600; letter-spacing: -.02em; }
.plan-price small { color: var(--faint); font-size: var(--text-xs); }
.plan-tile ul { margin: 0; padding-left: 16px; font-size: var(--text-xs); color: var(--muted); line-height: 1.7; }
.auth-form[hidden] { display: none !important; }

/* YouTube and TikTok */
.social-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.social-actions .select, .ig-section-head .select { width: auto; }
.social-split { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-top: 16px; }
.share-row { display: grid; gap: 5px; margin-bottom: 12px; }
.share-row > div:first-child { display: flex; justify-content: space-between; gap: 8px; font-size: var(--text-sm); }
.share-row small { color: var(--faint); font-weight: 400; margin-left: 4px; }
.share-row .progress { width: 100%; height: 5px; }
.social-video { display: grid; align-content: start; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--gray-0); color: inherit; text-decoration: none; min-width: 0; }
.social-video:hover { border-color: var(--gray-400, #9ca3af); }
.social-video img, .social-noimg { display: block; width: 100%; object-fit: cover; background: var(--gray-100); }
.social-video .wide { aspect-ratio: 16 / 9; }
.social-video .tall { aspect-ratio: 4 / 5; }
.social-video-copy { display: grid; gap: 6px; padding: 12px; }
.social-video-copy strong { font-size: var(--text-sm); line-height: 1.4; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.social-video-copy small { color: var(--faint); font-size: var(--text-xs); }
.social-foot { display: flex; gap: 16px; margin-top: 16px; }
.social-actions select, .ig-section-head select[data-youtube-sort], .ig-section-head select[data-tiktok-sort] { height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--gray-0); color: var(--ink); font: inherit; font-size: var(--text-sm); width: auto; }
.social-warn { margin-bottom: 16px; }

/* Sign-in pages: one centered column over a faint grid */
.auth { position: relative; display: flex; justify-content: center; align-items: stretch; background: var(--gray-0); isolation: isolate; }
.auth::before { content: ""; position: absolute; inset: 0 0 auto; height: 420px; z-index: -1; pointer-events: none;
  background-image: linear-gradient(var(--line-soft) 1px, transparent 1px), linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 56px 56px; background-position: center top; -webkit-mask-image: linear-gradient(#000 35%, transparent); mask-image: linear-gradient(#000 35%, transparent); }
.auth::after { content: ""; position: absolute; top: -90px; left: 50%; width: min(620px, 90%); height: 120px; transform: translateX(-50%); z-index: -1; pointer-events: none;
  background: linear-gradient(90deg, #f59e0b, #84cc16, #16a34a, #fbbf24); filter: blur(60px); opacity: .22; }
.auth-panel { display: flex; flex-direction: column; align-items: center; min-height: 100vh; width: 100%; padding: 28px 20px 24px; }
.auth-card { width: min(340px, 100%); border: 0; background: transparent; padding: 0; text-align: center; }
.auth-card-logo { margin-bottom: 56px; }
.auth-card h2 { font-size: 20px; margin-bottom: 24px; }
.auth-card .auth-sub { margin: -14px 0 22px; }
.auth-form { text-align: left; }
.auth-form .field input { height: 42px; }
.auth-card .btn-block { height: 42px; }
#loginView .auth-or { text-transform: uppercase; }
.auth-note { display: block; margin-top: 22px; padding: 0; border: 0; background: none; font-size: var(--text-xs); color: var(--faint); }
.auth-note summary { cursor: pointer; }
.auth-note p { margin-top: 8px; line-height: 1.55; color: var(--muted); }
.auth-note[hidden] { display: none; }
.auth-legal { margin-top: auto; padding-top: 40px; text-align: center; }
.auth-support { margin-top: 8px; }
