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

:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --border: #e3e8f0;
  --border-light: #edf1f7;
  --text: #0d1117;
  --text-muted: #60718a;
  --text-subtle: #96a5ba;
  --primary: #2b5bee;
  --primary-dark: #1a47d6;
  --primary-light: #eef2ff;
  --danger: #e53935;
  --danger-dark: #c62828;

  /* Type badge colors */
  --meeting-bg: #dbeafe;
  --meeting-fg: #1d4ed8;
  --email-bg: #dcfce7;
  --email-fg: #15803d;
  --call-bg: #f3e8ff;
  --call-fg: #7e22ce;
  --text-bg: #fce7f3;
  --text-fg: #9d174d;
  --note-bg: #fef9c3;
  --note-fg: #854d0e;

  /* Staleness badge */
  --fresh-bg: #dcfce7;
  --fresh-fg: #166534;
  --stale-bg: #fef3c7;
  --stale-fg: #92400e;
  --old-bg: #fee2e2;
  --old-fg: #991b1b;

  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(13, 17, 23, 0.06);
  --shadow: 0 1px 3px rgba(13, 17, 23, 0.07), 0 4px 16px rgba(13, 17, 23, 0.05);
  --shadow-lg:
    0 8px 32px rgba(13, 17, 23, 0.12), 0 2px 8px rgba(13, 17, 23, 0.06);
}

html,
body {
  height: 100%;
  font-family:
    "DM Sans",
    system-ui,
    -apple-system,
    sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ── Two-panel layout ────────────────────────────────────────────────────── */
body {
  display: grid;
  grid-template-columns: 300px 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar — shadcn/ui zinc-dark ───────────────────────────────────────── */
#sidebar {
  display: flex;
  flex-direction: column;
  background: #09090b; /* zinc-950 */
  border-right: 1px solid #27272a; /* zinc-800 */
  overflow: hidden;
}

#sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 12px 12px;
  border-bottom: 1px solid #27272a;
  flex-shrink: 0;
}

#sidebar-header h1 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.1px;
  color: #fafafa; /* zinc-50 */
}

/* Nav icon buttons in sidebar header */
#sidebar-header .btn-secondary {
  background: transparent;
  border: 1px solid transparent;
  color: #a1a1aa; /* zinc-400 */
  padding: 5px 7px;
  font-size: 13px;
  border-radius: 6px;
  line-height: 1;
  transition:
    background 0.12s,
    color 0.12s,
    border-color 0.12s;
}
#sidebar-header .btn-secondary:hover {
  background: #27272a; /* zinc-800 */
  border-color: #27272a;
  color: #a1a1aa; /* zinc-400 */
}
#sidebar-header .btn-secondary.active {
  background: #27272a;
  border-color: #3f3f46; /* zinc-700 */
  color: #e4e4e7; /* zinc-200 */
}

/* Inbox button — relative so the badge can be positioned inside */
.nav-btn-inbox {
  position: relative;
}
.inbox-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  background: #ef4444; /* red-500 */
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 14px;
  border-radius: 7px;
  text-align: center;
  pointer-events: none;
}

#search-wrap {
  padding: 10px 10px;
  border-bottom: 1px solid #27272a;
  flex-shrink: 0;
}

.search-inner {
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon {
  position: absolute;
  left: 10px;
  color: #a1a1aa; /* zinc-400 */
  pointer-events: none;
  flex-shrink: 0;
}

#client-search {
  width: 100%;
  padding: 7px 10px 7px 32px;
  border: 1px solid #27272a; /* zinc-800 */
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  background: #18181b; /* zinc-900 */
  color: #fafafa;
  transition:
    border-color 0.15s,
    background 0.15s,
    box-shadow 0.15s;
}
#client-search::placeholder {
  color: #71717a; /* zinc-500 */
}
#client-search:focus {
  border-color: #52525b; /* zinc-600 */
  background: #1c1c1f;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.04);
}

#sidebar-filters {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px 10px;
  border-bottom: 1px solid #27272a;
  flex-shrink: 0;
}

/* ── Checkbox dropdown filter ────────────────────────────────────────────── */
.fdd {
  position: relative;
}

.fdd-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 9px;
  border: 1px solid #3f3f46; /* zinc-700 */
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  background: transparent;
  cursor: pointer;
  text-align: left;
  color: #a1a1aa; /* zinc-400 */
  transition:
    border-color 0.15s,
    background 0.15s,
    color 0.15s;
}
.fdd-toggle:hover {
  border-color: #3f3f46; /* zinc-700 */
  background: #18181b;
  color: #a1a1aa; /* zinc-400 */
}
.fdd-toggle.fdd-active {
  color: #d4d4d8; /* zinc-300 */
  border-color: #3f3f46;
  background: #18181b;
}
.fdd-toggle.fdd-open {
  color: #d4d4d8;
  border-color: #3f3f46;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  background: #18181b;
}
.fdd-arrow {
  font-size: 9px;
  flex-shrink: 0;
  margin-left: 4px;
  color: #71717a; /* zinc-500 */
}
.fdd-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fdd-menu {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 200;
  background: #18181b; /* zinc-900 */
  border: 1px solid #3f3f46;
  border-top: none;
  border-bottom-left-radius: 6px;
  border-bottom-right-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  max-height: 200px;
  overflow-y: auto;
}
.fdd-menu.fdd-open {
  display: block;
}

.fdd-clear {
  width: 100%;
  text-align: left;
  padding: 6px 10px;
  font-size: 11px;
  color: #71717a; /* zinc-500 */
  background: none;
  border: none;
  border-bottom: 1px solid #27272a;
  cursor: pointer;
  font-weight: 600;
  font-family: inherit;
  transition:
    color 0.12s,
    background 0.12s;
}
.fdd-clear:hover {
  background: #27272a;
  color: #a1a1aa;
}

.fdd-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  font-size: 12px;
  cursor: pointer;
  color: #a1a1aa; /* zinc-400 */
  transition: background 0.1s;
}
.fdd-item:hover {
  background: #27272a; /* zinc-800 */
}
.fdd-item input[type="checkbox"] {
  cursor: pointer;
  accent-color: #e4e4e7; /* zinc-200 */
  flex-shrink: 0;
}
.fdd-empty {
  padding: 10px;
  font-size: 12px;
  color: #52525b; /* zinc-600 */
}

#client-list {
  flex: 1;
  overflow-y: auto;
  list-style: none;
  padding: 4px 0 8px;
}

.client-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  cursor: pointer;
  transition: background 0.1s;
  margin: 1px 6px;
  border-radius: 6px;
  position: relative;
}
.client-item:hover {
  background: #18181b; /* zinc-900 */
}
.client-item.active {
  background: #18181b;
  box-shadow: inset 2px 0 0 #e4e4e7; /* left-rail accent, zinc-200 */
}

/* ── Client avatar ───────────────────────────────────────────────────────── */
.client-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px; /* rounded-lg instead of circle */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
  flex-shrink: 0;
  opacity: 0.65;
  letter-spacing: 0;
  transition: opacity 0.1s;
}
.client-item:hover .client-avatar,
.client-item.active .client-avatar {
  opacity: 0.9;
}
.client-item-body {
  min-width: 0;
  flex: 1;
}

/* ── Company / group headers ─────────────────────────────────────────────── */
.client-list-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 10px 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: #3f3f46; /* zinc-700 */
  background: #09090b;
  position: sticky;
  top: 0;
  cursor: pointer;
  transition: color 0.12s;
  text-transform: uppercase;
}
.client-list-group-header:first-child {
  padding-top: 6px;
}
.client-list-group-header:hover {
  color: #71717a; /* zinc-500 */
}
.client-list-group-header.active {
  color: #a1a1aa; /* zinc-400 */
}
.group-header-name {
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #c2410c;
}
.group-header-line {
  flex: 1;
  height: 1px;
  background: #1c1c1f; /* zinc-900-ish */
}

