/* ==========================================================================
   DMM Growth Platform — tool-layer skin
   Adapts the Digital Monk marketing brand into a calm, dense internal tool.
   Builds on brand/colors_and_type.css (raw palette + type + spacing).
   ========================================================================== */

/* --------------------------------------------------------------------------
   THEME TOKENS — light (cream) is default, dark via [data-theme="dark"]
   These are *tool* semantics layered on top of the brand palette.
   -------------------------------------------------------------------------- */
:root,
[data-theme="light"] {
  --app-bg: #e7e0d2; /* the desk — a touch deeper than cream */
  --surface: #fbf9f4; /* panels, cards, tables (never pure white) */
  --surface-2: #f4f0e7; /* hover rows, insets, sunken */
  --surface-sunken: #efeade; /* table header, toolbar wells */
  --surface-raise: #ffffff; /* drawers / modals float brightest */

  --sidebar-bg: #053a44; /* deep teal anchor */
  --sidebar-bg-2: #0a4b57;
  --sidebar-fg: #dce9e8;
  --sidebar-muted: #7fa9ae;
  --sidebar-active: #0c7e8e;

  --line: color-mix(in oklab, #333 14%, #f2eee6);
  --line-soft: color-mix(in oklab, #333 8%, #f2eee6);
  --line-strong: color-mix(in oklab, #333 24%, #f2eee6);

  --text: #2c2c2b;
  --text-2: #54544f;
  --text-3: #8a887f;

  --accent: #0c7e8e;
  --accent-hover: #034a56;
  --accent-fg: #fbf9f4;
  --btn-primary-bg: #0c7e8e;
  --btn-primary-bg-hover: #034a56;
  --btn-primary-fg: #fbf9f4;
  --accent-tint: color-mix(in oklab, #0c7e8e 9%, #fbf9f4);
  --accent-line: color-mix(in oklab, #0c7e8e 30%, #fbf9f4);

  --gold: #c79a3e; /* slightly deeper for AA on cream */
  --gold-soft: #daac5a2b;
  --gold-bright: #daac5a;

  --shadow-sm:
    0 1px 2px rgba(40, 38, 30, 0.06), 0 1px 3px rgba(40, 38, 30, 0.05);
  --shadow-md: 0 4px 14px rgba(40, 38, 30, 0.1);
  --shadow-lg: 0 18px 48px rgba(20, 40, 44, 0.2);
  --drawer-scrim: rgba(30, 28, 22, 0.34);
}

[data-theme="dark"] {
  --app-bg: #0b1618;
  --surface: #122427;
  --surface-2: #182e32;
  --surface-sunken: #0e1f22;
  --surface-raise: #16292d;

  --sidebar-bg: #081315;
  --sidebar-bg-2: #0e2024;
  --sidebar-fg: #d7e4e3;
  --sidebar-muted: #6e9499;
  --sidebar-active: #0c7e8e;

  --line: #24403f;
  --line-soft: #1a3133;
  --line-strong: #335150;

  --text: #ecf3f1;
  --text-2: #aec2c0;
  --text-3: #7a9492;

  --accent: #2aa2b2;
  --accent-hover: #56c0cd;
  --accent-fg: #04161a;
  --btn-primary-bg: #0c7e8e;
  --btn-primary-bg-hover: #0a6b79;
  --btn-primary-fg: #f4fbfb;
  --accent-tint: color-mix(in oklab, #2aa2b2 16%, #122427);
  --accent-line: color-mix(in oklab, #2aa2b2 36%, #122427);

  --gold: #daac5a;
  --gold-soft: #daac5a24;
  --gold-bright: #e7bf73;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);
  --drawer-scrim: rgba(0, 0, 0, 0.55);
}

/* --------------------------------------------------------------------------
   SEMANTIC SYSTEMS — stage / score / stream / status
   Each provides a soft bg + a readable fg, tuned per theme.
   -------------------------------------------------------------------------- */
:root,
[data-theme="light"] {
  --st-prospect-fg: #4f5a66;
  --st-prospect-bg: #e7eaee;
  --st-audited-fg: #6b4fa6;
  --st-audited-bg: #ece6f6;
  --st-contacted-fg: #9a6a12;
  --st-contacted-bg: #f6ead2;
  --st-qualified-fg: #9a6a12;
  --st-qualified-bg: #f6ead2;
  --st-client-fg: #2e6b45;
  --st-client-bg: #dcede0;
  --st-churned-fg: #76736c;
  --st-churned-bg: #e8e5de;
  --st-lost-fg: #76736c;
  --st-lost-bg: #e8e5de;

  --score-red-fg: #b03a2e;
  --score-red-bg: #f4ddd8;
  --score-amber-fg: #9a6a12;
  --score-amber-bg: #f6ead2;
  --score-green-fg: #2e6b45;
  --score-green-bg: #dcede0;

  --stream-cold-fg: #b5651d;
  --stream-cold-bg: #f6e6d6;
  --stream-trans-fg: #2f5ea8;
  --stream-trans-bg: #dee7f5;

  --ok-fg: #2e6b45;
  --ok-bg: #dcede0;
  --warn-fg: #9a6a12;
  --warn-bg: #f6ead2;
  --err-fg: #b03a2e;
  --err-bg: #f4ddd8;
  --info-fg: #2f5ea8;
  --info-bg: #dee7f5;

  --dot-red: #c0492f;
  --dot-amber: #c79a3e;
  --dot-green: #3f8f5c;
  --dot-gray: #a8a59b;
}
[data-theme="dark"] {
  --st-prospect-fg: #a9b7c6;
  --st-prospect-bg: #222e3a;
  --st-audited-fg: #c0a8ee;
  --st-audited-bg: #2c2542;
  --st-contacted-fg: #e0b968;
  --st-contacted-bg: #3a2f18;
  --st-qualified-fg: #e0b968;
  --st-qualified-bg: #3a2f18;
  --st-client-fg: #7fcb97;
  --st-client-bg: #16321f;
  --st-churned-fg: #9a9890;
  --st-churned-bg: #26261f;
  --st-lost-fg: #9a9890;
  --st-lost-bg: #26261f;

  --score-red-fg: #e8897a;
  --score-red-bg: #3a1f1a;
  --score-amber-fg: #e0b968;
  --score-amber-bg: #3a2f18;
  --score-green-fg: #7fcb97;
  --score-green-bg: #16321f;

  --stream-cold-fg: #e0a06a;
  --stream-cold-bg: #372417;
  --stream-trans-fg: #8db2ee;
  --stream-trans-bg: #1e2c44;

  --ok-fg: #7fcb97;
  --ok-bg: #16321f;
  --warn-fg: #e0b968;
  --warn-bg: #3a2f18;
  --err-fg: #e8897a;
  --err-bg: #3a1f1a;
  --info-fg: #8db2ee;
  --info-bg: #1e2c44;

  --dot-red: #e07565;
  --dot-amber: #daac5a;
  --dot-green: #5fbf82;
  --dot-gray: #5c6b6a;
}

/* --------------------------------------------------------------------------
   DENSITY
   -------------------------------------------------------------------------- */
:root,
[data-density="comfortable"] {
  --row-h: 48px;
  --row-pad: 14px;
  --cell-fs: 13.5px;
}
[data-density="compact"] {
  --row-h: 38px;
  --row-pad: 10px;
  --cell-fs: 13px;
}

/* --------------------------------------------------------------------------
   RESET / BASE
   -------------------------------------------------------------------------- */
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}
body {
  font-family: var(--font-sans);
  background: var(--app-bg);
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
h1,
h2,
h3,
h4,
h5 {
  color: var(--text);
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
a {
  color: var(--accent);
  text-decoration: none;
}
button {
  font-family: inherit;
}
::selection {
  background: var(--gold-soft);
  color: var(--text);
}

/* scrollbars */
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
*::-webkit-scrollbar-thumb {
  background: color-mix(in oklab, var(--text-3) 40%, transparent);
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover {
  background: color-mix(in oklab, var(--text-3) 64%, transparent);
  background-clip: padding-box;
}
*::-webkit-scrollbar-track {
  background: transparent;
}

/* gold rule signature */
.gold-rule {
  display: inline-block;
  width: 36px;
  height: 2px;
  background: var(--gold-bright);
  border-radius: 1px;
}
.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   APP SHELL
   -------------------------------------------------------------------------- */
#root {
  height: 100vh;
}
.app {
  display: grid;
  grid-template-columns: auto 1fr;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-fg);
  width: 232px;
  flex: none;
  display: flex;
  flex-direction: column;
  transition: width var(--dur-base) var(--ease-standard);
  border-right: 1px solid color-mix(in oklab, #000 16%, var(--sidebar-bg));
  position: relative;
  z-index: 30;
}
.sidebar.collapsed {
  width: 64px;
}

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 14px;
  height: 56px;
}
.wordmark {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  user-select: none;
}
.wordmark .wm-logo {
  height: 30px;
  width: auto;
  object-fit: contain;
  display: block;
}
.wordmark .wm-mark {
  height: 26px;
  width: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}
.wordmark .wm-glyph {
  width: 26px;
  height: 26px;
  object-fit: contain;
  flex: none;
}
.wordmark .wm-text {
  display: flex;
  flex-direction: column;
  line-height: 0.96;
}
.wordmark .wm-text b {
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: 0.02em;
  color: var(--sidebar-fg);
}
.wordmark .wm-text span {
  font-size: 8.5px;
  letter-spacing: 0.34em;
  color: var(--sidebar-muted);
  text-transform: uppercase;
}
.sidebar.collapsed .wm-text {
  display: none;
}

.nav {
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow-y: auto;
  flex: 1;
}
.nav-section-label {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sidebar-muted);
  padding: 14px 10px 6px;
}
.sidebar.collapsed .nav-section-label {
  text-align: center;
  padding-left: 0;
  padding-right: 0;
  font-size: 0;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--sidebar-fg);
  cursor: pointer;
  position: relative;
  font-size: 13.5px;
  font-weight: 500;
  transition:
    background var(--dur-fast) var(--ease-standard),
    color var(--dur-fast);
  white-space: nowrap;
}
.nav-item svg {
  width: 18px;
  height: 18px;
  flex: none;
  opacity: 0.86;
}
.nav-item:hover {
  background: var(--sidebar-bg-2);
}
.nav-item.active {
  background: color-mix(in oklab, var(--sidebar-active) 90%, #000);
  color: #fff;
}
.nav-item.active svg {
  opacity: 1;
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 7px;
  bottom: 7px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--gold-bright);
}
.nav-badge {
  margin-left: auto;
  background: var(--gold-bright);
  color: #3a2a06;
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 7px;
  min-width: 18px;
  text-align: center;
}
.sidebar.collapsed .nav-item span.label,
.sidebar.collapsed .nav-badge {
  display: none;
}
.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 9px 0;
}

.sidebar-foot {
  border-top: 1px solid color-mix(in oklab, #000 18%, var(--sidebar-bg));
  padding: 10px;
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 8px;
  cursor: pointer;
}
.user-chip:hover {
  background: var(--sidebar-bg-2);
}
.user-chip .uc-meta {
  line-height: 1.2;
  min-width: 0;
}
.user-chip .uc-meta b {
  display: block;
  font-size: 13px;
  color: var(--sidebar-fg);
  font-weight: 600;
}
.user-chip .uc-meta span {
  font-size: 11px;
  color: var(--sidebar-muted);
}
.sidebar.collapsed .uc-meta,
.sidebar.collapsed .uc-caret {
  display: none;
}

/* main column */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
}

.topbar {
  height: 56px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 20;
}
.collapse-btn {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-2);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: none;
}
.collapse-btn:hover {
  background: var(--surface-sunken);
  color: var(--text);
}
.crumbs {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  color: var(--text-3);
  min-width: 0;
}
.crumbs b {
  color: var(--text);
  font-weight: 600;
}
.crumbs .sep {
  opacity: 0.5;
}

.global-search {
  margin-left: auto;
  width: 320px;
  max-width: 34vw;
  position: relative;
}
.global-search input {
  width: 100%;
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface-sunken);
  color: var(--text);
  padding: 0 12px 0 34px;
  font-size: 13px;
  font-family: inherit;
  transition:
    border-color var(--dur-fast),
    background var(--dur-fast);
}
.global-search input:focus {
  outline: none;
  border-color: var(--accent-line);
  background: var(--surface);
}
.global-search .gs-ico {
  position: absolute;
  left: 11px;
  top: 9px;
  color: var(--text-3);
  pointer-events: none;
}
.global-search .gs-kbd {
  position: absolute;
  right: 9px;
  top: 8px;
  font-size: 11px;
  color: var(--text-3);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 6px;
  background: var(--surface);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-2);
  display: grid;
  place-items: center;
  cursor: pointer;
  position: relative;
  transition: all var(--dur-fast);
}
.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}
.icon-btn .dot-alert {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dot-red);
  border: 1.5px solid var(--surface);
}

