:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-soft: #f0f0f0;
  --ink: #000000;
  --muted: #333333;
  --line: #000000;
  --line-strong: #000000;
  --nav: #000000;
  --nav-soft: #181818;
  --teal: #005f52;
  --teal-strong: #003f37;
  --blue: #003f7f;
  --coral: #8f240f;
  --amber: #735000;
  --green: #075f31;
  --shadow: 0 0 0 1px #000000;
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* High contrast is the only secureCRM theme. */
:root[data-theme],
:root[data-theme="contrast"] {
  color-scheme: light;
  --bg: #ffffff; --surface: #ffffff; --surface-soft: #f0f0f0;
  --ink: #000000; --muted: #333333; --line: #000000; --line-strong: #000000;
  --nav: #000000; --nav-soft: #141414;
  --teal: #006b5b; --teal-strong: #004a3f; --blue: #0b4a86;
  --coral: #a5301c; --amber: #7a5200; --green: #146c3a;
  --shadow: 0 0 0 1px #000000;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  min-width: 320px;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #000000;
}

.login-panel {
  width: min(460px, 100%);
  background: #ffffff;
  border: 2px solid #000000;
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 18px;
}

.login-brand {
  color: var(--ink);
}

.login-help {
  border: 2px solid #000000;
  background: #fff5d6;
  color: #000000;
  border-radius: var(--radius);
  padding: 12px;
  display: grid;
  gap: 4px;
  font-size: 13px;
  line-height: 1.35;
}

.login-help strong,
.login-help span {
  display: block;
}

.login-error {
  border: 2px solid var(--coral);
  background: #fdecea;
  color: var(--coral);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.35;
}

.form-field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.form-field input,
.form-field select,
.form-field textarea {
  color: var(--ink);
  font-weight: 500;
}

.form-wide {
  grid-column: 1 / -1;
}

button,
input,
select,
textarea {
  font: inherit;
}

a {
  color: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--nav);
  color: #f9fbfc;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #ffffff;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  object-fit: cover;
  background: #ffffff;
  border: 1px solid var(--line-strong);
  padding: 2px;
  flex: 0 0 auto;
}

.brand strong {
  display: block;
  font-size: 15px;
}

