/* ═══════════════════════════════════════════
   NetWeb CRM - Complete Stylesheet
   ═══════════════════════════════════════════ */

/* ── Auth-flash prevention ──────────────────────────────────────────────
   Hide the page immediately so unauthenticated users never see dashboard
   chrome. enforceAuthGate() in app.js sets visibility:'' once auth passes
   or reveals login.html. A redirect is instant anyway, but this closes
   the JS-parse window (~20–80 ms) where the HTML shell was briefly visible. */
html { visibility: hidden; }

/* ── Reset & Variables ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f1117;
  --bg-card: #1a1d27;
  --bg-card-hover: #222531;
  --bg-input: #141620;
  --accent: #6c5ce7;
  --accent-hover: #7d6ff0;
  --accent-dim: rgba(108, 92, 231, 0.15);
  --text: #e4e7ec;
  --text-dim: #8b8fa3;
  --text-muted: #5a5e70;
  --border: #2a2d3a;
  --border-light: #333648;
  --green: #00b894;
  --cyan: #00cec9;
  --orange: #fdcb6e;
  --red: #e17055;
  --sidebar-width: 260px;
  --sidebar-collapsed: 72px;
  --header-height: 64px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  --transition: 0.2s ease;
  /* ── White-label branding tokens (overridden at runtime by js/branding.js) ──
     Defaults are NWM Gulf-Oil palette. Per-tenant values are written to
     :root by branding.js after fetching /api/?r=organizations&sub=current. */
  --brand-primary: #010F3B;
  --brand-secondary: #FF671F;
  --brand-logo-url: none;
}

html { height: 100%; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100%;
  overflow: hidden;
}
a { color: var(--accent); text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ── Layout ── */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width var(--transition);
  flex-shrink: 0;
  z-index: 100;
  overflow: hidden;
}
.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .user-info { display: none; }
/* Collapsed: stack the brand mark over the toggle so the (now rotated, points-
   right) expand button is always reachable inside the 72px rail. */
.sidebar.collapsed .sidebar-header { flex-direction: column; justify-content: center; gap: 12px; padding: 16px 8px; }
.sidebar.collapsed .sidebar-toggle { transform: rotate(180deg); }
.sidebar.collapsed .nav-item { justify-content: center; padding: 12px; }
.sidebar.collapsed .user-card { justify-content: center; }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
  min-height: 65px;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-icon {
  width: 36px;
  height: 36px;
  /* The default NWM mark is the inline circular roundel (.nwm-badge), which
     carries its own navy/orange fills, so the container is transparent. */
  background: transparent;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
  overflow: hidden;
}
.brand-icon .nwm-badge { width: 100%; height: 100%; display: block; }
/* White-label: a tenant logo URL replaces the default NWM roundel — render
   it as a background image and hide the inline mark. */
.brand-icon[data-nwm-logo-icon="custom"] {
  background-image: var(--brand-logo-url);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  background-color: transparent;
  color: transparent;
}
.brand-icon[data-nwm-logo-icon="custom"] .nwm-badge { display: none; }
.brand-text {
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
}
.sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  flex-shrink: 0;
}
.sidebar-toggle:hover { color: var(--text); background: var(--bg); }

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.nav-item:hover { color: var(--text); background: var(--bg); }
.nav-item.active { color: var(--accent); background: var(--accent-dim); }
.nav-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

/* ── Collapsible nav groups ── */
.nav-group { display: flex; flex-direction: column; }
.nav-group-header {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  transition: var(--transition);
}
.nav-group-header:hover { color: var(--text); background: var(--bg); }
.nav-group.has-active > .nav-group-header { color: var(--accent); }
.nav-group-chevron {
  margin-left: auto;
  display: flex;
  align-items: center;
  transition: transform var(--transition);
}
.nav-group.open > .nav-group-header .nav-group-chevron { transform: rotate(90deg); }
.nav-group-items {
  display: none;
  flex-direction: column;
  gap: 2px;
  margin-left: 15px;
  padding-left: 7px;
  border-left: 1px solid var(--border);
}
.nav-group.open .nav-group-items { display: flex; }
/* Shown on a niche CRM tab that cannot narrow its rows yet — deliberately
   plain, so it reads as a caveat rather than an error. */
.niche-scope-notice {
  margin: 0 0 14px;
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-left: 3px solid #FF671F;
  border-radius: 6px;
  background: rgba(255, 103, 31, 0.06);
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.45;
}
.nav-group-nested {
  margin-left: 28px;
  padding-left: 10px;
  border-left: 1px solid var(--border);
}
.nav-group-nested > .nav-group-header {
  min-height: 34px;
  padding: 7px 8px 7px 0;
  font-size: 13px;
}
.nav-group-nested > .nav-group-items {
  margin-left: 8px;
  padding-left: 7px;
}
.nav-group-nested > .nav-group-items .nav-item {
  min-height: 31px;
  padding-left: 24px;
  font-size: 13px;
}
/* Collapsed rail: group headers disappear and every item stays reachable as
   a flat icon column (tooltips carry the labels). */
.sidebar.collapsed .nav-group-header { display: none; }
.sidebar.collapsed .nav-group-items {
  display: flex;
  margin-left: 0;
  padding-left: 0;
  border-left: none;
}

/* Fracmo niche account selector — mounted directly below Dashboard. */
.workspace-selector-host {
  position: relative;
  min-width: 0;
}
.workspace-selector {
  position: relative;
  margin: 2px 0 6px;
}
.workspace-selector-trigger {
  width: 100%;
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 12px;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  text-align: left;
  transition: var(--transition);
}
.workspace-selector-trigger:hover,
.workspace-selector.is-open .workspace-selector-trigger {
  color: var(--text);
  background: var(--bg);
  border-color: var(--border);
}
.workspace-selector-trigger:focus-visible,
.workspace-selector-option:focus-visible,
.workspace-selector-retry:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.workspace-selector-icon {
  width: 20px;
  flex: 0 0 20px;
  color: var(--accent);
  font-size: 20px;
  line-height: 1;
  text-align: center;
}
.workspace-selector-labels {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}
.workspace-selector-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}
.workspace-selector-current {
  overflow: hidden;
  color: var(--text-dim);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.workspace-selector-chevron {
  flex: 0 0 auto;
  font-size: 17px;
  transform: rotate(0);
  transition: transform var(--transition);
}
.workspace-selector.is-open .workspace-selector-chevron {
  transform: rotate(180deg);
}
.workspace-selector-menu {
  position: absolute;
  z-index: 240;
  top: calc(100% + 5px);
  left: 0;
  width: 100%;
  max-height: min(420px, 60vh);
  overflow-y: auto;
  padding: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}
.workspace-selector-option {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 11px;
  color: var(--text-dim);
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  text-align: left;
}
.workspace-selector-option:hover:not(:disabled) {
  color: var(--text);
  background: var(--bg);
}
.workspace-selector-option.is-active {
  color: var(--accent);
  background: var(--accent-dim);
}
.workspace-selector-option-name {
  width: 100%;
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.workspace-selector-option-meta {
  color: var(--text-dim);
  font-size: 10px;
  text-transform: capitalize;
}
.workspace-selector-status,
.workspace-selector-error {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  color: var(--text-dim);
  font-size: 11px;
}
.workspace-selector-error {
  color: #fca5a5;
  flex-wrap: wrap;
}
.workspace-selector-retry {
  padding: 3px 7px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 10px;
}
.workspace-selector-inline-error {
  margin: 5px;
  padding: 8px;
  color: #fecaca;
  background: rgba(239, 68, 68, 0.1);
  border-radius: var(--radius-sm);
  font-size: 11px;
}
.workspace-intent-error {
  position: fixed;
  z-index: 10000;
  right: 20px;
  bottom: 20px;
  max-width: min(420px, calc(100vw - 40px));
  padding: 12px 14px;
  color: #fecaca;
  background: #7f1d1d;
  border: 1px solid #ef4444;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  line-height: 1.45;
}
.nav-section-label {
  margin: 12px 12px 4px;
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.sidebar.collapsed .workspace-selector {
  margin-bottom: 4px;
}
.sidebar.collapsed .workspace-selector-trigger {
  min-height: 44px;
  justify-content: center;
  padding: 10px;
}
.sidebar.collapsed .workspace-selector-labels,
.sidebar.collapsed .workspace-selector-chevron,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .workspace-selector-status,
.sidebar.collapsed .workspace-selector-error {
  display: none;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}
.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-card .user-info { flex: 1; min-width: 0; }
.user-card .user-name,
.user-card .user-role { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition);
  text-decoration: none;
}
.sidebar-logout-btn:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.5);
  color: #ef4444;
}
.sidebar.collapsed .sidebar-logout-btn { display: none; }
.user-avatar {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}
.user-info { white-space: nowrap; }
.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 11px; color: var(--text-dim); }

