/* =====================================================================
   DOMINO — by Driftwood Capital
   App OS shell, built on the Driftwood design tokens.
   Navy authority rail · ivory workspace · teal accent · editorial calm.
   ===================================================================== */

@import url("assets/driftwood-tokens.css");

@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("fonts/PlusJakartaSans-VariableFont_wght.ttf") format("truetype-variations");
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background: var(--ink-900);
}

/* ---------------------------------------------------------------------
   App-level theme variables (driven by Tweaks)
   --------------------------------------------------------------------- */
.app {
  /* accent — defaults to Driftwood teal */
  --ac:        var(--gold-500);
  --ac-600:    var(--gold-600);
  --ac-700:    var(--gold-700);
  --ac-fg:     #04211a;
  --ac-soft:   color-mix(in oklab, var(--ac) 14%, transparent);
  --ac-line:   color-mix(in oklab, var(--ac) 32%, transparent);

  /* deal-strategy chip hues — Acquisition blue · Credit teal · Development gold */
  --strat-acq:    #2563A8;
  --strat-credit: #0E9E84;
  --strat-dev:    #977519;

  /* rail */
  --rail-bg:   var(--ink-900);
  --rail-fg:   rgba(255, 253, 248, 0.92);
  --rail-muted:rgba(255, 253, 248, 0.50);
  --rail-faint:rgba(255, 253, 248, 0.34);
  --rail-line: rgba(255, 253, 248, 0.10);
  --rail-hover:rgba(255, 253, 248, 0.06);
  --rail-active-bg: rgba(255, 253, 248, 0.08);

  /* surfaces — cool slate neutrals (no warm sand) */
  --canvas:    #F5F6F8;          /* slate-50 */
  --surface:   #FFFFFF;
  --hairline:  #E5E9EF;          /* cool hairline */
  --hairline-soft: #EDF0F4;
  --neutral-50:  #F5F6F8;
  --neutral-100: #EDF0F4;
  --neutral-200: #E5E9EF;

  /* density */
  --gutter:    40px;
  --section-gap: 44px;
  --card-pad:  24px;

  /* shape */
  --r-card:    10px;
  --r-control: 8px;
  --r-chip:    var(--radius-pill);

  /* type weight feel */
  --w-stat:    300;
  --w-head:    600;

  --rail-w:    256px;
  --foot-h:    40px;

  display: flex;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  background: var(--canvas);
  color: var(--ink-900);
  font-size: 15px;
}

/* density variants */
.app[data-density="compact"]  { --gutter: 28px; --section-gap: 32px; --card-pad: 18px; font-size: 14px; }
.app[data-density="spacious"] { --gutter: 56px; --section-gap: 60px; --card-pad: 30px; font-size: 15px; }

/* radius variants */
.app[data-radius="sharp"] { --r-card: 3px; --r-control: 4px; }
.app[data-radius="soft"]  { --r-card: 14px; --r-control: 11px; }

/* type weight variants */
.app[data-weight="light"]    { --w-stat: 200; --w-head: 500; }
.app[data-weight="standard"] { --w-stat: 300; --w-head: 600; }
.app[data-weight="bold"]     { --w-stat: 400; --w-head: 700; }

/* card style variants applied to .sys-card / .panel */
.app[data-card="elevated"] .sys-card,
.app[data-card="elevated"] .dq-panel,
.app[data-card="elevated"] .empty { box-shadow: var(--shadow-md); border-color: transparent; }
.app[data-card="filled"] .sys-card,
.app[data-card="filled"] .dq-panel,
.app[data-card="filled"] .empty { background: var(--neutral-50); border-color: var(--hairline); }

/* light sidebar variant */
.app[data-rail="light"] {
  --rail-bg:    #FFFFFF;
  --rail-fg:    var(--ink-900);
  --rail-muted: var(--slate-500);
  --rail-faint: var(--slate-400);
  --rail-line:  var(--slate-100);
  --rail-hover: var(--slate-50);
  --rail-active-bg: var(--slate-50);
}

/* light theme also lightens the rail (matches data-rail="light") */
.app.theme-light {
  --rail-bg:    #FFFFFF;
  --rail-fg:    var(--ink-900);
  --rail-muted: var(--slate-500);
  --rail-faint: var(--slate-400);
  --rail-line:  var(--slate-100);
  --rail-hover: var(--slate-50);
  --rail-active-bg: var(--slate-50);
}
/* =====================================================================
   EXPERIMENT — macOS glass chrome + surface temperature (Tweaks-driven)
   Reversible: data-glass="off" / data-surface="cool" = current baseline.
   Glass is applied ONLY to structural chrome (rail, topbar, scrims,
   command palette, popovers) — never to data-dense content surfaces.
   ⚠ BRAND NOTE: glass mode replaces the navy authority rail with a
   translucent light rail — a deliberate departure from Driftwood's
   navy-rail identity. Toggle off to restore.
   ===================================================================== */