.content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
}
.content-inner {
  padding: 24px 28px 80px;
}
.content-inner.wide {
  max-width: none;
}
.content-inner.narrow {
  max-width: 1180px;
  margin: 0 auto;
}

.page-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}
.page-head .ph-titles {
  min-width: 0;
}
.page-head h1 {
  font-size: 23px;
}
.page-head .ph-sub {
  color: var(--text-3);
  font-size: 13.5px;
  margin-top: 3px;
}
.page-head .ph-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
  flex: none;
}

/* --------------------------------------------------------------------------
   BUTTONS
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border-radius: 9px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--dur-fast) var(--ease-standard);
  font-family: inherit;
}
.btn svg {
  width: 16px;
  height: 16px;
}
.btn--primary {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
}
.btn--primary:hover {
  background: var(--btn-primary-bg-hover);
}
.btn--gold {
  background: var(--gold-bright);
  color: #3a2a06;
}
.btn--gold:hover {
  filter: brightness(0.96);
}
.btn--ghost {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
}
.btn--ghost:hover {
  background: var(--surface-2);
  border-color: var(--line-strong);
}
.btn--quiet {
  background: transparent;
  color: var(--text-2);
  border-color: transparent;
}
.btn--quiet:hover {
  background: var(--surface-2);
  color: var(--text);
}
.btn--danger {
  background: transparent;
  color: var(--err-fg);
  border-color: color-mix(in oklab, var(--err-fg) 40%, transparent);
}
.btn--danger:hover {
  background: var(--err-bg);
}
.btn--sm {
  height: 30px;
  padding: 0 11px;
  font-size: 12.5px;
  border-radius: 8px;
}
.btn--icon {
  padding: 0;
  width: 36px;
}
.btn--icon.btn--sm {
  width: 30px;
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* --------------------------------------------------------------------------
   PILLS / BADGES / DOTS
   -------------------------------------------------------------------------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--text-2);
}
.pill .pdot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.pill--clickable {
  cursor: pointer;
}
.pill--clickable:hover {
  filter: brightness(0.97);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, currentColor 30%, transparent);
}
.stage-prospect {
  background: var(--st-prospect-bg);
  color: var(--st-prospect-fg);
}
.stage-audited {
  background: var(--st-audited-bg);
  color: var(--st-audited-fg);
}
.stage-contacted {
  background: var(--st-contacted-bg);
  color: var(--st-contacted-fg);
}
.stage-qualified {
  background: var(--st-qualified-bg);
  color: var(--st-qualified-fg);
}
.stage-client {
  background: var(--st-client-bg);
  color: var(--st-client-fg);
}
.stage-churned {
  background: var(--st-churned-bg);
  color: var(--st-churned-fg);
}
.stage-lost {
  background: var(--st-lost-bg);
  color: var(--st-lost-fg);
}

.stream-cold {
  background: var(--stream-cold-bg);
  color: var(--stream-cold-fg);
}
.stream-transactional {
  background: var(--stream-trans-bg);
  color: var(--stream-trans-fg);
}

.score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 30px;
  height: 24px;
  padding: 0 8px;
  border-radius: 7px;
  font-weight: 700;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.score-red {
  background: var(--score-red-bg);
  color: var(--score-red-fg);
}
.score-amber {
  background: var(--score-amber-bg);
  color: var(--score-amber-fg);
}
.score-green {
  background: var(--score-green-bg);
  color: var(--score-green-fg);
}
.score-none {
  background: var(--surface-2);
  color: var(--text-3);
  font-weight: 600;
}

.sdot {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-2);
  white-space: nowrap;
}
.sdot i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}
.sdot--red i {
  background: var(--dot-red);
}
.sdot--amber i {
  background: var(--dot-amber);
}
.sdot--green i {
  background: var(--dot-green);
}
.sdot--gray i {
  background: var(--dot-gray);
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 8px;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
}
.tag-chip .x {
  cursor: pointer;
  opacity: 0.6;
  display: inline-flex;
}
.tag-chip .x:hover {
  opacity: 1;
}

.avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex: none;
  letter-spacing: 0.02em;
}
.avatar--sm {
  width: 22px;
  height: 22px;
  font-size: 10px;
}
.avatar--lg {
  width: 34px;
  height: 34px;
  font-size: 13px;
}

/* --------------------------------------------------------------------------
   CARDS / PANELS
   -------------------------------------------------------------------------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}
.panel-pad {
  padding: 18px;
}
.panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.panel-head h3 {
  font-size: 14.5px;
}
.panel-head .ph-r {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}
.card-stamp {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 26px;
  height: 26px;
  opacity: 0.5;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
}
.metric-card .mc-label {
  font-size: 12px;
  color: var(--text-3);
  font-weight: 500;
}
.metric-card .mc-value {
  font-size: 30px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.metric-card .mc-delta {
  font-size: 12px;
  font-weight: 600;
  margin-top: 5px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.delta-up {
  color: var(--ok-fg);
}
.delta-down {
  color: var(--err-fg);
}
.delta-flat {
  color: var(--text-3);
}

/* --------------------------------------------------------------------------
   DATA TABLE
   -------------------------------------------------------------------------- */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--cell-fs);
}
.tbl thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-sunken);
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-3);
  padding: 9px var(--row-pad);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  user-select: none;
}
.tbl thead th.sortable {
  cursor: pointer;
}
.tbl thead th.sortable:hover {
  color: var(--text);
}
.tbl thead th .th-sort {
  margin-left: 4px;
  opacity: 0.5;
}
.tbl tbody td {
  padding: 0 var(--row-pad);
  height: var(--row-h);
  border-bottom: 1px solid var(--line-soft);
  color: var(--text-2);
  vertical-align: middle;
  white-space: nowrap;
}
.tbl tbody tr {
  transition: background var(--dur-fast);
  cursor: pointer;
}
.tbl tbody tr:hover {
  background: var(--surface-2);
}
.tbl tbody tr.selected {
  background: var(--accent-tint);
}
.tbl tbody tr:last-child td {
  border-bottom: 0;
}
.tbl td.name-cell {
  color: var(--text);
  font-weight: 600;
}
.tbl td.col-check,
.tbl th.col-check {
  width: 38px;
  padding-left: 14px;
  padding-right: 0;
}
.tbl .muted {
  color: var(--text-3);
}
.cell-sub {
  font-size: 11.5px;
  color: var(--text-3);
  font-weight: 400;
}
.row-actions {
  opacity: 0;
  transition: opacity var(--dur-fast);
}
.tbl tbody tr:hover .row-actions {
  opacity: 1;
}

