/* BizAgent · JAK Technologies — enterprise theme (royal blue + white) */
:root {
  --royal: #2346c6;
  --royal-600: #1d3aa8;
  --royal-700: #172f8a;
  --royal-900: #0e1f5e;
  --royal-50: #eef2fd;
  --royal-100: #dfe6fb;
  --ink: #0f1b3d;
  --muted: #5b6785;
  --line: #e4e9f4;
  --bg: #f5f7fc;
  --white: #fff;
  --green: #12805c; --green-bg: #e6f6ef;
  --amber: #a35c00; --amber-bg: #fff4e0;
  --red: #b42318; --red-bg: #fdecea;
  --gray-bg: #eef0f5;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 27, 61, .04), 0 4px 16px rgba(15, 27, 61, .06);
  --shadow-lg: 0 12px 40px rgba(14, 31, 94, .18);
  font-family: "Segoe UI", "Inter", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
.sprite { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.icon.sm { width: 15px; height: 15px; }
h1, h2, h3 { letter-spacing: -.01em; margin: 0; }
a { color: var(--royal); text-decoration: none; font-weight: 600; }
a:hover { text-decoration: underline; }
.muted, .meta { color: var(--muted); }
.small { font-size: 12.5px; }
.meta { font-size: 13px; }
.block { display: block; margin-top: 3px; }

/* ---------- Buttons & inputs ---------- */
button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font: inherit; font-weight: 600; font-size: 13.5px; color: var(--royal-700);
  background: var(--white); border: 1px solid var(--line); border-radius: 9px;
  padding: 8px 14px; cursor: pointer; transition: background .15s, border-color .15s, box-shadow .15s, color .15s; white-space: nowrap;
}
button:hover:not(:disabled) { border-color: var(--royal-100); background: var(--royal-50); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid rgba(35, 70, 198, .25); outline-offset: 1px; }
button.primary { background: var(--royal); border-color: var(--royal); color: var(--white); box-shadow: 0 2px 6px rgba(35, 70, 198, .25); }
button.primary:hover:not(:disabled) { background: var(--royal-600); border-color: var(--royal-600); }
button.ghost-light { background: rgba(255, 255, 255, .12); color: var(--white); border-color: rgba(255, 255, 255, .35); }
button.ghost-light:hover:not(:disabled) { background: rgba(255, 255, 255, .22); }
button:disabled { opacity: .5; cursor: not-allowed; }
.block-btn { width: 100%; padding: 11px; }
.icon-btn { padding: 8px; }
.danger-link { color: var(--red); width: 100%; justify-content: flex-start; border-color: transparent; }
.danger-link:hover:not(:disabled) { background: var(--red-bg); border-color: transparent; }

input, select, textarea {
  font: inherit; color: var(--ink); background: var(--white);
  border: 1px solid #d6ddec; border-radius: 9px; padding: 9px 11px; min-width: 0; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--royal); box-shadow: 0 0 0 3px rgba(35, 70, 198, .12); outline: none; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--royal); flex: none; }
textarea { resize: vertical; line-height: 1.5; }
label { display: grid; gap: 6px; font-size: 12.5px; font-weight: 600; color: #3a4666; }
label.check, label.inline { display: flex; align-items: center; gap: 9px; font-weight: 500; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; display: flex; flex-wrap: wrap; gap: 14px; margin: 0; }
fieldset legend { font-size: 12.5px; font-weight: 600; padding: 0 6px; color: #3a4666; }
.weights label { flex: 1 1 120px; }
.field-title { font-weight: 600; font-size: 12.5px; margin: 0 0 6px; color: #3a4666; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-brand {
  background: radial-gradient(circle at 15% 20%, rgba(255,255,255,.12), transparent 45%), linear-gradient(150deg, var(--royal) 0%, var(--royal-700) 55%, var(--royal-900) 100%);
  color: var(--white); padding: 64px 72px; display: flex; flex-direction: column; justify-content: center; gap: 18px; position: relative; overflow: hidden;
}
.login-brand::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 380px; height: 380px; border-radius: 50%; border: 60px solid rgba(255,255,255,.06); }
.login-brand h1 { font-size: 44px; font-weight: 800; letter-spacing: -.03em; }
.login-tagline { font-size: 18px; opacity: .9; max-width: 420px; margin: 0; line-height: 1.5; }
.login-points { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 14px; }
.login-points li { display: flex; gap: 12px; align-items: center; font-size: 15px; opacity: .95; }
.login-points .icon { width: 34px; height: 34px; padding: 8px; border-radius: 9px; background: rgba(255,255,255,.14); }
.login-copy { position: absolute; bottom: 28px; font-size: 12px; opacity: .6; margin: 0; }
.login-panel { display: grid; place-items: center; background: var(--white); padding: 40px 24px; }
.login-form { width: min(380px, 100%); display: grid; gap: 16px; }
.login-form h2 { font-size: 26px; }
.login-form p { margin: 0; }
.input-icon { position: relative; display: block; }
.input-icon .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #8a95b0; }
.input-icon input { padding-left: 40px; height: 44px; }
.form-status { min-height: 0; margin: 0; font-size: 13px; color: var(--royal-700); }
.form-status:empty { display: none; }
#login-status:not(:empty) { color: var(--red); background: var(--red-bg); padding: 9px 12px; border-radius: 8px; }

/* ---------- Brand mark ---------- */
.brand-mark { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(140deg, #fff 0%, #dfe6fb 100%); color: var(--royal); font-weight: 900; font-size: 18px; box-shadow: 0 4px 12px rgba(0,0,0,.18); flex: none; }
.brand-mark.lg { width: 56px; height: 56px; font-size: 28px; border-radius: 14px; }
.brand-mark .brand-glyph { width: 66%; height: 66%; display: block; }
.brand-mark.sm { width: 28px; height: 28px; font-size: 14px; border-radius: 8px; background: var(--royal); color: var(--white); box-shadow: none; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 252px 1fr; height: 100vh; height: 100dvh; overflow: hidden; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--royal-700) 0%, var(--royal-900) 100%); color: #c9d4f7; padding: 18px 14px; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 20px; border-bottom: 1px solid rgba(255,255,255,.1); margin-bottom: 8px; }
.brand strong { display: block; color: var(--white); font-size: 17px; letter-spacing: .02em; }
.brand small { display: block; font-size: 11.5px; opacity: .75; }
.sidebar nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.nav-group { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; font-weight: 700; color: #8fa1dd; margin: 16px 10px 6px; }
.nav-item { justify-content: flex-start; gap: 12px; width: 100%; padding: 9px 12px; border: 0; border-radius: 9px; background: transparent; color: #d5ddf9; font-weight: 500; position: relative; }
.nav-item:hover:not(:disabled) { background: rgba(255,255,255,.08); color: var(--white); border: 0; }
.nav-item[aria-pressed="true"], .nav-item[aria-pressed="true"]:hover:not(:disabled) { background: var(--white); color: var(--royal-700); font-weight: 700; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.nav-item[aria-pressed="true"] .icon { color: var(--royal); }
.nav-badge { margin-left: auto; background: #ffb020; color: #3d2600; font-size: 11px; font-weight: 800; border-radius: 10px; padding: 1px 7px; }
.sidebar-foot { display: flex; align-items: center; gap: 9px; font-size: 12px; padding: 12px 10px 4px; border-top: 1px solid rgba(255,255,255,.1); }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #8fa1dd; box-shadow: 0 0 0 3px rgba(255,255,255,.08); }
.status-dot.live { background: #34d399; box-shadow: 0 0 0 3px rgba(52,211,153,.25); }
.status-dot.off { background: #fbbf24; }
.backdrop { display: none; }

.main-area { display: flex; flex-direction: column; min-width: 0; height: 100vh; height: 100dvh; overflow: hidden; }
.topbar {
  flex: none; position: relative; z-index: 20; display: flex; align-items: center; gap: 16px; min-height: 68px;
  background: var(--white); border-bottom: 1px solid var(--line); box-shadow: 0 1px 2px rgba(14, 31, 94, .04); padding: 10px 32px;
}
.menu-toggle { display: none; }
.page-heading { flex: 1; min-width: 0; }
.crumb { margin: 0 0 2px; font-size: 12px; color: var(--muted); }
.crumb span { opacity: .6; }
.crumb #page-crumb { opacity: 1; color: var(--royal); font-weight: 600; }
.page-heading h1 { font-size: 21px; font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.product-switch { display: flex; align-items: center; gap: 0; position: relative; }
.product-switch .icon { position: absolute; left: 11px; color: var(--royal); pointer-events: none; }
.product-switch select { height: 42px; padding-left: 36px; min-width: 210px; font-weight: 600; background-color: var(--royal-50); border-color: var(--royal-100); color: var(--royal-700); border-radius: 10px; }

.user-menu { position: relative; margin: 0; padding: 0; border: 0; font-size: inherit; }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: 10px; height: 42px; box-sizing: border-box; cursor: pointer; padding: 0 12px 0 4px; border-radius: 10px; border: 1px solid var(--line); background: var(--white); color: var(--ink); }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu[open] summary, .user-menu summary:hover { border-color: var(--royal-100); background: var(--royal-50); }
.avatar { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--royal); color: var(--white); font-weight: 700; font-size: 13px; }
.user-meta { display: grid; line-height: 1.2; }
.user-meta strong { font-size: 13px; }
.user-meta small { font-size: 11.5px; color: var(--muted); text-transform: capitalize; }
.user-dropdown { position: absolute; right: 0; top: calc(100% + 8px); width: 300px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 14px; display: grid; gap: 10px; }
.user-dropdown p { margin: 0; overflow-wrap: anywhere; }
.stack { display: grid; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stack strong { display: flex; align-items: center; gap: 6px; font-size: 13px; }

.content { flex: 1; min-height: 0; overflow-y: auto; padding: 24px 32px 32px; width: 100%; scroll-behavior: smooth; }
.content > section { display: grid; gap: 20px; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- Panels & cards ---------- */
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; min-width: 0; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.panel-head h3 { display: flex; align-items: center; gap: 9px; font-size: 15.5px; font-weight: 700; }
.panel-head h3 .icon { color: var(--royal); width: 20px; height: 20px; padding: 0; }
.panel-head p { margin: 5px 0 0; }
.toolbar { display: flex; gap: 8px; align-items: center; }
.toolbar select { width: auto; min-width: 170px; }
.list { display: grid; gap: 10px; }
.list > p { margin: 0; color: var(--muted); }
.list.compact { gap: 6px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid.boxed { background: #fafbff; border: 1px solid var(--royal-100); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.form-actions, .review-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.review-actions { margin-top: 10px; }
.review-actions input { flex: 1 1 240px; width: auto; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.card { background: var(--white); border: 1px solid var(--line); border-radius: 11px; padding: 16px 18px; transition: border-color .15s, box-shadow .15s; min-width: 0; }
.card:hover { border-color: var(--royal-100); box-shadow: 0 4px 14px rgba(35, 70, 198, .07); }
.card p { margin: 6px 0; line-height: 1.55; overflow-wrap: anywhere; }
.card > input, .card > textarea { margin: 6px 0; }
.card pre, #review-text { white-space: pre-wrap; overflow-wrap: anywhere; background: #f7f9fe; border: 1px solid var(--line); padding: 12px 14px; border-radius: 9px; max-height: 300px; overflow: auto; font: 13px/1.6 "Segoe UI", system-ui, sans-serif; margin: 8px 0; }
#review-text { max-height: 440px; }
.document-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); }
.document-row:hover { border-color: var(--royal-100); }
.document-row > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.card .document-row { border: 0; padding: 0; background: none; }
.card .section-heading strong { font-size: 14.5px; }
details { font-size: 13px; margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
summary { cursor: pointer; color: var(--royal-700); font-weight: 600; }
.lead ul { margin: 6px 0; padding-left: 20px; font-size: 13.5px; line-height: 1.6; }
.lead > strong, .card > strong { display: block; margin-top: 10px; font-size: 13px; }
.score { font-weight: 800; color: var(--royal); background: var(--royal-50); border-radius: 20px; padding: 4px 11px; font-size: 12.5px; white-space: nowrap; }
.issues { color: var(--amber); background: var(--amber-bg); border-radius: 9px; padding: 10px 14px 10px 30px; margin: 6px 0 10px; }
.enrollments { border-top: 1px dashed var(--line); margin-top: 12px; padding-top: 10px; display: grid; gap: 6px; }

/* ---------- Pills ---------- */
.pill { display: inline-flex; align-items: center; margin-left: 8px; padding: 2px 10px; border-radius: 20px; background: var(--royal-50); color: var(--royal-700); font-size: 11.5px; font-weight: 700; text-transform: capitalize; vertical-align: 1px; white-space: nowrap; }
.pill.approved, .pill.active, .pill.accepted { background: var(--green-bg); color: var(--green); }
.pill.draft, .pill.in_review, .pill.pending { background: var(--amber-bg); color: var(--amber); }
.pill.archived { background: var(--gray-bg); color: var(--muted); }
.pill.rejected { background: var(--red-bg); color: var(--red); }
.pill.completed { background: var(--green-bg); color: var(--green); margin-left: 0; }
.pill.queued, .pill.running { background: var(--royal-50); color: var(--royal-700); margin-left: 0; }
.pill.failed { background: var(--red-bg); color: var(--red); margin-left: 0; }
.pill.cancelled { background: var(--gray-bg); color: var(--muted); margin-left: 0; }

.pipeline-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.summary-item { padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--white); border-left: 4px solid var(--royal-100); }
.summary-item strong { display: block; font-size: 20px; font-weight: 800; color: var(--ink); }
.summary-item span { font-size: 12px; color: var(--muted); font-weight: 600; }
.summary-item.pending { border-left-color: var(--amber); }
.summary-item.running { border-left-color: var(--royal); }
.summary-item.accepted, .summary-item.active { border-left-color: var(--green); }

.journey { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin: 14px 0 10px; padding: 0; }
.journey-step { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; position: relative; padding-right: 12px; min-width: 0; }
.journey-step:not(:last-child)::after { content: ""; position: absolute; top: 13px; left: 36px; right: 8px; height: 2px; background: var(--line); }
.journey-step.done:not(:last-child)::after { background: var(--royal); }
.journey-step > div { min-width: 0; }
.journey-step strong { display: block; font-size: 12.5px; }
.journey-step small { display: block; font-size: 11.5px; color: var(--muted); overflow-wrap: anywhere; }
.journey-dot { flex: none; position: relative; z-index: 1; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--white); border: 2px solid var(--line); color: var(--muted); }
.journey-dot .icon { width: 14px; height: 14px; }
.journey-step.done .journey-dot { background: var(--royal); border-color: var(--royal); color: var(--white); }
.journey-step.current .journey-dot { border-color: var(--royal); color: var(--royal); box-shadow: 0 0 0 4px var(--royal-50); }
.journey-step.current strong { color: var(--royal-700); }
.journey-step.stopped .journey-dot { background: var(--red-bg); border-color: var(--red); color: var(--red); }

.next-step { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; margin: 4px 0 10px; border-radius: 10px; font-size: 13.5px; font-weight: 500; background: var(--royal-50); color: var(--royal-900); border: 1px solid var(--royal-100); }
.next-step .icon { flex: none; margin-top: 2px; color: var(--royal); }
.next-step.ready, .next-step.enrolled { background: var(--green-bg); color: var(--green); border-color: transparent; }
.next-step.ready .icon, .next-step.enrolled .icon { color: var(--green); }
.next-step.review, .next-step.needs_research { background: var(--amber-bg); color: var(--amber); border-color: transparent; }
.next-step.review .icon, .next-step.needs_research .icon { color: var(--amber); }
.next-step.no_email, .next-step.rejected { background: var(--red-bg); color: var(--red); border-color: transparent; }
.next-step.no_email .icon, .next-step.rejected .icon { color: var(--red); }
.next-step.searching .icon { animation: spin 2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: grid; gap: 10px; max-width: min(420px, calc(100vw - 40px)); }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: 10px; background: var(--royal-900); color: var(--white); box-shadow: 0 12px 32px rgba(14,31,94,.3); font-size: 13.5px; animation: toast-in .2s ease-out; }
.toast .icon { flex: none; margin-top: 2px; }
.toast.success .icon { color: #7ee2a8; }
.toast.error { background: #8a1f1f; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Dashboard ---------- */
.hero {
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  background: radial-gradient(circle at 90% 10%, rgba(255,255,255,.16), transparent 40%), linear-gradient(120deg, var(--royal) 0%, var(--royal-700) 100%);
  color: var(--white); border-radius: 16px; padding: 26px 30px; box-shadow: 0 10px 30px rgba(35, 70, 198, .25);
}
.hero h2 { font-size: 24px; }
.hero p { margin: 6px 0 0; opacity: .85; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero .primary { background: var(--white); color: var(--royal-700); border-color: var(--white); }
.hero .primary:hover:not(:disabled) { background: var(--royal-50); color: var(--royal-700); }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.tile { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 14px; align-items: center; text-align: left; padding: 18px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--ink); white-space: normal; }
.tile:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(35, 70, 198, .12); background: var(--white); }
.tile .tile-icon { grid-row: 1 / 3; width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center; background: var(--royal-50); color: var(--royal); }
.tile .tile-icon .icon { width: 22px; height: 22px; }
.tile strong { font-size: 26px; font-weight: 800; line-height: 1.1; }
.tile span:last-child { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.timeline { display: grid; }
.timeline-item { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: center; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.timeline-item:last-child { border-bottom: 0; }
.timeline-item .dot { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--royal-50); color: var(--royal); }
.timeline-item p { margin: 0; font-weight: 600; font-size: 13.5px; }
.timeline-item small { color: var(--muted); font-size: 12px; }
.timeline-item time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.empty { text-align: center; padding: 28px 10px; color: var(--muted); }
.empty .icon { width: 34px; height: 34px; color: #a9b5d6; display: block; margin: 0 auto 8px; }

/* ---------- Assistant ---------- */
.chat-panel { display: flex; flex-direction: column; min-height: calc(100vh - 230px); }
#messages { flex: 1; display: flex; flex-direction: column; gap: 14px; padding: 8px 2px 18px; overflow-y: auto; }
.message { max-width: 82%; border-radius: 14px; padding: 13px 16px; background: #f6f8fe; border: 1px solid var(--line); }
.message.user { align-self: flex-end; background: var(--royal); border-color: var(--royal); color: var(--white); border-bottom-right-radius: 4px; }
.message.assistant { border-bottom-left-radius: 4px; }
.message > span { font-size: 10.5px; font-weight: 800; letter-spacing: .1em; opacity: .65; }
.message > p { margin: 6px 0 0; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.message details p { white-space: pre-wrap; color: #3a4666; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.suggestions button { border-radius: 20px; background: var(--royal-50); border-color: var(--royal-100); }
.composer { display: flex; gap: 10px; align-items: stretch; border: 1px solid #d6ddec; border-radius: 12px; padding: 8px; background: var(--white); }
.composer:focus-within { border-color: var(--royal); box-shadow: 0 0 0 3px rgba(35, 70, 198, .12); }
.composer textarea { border: 0; box-shadow: none; flex: 1; }
.composer textarea:focus { box-shadow: none; }

/* ---------- Campaign steps ---------- */
.step-row { display: grid; grid-template-columns: 200px 1fr auto; gap: 12px; align-items: start; margin: 0 0 10px; padding: 12px; background: var(--white); border: 1px solid var(--line); border-radius: 10px; }
#add-step { margin-top: 2px; }

/* ---------- Settings ---------- */
.status-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.status-list li { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 9px; background: #f7f9fe; font-size: 13px; }
.status-list li.ok { background: var(--green-bg); color: #0b5e43; }
.status-list li.missing { background: var(--amber-bg); color: #7a4500; }
.switch { display: grid; grid-template-columns: 42px 1fr; gap: 12px; align-items: center; cursor: pointer; font-weight: 500; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .slider { width: 42px; height: 24px; border-radius: 20px; background: #cfd6e6; position: relative; transition: background .2s; }
.switch .slider::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--white); box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked + .slider { background: var(--royal); }
.switch input:checked + .slider::after { transform: translateX(18px); }
.switch input:focus-visible + .slider { outline: 3px solid rgba(35, 70, 198, .25); }
.switch strong { display: block; font-size: 13.5px; color: var(--ink); }
.switch small { display: block; color: var(--muted); font-weight: 400; margin-top: 2px; }
#policies select, #users select { width: auto; min-width: 110px; }
#users .document-row { flex-wrap: wrap; }

/* ---------- Footer ---------- */
.site-footer { flex: none; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; padding: 9px 32px; border-top: 1px solid var(--line); background: var(--white); font-size: 12.5px; color: var(--muted); }
.footer-brand { display: flex; align-items: center; gap: 10px; }
.footer-brand strong { color: var(--ink); font-size: 13px; }
.footer-brand small { margin-left: 6px; }
.footer-brand .brand-mark.sm { width: 24px; height: 24px; font-size: 12px; border-radius: 6px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 18px; }
.footer-links span { display: inline-flex; align-items: center; gap: 6px; }
.footer-links .icon { color: var(--royal); }
.footer-copy { margin: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) { .settings-grid { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: 262px; transform: translateX(-100%); transition: transform .25s; box-shadow: var(--shadow-lg); }
  body.menu-open .sidebar { transform: none; }
  body.menu-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(14, 31, 94, .35); z-index: 25; }
  .menu-toggle { display: inline-flex; }
  .topbar, .content, .site-footer { padding-left: 18px; padding-right: 18px; }
  .user-meta, .product-switch .icon { display: none; }
  .product-switch select { padding-left: 11px; min-width: 0; max-width: 170px; }
  .login { grid-template-columns: 1fr; }
  .login-brand { padding: 40px 28px 32px; }
  .login-copy { position: static; }
}
@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .step-row { grid-template-columns: 1fr; }
  .page-heading h1 { font-size: 18px; }
  .crumb { display: none; }
  .message { max-width: 95%; }
  .panel-head { flex-direction: column; }
  .topbar { flex-wrap: wrap; }
  .topbar-actions { order: 3; width: 100%; justify-content: space-between; }
  .product-switch, .product-switch select { flex: 1; min-width: 0; }
  #stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .pipeline-summary, .journey { grid-template-columns: 1fr 1fr; row-gap: 14px; }
  .journey-step::after { display: none; }
  .tile { grid-template-columns: 1fr; padding: 14px; row-gap: 8px; }
  .tile .tile-icon { grid-row: auto; width: 36px; height: 36px; }
}

/* ---------- Campaign AI assistant ---------- */
.hint { display: block; font-weight: 400; font-size: 12px; color: var(--muted); line-height: 1.4; }
.check-field { display: grid; gap: 4px; align-content: center; }
.check-field .hint { padding-left: 25px; }
.section-divider { margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--royal-100); font-size: 13.5px; color: var(--royal-700); }
.ai-helper { background: linear-gradient(135deg, #ffffff 0%, var(--royal-50) 100%); border: 1px solid var(--royal-100); border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 10px; }
.ai-helper-head { display: flex; gap: 12px; align-items: flex-start; }
.ai-helper-head p { margin: 2px 0 0; }
.ai-badge { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--royal); color: var(--white); flex: none; box-shadow: 0 4px 12px rgba(35, 70, 198, .3); }
.ai-helper .field-title { margin: 4px 0 0; }
.ai-ask { display: flex; gap: 10px; }
.ai-ask input { flex: 1; }
.ai-ask button { white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { border-radius: 20px; background: var(--white); border-color: var(--royal-100); font-size: 12.5px; font-weight: 500; padding: 5px 12px; }
.plan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.plan-grid:empty { display: none; }
.plan-card { display: flex; flex-direction: column; gap: 8px; background: var(--white); border: 1px solid var(--line); border-radius: 10px; padding: 14px; transition: border-color .15s, box-shadow .15s; }
.plan-card:hover { border-color: var(--royal-100); box-shadow: 0 6px 18px rgba(35, 70, 198, .08); }
.plan-card.selected { border-color: var(--royal); box-shadow: 0 0 0 3px var(--royal-50); }
.plan-card h4 { margin: 0; font-size: 14.5px; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.plan-card h4 .icon { color: var(--royal); }
.plan-card .best-for { margin: 0; font-size: 12.5px; color: var(--royal-700); font-weight: 600; }
.plan-card .why { margin: 0; font-size: 13px; color: #3a4666; line-height: 1.45; }
.plan-card ol { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--muted); display: grid; gap: 3px; }
.plan-card .plan-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.plan-card .plan-meta span { font-size: 11.5px; font-weight: 600; color: var(--royal-700); background: var(--royal-50); border-radius: 20px; padding: 2px 9px; }
.plan-card button { margin-top: auto; }
.plan-skeleton { height: 210px; border-radius: 10px; background: linear-gradient(90deg, var(--royal-50) 0%, #fff 50%, var(--royal-50) 100%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (max-width: 900px) { .plan-grid { grid-template-columns: 1fr; } .ai-ask { flex-direction: column; } }
/* ---------- In-app confirmation dialog ---------- */
button.danger { background: #b42318; border-color: #b42318; color: var(--white); box-shadow: 0 2px 6px rgba(180, 35, 24, .25); }
button.danger:hover:not(:disabled) { background: #912018; border-color: #912018; }
.app-dialog { width: min(460px, calc(100vw - 32px)); border: 1px solid var(--royal-100); border-radius: 14px; padding: 22px 24px 20px; color: var(--ink); box-shadow: 0 24px 64px rgba(14, 31, 94, .28); animation: dialog-in .16s ease-out; }
.app-dialog::backdrop { background: rgba(14, 31, 94, .5); }
.app-dialog-head { display: flex; align-items: center; gap: 12px; }
.app-dialog-head h3 { margin: 0; font-size: 17px; }
.app-dialog-icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--royal-50); color: var(--royal); }
.app-dialog-icon.danger { background: #fdecea; color: #b42318; }
.app-dialog p { margin: 14px 0 20px; font-size: 14px; line-height: 1.55; color: #3a4666; }
.app-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
/* ---------- Discovery workspace: tabs, filters, master-detail ---------- */
.view-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: -4px; }
.view-tabs [role=tab] { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: 10px 14px 11px; color: var(--muted); font-weight: 600; gap: 8px; margin-bottom: -1px; }
.view-tabs [role=tab]:hover:not(:disabled) { background: none; color: var(--royal-700); border-color: transparent; border-bottom-color: var(--royal-100); }
.view-tabs [role=tab][aria-selected=true] { color: var(--royal-700); border-bottom-color: var(--royal); }
.view-tabs [role=tab][aria-selected=true] .icon { color: var(--royal); }
.view-tabs [data-tab=new] { margin-left: auto; color: var(--royal); }
.tab-count { font-size: 11px; font-weight: 700; background: var(--gray-bg); color: var(--muted); border-radius: 10px; padding: 1px 7px; }
.tab-count:empty { display: none; }
.tab-count.alert { background: var(--amber-bg); color: var(--amber); }
.tab-panel { display: grid; gap: 16px; }
.tab-panel[hidden] { display: none; }

#lead-summary { margin-bottom: 0; }
button.summary-item { display: flex; align-items: center; justify-content: space-between; text-align: left; width: 100%; font-weight: 400; color: inherit; border-left-width: 4px; }
button.summary-item:hover:not(:disabled) { background: var(--white); box-shadow: 0 4px 14px rgba(35, 70, 198, .08); }
button.summary-item > .icon { width: 22px; height: 22px; color: var(--royal-100); }
button.summary-item.selected { background: var(--royal-50); box-shadow: 0 0 0 2px var(--royal-100) inset; }
button.summary-item.selected > .icon { color: var(--royal); }

.filter-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; }
.filter-bar select, .filter-bar input { height: 38px; padding-top: 0; padding-bottom: 0; }
.search-field { position: relative; flex: 1 1 240px; min-width: 200px; }
.search-field .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-field input { padding-left: 36px; }
.filter { display: grid; gap: 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.filter select { width: auto; min-width: 128px; font-size: 13px; text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--ink); }
.filter-actions { display: flex; gap: 8px; margin-left: auto; }
.filter-actions button { height: 38px; }
.link-btn { border-color: transparent; background: none; color: var(--muted); }
.link-btn:hover:not(:disabled) { color: var(--royal-700); background: var(--royal-50); border-color: transparent; }

.master-detail { display: grid; grid-template-columns: minmax(300px, 400px) 1fr; gap: 16px; align-items: start; }
.lead-list-panel, .lead-detail { position: sticky; top: 0; max-height: calc(100dvh - 210px); min-height: 360px; overflow-y: auto; }
.lead-list-panel { padding: 0; }
.lead-list-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 10px 16px; background: var(--white); border-bottom: 1px solid var(--line); font-size: 13px; }
.lead-list-head .icon-btn { padding: 6px; border-color: transparent; }
.lead-rows { display: grid; }
.lead-rows > .empty, .lead-rows > p { padding: 24px 16px; }
.lead-rows > button.primary { margin: 0 16px 16px; }
.lead-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; text-align: left; padding: 11px 16px; border: 0; border-bottom: 1px solid var(--line); border-left: 3px solid transparent; border-radius: 0; background: var(--white); font-weight: 400; color: var(--ink); }
.lead-row:hover:not(:disabled) { background: #f8faff; border-color: transparent; border-bottom-color: var(--line); }
.lead-row.selected, .lead-row.selected:hover:not(:disabled) { background: var(--royal-50); border-left-color: var(--royal); }
.lead-row-main { display: grid; min-width: 0; }
.lead-row-main strong { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lead-row-main small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lead-row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex: none; }
.lead-row-side .pill { margin-left: 0; font-size: 10.5px; padding: 1px 8px; }
.score-badge { min-width: 34px; text-align: center; font-weight: 800; font-size: 12.5px; color: var(--royal-700); background: var(--white); border: 1px solid var(--royal-100); border-radius: 7px; padding: 1px 6px; }
.lead-detail { padding: 0; }
.lead-detail > .card { border: 0; border-radius: 0; box-shadow: none; padding: 20px 22px; }
.lead-detail > .card:hover { box-shadow: none; }
.lead-detail > .card .section-heading { position: sticky; top: 0; z-index: 1; background: var(--white); margin: -20px -22px 0; padding: 16px 22px 12px; border-bottom: 1px solid var(--line); }
.lead-detail > .empty { padding: 60px 20px; }

@media (max-width: 1100px) {
  .master-detail { grid-template-columns: 1fr; }
  .lead-list-panel { position: static; max-height: 340px; min-height: 0; }
  .lead-detail { position: static; max-height: none; min-height: 0; }
}
@media (max-width: 640px) {
  .view-tabs { overflow-x: auto; }
  .view-tabs [data-tab=new] { margin-left: 0; }
  .filter, .filter select, .filter-actions { flex: 1 1 45%; }
  .filter-actions { margin-left: 0; }
}.filter select { max-width: 190px; }
.filter select#lead-run { max-width: 220px; }
.site-footer { flex-wrap: nowrap; white-space: nowrap; }
.footer-copy { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1280px) { .footer-links { display: none; } }
@media (max-width: 1200px) { .search-field { flex-basis: 100%; } }
@media (max-width: 640px) { .footer-brand small { display: none; } }.footer-links { flex-wrap: nowrap; gap: 16px; }
.filter-bar { align-items: center; }
.filter select, .filter select#lead-run { min-width: 0; max-width: 175px; }
.head-actions { display: flex; gap: 2px; }
.head-actions .icon-btn { padding: 6px; border-color: transparent; color: var(--muted); }
.head-actions .icon-btn:hover:not(:disabled) { color: var(--royal); }.filter select, .filter select#lead-run { max-width: 150px; }
.search-field { flex: 1 1 200px; min-width: 180px; }
@media (max-width: 1440px) { .footer-links { display: none; } }

/* ---------- Full-height lead pipeline: page fixed, list + detail scroll internally ---------- */
.lead-body > strong { display: block; margin-top: 10px; font-size: 13px; }
.lead-body ul { margin: 6px 0; padding-left: 20px; font-size: 13.5px; line-height: 1.6; }
.lead-detail > .card.lead { display: flex; flex-direction: column; padding: 0; }
.lead-detail > .card.lead > .section-heading { position: static; margin: 0; flex: none; padding: 16px 22px 12px; }
.lead-detail > .card.lead > .lead-body { padding: 16px 22px 18px; }
.lead-detail > .card.lead > .review-actions { flex: none; margin: 0; padding: 12px 22px; border-top: 1px solid var(--line); background: #f8faff; }
@media (min-width: 1101px) {
  .content.fit { overflow: hidden; display: flex; flex-direction: column; padding-bottom: 16px; }
  .content.fit > #discovery-view { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 16px; }
  .content.fit > #discovery-view > .view-tabs { flex: none; }
  .content.fit [data-panel=leads] { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 14px; }
  .content.fit [data-panel=leads] > :not(.master-detail) { flex: none; }
  .content.fit .master-detail { flex: 1; min-height: 0; align-items: stretch; grid-template-rows: minmax(0, 1fr); }
  .content.fit .lead-list-panel, .content.fit .lead-detail { position: static; height: 100%; max-height: none; min-height: 0; }
  .content.fit .lead-list-panel { display: flex; flex-direction: column; overflow: hidden; }
  .content.fit .lead-list-panel > .lead-list-head { flex: none; position: static; }
  .content.fit .lead-list-panel > .lead-rows { flex: 1; min-height: 0; overflow-y: auto; align-content: start; }
  .content.fit .lead-detail { overflow: hidden; display: flex; flex-direction: column; }
  .content.fit .lead-detail > .card.lead { flex: 1; min-height: 0; }
  .content.fit .lead-detail > .card.lead > .lead-body { flex: 1; min-height: 0; overflow-y: auto; }
  .content.fit .lead-detail > .empty { margin: auto; }
}.lead-detail > .card.lead > .section-heading { align-items: flex-start; }
.lead-detail > .card.lead > .section-heading > div { flex: 1; min-width: 0; }
.lead-detail > .card.lead > .section-heading > div > .pill { display: inline-block; white-space: normal; margin: 6px 6px 0 0; }
.lead-detail > .card.lead > .section-heading > .score { flex: none; }
@media (min-width: 1101px) {
  .content.fit #lead-summary button.summary-item { padding: 8px 14px; }
  .content.fit #lead-summary button.summary-item > span { display: flex; align-items: baseline; gap: 8px; }
  .content.fit #lead-summary button.summary-item strong { font-size: 18px; }
  .content.fit #lead-summary button.summary-item > .icon { width: 18px; height: 18px; }
}
/* ---------- Campaigns workspace ---------- */
#campaigns-view > .workspace { display: grid; gap: 14px; }
#campaigns-view > .workspace[hidden] { display: none; }
#campaign-summary { margin-bottom: 0; }
div.summary-item { display: flex; align-items: center; justify-content: space-between; }
div.summary-item > .icon { width: 22px; height: 22px; color: var(--royal-100); }
.campaign-row { justify-content: flex-start; }
.campaign-row .lead-row-main { flex: 1; }
.row-glyph { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none; background: var(--amber-bg); color: var(--amber); }
.row-glyph.active { background: var(--green-bg); color: var(--green); }
.row-glyph.paused { background: var(--amber-bg); color: var(--amber); }
.row-glyph.archived { background: var(--gray-bg); color: var(--muted); }
.row-note { font-size: 11px; font-weight: 700; color: var(--amber); }
.campaign-detail .section-heading .meta { margin: 4px 0 0; font-size: 12.5px; }
.mini-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.mini-stat { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); text-align: left; font-weight: 400; color: var(--ink); }
button.mini-stat:hover:not(:disabled) { border-color: var(--royal-100); background: var(--royal-50); }
.mini-stat > span:last-child { display: grid; min-width: 0; }
.mini-stat strong { font-size: 17px; font-weight: 800; line-height: 1.2; }
.mini-stat small { font-size: 11.5px; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-stat-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none; background: var(--royal-50); color: var(--royal); }
.detail-section-title { display: flex; align-items: center; gap: 8px; margin: 20px 0 8px; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--royal-700); }
.detail-section-title .icon { color: var(--royal); }
.facts { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; margin: 0; font-size: 13.5px; }
.facts dt { color: var(--muted); font-weight: 600; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.guard .meta { margin: 0 0 8px; }
.progress { height: 8px; border-radius: 6px; background: var(--royal-50); overflow: hidden; margin-bottom: 8px; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--royal), #4f74e8); border-radius: 6px; }
.sequence { list-style: none; margin: 0; padding: 0; display: grid; }
.sequence li { position: relative; display: flex; gap: 14px; padding-bottom: 14px; }
.sequence li:not(:last-child)::before { content: ""; position: absolute; left: 13px; top: 28px; bottom: 0; width: 2px; background: var(--royal-100); }
.sequence-dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--royal); color: var(--white); font-size: 12.5px; font-weight: 800; }
.sequence strong { font-size: 13.5px; }
.sequence p { margin: 3px 0 0; font-size: 13px; color: #3a4666; line-height: 1.5; }
.prospect-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.prospect-table th { text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); background: #f8faff; }
.prospect-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prospect-table td small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.prospect-table td .pill { margin-left: 0; }
.prospect-table td.ops { text-align: right; width: 1%; }
.link-cell { padding: 0; border: 0; background: none; color: var(--royal); font-weight: 700; text-align: left; }
.link-cell:hover:not(:disabled) { background: none; border: 0; text-decoration: underline; color: var(--royal-700); }
.prospects-empty { padding: 24px 10px; }
.danger-ghost { color: var(--red); }
.danger-ghost:hover:not(:disabled) { background: var(--red-bg); border-color: #f5c2bd; color: var(--red); }
.campaign-actions .danger-ghost { margin-left: auto; }
.campaign-actions button { gap: 6px; }
.editor-head { align-items: flex-start; }
.editor-title { display: flex; gap: 12px; align-items: flex-start; }
.editor-title h3 { margin: 0 0 4px; }
@media (min-width: 1101px) {
  .content.fit > #campaigns-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .content.fit > #campaigns-view > .workspace { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 14px; }
  .content.fit > #campaigns-view > .workspace > :not(.master-detail) { flex: none; }
  .content.fit #campaign-summary .summary-item { padding: 8px 14px; }
  .content.fit #campaign-summary .summary-item > span { display: flex; align-items: baseline; gap: 8px; }
  .content.fit #campaign-summary .summary-item strong { font-size: 18px; }
  .content.fit #campaign-summary .summary-item > .icon { width: 18px; height: 18px; }
}
@media (max-width: 900px) { .mini-stats { grid-template-columns: repeat(2, 1fr); } .facts { grid-template-columns: 1fr; } }.mini-stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

/* ---------- Outbox & Inbox workspaces ---------- */
#outbox-view > .workspace, #inbox-view > .workspace { display: grid; gap: 14px; }
#outbox-summary, #inbox-summary { margin-bottom: 0; }
.summary-item.rejected { border-left-color: var(--red); }
.filter-note { display: flex; align-items: center; gap: 6px; margin: 0 0 0 auto; max-width: 360px; line-height: 1.35; }
.filter-note .icon { flex: none; color: var(--royal); }
button.ghost { background: transparent; border-color: transparent; color: var(--royal-700); }
button.ghost:hover:not(:disabled) { background: var(--royal-50); border-color: var(--royal-100); }
.message-row { align-items: flex-start; justify-content: flex-start; }
.message-row .lead-row-main { flex: 1; gap: 2px; }
.row-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; min-width: 0; }
.row-top strong { min-width: 0; }
.row-top time { flex: none; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.message-row .row-snippet { color: #6b7591; }
.row-badges { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.row-badges .pill { margin-left: 0; font-size: 10.5px; padding: 1px 8px; }
.row-glyph.msg { background: var(--royal-50); color: var(--royal); }
.row-glyph.msg.pending_approval { background: var(--amber-bg); color: var(--amber); }
.row-glyph.msg.sent { background: var(--green-bg); color: var(--green); }
.row-glyph.msg.failed, .row-glyph.msg.blocked, .row-glyph.msg.bounced, .row-glyph.msg.complained { background: var(--red-bg); color: var(--red); }
.row-glyph.msg.cancelled { background: var(--gray-bg); color: var(--muted); }
.row-glyph.intent { background: var(--royal-50); color: var(--royal); }
.row-glyph.intent.accepted { background: var(--green-bg); color: var(--green); }
.row-glyph.intent.pending { background: var(--amber-bg); color: var(--amber); }
.row-glyph.intent.rejected { background: var(--red-bg); color: var(--red); }
.row-glyph.intent.archived { background: var(--gray-bg); color: var(--muted); }
.message-detail .section-heading > div > .pill { margin: 0 0 0 8px; vertical-align: middle; }
.message-detail .section-heading .meta { margin: 4px 0 0; font-size: 12.5px; }
.message-detail .recipient { display: flex; align-items: center; gap: 4px; color: var(--ink); font-weight: 600; margin-top: 8px !important; }
.message-detail .recipient .icon { color: var(--royal); }
.message-detail .next-step > div { display: grid; gap: 4px; }
.message-detail .next-step p { margin: 0; font-weight: 400; }
.notice-list { margin: 4px 0 0; padding-left: 18px; font-weight: 400; font-size: 13px; }
.mail-quote { border: 1px solid var(--line); border-left: 3px solid var(--royal-100); border-radius: 10px; background: #f8faff; padding: 12px 14px; }
.mail-quote.draft { border-left-color: var(--royal); background: var(--white); }
.mail-quote-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.mail-quote-head .pill { margin-left: auto; }
.mail-subject { margin: 0 0 6px; font-weight: 700; font-size: 13.5px; }
.mail-quote pre, .ai-preview pre { margin: 0; white-space: pre-wrap; word-break: break-word; font: inherit; font-size: 13.5px; line-height: 1.6; color: #24304d; background: none; padding: 0; border: 0; }
.compose { border: 1px solid var(--line); border-radius: 12px; background: var(--white); overflow: hidden; }
.compose:focus-within { border-color: var(--royal-100); box-shadow: 0 0 0 3px rgba(35, 70, 198, .08); }
.compose-label { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.compose-label input { flex: 1; border: 0; box-shadow: none !important; padding: 11px 0; font-size: 14px; font-weight: 600; color: var(--ink); text-transform: none; letter-spacing: 0; background: transparent; }
.compose textarea { width: 100%; border: 0; border-radius: 0; box-shadow: none !important; padding: 12px 14px; font-size: 14px; line-height: 1.6; resize: vertical; min-height: 220px; display: block; background: transparent; }
.compose.readonly textarea, .compose.readonly input { color: #24304d; -webkit-text-fill-color: #24304d; }
.compose-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 10px 6px 14px; border-top: 1px solid var(--line); background: #f8faff; min-height: 38px; }
.small-btn { padding: 4px 10px; font-size: 12.5px; gap: 6px; }
.ai-assist { margin-top: 16px; border: 1px solid var(--royal-100); border-radius: 12px; padding: 14px; background: linear-gradient(180deg, #f4f7ff, #fff 70%); display: grid; gap: 12px; }
.ai-chips { display: flex; flex-wrap: wrap; gap: 8px; }
button.ai-chip { border-radius: 20px; background: var(--white); border-color: var(--royal-100); font-size: 12.5px; font-weight: 600; padding: 6px 12px; gap: 6px; color: var(--royal-700); }
button.ai-chip:hover:not(:disabled) { background: var(--royal-50); border-color: var(--royal); }
.ai-result { border: 1px solid var(--line); border-radius: 10px; background: var(--white); padding: 12px 14px; display: grid; gap: 10px; }
.ai-result.working, .ai-result.error { display: flex; align-items: center; gap: 10px; color: var(--royal-700); font-weight: 600; }
.ai-result.error { color: var(--red); background: var(--red-bg); border-color: transparent; }
.ai-result-head { display: grid; gap: 2px; }
.ai-preview { border-left: 3px solid var(--royal); padding: 4px 0 4px 12px; }
.ai-result .issues { margin: 0; }
.ai-ok { margin: 0; color: var(--green); font-weight: 600; font-size: 13px; }
.ai-result-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-result-actions button { gap: 6px; }
.icon.spin { animation: spin 1.4s linear infinite; }
.source-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.source-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 16px; background: var(--royal-50); color: var(--royal-700); font-size: 12px; font-weight: 600; }
.message-detail .empty { padding: 16px 10px; }
@media (min-width: 1101px) {
  .content.fit > #outbox-view, .content.fit > #inbox-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .content.fit > #outbox-view > .workspace, .content.fit > #inbox-view > .workspace { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 14px; }
  .content.fit > #outbox-view > .workspace > :not(.master-detail), .content.fit > #inbox-view > .workspace > :not(.master-detail) { flex: none; }
  .content.fit #outbox-summary .summary-item, .content.fit #inbox-summary .summary-item { padding: 8px 14px; }
  .content.fit #outbox-summary .summary-item > span, .content.fit #inbox-summary .summary-item > span { display: flex; align-items: baseline; gap: 8px; }
  .content.fit #outbox-summary .summary-item strong, .content.fit #inbox-summary .summary-item strong { font-size: 18px; }
  .content.fit #outbox-summary .summary-item > .icon, .content.fit #inbox-summary .summary-item > .icon { width: 18px; height: 18px; }
}
@media (max-width: 1100px) { .filter-note { display: none; } }
.message-detail > .section-heading { align-items: flex-start; }
.detail-links { display: flex; gap: 6px; flex: none; }
.message-detail .campaign-actions { flex-wrap: nowrap; overflow-x: auto; }
.message-detail .campaign-actions button { white-space: nowrap; }

/* ---------- Assistant chat workspace ---------- */
.chat-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; height: calc(100vh - 210px); min-height: 520px; }
.chat-main { display: flex; flex-direction: column; min-height: 0; padding: 0; overflow: hidden; }
.chat-head { flex: none; display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.chat-badge { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, var(--royal), var(--royal-700)); color: var(--white); flex: none; }
.chat-title { flex: 1; min-width: 0; }
.chat-title h3 { margin: 0; font-size: 15px; }
.chat-title p { margin: 2px 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-title strong { color: var(--royal-700); }
.chat-grounded { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.chat-head button { white-space: nowrap; }
.chat-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 22px; display: flex; flex-direction: column; gap: 18px; background: linear-gradient(180deg, #fbfcff, var(--white)); scroll-behavior: smooth; }

.chat-row { display: flex; gap: 10px; align-items: flex-start; max-width: 860px; width: 100%; }
.chat-row.user { flex-direction: row-reverse; align-self: flex-end; }
.chat-avatar { width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 11.5px; font-weight: 800; }
.chat-avatar.assistant { background: var(--royal-50); color: var(--royal); border: 1px solid var(--royal-100); }
.chat-avatar.user { background: var(--royal-700); color: var(--white); }
.chat-bubble { min-width: 0; max-width: calc(100% - 42px); padding: 12px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--white); box-shadow: var(--shadow); border-top-left-radius: 4px; }
.chat-row.user .chat-bubble { background: var(--royal); border-color: var(--royal); color: var(--white); border-radius: 14px; border-top-right-radius: 4px; box-shadow: none; }
.chat-meta { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; font-size: 12px; }
.chat-meta strong { font-size: 12px; color: var(--royal-700); }
.chat-meta time { color: var(--muted); font-size: 11.5px; }
.chat-row.user .chat-meta { justify-content: flex-end; }
.chat-row.user .chat-meta strong, .chat-row.user .chat-meta time { color: rgba(255, 255, 255, .8); }
.chat-plain { margin: 0; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-text { line-height: 1.6; color: var(--ink); overflow-wrap: anywhere; }
.chat-text p { margin: 0 0 8px; }
.chat-text ul, .chat-text ol { margin: 0 0 8px; padding-left: 20px; }
.chat-text li { margin: 3px 0; }
.chat-text > :last-child { margin-bottom: 0; }
button.chat-cite { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; margin: 0 2px; border-radius: 5px; font-size: 10.5px; font-weight: 700; vertical-align: 2px; background: var(--royal-50); color: var(--royal); border: 1px solid var(--royal-100); line-height: 1; }
button.chat-cite:hover { background: var(--royal); color: var(--white); }
.chat-sources-label { display: flex; align-items: center; gap: 4px; margin: 12px 0 6px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.chat-sources { display: flex; flex-wrap: wrap; gap: 6px; }
button.chat-source { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 8px; font-size: 12.5px; background: var(--bg); border: 1px solid var(--line); color: var(--ink); font-weight: 600; }
button.chat-source .icon { color: var(--royal); }
button.chat-source small { color: var(--muted); font-weight: 500; }
button.chat-source:hover, button.chat-source[aria-pressed=true] { border-color: var(--royal); background: var(--royal-50); }
.chat-source-detail { margin-top: 8px; display: grid; gap: 8px; max-height: 220px; overflow-y: auto; }
.chat-source-detail blockquote { margin: 0; padding: 8px 12px; border-left: 3px solid var(--royal); background: var(--bg); border-radius: 0 8px 8px 0; }
.chat-source-detail p { margin: 4px 0 0; font-size: 12.5px; color: #3a4666; white-space: pre-wrap; line-height: 1.5; }
.chat-cite-label { font-size: 11px; font-weight: 700; color: var(--royal-700); }
.chat-actions { display: flex; gap: 6px; margin-top: 8px; }
.chat-actions button { padding: 4px 8px; font-size: 12.5px; display: inline-flex; align-items: center; gap: 4px; }
.chat-notice { display: flex; gap: 8px; align-items: flex-start; line-height: 1.5; }
.chat-notice .icon { flex: none; margin-top: 3px; }
.chat-bubble.unsupported { background: var(--amber-bg); border-color: #f3d9a8; color: #5c3a00; box-shadow: none; }
.chat-bubble.unsupported .icon { color: var(--amber); }
.chat-bubble.error { background: var(--red-bg); border-color: #f5c2bd; color: var(--red); box-shadow: none; }
.chat-typing { display: flex; align-items: center; gap: 4px; padding: 4px 0; }
.chat-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--royal); opacity: .35; animation: chat-dot 1.2s infinite ease-in-out; }
.chat-typing span:nth-child(2) { animation-delay: .15s; }
.chat-typing span:nth-child(3) { animation-delay: .3s; }
.chat-typing em { margin-left: 8px; font-size: 12.5px; color: var(--muted); font-style: normal; }
@keyframes chat-dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .chat-typing span { animation: none; opacity: .6; } .chat-scroll { scroll-behavior: auto; } }

.chat-welcome { margin: auto; max-width: 640px; text-align: center; padding: 12px 0; }
.chat-welcome-badge { width: 52px; height: 52px; border-radius: 14px; margin: 0 auto 12px; display: grid; place-items: center; background: linear-gradient(135deg, var(--royal), var(--royal-700)); color: var(--white); box-shadow: 0 8px 24px rgba(35, 70, 198, .25); }
.chat-welcome-badge .icon { width: 24px; height: 24px; }
.chat-welcome h3 { margin: 0 0 6px; font-size: 19px; }
.chat-welcome > p { margin: 0 auto 18px; max-width: 520px; line-height: 1.55; }
.chat-starters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; text-align: left; }
button.chat-starter { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--white); border: 1px solid var(--line); box-shadow: var(--shadow); text-align: left; font-weight: 400; }
button.chat-starter:hover { border-color: var(--royal); transform: translateY(-1px); }
.chat-starter-icon { width: 32px; height: 32px; border-radius: 9px; flex: none; display: grid; place-items: center; background: var(--royal-50); color: var(--royal); }
button.chat-starter strong { display: block; font-size: 13.5px; color: var(--ink); }
button.chat-starter small { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; line-height: 1.4; }

.chat-foot { flex: none; padding: 10px 18px 12px; border-top: 1px solid var(--line); background: var(--white); }
.chat-followups { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chat-followups[hidden] { display: none; }
button.chat-followup { display: inline-flex; align-items: center; gap: 4px; padding: 5px 11px; border-radius: 16px; font-size: 12.5px; font-weight: 500; background: var(--royal-50); border: 1px solid var(--royal-100); color: var(--royal-700); max-width: 100%; text-align: left; }
button.chat-followup:hover { background: var(--royal); color: var(--white); border-color: var(--royal); }
.chat-composer { align-items: flex-end; }
.chat-composer textarea { resize: none; min-height: 40px; max-height: 160px; padding: 9px 6px; line-height: 1.45; }
.chat-composer button#send { width: 42px; height: 40px; padding: 0; display: grid; place-items: center; border-radius: 10px; flex: none; }
.chat-hint { display: flex; justify-content: space-between; margin-top: 6px; }
.chat-hint kbd { font: inherit; font-size: 11px; padding: 0 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: var(--bg); }

.chat-side { display: flex; flex-direction: column; gap: 16px; min-height: 0; overflow-y: auto; padding: 16px; }
.chat-side h4 { display: flex; align-items: center; gap: 6px; margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.chat-side h4 .icon { color: var(--royal); }
.chat-coverage { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); }
.chat-coverage.ok { background: var(--green-bg); border-color: #bfe5d3; }
.chat-coverage.empty { background: var(--amber-bg); border-color: #f3d9a8; }
.chat-coverage-icon { width: 26px; height: 26px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--white); }
.chat-coverage.ok .chat-coverage-icon { color: var(--green); }
.chat-coverage.empty .chat-coverage-icon { color: var(--amber); }
.chat-coverage strong { display: block; font-size: 13px; }
.chat-coverage small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; line-height: 1.4; }
button.chat-coverage-link { margin-top: 6px; padding: 4px 6px; font-size: 12.5px; display: inline-flex; align-items: center; gap: 4px; }
.chat-side-prompts { display: flex; flex-direction: column; gap: 4px; }
.chat-group-label { margin: 8px 0 2px; font-size: 11.5px; font-weight: 700; color: var(--ink); }
.chat-side-prompts h4 + .chat-group-label { margin-top: 0; }
button.chat-prompt { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border-radius: 8px; background: transparent; border: 1px solid transparent; color: var(--ink); font-weight: 500; font-size: 13px; text-align: left; }
button.chat-prompt .icon { color: var(--royal); flex: none; }
button.chat-prompt:hover { background: var(--royal-50); border-color: var(--royal-100); }
.chat-note { margin: auto 0 0; display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--bg); font-size: 12px; color: var(--muted); line-height: 1.5; }
.chat-note .icon { color: var(--royal); flex: none; margin-top: 2px; }

@media (min-width: 1101px) {
  .content.fit > #assistant-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .content.fit > #assistant-view > .chat-workspace { flex: 1; min-height: 0; height: auto; }
}
@media (max-width: 1100px) {
  .chat-workspace { grid-template-columns: 1fr; height: auto; }
  .chat-main { height: calc(100vh - 200px); min-height: 480px; }
  .chat-side { overflow: visible; }
}
@media (max-width: 640px) {
  .chat-starters { grid-template-columns: 1fr; }
  .chat-grounded, .chat-hint > span:first-child { display: none; }
  .chat-scroll { padding: 14px; }
}button.chat-starter, button.chat-prompt, button.chat-source, button.chat-followup { justify-content: flex-start; white-space: normal; }
button.chat-starter > span:last-child { min-width: 0; flex: 1; }
button.chat-prompt { padding: 5px 10px; }
.chat-side { gap: 12px; }.chat-followups { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; padding-bottom: 2px; }
button.chat-followup { flex: none; max-width: 360px; white-space: nowrap; }
button.chat-followup .chat-followup-text { overflow: hidden; text-overflow: ellipsis; }.chat-followups { scrollbar-width: none; }
.chat-followups::-webkit-scrollbar { display: none; }

/* Saved chat history */
.chat-history { display: flex; flex-direction: column; gap: 2px; max-height: 220px; overflow-y: auto; }
.chat-history .chat-group-label { margin: 6px 0 2px; color: var(--muted); font-weight: 600; font-size: 11px; }
.chat-history .chat-group-label:first-child { margin-top: 0; }
.chat-history-empty { margin: 0; line-height: 1.45; }
.chat-history-row { display: flex; align-items: center; border-radius: 8px; border: 1px solid transparent; }
.chat-history-row:hover { background: var(--royal-50); }
.chat-history-row.active { background: var(--royal-50); border-color: var(--royal-100); }
button.chat-history-open { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: flex-start; gap: 8px; padding: 6px 8px; background: transparent; border: 0; color: var(--ink); font-weight: 500; font-size: 13px; text-align: left; }
button.chat-history-open .icon { color: var(--royal); flex: none; }
.chat-history-row.active button.chat-history-open { color: var(--royal-700); font-weight: 700; }
.chat-history-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button.chat-history-delete { flex: none; width: 26px; height: 26px; padding: 0; margin-right: 4px; display: grid; place-items: center; background: transparent; border: 0; color: var(--muted); opacity: 0; }
.chat-history-row:hover button.chat-history-delete, .chat-history-row.active button.chat-history-delete, button.chat-history-delete:focus-visible { opacity: 1; }
button.chat-history-delete:hover { color: var(--red); background: var(--red-bg); }
/* ---------- SaaS: sign-up, plan badge, onboarding, billing, platform ---------- */
.auth-switch { font-size: 13.5px; color: var(--muted); text-align: center; }
.auth-switch .link-btn { font-weight: 600; }
.plan-badge { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 20px; border: 1px solid var(--royal-100); background: var(--royal-50); color: var(--royal-700); font-size: 12.5px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.plan-badge:hover { border-color: var(--royal); }
.plan-badge.trial { background: var(--amber-bg); color: var(--amber); border-color: #f3dca5; }
.plan-badge.ok { background: var(--green-bg); color: var(--green); border-color: #bfe5cf; }
.plan-badge.blocked { background: var(--red-bg); color: var(--red); border-color: #f2c2c2; }
.access-banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 18px; border-radius: var(--radius); background: var(--amber-bg); color: #7a4b00; border: 1px solid #f3dca5; font-weight: 600; }
.access-banner > span { flex: 1; }
.access-banner > .icon { color: var(--amber); flex: none; }

.onboarding { margin-bottom: 20px; border-color: var(--royal-100); background: linear-gradient(180deg, #f7f9ff, var(--white)); }
.onboarding-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.onboarding-steps li { display: flex; align-items: center; gap: 14px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); }
.onboarding-steps li > div { flex: 1; min-width: 0; display: grid; gap: 2px; }
.onboarding-steps li small { color: var(--muted); }
.onboarding-steps li.done { background: #fbfcfe; }
.onboarding-steps li.done strong { color: var(--muted); text-decoration: line-through; text-decoration-color: #c4cbe0; }
.onboarding-mark { display: grid; place-items: center; width: 26px; height: 26px; flex: none; border-radius: 50%; border: 2px solid var(--royal-100); color: var(--royal-700); font-size: 12.5px; font-weight: 700; }
.onboarding-steps li.done .onboarding-mark { background: var(--green); border-color: var(--green); color: var(--white); }
.onboarding-icon { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 9px; background: var(--royal-50); color: var(--royal); }

.connect-step { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.connect-step:last-of-type { border-bottom: 0; }
.connect-mark { display: grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 50%; border: 2px solid var(--line); color: var(--muted); font-weight: 700; font-size: 13px; }
.connect-step.active .connect-mark { border-color: var(--royal); color: var(--royal); }
.connect-step.done .connect-mark { background: var(--green); border-color: var(--green); color: var(--white); }
.connect-step.pending { opacity: .6; }
.connect-body { flex: 1; min-width: 0; display: grid; gap: 8px; justify-items: start; }
.inline-form { display: flex; gap: 8px; width: 100%; }
.inline-form input { flex: 1; min-width: 0; }

.billing-summary { margin-bottom: 20px; }
.billing-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.billing-head h3 { font-size: 22px; margin: 2px 0 4px; }
.billing-head p { margin: 0; }
.usage-meters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 10px; }
.usage-meter { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: grid; gap: 10px; }
.usage-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; }
.usage-top span { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.usage-top .icon { color: var(--royal); }
.usage-bar { height: 8px; border-radius: 8px; background: var(--royal-50); overflow: hidden; }
.usage-bar span { display: block; height: 100%; border-radius: 8px; background: var(--royal); transition: width .3s; }
.usage-meter.mid .usage-bar span { background: var(--amber); }
.usage-meter.high .usage-bar span { background: var(--red); }
.segmented { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--royal-50); border: 1px solid var(--royal-100); }
.segmented button { border: 0; background: transparent; padding: 6px 14px; border-radius: 7px; font-weight: 600; color: var(--royal-700); box-shadow: none; }
.segmented button[aria-pressed="true"] { background: var(--white); color: var(--royal); box-shadow: 0 1px 3px rgba(20, 40, 120, .15); }
.price-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-bottom: 12px; }
.price-card { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 22px 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); }
.price-card h4 { margin: 0; font-size: 17px; }
.price-card.featured { border: 2px solid var(--royal); box-shadow: var(--shadow-lg); }
.price-card.current { border-color: var(--green); }
.price-ribbon { position: absolute; top: -11px; right: 16px; padding: 3px 10px; border-radius: 20px; background: var(--royal); color: var(--white); font-size: 11px; font-weight: 700; }
.price { margin: 8px 0 4px; }
.price strong { font-size: 28px; color: var(--ink); }
.price-features { list-style: none; margin: 4px 0 14px; padding: 0; display: grid; gap: 7px; flex: 1; font-size: 13.5px; }
.price-features li { display: flex; gap: 8px; align-items: flex-start; }
.price-features .icon { color: var(--green); flex: none; margin-top: 2px; }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table td strong, .data-table td small { display: block; }
.data-table select { width: auto; min-width: 120px; }
.data-table tbody tr:hover { background: #fafbff; }
.plan-editor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; }
.plan-editor { display: grid; gap: 12px; align-content: start; }
.plan-editor > button { justify-self: start; }
.plan-editor-head { display: flex; justify-content: space-between; align-items: center; }
.plan-editor-head code { font-size: 12px; color: var(--muted); }
.plan-flags { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.plan-flags .check-field { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; margin: 0; }
.plan-flags .check-field input { width: auto; margin: 0; }
@media (max-width: 900px) { .usage-meters { grid-template-columns: 1fr; } .plan-badge { display: none; } }
/* ---------- Work report ---------- */
#reports-view { display: grid; gap: 16px; }
.report-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.report-hero { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; padding: 24px 28px; border-radius: var(--radius); color: var(--white); background: linear-gradient(120deg, var(--royal-900), var(--royal) 70%, #3d63e0); box-shadow: var(--shadow); }
.report-range { color: rgba(255, 255, 255, .75); font-weight: 600; letter-spacing: .02em; }
.report-hero h2 { margin: 6px 0 4px; font-size: 20px; font-weight: 600; color: var(--white); }
.report-big { font-size: 34px; font-weight: 800; margin-right: 4px; }
.report-sub { margin: 0 0 6px; color: rgba(255, 255, 255, .85); }
.report-hero .delta { color: rgba(255, 255, 255, .9); }
.report-needs { display: grid; gap: 8px; min-width: 240px; padding: 14px; border-radius: 10px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .18); }
.report-needs > strong { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: rgba(255, 255, 255, .75); }
.report-need { display: grid; grid-template-columns: auto auto 1fr; gap: 10px; align-items: center; text-align: left; padding: 8px 10px; border-radius: 8px; border: 0; background: rgba(255, 255, 255, .08); color: var(--white); box-shadow: none; font-weight: 500; }
.report-need:hover:not(:disabled) { background: rgba(255, 255, 255, .2); color: var(--white); }
.report-need b { font-size: 16px; }
.report-tile { grid-template-rows: auto; }
.report-tile .tile-icon { grid-row: auto; }
.tile-text { display: grid; gap: 2px; }
.tile-text > span { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.delta { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.delta.up { color: var(--green); }
.delta.down { color: var(--red); }
.report-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table tfoot td { font-weight: 700; border-bottom: 0; }
.data-table .muted-row td { color: var(--muted); }
.chart-legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.chart-legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart-legend .sent::before, .chart-bars .sent { background: var(--royal); }
.chart-legend .replies::before, .chart-bars .replies { background: #2fb37d; }
.report-chart { display: flex; align-items: stretch; gap: 4px; height: 220px; padding-top: 8px; }
.report-chart > .empty { flex: 1; }
.chart-col { flex: 1; display: grid; grid-template-rows: 1fr 18px; gap: 4px; min-width: 0; }
.chart-bars { display: flex; align-items: flex-end; justify-content: center; gap: 2px; border-bottom: 1px solid var(--line); }
.chart-bars .bar { width: min(14px, 40%); min-height: 0; border-radius: 3px 3px 0 0; }
.chart-col small { font-size: 10.5px; color: var(--muted); text-align: center; white-space: nowrap; overflow: visible; }
#report-highlights { display: grid; }
.highlight-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: 12px; align-items: center; text-align: left; padding: 12px 6px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; color: var(--ink); box-shadow: none; font-weight: 400; }
.highlight-row:last-child { border-bottom: 0; }
.highlight-row:hover:not(:disabled) { background: var(--royal-50); color: var(--ink); }
.highlight-row > .icon { color: var(--royal); }
.highlight-row strong, .highlight-row div small { display: block; }
@media (max-width: 980px) {
  .report-hero, .report-grid { grid-template-columns: 1fr; }
}#report-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (min-width: 1500px) { #report-tiles { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (max-width: 640px) { #report-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.report-hero .delta.up, .report-hero .delta.down, .report-hero .delta.flat { display: inline-block; margin-top: 4px; padding: 3px 10px; border-radius: 999px; background: rgba(255, 255, 255, .14); color: var(--white); }
.chart-bars .bar { width: auto; flex: 0 1 9px; }

/* Mailboxes per line of business */
.mailbox-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.mailbox-head .pill, .mailbox-title .pill, #product-usage { flex: none; margin-left: 0; text-transform: none; }
.mailbox-list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.mailbox-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); }
.mailbox-row.pending { border-style: dashed; background: var(--amber-bg); }
.mailbox-info { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 4px; }
.mailbox-info .inline-form { max-width: 320px; margin-top: 6px; }
.mailbox-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.mailbox-title strong { overflow-wrap: anywhere; }
.mailbox-title .pill { margin-left: 0; }
.mailbox-actions { display: flex; flex: none; gap: 6px; }
.mailbox-add { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 8px; margin: 12px 0 6px; }
.mailbox-cap { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; padding: 10px 14px; border-radius: 10px; background: var(--royal-50); color: var(--royal-700); font-size: 13px; }
.mailbox-cap span { flex: 1; min-width: 200px; }
.product-mailbox { display: flex; align-items: center; gap: 6px; color: var(--royal-700); }
.price-worth { display: flex; flex-direction: column; gap: 2px; margin: 4px 0 2px; padding: 10px 12px; border-radius: 10px; background: var(--royal-50); color: var(--royal-700); font-size: 12.5px; }
.price-worth .icon { margin-bottom: 2px; }
.price-worth strong { font-size: 13.5px; color: var(--royal); }
@media (max-width: 640px) { .mailbox-add { grid-template-columns: 1fr; } .mailbox-row { flex-wrap: wrap; } }
.login-copy a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Lead pipeline 2.0: stage bar, quick views, chips, insights, bulk, table, drawer ---------- */
.stage-bar { display: grid; grid-template-columns: 4fr 3fr; gap: 12px; }
.stage-group { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; position: relative; padding-top: 16px; }
.stage-group-label { position: absolute; top: 0; left: 2px; font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.stage-group.stopped { padding-left: 12px; border-left: 1px dashed var(--line); }
.stage-group.stopped .stage-group-label { left: 14px; }
.stage-tile { --c: var(--royal); display: flex; align-items: baseline; justify-content: flex-start; gap: 8px; min-width: 0; padding: 8px 12px; border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: 10px; background: var(--white); color: var(--ink); font-weight: 400; text-align: left; }
.stage-tile strong { font-size: 18px; font-weight: 800; }
.stage-tile span { font-size: 12px; font-weight: 600; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage-tile.zero { opacity: .62; }
.stage-tile:hover:not(:disabled) { background: #f8faff; border-color: var(--royal-100); border-left-color: var(--c); }
.stage-tile.selected, .stage-tile.selected:hover:not(:disabled) { background: var(--royal-50); border-color: var(--c); box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 25%, transparent); opacity: 1; }
.stage-tile.review { --c: var(--amber); } .stage-tile.searching { --c: var(--royal); } .stage-tile.ready { --c: var(--green); } .stage-tile.enrolled { --c: #0b6e4f; }
.stage-tile.needs_research { --c: #b7791f; } .stage-tile.no_email { --c: #8b93a7; } .stage-tile.rejected { --c: var(--red); }
.stage-group.stopped .stage-tile { background: #fbfcfe; }

.view-switch { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: #f8faff; margin-left: auto; }
.view-switch .icon-btn { padding: 6px; border-color: transparent; background: transparent; color: var(--muted); }
.view-switch .icon-btn[aria-pressed=true] { background: var(--white); color: var(--royal); border-color: var(--royal-100); box-shadow: 0 1px 2px rgba(15, 27, 61, .08); }
.filter.active select { border-color: var(--royal); background-color: var(--royal-50); color: var(--royal-700); font-weight: 600; }

.filter-context { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.quick-views, .filter-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.filter-chips { justify-content: flex-end; }
.context-label { font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-right: 2px; }
.quick-view { padding: 5px 12px; border-radius: 20px; font-size: 12.5px; color: var(--muted); }
.quick-view.active, .quick-view.active:hover:not(:disabled) { background: var(--royal); border-color: var(--royal); color: var(--white); }
.result-note { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-right: 4px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border-radius: 20px; background: var(--royal-50); border: 1px solid var(--royal-100); color: var(--royal-700); font-size: 12px; font-weight: 600; max-width: 340px; }
.chip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-x { padding: 2px; border: 0; border-radius: 50%; background: transparent; color: inherit; }
.chip-x:hover:not(:disabled) { background: var(--royal-100); border: 0; }
.chip.subtle { padding: 3px 10px; background: var(--gray-bg); border-color: transparent; color: #3a4666; font-weight: 500; }
.chip.info { padding: 3px 10px; }
.small-btn { padding: 4px 8px; font-size: 12.5px; gap: 4px; }

.lead-insights { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.insight-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; box-shadow: var(--shadow); }
.insight-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-size: 13px; }
.bars { display: grid; gap: 2px; max-height: 150px; overflow-y: auto; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 38%) 1fr 32px; align-items: center; gap: 10px; padding: 3px 6px; border: 1px solid transparent; border-radius: 7px; background: none; font-weight: 400; color: var(--ink); text-align: left; }
.bar-row:hover:not(:disabled) { background: #f8faff; border-color: var(--line); }
.bar-row.active, .bar-row.active:hover:not(:disabled) { background: var(--royal-50); border-color: var(--royal-100); }
.bar-label { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 8px; border-radius: 6px; background: var(--royal-50); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 6px; background: var(--royal); }
.bar-row.band-high .bar-fill { background: var(--green); } .bar-row.band-mid .bar-fill { background: #d69e2e; } .bar-row.band-low .bar-fill { background: #a0a9bd; }
.bar-count { font-size: 12.5px; text-align: right; }

.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 8px 12px; border-radius: var(--radius); background: var(--royal-900); color: var(--white); box-shadow: var(--shadow-lg); }
.bulk-group { display: inline-flex; align-items: center; gap: 6px; }
.bulk-bar > .bulk-group:first-child { gap: 6px; font-size: 13px; }
.bulk-bar input, .bulk-bar select { height: 34px; padding-top: 0; padding-bottom: 0; font-size: 13px; }
.bulk-bar input { width: 260px; }
.bulk-bar select { max-width: 220px; }
.bulk-bar button { padding: 6px 12px; font-size: 13px; }
.bulk-bar .link-btn { color: #c8d3f5; margin-left: auto; }
.bulk-bar .link-btn:hover:not(:disabled) { color: var(--white); background: rgba(255, 255, 255, .1); }
.bulk-bar .danger-ghost { background: var(--white); }

.list-head-left { display: inline-flex; align-items: center; gap: 10px; }
.row-check { width: 16px; height: 16px; margin: 0; accent-color: var(--royal); cursor: pointer; flex: none; }
.lead-item { display: flex; align-items: stretch; border-bottom: 1px solid var(--line); border-left: 3px solid transparent; background: var(--white); }
.lead-item > .row-check { align-self: center; margin-left: 12px; }
.lead-item > .lead-row { flex: 1; min-width: 0; border-bottom: 0; border-left: 0; background: transparent; padding-left: 12px; }
.lead-item > .lead-row:hover:not(:disabled) { background: transparent; }
.lead-item:hover { background: #f8faff; }
.lead-item.checked { background: #f3f6fe; }
.lead-item.selected { background: var(--royal-50); border-left-color: var(--royal); }

.lead-table-panel { padding: 0; overflow: hidden; }
.table-scroll { overflow: auto; height: 100%; }
.lead-table thead th { position: sticky; top: 0; z-index: 1; white-space: nowrap; }
.lead-table tbody tr { cursor: pointer; }
.lead-table tbody tr:hover { background: #f8faff; }
.lead-table tbody tr.checked { background: #f3f6fe; }
.lead-table tbody tr.open { background: var(--royal-50); box-shadow: inset 3px 0 0 var(--royal); }
.lead-table td { vertical-align: middle; }
.lead-table .check-col { width: 36px; padding-right: 0; }
.lead-table .num { text-align: center; }
.th-sort { padding: 0; border: 0; background: none; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; gap: 2px; }
.th-sort:hover:not(:disabled) { background: none; border: 0; color: var(--royal); }
.th-sort.active { color: var(--royal-700); }
.link-cell.subtle { font-weight: 600; font-size: 12.5px; color: var(--royal-700); }

dialog.lead-drawer { position: fixed; inset: 0 0 0 auto; margin: 0; width: min(640px, 100vw); max-width: 100vw; height: 100dvh; max-height: 100dvh; padding: 0; border: 0; border-radius: 16px 0 0 16px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; }
dialog.lead-drawer:not([open]) { display: none; }
dialog.lead-drawer::backdrop { background: rgba(14, 31, 94, .28); }
.drawer-bar { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #f8faff; }
.drawer-bar .icon-btn { padding: 6px; }
.drawer-bar > .icon-btn:last-child { margin-left: auto; }
.lead-detail.drawer-body { position: static; flex: 1; min-height: 0; max-height: none; border: 0; border-radius: 0; box-shadow: none; overflow: hidden; display: flex; flex-direction: column; }
.lead-detail.drawer-body > .card.lead { flex: 1; min-height: 0; }
.lead-detail.drawer-body > .card.lead > .lead-body { flex: 1; min-height: 0; overflow-y: auto; }

@media (min-width: 1101px) {
  .content.fit [data-panel=leads] > .lead-table-panel { flex: 1; min-height: 0; }
}
@media (max-width: 1100px) {
  .stage-bar { grid-template-columns: 1fr; }
  .stage-group.stopped { padding-left: 0; border-left: 0; }
  .stage-group.stopped .stage-group-label { left: 2px; }
  .lead-insights { grid-template-columns: 1fr; }
  .lead-table-panel { max-height: 70vh; }
}
@media (max-width: 640px) {
  .stage-group { grid-auto-flow: row; grid-template-columns: 1fr 1fr; }
  .bulk-bar input { width: 100%; }
}

/* ---------- Discovery runs ---------- */
.run-summary { margin-bottom: 0; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; }
.run-summary .mini-stat { padding: 8px 10px; gap: 8px; }
.run-summary .mini-stat-icon { display: none; }
.run-summary .mini-stat small { white-space: normal; line-height: 1.25; }
.run-grid { display: grid; gap: 12px; }
.run-card { display: grid; gap: 12px; padding: 16px 18px; background: var(--white); border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: var(--radius); box-shadow: var(--shadow); }
.run-card.running, .run-card.queued { border-left-color: var(--royal); }
.run-card.failed { border-left-color: var(--red); }
.run-card.cancelled { border-left-color: #a0a9bd; }
.run-card.current { box-shadow: 0 0 0 2px var(--royal-100), var(--shadow); }
.run-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.run-title { min-width: 0; }
.run-title > div { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.run-title strong { font-size: 15px; }
.run-title .pill { margin-left: 0; }
.current-pill { background: var(--royal); color: var(--white); }
.run-focus { font-style: italic; }
.run-card .review-actions { margin: 0; flex: none; }
.run-card > .next-step { margin: 0; }
.run-funnel { display: grid; grid-template-columns: repeat(6, 1fr); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.run-step { position: relative; display: grid; gap: 2px; justify-items: start; padding: 8px 14px; border: 0; border-right: 1px solid var(--line); border-radius: 0; background: #fbfcfe; color: var(--ink); font-weight: 400; text-align: left; }
.run-step:last-child { border-right: 0; }
.run-step strong { font-size: 18px; font-weight: 800; }
.run-step small { font-size: 11.5px; color: var(--muted); font-weight: 600; }
button.run-step:hover:not(:disabled) { background: var(--royal-50); border-color: var(--line); }
button.run-step strong { color: var(--royal); }
.run-outcome { display: grid; gap: 8px; }
.outcome-bar { display: flex; height: 10px; border-radius: 6px; overflow: hidden; background: var(--gray-bg); gap: 2px; }
.outcome-bar .seg { display: block; flex-basis: 0; min-width: 6px; }
.seg.review, .legend-item.review .dot { background: var(--amber); }
.seg.searching, .legend-item.searching .dot { background: var(--royal); }
.seg.ready, .legend-item.ready .dot { background: var(--green); }
.seg.enrolled, .legend-item.enrolled .dot { background: #0b6e4f; }
.seg.needs_research, .legend-item.needs_research .dot { background: #d69e2e; }
.seg.no_email, .legend-item.no_email .dot { background: #a0a9bd; }
.seg.rejected, .legend-item.rejected .dot { background: var(--red); }
.outcome-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.legend-item { gap: 6px; padding: 3px 10px; border-radius: 20px; font-size: 12.5px; font-weight: 500; color: var(--ink); }
.legend-item strong { font-weight: 800; }
.legend-item .dot { width: 8px; height: 8px; border-radius: 50%; }
.legend-note { margin-left: auto; }
.run-skips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.skip-title { font-weight: 700; color: var(--muted); }
.run-foot { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 20px; }
.run-cost { display: grid; gap: 4px; min-width: 260px; flex: 0 1 380px; }
.run-cost small { color: var(--muted); font-size: 12px; }
.run-cost .progress { height: 6px; margin: 0; }
.run-notes { font-size: 12.5px; color: var(--muted); flex: 1 1 300px; }
.run-notes summary { cursor: pointer; font-weight: 600; text-align: right; }
.run-notes ul { margin: 6px 0 0; padding-left: 18px; line-height: 1.5; }
@media (max-width: 900px) {
  .run-funnel { grid-template-columns: repeat(3, 1fr); }
  .run-step:nth-child(3) { border-right: 0; }
  .run-step:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
  .run-card-head { flex-direction: column; }
}

/* ---------- Sales CRM ---------- */
.rep-mode .sidebar nav .nav-item:not([data-mode=crm]), .rep-mode .sidebar nav .nav-group:not([data-crm-group]), .rep-mode .product-switch, .rep-mode .sidebar-foot, .rep-mode #access-banner { display: none !important; }
.crm-stage-strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(120px, 1fr); gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.crm-stage-stat { display: grid; gap: 2px; padding: 10px 12px; background: var(--white); border: 1px solid var(--line); border-top: 3px solid var(--stage, var(--royal)); border-radius: 10px; box-shadow: var(--shadow); min-width: 0; }
.crm-stage-stat strong { font-size: 20px; font-weight: 800; line-height: 1.15; }
.crm-stage-stat small { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crm-stage-name { font-size: 12px; font-weight: 700; color: #3a4666; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crm-board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.crm-board > .empty { grid-column: 1 / -1; }
.crm-column { display: flex; flex-direction: column; min-height: 220px; max-height: calc(100dvh - 330px); background: #f4f6fb; border: 1px solid var(--line); border-radius: var(--radius); transition: background .15s, border-color .15s; }
.crm-column.drop { background: var(--royal-50); border-color: var(--royal); border-style: dashed; }
.crm-column-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 0; }
.crm-column-head::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--stage, var(--royal)); flex: none; }
.crm-column-title { font-weight: 700; font-size: 13.5px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crm-column-count { font-size: 11.5px; font-weight: 700; color: var(--muted); background: var(--white); border: 1px solid var(--line); border-radius: 10px; padding: 0 8px; }
.crm-column-value { margin: 2px 12px 8px 30px; font-size: 12px; color: var(--muted); min-height: 16px; }
.crm-column-cards { display: grid; gap: 8px; padding: 0 10px 10px; overflow-y: auto; align-content: start; flex: 1; }
.crm-column-empty { margin: 0; padding: 18px 8px; text-align: center; font-size: 12.5px; color: var(--muted); border: 1px dashed #d5dbea; border-radius: 10px; }
.crm-card { display: grid; gap: 6px; padding: 11px 12px; background: var(--white); border: 1px solid var(--line); border-left: 3px solid var(--stage, var(--royal)); border-radius: 10px; box-shadow: 0 1px 2px rgba(15, 27, 61, .06); cursor: pointer; transition: box-shadow .15s, transform .15s; }
.crm-card:hover, .crm-card:focus-visible { box-shadow: var(--shadow-lg); transform: translateY(-1px); outline: none; }
.crm-card[draggable=true] { cursor: grab; }
.crm-card.dragging { opacity: .45; }
.crm-card-top { display: flex; align-items: flex-start; gap: 8px; justify-content: space-between; }
.crm-card-top strong { font-size: 13.5px; line-height: 1.3; overflow-wrap: anywhere; }
.crm-card-contact { margin: 0; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crm-card-foot { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.crm-card-value { font-size: 12.5px; font-weight: 700; color: var(--royal-700); margin-right: auto; }
.crm-avatar { flex: none; width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 10.5px; font-weight: 800; background: var(--royal); color: var(--white); }
.crm-avatar.none { background: var(--gray-bg); color: var(--muted); }
.crm-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: var(--gray-bg); color: #3a4666; white-space: nowrap; }
.crm-chip .icon { width: 12px; height: 12px; }
.crm-chip.overdue { background: var(--red-bg); color: var(--red); }
.crm-chip.today { background: var(--amber-bg); color: var(--amber); }
.crm-chip.later { background: var(--royal-50); color: var(--royal-700); }
.crm-chip.reply { background: var(--green-bg); color: var(--green); }
.crm-stage-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 12px; background: color-mix(in srgb, var(--stage) 14%, white); color: color-mix(in srgb, var(--stage) 75%, black); white-space: nowrap; }
.crm-stage-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--stage); }
.crm-table td { vertical-align: middle; }
.crm-table td small { display: block; font-size: 12px; }
.crm-row { cursor: pointer; }
.crm-row:hover td { background: #f8faff; }
.crm-stage-select { padding: 4px 8px; font-size: 12.5px; max-width: 170px; }
.crm-bad { color: var(--red); font-weight: 700; }

.crm-drawer .crm-delete + .icon-btn { margin-left: 0; }
.crm-drawer .crm-delete { margin-left: auto; }
.crm-drawer-body { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 22px 28px; display: grid; gap: 18px; align-content: start; }
.crm-drawer-title h2 { margin: 0 0 4px; font-size: 21px; }
.crm-drawer-title p { margin: 0 0 4px; }
.crm-drawer-title a { font-size: 13px; font-weight: 600; }
.crm-drawer h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.crm-details h4 { grid-column: 1 / -1; margin: 0; }
.crm-quick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 14px; background: var(--royal-50); border: 1px solid var(--royal-100); border-radius: var(--radius); }
.crm-quick label, .crm-details label { display: grid; gap: 5px; font-size: 12.5px; font-weight: 600; color: #3a4666; }
.crm-follow { padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); }
.crm-follow-row { display: grid; grid-template-columns: 210px 1fr; gap: 8px; }
.crm-follow-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.crm-follow-quick .primary { margin-left: auto; }
.crm-composer { display: grid; grid-template-columns: 120px 1fr auto; gap: 8px; align-items: start; margin-bottom: 10px; }
.crm-composer textarea { min-height: 40px; resize: vertical; }
.crm-timeline { display: grid; }
.crm-event { display: grid; grid-template-columns: 30px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.crm-event:last-child { border-bottom: 0; }
.crm-event .dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--royal-50); color: var(--royal); }
.crm-event.status_change .dot { background: #eef6ff; color: #1f6feb; }
.crm-event.reply .dot { background: var(--green-bg); color: var(--green); }
.crm-event.follow_up .dot { background: var(--amber-bg); color: var(--amber); }
.crm-event.call .dot, .crm-event.meeting .dot { background: #f3efff; color: #6b46c1; }
.crm-event p { margin: 3px 0 2px; font-size: 13.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.crm-event small { font-size: 12px; }

.crm-form-dialog { width: min(620px, calc(100vw - 32px)); }
.crm-form-dialog h3 { margin: 0; }
.crm-form-dialog .stack { border: 0; padding: 0; gap: 12px; }
.crm-form-dialog .stack p { margin: 0; }
.crm-form-dialog .form-actions { justify-content: flex-end; }
.crm-form-dialog label { display: grid; gap: 5px; font-size: 12.5px; font-weight: 600; }

.crm-followups { display: grid; gap: 14px; }
.crm-follow-group h3 { margin: 0 0 8px; font-size: 14px; }
.crm-follow-group.overdue h3 { color: var(--red); }
.crm-follow-group.today h3 { color: var(--amber); }
.crm-follow-item { display: grid; grid-template-columns: 130px 1fr auto auto; gap: 12px; align-items: center; width: 100%; text-align: left; padding: 10px 8px; background: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; font-weight: 400; color: var(--ink); }
.crm-follow-item:last-child { border-bottom: 0; }
.crm-follow-item:hover:not(:disabled) { background: #f8faff; border-color: var(--line); }
.crm-follow-item strong { display: block; font-size: 13.5px; }
.crm-follow-item small { display: block; font-size: 12.5px; }
.crm-funnel-row { grid-template-columns: minmax(90px, 30%) 1fr auto; }
.crm-recent-item { width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; font-weight: 400; color: var(--ink); }
.crm-recent-item:hover:not(:disabled) { background: #f8faff; }
.crm-status-list { display: grid; gap: 6px; margin-bottom: 12px; }
.crm-status-row { display: grid; grid-template-columns: 38px 1fr 90px 64px auto auto auto auto; gap: 6px; align-items: center; padding: 6px; border: 1px solid var(--line); border-radius: 10px; }
.crm-status-row.hidden-stage { opacity: .55; background: #fafbfd; }
.crm-status-row input[type=color], .crm-status-add input[type=color] { width: 38px; height: 32px; padding: 2px; border-radius: 8px; cursor: pointer; }
.crm-status-row .icon-btn { padding: 5px; }
.crm-status-row .flip { transform: rotate(180deg); }
.crm-status-add { display: grid; grid-template-columns: 1fr 38px 100px auto; gap: 6px; align-items: center; }
.crm-toggle { display: grid; grid-template-columns: 18px 1fr; gap: 10px; align-items: start; padding: 10px 0; font-weight: 400; cursor: pointer; }
.crm-toggle input { width: 16px; height: 16px; margin: 2px 0 0; }
.crm-toggle strong { display: block; font-size: 13.5px; }
.crm-toggle small { display: block; font-size: 12.5px; margin-top: 2px; }
#crm-settings-form { gap: 0; }
.crm-recent { max-height: 420px; overflow-y: auto; }

@media (max-width: 760px) {
  .crm-board { grid-auto-columns: 82vw; }
  .crm-column { max-height: none; }
  .crm-follow-row, .crm-quick, .crm-composer { grid-template-columns: 1fr; }
  .crm-follow-item { grid-template-columns: 1fr auto; }
  .crm-follow-item > .crm-stage-pill { display: none; }
  .crm-status-row { grid-template-columns: 38px 1fr auto auto; }
  .crm-status-row select, .crm-status-row > span { display: none; }
}

/* Mailbox providers, health and pauses */
.mailbox-row.paused { border-color: var(--red); background: var(--red-bg); }
.mailbox-alert { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0 4px; padding: 8px 12px; border-radius: 9px; background: var(--amber-bg); color: #7a4b00; font-size: 12.5px; }
.mailbox-alert span { flex: 1; min-width: 180px; }
.mailbox-alert.danger { background: var(--red-bg); color: var(--red); margin-bottom: 12px; }
.connect-mailbox { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.connect-mailbox h4 { margin: 0 0 10px; }
.connect-mailbox .segmented { flex-wrap: wrap; margin-bottom: 6px; }
.connect-panel { padding-top: 6px; }
.smtp-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin-top: 10px; }
.smtp-form label { display: grid; gap: 4px; font-size: 12.5px; font-weight: 600; }
.smtp-form .wide { grid-column: 1 / -1; }
.smtp-edit { margin: -4px 0 8px; padding: 12px 14px; border: 1px dashed var(--royal-100); border-radius: 10px; }
@media (max-width: 720px) { .smtp-form { grid-template-columns: 1fr; } }

/* Usage credits */
.credits-panel { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.credits-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.credits-top h3 { margin: 2px 0 4px; font-size: 26px; }
.credit-packs { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-top: 10px; }
.credit-pack { display: grid; gap: 4px; padding: 12px 14px; border: 1px solid var(--royal-100); border-radius: 10px; background: #fafbff; }
.credit-pack button { justify-self: start; margin-top: 4px; }
.credit-history { margin-top: 12px; display: grid; gap: 2px; max-height: 280px; overflow: auto; }
.credit-row { display: grid; grid-template-columns: 1fr auto 70px; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.credit-row strong { text-align: right; }
.credit-row .pos { color: var(--green); }
.credit-row .neg { color: var(--red); }
.switch.muted-switch { opacity: .6; }

/* Buying signals */
.signal-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.signal-chip { display: inline-flex; align-items: center; gap: 3px; padding: 1px 8px; border-radius: 20px; background: #fff4e0; color: #8a5300; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.signal-chip.more { background: var(--gray-bg); color: #3a4666; }
.signal-box { margin: 10px 0; padding: 10px 14px; border-radius: 10px; background: #fffaf0; border: 1px solid #f5dfb5; }
.signal-box p { margin: 6px 0 0; font-size: 13px; }

.signal-pick { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.check-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.check-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--royal-100); border-radius: 20px; font-size: 12.5px; font-weight: 500; cursor: pointer; }
.check-chip input { width: auto; margin: 0; }

/* Meetings */
.meeting-dialog { width: min(520px, 94vw); }
.meeting-form { display: grid; gap: 10px; }
.meeting-form label { display: grid; gap: 4px; font-size: 12.5px; font-weight: 600; }
.meeting-form .check-line { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.meeting-form .check-line input { width: auto; margin: 0; }
.slot-picks { display: flex; flex-wrap: wrap; gap: 6px; }
.slot-pick { border-radius: 20px; font-size: 12.5px; padding: 5px 12px; }
.slot-pick[aria-pressed="true"] { background: var(--royal); color: var(--white); border-color: var(--royal); }
.meeting-note { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0; padding: 10px 14px; border-radius: 10px; background: var(--green-bg); color: var(--green); font-weight: 600; font-size: 13px; }
.meeting-note .icon { width: 16px; height: 16px; }

.crm-meetings { margin: 16px 0; }
.crm-meetings-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.crm-meetings-head h4 { margin: 0; }
.crm-meeting { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; background: var(--white); }
.crm-meeting > div:first-child { display: grid; gap: 2px; min-width: 0; }
.crm-meeting .link-btn { justify-self: start; padding: 0; }
.crm-meeting-side { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
.crm-meeting.cancelled { opacity: .65; }

/* Funnel report */
.funnel { display: grid; gap: 6px; margin-bottom: 18px; }
.funnel-row { display: grid; grid-template-columns: 150px 1fr 130px 120px; align-items: center; gap: 12px; font-size: 13px; }
.funnel-bar { height: 22px; border-radius: 6px; background: var(--royal-50, #eef2ff); overflow: hidden; }
.funnel-bar span { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--royal, #2541b2), #5b7cff); }
.funnel-count { text-align: right; }
.funnel-sub { margin: 6px 0 8px; font-size: 13.5px; }
#funnel-campaigns td:first-child { min-width: 190px; }
@media (max-width: 720px) { .funnel-row { grid-template-columns: 1fr 90px; } .funnel-bar, .funnel-rate { grid-column: 1 / -1; } }