/* ── Client name / meta ──────────────────────────────────────────────────── */
.client-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.client-name {
  font-weight: 500;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.1px;
  color: #a1a1aa; /* zinc-400 — subdued default */
}
.client-item:hover .client-name {
  color: #d4d4d8; /* zinc-300 */
}
.client-item.active .client-name {
  color: #fafafa; /* zinc-50 — full brightness when selected */
  font-weight: 600;
}
.client-list-pipeline {
  display: inline-block;
  margin-top: 2px;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  background: #3f3f46; /* zinc-700 */
  color: #d4d4d8; /* zinc-300 */
  border: 1px solid #52525b;
  white-space: nowrap;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.client-item.active .client-list-pipeline {
  background: #52525b;
  color: #fafafa;
  border-color: #71717a;
}
.client-company {
  font-size: 12px;
  color: #52525b; /* zinc-600 */
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Last-contact meta ───────────────────────────────────────────────────── */
.client-meta {
  font-size: 11px;
  color: #a1a1aa; /* zinc-400 — visible against dark sidebar */
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 400;
}
.client-item:hover .client-meta,
.client-item.active .client-meta {
  color: #d4d4d8; /* zinc-300 — brighter on hover/active */
}
.client-meta.stale {
  color: #fbbf24; /* amber-400 — bright enough to read on dark */
}
.client-meta.old {
  color: #f87171; /* red-400 — bright enough to read on dark */
}

/* Keep .last-contact-badge for dashboard and other uses */
.last-contact-badge {
  display: inline-block;
  margin-top: 5px;
  padding: 2px 7px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
}
.last-contact-badge.never {
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.last-contact-badge.fresh {
  background: var(--fresh-bg);
  color: var(--fresh-fg);
}
.last-contact-badge.stale {
  background: var(--stale-bg);
  color: var(--stale-fg);
}
.last-contact-badge.old {
  background: var(--old-bg);
  color: var(--old-fg);
}

.client-list-empty {
  padding: 20px;
  color: rgba(255, 255, 255, 0.3);
  text-align: center;
  font-size: 13px;
}

/* ── Detail panel ────────────────────────────────────────────────────────── */
#detail-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

#empty-state {
  flex: 1;
  overflow-y: auto;
}

/* ── Home panel ──────────────────────────────────────────────────────────── */
.home-loading-msg {
  padding: 48px 32px;
  color: var(--text-subtle);
  font-size: 14px;
}

.home-panel {
  padding: 32px 32px 48px;
  max-width: none;
}
.home-panel > *:not(.home-doc-embed) {
  max-width: 680px;
}

.home-doc-embed {
  margin: 28px -32px -48px;
}
.home-doc-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 32px 10px;
}
.home-doc-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.2px;
  padding: 4px 6px;
  border-radius: 6px;
  transition: color .15s ease, background .15s ease;
}
.home-doc-title:hover {
  color: var(--accent, #2563eb);
  background: var(--hover, rgba(0,0,0,0.04));
}
.home-doc-title-icon {
  opacity: 0.55;
  transition: opacity .15s ease, transform .15s ease;
}
.home-doc-title:hover .home-doc-title-icon {
  opacity: 1;
  transform: translate(1px, -1px);
}
.home-doc-embed iframe {
  display: block;
  width: 100%;
  height: calc(100vh - 90px);
  border: none;
  background: #fff;
}

.home-greeting {
  font-size: 21px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.4px;
  margin-bottom: 24px;
}

/* Stat cards */
.home-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 28px;
}

.hstat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  box-shadow: var(--shadow-sm);
}

.hstat-val {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -1px;
  color: var(--text);
  line-height: 1;
}

.hstat-lbl {
  font-size: 11px;
  color: var(--text-subtle);
  font-weight: 500;
  line-height: 1.3;
}

.hstat.hstat-warn .hstat-val {
  color: #b45309;
}
.hstat.hstat-crit .hstat-val {
  color: var(--danger);
}
.hstat.hstat-muted .hstat-val {
  color: var(--text-muted);
}

/* Section header */
.home-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.home-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.home-section-badge {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 20px;
  letter-spacing: 0;
  text-transform: none;
}

/* Follow-up queue rows */
.home-queue {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.hq-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition:
    box-shadow 0.12s,
    border-color 0.12s;
}

.hq-row:hover {
  box-shadow: var(--shadow);
  border-color: #cfd8e8;
  border-left-color: var(--primary);
}

.hq-row.hq-stale {
  border-left-color: #f59e0b;
}
.hq-row.hq-overdue {
  border-left-color: var(--danger);
}

.hq-info {
  flex: 1;
  min-width: 0;
}

.hq-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hq-company {
  font-size: 11px;
  color: var(--text-subtle);
  font-weight: 400;
  flex-shrink: 0;
}

.hq-last {
  font-size: 11px;
  color: var(--text-subtle);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hq-days {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  font-weight: 500;
  flex-shrink: 0;
}

.hq-row.hq-stale .hq-days {
  color: #b45309;
}
.hq-row.hq-overdue .hq-days {
  color: var(--danger);
  font-weight: 600;
}

/* Company groups in follow-up queue */
.hq-company-group {
  margin-bottom: 6px;
}

.hq-company-header {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px 6px;
  cursor: pointer;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.hq-company-header:hover .hq-company-name {
  color: var(--primary);
}

.hq-company-avatar {
  width: 22px;
  height: 22px;
  font-size: 10px;
  opacity: 1;
}

.hq-company-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: -0.1px;
  transition: color 0.12s;
}

.hq-company-count {
  font-size: 11px;
  color: var(--text-subtle);
  font-weight: 400;
}

.hq-company-rows .hq-row {
  border-radius: 0;
  border-top: none;
}

.hq-company-rows .hq-row:first-child {
  border-top: 1px solid var(--border);
}

.hq-company-rows .hq-row:last-child {
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

/* Signal badges inside queue rows */
.hq-sig {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  letter-spacing: 0.3px;
  vertical-align: middle;
  flex-shrink: 0;
}
.hq-sig-sub {
  background: #ede9fe;
  color: #6d28d9;
}
.hq-sig-revenue {
  background: #dcfce7;
  color: #166534;
}
.hq-sig-recip {
  background: #dbeafe;
  color: #1d4ed8;
}
.hq-sig-urgent {
  background: #fef2f2;
  color: #b91c1c;
}
.hq-sig-awaiting {
  background: #fff7ed;
  color: #c2410c;
}
.hq-sig-mtg {
  background: #f0fdf4;
  color: #15803d;
}

.home-all-clear {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ── KPI Post bar ─────────────────────────────────────────────────────────── */
.kpi-post-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.kpi-post-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.kpi-post-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.kpi-post-btn .kpi-check-icon {
  flex-shrink: 0;
  opacity: 0.45;
  transition: opacity 0.15s;
}

.kpi-post-btn:hover:not(:disabled) .kpi-check-icon {
  opacity: 1;
}

.kpi-post-btn--loading {
  opacity: 0.6;
  cursor: wait;
}

.kpi-post-btn--done {
  border-color: #22c55e;
  background: #f0fdf4;
  color: #16a34a;
  cursor: default;
}

.kpi-post-btn--done .kpi-check-icon {
  opacity: 1;
  stroke: #16a34a;
}

.kpi-post-count {
  margin-left: auto;
  padding-left: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  opacity: 0.7;
}

/* ── Retirement candidates section ───────────────────────────────────────── */
.retire-section {
  margin-top: 20px;
}

.retire-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  margin-bottom: 0;
}
.retire-summary::-webkit-details-marker {
  display: none;
}

.retire-badge {
  background: #fef3c7;
  color: #92400e;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 99px;
}

.retire-chevron {
  margin-left: auto;
  font-size: 16px;
  color: var(--text-subtle);
  transition: transform 0.15s;
  line-height: 1;
}
details[open] .retire-chevron {
  transform: rotate(90deg);
}

.retire-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 8px;
}

.retire-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid #d97706;
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  cursor: pointer;
  transition:
    box-shadow 0.12s,
    border-color 0.12s;
}
.retire-row:hover {
  box-shadow: var(--shadow);
  border-color: #b45309;
}

.retire-avatar {
  width: 28px;
  height: 28px;
  font-size: 12px;
  flex-shrink: 0;
  opacity: 0.75;
}

.retire-info {
  flex: 1;
  min-width: 0;
}

.retire-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.retire-reason {
  font-size: 11px;
  color: #92400e;
  margin-top: 1px;
}

.retire-stage {
  font-size: 11px;
  color: var(--text-subtle);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Task list (home panel) ──────────────────────────────────────────────── */

.task-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius-sm);
}

/* Left-border accent colours by urgency */
.task-border-overdue {
  border-left-color: var(--danger);
}
.task-border-today {
  border-left-color: #f59e0b;
}
.task-border-soon {
  border-left-color: var(--primary);
}
.task-border-future {
  border-left-color: #93c5fd;
}

