:root {
  color-scheme: light;
  --ink: #17232b;
  --navy: #203847;
  --navy-2: #29495a;
  --paper: #f4f1e9;
  --card: #fffdf8;
  --line: #ded8cc;
  --muted: #6d746f;
  --accent: #c75e3b;
  --accent-soft: #f2ded4;
  --green: #37755c;
  --green-soft: #dfece4;
  --gold: #b48a35;
  --gold-soft: #f4e9ca;
  --red: #a94538;
  --red-soft: #f4deda;
  --shadow: 0 18px 60px rgba(36, 48, 53, 0.09);
  --radius: 20px;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--paper); }

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(244, 241, 233, 0.94), rgba(244, 241, 233, 0.94)),
    repeating-linear-gradient(0deg, transparent 0 9px, rgba(32, 56, 71, 0.035) 9px 10px),
    repeating-linear-gradient(90deg, transparent 0 9px, rgba(32, 56, 71, 0.035) 9px 10px);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  min-height: 100vh;
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.app-shell { min-height: 100vh; }

.topbar {
  height: 68px;
  padding: 0 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 253, 248, 0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { display: inline-flex; align-items: center; gap: 13px; text-decoration: none; }
.brand strong { display: block; letter-spacing: 0.02em; }
.brand small { color: var(--muted); display: block; margin-top: 3px; font-size: 11px; letter-spacing: 0.08em; }

.brand-mark {
  width: 39px;
  height: 39px;
  border-radius: 12px;
  display: grid;
  place-content: center;
  gap: 3px;
  background: var(--navy);
  transform: rotate(3deg);
  box-shadow: 4px 4px 0 var(--accent-soft);
}
.brand-mark i { display: block; width: 21px; height: 2px; background: #f7f2e8; border-radius: 2px; }
.brand-mark i:nth-child(2) { width: 15px; margin-left: 6px; }

.top-actions { display: flex; align-items: center; gap: 10px; }
.live-pill { color: var(--green); background: var(--green-soft); border-radius: 100px; padding: 9px 13px; font-size: 12px; font-weight: 700; }
.live-pill span { display: inline-block; width: 7px; height: 7px; background: var(--green); border-radius: 50%; margin-right: 5px; }

main { width: min(1580px, calc(100% - 36px)); margin: 0 auto; padding: 22px 0 54px; }

.hero {
  min-height: 162px;
  padding: 27px 32px;
  border-radius: 26px;
  color: #f8f5ed;
  display: grid;
  grid-template-columns: 1.5fr 0.72fr;
  gap: 30px;
  align-items: end;
  background:
    radial-gradient(circle at 92% 18%, rgba(214, 126, 91, 0.36), transparent 26%),
    linear-gradient(135deg, #1d3542, #294d5d 64%, #3b5f65);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}

.hero::after {
  content: "";
  position: absolute;
  width: 280px;
  height: 280px;
  right: -60px;
  top: -105px;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 44% 56% 56% 44%;
  transform: rotate(28deg);
}

.eyebrow { margin: 0 0 9px; color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: 0.17em; }
.hero .eyebrow { color: #f1a486; }
.hero h1 { margin: 0; font-size: clamp(26px, 2.6vw, 40px); line-height: 1.14; letter-spacing: -0.04em; max-width: 800px; }
.hero-copy { max-width: 820px; margin: 12px 0 0; color: rgba(255,255,255,.72); line-height: 1.6; font-size: 13px; }

.hero-metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; position: relative; z-index: 1; }
.metric { padding: 13px 15px; border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.07); border-radius: 14px; }
.metric strong { display: block; font-size: 23px; line-height: 1; }
.metric span { display: block; margin-top: 7px; font-size: 10px; color: rgba(255,255,255,.67); }

.integrations-panel, .lead-sidebar, .lead-detail {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(36, 48, 53, 0.045);
}

.integrations-panel { margin-top: 14px; padding: 17px 20px; }
.batch-status { margin-top: 14px; padding: 16px 20px; border: 1px solid #c9d8d0; border-radius: 16px; background: linear-gradient(110deg, #edf5f0, #fffaf3); box-shadow: 0 8px 24px rgba(36,48,53,.05); }
.batch-status-head { display: flex; justify-content: space-between; align-items: end; gap: 18px; }
.batch-status-head .eyebrow { margin-bottom: 4px; color: var(--green); }
.batch-status-head strong { font-size: 14px; }
.batch-status-head span { color: var(--muted); font-size: 10px; font-weight: 700; }
.batch-progress { height: 7px; margin-top: 12px; overflow: hidden; border-radius: 99px; background: #dfe7e1; }
.batch-progress i { display: block; height: 100%; min-width: 2px; border-radius: inherit; background: linear-gradient(90deg, var(--green), #6e9f83); transition: width .35s ease; }
.batch-status > p { margin: 8px 0 0; color: var(--muted); font-size: 10px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.section-heading.compact h2 { margin: 0; font-size: 19px; }
.section-heading .eyebrow { margin-bottom: 5px; }
.muted { color: var(--muted); font-size: 12px; margin: 0; }

.integration-strip { margin-top: 12px; display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.integration-card { min-width: 0; padding: 11px 12px; border-radius: 12px; background: #f7f4ed; border: 1px solid #e8e2d7; text-decoration: none; transition: .2s ease; }
.integration-card:hover { transform: translateY(-2px); border-color: #cfc5b5; }
.integration-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.integration-card strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.integration-card small { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; line-height: 1.35; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #a6aaa7; box-shadow: 0 0 0 4px rgba(166,170,167,.14); flex: 0 0 auto; }
.status-dot.online { background: var(--green); box-shadow: 0 0 0 4px rgba(55,117,92,.13); }
.config-tag { display: inline-block; margin-top: 9px; padding: 4px 7px; border-radius: 20px; background: #ebe7de; color: #6b6f6b; font-size: 9px; font-weight: 800; }
.config-tag.ready { background: var(--green-soft); color: var(--green); }
.integration-open { display: block; margin-top: 8px; color: var(--navy); font-size: 9px; font-weight: 800; }

.workspace-grid { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 14px; margin-top: 14px; align-items: start; }
.lead-sidebar { padding: 20px 16px; position: sticky; top: 82px; min-height: 590px; }
.count-badge { min-width: 27px; height: 27px; display: grid; place-items: center; padding: 0 8px; background: var(--navy); color: white; border-radius: 99px; font-size: 11px; font-weight: 800; }

.search-field { margin: 17px 0 12px; height: 42px; border: 1px solid var(--line); border-radius: 12px; display: flex; align-items: center; gap: 8px; padding: 0 12px; background: white; color: var(--muted); }
.search-field input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 12px; }
.lead-list { display: grid; gap: 8px; max-height: calc(100vh - 265px); overflow: auto; padding-right: 3px; }
.lead-list-empty { padding: 42px 13px; text-align: center; color: var(--muted); font-size: 12px; line-height: 1.7; }
.lead-item { width: 100%; text-align: left; border: 1px solid transparent; border-radius: 14px; background: transparent; padding: 13px; color: var(--ink); transition: .18s ease; }
.lead-item:hover { background: #f5f1e9; }
.lead-item.active { background: #eef1ed; border-color: #cbd8d1; }
.lead-item-head { display: flex; align-items: center; justify-content: space-between; gap: 9px; }
.lead-item strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-item p { margin: 7px 0 0; color: var(--muted); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.decision-dot { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; border-radius: 6px; font-size: 9px; font-weight: 900; background: #e7e5df; color: var(--muted); }
.decision-dot.qualified { background: var(--green-soft); color: var(--green); }
.decision-dot.nurture { background: var(--gold-soft); color: #8b681e; }
.decision-dot.hold { background: var(--red-soft); color: var(--red); }

.lead-detail { min-height: 590px; overflow: hidden; }
.empty-state { min-height: 590px; display: grid; place-items: center; align-content: center; text-align: center; padding: 50px; }
.empty-state h2 { margin: 0; font-size: 26px; }
.empty-state p:not(.eyebrow) { max-width: 500px; color: var(--muted); line-height: 1.75; margin: 13px auto 22px; }
.empty-loom { display: flex; gap: 5px; margin-bottom: 24px; transform: rotate(-4deg); }
.empty-loom i { width: 8px; height: 42px; background: var(--navy); border-radius: 10px; }
.empty-loom i:nth-child(2) { background: var(--accent); height: 58px; }
.empty-loom i:nth-child(3) { height: 50px; }
.empty-loom i:nth-child(4) { background: #d5a953; height: 35px; }

.detail-header { padding: 23px 26px 20px; border-bottom: 1px solid var(--line); background: linear-gradient(130deg, #fffdf8, #f5f2ea); }
.detail-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 22px; }
.detail-title h2 { margin: 0; font-size: 28px; letter-spacing: -.025em; }
.detail-title p { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.record-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.record-badges span { padding: 5px 8px; border-radius: 99px; background: #ebe7de; color: var(--muted); font-size: 9px; font-weight: 800; }
.record-badges span.qualified { background: var(--green-soft); color: var(--green); }
.record-badges span.nurture { background: var(--gold-soft); color: #80601b; }
.record-badges span.hold { background: var(--red-soft); color: var(--red); }

.button { border: 0; border-radius: 11px; padding: 11px 15px; font-weight: 750; font-size: 12px; transition: .18s ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .45; }
.button.primary { background: var(--accent); color: white; box-shadow: 0 8px 20px rgba(199,94,59,.2); }
.button.dark { background: var(--navy); color: white; }
.button.ghost { background: #efebe3; color: var(--ink); }
.button.outline { background: transparent; color: var(--navy); border: 1px solid #b9c6cb; }
.button.small { padding: 8px 10px; font-size: 10px; }
.mailbox-button.connected { color: var(--green); border-color: #9dbbad; background: var(--green-soft); }
.approval-queue-button span { display: inline-grid; min-width: 18px; height: 18px; margin-left: 5px; place-items: center; border-radius: 99px; background: #e7e3da; font-size: 9px; }
.approval-queue-button.ready { color: var(--green); border-color: #9dbbad; background: var(--green-soft); }
.approval-queue-button.ready span { color: #fff; background: var(--green); }
.automation-all-button.running { color: #fff; background: var(--green); }

.pipeline-wrap { padding: 18px 26px; border-bottom: 1px solid var(--line); }
.pipeline { display: grid; grid-template-columns: repeat(8, 1fr); gap: 0; }
.stage { position: relative; text-align: center; min-width: 0; }
.stage::before { content: ""; position: absolute; height: 2px; background: #dfd9ce; left: 0; right: 0; top: 15px; }
.stage:first-child::before { left: 50%; }
.stage:last-child::before { right: 50%; }
.stage-node { position: relative; z-index: 1; width: 31px; height: 31px; margin: 0 auto 9px; display: grid; place-items: center; background: #ece8df; border: 4px solid var(--card); border-radius: 50%; color: #858987; font-size: 9px; font-weight: 900; }
.stage.done::before, .stage.done + .stage::before { background: #9fb7aa; }
.stage.done .stage-node { background: var(--green); color: white; }
.stage.current .stage-node { background: var(--accent); color: white; box-shadow: 0 0 0 5px var(--accent-soft); }
.stage.blocked .stage-node { background: var(--red); color: white; }
.stage strong { display: block; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage small { display: block; margin-top: 3px; font-size: 8px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.detail-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(118px, 1fr));
  gap: 5px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: #f6f2ea;
  position: sticky;
  top: 68px;
  z-index: 9;
}
.detail-tab { border: 0; border-radius: 11px; padding: 10px 12px; text-align: left; background: transparent; color: var(--muted); transition: .18s ease; }
.detail-tab:hover { background: rgba(255,255,255,.72); color: var(--ink); }
.detail-tab.active { color: var(--navy); background: white; box-shadow: 0 3px 12px rgba(36,48,53,.08); }
.detail-tab strong, .detail-tab small { display: block; }
.detail-tab strong { font-size: 11px; }
.detail-tab small { margin-top: 4px; font-size: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.detail-content { padding: 22px 26px 30px; display: grid; gap: 16px; min-height: 510px; }
.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.summary-card { padding: 15px; background: #f5f2eb; border-radius: 14px; border: 1px solid #e9e3d8; min-width: 0; }
.summary-card span { color: var(--muted); display: block; font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.summary-card strong, .summary-card a { display: block; margin-top: 7px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }

.panel-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(260px, .75fr); gap: 18px; align-items: start; }
.content-panel { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: white; }
.content-panel-header { padding: 15px 17px; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #faf8f2; border-bottom: 1px solid var(--line); }
.content-panel-header h3 { margin: 0; font-size: 14px; }
.content-panel-body { padding: 17px; }
.report { white-space: pre-wrap; color: #37434a; line-height: 1.72; font-size: 12px; max-height: 580px; overflow: auto; }
.report-placeholder { padding: 46px 22px; color: var(--muted); text-align: center; line-height: 1.7; }
.report-placeholder.compact-placeholder { padding: 34px 22px; font-size: 11px; }

.overview-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(310px, .8fr); gap: 16px; align-items: start; }
.overview-main { display: grid; gap: 16px; }
.signal-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.signal-grid > div { padding: 14px; border-radius: 13px; background: #f6f3ec; border: 1px solid #ebe5da; min-width: 0; }
.signal-grid span, .signal-grid strong, .signal-grid small { display: block; }
.signal-grid span { color: var(--muted); font-size: 9px; }
.signal-grid strong { margin-top: 7px; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.signal-grid small { margin-top: 4px; color: var(--muted); font-size: 8px; }
.latest-update { margin-top: 11px; padding: 13px 14px; border-left: 3px solid var(--accent); border-radius: 0 11px 11px 0; background: var(--accent-soft); }
.latest-update span, .latest-update strong, .latest-update small { display: block; }
.latest-update span { color: var(--accent); font-size: 8px; font-weight: 800; letter-spacing: .08em; }
.latest-update strong { margin-top: 5px; font-size: 11px; line-height: 1.5; }
.latest-update small { margin-top: 4px; color: #8e695a; font-size: 8px; }

.research-mode-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.research-mode-card { min-height: 142px; padding: 18px; border-radius: 16px; display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; border: 1px solid #d9e0dc; background: linear-gradient(145deg, #edf3ef, #f9fbf9); }
.research-mode-card.deep { color: white; border-color: transparent; background: radial-gradient(circle at 94% 8%, rgba(244,167,134,.35), transparent 33%), linear-gradient(140deg, #203847, #315663); }
.research-mode-card h3 { margin: 4px 0 6px; font-size: 16px; }
.research-mode-card p { max-width: 520px; margin: 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.research-mode-card.deep p { color: rgba(255,255,255,.68); }
.mode-kicker { color: var(--green); font-size: 8px; font-weight: 900; letter-spacing: .14em; }
.research-mode-card.deep .mode-kicker { color: #f1a486; }
.research-mode-card .button { flex: 0 0 auto; }
.research-grid { grid-template-columns: minmax(0, 1.7fr) minmax(240px, .55fr); }
.score-panel .button { width: 100%; margin-top: 14px; }
.outreach-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.contract-grid { grid-template-columns: minmax(300px, .85fr) minmax(0, 1.15fr); }
.panel-spacer { margin-top: 16px; }

.score-ring { width: 86px; height: 86px; border-radius: 50%; display: grid; place-content: center; margin: 3px auto 15px; background: conic-gradient(var(--green) calc(var(--score, 0) * 1%), #e9e5dc 0); position: relative; }
.score-ring::after { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: white; }
.score-ring strong, .score-ring small { position: relative; z-index: 1; text-align: center; }
.score-ring strong { font-size: 24px; }
.score-ring small { color: var(--muted); font-size: 9px; }
.score-breakdown { display: grid; gap: 8px; }
.score-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; font-size: 10px; }
.score-row span { color: var(--muted); }
.score-row small { display: block; margin-top: 2px; color: #9a9d99; font-size: 8px; line-height: 1.35; }
.qualification-gates { display: grid; gap: 7px; margin: 0 0 15px; padding: 12px; border-radius: 12px; background: #f6f3ec; border: 1px solid #e8e2d7; }
.qualification-gates > strong { margin-bottom: 2px; font-size: 9px; letter-spacing: .04em; }
.gate-row { display: grid; grid-template-columns: 19px 1fr; gap: 7px; align-items: start; }
.gate-row > span { width: 19px; height: 19px; display: grid; place-items: center; border-radius: 50%; font-size: 10px; font-weight: 900; }
.gate-row.pass > span { color: white; background: var(--green); }
.gate-row.fail > span { color: white; background: var(--red); }
.gate-row b, .gate-row small { display: block; }
.gate-row b { font-size: 9px; line-height: 1.35; }
.gate-row small { margin-top: 2px; color: var(--muted); font-size: 8px; line-height: 1.4; }
.decision-banner { margin-top: 13px; padding: 11px; border-radius: 11px; text-align: center; font-size: 11px; font-weight: 800; background: #ece9e2; }
.decision-banner.qualified { background: var(--green-soft); color: var(--green); }
.decision-banner.nurture { background: var(--gold-soft); color: #80601b; }
.decision-banner.hold { background: var(--red-soft); color: var(--red); }
.qualification-reason { margin: 8px 0 0; color: var(--muted); font-size: 9px; line-height: 1.5; text-align: center; }

.action-stack { display: grid; gap: 8px; }
.action-card { border: 1px solid var(--line); border-radius: 13px; padding: 13px; background: #fff; }
.action-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.action-card strong { font-size: 11px; }
.action-card p { margin: 6px 0 10px; color: var(--muted); font-size: 10px; line-height: 1.55; }
.blocked-note { margin-top: 11px; padding: 10px; border-radius: 10px; background: var(--red-soft); color: var(--red); font-size: 10px; line-height: 1.5; }

.approval-note { color: var(--red); font-size: 9px; margin: 9px 0 0; }
.approval-note.ready { padding: 9px 11px; border-radius: 10px; color: var(--green); background: var(--green-soft); line-height: 1.5; }

.module-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.module-form label span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 9px; font-weight: 700; }
.module-form input, .module-form select, .quick-entry input, .quick-entry select, .conversation-entry select, .conversation-entry textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; color: var(--ink); background: #fff; outline: 0;
}
.money-field { display: grid; grid-template-columns: 82px 1fr; gap: 6px; }
.quick-entry { display: grid; grid-template-columns: 100px minmax(120px, 1fr) 132px auto; gap: 7px; align-items: center; }
.compact-list { display: grid; gap: 8px; margin-top: 13px; }
.compact-list > div { display: grid; gap: 4px; padding: 10px 11px; border-radius: 10px; background: #f7f4ed; }
.compact-list strong { font-size: 10px; line-height: 1.45; }
.compact-list small { color: var(--muted); font-size: 8px; }
.contacts-panel { margin: 12px 0; }
.contact-verification-note { margin: 0 0 12px; color: var(--muted); font-size: 9px; line-height: 1.55; }
.contact-header-actions { display: flex; align-items: center; gap: 8px; }
.phone-call-alert { display: grid; gap: 4px; margin-top: 10px; padding: 12px 14px; border: 1px solid #d06a47; border-radius: 12px; background: #fff2e8; color: #74351f; }
.phone-call-alert strong { font-size: 14px; }
.phone-call-alert span { font-weight: 700; }
.phone-call-alert small { color: #8b5a46; }
.mailbox-account-section { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #f8f6f0; }
.mailbox-account-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mailbox-account-list { display: grid; gap: 8px; }
.mailbox-account-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.mailbox-account-card.active { border-color: #7da99a; background: #eef7f2; }
.mailbox-account-card > div:first-child { display: grid; gap: 2px; min-width: 0; }
.mailbox-account-card > div:last-child { display: flex; align-items: center; gap: 6px; }
.mailbox-account-card span, .mailbox-account-card small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mailbox-account-card small { color: var(--muted); }
.contact-list { display: grid; gap: 9px; }
.contact-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 13px; border: 1px solid var(--line); border-radius: 12px; background: #fbfaf6; }
.contact-card.primary { border-color: #bed3c9; background: #f3f8f5; }
.contact-main { min-width: 0; display: grid; gap: 4px; }
.contact-main > div { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.contact-main strong { font-size: 11px; }
.contact-main small, .contact-main p { margin: 0; color: var(--muted); font-size: 8px; line-height: 1.45; overflow-wrap: anywhere; }
.primary-tag { padding: 2px 6px; border-radius: 999px; background: var(--green-soft); color: var(--green); font-size: 7px; font-weight: 800; }
.contact-status { justify-self: start; padding: 3px 7px; border-radius: 999px; font-size: 7px; font-weight: 800; }
.contact-status.verified { background: var(--green-soft); color: var(--green); }
.contact-status.pending { background: #f5ead4; color: #8e6221; }
.contact-status.invalid { background: #f7dfd8; color: #a6452d; }
.contact-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; max-width: 270px; }
.button.tiny { min-height: 28px; padding: 6px 9px; font-size: 8px; }
.message-list { display: grid; gap: 8px; margin-bottom: 13px; max-height: 260px; overflow: auto; }
.message { max-width: 88%; padding: 10px 12px; border-radius: 12px; background: #f1eee7; }
.message.outgoing { margin-left: auto; background: var(--green-soft); }
.message span, .message small { color: var(--muted); font-size: 8px; }
.message p { margin: 4px 0; font-size: 10px; line-height: 1.55; white-space: pre-wrap; }
.conversation-entry { display: grid; gap: 8px; }
.conversation-entry textarea { resize: vertical; line-height: 1.55; }
.mailbox-inline { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #f7f4ed; }
.mailbox-inline.connected { border-color: #c4d8cd; background: #edf5f0; }
.mailbox-inline strong, .mailbox-inline small { display: block; }
.mailbox-inline strong { font-size: 10px; }
.mailbox-inline small { margin-top: 4px; color: var(--muted); font-size: 8px; line-height: 1.45; }

.timeline { display: grid; gap: 0; }
.timeline-item { display: grid; grid-template-columns: 14px 1fr; gap: 10px; position: relative; padding-bottom: 15px; }
.timeline-item::before { content: ""; position: absolute; left: 6px; top: 14px; bottom: 0; width: 1px; background: var(--line); }
.timeline-item:last-child::before { display: none; }
.timeline-dot { width: 13px; height: 13px; border-radius: 50%; background: var(--green); margin-top: 2px; }
.timeline-dot.blocked { background: var(--red); }
.timeline-item p { margin: 0; font-size: 10px; line-height: 1.5; }
.timeline-item time { display: block; color: var(--muted); font-size: 8px; margin-top: 3px; }

dialog { width: min(760px, calc(100% - 28px)); border: 0; border-radius: 22px; padding: 0; color: var(--ink); background: var(--card); box-shadow: 0 30px 100px rgba(20,31,37,.3); }
.import-dialog { width: min(1120px, calc(100% - 28px)); }
.mailbox-dialog { width: min(720px, calc(100% - 28px)); }
.email-preview-dialog { width: min(900px, calc(100% - 28px)); }
dialog::backdrop { background: rgba(20,31,37,.52); backdrop-filter: blur(3px); }
.lead-form { padding: 27px; }
.dialog-header { display: flex; justify-content: space-between; align-items: flex-start; }
.dialog-header h2 { margin: 0; font-size: 24px; }
.icon-button { border: 0; width: 34px; height: 34px; border-radius: 50%; background: #eeeae2; color: var(--ink); font-size: 20px; }
.form-note { color: var(--muted); font-size: 11px; line-height: 1.6; margin: 12px 0 20px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.form-grid label span { display: block; margin-bottom: 6px; font-size: 10px; font-weight: 750; }
.form-grid input, .form-grid textarea { width: 100%; border: 1px solid var(--line); border-radius: 11px; padding: 11px 12px; background: white; color: var(--ink); outline: 0; }
.form-grid input:focus, .form-grid textarea:focus { border-color: var(--navy-2); box-shadow: 0 0 0 3px rgba(41,73,90,.09); }
.form-grid textarea { resize: vertical; }
.span-2 { grid-column: span 2; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.email-recipient-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0 14px; }
.email-recipient-bar > div { padding: 11px 13px; border-radius: 11px; background: #f3f0e9; }
.email-recipient-bar span, .email-recipient-bar strong { display: block; }
.email-recipient-bar span { color: var(--muted); font-size: 8px; }
.email-recipient-bar strong { margin-top: 4px; font-size: 10px; overflow-wrap: anywhere; }
.email-preview-dialog form > label:not(.email-attachment-choice) { display: block; margin-top: 12px; }
.email-preview-dialog form > label:not(.email-attachment-choice) > span { display: block; margin-bottom: 6px; font-size: 10px; font-weight: 750; }
.email-preview-dialog input[type="text"], .email-preview-dialog input:not([type]), .email-preview-dialog textarea { width: 100%; border: 1px solid var(--line); border-radius: 11px; padding: 11px 12px; background: white; color: var(--ink); outline: 0; }
.email-preview-dialog textarea { resize: vertical; line-height: 1.6; }
.email-preview-dialog input:focus, .email-preview-dialog textarea:focus { border-color: var(--navy-2); box-shadow: 0 0 0 3px rgba(41,73,90,.09); }
.deliverability-panel { margin-top: 14px; padding: 14px; border: 1px solid #d7d1c5; border-radius: 14px; background: #faf8f3; }
.deliverability-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.deliverability-head strong { display: block; margin-top: 2px; font-size: 13px; }
.deliverability-score { min-width: 96px; padding: 8px 11px; border-radius: 999px; color: #fff; background: var(--green); font-size: 10px; font-weight: 850; text-align: center; }
.deliverability-score.medium { background: #a76c23; }
.deliverability-score.high { background: var(--red); }
.deliverability-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.deliverability-grid > div { min-width: 0; padding: 11px; border-radius: 11px; background: #fff; }
.deliverability-grid h3 { margin: 0 0 8px; font-size: 10px; }
.domain-checks, .content-checks { display: grid; gap: 6px; }
.deliverability-item { display: grid; grid-template-columns: 10px minmax(0, 1fr); gap: 7px; align-items: start; color: var(--muted); font-size: 8px; line-height: 1.4; }
.deliverability-item i { width: 8px; height: 8px; margin-top: 2px; border-radius: 50%; background: var(--green); }
.deliverability-item.warn i { background: #b9802e; }
.deliverability-item.fail i { background: var(--red); }
.deliverability-item strong { color: var(--ink); }
.deliverability-item small { display: block; margin-top: 1px; overflow-wrap: anywhere; color: var(--muted); font-size: 7.5px; }
.deliverability-note { margin: 10px 0 0; color: var(--muted); font-size: 8px; line-height: 1.5; }
.email-attachment-choice { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 11px; align-items: center; margin-top: 14px; padding: 13px 14px; border: 1px solid #bfd4c9; border-radius: 12px; background: var(--green-soft); }
.email-attachment-choice span strong, .email-attachment-choice span small { display: block; }
.email-attachment-choice span strong { font-size: 10px; color: var(--green); }
.email-attachment-choice span small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.email-attachment-choice a { color: var(--green); font-size: 9px; font-weight: 800; text-decoration: none; }
.send-schedule-panel { margin-top: 14px; padding: 13px; border: 1px solid #d8d1c5; border-radius: 13px; background: #f7f4ed; }
.send-mode-options { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.send-mode-options > label { display: flex; align-items: flex-start; gap: 9px; padding: 11px; border: 1px solid #ded8cd; border-radius: 10px; background: #fff; cursor: pointer; }
.send-mode-options input { margin-top: 2px; accent-color: var(--green); }
.send-mode-options strong, .send-mode-options small { display: block; }
.send-mode-options strong { font-size: 10px; }
.send-mode-options small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.schedule-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 11px; padding-top: 11px; border-top: 1px solid #ddd5c9; }
.schedule-fields label > span { display: block; margin-bottom: 6px; font-size: 9px; font-weight: 750; }
.schedule-fields select, .schedule-fields input { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px; color: var(--ink); background: #fff; font-size: 10px; }
.schedule-fields p { grid-column: 1 / -1; margin: 0; padding: 9px 10px; border-radius: 9px; color: var(--green); background: var(--green-soft); font-size: 8px; line-height: 1.5; }

@media (max-width: 680px) {
  .deliverability-grid { grid-template-columns: 1fr; }
  .send-mode-options, .schedule-fields { grid-template-columns: 1fr; }
}

.import-file-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: stretch; }
.file-picker { min-width: 0; display: flex; align-items: center; gap: 13px; padding: 9px; border: 1px dashed #b9c6cb; border-radius: 12px; background: #f7f7f2; }
.file-picker > span { min-width: 0; overflow: hidden; color: var(--muted); font-size: 10px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.file-picker .button { flex: 0 0 auto; }
.import-preview { display: grid; gap: 18px; margin-top: 20px; }
.import-summary { display: flex; justify-content: space-between; gap: 14px; padding: 12px 14px; border-radius: 12px; background: var(--green-soft); color: var(--green); }
.import-summary strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.import-summary span { font-size: 10px; }
.import-section-title { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 9px; }
.import-section-title strong { font-size: 12px; }
.import-section-title small { color: var(--muted); font-size: 9px; }
.mapping-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.mapping-grid label { min-width: 0; padding: 9px; border: 1px solid #e5dfd4; border-radius: 10px; background: #faf8f3; }
.mapping-grid label > span { display: block; margin-bottom: 6px; overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.mapping-grid select { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px; color: var(--ink); background: white; font-size: 10px; outline: 0; }
.table-scroll { max-height: 210px; overflow: auto; border: 1px solid var(--line); border-radius: 11px; background: white; }
.preview-table { width: max-content; min-width: 100%; border-collapse: collapse; font-size: 9px; }
.preview-table th, .preview-table td { max-width: 240px; padding: 8px 10px; border-right: 1px solid #eee9e0; border-bottom: 1px solid #eee9e0; overflow: hidden; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.preview-table th { position: sticky; top: 0; z-index: 1; color: var(--navy); background: #f3f0e9; font-weight: 800; }
.automation-choice { display: flex; align-items: flex-start; gap: 10px; padding: 14px; border: 1px solid #c9d8d0; border-radius: 12px; background: #f1f7f3; cursor: pointer; }
.automation-choice input { margin-top: 2px; accent-color: var(--green); }
.automation-choice strong, .automation-choice small { display: block; }
.automation-choice strong { font-size: 11px; }
.automation-choice small { margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.45; }
.security-note { margin: 14px 0 18px; padding: 14px 16px; border: 1px solid #e8cfaa; border-radius: 13px; background: #fff5e5; }
.security-note strong { color: #875f1d; font-size: 11px; }
.security-note p { margin: 6px 0; color: #735f3f; font-size: 10px; line-height: 1.55; }
.security-note a { color: var(--navy); font-size: 9px; font-weight: 750; }

.crm-dashboard-dialog { width: min(1180px, calc(100vw - 40px)); max-height: calc(100vh - 50px); padding: 24px; }
.approval-queue-dialog { width: min(1240px, calc(100vw - 40px)); }
.approval-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 14px; padding: 13px 15px; border: 1px solid #c9d8d0; border-radius: 13px; background: #f1f7f3; }
.approval-toolbar p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.approval-table td:nth-child(5) { min-width: 220px; max-width: 320px; white-space: normal; line-height: 1.45; }
.crm-summary-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 18px 0; }
.crm-summary-row > div { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #f7f4ed; }
.crm-summary-row strong, .crm-summary-row span { display: block; }
.crm-summary-row strong { color: var(--navy); font-size: 22px; }
.crm-summary-row span { margin-top: 4px; color: var(--muted); font-size: 10px; }
.crm-table-wrap { max-height: 58vh; overflow: auto; border: 1px solid var(--line); border-radius: 14px; }
.crm-table { width: 100%; border-collapse: collapse; background: white; }
.crm-table th { position: sticky; top: 0; z-index: 1; padding: 11px 12px; background: #f1ede4; color: var(--muted); text-align: left; font-size: 9px; }
.crm-table td { padding: 12px; border-top: 1px solid var(--line); font-size: 10px; vertical-align: middle; }
.crm-table td strong, .crm-table td small { display: block; }
.crm-table td strong { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.crm-table td small { max-width: 180px; margin-top: 4px; overflow: hidden; color: var(--muted); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.crm-stage-pill { display: inline-block; padding: 4px 7px; border-radius: 99px; background: var(--green-soft); color: var(--green); font-size: 9px; font-weight: 800; }
.mailbox-inline-actions { display: flex; align-items: center; gap: 8px; }

.toast-region { position: fixed; z-index: 60; right: 22px; bottom: 22px; display: grid; gap: 8px; pointer-events: none; }
.toast { width: min(380px, calc(100vw - 44px)); padding: 13px 15px; color: white; border-radius: 12px; background: var(--navy); box-shadow: var(--shadow); font-size: 11px; line-height: 1.55; animation: toast-in .2s ease-out; }
.toast.error { background: var(--red); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

.busy { position: relative; overflow: hidden; }
.busy::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: linear-gradient(90deg, transparent, rgba(255,255,255,.8), transparent); animation: busy 1s linear infinite; }
@keyframes busy { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

@media (max-width: 1120px) {
  .integration-strip { grid-template-columns: repeat(3, 1fr); }
  .hero { grid-template-columns: 1fr; }
  .hero-metrics { max-width: 520px; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .pipeline { overflow-x: auto; grid-template-columns: repeat(8, minmax(94px, 1fr)); padding-bottom: 6px; }
  .overview-grid, .contract-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .topbar { height: auto; min-height: 70px; padding: 12px 18px; }
  .brand small, .live-pill, #refreshButton { display: none; }
  main { width: min(100% - 24px, 1540px); padding-top: 18px; }
  .hero { padding: 28px 24px; }
  .workspace-grid { grid-template-columns: 1fr; }
  .lead-sidebar { position: static; min-height: auto; }
  .lead-list { max-height: 260px; }
  .panel-grid { grid-template-columns: 1fr; }
  .research-mode-grid, .outreach-grid { grid-template-columns: 1fr; }
  .integration-strip { grid-template-columns: repeat(2, 1fr); }
  .detail-title-row { display: grid; }
  .detail-actions { justify-content: flex-start; }
  .quick-entry { grid-template-columns: 1fr; }
  .mailbox-inline { align-items: stretch; flex-direction: column; }
  .crm-summary-row { grid-template-columns: 1fr 1fr; }
  .crm-table-wrap { max-height: 64vh; }
  .detail-tabs { display: flex; overflow-x: auto; top: 70px; }
  .detail-tab { min-width: 138px; }
  .mapping-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .contact-card { grid-template-columns: 1fr; }
  .contact-actions { justify-content: flex-start; max-width: none; }
}

@media (max-width: 540px) {
  .top-actions .button { padding: 9px 10px; font-size: 10px; }
  .brand strong { font-size: 12px; }
  .hero h1 { font-size: 29px; }
  .hero-metrics { grid-template-columns: 1fr 1fr; }
  .integration-strip, .summary-grid, .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .module-form { grid-template-columns: 1fr; }
  .signal-grid, .research-mode-grid { grid-template-columns: 1fr; }
  .research-mode-card { align-items: stretch; flex-direction: column; }
  .research-mode-card .button { width: 100%; }
  .integrations-panel, .detail-header, .pipeline-wrap, .detail-content { padding-left: 18px; padding-right: 18px; }
  .section-heading { align-items: flex-start; display: grid; }
  .mapping-grid, .import-file-row { grid-template-columns: 1fr; }
  .batch-status-head, .import-summary { align-items: flex-start; flex-direction: column; }
  .email-recipient-bar { grid-template-columns: 1fr; }
  .email-attachment-choice { grid-template-columns: auto 1fr; }
  .email-attachment-choice a { grid-column: 2; justify-self: start; }
}

.login-page { min-height: 100vh; }
.login-shell { width: min(1080px, calc(100% - 36px)); min-height: 100vh; margin: 0 auto; padding: 42px 0; display: grid; grid-template-columns: 1.15fr .85fr; align-items: stretch; }
.login-intro { min-height: 620px; padding: 42px; display: flex; flex-direction: column; justify-content: space-between; color: white; border-radius: 28px 0 0 28px; background: radial-gradient(circle at 80% 15%, rgba(214,126,91,.38), transparent 28%), linear-gradient(145deg, #1d3542, #315866); box-shadow: var(--shadow); }
.login-brand { color: white; }
.login-brand small { color: rgba(255,255,255,.65); }
.login-intro h1 { margin: 0; max-width: 640px; font-size: clamp(34px, 4vw, 54px); line-height: 1.14; letter-spacing: -.045em; }
.login-intro > div > p:last-child { max-width: 580px; margin: 20px 0 0; color: rgba(255,255,255,.68); line-height: 1.7; }
.login-card { min-height: 620px; padding: 52px 48px; display: grid; align-content: center; border: 1px solid var(--line); border-left: 0; border-radius: 0 28px 28px 0; background: var(--card); box-shadow: var(--shadow); }
.login-form { display: grid; gap: 16px; }
.login-form h2 { margin: 0; font-size: 30px; }
.login-form label { display: grid; gap: 7px; }
.login-form label > span { font-size: 11px; font-weight: 750; }
.login-form input { width: 100%; padding: 13px 14px; border: 1px solid var(--line); border-radius: 11px; outline: 0; color: var(--ink); background: white; }
.login-form input:focus { border-color: #819ca8; box-shadow: 0 0 0 3px rgba(41,73,90,.08); }
.login-form .button { margin-top: 6px; padding: 14px; }
.login-loading { color: var(--muted); text-align: center; }
.login-message { margin: 16px 0 0; padding: 11px 13px; color: var(--red); border: 1px solid #dfb6af; border-radius: 10px; background: var(--red-soft); font-size: 11px; }
.password-hint { margin: -7px 0 0; color: var(--muted); font-size: 9px; }

.access-dialog { width: min(780px, calc(100vw - 32px)); max-height: calc(100vh - 42px); padding: 24px; }
.access-current, .access-user-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px; background: #f8f6f0; }
.access-current { margin: 16px 0; border-color: #c4d8cd; background: #edf5f0; }
.access-current strong, .access-current span, .access-user-card strong, .access-user-card span, .access-user-card small { display: block; }
.access-current span, .access-user-card span, .access-user-card small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.access-users { display: grid; gap: 8px; }
.access-user-card.disabled { opacity: .62; }
.access-user-card > div:last-child { display: flex; align-items: center; gap: 8px; }
.access-create-form { margin-top: 18px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #f8f6f0; }
.access-create-form h3 { margin: 0 0 13px; font-size: 14px; }
.toggle-label { display: flex !important; align-items: center; gap: 8px; min-height: 42px; }
.toggle-label input { width: auto; }

@media (max-width: 760px) {
  .login-shell { grid-template-columns: 1fr; padding: 18px 0; }
  .login-intro { min-height: 270px; padding: 28px; border-radius: 24px 24px 0 0; }
  .login-intro h1 { font-size: 31px; }
  .login-card { min-height: 430px; padding: 34px 24px; border-left: 1px solid var(--line); border-top: 0; border-radius: 0 0 24px 24px; }
  .access-current, .access-user-card { align-items: flex-start; flex-direction: column; }
}