.checkbox {
  width: 16px;
  height: 16px;
  border-radius: 5px;
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  flex: none;
  transition: all var(--dur-fast);
  color: transparent;
}
.checkbox.checked {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}
.checkbox.indet {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}

/* filter / toolbar */
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.toolbar .spacer {
  flex: 1;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 11px;
  border-radius: 9px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--dur-fast);
}
.filter-chip:hover {
  border-color: var(--line-strong);
}
.filter-chip.active {
  background: var(--accent-tint);
  border-color: var(--accent-line);
  color: var(--accent);
}
.filter-chip .fc-val {
  font-weight: 700;
  color: var(--text);
}
.filter-chip .fc-x {
  opacity: 0.6;
}
.filter-chip .fc-x:hover {
  opacity: 1;
}
.table-search {
  position: relative;
}
.table-search input {
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 0 10px 0 30px;
  font-size: 12.5px;
  width: 200px;
  font-family: inherit;
}
.table-search input:focus {
  outline: none;
  border-color: var(--accent-line);
}
.table-search .ts-ico {
  position: absolute;
  left: 9px;
  top: 8px;
  color: var(--text-3);
}

/* bulk action bar */
.bulk-bar {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 8px 8px 16px;
  z-index: 25;
  animation: bulkin var(--dur-base) var(--ease-out);
}
[data-theme="dark"] .bulk-bar {
  background: #02292f;
  color: #ecf3f1;
  border: 1px solid var(--line-strong);
}
@keyframes bulkin {
  from {
    opacity: 0;
    transform: translate(-50%, 12px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}
.bulk-bar .bb-count {
  font-size: 13px;
  font-weight: 600;
  padding-right: 8px;
  margin-right: 4px;
  border-right: 1px solid color-mix(in oklab, currentColor 25%, transparent);
}
.bulk-bar .bb-act {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 11px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  color: inherit;
  background: transparent;
  border: 0;
  transition: background var(--dur-fast);
}
.bulk-bar .bb-act:hover {
  background: color-mix(in oklab, currentColor 16%, transparent);
}
.bulk-bar .bb-act svg {
  width: 15px;
  height: 15px;
}
.bulk-bar .bb-close {
  margin-left: 4px;
}

/* pagination */
.pager {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
  padding: 12px 4px 0;
  color: var(--text-3);
  font-size: 12.5px;
}
.pager .pg-btn {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-2);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.pager .pg-btn:hover {
  background: var(--surface-2);
}
.pager .pg-btn.active {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}

/* --------------------------------------------------------------------------
   EMPTY / LOADING STATES
   -------------------------------------------------------------------------- */
.empty-state {
  text-align: center;
  padding: 56px 24px;
  max-width: 460px;
  margin: 12px auto;
}
.empty-state .es-art {
  width: 84px;
  height: 84px;
  margin: 0 auto 18px;
  opacity: 0.9;
}
.empty-state h3 {
  font-size: 18px;
  margin-bottom: 7px;
}
.empty-state p {
  color: var(--text-3);
  margin: 0 auto 18px;
  font-size: 13.5px;
  max-width: 340px;
}
.skel {
  background: linear-gradient(
    90deg,
    var(--surface-2) 25%,
    var(--surface-sunken) 37%,
    var(--surface-2) 63%
  );
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: 6px;
}
@keyframes shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

/* --------------------------------------------------------------------------
   DRAWER / MODAL
   -------------------------------------------------------------------------- */
.scrim {
  position: fixed;
  inset: 0;
  background: var(--drawer-scrim);
  z-index: 60;
}
@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 720px;
  max-width: 94vw;
  z-index: 61;
  background: var(--surface-raise);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: drawin var(--dur-slow) var(--ease-out);
}
.drawer.drawer--wide {
  width: 980px;
}
@keyframes drawin {
  from {
    transform: translateX(36px);
  }
  to {
    transform: translateX(0);
  }
}
.modal-wrap {
  position: fixed;
  inset: 0;
  z-index: 62;
  display: grid;
  place-items: center;
  padding: 24px;
}
.modal {
  background: var(--surface-raise);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 460px;
  animation: modalin var(--dur-base) var(--ease-out);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.modal.modal--lg {
  max-width: 720px;
}
@keyframes modalin {
  from {
    transform: translateY(10px) scale(0.99);
  }
  to {
    transform: none;
  }
}
.modal-head {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.modal-head h3 {
  font-size: 16px;
}
.modal-head p {
  font-size: 12.5px;
  color: var(--text-3);
  margin-top: 3px;
}
.modal-body {
  padding: 18px 20px;
  overflow-y: auto;
}
.modal-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* --------------------------------------------------------------------------
   FORMS
   -------------------------------------------------------------------------- */
.field {
  margin-bottom: 14px;
}
.field > label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.field .hint {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 5px;
}
.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 9px;
  padding: 9px 11px;
  font-size: 13.5px;
  font-family: inherit;
  transition: border-color var(--dur-fast);
}
.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-tint);
}
.textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.55;
}
.input::placeholder,
.textarea::placeholder {
  color: var(--text-3);
}
.field-row {
  display: flex;
  gap: 12px;
}
.field-row > * {
  flex: 1;
}