/* Due-date badge pill */
.task-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 76px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}
.task-badge-overdue {
  background: #fee2e2;
  color: #dc2626;
}
.task-badge-today {
  background: #fef3c7;
  color: #92400e;
}
.task-badge-soon {
  background: #dbeafe;
  color: #1d4ed8;
}
.task-badge-future {
  background: #f1f5f9;
  color: var(--text-muted);
}

.task-body {
  flex: 1;
  min-width: 0;
}

.task-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-title-link {
  text-decoration: none;
  color: var(--text);
}
.task-title-link:hover {
  color: var(--primary);
  text-decoration: underline;
}

.task-meta {
  font-size: 12px;
  color: var(--text-subtle);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-contact {
  color: var(--primary);
  cursor: pointer;
}
.task-contact:hover {
  text-decoration: underline;
}

.task-contact-plain {
  color: var(--text-muted);
}
.task-notes-preview {
  color: var(--text-subtle);
}
.task-meta-sep {
  color: var(--border-light);
}

/* No-due-date collapsible section */
.tasks-noduedate {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.tasks-noduedate-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--surface);
}
.tasks-noduedate-summary::-webkit-details-marker {
  display: none;
}
.tasks-noduedate-summary::after {
  content: "›";
  margin-left: auto;
  font-size: 15px;
  color: var(--text-subtle);
  transition: transform 0.15s;
  line-height: 1;
  font-weight: 400;
}
details[open].tasks-noduedate > .tasks-noduedate-summary::after {
  transform: rotate(90deg);
}

.tasks-overdue > .tasks-noduedate-summary {
  color: #b91c1c;
}
.tasks-overdue > .tasks-noduedate-summary .tasks-noduedate-badge {
  background: #fee2e2;
  color: #dc2626;
}

.tasks-noduedate-badge {
  background: #f1f5f9;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 99px;
  letter-spacing: 0;
  text-transform: none;
}

.tasks-noduedate-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px;
  background: var(--bg);
}

.tasks-noduedate-list .task-item {
  border-left-color: var(--border);
}

#client-detail {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
}
#client-detail.hidden {
  display: none;
}

#client-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 20px 24px 18px;
  flex-shrink: 0;
}

/* ── Avatar + info row ───────────────────────────────────────────────────── */
.client-header-main {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.client-header-attrs {
  margin-left: auto;
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  padding-left: 24px;
  border-left: 1px solid var(--border);
}


.client-header-avatar {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2b5bee 0%, #3d2ec4 100%);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(43, 91, 238, 0.35);
}

.client-header-info {
  flex: 1;
  min-width: 0;
}

.client-header-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.client-header-name {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.15;
}
.client-header-company {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
  font-weight: 400;
}
.client-header-company.clickable-company {
  cursor: pointer;
  color: var(--primary, #2B5BEE);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.client-header-company.clickable-company::after {
  content: '↗';
  font-size: 11px;
  opacity: 0.6;
}
.client-header-company.clickable-company:hover {
  color: var(--accent, #1D4ED8);
  text-decoration: underline;
}

.client-header-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 7px;
  font-size: 12.5px;
  color: var(--text-muted);
}
.client-header-meta > *:not([style*="display:none"]):not(:empty) {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.client-header-meta a {
  color: var(--primary);
  text-decoration: none;
}
.client-header-meta a:hover {
  text-decoration: underline;
}
.clickable-email {
  cursor: pointer;
  color: var(--primary, #2B5BEE);
}
.clickable-email:hover {
  text-decoration: underline;
}

/* ── Client tags ─────────────────────────────────────────────────────────── */
#ch-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

/* ── Client stats column ────────────────────────────────────────────────── */
#ch-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}
.ch-stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.ch-stat.stat-jurisdiction {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e40af;
}
.ch-stat.stat-law {
  background: #f5f3ff;
  border-color: #ddd6fe;
  color: #5b21b6;
}
.ch-stat.stat-pipeline {
  background: var(--primary-light);
  border-color: rgba(43, 91, 238, 0.2);
  color: var(--primary);
}
.ch-stat.stat-collapsed {
  display: none;
}
.stat-toggle {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  font-family: inherit;
  background: none;
  border: 1px dashed var(--border);
  color: var(--text-subtle);
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
}
.stat-toggle:hover {
  border-color: var(--text-muted);
  color: var(--text-muted);
}
.ch-stat.stat-joe {
  background: #fef9c3;
  border-color: #fde047;
  color: #854d0e;
}
.ch-stat.stat-referral {
  background: #dcfce7;
  border-color: #86efac;
  color: #15803d;
}
.ch-stat.stat-invoiced {
  background: #dcfce7;
  border-color: #86efac;
  color: #15803d;
}
.client-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.client-tag.pipeline {
  background: var(--primary-light);
  border-color: rgba(43, 91, 238, 0.2);
  color: var(--primary);
}
.client-tag.referral {
  background: #dcfce7;
  border-color: #86efac;
  color: #15803d;
}
.client-tag.unsubbed {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
}
.client-tag.joe-status {
  background: #fef9c3;
  border-color: #fde047;
  color: #854d0e;
}

/* ── Client summary ──────────────────────────────────────────────────────── */
#client-summary {
  margin-top: 12px;
  padding: 10px 0 0;
  border-top: 1px solid var(--border-light);
}

/* Pill strip */
.summary-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}
.summary-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  white-space: nowrap;
}
.pill-cadence-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.pill-active {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}
.pill-active .pill-cadence-dot {
  background: #16a34a;
}
.pill-risk {
  background: #fef3c7;
  border-color: #fde68a;
  color: #92400e;
}
.pill-risk .pill-cadence-dot {
  background: #d97706;
}
.pill-dormant {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
}
.pill-dormant .pill-cadence-dot {
  background: #dc2626;
}
.pill-money {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}
.pill-owed {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
}

.summary-empty {
  color: var(--text-subtle);
  font-size: 12px;
  font-style: italic;
}

/* Company contacts list */
.company-contacts-header {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
  margin-bottom: 7px;
}

.header-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* ── Timeline controls (unified toolbar) ─────────────────────────────────── */
#timeline-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.controls-divider {
  width: 1px;
  height: 20px;
  background: var(--text-muted, #9ca3af);
  opacity: 0.4;
  margin: 0 6px;
  flex-shrink: 0;
}

#filter-type {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
}
#filter-type:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(43, 91, 238, 0.12);
}

.quick-log-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-right: 2px;
  flex-shrink: 0;
}

.btn-quick-log {
  padding: 4px 11px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-muted);
  cursor: pointer;
  transition:
    background 0.12s,
    border-color 0.12s,
    color 0.12s;
}
.btn-quick-log:hover {
  background: var(--primary-light);
  border-color: rgba(43, 91, 238, 0.3);
  color: var(--primary);
}

/* ── Timeline visual ─────────────────────────────────────────────────────── */
#timeline-visual-wrap {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px 10px;
  flex-shrink: 0;
}

.tviz-insights {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.tviz-stat {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 2px 9px;
  border-radius: 20px;
}
.tviz-stat-money {
  color: #15803d;
  background: #dcfce7;
  border-color: #86efac;
}
.tviz-stat-warn {
  color: #92400e;
  background: #fef3c7;
  border-color: #fde68a;
}

.tviz-track {
  position: relative;
  height: 22px;
  margin: 0 6px;
}
.tviz-track::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border);
  transform: translateY(-50%);
  border-radius: 1px;
}

.tviz-gap {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 6px;
  background: rgba(245, 158, 11, 0.22);
  border-radius: 3px;
  pointer-events: none;
}
.tviz-gap-trailing {
  background: rgba(239, 68, 68, 0.18);
}

.tviz-dot {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid var(--surface);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
  transition:
    transform 0.12s,
    box-shadow 0.12s;
  z-index: 1;
}
.tviz-dot:hover {
  transform: translate(-50%, -50%) scale(1.6);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.22);
  z-index: 10;
}
.tviz-dot-inv {
  width: 14px;
  height: 14px;
  z-index: 2;
}
.tviz-dot-est {
  width: 12px;
  height: 12px;
  z-index: 2;
}
.tviz-dollar {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 7px;
  font-weight: 800;
  color: #fff;
  pointer-events: none;
}

.tviz-marker-start {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-subtle);
  border: 2px solid var(--surface);
}
.tviz-marker-today {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translate(50%, -50%);
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 3px rgba(43, 91, 238, 0.2);
}