/* --- surface temperature: warm off-white content canvas --- */
.app[data-surface="warm"] {
  --canvas:        #F5F4F1;   /* warm off-white (macOS-style) */
  --neutral-50:    #FAFAF9;
  --hairline:      rgba(0,0,0,0.08);
  --hairline-soft: rgba(0,0,0,0.05);
}

/* --- glass chrome --- */
.app[data-glass="on"] {
  /* tweakable knobs (overridden inline by the Tweaks sliders) */
  --glass-blur: 20px;
  --glass-fill: rgba(255,255,255,0.72);
  --glass-fill-2: rgba(255,255,255,0.86);
  /* a soft light ground so the frosted chrome has something to refract */
  background:
    radial-gradient(1100px 620px at -8% -12%, color-mix(in oklab, var(--ac) 11%, transparent), transparent 60%),
    radial-gradient(960px 560px at 108% 8%, color-mix(in oklab, #6f93c4 14%, transparent), transparent 62%),
    linear-gradient(180deg, #EEF0F3, #E9EBEF);
  /* translucent light rail (replaces navy) */
  --rail-bg:    var(--glass-fill);
  --rail-fg:    rgba(11,43,72,0.92);
  --rail-muted: rgba(11,43,72,0.56);
  --rail-faint: rgba(11,43,72,0.40);
  --rail-line:  rgba(0,0,0,0.08);
  --rail-hover: rgba(11,43,72,0.05);
  --rail-active-bg: color-mix(in oklab, var(--ac) 14%, transparent);
}
.app[data-glass="on"].theme-dark {
  background: linear-gradient(180deg, #0A1119, #0C1620);
  --rail-bg:    var(--glass-fill);
  --rail-fg:    rgba(255,253,248,0.92);
  --rail-muted: rgba(255,253,248,0.52);
  --rail-faint: rgba(255,253,248,0.34);
  --rail-line:  rgba(255,255,255,0.10);
  --rail-hover: rgba(255,255,255,0.06);
  --rail-active-bg: rgba(255,255,255,0.10);
}
/* the rail itself: frost it. transform/opacity only on transitions — never animate the blur */
.app[data-glass="on"] .rail {
  backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  border-right: 0.5px solid var(--rail-line);
}
/* topbar: same frosted material */
.app[data-glass="on"] .topbar {
  background: var(--rail-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  border-bottom: 0.5px solid rgba(0,0,0,0.08);
  box-shadow: none;
}
.app[data-glass="on"].theme-dark .topbar { border-bottom-color: rgba(255,255,255,0.08); }
/* main canvas stays opaque & flat (content is never glass) */
.app[data-glass="on"] .main { background: var(--canvas); }

/* drawer / modal scrims: blurred ground, flat-white panel */
.app[data-glass="on"] ~ * .drawer-overlay,
.app[data-glass="on"] .drawer-overlay,
[data-glass="on"] .drawer-overlay,
[data-glass="on"] .dv-tm-ov {
  background: rgba(0,0,0,0.25);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
/* command palette / Ask-Domino overlay: brighter frost */
[data-glass="on"] .cmdk, [data-glass="on"] .ask-overlay, [data-glass="on"] .palette {
  background: var(--glass-fill-2, rgba(255,255,255,0.85));
  backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  border: 0.5px solid rgba(0,0,0,0.10);
  border-radius: 12px;
}
/* floating popovers / dropdown menus / tooltips */
[data-glass="on"] .dl-menu, [data-glass="on"] .dv-menu,
[data-glass="on"] .filterdrop, [data-glass="on"] .menu-pop, [data-glass="on"] .tip {
  background: var(--glass-fill, rgba(255,255,255,0.82));
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
}
.app[data-glass="on"].theme-dark .dl-menu, .app[data-glass="on"].theme-dark .dv-menu {
  background: var(--glass-fill, rgba(20,32,44,0.82));
}

/* --- glass on drawers & panels (opt-in) --- */
/* Single blur layer on the SCRIM; the panel is genuinely translucent (no own
   blur) so the blurred page shows THROUGH it — the macOS frosted-glass read.
   Header & body are transparent so the frosted zone is large; inner cards stay
   opaque for legibility. .app-prefixed so it beats the chrome scrim rule above. */
.app[data-glass-panels="on"] .drawer-overlay,
.app[data-glass-panels="on"] .propdrawer-overlay {
  background: rgba(6,26,46,0.16);
  backdrop-filter: blur(calc(var(--glass-blur) * 0.8)) saturate(140%);
  -webkit-backdrop-filter: blur(calc(var(--glass-blur) * 0.8)) saturate(140%);
}
.app[data-glass-panels="on"] .drawer,
.app[data-glass-panels="on"] .propdrawer {
  background: var(--glass-fill, rgba(255,255,255,0.66));
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: -1px 0 0 rgba(255,255,255,0.5), var(--shadow-xl);
}
/* large frosted chrome zones — show the blurred page through the translucent panel */
.app[data-glass-panels="on"] .drawer__body,
.app[data-glass-panels="on"] .drawer__tabs { background: transparent; }
/* identity header: keep it solid/white so the name & key metrics read crisply */
.app[data-glass-panels="on"] .drawer__head { background: rgba(255,255,255,0.95); }
/* KPI strip & footer: a touch more opaque so figures stay crisp, still glassy */
.app[data-glass-panels="on"] .dl-kpis,
.app[data-glass-panels="on"] .drawer__foot { background: var(--glass-fill-2, rgba(255,255,255,0.86)); }
/* the tab rail divider reads better as a hairline on glass */
.app[data-glass-panels="on"] .drawer__tabs { border-bottom-color: rgba(0,0,0,0.08); }


.app.theme-dark {
  --canvas:    #0B141C;
  --surface:   #121E29;
  --hairline:  #27343F;
  --hairline-soft: #1B2731;
  --neutral-50:  #16212C;
  --neutral-100: #1E2B37;
  --neutral-200: #28363F;

  --ink-900: #F2F6FA; --ink-800: #E4EBF2; --ink-700: #CCD7E0; --ink-600: #A7B5C2; --ink-500: #8A98A6;
  --slate-700: #EEF2F6; --slate-600: #CBD5DF; --slate-500: #A2AFBB; --slate-400: #828F9C;
  --slate-300: #5E6B77; --slate-200: #39454F; --slate-100: #26323D; --slate-50: #18222D;
  --ivory: #F2F6FA; --paper: #121E29;

  --success: #5FB389; --success-bg: #15271F;
  --warning: #D69A4E; --warning-bg: #2A2113;
  --danger:  #DB7E72; --danger-bg: #2C1A18;
  --info:    #5FA1DC; --info-bg: #14222F;

  /* deal-strategy chip hues (lightened for dark surfaces) */
  --strat-acq:    #6FB0E6;
  --strat-credit: #34C9AC;
  --strat-dev:    #D9B65E;

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.45);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.5);
  --shadow-md: 0 10px 28px -10px rgba(0,0,0,0.65);
  --shadow-lg: 0 26px 64px -22px rgba(0,0,0,0.75);
  --shadow-xl: 0 44px 110px -34px rgba(0,0,0,0.85);
  --shadow-inset: inset 0 0 0 1px rgba(255,255,255,0.05);

  --rail-bg: #0A1A2B;
  --rail-line: rgba(255,255,255,0.08);
  --chip: #2A3A48; --chip-fg: #EAF1F7;
  background: var(--canvas);
}

/* dual-use ink/slate backgrounds → explicit chip surface + light glyph */
.app.theme-dark .seg__btn.is-active { background: transparent; color: var(--ink-900); box-shadow: none; }
.app.theme-dark .seg::before { background: var(--neutral-200); box-shadow: 0 1px 3px rgba(0,0,0,0.3), 0 0 0 1px var(--hairline); }
.app.theme-dark .dl-view.is-active,
.app.theme-dark .dl-link-row__av,
.app.theme-dark .dl-act-av:not(.is-ai),
.app.theme-dark .mtg-person__av,
.app.theme-dark .dl-lprop__idx,
.app.theme-dark .dl-ptrow__idx,
.app.theme-dark .dl-prop-card__idx,
.app.theme-dark .cre-num { background: var(--chip); color: var(--chip-fg); }

/* slate / primary buttons */
.app.theme-dark .btn--slate { background: var(--chip); color: var(--chip-fg); box-shadow: var(--shadow-xs); }
.app.theme-dark .btn--slate:hover { background: #35485B; }
.app.theme-dark .btn--slate-soft { background: var(--neutral-100); color: var(--ink-800); border-color: var(--hairline); }
.app.theme-dark .btn--slate-soft:hover { background: var(--neutral-200); color: var(--ink-900); }
.app.theme-dark .btn--primary { background: linear-gradient(180deg, #1B3A59, #12273D); color: #fff; }

/* decorative gradient tiles */
.app.theme-dark .drawer__photo,
.app.theme-dark .dl-media__tile { background: linear-gradient(150deg, #1C2C3B, #0F1D29); }

/* maps — approximate dark tiles */
.app.theme-dark .dl-map iframe,
.app.theme-dark .dl-prop-card__map iframe,
.app.theme-dark .propdrawer__map iframe { filter: invert(0.92) hue-rotate(180deg) brightness(0.95) contrast(0.9) saturate(0.85); }

/* =====================================================================
   RAIL  (left navigation)
   ===================================================================== */
.rail {
  width: var(--rail-w);
  flex: 0 0 var(--rail-w);
  background: var(--rail-bg);
  color: var(--rail-fg);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--rail-line);
  transition: width var(--duration-base) var(--ease-out);
  position: relative;
  z-index: 5;
}
.app[data-collapsed="true"] .rail { --rail-w: 76px; }

/* brand lockup */
.rail__brand {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 22px 20px 18px;
  gap: 10px;
}
.brand__mark { min-width: 0; }
.brand__word {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--rail-fg);
  line-height: 1;
}
.brand__dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ac);
  margin-bottom: -1px;
  box-shadow: 0 0 0 0 var(--ac-line);
}
.brand__sub {
  font-size: 9.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--rail-faint);
  font-weight: 600;
  margin-top: 7px;
}
.app[data-collapsed="true"] .brand__sub,
.app[data-collapsed="true"] .brand__word span,
.app[data-collapsed="true"] .nav__label,
.app[data-collapsed="true"] .nav__group-label,
.app[data-collapsed="true"] .ask__label,
.app[data-collapsed="true"] .ask__kbd,
.app[data-collapsed="true"] .who__meta { display: none; }
.app[data-collapsed="true"] .brand__word { justify-content: center; }
.app[data-collapsed="true"] .rail__brand { justify-content: center; padding-left: 0; padding-right: 0; }
.app[data-collapsed="true"] .brand__mark { display: none; }

.rail__collapse {
  flex: 0 0 auto;
  width: 26px; height: 26px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--rail-line);
  background: transparent;
  color: var(--rail-muted);
  display: grid; place-items: center;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}
.rail__collapse:hover { color: var(--rail-fg); background: var(--rail-hover); }
.app[data-collapsed="true"] .rail__collapse svg { transform: rotate(180deg); }

/* Ask Domino command */
.ask {
  margin: 4px 14px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: var(--r-control);
  border: 1px solid var(--rail-line);
  background: var(--rail-hover);
  color: var(--rail-fg);
  cursor: text;
  transition: all var(--duration-fast) var(--ease-out);
  width: calc(100% - 28px);
}
.ask:hover { border-color: var(--ac-line); background: var(--rail-active-bg); }
.ask__icon { color: var(--ac); flex: 0 0 auto; display: grid; place-items: center; }
.ask__label { font-size: 13.5px; font-weight: 500; flex: 1; text-align: left; letter-spacing: -0.01em; }
.ask__kbd {
  font-size: 10px;
  font-weight: 600;
  color: var(--rail-muted);
  border: 1px solid var(--rail-line);
  border-radius: 4px;
  padding: 2px 6px;
  letter-spacing: 0.04em;
}
.app[data-collapsed="true"] .ask { justify-content: center; padding: 11px 0; }

/* nav scroll area */
.rail__nav {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--rail-line) transparent;
}
.rail__nav::-webkit-scrollbar { width: 6px; }
.rail__nav::-webkit-scrollbar-thumb { background: var(--rail-line); border-radius: 3px; }

.nav__group { margin-bottom: 18px; }
.nav__group-label {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--rail-faint);
  font-weight: 600;
  padding: 0 12px;
  margin-bottom: 8px;
}
.nav__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--r-control);
  color: var(--rail-muted);
  cursor: pointer;
  position: relative;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: color var(--duration-fast) var(--ease-out),
              background var(--duration-fast) var(--ease-out);
  user-select: none;
  margin-bottom: 1px;
}
.nav__item:hover { color: var(--rail-fg); background: var(--rail-hover); }
.nav__item svg { flex: 0 0 auto; width: 18px; height: 18px; }
.nav__label { flex: 1; }
.nav__item.is-active {
  color: var(--rail-fg);
  background: var(--rail-active-bg);
  font-weight: 600;
}
.nav__item.is-active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--ac);
  border-radius: 0 3px 3px 0;
}
.nav__item.is-active svg { color: var(--ac); }
.nav__badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--rail-muted);
  background: var(--rail-hover);
  border-radius: var(--radius-pill);
  padding: 1px 8px;
  min-width: 20px;
  text-align: center;
}
.app[data-collapsed="true"] .nav__item { justify-content: center; padding: 10px 0; }
.app[data-collapsed="true"] .nav__group-label { height: 1px; padding: 0; margin: 0 10px 14px; background: var(--rail-line); }
.app[data-collapsed="true"] .nav__badge { display: none; }
.app[data-collapsed="true"] .nav__item.is-active::before { left: 0; }

