:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #16181d;
  --muted: #667085;
  --line: #e4e7ec;
  --brand: #2557d6;
  --brand-ink: #ffffff;
  --ok: #12805c;
  --warn: #b54708;
  --bad: #c01048;
  --radius: 10px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color: var(--ink);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; display: flex; min-height: 100vh; background: var(--bg); }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 28px 0 12px; }
h3 { margin: 0 0 6px; font-size: 16px; }
h4 { margin: 18px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.muted { color: var(--muted); margin: 4px 0 10px; }

.sidebar { width: 230px; background: #101828; color: #d0d5dd; padding: 20px 14px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; }
.brand { color: #fff; font-weight: 700; font-size: 18px; margin-bottom: 18px; }
.tag { font-size: 10px; background: #344054; padding: 2px 6px; border-radius: 6px; vertical-align: middle; }
.ws-label { font-size: 11px; text-transform: uppercase; color: #98a2b3; }
.sidebar select { width: 100%; }
.sidebar .link { background: none; color: #84adff; padding: 4px 0; text-align: left; }
nav { display: flex; flex-direction: column; margin-top: 16px; gap: 2px; }
nav a { padding: 8px 10px; border-radius: 8px; cursor: pointer; color: #d0d5dd; }
nav a:hover { background: #1d2939; }
nav a.active { background: #2557d6; color: #fff; }
.system { margin-top: auto; font-size: 12px; color: #98a2b3; line-height: 1.6; }
.me { border-top: 1px solid #344054; margin-top: 10px; padding-top: 10px; color: #d0d5dd; }
.me .warn { color: #fec84b; }
body.booting .sidebar, body.booting main { visibility: hidden; }

main { flex: 1; padding: 28px 32px; max-width: 1200px; }
.head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.head h1 { margin: 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

button { background: var(--brand); color: var(--brand-ink); border: 0; border-radius: 8px; padding: 8px 14px; font: inherit; cursor: pointer; font-weight: 600; }
button:hover { filter: brightness(1.08); }
button.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-link { display: inline-block; padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 600; background: #fff; }
.btn-link:hover { background: #f9fafb; }
button.small { padding: 5px 10px; font-size: 12px; }
button.danger { background: transparent; color: var(--bad); border: 1px solid #fda29b; }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); width: 100%; }
textarea { min-height: 64px; resize: vertical; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 500; }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); }
label.check input { width: auto; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; margin-top: 14px; }
.form { margin-bottom: 18px; display: flex; flex-direction: column; gap: 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.checks { display: flex; flex-wrap: wrap; gap: 14px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tile .v { font-size: 24px; font-weight: 700; margin-top: 4px; }
.tile .l { color: var(--muted); font-size: 12px; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: #eef2f6; color: #344054; }
.badge.active, .badge.running, .badge.replied, .badge.interested, .badge.meeting_booked { background: #dcfae6; color: var(--ok); }
.badge.paused, .badge.needs_login, .badge.invited, .badge.draft, .badge.not_now { background: #fef0c7; color: var(--warn); }
.badge.owner { background: #e0eaff; color: var(--brand); }
.badge.restricted, .badge.failed, .badge.not_interested { background: #fee4e2; color: var(--bad); }

.meter { margin: 6px 0; }
.meter .bar { height: 6px; background: #eef2f6; border-radius: 4px; overflow: hidden; }
.meter .fill { height: 100%; background: var(--brand); }
.meter .txt { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.meta { font-size: 12px; color: var(--muted); margin: 6px 0; word-break: break-all; }
code { background: #f2f4f7; padding: 2px 6px; border-radius: 6px; font-size: 12px; word-break: break-all; }
.reason { color: var(--bad); font-size: 12px; margin: 6px 0; }

.step { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; display: grid; grid-template-columns: 150px 110px 1fr auto; gap: 10px; align-items: start; background: #fcfcfd; }
.step .kind { font-weight: 600; padding-top: 8px; }
.step .ai { flex-direction: row; gap: 6px; align-items: center; margin-top: 6px; }
.step .ai input { width: auto; }

.table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 13px; }
.table th { background: #f9fafb; color: var(--muted); font-weight: 600; font-size: 12px; }
.table td.detail { max-width: 420px; color: var(--muted); }
.table a { color: var(--brand); text-decoration: none; }

.msg { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 10px; }
.msg .top { display: flex; justify-content: space-between; gap: 10px; }
.msg .text { margin: 8px 0; white-space: pre-wrap; }
.msg.out { background: #f5f8ff; }

.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 10px 0; text-align: center; }
.stats div { background: #f9fafb; border-radius: 8px; padding: 6px 2px; }
.stats b { display: block; font-size: 16px; }
.stats span { font-size: 11px; color: var(--muted); }

.modal { position: fixed; inset: 0; background: rgba(16, 24, 40, .5); display: flex; align-items: center; justify-content: center; }
.modal-box { background: #fff; border-radius: 12px; padding: 20px 22px; max-width: 560px; width: 92%; }
.toast { position: fixed; bottom: 20px; right: 20px; background: #101828; color: #fff; padding: 10px 14px; border-radius: 8px; max-width: 420px; }
.toast.error { background: var(--bad); }
.empty { color: var(--muted); padding: 30px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); }

.auth-page { align-items: center; justify-content: center; }
.auth-box { width: 380px; max-width: 92%; }
.auth-box .brand { color: var(--ink); text-align: center; }
.auth-box .tag { color: #fff; }
.auth-box .reason { text-align: center; }
button:disabled { opacity: .6; cursor: default; }

.badge.sn { background: #e0eaff; color: #2557d6; }
.preview { background: #f9fafb; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px; margin: 4px 0; white-space: pre-wrap; }
.preview:empty { display: none; }

.modal.live { z-index: 50; }
.live-box { background: #fff; border-radius: 12px; padding: 12px 14px; width: min(1320px, 96vw); max-height: 96vh; display: flex; flex-direction: column; gap: 8px; }
.live-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.live-screen { position: relative; background: #0b1220; border-radius: 8px; overflow: hidden; outline: none; display: flex; align-items: center; justify-content: center; min-height: 300px; }
.live-screen:focus { box-shadow: 0 0 0 2px var(--brand); }
.live-screen img { display: block; width: 100%; height: auto; max-height: calc(96vh - 120px); object-fit: contain; cursor: default; user-select: none; }
.live-screen.view-only img { cursor: not-allowed; }
.live-empty { position: absolute; color: #d0d5dd; font-size: 14px; padding: 20px; text-align: center; }
.live-foot { margin: 0; }

.fu { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; background: #fcfcfd; display: flex; flex-direction: column; gap: 8px; }
.fu textarea { min-height: 60px; }
.small-input { width: 80px !important; }
.fu select { width: auto; }
.steps { border-top: 1px solid var(--line); margin: 8px 0 4px; padding-top: 6px; }
.step-line { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; padding: 2px 0; }
.step-line b { white-space: nowrap; }
.msg.in { background: #f0fdf4; }
.modal-box { max-height: 90vh; overflow: auto; }

/* Connect LinkedIn pop-up (HeyReach-style) */
.li-mark { display: inline-block; background: #0a66c2; color: #fff; font-weight: 800; border-radius: 4px; padding: 0 5px; font-size: 13px; line-height: 18px; margin-right: 2px; }
button .li-mark { background: #fff; color: #2557d6; }
.li-shell { display: grid; grid-template-columns: 260px 1fr; width: min(900px, 96vw); max-height: 92vh; background: #fff; border-radius: 14px; overflow: hidden; }
.li-side { background: linear-gradient(160deg, #1d1b4b, #3b2a7a); color: #e9e7ff; padding: 28px 22px; display: flex; flex-direction: column; gap: 10px; }
.li-side-title { font-size: 24px; font-weight: 800; color: #fff; }
.li-side ul { padding-left: 18px; line-height: 1.8; margin: 0; }
.li-main { padding: 18px 22px; overflow: auto; display: flex; flex-direction: column; gap: 10px; }
.li-main h3 { margin: 4px 0; }
.li-dots i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #d0d5dd; margin: 0 2px; }
.li-dots i.on { background: #2557d6; }
.li-option { display: block; width: 100%; text-align: left; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin: 8px 0; font-weight: 400; line-height: 1.6; }
.li-option:hover { border-color: #2557d6; filter: none; }
.li-option.recommended { border: 2px solid #22c55e; }
.tag-rec { background: #eef2ff; color: #4338ca; border-radius: 999px; padding: 1px 8px; font-size: 11px; font-weight: 600; }
.li-stepcard { display: flex; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; color: var(--ink); text-decoration: none; }
.li-stepcard.col { flex-direction: column; align-items: stretch; }
a.li-stepcard:hover { border-color: #2557d6; }
.li-stepcard .n { width: 24px; height: 24px; border-radius: 6px; background: #f2f4f7; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
#li-cookies { min-height: 90px; font-family: ui-monospace, monospace; font-size: 12px; }
.li-toggle { flex-direction: row; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color: var(--ink); font-weight: 400; }
.li-toggle input { width: auto; margin-top: 4px; }
.li-step { padding: 14px; background: #f5f8ff; border-radius: 8px; }
.li-step.warn { background: #fff8e6; }
.li-step.bad { background: #fee4e2; color: var(--bad); }
.who { display: flex; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 10px; margin-top: 10px; }
.who .avatar { width: 44px; height: 44px; border-radius: 50%; background: #e0eaff; color: #2557d6; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px; }
.done-box { text-align: center; padding: 40px 10px; }
.done-box .big { font-size: 20px; font-weight: 700; margin-top: 6px; }
@media (max-width: 760px) { .li-shell { grid-template-columns: 1fr; } .li-side { display: none; } }

.pin-boxes { display: flex; gap: 8px; margin: 10px 0; }
.pin-boxes input { width: 48px !important; height: 52px; text-align: center; font-size: 22px; }

/* ---------- Phase 1: shared bits ---------- */
button.link { background: none; border: 0; color: var(--brand); padding: 0; font-weight: 600; font-size: 12px; }
button.link:hover { text-decoration: underline; filter: none; }
.modal-box.wide { max-width: 1100px; width: 96%; }
.actions.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.inline-label { flex-direction: row; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--ink); }
.inline-label select { width: auto; max-width: 100%; }
.narrow { max-width: 220px; }
.warn-note { background: #fffaeb; border: 1px solid #fedf89; color: #93370d; border-radius: 8px; padding: 8px 10px; font-size: 12px; margin: 6px 0; }
.bad { color: var(--bad); font-weight: 600; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: #e0eaff; color: var(--brand); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; flex: none; }
.avatar.sm { width: 28px; height: 28px; font-size: 13px; }
.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; background: #eef2f6; color: #344054; }
.chip.st-working { background: #dcfae6; color: var(--ok); }
.chip.st-waiting, .chip.st-off_hours, .chip.st-idle { background: #eef2f6; color: #475467; }
.chip.st-paused, .chip.st-needs_login { background: #fef0c7; color: var(--warn); }
.chip.st-restricted { background: #fee4e2; color: var(--bad); }
.badge.warmup { background: #f4ebff; color: #6941c6; }
.badge.person { background: #e0eaff; color: var(--brand); }
.badge.company { background: #f2f4f7; color: #344054; }

/* ---------- Sender table ---------- */
.senders { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-top: 12px; }
.sender { display: grid; grid-template-columns: minmax(200px, 1.2fr) minmax(190px, 1.1fr) minmax(240px, 1.4fr) auto; gap: 16px; padding: 14px 16px; border-bottom: 1px solid var(--line); align-items: start; }
.sender:last-child { border-bottom: 0; }
.sender.head-row { padding: 9px 16px; background: #f9fafb; color: var(--muted); font-size: 12px; font-weight: 600; border-radius: var(--radius) var(--radius) 0 0; }
.s-who { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.s-who .meta { margin: 2px 0; word-break: normal; }
.s-who a { color: var(--brand); text-decoration: none; }
.s-activity { font-size: 12px; color: var(--ink); margin-top: 6px; line-height: 1.4; }
.meter.req { margin: 0 0 8px; }
.meter.req .bar { height: 8px; }
.meter.req .txt { color: var(--ink); }
.meter.req .txt + .bar + .txt { color: var(--muted); margin-top: 3px; }
.minis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.mini { font-size: 11px; color: var(--muted); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mini b { color: var(--ink); font-size: 12px; }
.mini i { display: block; height: 3px; background: #eef2f6; border-radius: 2px; overflow: hidden; }
.mini i s { display: block; height: 100%; background: #84adff; text-decoration: none; }
.s-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
details.menu { position: relative; }
details.menu summary { list-style: none; cursor: pointer; border: 1px solid var(--line); border-radius: 8px; padding: 3px 10px; font-weight: 700; user-select: none; }
details.menu summary::-webkit-details-marker { display: none; }
.menu-list { position: absolute; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(16, 24, 40, .12); padding: 6px; display: flex; flex-direction: column; gap: 4px; z-index: 20; min-width: 190px; }
.menu-list button { text-align: left; }

/* ---------- Side panel ---------- */
.drawer-wrap { position: fixed; inset: 0; background: rgba(16, 24, 40, .35); z-index: 40; display: flex; justify-content: flex-end; }
.drawer { background: #fff; width: min(440px, 100vw); height: 100%; overflow: auto; padding: 18px 20px; box-shadow: -8px 0 24px rgba(16, 24, 40, .15); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.lim { padding: 10px 0; border-bottom: 1px solid var(--line); }
.lim-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-weight: 600; }
.lim-top input { width: 80px; }
.lim input[type=range] { padding: 0; border: 0; margin-top: 6px; accent-color: var(--brand); }
.grid.two { grid-template-columns: 1fr 1fr; }

/* ---------- Wizard ---------- */
.wiz { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.wiz-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.wiz-name input { font-size: 16px; padding: 10px 12px; }
.wiz-sec h2 { margin: 0 0 12px; display: flex; align-items: center; gap: 10px; }
.wiz-sec h2 .n { width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; }
.wiz-summary { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 8px; }
.wiz-summary h3 { margin: 0; }
.sum-sentence { font-size: 15px; line-height: 1.45; margin: 0; font-weight: 600; }
.sum-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.sum-list b { display: block; color: var(--ink); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.sum-issues { background: #fef3f2; border: 1px solid #fecdca; color: #b42318; border-radius: 8px; padding: 8px 10px; font-size: 12px; display: flex; flex-direction: column; gap: 3px; }
.sum-ok { color: var(--ok); font-weight: 600; }
.wiz-summary .actions button { flex: 1; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.seg label { flex-direction: row; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; color: var(--ink); cursor: pointer; }
.seg label:has(input:checked) { border-color: var(--brand); background: #f5f8ff; color: var(--brand); }
.seg input { width: auto; }
.pick { flex-direction: row; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; color: var(--ink); cursor: pointer; }
.pick:has(input:checked) { border-color: var(--brand); background: #f5f8ff; }
.pick input { width: auto; }
.pick-main { flex: 1; min-width: 0; }
.pick-main .meta { display: block; margin: 3px 0 0; word-break: normal; }
.pick .cap { white-space: nowrap; font-size: 12px; color: var(--muted); }
.pick .cap b { font-size: 16px; color: var(--ink); }
.days { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.day { background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-weight: 600; }
.day.on { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---------- Sequence builder ---------- */
.sq-templates { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 14px; }
.sq-templates .meta { flex-basis: 100%; word-break: normal; }
.chip-btn { background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; font-size: 12px; font-weight: 600; }
.chip-btn.on { border-color: var(--brand); background: #f5f8ff; color: var(--brand); }
.sq { display: flex; flex-direction: column; gap: 8px; }
.sq-col-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.sq-step, .sq-invite { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fcfcfd; display: flex; flex-direction: column; gap: 8px; }
.sq-invite { border: 2px solid #b2ccff; background: #f5f8ff; }
.sq-step-head { display: flex; align-items: center; gap: 8px; }
.sq-num { width: 22px; height: 22px; border-radius: 6px; background: #eef2f6; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex: none; }
.sq-num.in { background: #0a66c2; color: #fff; }
.sq-type { width: auto; font-weight: 600; }
.sq-tools { margin-left: auto; display: flex; gap: 2px; }
button.icon { background: none; color: var(--muted); border: 1px solid transparent; padding: 2px 7px; font-size: 13px; }
button.icon:hover:not(:disabled) { border-color: var(--line); color: var(--ink); filter: none; }
button.icon:disabled { opacity: .3; }
.sq-inline { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.sq-inline select { width: auto; padding: 5px 8px; }
input.tiny { width: 64px; padding: 5px 8px; }
.sq-ver { display: flex; flex-direction: column; gap: 4px; }
.sq-ver-head { display: flex; justify-content: space-between; align-items: center; }
.sq-ver-head .ver { font-size: 12px; font-weight: 700; color: var(--ink); }
.sq textarea { min-height: 80px; }
.sq textarea.short { min-height: 44px; }
.sq-under { display: flex; justify-content: flex-end; margin-top: -2px; }
.sq-count { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sq-count.over { color: var(--bad); font-weight: 700; }
.sq-toolbar { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.sq-toolbar .muted { margin: 0 2px 0 0; font-size: 12px; }
button.var { background: #eef4ff; color: #3538cd; border: 1px solid #c7d7fe; border-radius: 6px; padding: 2px 8px; font-size: 11px; font-weight: 600; }
.sq-nonote { font-size: 13px; color: var(--muted); }
.sq-ai { display: flex; gap: 6px; }
.sq-preview { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.sq-preview .pv { border-top: 1px solid var(--line); padding-top: 6px; }
.sq-preview .pv .meta { margin: 0 0 2px; word-break: normal; }
.pv-text { white-space: pre-wrap; font-size: 13px; }
.sq-rules { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: #475467; background: #f9fafb; border-radius: 8px; padding: 8px 10px; }
.sq-branches { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
.sq-branch { border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.sq-branch.ok { background: #f6fef9; border: 1px solid #abefc6; }
.sq-branch.ok .sq-col-title { color: var(--ok); }
.sq-branch.no { background: #fcfcfd; border: 1px dashed #d0d5dd; }
.sq-empty { font-size: 12px; color: var(--muted); padding: 6px 2px; }
.sq-add { align-self: flex-start; }

/* ---------- Campaign funnel ---------- */
.cards.wide { grid-template-columns: repeat(auto-fill, minmax(min(480px, 100%), 1fr)); }
.funnel { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 4px; }
.frow .fl { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; }
.frow .fn { color: var(--muted); text-align: right; }
.frow .fn b { color: var(--ink); }
.frow.invite .fl > span:first-child { font-weight: 700; }
.fbar { height: 6px; background: #eef2f6; border-radius: 4px; overflow: hidden; margin-top: 3px; }
.fbar i { display: block; height: 100%; background: #84adff; }
.fbar.invite i { background: var(--brand); }
.rate { background: #dcfae6; color: var(--ok); border-radius: 999px; padding: 0 6px; font-weight: 700; }
.fvars { font-size: 11px; color: var(--muted); padding-left: 8px; }
.fvars .win { color: var(--ok); }
.fbranches { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.fbranch { border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fbranch.ok { background: #f6fef9; }
.fbranch.no { background: #f9fafb; }
.fbt { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.fbranch.ok .fbt { color: var(--ok); }
.fbranch .frow .fl { flex-direction: column; gap: 0; }
.fbranch .frow .fn { text-align: left; }
.ftotals { display: flex; gap: 16px; font-size: 13px; border-top: 1px solid var(--line); padding-top: 8px; }
.muted.small { font-size: 12px; margin: 0; }

/* ---------- Narrow screens (phones, small laptops) ---------- */
@media (max-width: 1100px) {
  .sender { grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr); }
  .sender.head-row { display: none; }
  .s-actions { justify-content: flex-start; }
}
@media (max-width: 1000px) {
  .wiz { grid-template-columns: 1fr; }
  .wiz-summary { position: sticky; bottom: 0; top: auto; z-index: 5; box-shadow: 0 -6px 18px rgba(16, 24, 40, .1); max-height: 55vh; overflow: auto; }
}
@media (max-width: 760px) {
  body { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; padding: 12px; gap: 4px; }
  .brand { margin-bottom: 6px; }
  nav { flex-direction: row; overflow-x: auto; margin-top: 6px; padding-bottom: 4px; }
  nav a { white-space: nowrap; }
  #system { display: none; }
  .me { margin-top: 4px; padding-top: 6px; }
  main { padding: 16px 12px; max-width: 100%; }
  .head { flex-wrap: wrap; gap: 8px; }
  .sender { grid-template-columns: 1fr; gap: 10px; }
  .sq-branches, .fbranches { grid-template-columns: 1fr; }
  .minis { grid-template-columns: repeat(3, 1fr); }
  .table { display: block; overflow-x: auto; }
  .wiz-summary { max-height: 45vh; }
  .sum-list { display: none; }
  .pick { flex-wrap: wrap; }
}
label.check .muted { margin: 0; }
@media (max-width: 760px) {
  .wiz-summary { padding: 10px 12px; gap: 6px; }
  .wiz-summary h3, .wiz-summary .warn-note, .sum-issues > div { display: none; }
  .sum-sentence { font-size: 13px; }
  .wiz-summary .actions { margin-top: 2px; }
}

/* ---------- Unibox (Inbox) ---------- */
.nav-count { display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: #f04438; color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
main:has(> section[data-view="inbox"]:not([hidden])) { max-width: none; padding-top: 16px; padding-bottom: 16px; }
.ub { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); height: calc(100vh - 32px); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.ub-list { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); }
.ub-list-head { padding: 14px 14px 10px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.ub-list-head h1 { margin: 0; font-size: 20px; }
.ub-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.ub-tab { background: #fff; color: #344054; border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.ub-tab .n { color: var(--muted); font-weight: 600; }
.ub-tab.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.ub-tab.on .n { color: #dbe5ff; }
.ub-selects { display: flex; gap: 6px; }
.ub-selects select { padding: 6px 8px; font-size: 12px; min-width: 0; }
.ub-rows { flex: 1; overflow-y: auto; min-height: 0; }
.ub-row { display: flex; gap: 10px; padding: 11px 14px; border-bottom: 1px solid #f2f4f7; cursor: pointer; outline: none; }
.ub-row:hover { background: #f9fafb; }
.ub-row:focus-visible { box-shadow: inset 0 0 0 2px var(--brand); }
.ub-row.sel { background: #eef4ff; }
.ub-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ub-row-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.ub-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.ub-row.unread .ub-name { font-weight: 800; }
.ub-row.unread .avatar { box-shadow: 0 0 0 2px var(--brand); }
.ub-time { font-size: 11px; color: var(--muted); white-space: nowrap; }
.ub-row.unread .ub-time { color: var(--brand); font-weight: 700; }
.ub-company { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ub-snip { font-size: 13px; color: #475467; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ub-row.unread .ub-snip { color: var(--ink); font-weight: 600; }
.ub-snip .you { color: var(--muted); font-weight: 500; }
.ub-row-foot { display: flex; align-items: center; gap: 6px; margin-top: 2px; min-width: 0; }
.ub-sender { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ub-row-foot .star { margin-left: auto; }
button.star { background: none; border: 0; padding: 0 4px; font-size: 17px; line-height: 1; color: #98a2b3; font-weight: 400; }
button.star.on { color: #f5a623; }
button.star:hover { color: #f5a623; filter: none; }
.lab { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; background: #eef2f6; color: #475467; }
.lab.interested { background: #dcfae6; color: #067647; }
.lab.meeting_booked { background: #d1e0ff; color: #2448b8; }
.lab.not_now { background: #fef0c7; color: #b54708; }
.lab.not_interested { background: #eaecf0; color: #475467; }
.lab.unclear { background: #f2f4f7; color: #667085; font-weight: 600; }
.ub-more { padding: 12px; text-align: center; }
.ub-wait { color: var(--muted); padding: 24px; text-align: center; }
.ub-empty { margin: 16px; }

.ub-conv { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: #fcfcfd; }
.ub-none { margin: auto; color: var(--muted); padding: 30px; text-align: center; }
.ub-thread { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.ub-head { padding: 12px 16px; border-bottom: 1px solid var(--line); background: #fff; display: flex; flex-direction: column; gap: 10px; }
.ub-head-top { display: flex; gap: 12px; align-items: center; }
.ub-back { display: none; }
.ub-who { flex: 1; min-width: 0; }
.ub-who-name { font-weight: 700; font-size: 16px; }
.ub-who-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.ub-head .star { font-size: 22px; }
.ub-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ub-tools select { width: auto; padding: 4px 8px; font-size: 12px; }
.btn-link.small { padding: 5px 10px; font-size: 12px; }
.spin { display: inline-block; width: 11px; height: 11px; border: 2px solid #c7d7fe; border-top-color: var(--brand); border-radius: 50%; animation: ubspin .8s linear infinite; vertical-align: -1px; }
@keyframes ubspin { to { transform: rotate(360deg); } }
.ub-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.ub-day { align-self: center; font-size: 11px; color: var(--muted); background: #f2f4f7; border-radius: 999px; padding: 2px 10px; margin: 6px 0 2px; }
.bub { max-width: min(560px, 80%); padding: 9px 12px; border-radius: 14px; display: flex; flex-direction: column; gap: 4px; }
.bub.in { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bub.out { align-self: flex-end; background: #e0eaff; border-bottom-right-radius: 4px; }
.bub-text { white-space: pre-wrap; word-break: break-word; line-height: 1.45; }
.bub-meta { display: flex; gap: 8px; align-items: center; justify-content: flex-end; font-size: 11px; color: var(--muted); flex-wrap: wrap; }
.bub.in .bub-meta { justify-content: flex-start; }
.ub-reply { border-top: 1px solid var(--line); background: #fff; padding: 10px 14px 12px; display: flex; flex-direction: column; gap: 8px; }
.ub-cant { background: #fffaeb; border: 1px solid #fedf89; color: #93370d; border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.ub-suggest { display: flex; flex-wrap: wrap; gap: 6px; }
.ub-suggest .chip-btn.ai { border-color: #c7d7fe; color: #3538cd; background: #f5f8ff; }
.ub-suggest .chip-btn:disabled { opacity: .5; }
#ub-text { min-height: 72px; max-height: 40vh; }
.ub-err { margin: 0; }
.ub-send-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.ub-send-row .muted { margin: 0; }

@media (max-width: 760px) {
  main:has(> section[data-view="inbox"]:not([hidden])) { padding: 8px; }
  main:has(> section[data-view="inbox"]:not([hidden])) { min-width: 0; width: 100%; }
  .ub { grid-template-columns: minmax(0, 1fr); height: auto; min-height: 70vh; border-radius: 8px; }
  .ub-list, .ub-list-head, .ub-tabs { min-width: 0; }
  .ub-list { border-right: 0; }
  .ub-rows { overflow: visible; }
  .ub-conv { display: none; }
  .ub-selects select { flex: 1 1 0; width: 0; }
  /* Open conversation: full screen with a back button */
  .ub.open .ub-conv { display: flex; position: fixed; inset: 0; z-index: 30; }
  .ub-back { display: inline-block; }
  .ub-head { padding: 10px 12px; }
  .ub-head-top .avatar { display: none; }
  .ub-msgs { padding: 12px 10px; }
  .bub { max-width: 88%; }
  .ub-reply { padding: 8px 10px calc(10px + env(safe-area-inset-bottom)); }
  body.ub-full { overflow: hidden; }
}
#modal { z-index: 45; }
.toast { z-index: 60; }