.seg {
  display: inline-flex;
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 3px;
  gap: 2px;
}
.seg button {
  border: 0;
  background: transparent;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 7px;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--dur-fast);
}
.seg button.on {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.toggle {
  width: 38px;
  height: 22px;
  border-radius: 12px;
  background: var(--line-strong);
  position: relative;
  cursor: pointer;
  transition: background var(--dur-fast);
  flex: none;
}
.toggle.on {
  background: var(--accent);
}
.toggle::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform var(--dur-fast) var(--ease-out);
  box-shadow: var(--shadow-sm);
}
.toggle.on::after {
  transform: translateX(16px);
}

/* --------------------------------------------------------------------------
   TABS
   -------------------------------------------------------------------------- */
.tabbar {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line);
}
.tab {
  padding: 10px 14px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-3);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color var(--dur-fast);
  display: flex;
  align-items: center;
  gap: 7px;
}
.tab:hover {
  color: var(--text);
}
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.tab .tab-count {
  font-size: 11px;
  background: var(--surface-2);
  color: var(--text-3);
  border-radius: 8px;
  padding: 0 6px;
  height: 16px;
  display: inline-grid;
  place-items: center;
}
.tab.active .tab-count {
  background: var(--accent-tint);
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   ACTIVITY TIMELINE
   -------------------------------------------------------------------------- */
.timeline {
  position: relative;
}
.tl-item {
  display: flex;
  gap: 12px;
  padding: 9px 0;
  position: relative;
}
.tl-item::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 30px;
  bottom: -9px;
  width: 1.5px;
  background: var(--line);
}
.tl-item:last-child::before {
  display: none;
}
.tl-ico {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex: none;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--line);
  z-index: 1;
}
.tl-ico svg {
  width: 14px;
  height: 14px;
}
.tl-body {
  min-width: 0;
  padding-top: 3px;
}
.tl-body .tl-sum {
  font-size: 13px;
  color: var(--text);
}
.tl-body .tl-meta {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 2px;
}