/* who / footer of rail */
.rail__who {
  border-top: 1px solid var(--rail-line);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 11px;
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out);
}
.rail__who:hover { background: var(--rail-hover); }
.rail__who.is-active { background: var(--rail-active-bg); }
.rail__who.is-active .who__avatar { box-shadow: 0 0 0 2px var(--ac); }
.who__avatar {
  width: 34px; height: 34px;
  flex: 0 0 auto;
  border-radius: 9px;
  background: linear-gradient(150deg, var(--ac), var(--ac-700));
  color: var(--ac-fg);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
  letter-spacing: 0.02em;
}
.who__meta { min-width: 0; flex: 1; }
.who__name { font-size: 13px; font-weight: 600; color: var(--rail-fg); line-height: 1.2; }
.who__org { font-size: 11px; color: var(--rail-faint); line-height: 1.3; margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who__actions { display: flex; gap: 2px; }
.who__btn {
  width: 28px; height: 28px;
  border: 0; background: transparent;
  color: var(--rail-faint);
  border-radius: 6px;
  display: grid; place-items: center;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}
.who__btn:hover { color: var(--rail-fg); background: var(--rail-hover); }
.who__btn svg { width: 16px; height: 16px; }
.app[data-collapsed="true"] .who__actions { display: none; }
.app[data-collapsed="true"] .rail__who { justify-content: center; padding: 14px 0; }

/* =====================================================================
   MAIN
   ===================================================================== */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--canvas);
  overflow: hidden;
  position: relative;
  padding-bottom: var(--foot-h);
}