.tviz-labels {
  position: relative;
  height: 16px;
  margin: 3px 6px 0;
}
.tviz-label {
  position: absolute;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 500;
  color: var(--text-subtle);
  white-space: nowrap;
}

/* comm highlight flash when clicking a dot */
.comm-highlight {
  animation: comm-flash 0.9s ease;
}
@keyframes comm-flash {
  0% {
    background: var(--surface);
  }
  30% {
    background: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(43, 91, 238, 0.15);
  }
  100% {
    background: var(--surface);
  }
}

/* ── Timeline ────────────────────────────────────────────────────────────── */
#timeline-wrap {
  flex: 1;
  padding: 16px 22px;
}

#timeline {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.comm-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  border-left: 3px solid var(--border);
  transition: box-shadow 0.15s;
}
.comm-item:hover {
  box-shadow: var(--shadow);
}
.comm-item.meeting {
  border-left-color: var(--meeting-fg);
}
.comm-item.email {
  border-left-color: var(--email-fg);
}
.comm-item.call {
  border-left-color: var(--call-fg);
}
.comm-item.text {
  border-left-color: var(--text-fg);
}
.comm-item.note {
  border-left-color: var(--note-fg);
}

.comm-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.comm-type-badge {
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.comm-type-badge.meeting {
  background: var(--meeting-bg);
  color: var(--meeting-fg);
}
.comm-type-badge.email {
  background: var(--email-bg);
  color: var(--email-fg);
}
.comm-type-badge.call {
  background: var(--call-bg);
  color: var(--call-fg);
}
.comm-type-badge.text {
  background: var(--text-bg);
  color: var(--text-fg);
}
.comm-type-badge.note {
  background: var(--note-bg);
  color: var(--note-fg);
}

.comm-date {
  font-size: 12px;
  color: var(--text-muted);
}
.comm-client-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1px 8px;
}

.comm-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.15s;
}
.comm-item:hover .comm-actions {
  opacity: 1;
}

.comm-toggle {
  background: none;
  border: none;
  padding: 0 0 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.comm-toggle:hover {
  color: var(--primary);
}
.comm-snippet {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-height: 2em;
  opacity: 1;
  transition:
    opacity 0.18s ease,
    max-height 0.2s ease,
    margin 0.2s ease;
}
.comm-expanded .comm-snippet {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
  pointer-events: none;
}
.comm-snippet-subject {
  font-weight: 600;
  color: var(--text);
  margin-right: 6px;
}
/* Smooth expand/collapse using CSS Grid — animates to natural height */
.comm-body-wrap {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.25s ease;
}
.comm-expanded .comm-body-wrap {
  grid-template-rows: 1fr;
}
.comm-body {
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.2s ease 0.05s;
}
.comm-expanded .comm-body {
  opacity: 1;
}

.comm-subject {
  font-weight: 600;
  margin-top: 9px;
  font-size: 14px;
  letter-spacing: -0.1px;
}
.comm-project-type {
  font-size: 11px;
  font-weight: 600;
  background: #f3e8ff;
  border: 1px solid #d8b4fe;
  color: #6b21a8;
  border-radius: 20px;
  padding: 1px 7px;
  margin-left: 6px;
}
.comm-amount {
  font-weight: 700;
  color: #15803d;
  font-size: 13px;
  margin-left: 6px;
}
.comm-payment {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  font-style: italic;
}
.comm-rejected {
  color: #b91c1c;
}
.comm-notes {
  margin-top: 7px;
  font-size: 13px;
  color: var(--text-muted);
  white-space: pre-wrap;
  line-height: 1.6;
}
.comm-notes-md {
  white-space: normal;
}
.comm-notes-md p {
  margin: 0 0 6px;
}
.comm-notes-md p:last-child {
  margin-bottom: 0;
}
.comm-notes-md h1,
.comm-notes-md h2,
.comm-notes-md h3 {
  font-size: 13px;
  font-weight: 700;
  margin: 8px 0 4px;
}
.comm-notes-md ul,
.comm-notes-md ol {
  margin: 4px 0 6px 18px;
  padding: 0;
}
.comm-notes-md li {
  margin-bottom: 2px;
}
.comm-notes-md strong {
  font-weight: 700;
  color: var(--text);
}
.comm-notes-md em {
  font-style: italic;
}
.comm-notes-md code {
  font-family: monospace;
  font-size: 12px;
  background: var(--border-light);
  padding: 1px 4px;
  border-radius: 3px;
}
.comm-notes-md a {
  color: var(--primary);
  text-decoration: underline;
}

.comm-source a {
  font-size: 11px;
  color: var(--primary);
  text-decoration: none;
  margin-top: 6px;
  display: inline-block;
}
.comm-source a:hover {
  text-decoration: underline;
}

.timeline-empty {
  color: var(--text-muted);
  font-size: 13px;
  padding: 20px 0;
  text-align: center;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
button {
  cursor: pointer;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  padding: 7px 14px;
  transition:
    background 0.12s,
    box-shadow 0.12s,
    opacity 0.12s;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 1px 3px rgba(43, 91, 238, 0.3);
}
.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 2px 6px rgba(43, 91, 238, 0.35);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--bg);
  border-color: #c4cdd8;
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid transparent;
  font-size: 12px;
  padding: 4px 8px;
}
.btn-danger:hover {
  background: var(--old-bg);
  border-color: var(--danger);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  font-size: 12px;
  padding: 4px 8px;
}
.btn-ghost:hover {
  background: var(--bg);
  border-color: var(--border);
  color: var(--text);
}

/* ── Modals ──────────────────────────────────────────────────────────────── */
dialog {
  border: none;
  border-radius: var(--radius-lg);
  padding: 0;
  box-shadow: var(--shadow-lg);
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}
dialog::backdrop {
  background: rgba(13, 17, 23, 0.45);
  backdrop-filter: blur(2px);
}

.modal-inner {
  padding: 26px;
}
.modal-inner h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
}
.form-group label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  background: var(--bg);
  color: var(--text);
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(43, 91, 238, 0.12);
  background: var(--surface);
}
.form-group textarea {
  resize: vertical;
  min-height: 90px;
}

/* Client autocomplete */
.client-autocomplete-wrap {
  position: relative;
}
.client-autocomplete-wrap input[type="text"] {
  width: 100%;
  box-sizing: border-box;
}
.client-autocomplete-list {
  position: absolute;
  top: calc(100% + 3px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  list-style: none;
  margin: 0;
  padding: 4px 0;
  max-height: 220px;
  overflow-y: auto;
  z-index: 200;
}
.client-autocomplete-list[hidden] {
  display: none;
}
.client-autocomplete-list li {
  display: flex;
  flex-direction: column;
  padding: 7px 12px;
  cursor: pointer;
  gap: 1px;
}
.client-autocomplete-list li:hover {
  background: var(--bg);
}
.ca-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.ca-company {
  font-size: 11px;
  color: var(--text-muted);
}

.btn-claude {
  margin-top: 6px;
  width: 100%;
  padding: 8px 12px;
  background: linear-gradient(135deg, #f0f4ff, #faf0ff);
  border: 1px solid #c4b5fd;
  border-radius: var(--radius-sm);
  color: #5b21b6;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s;
  text-align: center;
}
.btn-claude:hover {
  background: linear-gradient(135deg, #e0e7ff, #f3e8ff);
  border-color: #7c3aed;
}

.form-group select#comm-client {
  font-size: 14px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 22px;
}

/* ── Auth screen ─────────────────────────────────────────────────────────── */
#auth-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 44px 48px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.auth-brand-icon {
  font-size: 38px;
  line-height: 1;
  margin-bottom: 2px;
}
.auth-brand h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.4px;
  margin: 0;
}
.auth-sub {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0 0 28px;
  line-height: 1.5;
}
.btn-google-signin {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 20px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  transition:
    background 0.15s,
    box-shadow 0.15s;
  box-shadow: var(--shadow-sm);
}
.btn-google-signin:hover {
  background: #f8f9fa;
  box-shadow: var(--shadow);
}
.btn-google-signin:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.auth-note {
  margin-top: 20px;
  font-size: 12px;
  color: var(--text-subtle);
  margin-bottom: 0;
}

/* ── Sidebar user bar ────────────────────────────────────────────────────── */
#sidebar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  flex-shrink: 0;
}
.su-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(43, 91, 238, 0.5);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.su-name {
  flex: 1;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.su-signout {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 5px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 11px;
  padding: 3px 8px;
  cursor: pointer;
  font-family: inherit;
  transition:
    color 0.15s,
    background 0.15s,
    border-color 0.15s;
  flex-shrink: 0;
}
.su-signout:hover {
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.22);
}