/* progress */
.progress {
  height: 10px;
  border-radius: 6px;
  background: var(--surface-sunken);
  overflow: hidden;
  border: 1px solid var(--line);
}
.progress > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  border-radius: 6px;
  transition: width 0.4s var(--ease-out);
}
.progress--gold > i {
  background: linear-gradient(90deg, var(--gold-bright), var(--gold));
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 11px;
}
.bar-row .br-label {
  width: 120px;
  font-size: 12.5px;
  color: var(--text-2);
  flex: none;
}
.bar-row .br-track {
  flex: 1;
  height: 8px;
  border-radius: 5px;
  background: var(--surface-sunken);
  overflow: hidden;
}
.bar-row .br-fill {
  height: 100%;
  border-radius: 5px;
}
.bar-row .br-val {
  width: 34px;
  text-align: right;
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex: none;
}

/* log stream */
.logfeed {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  line-height: 1.7;
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  max-height: 280px;
  overflow-y: auto;
}
.logfeed .lg {
  display: flex;
  gap: 10px;
  white-space: nowrap;
}
.logfeed .lg .t {
  color: var(--text-3);
  flex: none;
}
.logfeed .lg.add .m {
  color: var(--ok-fg);
}
.logfeed .lg.dupe .m {
  color: var(--text-3);
}
.logfeed .lg.fail .m {
  color: var(--err-fg);
}