/* top bar */
.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px var(--gutter);
  border-bottom: 1px solid var(--neutral-200);
  background: color-mix(in oklab, var(--canvas) 86%, transparent);
  backdrop-filter: blur(10px);
  box-shadow: 0 1px 3px rgba(6,26,46,0.04);
  position: relative; z-index: 10;
}
.topbar__left { display: flex; align-items: center; gap: 18px; min-width: 0; }
.topbar__title {
  font-size: 19px;
  font-weight: var(--w-head);
  letter-spacing: -0.02em;
  color: var(--ink-900);
}
.topbar__status { display: flex; align-items: center; gap: 16px; }
.statline { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--slate-500); white-space: nowrap; }
.statline__dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.statline__dot--live { background: var(--success); box-shadow: 0 0 0 3px var(--success-bg); }
.statline__dot--idle { background: var(--slate-300); }
.topbar__right { display: flex; align-items: center; gap: 10px; }

/* pill buttons in topbar */
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--hairline);
  background: var(--surface);
  color: var(--ink-800);
  font-size: 13px; font-weight: 600; letter-spacing: -0.01em;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}
.pill:hover { border-color: var(--slate-300); box-shadow: var(--shadow-xs); }
.pill svg { width: 16px; height: 16px; }
.pill--icon { padding: 0; width: 36px; justify-content: center; }
.pill--icon.dl-insightsbtn { color: var(--ink-800); transition: background 200ms var(--ease-out), border-color 200ms var(--ease-out), color 200ms var(--ease-out), transform 120ms var(--ease-out); }
/* hover → blue tint so it reads as clickable */
.pill--icon.dl-insightsbtn:hover { background: color-mix(in oklab, var(--ac) 12%, var(--surface)); border-color: var(--ac); color: var(--ac); box-shadow: none; }
.pill--icon.dl-insightsbtn:active { transform: scale(0.88); }
/* active → solid blue, with a pop ring + glyph spin on each activation */
.pill--icon.dl-insightsbtn.is-active { background: var(--ac); border-color: var(--ac); color: #fff; animation: dl-insights-pop 420ms var(--ease-out); }
.pill--icon.dl-insightsbtn.is-active:hover { background: var(--ac); color: #fff; }
.pill--icon.dl-insightsbtn.is-active svg { animation: dl-insights-spin 460ms var(--ease-out); }
@keyframes dl-insights-pop { 0% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--ac) 60%, transparent); transform: scale(0.88); } 50% { transform: scale(1.08); } 70% { box-shadow: 0 0 0 9px color-mix(in oklab, var(--ac) 0%, transparent); } 100% { box-shadow: 0 0 0 0 transparent; transform: scale(1); } }
@keyframes dl-insights-spin { from { transform: rotate(-40deg) scale(0.8); } to { transform: rotate(0) scale(1); } }
.topacct { display: inline-flex; align-items: center; gap: 9px; height: 36px; padding: 0 10px 0 5px; border: 1px solid var(--hairline); background: var(--surface); border-radius: var(--radius-pill); cursor: pointer; transition: all var(--duration-fast) var(--ease-out); }
.topacct:hover { border-color: var(--slate-300); box-shadow: var(--shadow-xs); }
.topacct__av { width: 28px; height: 28px; flex: 0 0 auto; border-radius: 50%; background: var(--ink-800); color: var(--ivory); display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.app.theme-dark .topacct__av { background: var(--chip); color: var(--chip-fg); }
.topacct__meta { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.topacct__name { font-size: 12.5px; font-weight: 600; color: var(--ink-900); letter-spacing: -0.01em; }
.topacct__org { font-size: 10.5px; color: var(--slate-400); }
.topacct svg { color: var(--slate-400); }
@media (max-width: 900px) { .topacct__meta { display: none; } }
.pill__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ac); }

