/* Hybrid CRM — sales desk for ISP / LCO partner onboarding */
@font-face { font-family: "Plex"; src: url("../fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex"; src: url("../fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Plex"; src: url("../fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Plex"; src: url("../fonts/ibm-plex-sans-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --ink: #17212b;
  --ink-2: #4a5866;
  --ink-3: #75828f;
  --paper: #f2f4f6;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --line: #dde3e9;
  --line-2: #edf0f3;
  --nav: #142131;
  --nav-2: #1c2c3f;
  --nav-ink: #b9c6d3;
  --accent: #1d5fd0;
  --accent-2: #174ea9;
  --accent-soft: #e8f0fd;
  --signal: #b77700;          /* attention: due / overdue text */
  --signal-bg: #fff4dc;
  --danger: #c43535;
  --danger-bg: #fdecec;
  --ok: #10794f;
  --ok-bg: #e4f5ec;
  --wa: #17864a;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(20, 33, 49, .06), 0 2px 8px rgba(20, 33, 49, .04);
  --font: "Plex", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 14px/1.5 var(--font); color: var(--ink); background: var(--paper); font-variant-numeric: tabular-nums; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0 0 .6em; }
small, .small { font-size: 12.5px; }
.muted { color: var(--ink-3); }
.soft { color: var(--ink-2); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.tight { gap: 6px; }
.spacer { flex: 1; }
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; }
.mb-2 { margin-bottom: 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
svg.i { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -3px; }
svg.i.lg { width: 20px; height: 20px; }
svg.i.fill { fill: currentColor; stroke: none; }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; background: linear-gradient(90deg, var(--nav) 232px, var(--paper) 232px); }
.who-cell { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.sidebar { background: var(--nav); color: var(--nav-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; }
.brand-mark { width: 30px; height: 30px; border-radius: 7px; background: linear-gradient(135deg, #2f7cf6, #1d5fd0); display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; }
.brand-name { font-weight: 600; font-size: 14.5px; line-height: 1.2; }
.brand-sub { font-size: 11.5px; color: #8796a6; }
.nav { padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 7px; color: var(--nav-ink); font-weight: 500; }
.nav a:hover { background: var(--nav-2); color: #fff; text-decoration: none; }
.nav a.active { background: #24384f; color: #fff; }
.nav a .count { margin-left: auto; font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 10px; background: #2b3e55; color: #dbe5ef; }
.nav a .count.alert { background: #f0b429; color: #3b2a00; }
.nav-sep { height: 1px; background: #233448; margin: 10px 12px; }
.nav-label { font-size: 11.5px; color: #7f8fa0; padding: 8px 20px 2px; }
.sidebar-foot { margin-top: auto; padding: 12px; border-top: 1px solid #233448; display: flex; align-items: center; gap: 10px; }
.sidebar-foot .who { min-width: 0; flex: 1; }
.sidebar-foot .who b { display: block; color: #fff; font-weight: 500; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-foot .who span { font-size: 11.5px; color: #8796a6; }
.sidebar-foot button, .sidebar-foot a.ic { background: none; border: 0; color: var(--nav-ink); padding: 6px; border-radius: 6px; cursor: pointer; display: inline-flex; }
.sidebar-foot button:hover, .sidebar-foot a.ic:hover { background: var(--nav-2); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.page-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 22px 28px 0; }
.page-head h1 { margin-right: auto; }
.page-head .sub { color: var(--ink-3); font-size: 13px; margin-top: 2px; }
.content { padding: 18px 28px 40px; }
.topbar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.bell { position: relative; }
.bell .dot-count { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 600; display: grid; place-items: center; border: 2px solid var(--paper); }
.notif-panel { position: absolute; right: 0; top: calc(100% + 8px); width: 360px; max-width: calc(100vw - 24px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(20, 33, 49, .16); z-index: 50; }
.notif-panel header { display: flex; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line-2); }
.notif-panel header b { margin-right: auto; }
.notif-list { max-height: 420px; overflow-y: auto; }
.notif-item { display: block; padding: 10px 14px; border-bottom: 1px solid var(--line-2); color: var(--ink); }
.notif-item:hover { background: var(--surface-2); text-decoration: none; }
.notif-item.unread { background: #f4f8ff; }
.notif-item .t { font-weight: 500; }
.notif-item .b { color: var(--ink-2); font-size: 12.5px; }
.notif-item .a { color: var(--ink-3); font-size: 11.5px; }

/* Mobile chrome */
.mobile-bar, .tabbar { display: none; }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; background: var(--paper); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 264px; z-index: 60; transform: translateX(-100%); transition: transform .2s ease; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(10, 18, 28, .45); }
  .mobile-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--nav); color: #fff; position: sticky; top: 0; z-index: 40; }
  .mobile-bar button, .mobile-bar a { background: none; border: 0; color: #fff; padding: 6px; display: inline-flex; border-radius: 6px; }
  .mobile-bar .t { font-weight: 600; margin-right: auto; }
  .page-head { padding: 16px 14px 0; }
  .page-head .topbar-actions .bell { display: none; }
  .content { padding: 14px 14px 96px; }
  .tabbar { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 1px solid var(--line); z-index: 40; padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 7px; color: var(--ink-3); font-size: 11px; font-weight: 500; position: relative; }
  .tabbar a.active { color: var(--accent); }
  .tabbar a:hover { text-decoration: none; }
  .tabbar .badge-n { position: absolute; top: 3px; left: calc(50% + 6px); background: var(--danger); color: #fff; border-radius: 9px; font-size: 10px; padding: 0 5px; line-height: 16px; }
}

/* ---------- Surfaces ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--line-2); }
.panel-head h2 { margin-right: auto; font-size: 14.5px; }
.panel-head .muted { font-size: 12.5px; }
.panel-body { padding: 16px; }
.panel-body.flush { padding: 0; }
.panel-foot { padding: 10px 16px; border-top: 1px solid var(--line-2); font-size: 13px; }
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-main { grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr); }
@media (max-width: 1100px) { .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols-main { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .cols-2, .cols-3 { grid-template-columns: 1fr; } }

/* KPI strip */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.kpi { padding: 14px 16px; border-left: 1px solid var(--line-2); min-width: 0; color: var(--ink); }
a.kpi:hover { background: var(--surface-2); text-decoration: none; }
.kpi:first-child { border-left: 0; }
.kpi .v { font-size: 26px; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; }
.kpi .l { color: var(--ink-2); font-size: 12.5px; }
.kpi .d { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.kpi.warn .v { color: var(--signal); }
.kpi.bad .v { color: var(--danger); }
.up { color: var(--ok); } .down { color: var(--danger); }
@media (max-width: 1200px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } .kpi:nth-child(4) { border-left: 0; } .kpi:nth-child(n+4) { border-top: 1px solid var(--line-2); } }
@media (max-width: 560px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpi { border-left: 0; border-top: 1px solid var(--line-2); } .kpi:nth-child(-n+2) { border-top: 0; } .kpi:nth-child(even) { border-left: 1px solid var(--line-2); } .kpi:nth-child(4) { border-left: 1px solid var(--line-2); } }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 500 13.5px/1 var(--font); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); border-color: #c9d1d9; text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-wa { background: var(--wa); border-color: var(--wa); color: #fff; }
.btn-wa:hover { background: #12703d; border-color: #12703d; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); border-color: #f0c4c4; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--line-2); border-color: transparent; }
.btn-sm { height: 28px; padding: 0 9px; font-size: 12.5px; gap: 5px; }
.btn-lg { height: 40px; padding: 0 16px; font-size: 14px; }
.btn-icon { width: 34px; padding: 0; }
.btn-icon.btn-sm { width: 28px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-group { display: inline-flex; }
.btn-group > .btn:not(:first-child), .btn-group > details:not(:first-child) > summary.btn { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; }
.btn-group > .btn:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
button.link:hover { text-decoration: underline; }

/* ---------- Forms ---------- */
label { font-weight: 500; font-size: 13px; color: var(--ink-2); display: block; margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=search], input[type=date], input[type=datetime-local], input[type=url], select, textarea {
  width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font: 400 13.5px var(--font); }
textarea { height: auto; min-height: 84px; padding: 8px 10px; line-height: 1.45; resize: vertical; }
select { padding-right: 28px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2375828f' stroke-width='2.5' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; }
select[multiple] { height: auto; min-height: 120px; padding: 4px; background-image: none; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(29, 95, 208, .14); }
.field { margin-bottom: 12px; min-width: 0; }
.field .hint { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.fields .span-2 { grid-column: span 2; }
@media (max-width: 560px) { .fields { grid-template-columns: 1fr; } .fields .span-2 { grid-column: auto; } }
.check { display: inline-flex; align-items: center; gap: 7px; font-weight: 400; color: var(--ink); margin: 0; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.chips-input { display: flex; flex-wrap: wrap; gap: 6px; }
.chips-input label { margin: 0; }
.chips-input input { position: absolute; opacity: 0; pointer-events: none; }
.chips-input span { display: inline-flex; align-items: center; height: 28px; padding: 0 10px; border: 1px solid var(--line); border-radius: 14px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); cursor: pointer; background: var(--surface); }
.chips-input input:checked + span { background: var(--accent-soft); border-color: #b8cdf3; color: var(--accent-2); }
.chips-input input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.presets { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.presets button { height: 26px; padding: 0 9px; border-radius: 13px; border: 1px solid var(--line); background: var(--surface-2); font: 500 12px var(--font); color: var(--ink-2); cursor: pointer; }
.presets button:hover { border-color: var(--accent); color: var(--accent); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { margin: 0; }
.seg span { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; font-size: 13px; font-weight: 500; color: var(--ink-2); cursor: pointer; border-left: 1px solid var(--line); }
.seg label:first-child span { border-left: 0; }
.seg input:checked + span { background: var(--accent-soft); color: var(--accent-2); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }
.seg a { display: inline-flex; align-items: center; white-space: nowrap; height: 32px; padding: 0 12px; font-size: 13px; font-weight: 500; color: var(--ink-2); border-left: 1px solid var(--line); }
.seg a:first-child { border-left: 0; }
.seg a.on { background: var(--accent-soft); color: var(--accent-2); }
.seg a:hover { text-decoration: none; background: var(--surface-2); }

/* ---------- Badges & chips ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 12px; font-weight: 500; white-space: nowrap; background: #eef1f4; color: #47525e; }
.badge .d { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.sq { border-radius: 5px; }
.c-blue { background: #e6effd; color: #1f53b0; }
.c-cyan { background: #e2f4f8; color: #0f6577; }
.c-green { background: #e5f5e9; color: #1d6b33; }
.c-emerald { background: #dcf3ea; color: #0b6a47; }
.c-violet { background: #efebfd; color: #5340b8; }
.c-pink { background: #fcebf3; color: #a3305f; }
.c-amber { background: #fdf2d8; color: #8a5a00; }
.c-orange { background: #fdebdf; color: #a3441b; }
.c-red { background: #fbe9e9; color: #a92b2b; }
.c-gray { background: #eef1f4; color: #4d5864; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: 0; }
.swatch.c-blue { background: #2a78d6; } .swatch.c-cyan { background: #1aa0bb; } .swatch.c-green { background: #2e9e4f; } .swatch.c-emerald { background: #12936a; } .swatch.c-violet { background: #6250d6; } .swatch.c-pink { background: #d4568a; } .swatch.c-amber { background: #dc9a0b; } .swatch.c-orange { background: #e0662d; } .swatch.c-red { background: #d24242; } .swatch.c-gray { background: #8794a1; }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: #dfe7f2; color: #2c4a73; display: inline-grid; place-items: center; font-size: 11px; font-weight: 600; flex: none; }
.avatar.lg { width: 34px; height: 34px; font-size: 13px; }
.sidebar .avatar { background: #2b3e55; color: #dbe5ef; }
.due { font-weight: 500; }
.due.overdue { color: var(--danger); }
.due.today { color: var(--signal); }
.pill-src { font-size: 11.5px; color: var(--ink-3); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { display: inline-flex; align-items: center; gap: 7px; padding: 9px 12px; color: var(--ink-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.on { color: var(--accent-2); border-bottom-color: var(--accent); }
.tabs .n { font-size: 11.5px; padding: 0 6px; border-radius: 9px; background: var(--line-2); color: var(--ink-2); line-height: 18px; }
.tabs a.on .n { background: var(--accent-soft); color: var(--accent-2); }
.tabs .n.alert { background: var(--danger-bg); color: var(--danger); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12.5px; font-weight: 500; color: var(--ink-3); padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.table td { padding: 10px 11px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafbfd; }
.table tr.sel td { background: #f3f7ff; }
.table .cb { width: 34px; padding-right: 0; }
.table .cb input { width: 16px; height: 16px; accent-color: var(--accent); }
.table td.num, .table th.num { text-align: right; }
.lead-cell { display: flex; flex-direction: column; min-width: 0; }
.lead-cell a.n { font-weight: 600; color: var(--ink); }
.lead-cell .c { color: var(--ink-2); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
@media (max-width: 1520px) { .table .owner-name { display: none; } }
@media (max-width: 1380px) and (min-width: 761px) { .table .col-recv { display: none; } }
.quick { display: inline-flex; gap: 4px; }
.quick a { width: 28px; height: 28px; border-radius: 6px; display: inline-grid; place-items: center; color: var(--ink-2); border: 1px solid var(--line); background: var(--surface); }
.quick a:hover { text-decoration: none; color: var(--accent); border-color: var(--accent); }
.quick a.wa:hover { color: var(--wa); border-color: var(--wa); }
.phone { white-space: nowrap; }
.bar-cell { display: flex; align-items: center; gap: 8px; }
.bar-cell .track { flex: 1; height: 8px; background: var(--line-2); border-radius: 4px; overflow: hidden; min-width: 60px; display: flex; }
.bar-cell .fill { height: 100%; background: #2a78d6; border-radius: 0 4px 4px 0; }
.bar-cell .fill.won { background: #12936a; border-radius: 0; }
.bar-cell .fill.eng { background: #86b6ef; border-radius: 0; }

.only-sm { display: none; }
/* Lead list as cards on phones */
@media (max-width: 760px) {
  .table.responsive thead { display: none; }
  .table.responsive tr { display: grid; grid-template-columns: 34px 1fr auto; gap: 2px 8px; padding: 12px 12px; border-bottom: 1px solid var(--line-2); }
  .table.responsive td { display: block; border: 0; padding: 0; }
  .table.responsive td.cb { grid-row: span 3; padding-top: 2px; }
  .table.responsive td.hide-sm { display: none; }
  .table.responsive td.only-sm { display: block; }
  .table.responsive td.quick-td { grid-column: 3; grid-row: 1 / span 2; }
  .table.responsive td.meta-sm { grid-column: 2 / span 2; font-size: 12.5px; }
  .lead-cell .c { max-width: 60vw; }
}

/* ---------- Filters / bulk ---------- */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
.toolbar .search { position: relative; flex: 1 1 260px; max-width: 420px; }
.toolbar .search svg { position: absolute; left: 10px; top: 9px; color: var(--ink-3); }
.toolbar .search input { padding-left: 32px; }
.filters { display: none; padding: 12px 16px; border-bottom: 1px solid var(--line-2); background: var(--surface-2); }
.filters.open { display: block; }
.filters .grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.filters .field { margin: 0; }
.filter-count { background: var(--accent); color: #fff; border-radius: 9px; font-size: 11px; padding: 0 6px; line-height: 17px; }
.bulk-bar { position: sticky; bottom: 0; display: none; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 16px; background: var(--nav); color: #fff; border-radius: 0 0 var(--radius) var(--radius); z-index: 5; }
.bulk-bar.show { display: flex; }
.bulk-bar select, .bulk-bar input { height: 30px; width: auto; min-width: 140px; }
.bulk-bar .btn { height: 30px; }
@media (max-width: 900px) { .bulk-bar { position: fixed; left: 0; right: 0; bottom: 58px; border-radius: 0; } }

.pager { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--line-2); font-size: 13px; color: var(--ink-3); }
.pager .spacer { flex: 1; }

/* ---------- Lead detail ---------- */
.lead-head { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px 20px; align-items: start; }
.lead-head h1 { font-size: 21px; }
.lead-head .company { color: var(--ink-2); font-size: 14px; margin-top: 2px; }
.lead-head .facts { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; color: var(--ink-2); font-size: 13px; }
.lead-head .facts span { display: inline-flex; align-items: center; gap: 6px; }
.lead-head .badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.actions-bar { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 760px) {
  .lead-head { grid-template-columns: 1fr; padding: 14px; }
  .actions-bar { justify-content: stretch; display: grid; grid-template-columns: repeat(3, 1fr); }
  .actions-bar > * { min-width: 0; }
  .actions-bar summary svg:last-child { display: none; }
  .topbar-actions { max-width: 100%; }
  .topbar-actions .seg { overflow-x: auto; max-width: 100%; }
  .actions-bar .btn, .actions-bar details, .actions-bar details > summary { width: 100%; padding: 0 8px; }
}
.status-row { display: flex; gap: 6px; flex-wrap: wrap; }
:where(.status-row) button { height: 30px; padding: 0 11px; border-radius: 15px; border: 1px solid var(--line); background: var(--surface); font: 500 12.5px var(--font); color: var(--ink-2); cursor: pointer; }
:where(.status-row) button:hover { border-color: #b9c4cf; }
.status-row button.on { border-color: transparent; font-weight: 600; }
dl.kv { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 7px 12px; margin: 0; font-size: 13.5px; }
dl.kv dt { color: var(--ink-3); }
dl.kv dd { margin: 0; word-break: break-word; }
.answers { display: flex; flex-direction: column; gap: 10px; }
.answers .q { color: var(--ink-3); font-size: 12.5px; }
.answers .a { font-weight: 500; }

/* follow-up rows */
.fu { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
.fu:last-child { border-bottom: 0; }
.fu .ch { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; background: var(--line-2); color: var(--ink-2); }
.fu .ch.call { background: #e6effd; color: #1f53b0; }
.fu .ch.whatsapp { background: #e1f4e8; color: var(--wa); }
.fu .ch.email { background: #efebfd; color: #5340b8; }
.fu .ch.meeting { background: #fdf2d8; color: #8a5a00; }
.fu .t { font-weight: 500; }
.fu .n { color: var(--ink-2); font-size: 13px; }
.fu .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.fu.overdue { box-shadow: inset 3px 0 0 var(--danger); }
.fu.today { box-shadow: inset 3px 0 0 #e7a21a; }
@media (max-width: 640px) { .fu { grid-template-columns: 34px minmax(0, 1fr); } .fu .acts { grid-column: 1 / -1; justify-content: flex-start; } }

/* agenda (follow-ups page) */
.day-head { display: flex; align-items: baseline; gap: 10px; padding: 14px 16px 6px; font-weight: 600; }
.day-head .muted { font-weight: 400; font-size: 12.5px; }
.agenda .fu { grid-template-columns: 64px 34px minmax(0, 1fr) auto; }
.agenda .time { font-weight: 600; font-size: 13px; padding-top: 7px; }
.agenda .time.overdue { color: var(--danger); }
@media (max-width: 640px) { .agenda .fu { grid-template-columns: 54px minmax(0, 1fr); } .agenda .fu .ch { display: none; } .agenda .fu .acts { grid-column: 1 / -1; } }

/* timeline */
.timeline { list-style: none; margin: 0; padding: 4px 0; }
.timeline li { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; padding: 10px 16px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: 30px; top: 0; bottom: 0; width: 1px; background: var(--line-2); }
.timeline li:first-child::before { top: 22px; }
.timeline li:last-child::before { bottom: calc(100% - 22px); }
.timeline .ic { width: 28px; height: 28px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); display: grid; place-items: center; color: var(--ink-3); position: relative; z-index: 1; }
.timeline .ic.call { color: #1f53b0; border-color: #c8d9f6; background: #f2f6fe; }
.timeline .ic.whatsapp { color: var(--wa); border-color: #c4e6d1; background: #f0faf3; }
.timeline .ic.email { color: #5340b8; border-color: #d8d1f8; background: #f6f4fe; }
.timeline .ic.status { color: #8a5a00; border-color: #f1dcab; background: #fffaf0; }
.timeline .ic.note { color: var(--ink-2); }
.timeline .h { font-size: 12.5px; color: var(--ink-3); }
.timeline .h b { color: var(--ink); font-weight: 500; }
.timeline .body { white-space: pre-wrap; margin-top: 2px; word-break: break-word; }
.timeline .body.clip { max-height: 7.5em; overflow: hidden; }
.note-box { padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
.note-box textarea { min-height: 60px; }

/* ---------- Pipeline ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.col { background: #e9edf1; border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 190px); min-height: 160px; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-weight: 600; }
.col-head .n { margin-left: auto; font-weight: 500; color: var(--ink-3); font-size: 12.5px; }
.col-body { padding: 0 8px 8px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.col.drop .col-body { outline: 2px dashed var(--accent); outline-offset: -4px; border-radius: 6px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 10px 11px; cursor: grab; box-shadow: var(--shadow); }
.card:active { cursor: grabbing; }
.card.dragging { opacity: .45; }
.card a.n { font-weight: 600; color: var(--ink); display: block; }
.card .c { color: var(--ink-2); font-size: 12.5px; }
.card .m { display: flex; align-items: center; gap: 6px; margin-top: 8px; flex-wrap: wrap; font-size: 12px; }
.card .m .avatar { width: 22px; height: 22px; font-size: 10px; margin-left: auto; }
.col-more { text-align: center; font-size: 12.5px; padding: 4px 0 2px; }

/* ---------- Misc ---------- */
.flashes { display: flex; flex-direction: column; gap: 8px; padding: 14px 28px 0; }
.flash { padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid; font-size: 13.5px; display: flex; gap: 10px; align-items: flex-start; }
.flash.success { background: var(--ok-bg); border-color: #b9e2cb; color: #0c5a3b; }
.flash.error { background: var(--danger-bg); border-color: #f2c6c6; color: #8c2323; }
.flash.info { background: var(--accent-soft); border-color: #c5d7f6; color: #1a4a99; }
.flash button { margin-left: auto; background: none; border: 0; color: inherit; cursor: pointer; opacity: .6; padding: 0; }
@media (max-width: 900px) { .flashes { padding: 12px 14px 0; } }
.empty { text-align: center; padding: 36px 20px; color: var(--ink-3); }
.empty h3 { color: var(--ink); margin-bottom: 4px; }
.empty .btn { margin-top: 12px; }
.callout { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.callout.warn { background: var(--signal-bg); border-color: #f2dba4; color: #6e4b00; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; word-break: break-all; }
pre.code { padding: 12px; white-space: pre-wrap; display: block; }
.copy-row { display: flex; gap: 6px; align-items: center; }
.copy-row .code { flex: 1; padding: 7px 10px; }
details.menu { position: relative; display: inline-block; }
details.menu > summary { list-style: none; }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu .menu-list { position: absolute; right: 0; top: calc(100% + 6px); min-width: 230px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 28px rgba(20, 33, 49, .14); padding: 6px; z-index: 30; }
details.menu.left .menu-list { left: 0; right: auto; }
details.menu .menu-list a, details.menu .menu-list button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border-radius: 6px; color: var(--ink); background: none; border: 0; font: 400 13.5px var(--font); text-align: left; cursor: pointer; }
details.menu .menu-list a:hover, details.menu .menu-list button:hover { background: var(--surface-2); text-decoration: none; }
details.menu .menu-list .sep { height: 1px; background: var(--line-2); margin: 5px 4px; }
details.menu .menu-list .lbl { font-size: 12px; color: var(--ink-3); padding: 6px 10px 2px; }

dialog { border: 0; border-radius: 12px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px); box-shadow: 0 24px 60px rgba(10, 18, 28, .3); color: var(--ink); }
dialog::backdrop { background: rgba(14, 24, 36, .45); }
dialog .d-head { display: flex; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
dialog .d-head h2 { margin-right: auto; }
dialog .d-body { padding: 16px 18px; overflow-y: auto; max-height: calc(100vh - 170px); }
dialog .d-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line-2); background: var(--surface-2); }
dialog .close { background: none; border: 0; cursor: pointer; color: var(--ink-3); padding: 4px; border-radius: 6px; display: inline-flex; }
dialog .close:hover { background: var(--line-2); color: var(--ink); }
.subsection { border-top: 1px solid var(--line-2); margin: 14px -18px 0; padding: 14px 18px 0; }

.chart-box { position: relative; height: 240px; }
.chart-box.tall { height: 300px; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }

.login-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.login-side { background: var(--nav); color: #dbe5ef; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.login-side h2 { color: #fff; font-size: 26px; max-width: 18ch; line-height: 1.2; }
.login-side p { color: #9fb0c1; max-width: 42ch; }
.login-form { display: grid; place-items: center; padding: 32px 20px; }
.login-form form { width: min(360px, 100%); }
@media (max-width: 800px) { .login-wrap { grid-template-columns: 1fr; } .login-side { display: none; } }

.settings-nav { display: flex; gap: 2px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.settings-nav a { padding: 8px 12px; color: var(--ink-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.settings-nav a.on { color: var(--accent-2); border-bottom-color: var(--accent); }
.settings-nav a:hover { text-decoration: none; color: var(--ink); }
.steps { margin: 0; padding-left: 20px; }
.steps li { margin-bottom: 8px; }
.state-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.region-tile { padding: 12px 14px; }
.region-tile .v { font-size: 22px; font-weight: 600; }
.status-split { display: flex; height: 8px; border-radius: 4px; overflow: hidden; gap: 2px; background: var(--line-2); min-width: 120px; }
.status-split span { display: block; height: 100%; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
