/* ─────────────────────────────────────────────────────────────
   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; }
.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: 196px minmax(0, 1fr) 324px; 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: 44px 24px 70px;
  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;
}
.connector { width: 1.5px; height: 34px; 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: 420px; }
}
@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; }