.brand small,
.sidebar-footer span {
  color: #aab4c2;
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item,
.icon-btn,
.ghost-btn,
.primary-btn,
.chip-btn {
  border: 0;
  cursor: pointer;
}

.nav-item {
  width: 100%;
  height: 42px;
  border-radius: var(--radius);
  background: transparent;
  color: #c8d1dc;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  text-align: left;
}

.nav-item svg {
  width: 18px;
  height: 18px;
}

.nav-item:hover,
.nav-item.is-active {
  background: var(--nav-soft);
  color: #ffffff;
}

.nav-item.is-active {
  box-shadow: inset 3px 0 0 #38b8a6;
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.workspace {
  min-width: 0;
  padding: 26px clamp(18px, 3vw, 34px) 40px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 22px;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 700;
  margin: 0 0 6px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.05;
  margin-bottom: 0;
}

h2 {
  font-size: 20px;
  line-height: 1.2;
}

h3 {
  font-size: 15px;
  margin-bottom: 6px;
}

.topbar-actions,
.toolbar,
.toolbar-row,
.filter-row,
.inline-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.user-chip {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.ghost-btn,
.primary-btn,
.chip-btn,
.icon-btn {
  min-height: 38px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.text-link {
  border: 0;
  background: transparent;
  color: var(--teal);
  padding: 0;
  font-weight: 800;
  cursor: pointer;
  text-align: left;
}

.ghost-btn,
.chip-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 0 12px;
}

.primary-btn {
  background: var(--teal);
  color: #ffffff;
  padding: 0 14px;
  box-shadow: 0 10px 24px rgba(22, 135, 124, 0.22);
}

.primary-btn:hover,
.ghost-btn:hover,
.chip-btn:hover,
.icon-btn:hover {
  transform: translateY(-1px);
}

.primary-btn:disabled,
.ghost-btn:disabled,
.chip-btn:disabled,
.icon-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.primary-btn:hover {
  background: var(--teal-strong);
}

.icon-btn {
  width: 38px;
  background: rgba(255, 255, 255, 0.1);
  color: currentColor;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.topbar .icon-btn,
.detail-drawer .icon-btn,
.panel .icon-btn {
  background: var(--surface);
  border-color: var(--line);
}

svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.hidden {
  display: none !important;
}

.notice {
  padding: 12px 14px;
  border: 1px solid #b7dacd;
  background: #ebf8f4;
  color: #0f5f55;
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  min-height: 124px;
  display: grid;
  align-content: space-between;
  box-shadow: 0 1px 0 rgba(24, 33, 47, 0.03);
}

.kpi-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.kpi-value {
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 800;
  line-height: 1;
}

.kpi-caption {
  color: var(--muted);
  font-size: 12px;
}

.accent-teal {
  color: var(--teal);
}

.accent-blue {
  color: var(--blue);
}

.accent-coral {
  color: var(--coral);
}

.accent-amber {
  color: var(--amber);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
  gap: 16px;
  margin-top: 16px;
}

.company-leads-panel {
  margin-top: 16px;
}

.dashboard-source-grid {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.user-connection-card {
  display: grid;
  gap: 10px;
}

.connection-mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.connection-mini-grid span {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.connection-mini-grid b {
  display: block;
  color: var(--ink);
  font-size: 18px;
}

.outreach-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 16px;
  align-items: start;
}

.archive-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.archive-actions .primary-btn,
.archive-actions .ghost-btn {
  width: 100%;
}

.archive-summary-grid {
  margin-bottom: 12px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  min-width: 0;
  box-shadow: 0 1px 0 rgba(24, 33, 47, 0.03);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-header h2 {
  margin-bottom: 0;
}

.muted {
  color: var(--muted);
}

.pipeline-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
  overflow: auto;
  padding-bottom: 4px;
  align-items: start;
  max-height: 390px;
}

.pipeline-column {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 250px;
  padding: 10px;
}

.pipeline-column header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 10px;
}

.mini-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  margin-bottom: 8px;
  width: 100%;
  text-align: left;
}

.mini-card strong,
.mini-card span {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.mini-card span {
  color: var(--muted);
  font-size: 12px;
}

.toolbar {
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 14px;
  position: sticky;
  top: 0;
  z-index: 3;
}

.search-field {
  min-width: min(460px, 100%);
  flex: 1 1 280px;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px;
  background: #ffffff;
}

.search-field input {
  border: 0;
  outline: 0;
  width: 100%;
  min-width: 0;
  background: transparent;
}

select,
textarea,
.text-input {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
}

select,
.text-input {
  height: 40px;
  padding: 0 10px;
}

textarea {
  width: 100%;
  min-height: 104px;
  resize: vertical;
  padding: 10px;
}

.table-shell {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  background: #fbfcfd;
  border-bottom: 1px solid var(--line);
  padding: 12px;
  white-space: nowrap;
}

.data-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.data-table tr {
  cursor: pointer;
}

.data-table tr:hover {
  background: #f9fbfc;
}

.name-cell {
  display: grid;
  gap: 4px;
  min-width: 210px;
}

.name-cell strong {
  overflow-wrap: anywhere;
}

.name-cell small,
.cell-sub {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
  background: #eef2f5;
  color: #344054;
  white-space: nowrap;
}

.badge.ready,
.badge.accepted,
.badge.connected,
.badge.replied,
.badge.meeting_booked,
.badge.proposal_sent,
.badge.won,
.badge.engaged,
.badge.customer {
  background: #e8f6f1;
  color: #136d52;
}

.badge.request_sent,
.badge.pending,
.badge.outreach_due,
.badge.contacted,
.badge.follow_up_due,
.badge.active {
  background: #fff3db;
  color: #8a5200;
}

.badge.rejected,
.badge.disqualified {
  background: #fdecea;
  color: #aa3825;
}

.badge.not_added,
.badge.new,
.badge.new_lead,
.badge.assigned,
.badge.researching,
.badge.prospect {
  background: #edf2ff;
  color: #315fbd;
}

.meter {
  min-width: 92px;
}

.meter-bar {
  height: 7px;
  background: #edf1f5;
  border-radius: 99px;
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--coral), var(--amber), var(--teal));
}

.meter-fill.indeterminate {
  width: 45%;
  animation: progress-slide 1.8s ease-in-out infinite;
}

@keyframes progress-slide {
  0% { transform: translateX(-110%); }
  50% { transform: translateX(70%); }
  100% { transform: translateX(230%); }
}

.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 10px;
}

.status-grid.small {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.status-tile {
  border: 1px solid var(--line);
  background: #fbfcfd;
  border-radius: var(--radius);
  min-height: 74px;
  padding: 12px;
  display: grid;
  gap: 8px;
  text-align: left;
  cursor: pointer;
}

.status-tile:hover {
  border-color: var(--teal);
}

.status-tile span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.status-tile strong {
  font-size: 24px;
}

.lead-add-panel {
  margin-bottom: 14px;
}

.request-summary-panel {
  margin-bottom: 14px;
}

.lead-form,
.ai-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.ai-panel {
  margin-top: 16px;
}

.lead-paste-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 12px;
  display: grid;
  gap: 10px;
}

.network-lead-panel {
  display: grid;
  gap: 14px;
}

.network-lead-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 0.35fr);
  gap: 12px;
  align-items: end;
}