/* wizard steps */
.wizsteps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 22px;
}
.wizstep {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
}
.wizstep .ws-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12.5px;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--text-3);
  border: 1px solid var(--line);
  flex: none;
  transition: all var(--dur-fast);
}
.wizstep .ws-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
  white-space: nowrap;
}
.wizstep.active .ws-num {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}
.wizstep.active .ws-label {
  color: var(--text);
}
.wizstep.done .ws-num {
  background: var(--st-client-bg);
  color: var(--st-client-fg);
  border-color: transparent;
}
.wizstep.done .ws-label {
  color: var(--text-2);
}
.wizline {
  flex: 1;
  height: 1.5px;
  background: var(--line);
  margin: 0 12px;
  min-width: 18px;
}

/* toast */
.toast-stack {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.toast {
  background: var(--text);
  color: var(--surface);
  border-radius: 10px;
  padding: 11px 14px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 13px;
  font-weight: 500;
  min-width: 280px;
  max-width: 440px;
  animation: toastin var(--dur-base) var(--ease-out);
}
[data-theme="dark"] .toast {
  background: #02292f;
  color: #ecf3f1;
  border: 1px solid var(--line-strong);
}
@keyframes toastin {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.toast .t-ico {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
}
.toast .t-act {
  margin-left: auto;
  color: var(--gold-bright);
  font-weight: 700;
  cursor: pointer;
  background: none;
  border: 0;
  font-size: 13px;
  font-family: inherit;
}

/* misc utility */
.row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.col {
  display: flex;
  flex-direction: column;
}
.grow {
  flex: 1;
}
.muted {
  color: var(--text-3);
}
.mono {
  font-variant-numeric: tabular-nums;
}
.divider-h {
  height: 1px;
  background: var(--line);
  margin: 14px 0;
}
.kbd {
  display: inline-block;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 11px;
  color: var(--text-2);
  background: var(--surface);
  font-family: ui-monospace, monospace;
}
.link {
  color: var(--accent);
  cursor: pointer;
  font-weight: 600;
}
.link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.grid-cards {
  display: grid;
  gap: 16px;
}
.gc-2 {
  grid-template-columns: repeat(2, 1fr);
}
.gc-3 {
  grid-template-columns: repeat(3, 1fr);
}
.gc-4 {
  grid-template-columns: repeat(4, 1fr);
}
@media (max-width: 1100px) {
  .gc-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  .gc-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* dropdown menu */
.menu {
  background: var(--surface-raise);
  border: 1px solid var(--line);
  border-radius: 11px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  min-width: 190px;
  z-index: 70;
  animation: modalin var(--dur-fast) var(--ease-out);
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.menu-item:hover {
  background: var(--surface-2);
}
.menu-item svg {
  width: 15px;
  height: 15px;
  opacity: 0.7;
}
.menu-item.danger {
  color: var(--err-fg);
}
.menu-sep {
  height: 1px;
  background: var(--line);
  margin: 5px 0;
}
.menu-label {
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 8px 10px 4px;
}

/* banner */
.banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 11px;
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid;
}
.banner--info {
  background: var(--info-bg);
  color: var(--info-fg);
  border-color: color-mix(in oklab, var(--info-fg) 24%, transparent);
}
.banner--warn {
  background: var(--warn-bg);
  color: var(--warn-fg);
  border-color: color-mix(in oklab, var(--warn-fg) 24%, transparent);
}
.banner--gold {
  background: var(--gold-soft);
  color: var(--text);
  border-color: color-mix(in oklab, var(--gold-bright) 40%, transparent);
}
.banner .b-act {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

/* sparkline */
.spark {
  display: block;
}

/* focus ring */
:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 2px;
}

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

/* pdf-ish preview surface */
.pdf-surface {
  background: #fff;
  color: #222;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
}

/* sequence builder */
.seq {
  position: relative;
  padding-left: 8px;
}
.seq-step {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 13px 15px;
  position: relative;
}
.seq-wait {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-3);
  font-size: 12px;
  padding: 7px 0 7px 14px;
  position: relative;
}
.seq-wait::before {
  content: "";
  position: absolute;
  left: 0;
  top: -6px;
  bottom: -6px;
  width: 1.5px;
  background: var(--line);
  border-left: 1.5px dashed var(--line-strong);
}

/* sequence builder v2 — clean timeline */
.seqx {
  display: flex;
  flex-direction: column;
}
.seqx-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--surface-raise);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.seqx-num {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-tint);
  color: var(--accent);
  border: 1px solid var(--accent-line);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13.5px;
  flex: none;
  font-variant-numeric: tabular-nums;
}
.seqx-grow {
  flex: 1;
  min-width: 0;
}
.seqx-conn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
}
.seqx-vline {
  width: 2px;
  height: 30px;
  background: var(--line);
  border-radius: 2px;
  margin-left: 14px;
  flex: none;
}
.seqx-wait {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 5px 9px 5px 11px;
  font-size: 12.5px;
  color: var(--text-2);
}
.seqx-wait input {
  width: 48px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  text-align: center;
  font-family: inherit;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.seqx-wait input:focus {
  outline: none;
  border-color: var(--accent-line);
}
.seqx-wait select {
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 0 6px;
  cursor: pointer;
}
.seqx-wait select:focus {
  outline: none;
  border-color: var(--accent-line);
}
.seqx-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 21px;
  padding: 0 9px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 11.5px;
  font-weight: 600;
}
.seqx-global {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-sunken);
  margin-top: 8px;
}