/* ── Main Content ── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  transition: var(--transition);
}

/* ── Header ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: var(--header-height);
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  flex-shrink: 0;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.page-title {
  font-size: 20px;
  font-weight: 700;
}
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  padding: 4px;
}
.header-icon-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  position: relative;
}
.header-icon-btn:hover { color: var(--text); border-color: var(--border-light); }
.notif-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 7px;
  height: 7px;
  background: var(--red);
  border-radius: 50%;
}
.header-avatar {
  width: 34px;
  height: 34px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  border: none;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--border-light); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-save.saved { background: var(--green); }

/* ── Page Body ── */
.page-body {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px 40px;
}

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 26px;
  min-height: 140px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
}
.card-title {
  font-size: 15px;
  font-weight: 600;
}

/* Empty-state bodies inside cards (e.g. "No revenue data yet.") — give them breathing room */
.card > div:not(.card-header):empty,
.card > div:not(.card-header) {
  padding-top: 4px;
}

/* ═══════════════════════════════
   DASHBOARD
   ═══════════════════════════════ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 110px;
}
.stat-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card-link { cursor: pointer; text-decoration: none; color: inherit; }
.stat-card-link:hover .stat-value { color: var(--accent); }
/* Unread website-chat leads — sits above the stats grid on the dashboard.
   Deliberately loud: a chat lead nobody answers is a lost sale, and the quiet
   version of this (a number inside conversations.html) went unread for six days. */
.unread-chats-alert {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding: 0.9rem 1.15rem;
  border-radius: 10px;
  border-left: 4px solid var(--accent);
  background: var(--accent-dim);
  color: var(--text);
  font-size: 0.94rem;
  text-decoration: none;
  transition: background var(--transition);
}
.unread-chats-alert:hover { background: var(--bg-card-hover); }
.unread-chats-alert[hidden] { display: none; }
.unread-chats-alert .unread-chats-count {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.1rem 0.6rem;
  flex-shrink: 0;
}
.unread-chats-alert .unread-chats-cta { margin-left: auto; color: var(--accent); font-weight: 700; }
/* Clickable dashboard panel rows (deals / contacts / schedule) — drill into the record list */
.dash-row-link { text-decoration: none; color: inherit; cursor: pointer; }
.dash-row-link:hover .deal-title,
.dash-row-link:hover .contact-name,
.dash-row-link:hover .schedule-title { color: var(--accent); }
.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
  gap: 12px;
}
.stat-label {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.stat-icon { color: var(--accent); opacity: 0.6; }
.stat-value { font-size: 28px; font-weight: 700; margin-bottom: 6px; }
.stat-change { font-size: 12px; }
.stat-change.positive { color: var(--green); }
.stat-change.negative { color: var(--red); }

.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}
.dashboard-col { display: flex; flex-direction: column; gap: 20px; }

/* Dashboard empty-state text (rendered by dashboard.js when no data) */
.empty-state, [id="revenueChart"]:empty::before,
[id="activeDeals"]:empty::before, [id="todaySchedule"]:empty::before,
[id="recentContacts"]:empty::before {
  display: block;
  text-align: center;
  color: var(--text-dim);
  padding: 32px 16px;
  font-size: 14px;
}

/* Revenue Chart */
.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  height: 200px;
  padding-top: 20px;
}
.chart-bar-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}
.chart-bar-wrapper {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.chart-bar {
  width: 70%;
  max-width: 48px;
  background: var(--border-light);
  border-radius: 4px 4px 0 0;
  transition: height 0.5s ease;
}
.chart-bar.accent { background: var(--accent); }
.chart-label {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 8px;
}

/* Schedule */
.schedule-item {
  display: flex;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.schedule-item:last-child { border-bottom: none; }
.schedule-time {
  font-size: 12px;
  color: var(--text-dim);
  min-width: 72px;
  padding-top: 2px;
}
.schedule-title { font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.schedule-type {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}
.type-meeting { background: rgba(108, 92, 231, 0.15); color: var(--accent); }
.type-call { background: rgba(0, 184, 148, 0.15); color: var(--green); }
.type-task { background: rgba(225, 112, 85, 0.15); color: var(--red); }

/* Deal rows */
.deal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.deal-row:last-child { border-bottom: none; }
.deal-title { font-size: 14px; font-weight: 500; }
.deal-company { font-size: 12px; color: var(--text-dim); }
.deal-value { font-size: 14px; font-weight: 600; text-align: right; }
.deal-stage {
  font-size: 11px;
  color: var(--text-dim);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 10px;
}

/* Contact rows */
.contact-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.contact-row:last-child { border-bottom: none; }
.contact-avatar {
  width: 38px;
  height: 38px;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}
.contact-avatar.small { width: 32px; height: 32px; font-size: 11px; }
.contact-info { flex: 1; min-width: 0; }
.contact-name { font-size: 14px; font-weight: 500; }
.contact-company { font-size: 12px; color: var(--text-dim); }

/* ── Status Badges ── */
.status-badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 10px;
  font-weight: 600;
  white-space: nowrap;
}
.status-customer { background: rgba(0, 184, 148, 0.15); color: var(--green); }
.status-prospect { background: rgba(0, 206, 201, 0.15); color: var(--cyan); }
.status-lead { background: rgba(253, 203, 110, 0.15); color: var(--orange); }
.status-churned { background: rgba(225, 112, 85, 0.15); color: var(--red); }

/* ═══════════════════════════════
   CONTACTS PAGE
   ═══════════════════════════════ */

.contacts-layout {
  display: flex;
  gap: 0;
  height: 100%;
}
.contacts-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.contacts-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.search-input-wrap {
  position: relative;
  flex: 1;
  max-width: 320px;
}
.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  display: flex;
}
.search-input {
  width: 100%;
  padding: 8px 12px 8px 38px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: var(--transition);
}
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--text-muted); }