.network-lead-grid .primary-btn {
  min-height: 44px;
}

.network-job-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  display: grid;
  gap: 12px;
  background: var(--surface);
}

.network-job-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.network-job-head strong {
  display: block;
  font-size: 14px;
}

.network-job-head small {
  color: var(--muted);
}

.network-picks {
  margin-top: 2px;
}

/* Prefilled criteria presets for the Lead Generator. */
.prompt-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 10px;
}

.prompt-presets .preset-chip {
  font-size: 12px;
}

/* Live connect-result pills shown as each request is sent. */
.connect-results {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.connect-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  background: var(--surface-soft);
  white-space: nowrap;
}

.connect-pill.ok {
  border-color: var(--green);
  color: var(--green);
}

.connect-pill.skip {
  color: var(--muted);
  opacity: 0.85;
}

.eta-live strong {
  font-variant-numeric: tabular-nums;
}

.empty-state.small {
  padding: 18px 12px;
  min-height: 58px;
}

.inline-error {
  margin: 0;
  background: #fff7f6;
  border-color: var(--coral);
  color: #000000;
}

.lead-paste-header,
.command-top,
.command-actions,
.reply-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.lead-paste-header strong,
.command-top,
.reply-head strong {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
  color: var(--ink);
}

.command-panel {
  background: #ffffff;
}

.command-shell {
  border: 2px solid #000000;
  border-radius: var(--radius);
  background: #050505;
  color: #ffffff;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.command-top {
  color: #ffffff;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.command-top span:last-child {
  color: #d7fff4;
}

.ai-model-row {
  display: grid;
  grid-template-columns: auto minmax(210px, 320px) 1fr;
  gap: 10px;
  align-items: center;
  color: #d8d8d8;
  font-size: 13px;
}

.ai-model-row label {
  color: #ffffff;
  font-weight: 800;
}

.ai-model-row select {
  border-color: #ffffff;
  background: #ffffff;
  color: #000000;
}

.ai-model-row span {
  overflow-wrap: anywhere;
}

.model-help {
  color: #d8d8d8;
  font-size: 12px;
  line-height: 1.45;
}

.command-shell textarea {
  min-height: 210px;
  border: 1px solid #ffffff;
  background: #0d0d0d;
  color: #ffffff;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  line-height: 1.5;
}

.command-actions {
  color: #d8d8d8;
  font-size: 13px;
}

.analysis-card {
  margin-top: 16px;
  display: grid;
  gap: 14px;
}

.ai-summary-grid,
.ai-detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.ai-detail-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ai-detail-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 10px;
  min-height: 72px;
}

.ai-detail-box strong,
.ai-detail-box span {
  display: block;
  overflow-wrap: anywhere;
}

.ai-detail-box strong {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.ai-detail-box span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  padding: 4px 8px;
}

.reply-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px;
  display: grid;
  gap: 10px;
}

.reply-card.send-now {
  border-width: 2px;
  background: #f5fff9;
}

.ai-message-preview {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  display: grid;
  gap: 10px;
}

.reply-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.reply-card textarea,
.ai-message-preview textarea {
  min-height: 132px;
  background: #ffffff;
  color: #000000;
  line-height: 1.5;
}

.task-list {
  display: grid;
  gap: 8px;
}

.compact-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.check-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: var(--radius);
  padding: 10px;
}

.check-row.compact {
  min-height: 38px;
  align-items: center;
  padding: 0 10px;
}

.check-row input {
  margin-top: 3px;
}

.check-row.compact input {
  margin-top: 0;
}

.activity-log {
  display: grid;
  gap: 10px;
}

.activity-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: #fbfcfd;
}