/* scroll body */
.scroll {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--slate-300) transparent;
}
.scroll::-webkit-scrollbar { width: 10px; }
.scroll::-webkit-scrollbar-thumb { background: var(--slate-300); border-radius: 5px; border: 3px solid var(--canvas); }
.content {
  /* full-bleed, consistent with the funnel screens (DealFlow / Deals / Pipeline / Portfolio):
     same --gutter side padding, no centered max-width cap */
  padding: 30px var(--gutter) 56px;
}

/* =====================================================================
   SCOPE TABS (segmented)
   ===================================================================== */
.seg {
  display: inline-flex;
  background: var(--neutral-100);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-pill);
  padding: 3px;
  gap: 2px;
  position: relative;
}
/* sliding active highlight (positioned by seg-slider.js via --seg-* vars) */
.seg::before {
  content: "";
  position: absolute; top: 0; left: 0;
  width: var(--seg-w, 0); height: var(--seg-h, 0);
  transform: translate(var(--seg-x, 3px), var(--seg-y, 3px));
  background: var(--surface);
  border-radius: var(--radius-pill);
  box-shadow: 0 1px 3px rgba(6,26,46,0.10), 0 0 0 1px var(--hairline);
  opacity: var(--seg-on, 0);
  pointer-events: none;
  z-index: 0;
  transition: transform 340ms cubic-bezier(0.2,0.7,0.2,1), width 340ms cubic-bezier(0.2,0.7,0.2,1), height 340ms cubic-bezier(0.2,0.7,0.2,1), opacity 160ms var(--ease-out);
}
@media (prefers-reduced-motion: reduce) { .seg::before { transition: opacity 120ms; } }
.seg__btn {
  border: 0; background: transparent;
  font-size: 13.5px; font-weight: 600; letter-spacing: -0.01em;
  color: var(--slate-500);
  padding: 8px 20px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  position: relative; z-index: 1;
  transition: color var(--duration-fast) var(--ease-out);
}
.seg__btn:hover { color: var(--ink-800); }
.seg__btn.is-active {
  background: transparent;
  color: var(--ink-900);
  box-shadow: none;
}