/* ── Toast notifications ─────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 10000;
  pointer-events: none;
}

.toast {
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow);
  animation:
    toast-in 0.2s ease,
    toast-out 0.3s ease 3.2s forwards;
  pointer-events: auto;
}
.toast.success {
  background: #14532d;
  color: #fff;
}
.toast.error {
  background: var(--danger);
  color: #fff;
}

/* ── Inbox badge on button ───────────────────────────────────────────────── */
.inbox-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--danger);
  color: #fff;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  margin-left: 2px;
  vertical-align: middle;
}

/* ── Inbox panel ─────────────────────────────────────────────────────────── */
#inbox-panel {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.inbox-header {
  padding: 22px 26px 12px;
  border-bottom: 1px solid var(--border);
}
.inbox-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.inbox-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.inbox-select-all {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}
.inbox-filters {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}
.inbox-filter-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.inbox-filter-input {
  flex: 1;
  padding: 6px 10px;
  font-size: 13px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.inbox-filter-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(43, 91, 238, 0.12);
}
.inbox-exact-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  cursor: pointer;
}
.inbox-count {
  background: var(--danger);
  color: #fff;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  padding: 1px 8px;
}
.inbox-sub {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}
.inbox-empty {
  padding: 40px 26px;
  color: var(--text-muted);
  font-size: 14px;
}
.inbox-list {
  padding: 14px 26px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 80px;
}

.inbox-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: var(--surface);
  display: flex;
  flex-direction: row;
  gap: 12px;
  align-items: flex-start;
  transition: box-shadow 0.15s;
}
.inbox-item:hover {
  box-shadow: var(--shadow);
}
.inbox-item-selected {
  border-color: var(--primary);
  background: var(--primary-light);
}
.inbox-checkbox {
  padding-top: 2px;
  flex-shrink: 0;
}
.inbox-item-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.inbox-item-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.inbox-client-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--primary);
}
.inbox-unknown {
  color: var(--text-muted);
  font-style: italic;
}
.inbox-date {
  font-size: 12px;
  color: var(--text-muted);
}
.inbox-subject {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.1px;
}
.inbox-from {
  font-size: 12px;
  color: var(--text-muted);
}
.inbox-snippet {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  max-height: 54px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}
.inbox-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  align-items: center;
}
.btn-inbox-open {
  font-size: 12px;
  padding: 5px 10px;
  text-decoration: none;
}
.inbox-bulk-bar {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 12px 26px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 -2px 12px rgba(13, 17, 23, 0.06);
}
.inbox-bulk-bar span {
  font-size: 13px;
  font-weight: 600;
  flex: 1;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes toast-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* ── Payment rows (modal) ────────────────────────────────────────────────── */
.payments-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.payments-header label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.payments-header .btn-secondary {
  padding: 4px 10px;
  font-size: 12px;
}

.payment-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}
.payment-row .payment-date {
  flex: 1;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  background: var(--bg);
  outline: none;
  transition: border-color 0.15s;
}
.payment-row .payment-amount {
  flex: 1;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  background: var(--bg);
  outline: none;
  transition: border-color 0.15s;
}
.payment-row .payment-date:focus,
.payment-row .payment-amount:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(43, 91, 238, 0.12);
}
.payment-row .payment-remove {
  flex-shrink: 0;
  padding: 4px 8px;
  font-size: 14px;
  line-height: 1;
}

/* ── Dashboard ───────────────────────────────────────────────────────────── */
#dashboard-panel {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.dash-loading {
  padding: 40px;
  color: var(--text-muted);
  text-align: center;
}

.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 18px 24px 0;
  flex-shrink: 0;
}
.dash-header h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.4px;
}

.dash-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.dash-filters select {
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
}
.dash-filters select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(43, 91, 238, 0.12);
}
.dash-period-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 4px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.dash-body {
  padding: 16px 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Stat cards */
.dash-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.dash-card {
  flex: 1;
  min-width: 140px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s;
}
.dash-card:hover {
  box-shadow: var(--shadow);
}
.dash-metric-cards {
  align-items: flex-start;
}
.dash-card-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-subtle);
  margin-bottom: 7px;
}
.dash-card-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
  line-height: 1.1;
}
.dash-card-sub {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
}
.dash-blue {
  color: var(--primary);
}
.dash-new-contacts {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--border-light);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dash-new-contact-row {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 3px 5px;
  margin: 0 -5px;
  transition: background 0.15s;
}
.dash-new-contact-row:hover {
  background: var(--primary-light);
}
.dash-contact-avatar {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dash-contact-name {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-contact-date {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--text-muted);
}
.dash-contact-more {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  padding-top: 2px;
}

/* Averages bar */
.dash-averages {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.dash-avg-item {
  flex: 1;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.dash-avg-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 5px;
}
.dash-avg-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.4px;
}
.dash-avg-sub {
  font-size: 11px;
  color: var(--text-subtle);
  margin-top: 3px;
}

/* Grid sections */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.dash-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.dash-section-wide {
  grid-column: 1 / -1;
}
.dash-section h3 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.1px;
  margin-bottom: 14px;
}
.dash-section-sub {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 4px;
}
.dash-empty {
  color: var(--text-muted);
  font-size: 13px;
  font-style: italic;
}
.dash-meeting-group {
  margin-bottom: 16px;
}
.dash-meeting-group:last-child {
  margin-bottom: 0;
}
.dash-meeting-group-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.dash-meeting-row {
  display: flex;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  gap: 0;
}
.dash-meeting-row:last-child {
  border-bottom: none;
}
.dash-meeting-row:hover {
  background: var(--primary-light);
}
.dash-meeting-dim {
  opacity: 0.6;
}
.dash-meeting-date {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  width: 90px;
  flex-shrink: 0;
}
.dash-meeting-client {
  font-size: 13px;
  font-weight: 600;
  width: 200px;
  flex-shrink: 0;
}
.dash-meeting-subject {
  font-size: 13px;
  color: var(--text-muted);
  flex: 1;
}
.dash-meeting-popup-trigger {
  cursor: pointer;
}

/* Meeting popup */
.mp-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mp-box {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  width: 520px;
  max-width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}
.mp-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}
.mp-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.2px;
  margin-bottom: 4px;
}
.mp-title-2 {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.2px;
  margin-bottom: 4px;
}
.mp-meta {
  display: flex;
  gap: 10px;
  align-items: center;
}
.mp-client {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
}
.mp-client-link {
  cursor: pointer;
  text-decoration: underline;
}
.mp-client-link:hover {
  opacity: 0.75;
}
.mp-date {
  font-size: 13px;
  color: var(--text-muted);
}
.mp-close {
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 0 0 8px;
}
.mp-close:hover {
  color: var(--text);
}
.mp-notes {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 20px;
}
.mp-goto {
  margin-top: 4px;
}

/* Table */
.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.dash-table th {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-subtle);
  padding: 0 12px 8px 0;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.dash-table th:first-child {
  padding-left: 0;
  width: 100%;
}
.dash-table th:not(:first-child) {
  text-align: right;
  min-width: 90px;
}
.dash-table td {
  padding: 7px 12px 7px 0;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}
.dash-table td:first-child {
  padding-left: 0;
}
.dash-table tr:last-child td {
  border-bottom: none;
}
.dash-table td:not(:first-child) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.dash-table-total td {
  border-top: 2px solid var(--border);
  border-bottom: none !important;
  padding-top: 8px;
  font-weight: 600;
}
.dash-table-avg {
  border-bottom: none !important;
  color: var(--text-muted);
  font-size: 12px;
  padding-top: 6px !important;
}
.dash-type-row td {
  background: var(--bg);
  border-top: 2px solid var(--border);
  padding-top: 6px;
  padding-bottom: 6px;
}
.dash-inv-row td {
  font-size: 12px;
  color: var(--text-muted);
  padding: 3px 8px 3px 16px;
}
.dash-inv-cell-client {
  text-align: left !important;
}