.activity-tree {
  display: grid;
  gap: 0;
}

.activity-node {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  position: relative;
}

.activity-node::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 20px;
  width: 2px;
  background: var(--line);
}

.activity-node:first-child::before {
  top: 21px;
}

.activity-node:last-child::before {
  bottom: calc(100% - 21px);
}

.activity-rail {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  padding-top: 10px;
}

.activity-avatar {
  width: 28px;
  height: 28px;
  border: 2px solid #000000;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #ffffff;
  color: #000000;
  font-size: 12px;
  font-weight: 900;
}

.activity-card {
  margin: 0 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.activity-node.is-reverted .activity-card {
  background: #f3f3f3;
}

.activity-title {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.activity-title span {
  color: var(--muted);
}

.activity-title code {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 7px;
  background: var(--surface-soft);
  font-size: 12px;
}

.conversation-form {
  display: grid;
  gap: 8px;
}

.post-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  display: grid;
  gap: 12px;
}

.post-content {
  color: #344054;
  line-height: 1.45;
  max-height: 124px;
  overflow: hidden;
}

.comment-box {
  background: #f7faf9;
  border: 1px solid #d7ebe5;
  border-radius: var(--radius);
  padding: 10px;
  color: #164d45;
  font-size: 13px;
}

.detail-drawer {
  position: fixed;
  right: 18px;
  top: 18px;
  bottom: 18px;
  width: min(540px, calc(100vw - 36px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transform: translateX(calc(100% + 24px));
  transition: transform 180ms ease;
  z-index: 20;
  display: flex;
  flex-direction: column;
}

.detail-drawer.is-open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.drawer-header h2 {
  margin-bottom: 0;
  overflow-wrap: anywhere;
}

.drawer-body {
  overflow: auto;
  padding: 18px;
  display: grid;
  gap: 16px;
}

.detail-section {
  display: grid;
  gap: 10px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 10px 14px;
}

.detail-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.detail-value {
  min-width: 0;
  overflow-wrap: anywhere;
}

.raw-list {
  display: grid;
  gap: 8px;
}

details {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
}

summary {
  cursor: pointer;
  font-weight: 800;
}

pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #111820;
  color: #dce6ef;
  padding: 12px;
  border-radius: var(--radius);
  max-height: 360px;
  overflow: auto;
}

.empty-state {
  display: grid;
  place-items: center;
  padding: 44px 14px;
  color: var(--muted);
  text-align: center;
}

.split-list {
  display: grid;
  gap: 8px;
}

.activity-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.activity-dot {
  width: 10px;
  height: 10px;
  border-radius: 99px;
  background: var(--teal);
  margin-top: 5px;
}

.activity-dot.request_sent {
  background: var(--amber);
}

.activity-dot.connected {
  background: var(--green);
}

.source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.source-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: #fbfcfd;
}

.source-card strong {
  display: block;
  overflow-wrap: anywhere;
}

.source-card small {
  color: var(--muted);
}

.user-settings-card {
  display: grid;
  gap: 8px;
}

.password-reset-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  }

  .nav-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .nav-item {
    justify-content: center;
  }

  .nav-item span {
    display: none;
  }

  .sidebar-footer {
    display: none;
  }

  .kpi-grid,
  .dashboard-grid,
  .outreach-grid {
    grid-template-columns: 1fr 1fr;
  }

  .ai-summary-grid,
  .ai-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .workspace {
    padding: 18px 12px 30px;
  }

  .topbar,
  .toolbar {
    display: grid;
  }

  .topbar-actions,
  .toolbar-row,
  .filter-row {
    width: 100%;
  }

  .ghost-btn,
  .primary-btn,
  select {
    flex: 1 1 auto;
  }

  .kpi-grid,
  .dashboard-grid,
  .outreach-grid {
    grid-template-columns: 1fr;
  }

  .table-shell {
    overflow-x: auto;
  }

  .data-table {
    min-width: 780px;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .lead-form,
  .ai-grid,
  .ai-model-row,
  .network-lead-grid,
  .ai-summary-grid,
  .ai-detail-grid,
  .compact-list {
    grid-template-columns: 1fr;
  }

  .activity-row,
  .activity-card {
    align-items: stretch;
    display: grid;
  }
}