/* =====================================================================
   IDENTITY ROW
   ===================================================================== */
.identity {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: 26px 0 30px;
}
.identity__left { display: flex; align-items: center; gap: 18px; min-width: 0; }
.identity__avatar {
  width: 56px; height: 56px;
  flex: 0 0 auto;
  border-radius: 13px;
  background: linear-gradient(150deg, var(--ac), var(--ac-700));
  color: var(--ac-fg);
  display: grid; place-items: center;
  font-size: 18px; font-weight: 700;
  box-shadow: var(--shadow-sm);
}
.identity__email {
  font-size: 28px;
  font-weight: var(--w-head);
  letter-spacing: -0.025em;
  color: var(--ink-900);
  line-height: 1.1;
}
.identity__org { font-size: 13.5px; color: var(--slate-500); margin-top: 3px; }
.identity__right { display: flex; align-items: center; gap: 22px; }
.identity__pct { text-align: right; }
.identity__pct-label {
  font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--slate-400); font-weight: 600;
}
.identity__pct-sub { font-size: 13px; color: var(--slate-500); margin-top: 4px; }

/* progress ring */
.ring { position: relative; width: 64px; height: 64px; flex: 0 0 auto; }
.ring svg { transform: rotate(-90deg); display: block; }
.ring__track { stroke: var(--neutral-200); }
.ring__fill { stroke: var(--ac); stroke-linecap: round; transition: stroke-dashoffset var(--duration-slow) var(--ease-out); }
.ring__val {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 15px; font-weight: 700; color: var(--ink-900);
  letter-spacing: -0.02em; white-space: nowrap;
}

/* =====================================================================
   KPI STAT STRIP
   ===================================================================== */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.kpi {
  padding: 14px 20px;
  border-left: 1px solid var(--hairline-soft);
  position: relative;
}
.kpi:first-child { border-left: 0; }
.kpi__label {
  font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--slate-400); font-weight: 600;
}
.kpi__val {
  font-size: 30px; font-weight: var(--w-stat);
  letter-spacing: -0.03em; color: var(--ink-900);
  line-height: 1; margin-top: 14px;
  font-feature-settings: "tnum" 1;
  display: flex; align-items: baseline; gap: 4px;
}
.kpi__val .u { font-size: 18px; font-weight: 400; color: var(--slate-400); }
.kpi__hint { font-size: 12px; color: var(--slate-400); margin-top: 6px; display: flex; align-items: center; gap: 6px; }
.kpi__spark { color: var(--ac-600); font-weight: 600; }

/* =====================================================================
   SECTION HEADER
   ===================================================================== */
.section { margin-top: var(--section-gap); }
.section__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}
.section__title {
  font-size: 17px; font-weight: var(--w-head);
  letter-spacing: -0.02em; color: var(--ink-900);
}
.section__sub { font-size: 13px; color: var(--slate-400); margin-top: 3px; }
.section__link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--ac-700);
  cursor: pointer; letter-spacing: -0.01em;
  transition: gap var(--duration-fast) var(--ease-out);
}
.section__link:hover { gap: 9px; }
.section__link svg { width: 15px; height: 15px; }