/* rich text email editor */
.rte-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  padding: 6px;
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 9px 9px 0 0;
}
.rte-btn {
  min-width: 30px;
  height: 30px;
  padding: 0 7px;
  border-radius: 6px;
  border: 0;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  font-size: 13.5px;
  font-weight: 700;
  font-family: inherit;
}
.rte-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}
.rte-btn.on {
  background: var(--accent-tint);
  color: var(--accent);
}
.rte-btn i {
  font-style: italic;
}
.rte-btn u {
  text-decoration: underline;
}
.rte-sep {
  width: 1px;
  align-self: stretch;
  background: var(--line);
  margin: 4px 5px;
}
.rte-area {
  border: 1px solid var(--line);
  border-radius: 0 0 9px 9px;
  background: var(--surface);
  overflow: hidden;
}
.rte-edit {
  min-height: 300px;
  max-height: 430px;
  overflow-y: auto;
  padding: 16px 18px;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text);
  outline: none;
}
.rte-edit:empty::before {
  content: attr(data-ph);
  color: var(--text-3);
}
.rte-edit p {
  margin: 0 0 12px;
}
.rte-edit h2 {
  font-size: 19px;
  margin: 0 0 10px;
  color: var(--text);
}
.rte-edit h3 {
  font-size: 16px;
  margin: 0 0 8px;
}
.rte-edit ul,
.rte-edit ol {
  margin: 0 0 12px;
  padding-left: 22px;
}
.rte-edit li {
  margin-bottom: 4px;
}
.rte-edit a {
  color: var(--accent);
}
.rte-edit .email-btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 11px 20px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  margin: 4px 0;
}
.rte-code {
  display: block;
  width: 100%;
  min-height: 330px;
  max-height: 430px;
  border: 0;
  background: var(--surface);
  color: var(--text);
  font-family: ui-monospace, monospace;
  font-size: 12.5px;
  padding: 16px 18px;
  outline: none;
  resize: vertical;
  line-height: 1.6;
  box-sizing: border-box;
}