/* ── Due chips ─────────────────────────────────────────────────────────────── */
.due-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.due-chip.bad { background: #fdecea; color: #aa3825; }
.due-chip.warn { background: #fff3db; color: #8a5200; }
.due-chip.soon { background: #e9f0fa; color: #2f5d87; }
.status-cell { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.due-cell { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ── Next-action card (lead drawer) ────────────────────────────────────────── */
.next-action-card {
  border: 1px solid var(--teal);
  background: color-mix(in srgb, var(--surface) 88%, var(--teal));
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 12px 0;
  display: grid;
  gap: 8px;
}
.next-action-card .na-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.next-action-card .na-head strong {
  font-size: 12px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--teal-strong);
}
.next-action-card .na-body { font-size: 14px; color: var(--ink); }
.na-msg { display: grid; gap: 6px; }
.na-msg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}
.na-msg textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
}

/* Dark-theme fixes for a couple of hardcoded light surfaces */
:root[data-theme="dark"] .meter-bar,
:root[data-theme="midnight"] .meter-bar,
:root[data-theme="forest"] .meter-bar,
:root[data-theme="dark"] .status-tile,
:root[data-theme="midnight"] .status-tile,
:root[data-theme="forest"] .status-tile { background: var(--surface-soft); }

/* ── Setup wizard ──────────────────────────────────────────────────────────── */
.setup-steps { display: grid; gap: 10px; }
.setup-step {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); padding: 12px 14px;
}
.setup-step.is-active { border-color: var(--teal); }
.setup-step.is-done { border-color: var(--green); }
.setup-step-mark i { width: 22px; height: 22px; color: var(--muted); }
.setup-step.is-active .setup-step-mark i { color: var(--teal); }
.setup-step.is-done .setup-step-mark i { color: var(--green); }
.setup-step-body { flex: 1; display: grid; gap: 2px; }
.setup-step-body strong { font-size: 14px; }
.setup-state {
  display: flex; align-items: center; gap: 12px;
  border: 1px dashed var(--line-strong); border-radius: var(--radius);
  padding: 12px 14px; color: var(--muted);
}
.setup-state.ok { border-style: solid; border-color: var(--green); color: var(--ink); background: color-mix(in srgb, var(--surface) 90%, var(--green)); }
.setup-state i { width: 26px; height: 26px; }
.setup-state strong { display: block; font-size: 14px; color: var(--ink); }
.setup-token { display: grid; gap: 4px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.setup-token input { font-family: ui-monospace, Consolas, monospace; }

/* ── Chip rows (AI examples) ───────────────────────────────────────────────── */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn.ghost { background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.chip-btn.ghost:hover { border-color: var(--teal); color: var(--ink); }
.example-chip { font-size: 12px; }

/* ── AI enhancement markers ────────────────────────────────────────────────── */
.enh-badge {
  display: inline-flex; align-items: center; border-radius: 999px;
  padding: 1px 7px; font-size: 10.5px; font-weight: 800; letter-spacing: .3px; white-space: nowrap;
}
.enh-badge.on { background: color-mix(in srgb, var(--surface) 70%, var(--teal)); color: var(--teal-strong); border: 1px solid var(--teal); }
.enh-badge.off { background: transparent; color: var(--muted); border: 1px dashed var(--line-strong); }
.verdict-chip { display: inline-flex; align-items: center; border-radius: 999px; padding: 1px 8px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.verdict-chip.good { background: #e8f6f1; color: #136d52; }
.verdict-chip.bad { background: #fdecea; color: #aa3825; }
.verdict-chip.warn { background: #fff3db; color: #8a5200; }
.enh-block {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin: 12px 0;
}
.enh-block.on { border-color: var(--teal); background: color-mix(in srgb, var(--surface) 90%, var(--teal)); }
.enh-block strong { font-size: 13px; display: block; }
.enh-block small { color: var(--muted); font-size: 12px; }
.enhance-panel .status-grid { margin-top: 4px; }

/* ── Secure Client disconnected bar ───────────────────────────────────────── */
.client-bar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #c0392b;
  color: #ffffff;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}
.client-bar.hidden { display: none; }
.client-bar a {
  color: #ffffff;
  text-decoration: underline;
  cursor: pointer;
  font-weight: 700;
}
.client-bar-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.6);
  animation: clientBarPulse 1.8s infinite;
}
@keyframes clientBarPulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.55); }
  70% { box-shadow: 0 0 0 7px rgba(255, 255, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}
@media (prefers-reduced-motion: reduce) { .client-bar-dot { animation: none; } }