/* =====================================================================
   CONNECTED SYSTEMS CARDS
   ===================================================================== */
.sys-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.sys-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
  padding: var(--card-pad);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color var(--duration-base) var(--ease-out),
              box-shadow var(--duration-base) var(--ease-out),
              transform var(--duration-base) var(--ease-out);
}
.sys-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.sys-card.is-connected { border-color: var(--ac-line); }
.sys-card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sys-card__id { display: flex; align-items: center; gap: 12px; }
.sys-card__icon {
  width: 40px; height: 40px; flex: 0 0 auto;
  border-radius: 9px;
  background: var(--neutral-100);
  border: 1px solid var(--hairline);
  color: var(--ink-700);
  display: grid; place-items: center;
}
.sys-card__icon svg { width: 20px; height: 20px; }
.sys-card.is-connected .sys-card__icon { background: var(--ac-soft); border-color: var(--ac-line); color: var(--ac-700); }
.sys-card__name { font-size: 15.5px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink-900); }
.sys-card__desc { font-size: 13px; color: var(--slate-500); line-height: 1.5; flex: 1; }

.status-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  padding: 5px 10px; border-radius: var(--radius-pill);
  background: var(--neutral-100); color: var(--slate-500);
  border: 1px solid var(--hairline);
  white-space: nowrap;
}
.status-chip .d { width: 6px; height: 6px; border-radius: 50%; background: var(--slate-300); }
.status-chip.is-on { background: var(--success-bg); color: #2F5A42; border-color: transparent; }
.status-chip.is-on .d { background: var(--success); }

.sys-card__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 2px; }
.sys-card__synced { font-size: 12px; color: var(--slate-400); display: flex; align-items: center; gap: 6px; }
.sys-card__synced svg { width: 13px; height: 13px; color: var(--ac-600); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-sans);
  font-size: 13.5px; font-weight: 600; letter-spacing: -0.01em;
  padding: 12px 22px;
  border-radius: var(--r-control);
  border: 1px solid transparent;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: transform var(--duration-fast) var(--ease-out),
              background var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out);
  line-height: 1;
  min-height: 42px;
}
.btn svg { width: 16px; height: 16px; }
.btn:active { transform: translateY(0.5px); }

.btn--primary {
  background: linear-gradient(180deg, var(--ink-700), var(--ink-800));
  color: #fff;
  box-shadow: 0 1px 2px rgba(6,26,46,0.30), inset 0 1px 0 rgba(255,255,255,0.10);
}
.btn--primary:hover {
  background: linear-gradient(180deg, var(--ink-600), var(--ink-700));
  box-shadow: 0 6px 16px -6px rgba(6,26,46,0.45), inset 0 1px 0 rgba(255,255,255,0.13);
  transform: translateY(-1px);
}
.btn--primary:active { transform: translateY(0); background: var(--ink-900); }

.btn--accent {
  background: var(--ac); color: var(--ac-fg);
  box-shadow: 0 1px 2px rgba(6,26,46,0.20), inset 0 1px 0 rgba(255,255,255,0.28);
}
.btn--accent:hover {
  background: var(--ac-600);
  box-shadow: 0 7px 18px -6px var(--ac-line), inset 0 1px 0 rgba(255,255,255,0.32);
  transform: translateY(-1px);
}
.btn--accent:active { transform: translateY(0); background: var(--ac-700); }

.btn--soft {
  background: color-mix(in oklab, var(--ac) 12%, var(--surface));
  color: var(--ink-800);
  border-color: color-mix(in oklab, var(--ac) 22%, transparent);
  box-shadow: none;
  padding: 12px 24px;
  font-size: 13px;
}
.btn--soft:hover {
  background: color-mix(in oklab, var(--ac) 20%, var(--surface));
  border-color: color-mix(in oklab, var(--ac) 40%, transparent);
  transform: translateY(-1px);
}
.btn--soft:active { transform: translateY(0); background: color-mix(in oklab, var(--ac) 26%, var(--surface)); }

.btn--outline {
  background: var(--surface); border-color: var(--hairline); color: var(--ink-800);
}
.btn--outline:hover { border-color: var(--slate-300); background: var(--neutral-50); box-shadow: var(--shadow-sm); transform: translateY(-1px); }

.btn--ghost { background: transparent; color: var(--slate-500); padding: 12px 16px; box-shadow: none; }
.btn--ghost:hover { color: var(--ink-800); background: var(--neutral-100); }

.btn--sm { padding: 9px 16px; font-size: 12.5px; min-height: 36px; }
.btn:disabled { opacity: 0.6; cursor: default; box-shadow: none; transform: none; }