/* Projects grid */
.proj-grid {
  display: grid;
  grid-template-columns: 2fr 1.6fr 1.2fr 1fr 1fr 1fr 52px;
  width: 100%;
}
.proj-grid-client {
  grid-template-columns: 2fr 1.6fr 1fr 1fr 1fr 52px;
}
.proj-grid-head {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0 12px 10px 0;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.proj-cell {
  font-size: 13px;
  color: var(--text);
  padding: 8px 12px 8px 0;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
}
.proj-grid > div:nth-last-child(-n + 7) {
  border-bottom: none;
}
.proj-grid-client > div:nth-last-child(-n + 6) {
  border-bottom: none;
}
.client-projects-wrap {
  margin-top: 16px;
}
.client-projects-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0 0 10px;
}
.proj-cell-name {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
}
.proj-cell-actions {
  justify-content: flex-end;
  padding-right: 0;
}
.btn-proj-edit {
  display: inline-block;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  overflow: visible;
  flex-shrink: 0;
  transition:
    background 0.12s,
    color 0.12s,
    border-color 0.12s;
}
.btn-proj-edit:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}
.proj-cell-clickable {
  cursor: pointer;
}
.dash-proj-pagination {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}
.dash-proj-page-info {
  font-size: 13px;
  color: var(--text-muted);
}
.proj-cell-clickable:hover {
  background: var(--primary-light);
}

/* Project status badges */
.proj-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.proj-status-project-credentials {
  background: #ede9fe;
  color: #5b21b6;
}
.proj-status-building {
  background: #dbeafe;
  color: #1d4ed8;
}
.proj-status-test {
  background: #fef3c7;
  color: #92400e;
}
.proj-status-meet {
  background: #d1fae5;
  color: #065f46;
}
.proj-status-edits {
  background: #ffe4e6;
  color: #9f1239;
}
.proj-status-completed {
  background: #dcfce7;
  color: #14532d;
}

.dash-inv-breakdown {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 11px;
}
.dash-inv-breakdown th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 500;
  padding: 2px 6px 4px;
  border-bottom: 1px solid var(--border);
}
.dash-inv-breakdown td {
  padding: 3px 6px;
  border-bottom: 1px solid var(--border-light);
}
.dash-inv-breakdown td:nth-child(2),
.dash-inv-breakdown td:nth-child(5),
.dash-inv-breakdown th:nth-child(2),
.dash-inv-breakdown th:nth-child(5) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Pipeline bars */
.dash-pipeline {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dash-pipeline-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.dash-pipeline-label {
  width: 110px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}
.dash-pipeline-bar-wrap {
  flex: 1;
  height: 7px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
}
.dash-pipeline-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  min-width: 4px;
  opacity: 0.85;
}
.dash-pipeline-count {
  width: 28px;
  text-align: right;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 12px;
}

/* Client lists */
.dash-client-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dash-client-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s;
}
.dash-client-row:hover {
  background: var(--bg);
}
.dash-client-name {
  font-size: 13px;
  font-weight: 600;
}
.dash-client-co {
  font-size: 11px;
  color: var(--text-muted);
}

/* Chart */
.dash-chart-wrap {
  position: relative;
  height: 220px;
}

/* ── Subscriptions ───────────────────────────────────────────────────────── */
.dash-section-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.dash-section-header-row h3 {
  margin-bottom: 0;
}

.sub-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--text-muted);
}
.sub-summary-item strong {
  color: var(--text);
}
.sub-summary-sep {
  color: var(--border);
}