.filter-group {
  display: flex;
  gap: 4px;
}
.filter-btn {
  padding: 6px 14px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 500;
  transition: var(--transition);
}
.filter-btn:hover { border-color: var(--border-light); color: var(--text); }
.filter-btn.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

.contacts-table-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 0 28px;
}
.contacts-table {
  width: 100%;
  border-collapse: collapse;
}
.contacts-table th {
  text-align: left;
  padding: 14px 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 2;
}
.contacts-table td {
  padding: 14px 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.contact-table-row { cursor: pointer; transition: var(--transition); }
.contact-table-row:hover { background: var(--bg-card-hover); }
.td-flex {
  display: flex;
  align-items: center;
  gap: 10px;
}
.td-name { font-weight: 500; }
.td-email { font-size: 12px; color: var(--text-dim); }
.empty-state {
  text-align: center;
  color: var(--text-dim);
  padding: 40px 0;
}

/* Contact Detail Panel */
.contact-detail {
  width: 0;
  overflow: hidden;
  border-left: 1px solid var(--border);
  background: var(--bg-card);
  transition: width 0.3s ease;
  flex-shrink: 0;
}
.contact-detail.open { width: 380px; overflow-y: auto; }

.detail-header {
  padding: 24px 20px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.detail-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}
.detail-close:hover { color: var(--text); }
.detail-avatar {
  width: 64px;
  height: 64px;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  margin: 0 auto 12px;
}
.detail-name { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.detail-role { font-size: 13px; color: var(--text-dim); margin-bottom: 10px; }

.detail-section {
  padding: 20px;
  border-bottom: 1px solid var(--border);
}
.detail-section h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  margin-bottom: 14px;
}
.detail-field {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 13px;
}
.field-label { color: var(--text-dim); }
.field-value { font-weight: 500; }
.detail-notes { font-size: 13px; color: var(--text-dim); line-height: 1.6; }
.detail-actions {
  padding: 20px;
  display: flex;
  gap: 10px;
}

/* ═══════════════════════════════
   PIPELINE PAGE
   ═══════════════════════════════ */

.pipeline-board {
  display: flex;
  gap: 12px;
  flex: 1;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 16px;
}
/* List view renders a single tall table instead of columns — let it scroll vertically. */
.pipeline-board.list-view { overflow-y: auto; }
.pipeline-column {
  min-width: 260px;
  max-width: 280px;
  flex-shrink: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  max-height: 100%;
}
.column-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.column-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.column-name { font-size: 13px; font-weight: 600; }
.column-count {
  background: var(--bg);
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 10px;
  color: var(--text-dim);
}
.column-value { font-size: 12px; color: var(--text-dim); }

.column-cards {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 60px;
}
.column-cards.drag-over {
  background: var(--accent-dim);
  border-radius: 0 0 var(--radius) var(--radius);
}

.deal-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  cursor: grab;
  transition: var(--transition);
}
.deal-card:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow); }
.deal-card.dragging { opacity: 0.5; }
.deal-card-title { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.deal-card-company { font-size: 12px; color: var(--text-dim); margin-bottom: 10px; }
.deal-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.deal-card-value { font-size: 14px; font-weight: 700; }
.deal-card-prob { font-size: 12px; font-weight: 600; }
.deal-card-contact { font-size: 11px; color: var(--text-dim); }
.deal-card-source { display: inline-block; font-size: 10px; font-weight: 600; color: #6c5ce7; background: rgba(108,92,231,.15); border: 1px solid rgba(108,92,231,.3); padding: 2px 7px; border-radius: 20px; margin-bottom: 6px; text-transform: uppercase; letter-spacing: .4px; }
.deal-card-followup { font-size: 11px; color: var(--brand-secondary, #FF671F); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deal-card-days { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ═══════════════════════════════
   CONVERSATIONS PAGE
   ═══════════════════════════════ */

.conversations-layout {
  display: flex;
  height: 100%;
  overflow: hidden;
}
.conv-sidebar {
  width: 360px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  background: var(--bg-card);
}
.conv-filters {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 6px;
}
.channel-btn {
  padding: 5px 12px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 500;
  transition: var(--transition);
}
.channel-btn:hover { border-color: var(--border-light); color: var(--text); }
.channel-btn.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

.conv-list {
  flex: 1;
  overflow-y: auto;
}
.conv-item {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
}
.conv-item:hover { background: var(--bg-card-hover); }
.conv-item.active { background: var(--accent-dim); border-left: 3px solid var(--accent); }
.conv-item.unread .conv-name { font-weight: 700; }
.conv-item.unread .conv-subject { color: var(--text); }
.conv-avatar {
  width: 40px;
  height: 40px;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}
.conv-content { flex: 1; min-width: 0; }
.conv-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}
.conv-name { font-size: 13px; font-weight: 500; }
.conv-time { font-size: 11px; color: var(--text-muted); }
.conv-subject {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 2px;
  font-weight: 500;
}
.conv-preview {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-channel {
  display: flex;
  align-items: flex-start;
  padding-top: 2px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.empty-conv {
  text-align: center;
  color: var(--text-dim);
  padding: 40px 16px;
}

/* Chat Panel */
.chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.chat-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}
.chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.chat-header-name { font-size: 15px; font-weight: 600; }
.chat-header-channel {
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.chat-message {
  display: flex;
  gap: 10px;
  max-width: 70%;
}
.chat-message.sent {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.msg-avatar {
  width: 32px;
  height: 32px;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}
.msg-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
}
.chat-message.sent .msg-bubble {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.msg-text { font-size: 13px; line-height: 1.5; }
.msg-time { font-size: 11px; color: var(--text-muted); margin-top: 6px; }
.chat-message.sent .msg-time { color: rgba(255, 255, 255, 0.6); }

.chat-input {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  gap: 10px;
}
.chat-input textarea {
  flex: 1;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  resize: none;
  outline: none;
  min-height: 42px;
  max-height: 120px;
}
.chat-input textarea:focus { border-color: var(--accent); }
.chat-input textarea::placeholder { color: var(--text-muted); }
.chat-input .btn { align-self: flex-end; }
.chat-input .btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ═══════════════════════════════
   AI TRIAGE PANEL (conversations)
   ═══════════════════════════════ */
.triage-panel {
  border-top: 1px solid var(--border);
  background: rgba(255, 103, 31, 0.06); /* tinted Gulf orange */
  padding: 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
}
.triage-panel[hidden] { display: none; }
.triage-loading,
.triage-error {
  color: var(--text-muted);
  font-style: italic;
}
.triage-error { color: #c0392b; font-style: normal; }
.triage-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.triage-badge,
.triage-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
  border: 1px solid transparent;
  line-height: 1.4;
}
/* Intent — neutral chips, color reserved for urgency */
.triage-intent { background: #eef2ff; color: #1e3a8a; }
.triage-intent-spam { background: #fee2e2; color: #991b1b; }
.triage-intent-complaint { background: #fef3c7; color: #92400e; }
/* Urgency — semantic */
.triage-urgency-low { background: #ecfdf5; color: #065f46; }
.triage-urgency-normal { background: #f3f4f6; color: #374151; }
.triage-urgency-urgent { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
/* Action pill */
.triage-action { background: #010F3B; color: #fff; }
.triage-action-mark_spam { background: #6b7280; }
.triage-fallback { background: #f3f4f6; color: #6b7280; font-weight: 500; }

.triage-draft {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.triage-draft-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.triage-draft-text {
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
}
.triage-draft .btn { align-self: flex-start; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

#triageBtn { align-self: flex-end; white-space: nowrap; }
#triageBtn .triage-btn-label { margin-left: 4px; }

/* ═══════════════════════════════
   CALENDAR PAGE
   ═══════════════════════════════ */

.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.calendar-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}
.calendar-nav .btn { padding: 6px 10px; }
.week-label {
  font-size: 16px;
  font-weight: 600;
  min-width: 200px;
  text-align: center;
}

.calendar-grid {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.cal-header-row {
  display: grid;
  grid-template-columns: 72px repeat(5, 1fr);
  border-bottom: 1px solid var(--border);
}
.cal-time-gutter {
  background: var(--bg-card);
}
.cal-day-header {
  padding: 14px 12px;
  text-align: center;
  border-left: 1px solid var(--border);
}
.cal-day-header.today { background: var(--accent-dim); }
.cal-day-name {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.cal-day-num { font-size: 20px; font-weight: 700; }
.cal-day-num.today { color: var(--accent); }

.cal-body { max-height: calc(100vh - 280px); overflow-y: auto; }
.cal-row {
  display: grid;
  grid-template-columns: 72px repeat(5, 1fr);
  min-height: 60px;
}
.cal-time-label {
  padding: 8px 10px 0;
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
  border-right: 1px solid var(--border);
}
.cal-cell {
  border-left: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  position: relative;
  min-height: 60px;
}
.cal-event {
  position: absolute;
  left: 3px;
  right: 3px;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  overflow: hidden;
  z-index: 1;
  cursor: pointer;
}
.cal-event-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ═══════════════════════════════
   SETTINGS PAGE
   ═══════════════════════════════ */

.settings-layout {
  display: flex;
  gap: 0;
  height: 100%;
}
.settings-tabs {
  width: 220px;
  border-right: 1px solid var(--border);
  padding: 16px 8px;
  flex-shrink: 0;
  background: var(--bg-card);
}
.settings-tab {
  display: block;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  text-align: left;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 2px;
}
.settings-tab:hover { color: var(--text); background: var(--bg); }
.settings-tab.active { color: var(--accent); background: var(--accent-dim); }

.settings-content {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
}
.settings-panel { display: none; }
.settings-panel.active { display: block; }
.settings-panel h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
}
.settings-panel .section-desc {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 20px;
}
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  max-width: 480px;
  padding: 9px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: var(--transition);
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus { border-color: var(--accent); }
.form-input::placeholder,
.form-textarea::placeholder { color: var(--text-muted); }
.form-select { appearance: auto; }
.form-textarea { resize: vertical; min-height: 80px; }
.form-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  max-width: 480px;
}

/* Toggle */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  max-width: 480px;
}
.toggle-label { font-size: 14px; font-weight: 500; }
.toggle-desc { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--border-light);
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition);
}
.toggle-slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: var(--transition);
}
.toggle-switch input:checked + .toggle-slider { background: var(--accent); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* Team Members */
.team-member {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.team-member-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.team-member-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.team-role {
  font-size: 12px;
  color: var(--text-dim);
  background: var(--bg);
  padding: 3px 10px;
  border-radius: 10px;
}

/* Settings sections divider */
.settings-divider {
  height: 1px;
  background: var(--border);
  margin: 28px 0;
  max-width: 480px;
}

/* Billing plan cards */
.plan-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  max-width: 720px;
}
.plan-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  transition: var(--transition);
}
.plan-card.current { border-color: var(--accent); }
.plan-card-name { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.plan-card-price { font-size: 28px; font-weight: 700; margin-bottom: 4px; }
.plan-card-price span { font-size: 13px; color: var(--text-dim); font-weight: 400; }
.plan-card-desc { font-size: 12px; color: var(--text-dim); margin-bottom: 16px; }
.plan-card .btn { width: 100%; justify-content: center; }

/* ═══════════════════════════════
   RESPONSIVE
   ═══════════════════════════════ */

@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 992px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    transform: translateX(-100%);
    z-index: 200;
    width: var(--sidebar-width);
    box-shadow: var(--shadow);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar.mobile-open {
    width: min(320px, calc(100vw - 24px));
  }
  .workspace-selector-menu {
    max-height: min(420px, 55vh);
  }
  .mobile-menu-btn { display: flex; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .contact-detail.open { width: 300px; }
  .conv-sidebar { width: 280px; }
  .settings-tabs { width: 180px; }
  .plan-cards { grid-template-columns: 1fr; max-width: 320px; }
}
@media (max-width: 640px) {
  .page-header { padding: 0 16px; }
  .page-body { padding: 16px; }
  .contacts-toolbar { padding: 12px 16px; }
  .contacts-table-wrap { padding: 0 16px; }
  .contact-detail.open { width: 100%; position: absolute; right: 0; top: 0; bottom: 0; z-index: 50; }
  .conv-sidebar { width: 100%; }
  .chat-panel { display: none; }
  .settings-layout { flex-direction: column; }
  .settings-tabs {
    width: 100%;
    flex-direction: row;
    display: flex;
    overflow-x: auto;
    padding: 8px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .settings-tab { white-space: nowrap; }
  .form-row { grid-template-columns: 1fr; }
}

/* ── Utility Classes ── */
/* Pipeline shell: flex column so the top bar (tabs/KPIs/filters) is pinned and the
   board flexes to fill the remaining height. The board owns horizontal scroll; columns
   (or the list-view table) own vertical scroll — so the page itself never scrolls. */
.pipeline-body { display: flex; flex-direction: column; overflow: hidden; }
.team-invite-wrap { margin-bottom: 20px; }
.subsection-title { font-size: 15px; font-weight: 600; margin-bottom: 16px; }
.chat-placeholder-avatar { opacity: 0.3; }
.chat-placeholder-text { color: var(--text-dim); }

/* ═══════════════════════════════
   TAB BAR (Reusable)
   ═══════════════════════════════ */

.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  background: var(--bg-card);
}
.tab-btn {
  padding: 12px 20px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ═══════════════════════════════
   SUMMARY CARDS (Reusable row)
   ═══════════════════════════════ */

.summary-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.summary-card .card-label {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.summary-card .card-value {
  font-size: 28px;
  font-weight: 700;
}
.summary-card .card-value.green { color: var(--green); }
.summary-card .card-value.orange { color: var(--orange); }
.summary-card .card-value.red { color: var(--red); }

/* ═══════════════════════════════
   DATA TABLE (Reusable)
   ═══════════════════════════════ */

.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  text-align: left;
  padding: 14px 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}
.data-table td {
  padding: 14px 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.data-table tbody tr { transition: var(--transition); }
.data-table tbody tr:hover { background: var(--bg-card-hover); }

/* Additional status badges */
.status-paid { background: rgba(0, 184, 148, 0.15); color: var(--green); }
.status-pending { background: rgba(253, 203, 110, 0.15); color: var(--orange); }
.status-overdue { background: rgba(225, 112, 85, 0.15); color: var(--red); }
.status-active { background: rgba(0, 184, 148, 0.15); color: var(--green); }
.status-inactive { background: rgba(139, 143, 163, 0.15); color: var(--text-dim); }
.status-draft { background: rgba(139, 143, 163, 0.15); color: var(--text-dim); }
.status-completed { background: rgba(108, 92, 231, 0.15); color: var(--accent); }
.status-sent { background: rgba(0, 206, 201, 0.15); color: var(--cyan); }
.status-viewed { background: rgba(253, 203, 110, 0.15); color: var(--orange); }
.status-signed { background: rgba(0, 184, 148, 0.15); color: var(--green); }
.status-published { background: rgba(0, 184, 148, 0.15); color: var(--green); }

/* ═══════════════════════════════
   PAYMENTS PAGE
   ═══════════════════════════════ */

.payments-body { padding: 24px 28px; overflow-y: auto; flex: 1; }

/* ═══════════════════════════════
   MARKETING PAGE
   ═══════════════════════════════ */

.marketing-body { padding: 24px 28px; overflow-y: auto; flex: 1; }

/* ═══════════════════════════════
   AUTOMATION PAGE - Workflow Cards
   ═══════════════════════════════ */

.automation-body { padding: 24px 28px; overflow-y: auto; flex: 1; }

.workflow-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.workflow-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: var(--transition);
}
.workflow-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.workflow-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}
.workflow-card-title { font-size: 15px; font-weight: 600; }
.workflow-card-trigger { font-size: 12px; color: var(--text-dim); margin-bottom: 14px; line-height: 1.5; }
.workflow-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-dim);
}
.workflow-card-stats {
  display: flex;
  gap: 16px;
}
.workflow-stat span { font-weight: 600; color: var(--text); }

/* Status toggle (compact) */
.status-toggle {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.status-toggle input { opacity: 0; width: 0; height: 0; }
.status-toggle .toggle-track {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--border-light);
  border-radius: 11px;
  cursor: pointer;
  transition: var(--transition);
}
.status-toggle .toggle-track::before {
  content: "";
  position: absolute;
  width: 16px; height: 16px;
  left: 3px; bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: var(--transition);
}
.status-toggle input:checked + .toggle-track { background: var(--green); }
.status-toggle input:checked + .toggle-track::before { transform: translateX(18px); }

/* ═══════════════════════════════
   SITES PAGE - Funnel/Site Cards
   ═══════════════════════════════ */

.sites-body { padding: 24px 28px; overflow-y: auto; flex: 1; }

.site-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.site-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
}
.site-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.site-card-thumb {
  height: 140px;
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.site-card-body { padding: 16px; }
.site-card-title { font-size: 15px; font-weight: 600; margin-bottom: 8px; }
.site-card-stats {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 12px;
}
.site-card-stats span { font-weight: 600; color: var(--text); }
.site-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ═══════════════════════════════
   REPUTATION PAGE - Reviews
   ═══════════════════════════════ */

.reputation-body { padding: 24px 28px; overflow-y: auto; flex: 1; }

.review-list { display: flex; flex-direction: column; gap: 12px; }
.review-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: var(--transition);
}
.review-item:hover { border-color: var(--border-light); }
.review-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.review-author {
  display: flex;
  align-items: center;
  gap: 10px;
}
.review-platform {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 10px;
  font-weight: 600;
}
.platform-google { background: rgba(66, 133, 244, 0.15); color: #4285f4; }
.platform-facebook { background: rgba(24, 119, 242, 0.15); color: #1877f2; }
.review-stars { color: #fdcb6e; font-size: 16px; letter-spacing: 1px; margin-bottom: 8px; }
.review-text { font-size: 13px; color: var(--text-dim); line-height: 1.6; margin-bottom: 8px; }
.review-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

/* Star rating display */
.star-rating { color: #fdcb6e; font-size: 24px; letter-spacing: 2px; }

/* ═══════════════════════════════
   REPORTING PAGE
   ═══════════════════════════════ */

.reporting-body { padding: 24px 28px; overflow-y: auto; flex: 1; }

.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
.chart-placeholder {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  min-height: 260px;
  display: flex;
  flex-direction: column;
}
.chart-placeholder-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
}
.chart-placeholder-area {
  flex: 1;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ═══════════════════════════════
   DOCUMENTS PAGE
   ═══════════════════════════════ */

.documents-body { padding: 24px 28px; overflow-y: auto; flex: 1; }

/* ═══════════════════════════════
   COURSES PAGE - Course Cards
   ═══════════════════════════════ */

.courses-body { padding: 28px 32px 40px; overflow-y: auto; flex: 1; }

/* Stats strip above grid */
.courses-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.courses-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.courses-stat-label {
  font-size: 11px; color: var(--text-dim); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.6px;
  margin-bottom: 4px;
}
.courses-stat-value { font-size: 24px; font-weight: 700; }

/* Toolbar */
.courses-toolbar {
  display: flex; gap: 12px; align-items: center; margin-bottom: 20px;
}
.course-search {
  flex: 1; max-width: 420px;
  padding: 10px 14px; font-size: 13px;
  background: var(--bg-input); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); outline: none;
}
.course-search:focus { border-color: var(--accent); }

.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}
.course-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
}
.course-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.course-card-thumb {
  height: 140px;
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.course-card-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 10px; }
.course-card-title { font-size: 16px; font-weight: 700; line-height: 1.3; margin: 0; }
.course-card-tag { font-size: 12px; color: var(--text-dim); line-height: 1.5; margin: 0; min-height: 36px; }
.course-card-stats {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 12px;
}
.course-card-stats span { font-weight: 600; color: var(--text); }

.course-meta {
  display: flex; flex-wrap: wrap; gap: 10px 14px;
  font-size: 11px; color: var(--text-dim); margin-top: 2px;
}
.course-meta-item { letter-spacing: .02em; }
.course-meta-item b { color: var(--text); font-weight: 700; }

.course-enroll {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; color: var(--text-dim); margin-top: 4px;
}
.course-enroll-pct { font-weight: 700; color: var(--text); }

.course-card-thumb {
  height: 130px !important;
  display: flex !important;
  flex-direction: column;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px;
}
.course-thumb-icon { font-size: 42px; line-height: 1; }
.course-thumb-title { font-size: 13px; font-weight: 700; letter-spacing: .04em; text-align: center; padding: 0 12px; }

.course-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  gap: 10px;
}
.progress-bar {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-right: 10px;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* ═══════════════════════════════
   SOCIAL PLANNER PAGE
   ═══════════════════════════════ */

.social-body { padding: 24px 28px; overflow-y: auto; flex: 1; }

.social-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
}
.social-day {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 200px;
  display: flex;
  flex-direction: column;
}
.social-day-header {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}
.social-day-header span {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 500;
  text-transform: uppercase;
  margin-bottom: 2px;
}
.social-day-body {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.social-post {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 11px;
  cursor: pointer;
  transition: var(--transition);
}
.social-post:hover { background: var(--bg-card-hover); }
.social-post-platform {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.platform-fb { background: #1877f2; }
.platform-ig { background: #e1306c; }
.platform-li { background: #0a66c2; }
.platform-yt { background: #ff0000; }
.platform-tk { background: #010101; }

/* ── Connected Accounts panel ───────────────────────────────────────── */
.social-accounts-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 24px;
}
.social-accounts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.social-accounts-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.social-accounts-badge {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 10px;
}
.social-accounts-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}
.social-connect-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  transition: border-color var(--transition);
}
.social-connect-card:hover { border-color: var(--border-light); }
.social-connect-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.scc-icon {
  width: 34px !important;
  height: 34px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  flex-shrink: 0;
}
.social-connect-info { flex: 1; min-width: 0; }
.social-connect-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.social-connect-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  margin-top: 3px;
}
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-connected   { color: var(--green); }
.status-connected   .status-dot { background: var(--green); }
.status-disconnected { color: var(--text-muted); }
.status-disconnected .status-dot { background: var(--text-muted); }
.social-connect-note {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: 10px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

/* ── Today column highlight ─────────────────────────────────────────── */
.social-day-today { border-color: var(--accent) !important; }
.social-day-today .social-day-header { color: var(--accent); }

/* ── Social connect modal instructions ─────────────────────────────── */
.social-modal-instructions {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.7;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 20px;
}
.social-modal-instructions code {
  font-size: 11px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  color: var(--cyan);
}
.social-post-time { color: var(--text-muted); white-space: nowrap; font-size: 10px; }
.social-post-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

/* Action link button */
.action-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.action-link:hover { background: var(--accent-dim); }

/* ═══════════════════════════════
   RESPONSIVE ADDITIONS
   ═══════════════════════════════ */

@media (max-width: 1200px) {
  .summary-cards { grid-template-columns: repeat(2, 1fr); }
  .charts-row { grid-template-columns: 1fr; }
  .social-calendar { grid-template-columns: repeat(4, 1fr); }
  .social-accounts-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 992px) {
  .workflow-grid { grid-template-columns: 1fr; }
  .site-grid { grid-template-columns: 1fr; }
  .course-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .summary-cards { grid-template-columns: 1fr; }
  .tab-bar { padding: 0 16px; overflow-x: auto; }
  .social-calendar { grid-template-columns: repeat(2, 1fr); }
  .social-accounts-grid { grid-template-columns: repeat(2, 1fr); }
  .payments-body, .marketing-body, .automation-body, .sites-body,
  .reputation-body, .reporting-body, .documents-body, .courses-body,
  .social-body { padding: 16px; }
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ═══════════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════════ */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
  overflow: auto;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 80px rgba(108, 92, 231, 0.06);
  position: relative;
}

.login-gradient-line {
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--cyan), var(--accent));
  background-size: 200% 100%;
}

.login-header {
  padding: 40px 36px 0;
  text-align: center;
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 28px;
}

.login-brand-text {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.login-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.login-form {
  padding: 28px 36px 0;
}

.login-field {
  margin-bottom: 20px;
}

.login-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.login-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.login-input::placeholder {
  color: var(--text-muted);
}

.login-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.2);
}

.login-btn {
  width: 100%;
  padding: 13px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  margin-top: 4px;
}

.login-btn:hover {
  background: var(--accent-hover);
}

.login-btn:active {
  transform: scale(0.98);
}

.login-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.login-error {
  color: var(--red);
  font-size: 13px;
  min-height: 20px;
  text-align: center;
  margin-bottom: 4px;
}

.login-tabs {
  display: flex;
  padding: 0 36px;
  gap: 0;
  border-bottom: 1px solid var(--border-glass, rgba(255,255,255,0.08));
}

.login-tab {
  flex: 1;
  padding: 14px 0;
  background: none;
  border: none;
  color: var(--text-dim, #8b8fa3);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  font-family: inherit;
}

.login-tab:hover {
  color: var(--text, #e4e7ec);
}

.login-tab.active {
  color: var(--accent, #6c5ce7);
  border-bottom-color: var(--accent, #6c5ce7);
}

.login-form-hidden {
  display: none;
}

.login-remember {
  display: flex;
  align-items: center;
  margin-top: -4px;
  margin-bottom: 18px;
}

.login-remember-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}

.login-remember-check {
  width: 16px;
  height: 16px;
  accent-color: var(--accent, #6c5ce7);
  cursor: pointer;
}

.login-forgot {
  text-align: center;
  margin-top: 12px;
  font-size: 13px;
}

.login-forgot a {
  color: var(--accent, #6c5ce7);
  text-decoration: none;
  font-weight: 500;
}

.login-forgot a:hover {
  text-decoration: underline;
}

.login-footer {
  padding: 24px 36px 32px;
  text-align: center;
}

.login-terms {
  font-size: 11px;
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════
   UPGRADE MODAL
   ═══════════════════════════════════════════ */

.upgrade-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.upgrade-modal {
  width: 100%;
  max-width: 720px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
  position: relative;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
  max-height: 90vh;
  overflow-y: auto;
}

.upgrade-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  transition: color var(--transition);
}

.upgrade-close:hover {
  color: var(--text);
}

.upgrade-heading {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
  text-align: center;
}

.upgrade-subheading {
  font-size: 14px;
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 32px;
}

.upgrade-plans {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.upgrade-plan {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: border-color var(--transition);
}

.upgrade-plan.featured {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(108, 92, 231, 0.15);
  position: relative;
}

.upgrade-plan-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.upgrade-plan-price {
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
}

.upgrade-plan-period {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-dim);
}
/* Plan picker (audit-fix F-04): setup fee + first-charge line under the price,
   and a <button> variant of .upgrade-cta so a card can check out in place. */
.upgrade-plan-setup {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-dim);
  margin: -12px 0 16px;
}
button.upgrade-cta { cursor: pointer; font-family: inherit; width: 100%; }
.upgrade-footnote { margin: 20px 0 0; }
.upgrade-footnote a { color: var(--accent); text-decoration: none; }
.upgrade-footnote a:hover { text-decoration: underline; }

.upgrade-plan-features {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  width: 100%;
}

.upgrade-plan-features li {
  font-size: 13px;
  color: var(--text-dim);
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.upgrade-plan-features li:last-child {
  border-bottom: none;
}

.upgrade-cta {
  display: inline-block;
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: background var(--transition), border-color var(--transition);
  margin-top: auto;
}

.upgrade-cta:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
  color: var(--text);
}

.upgrade-cta.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.upgrade-cta.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}

@media (max-width: 700px) {
  .upgrade-plans {
    grid-template-columns: 1fr;
    max-width: 320px;
    margin: 0 auto;
  }
  .upgrade-modal {
    padding: 24px 20px;
  }
}

@media (max-width: 480px) {
  .login-card {
    border: none;
    border-radius: 0;
  }
  .login-header {
    padding: 32px 24px 0;
  }
  .login-form {
    padding: 24px 24px 0;
  }
  .login-footer {
    padding: 20px 24px 28px;
  }
}

/* ============================================================================
 * Workflow / Sequence Builder (automation.js)
 * Brand: navy #010F3B + orange #FF671F
 * ========================================================================== */

/* List view */
.wf-list-wrap {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
}
.wf-list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.wf-list-table thead th {
  text-align: left;
  background: #f9fafb;
  color: #374151;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 12px 16px;
  border-bottom: 1px solid #e5e7eb;
}
.wf-list-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid #f3f4f6;
  color: #111827;
}
.wf-list-table tbody tr:last-child td { border-bottom: 0; }
.wf-list-table tbody tr:hover { background: #fafbfc; }
.wf-filter-chip {
  display: inline-block;
  background: #f3f4f6;
  color: #4b5563;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: 6px;
}

/* Status pill */
.wf-status {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.3px;
}
.wf-status-active  { background: #d1fae5; color: #065f46; }
.wf-status-paused  { background: #fef3c7; color: #92400e; }
.wf-status-draft   { background: #e5e7eb; color: #374151; }

/* Row action buttons */
.wf-action {
  background: transparent;
  border: 1px solid #d1d5db;
  color: #374151;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 6px;
  margin-left: 6px;
  cursor: pointer;
  transition: all .15s ease;
}
.wf-action:hover { border-color: #FF671F; color: #FF671F; }
.wf-action-danger:hover { border-color: #c0392b; color: #c0392b; }

/* Editor panel */
.wf-editor-panel {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 24px;
}
.wf-editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
  margin-bottom: 24px;
}
.wf-field { display: flex; flex-direction: column; gap: 6px; }
.wf-field label {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.wf-field input,
.wf-field select {
  padding: 9px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  color: #111827;
  background: #fff;
  font-family: inherit;
}
.wf-field input:focus,
.wf-field select:focus {
  outline: none;
  border-color: #FF671F;
  box-shadow: 0 0 0 3px rgba(255,103,31,0.12);
}
@media (max-width: 720px) {
  .wf-editor-grid { grid-template-columns: 1fr; }
}

/* Steps section */
.wf-steps-section { border-top: 1px solid #f3f4f6; padding-top: 20px; }
.wf-steps-heading {
  font-size: 13px;
  font-weight: 700;
  color: #010F3B;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin: 0 0 14px;
}

/* Step card */
.wf-step-card {
  display: flex;
  align-items: stretch;
  gap: 14px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.wf-step-card:hover {
  border-color: #c7cdd6;
  box-shadow: 0 2px 6px rgba(1,15,59,0.04);
}
.wf-step-num {
  display: flex;
  align-items: center;
  justify-content: center;
}
.step-type-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  background: #010F3B;
}
.step-type-badge.step-type-wait        { background: #6b7280; }
.step-type-badge.step-type-send_email  { background: #FF671F; }
.step-type-badge.step-type-add_tag     { background: #10b981; }
.step-type-badge.step-type-remove_tag  { background: #ef4444; }
.step-type-badge.step-type-create_task { background: #3b82f6; }

.wf-step-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.wf-step-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wf-step-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #6b7280;
  min-width: 90px;
}
.wf-step-input,
.wf-step-card select.wf-step-type {
  flex: 1;
  min-width: 180px;
  padding: 7px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  color: #111827;
  background: #fff;
  font-family: inherit;
}
.wf-step-input:focus,
.wf-step-card select.wf-step-type:focus {
  outline: none;
  border-color: #FF671F;
  box-shadow: 0 0 0 3px rgba(255,103,31,0.12);
}

/* Reorder controls */
.wf-step-reorder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border-left: 1px solid #f3f4f6;
  padding-left: 12px;
}
.wf-reorder-btn,
.wf-remove-btn {
  width: 28px;
  height: 28px;
  border: 1px solid transparent;
  background: transparent;
  color: #9ca3af;
  cursor: pointer;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1;
  transition: all .15s ease;
}
.wf-reorder-btn:hover:not(:disabled) {
  color: #010F3B;
  border-color: #d1d5db;
  background: #f9fafb;
}
.wf-reorder-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.wf-remove-btn:hover { color: #c0392b; border-color: #fee2e2; background: #fef2f2; }

/* Quick-reply button rows in the send_chat_message step editor.
   Deliberately NOT .wf-reorder-btn — that class carries a global click
   handler in automation.js (reorder/remove) that must not fire here. */
.wf-chatbtn {
  height: 28px;
  padding: 0 10px;
  border: 1px solid #d1d5db;
  background: #f9fafb;
  color: #374151;
  cursor: pointer;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  transition: all .15s ease;
}
.wf-chatbtn:hover { color: #010F3B; border-color: #9ca3af; background: #fff; }

.wf-add-step {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 600;
}

/* Editor footer */
.wf-editor-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #f3f4f6;
}

/* ── Admin overview: By Status / By Plan distribution bars (dashboard) ── */
.dashboard-grid-dist { margin-bottom: 24px; }
.dashboard-grid-dist .dist-row {
  display: grid;
  grid-template-columns: 110px 1fr 40px;
  align-items: center;
  gap: 12px;
  padding: 8px 4px;
  font-size: 13px;
}
.dashboard-grid-dist .dist-label {
  color: #4b5563;
  text-transform: capitalize;
  font-weight: 500;
}
.dashboard-grid-dist .dist-bar-wrap {
  height: 8px;
  background: #f3f4f6;
  border-radius: 4px;
  overflow: hidden;
}
.dashboard-grid-dist .dist-bar {
  height: 100%;
  background: linear-gradient(90deg, #FF671F 0%, #ff8a4d 100%);
  border-radius: 4px;
  transition: width 0.4s ease;
}
.dashboard-grid-dist .dist-count {
  text-align: right;
  font-weight: 700;
  color: #010F3B;
  font-size: 14px;
}

/* ── Shared modal (.crm-modal) ─────────────────────────────────────────────
   Used by injected forms (New Invoice, New Payment Link, New Contact, …).
   Hidden via inline style="display:none"; shown by clearing it (display:''). */
.crm-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.crm-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(1, 15, 59, 0.62);
}
.crm-modal-box {
  position: relative;
  background: #0d1b3e;
  color: #e8ecf4;
  border-radius: 14px;
  padding: 26px;
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
}
.crm-modal-box h3 {
  margin: 0 0 18px;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}
.crm-modal-box label {
  display: block;
  margin-bottom: 13px;
  font-size: 13px;
  color: #9aa5be;
}
.crm-modal-box input,
.crm-modal-box select,
.crm-modal-box textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 9px 12px;
  background: #0a1530;
  border: 1px solid #2a3a5e;
  border-radius: 8px;
  color: #fff;
  font: inherit;
  font-size: 14px;
}
.crm-modal-box input:focus,
.crm-modal-box select:focus,
.crm-modal-box textarea:focus {
  outline: none;
  border-color: #FF671F;
}
.crm-modal-box .modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* ── Phase 3: trial banner / lock modal / plan-limit toast ───────────────── */
.trial-banner {
  display: flex; align-items: center; gap: 10px;
  margin: 8px 12px; padding: 9px 12px;
  background: rgba(255, 103, 31, 0.10);
  border: 1px solid rgba(255, 103, 31, 0.35);
  border-radius: 8px;
  font: 600 12px Inter, system-ui, sans-serif; color: #FF671F;
}
.trial-banner__msg { flex: 1; line-height: 1.3; }
.trial-banner__cta {
  background: #FF671F; color: #fff; text-decoration: none;
  padding: 4px 10px; border-radius: 999px; font-weight: 700; white-space: nowrap;
}
.trial-banner--urgent { background: rgba(255,103,31,.18); border-color: #FF671F; }
.trial-banner--locked { background: rgba(192,57,43,.12); border-color: rgba(192,57,43,.45); color: #c0392b; }
.trial-banner--locked .trial-banner__cta { background: #c0392b; }

.lock-overlay {
  position: fixed; inset: 0; width: 100%; height: 100%;
  background: rgba(1, 15, 59, 0.82); z-index: 10000;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.lock-modal {
  width: 100%; max-width: 460px; position: relative;
  background: var(--bg-card, #fff); border: 1px solid var(--border, #e5e7eb);
  border-radius: var(--radius, 12px); padding: 32px 28px; text-align: center;
  box-shadow: 0 12px 48px rgba(0,0,0,.5);
}
.lock-close { position: absolute; top: 12px; right: 14px; background: none; border: 0; font-size: 22px; line-height: 1; cursor: pointer; color: var(--text-muted, #888); }
.lock-heading { margin: 4px 0 8px; font: 700 22px Poppins, Inter, sans-serif; color: #010F3B; }
.lock-sub { margin: 0 0 22px; font: 400 14px Inter, sans-serif; color: var(--text-muted, #555); line-height: 1.45; }
.lock-cta { background: #FF671F; color: #fff; border: 0; border-radius: 8px; padding: 11px 22px; font: 700 14px Inter, sans-serif; cursor: pointer; }

.plan-limit-toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; z-index: 10001;
  background: #010F3B; color: #fff; padding: 12px 18px; border-radius: 10px;
  font: 600 13px Inter, sans-serif; box-shadow: 0 8px 28px rgba(0,0,0,.35); max-width: 92vw;
}
.plan-limit-toast__cta { color: #FF671F; text-decoration: underline; font-weight: 700; white-space: nowrap; }

/* ═══════════════════════════════
   PHASE 10 — AI LEAD SCORING
   ═══════════════════════════════
   Visual foundation for SCORE-01 (score/tier/rationale), ENRICH-01
   (decision-maker/firmographics + honest-unknown block), and AIGATE-01
   (locked-chip/card + budget banner). Every value below is a verbatim
   copy of an existing app.css rule or predictions-widget.js rule — see
   10-UI-SPEC.md Component Inventory + 10-PATTERNS.md for citations.
   The ai-pred-bar / ai-pred-conf selectors below are a deliberate rename
   of predictions-widget.js's equivalent progress-bar / confidence-pill
   selectors (WARNING-4, 2026-07-21) — that widget's ensureCss() self-injects
   a runtime <style> tag defining the ORIGINAL names with the ORIGINAL
   light-panel colors; reusing those same names here would let that
   later-DOM runtime style win the cascade and silently revert this
   dark-theme fix. This file must never (re)define the widget's original
   selector names. */

/* Tier badges — tint formulas copied verbatim from .status-churned (hot),
   .status-lead (warm), .status-inactive (cold). See app.css:538-539,1512. */
.ai-tier-badge { display:inline-block; padding:2px 8px; border-radius:10px; font:600 11px Inter; text-transform:capitalize; }
.ai-tier-hot  { background:rgba(225,112,85,.15);  color:var(--red); }
.ai-tier-warm { background:rgba(253,203,110,.15); color:var(--orange); }
.ai-tier-cold { background:rgba(139,143,163,.15); color:var(--text-dim); }

/* Score digits — the ONLY two selectors in this codebase allowed weight 800,
   per 10-CONTEXT.md §4. Citing predictions-widget.js:33
   (.nwm-pred-score .pct{font:800 22px Inter}). */
.ai-score-num    { font:800 13px Inter; color:var(--text); font-variant-numeric:tabular-nums; margin-left:4px; }
.ai-score-num-lg { font:800 22px Inter; color:var(--text); }
.ai-score-display{ display:flex; align-items:baseline; gap:8px; }

/* Rationale / meta / unscored chip / inline budget error — Body (13px/400)
   and Label (11px/600) roles only, dark tokens, sm=8px top margins. */
.ai-rationale { font:400 13px Inter; color:var(--text-dim); margin-top:8px; line-height:1.5; }
.ai-meta      { font:600 11px Inter; color:var(--text-muted); margin-top:8px; }
.ai-unscored  { background:rgba(139,143,163,.15); color:var(--text-dim); }   /* .status-inactive formula */
.ai-budget-inline-error { font:400 13px Inter; color:var(--text-muted); margin-top:8px; }

/* Budget-exhausted (402) banner — new freestanding element, 8/16 tokens only.
   Same brand-orange tint family already shipped for the pager bar / trial banner. */
.ai-budget-banner { background:rgba(255,103,31,.08); border:1px solid rgba(255,103,31,.25); border-radius:8px; padding:8px 16px; font:400 13px Inter; color:var(--text); margin-bottom:16px; display:flex; align-items:center; justify-content:space-between; }
.ai-budget-banner__dismiss { background:none; border:none; color:var(--text-muted); cursor:pointer; font-size:16px; }

/* Locked-chip + locked-card — 403 tier-gate. Brand-orange tint reserved for
   the "upgrade" affordance, never a real tier color. */
.ai-locked-chip { background:rgba(255,103,31,.12); color:#FF671F; }
.ai-locked-card { border:1px dashed var(--border); background:rgba(255,103,31,.04); }
.ai-locked-body { font:400 13px Inter; color:var(--text-dim); margin:8px 0; }

/* Honest-unknown enrichment block — never blank; a deliberate statement so a
   tenant can't mistake "unknown" for "still loading". */
.ai-unknown-enrichment { color:var(--text-dim); font-size:13px; padding:8px 0; }
.ai-unknown-enrichment strong { font-weight:600; color:var(--text); display:block; }
.ai-unknown-enrichment p { margin-top:4px; }

/* Bulk-score progress row + ported predictions-widget rules, renamed to
   the ai-pred-* prefix (WARNING-4 — see file-header note above). Property
   values are copied verbatim from predictions-widget.js:30-31,35-39; the
   track background and the confidence-pill background/color are swapped
   from the widget's hardcoded light-panel hex values to existing
   dark-theme tokens/rgba tints already shipped elsewhere in this file:
     - track background: var(--border), matching the existing dark-theme
       .progress-bar convention (app.css:1841-1848), not the widget's
       light gray track color.
     - gradient fill: the already-sanctioned brand orange -> var(--green),
       preserving the orange-to-green intent of the widget's original
       gradient without introducing a net-new hex value not otherwise
       present in this file.
     - confidence pill high/medium/low: the same rgba tint formulas already
       used by .status-customer/.status-active (green), .status-lead
       (orange), and .status-churned (red) — not the widget's hardcoded
       light-panel background colors. */
.ai-bulk-progress { display:flex; align-items:center; gap:8px; margin-left:auto; }
.ai-pred-bar { position:relative; height:8px; border-radius:4px; background:var(--border); overflow:hidden; margin:6px 0; }
.ai-pred-bar .fill { position:absolute; left:0; top:0; bottom:0; background:linear-gradient(90deg,#FF671F,var(--green)); transition:width .4s; }
.ai-pred-conf { font:600 10px Inter; text-transform:uppercase; letter-spacing:.5px; padding:2px 7px; border-radius:999px; display:inline-block; }
.ai-pred-conf.high   { background:rgba(0,184,148,.15);  color:var(--green); }
.ai-pred-conf.medium { background:rgba(253,203,110,.15); color:var(--orange); }
.ai-pred-conf.low    { background:rgba(225,112,85,.15);  color:var(--red); }