/* ---- Link-style variant (no background, reads like a link) ---------- */
.app[data-btn="link"] .btn {
  background: none;
  box-shadow: none;
  border-color: transparent;
  padding: 10px 4px;
  color: var(--ac-700);
  border-radius: 0;
}
.app[data-btn="link"] .btn--primary,
.app[data-btn="link"] .btn--accent,
.app[data-btn="link"] .btn--soft { color: var(--ac-700); }
.app[data-btn="link"] .btn--outline { color: var(--ink-800); }
.app[data-btn="link"] .btn--ghost { color: var(--slate-500); }
.app[data-btn="link"] .btn:hover {
  background: none;
  transform: none;
  box-shadow: none;
  color: var(--ink-900);
  text-decoration: underline;
  text-decoration-color: var(--ac);
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}
.app[data-btn="link"] .btn:active { transform: none; }

/* connecting state */
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 0.8s linear infinite; }

/* =====================================================================
   EMPTY STATE (agent recommendations)
   ===================================================================== */
.empty {
  background: var(--surface);
  border: 1px dashed var(--slate-200);
  border-radius: var(--r-card);
  padding: 40px 32px;
  display: flex;
  align-items: center;
  gap: 22px;
}
.empty__icon {
  width: 52px; height: 52px; flex: 0 0 auto;
  border-radius: 12px;
  background: var(--ac-soft);
  color: var(--ac-700);
  display: grid; place-items: center;
}
.empty__icon svg { width: 24px; height: 24px; }
.empty__body { flex: 1; }
.empty__title { font-size: 15px; font-weight: 600; color: var(--ink-900); letter-spacing: -0.01em; }
.empty__text { font-size: 13.5px; color: var(--slate-500); line-height: 1.5; margin-top: 4px; max-width: 540px; }

/* =====================================================================
   DATA QUALITY PANEL
   ===================================================================== */
.dq-panel {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
  padding: 8px var(--card-pad);
  box-shadow: var(--shadow-xs);
}
.dq-row {
  display: grid;
  grid-template-columns: 150px 1fr 56px;
  align-items: center;
  gap: 20px;
  padding: 16px 0;
  border-top: 1px solid var(--hairline-soft);
}
.dq-row:first-child { border-top: 0; }
.dq-row__label { display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 600; color: var(--ink-800); letter-spacing: -0.01em; }
.dq-row__label svg { width: 16px; height: 16px; color: var(--slate-400); }
.dq-row__track { height: 6px; border-radius: 3px; background: var(--neutral-100); overflow: hidden; }
.dq-row__fill {
  height: 100%; border-radius: 3px;
  background: var(--ac);
  transition: width var(--duration-slow) var(--ease-out);
  min-width: 0;
}
.dq-row__val { font-size: 14px; font-weight: 600; color: var(--ink-900); text-align: right; font-feature-settings: "tnum" 1; }
.dq-row__val.is-zero { color: var(--slate-300); }

/* =====================================================================
   FOOTER
   ===================================================================== */
.foot {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  height: var(--foot-h);
  padding: 0 var(--gutter);
  border-top: 1px solid var(--hairline);
  background: var(--surface);
  position: absolute;
  left: 0; right: 0; bottom: 0;
  box-sizing: border-box;
  z-index: 5;
}
.foot__live { display: inline-flex; align-items: center; gap: 7px; color: var(--slate-500); font-family: var(--font-sans); font-size: 11px; font-weight: 600; letter-spacing: normal; text-transform: none; }
.foot__brand { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; letter-spacing: -0.02em; color: var(--slate-500); }
.foot__brand .d { width: 5px; height: 5px; border-radius: 50%; background: var(--ac); }
.foot__brand span { font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; font-size: 9.5px; color: var(--slate-400); }
.foot__meta { display: flex; align-items: center; gap: 18px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.06em; color: var(--slate-300); text-transform: uppercase; }
.foot__meta .sep { color: var(--slate-300); }

/* =====================================================================
   GLOBAL: profile pictures are circular (companies stay rounded-square)
   ===================================================================== */
.who__avatar,
.identity__avatar,
.t-mail__av,
.conv__av,
.msg__av,
.mtg-ava,
.mtg-conv__av,
.mtg-person__av,
.dl-link-row__av,
.dl-act-av { border-radius: 50% !important; }
/* company logos keep a soft square so they read as brands, not people */
.dl-link-row__av.is-co { border-radius: 8px !important; }

/* responsive */
@media (max-width: 1080px) {
  .sys-grid { grid-template-columns: repeat(2, 1fr); }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpi:nth-child(3) { border-left: 0; }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--hairline-soft); }
}

/* placeholder route */
.placeholder {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 110px 20px; gap: 14px;
}
.placeholder__icon {
  width: 60px; height: 60px; border-radius: 15px;
  background: var(--neutral-100); border: 1px solid var(--hairline);
  color: var(--slate-400); display: grid; place-items: center;
}
.placeholder__title { font-size: 22px; font-weight: var(--w-head); color: var(--ink-900); letter-spacing: -0.02em; }
.placeholder__text { max-width: 440px; color: var(--slate-500); font-size: 14px; line-height: 1.6; }
.placeholder .btn { margin-top: 8px; }