/* merge field catalog */
.mf-item {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  margin-bottom: 6px;
  overflow: hidden;
}
.mf-head {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  cursor: pointer;
}
.mf-head:hover {
  background: var(--surface-2);
}
.mf-token {
  font-family: ui-monospace, monospace;
  font-size: 11.5px;
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mf-src {
  font-size: 10px;
  color: var(--text-3);
  margin-left: auto;
  white-space: nowrap;
  flex: none;
}
.mf-body {
  padding: 0 9px 9px;
  border-top: 1px solid var(--line-soft);
}
.mf-body .lbl {
  font-size: 10.5px;
  color: var(--text-3);
  margin: 8px 0 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.mf-fb-input {
  width: 100%;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-sunken);
  color: var(--text);
  font-size: 12px;
  padding: 0 8px;
  font-family: inherit;
}
.mf-fb-input:focus {
  outline: none;
  border-color: var(--accent-line);
}
.mf-insert {
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* preview merge markers */
.mf-real {
  background: #e7f3ee;
  color: #2e6b45;
  border-radius: 3px;
  padding: 0 2px;
}
.mf-miss {
  background: #f6ead2;
  color: #9a6a12;
  border-radius: 3px;
  padding: 0 2px;
  border-bottom: 1.5px dotted #c79a3e;
}

/* template card grid */
.tmpl-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
  overflow: hidden;
  cursor: pointer;
  transition: all var(--dur-fast);
  box-shadow: var(--shadow-sm);
}
.tmpl-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.tmpl-thumb {
  height: 120px;
  background: var(--surface-sunken);
  border-bottom: 1px solid var(--line);
  padding: 14px;
  overflow: hidden;
  position: relative;
}
.tmpl-thumb .tt-line {
  height: 7px;
  background: var(--line);
  border-radius: 4px;
  margin-bottom: 7px;
}

/* funnel */
.funnel-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}
.funnel-bar {
  height: 30px;
  border-radius: 7px;
  background: var(--accent);
  display: flex;
  align-items: center;
  padding: 0 12px;
  color: var(--accent-fg);
  font-weight: 700;
  font-size: 13px;
  min-width: 54px;
}

/* phone frame for public audit */
.phone {
  width: 390px;
  background: var(--surface-raise);
  border-radius: 30px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.phone-notch {
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.phone-notch::after {
  content: "";
  width: 90px;
  height: 6px;
  border-radius: 4px;
  background: var(--line-strong);
}

/* tweaks fab */
.tweaks-fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--accent);
  color: var(--accent-fg);
  border: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  z-index: 80;
  transition: transform var(--dur-fast);
}
.tweaks-fab:hover {
  transform: translateY(-2px);
}

/* tweak-gated decoration */
.geo-off .geo-motif {
  display: none !important;
}
.gold-off .gold-rule {
  display: none !important;
}

/* theme-aware logo swap (dark wordmark on dark surfaces, dark-text on light) */
.auth-logo-light {
  display: none;
}
[data-theme="light"] .auth-logo-dark {
  display: none;
}
[data-theme="light"] .auth-logo-light {
  display: block;
}

/* radio (token: radio / radio-checked) */
.radio {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  display: inline-grid;
  place-items: center;
  flex: none;
  cursor: pointer;
  transition: border-color var(--dur-fast);
}
.radio.on {
  border-color: var(--accent);
}
.radio.on::after {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
}

/* radio-card (token: radio-card / radio-card-selected) */
.radio-card {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 11px 13px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  cursor: pointer;
}
.radio-card.on {
  background: var(--accent-tint);
  border-color: var(--accent-line);
}

/* multi-select (token: multi-select) */
.multiselect {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-height: 38px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 9px;
}
.multiselect input {
  border: 0;
  background: transparent;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  flex: 1;
  min-width: 80px;
}

/* hover-card (token: hover-card) */
.hovercard {
  background: var(--surface-raise);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 14px;
  width: 240px;
}

/* ---- static state simulation for the component library (token-based) ---- */
.is-hover.btn--primary {
  background: var(--accent-hover);
}
.is-hover.btn--ghost {
  background: var(--surface-2);
  border-color: var(--line-strong);
}
.is-hover.btn--quiet {
  background: var(--surface-2);
  color: var(--text);
}
.is-hover.btn--danger {
  background: var(--err-bg);
}
.is-pressed.btn {
  transform: translateY(1px);
  filter: brightness(0.95);
}
.is-focus.btn {
  outline: 2px solid var(--gold-bright);
  outline-offset: 2px;
}
.is-hover.tbl-row,
tr.is-hover {
  background: var(--surface-2) !important;
}
.is-focus.input {
  outline: none;
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-tint);
}
.is-hover.nav-item {
  background: var(--sidebar-bg-2);
}