.sub-grid {
  display: grid;
  grid-template-columns: 2fr 1.6fr 1fr 1fr 0.9fr 0.7fr 1fr 1fr;
  width: 100%;
}
.sub-grid-head {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0 12px 10px 0;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.sub-grid-head-num {
  text-align: right;
  padding-right: 0;
}
.sub-cell {
  font-size: 13px;
  padding: 10px 12px 10px 0;
  border-bottom: 1px solid var(--border-light, #f0f2f4);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.sub-grid > div:nth-last-child(-n + 8) {
  border-bottom: none;
}
.sub-cell-num {
  text-align: right;
  padding-right: 0;
  font-variant-numeric: tabular-nums;
}
.sub-cell-contact {
  gap: 2px;
}
.sub-cell-name {
  font-weight: 500;
}
.sub-cell-company {
  font-size: 11px;
  color: var(--text-muted);
}

.sub-row-clickable {
  cursor: pointer;
}
.sub-row-clickable:hover {
  background: var(--hover-bg, #f8f9fa);
}

.sub-status {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  letter-spacing: 0.02em;
}
.sub-status-active {
  background: #dcfce7;
  color: #15803d;
}
.sub-status-inactive {
  background: #f1f5f9;
  color: #64748b;
}

.label-hint {
  font-weight: 400;
  text-transform: none;
  font-size: 10px;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ── Collapsible dashboard sections ─────────────────────────────────────── */
.dash-chevron {
  display: inline-block;
  margin-left: 7px;
  font-size: 25px;
  color: var(--text-muted);
  transition: transform 0.18s ease;
  vertical-align: middle;
  line-height: 1;
}
.dash-chevron::before {
  content: "▾";
}
.dash-chevron.collapsed {
  transform: rotate(-90deg);
}

.dash-kpi-header,
.dash-section-header-row {
  user-select: none;
}
.dash-section[data-section] > h3 {
  user-select: none;
}

/* ── Scrollbar (subtle) ──────────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 4px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #c4cdd8;
}

#client-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
}
#client-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* ── Goals / KPIs ─────────────────────────────────────────────────────────── */
#goals-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
}
.goals-body {
  padding: 24px 28px;
  flex: 1;
}
.goals-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 2fr;
  gap: 0;
  width: 100%;
  max-width: 860px;
}
.goals-head {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0 12px 10px 0;
  border-bottom: 1px solid var(--border);
}
.goals-row {
  display: contents;
}
.goals-cell {
  font-size: 13px;
  padding: 9px 12px 9px 0;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
}
.goals-label {
  font-weight: 500;
  color: var(--text);
}
.goals-target-input,
.goals-actual-input {
  width: 90px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
}
.goals-target-input:focus,
.goals-actual-input:focus {
  outline: none;
  border-color: var(--primary);
}
.goals-actual-auto {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}
.goals-progress-cell {
  gap: 8px;
}
.goals-progress-bar {
  flex: 1;
  height: 8px;
  background: var(--border-light);
  border-radius: 4px;
  overflow: hidden;
  min-width: 80px;
}
.goals-progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}
.goals-bar-green {
  background: #16a34a;
}
.goals-bar-amber {
  background: #d97706;
}
.goals-bar-red {
  background: #dc2626;
}
.goals-pct {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 36px;
  text-align: right;
}
.goals-pct-empty {
  font-weight: 400;
}
.goals-remaining {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
  display: block;
}
.goals-remaining-met {
  color: #16a34a;
  font-weight: 600;
}
.goals-actions {
  margin-top: 20px;
  max-width: 860px;
}
.goals-year-note {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 16px;
}
.goals-section-header {
  grid-column: 1 / -1;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  padding: 14px 0 6px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 2px;
}
.goals-section-header:first-child {
  padding-top: 0;
}

/* Dashboard KPI widget */
.dash-kpi-section {
}
.dash-kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.dash-kpi-header h3 {
  margin: 0;
}
.dash-kpi-goto {
  font-size: 12px;
  padding: 4px 10px;
}

/* KPI section break — full-width row inside the grid */
.kpi-section-break {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0 2px;
}
.kpi-section-break:first-child {
  margin-top: 0;
}
.kpi-section-break span {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  white-space: nowrap;
}
.kpi-section-break::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* KPI cards grid */
.kpi-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: box-shadow 0.15s;
}
.kpi-card.dash-kpi-clickable {
  cursor: pointer;
}
.kpi-card.dash-kpi-clickable:hover {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  border-color: var(--text-muted);
}
.kpi-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 2px;
}
.kpi-card-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.3;
}
.kpi-card-pct {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}
.kpi-pct-green {
  background: #dcfce7;
  color: #16a34a;
}
.kpi-pct-amber {
  background: #fef3c7;
  color: #b45309;
}
.kpi-pct-red {
  background: #fee2e2;
  color: #dc2626;
}
.kpi-card-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}
.kpi-card-target {
  font-size: 11px;
  color: var(--text-subtle);
  margin-bottom: 6px;
}
.kpi-card-bar-wrap {
  margin-bottom: 2px;
}
.kpi-card-bar {
  height: 5px;
  background: var(--border-light);
  border-radius: 3px;
  overflow: hidden;
}
.dash-kpi-remaining {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
  display: block;
}
.dash-kpi-remaining-met {
  color: #16a34a;
  font-weight: 600;
}
.kpi-card[data-section="subs-chart"] {
  grid-column: 1 / -1;
}
.kpi-card[data-section="subs-chart"] .dash-chart-wrap {
  height: 300px;
}
.dash-ytd-btn {
  font-weight: 600;
  letter-spacing: 0.04em;
}
.dash-ytd-active {
  background: var(--accent, #3b82f6) !important;
  color: #fff !important;
  border-color: var(--accent, #3b82f6) !important;
}
.kpi-card-spark-wrap {
  margin-top: 10px;
  border-top: 1px solid var(--border-light);
  padding-top: 8px;
}
.kpi-card-spark-title {
  font-size: 10px;
  color: var(--text-subtle);
  font-weight: 500;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.kpi-chart-canvas-wrap {
  position: relative;
  height: 80px;
}
/* New Projects Dashboard */
.np-popup-count {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 6px;
}
.np-popup-head {
  display: grid;
  grid-template-columns: 0.5fr 2fr 1.5fr 2fr;
  gap: 0 12px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 10px 0 6px;
  border-bottom: 1px solid var(--border);
}
.np-popup-list {
  max-height: 360px;
  overflow-y: auto;
}
.np-popup-row {
  display: grid;
  grid-template-columns: 0.5fr 2fr 1.5fr 2fr;
  gap: 0 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  font-size: 13px;
  align-items: center;
}
.np-popup-row:hover {
  background: var(--bg);
}
.np-popup-row:last-child {
  border-bottom: none;
}

/* Sales Calls popup */
.sc-popup-count {
  font-size: 13px;
  font-weight: 400;
  color: blue;
  margin-left: 6px;
}
.sc-popup-head {
  display: grid;
  grid-template-columns: 2fr 1fr 2fr;
  gap: 0 12px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 10px 0 6px;
  border-bottom: 1px solid var(--border);
}
.sc-popup-list {
  max-height: 360px;
  overflow-y: auto;
}
.sc-popup-row {
  display: grid;
  grid-template-columns: 2fr 1fr 2fr;
  gap: 0 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  font-size: 13px;
  align-items: center;
}
.sc-popup-row:hover {
  background: var(--bg);
}
.sc-popup-row:last-child {
  border-bottom: none;
}
.sc-popup-client {
  font-weight: 500;
  color: var(--primary);
}
.sc-popup-company {
  font-weight: 500;
  color: black;
}
.sc-popup-date {
  color: var(--text-muted);
}
.sc-popup-subject {
  color: var(--text-muted);
  white-space: normal;
  overflow: visible;
}

/* ── Rolling Profiles — integrated into #client-header ──────────────────── */
#profile-section:not(:empty) {
  margin-top: 14px;
  padding: 14px 0 4px;
  border-top: 1px solid var(--border-light);
}

.profile-cols {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 0 24px;
}
@media (max-width: 800px) {
  .profile-cols {
    grid-template-columns: 1fr;
    gap: 14px 0;
  }
}

.profile-col-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
  margin-bottom: 7px;
}

/* AI Summary */
.profile-summary-text {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
}
.profile-summary-empty {
  font-size: 13px;
  color: var(--text-subtle);
  font-style: italic;
}
.profile-ai-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.profile-generated-at {
  font-size: 11px;
  color: var(--text-subtle);
  flex: 1;
}
.profile-spinner {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

/* Next steps */
.profile-next-steps-textarea {
  width: 100%;
  min-height: 70px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 9px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  resize: vertical;
  outline: none;
  background: var(--bg);
  transition: border-color 0.15s;
}
.profile-next-steps-textarea:focus {
  border-color: var(--primary);
  background: var(--surface);
}
/* Next steps task creator */
.ns-task-fields {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 6px;
}
.ns-task-input {
  width: 100%;
  font-size: 12px;
  padding: 5px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  box-sizing: border-box;
  resize: vertical;
}
.ns-task-input:focus {
  border-color: var(--primary);
  outline: none;
  background: var(--surface);
}
.ns-task-input[type="date"] {
  color: var(--text);
}
.ns-task-actions {
  display: flex;
  justify-content: flex-end;
}

/* ── Button spinner ──────────────────────────────────────────────────────────── */
.btn-spinner {
  display: inline-block;
  width: 11px;
  height: 11px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 1px;
}
@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

/* Company contacts inside profile */
.profile-contacts-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 6px;
}
.profile-contact-row {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 5px 7px;
  margin: 0 -7px;
  transition: background 0.12s;
}
.profile-contact-row:hover {
  background: var(--primary-light);
}
.profile-contact-avatar {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.profile-contact-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.profile-contact-meta {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Estimates & Invoices panel ──────────────────────────────────────────── */
#estimates-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
}
.ei-body {
  padding: 24px 28px;
  flex: 1;
}
.ei-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.ei-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}
.ei-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}
.ei-metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.ei-metric-card .em-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.ei-metric-card .em-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
.ei-metric-card .em-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}
.ei-section {
  margin-bottom: 32px;
}
.ei-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.ei-section-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.ei-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.ei-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 6px 10px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.ei-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  color: var(--text);
}
.ei-table tr:last-child td {
  border-bottom: none;
}
.ei-table tr:hover td {
  background: var(--bg);
}
.ei-table .td-client {
  font-weight: 500;
  color: var(--primary);
  cursor: pointer;
}
.ei-table .td-client:hover {
  text-decoration: underline;
}
.ei-table .td-amount {
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.ei-table .td-days {
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.ei-table .td-notes {
  white-space: normal;
  word-break: break-word;
  min-width: 160px;
  max-width: 320px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}
.ei-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}
.ei-badge-paid {
  background: #dcfce7;
  color: #15803d;
}
.ei-badge-late {
  background: #fee2e2;
  color: #b91c1c;
}
.ei-badge-due {
  background: #fef9c3;
  color: #92400e;
}
.ei-badge-unpaid {
  background: #f1f5f9;
  color: #64748b;
}
.ei-badge-converted {
  background: #dcfce7;
  color: #15803d;
}
.ei-badge-pending-est {
  background: #f1f5f9;
  color: #64748b;
}
.ei-badge-declined {
  background: #fee2e2;
  color: #b91c1c;
}
.ei-empty {
  color: var(--text-muted);
  font-size: 13px;
  padding: 24px 10px;
  text-align: center;
}
.ei-actions {
  display: flex;
  gap: 8px;
}
.ei-row-actions {
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.12s;
}
tr:hover .ei-row-actions {
  opacity: 1;
}
.ei-btn-sm {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  color: var(--text-muted);
  transition:
    background 0.12s,
    color 0.12s;
}
.ei-btn-sm:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

/* ── Pipeline Card View ──────────────────────────────────────────────────── */
/* ── Shell ── */
#funnel-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* ── Header ── */
.fn-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 12px;
}
.fn-header-left {}
.fn-header h2 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}
.fn-header-stats {
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
}
.fn-stat {
  font-size: 12px;
  color: var(--text-muted);
}
.fn-stat--warn { color: #d97706; font-weight: 600; }
.fn-stat--ok   { color: #16a34a; font-weight: 600; }
.fn-stat--muted { color: var(--text-subtle); }
.fn-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.fn-search {
  width: 160px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
.fn-search:focus { border-color: var(--primary); }
.fn-refresh {
  font-size: 14px;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s;
}
.fn-refresh:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }

/* ── Tabs ── */
.fn-tabs {
  display: flex;
  gap: 2px;
  padding: 8px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.fn-tab {
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.fn-tab:hover { border-color: var(--primary); color: var(--primary); }
.fn-tab--active { background: var(--primary); border-color: var(--primary); color: #fff; }
.fn-tab-count {
  font-size: 11px;
  font-weight: 700;
  background: rgba(0,0,0,0.10);
  border-radius: 10px;
  padding: 0 5px;
  line-height: 16px;
}
.fn-tab--active .fn-tab-count { background: rgba(255,255,255,0.25); }

/* ── Card grid ── */
.fn-grid {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  align-content: start;
}
.fn-empty {
  grid-column: 1/-1;
  padding: 48px 0;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

/* ── Card ── */
.fn-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.fn-card:hover {
  box-shadow: var(--shadow);
  border-color: #d1d9e8;
}

/* Card top row */
.fn-card-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.fn-card-avatar {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fn-card-info { flex: 1; min-width: 0; }
.fn-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fn-card-company {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

/* Recency badge */
.fn-recency {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  white-space: nowrap;
  margin-top: 1px;
}
.fn-recency--ok   { background: #dcfce7; color: #166534; }
.fn-recency--mild { background: #fef9c3; color: #854d0e; }
.fn-recency--warn { background: #fef3c7; color: #92400e; }
.fn-recency--old  { background: #fee2e2; color: #991b1b; }

/* Milestone dots row */
.fn-card-dots {
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
}
.fn-dot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 28px;
  flex-shrink: 0;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, transform 0.1s;
}
.fn-dot:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-1px);
}
.fn-dot--on {
  color: #fff;
}
.fn-dot--on:hover {
  filter: brightness(0.88);
}
.fn-dot-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  pointer-events: none;
  line-height: 1;
}
.fn-dot--on .fn-dot-label { color: #fff; }

/* Next step footer */
.fn-card-next {
  font-size: 11px;
  color: var(--text-muted);
  padding: 7px 10px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--border);
  display: flex;
  align-items: center;
  gap: 5px;
}
.fn-card-next--mid {
  border-left-color: #f59e0b;
  background: #fffbeb;
  color: #92400e;
}
.fn-card-next--high {
  border-left-color: #10b981;
  background: #f0fdf4;
  color: #065f46;
}
.fn-next-arrow {
  font-size: 12px;
  flex-shrink: 0;
}

/* ── Stage pills in client header ── */
.fn-header-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.fn-header-stage-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}
.fn-header-no-stage {
  font-size: 11px;
  color: var(--text-subtle);
  font-style: italic;
}

/* ── Geo / Practice Map Panel ────────────────────────────────────────────── */

#geo-panel {
  overflow-y: auto;
  height: 100%;
}

.geo-wrap {
  padding: 24px 28px 40px;
  min-height: 100%;
}

/* Header */
.geo-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.geo-header-left {}
.geo-h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 3px;
}
.geo-sub {
  font-size: 13px;
  color: var(--text-muted);
}

/* KPI chips */
.geo-kpis {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.geo-kpi {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 14px;
  min-width: 80px;
  box-shadow: var(--shadow-sm);
}
.geo-kpi-val {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.1;
}
.geo-kpi-lbl {
  font-size: 10px;
  color: var(--text-subtle);
  text-align: center;
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

/* Body: two-column map + sidebar */
.geo-body {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
  align-items: start;
}

/* Cards */
.geo-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.geo-card--full {
  height: 100%;
}
.geo-map-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.geo-card-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  flex-wrap: wrap;
}
.geo-card-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.geo-card-meta {
  font-size: 11px;
  color: var(--text-subtle);
}
.geo-map-hdr-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.geo-clear-btn {
  font-size: 11px;
  font-family: inherit;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  border: 1px solid #c7d7fd;
  border-radius: 4px;
  padding: 2px 8px;
  cursor: pointer;
  transition: background 0.12s;
}
.geo-clear-btn:hover { background: #dde8ff; }

/* Map area */
.geo-map-wrap {
  padding: 8px;
  background: var(--bg);
  position: relative;
}
.geo-map-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 48px 0;
  justify-content: center;
  font-size: 13px;
  color: var(--text-muted);
}
@keyframes geo-spin { to { transform: rotate(360deg); } }
.geo-spin { animation: geo-spin 1s linear infinite; }

/* Legend */
.geo-legend-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 8px;
  border-top: 1px solid var(--border-light);
  flex-wrap: wrap;
}
.geo-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
}
.geo-legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  display: inline-block;
}

/* International tags */
.geo-intl {
  padding: 10px 14px 12px;
  border-top: 1px solid var(--border-light);
}
.geo-intl-hdr {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
  margin-bottom: 6px;
}
.geo-intl-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.geo-intl-tag {
  font-size: 11px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--text-muted);
}
.geo-intl-tag em {
  font-style: normal;
  font-weight: 700;
  color: var(--text);
  margin-left: 4px;
}

/* Right sidebar */
.geo-sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: calc(100vh - 180px);
  overflow: hidden;
}
.geo-card--full {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.geo-aol-wrap {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* AOL/Spec sections */
.geo-aol-section,
.geo-spec-section {
  padding: 10px 14px 6px;
}
.geo-aol-section + .geo-spec-section {
  border-top: 1px solid var(--border-light);
}
.geo-aol-section-hdr {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
  margin-bottom: 8px;
}

/* AOL bar rows */
.geo-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}
.geo-bar-row--clickable { cursor: pointer; }
.geo-bar-row--clickable:hover .geo-bar-fill { opacity: 0.8; }
.geo-bar-row--active .geo-bar-label { font-weight: 600; color: var(--text); }
.geo-bar-label {
  font-size: 11px;
  color: var(--text-muted);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Inside AOL blocks the row stacks vertically so the label gets full width */
.geo-aol-block .geo-bar-row {
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
}
.geo-aol-block .geo-bar-label {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
}
.geo-bar-track {
  flex: 1;
  height: 6px;
  background: var(--border-light);
  border-radius: 3px;
  overflow: hidden;
}
.geo-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}
.geo-bar-cnt {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 20px;
  text-align: right;
}

/* Specialty tag cloud */
.geo-spec-group {
  margin-bottom: 10px;
}
.geo-spec-hdr {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 5px;
}
.geo-spec-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.geo-spec-tag {
  font-size: 11px;
  border: 1px solid;
  border-radius: 4px;
  padding: 2px 6px;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: normal;
  word-break: break-word;
}
.geo-spec-tag:hover { opacity: 0.8; }
.geo-spec-cnt {
  font-style: normal;
  font-weight: 700;
  margin-left: 4px;
  opacity: 0.75;
}

/* Tooltip */
.geo-tooltip {
  display: none;
  position: fixed;
  z-index: 999;
  background: #1e293b;
  color: #f1f5f9;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  max-width: 220px;
  pointer-events: none;
  box-shadow: var(--shadow-lg);
}
.geo-tooltip strong { display: block; margin-bottom: 4px; font-size: 13px; }
.geo-tooltip ul { margin: 0; padding: 0; list-style: none; }
.geo-tooltip li { padding: 1px 0; color: #cbd5e1; }
.geo-tooltip .geo-tip-more { color: #94a3b8; font-style: italic; }

/* Empty state */
.geo-empty-msg {
  font-size: 12px;
  color: var(--text-subtle);
  font-style: italic;
  padding: 8px 0;
}

/* Sidebar nav buttons — allow wrapping */
#sidebar-header {
  flex-wrap: wrap;
  row-gap: 4px;
}

/* ── Geo: AOL block (bar + nested spec tags) ─────────────────────────────── */
.geo-aol-block {
  padding: 4px 14px;
  border-radius: 6px;
  transition: background 0.1s;
}
.geo-aol-block--active {
  background: var(--primary-light);
}
.geo-bar-top {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 3px;
}
.geo-aol-specs {
  padding: 4px 0 6px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* Specialties toggle button */
.geo-spec-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-family: inherit;
  font-weight: 600;
  color: var(--text-subtle);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 0 4px 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: color 0.12s;
}
.geo-spec-toggle:hover { color: var(--text-muted); }
.geo-spec-toggle-icon {
  transition: transform 0.2s ease;
  flex-shrink: 0;
}
.geo-spec-toggle--open .geo-spec-toggle-icon { transform: rotate(180deg); }

/* Spec group header (inside _geoSpecHtml) */
.geo-spec-group-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.geo-spec-group-cnt {
  font-weight: 600;
  color: var(--text-subtle);
}

/* Tooltip (updated with visibility class) */
.geo-tooltip {
  display: block;
  visibility: hidden;
  opacity: 0;
  position: fixed;
  z-index: 999;
  background: #1e293b;
  color: #f1f5f9;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  width: max-content;
  max-width: 360px;
  pointer-events: none;
  box-shadow: var(--shadow-lg);
  transition: opacity 0.1s;
}
.geo-tooltip--visible {
  visibility: visible;
  opacity: 1;
}
.geo-tt-state {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 2px;
}
.geo-tt-count {
  color: #94a3b8;
  font-size: 11px;
  margin-bottom: 4px;
}
.geo-tt-filtered { color: #fbbf24; }
.geo-tt-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.geo-tt-list li {
  font-size: 12px;
  padding: 1px 0;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.geo-tt-cnt {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 600;
}
.geo-tt-more {
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
}
.geo-tt-list li { padding: 1px 0; color: #cbd5e1; }
.geo-tt-more { color: #94a3b8; font-style: italic; }
