/* ==========================================================
   Maynard CRM — UI stylesheet
   ========================================================== */
:root {
  --side-bg: #0c3b2e;
  --side-bg-2: #0f4737;
  --side-hover: #165a45;
  --side-active: #1d6b52;
  --side-text: #d5eadf;
  --side-muted: #8fb8a6;
  --primary: #0a7d55;
  --primary-hover: #086846;
  --primary-soft: #e3f4ec;
  --primary-ring: rgba(10,125,85,.25);
  --accent: #19c37d;
  --bg: #f5f8fa;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --border: #dfe3eb;
  --border-strong: #cbd6e2;
  --text: #1f2d3d;
  --text-2: #425b76;
  --muted: #6b7f93;
  --danger: #c93a3a;
  --danger-soft: #fdecec;
  --warn: #c27c0e;
  --info-soft: #e8f1fb;
  --radius: 8px;
  --radius-sm: 5px;
  --shadow: 0 1px 2px rgba(16,40,30,.06), 0 1px 4px rgba(16,40,30,.05);
  --shadow-lg: 0 10px 30px rgba(16,40,30,.18);
  --side-w: 236px;
  --top-h: 56px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 14px; color: var(--text); background: var(--bg); line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; color: var(--text); }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 15px; } h4 { font-size: 14px; }
code { background: #eef2f6; padding: 1px 5px; border-radius: 4px; font-size: 12px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 12px; } .strong { font-weight: 600; }
.danger { color: var(--danger) !important; } .success { color: var(--primary); } .yes { color: var(--primary); font-size: 16px; }
.center { text-align: center; } .right { margin-left: auto; } .nowrap { white-space: nowrap; } .inline { display: inline; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.pad { padding: 16px 20px; } .pad-x { padding: 0 24px; display: inline-block; margin-top: 16px; } .pad-top { padding-top: 12px; }
.strike { text-decoration: line-through; color: var(--muted); }
.clamp-1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--side-w); background: var(--side-bg); color: var(--side-text); display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 40; transition: width .18s ease; }
.sidebar-head { height: var(--top-h); display: flex; align-items: center; justify-content: space-between; padding: 0 10px 0 16px; border-bottom: 1px solid rgba(255,255,255,.06); }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; }
.brand:hover { text-decoration: none; }
.logo-mark { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, #19c37d, #0a7d55); display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 16px; flex: none; }
.sidebar-collapse { color: var(--side-muted); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 8px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 8px; color: var(--side-text); font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap; list-style: none; position: relative; margin: 1px 0; }
.nav-link::-webkit-details-marker { display: none; }
.nav-link .bi { font-size: 17px; width: 20px; text-align: center; flex: none; }
.nav-link:hover { background: var(--side-hover); text-decoration: none; color: #fff; }
.nav-link.active { background: var(--side-active); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav-link.locked { color: var(--side-muted); }
.nav-text { overflow: hidden; text-overflow: ellipsis; }
.nav-upgrade { margin-left: auto; color: #8de0b8; font-size: 15px; display: inline-flex; }
.nav-upgrade.dark { color: var(--primary); }
.nav-badge { margin-left: auto; background: var(--accent); color: #05261b; border-radius: 10px; font-size: 11px; font-weight: 700; padding: 0 7px; line-height: 18px; }
.nav-sep { height: 1px; background: rgba(255,255,255,.08); margin: 8px 6px; }
.nav-section-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--side-muted); padding: 6px 12px 4px; }
.nav-group > .nav-link .chev { margin-left: auto; transition: transform .15s; font-size: 12px; }
.nav-group[open] > .nav-link .chev { transform: rotate(180deg); }
.nav-group > a.nav-link { padding-left: 44px; font-size: 13.5px; }
.nav-group > a.nav-link .bi { display: none; }
.sidebar-foot { padding: 10px; }
.plan-card { background: var(--side-bg-2); border: 1px solid rgba(255,255,255,.08); border-radius: 10px; padding: 12px; font-size: 12.5px; }
.plan-card-title { font-weight: 600; color: #fff; }
.plan-card p { margin: 4px 0 10px; color: var(--side-muted); }
body.side-collapsed .sidebar { width: 64px; }
body.side-collapsed .nav-text, body.side-collapsed .nav-section-label, body.side-collapsed .plan-card, body.side-collapsed .nav-badge, body.side-collapsed .chev, body.side-collapsed .nav-upgrade { display: none; }
body.side-collapsed .nav-group > a.nav-link { padding-left: 12px; }
body.side-collapsed .nav-group > a.nav-link .bi { display: inline-block; }
body.side-collapsed .sidebar-head { padding: 0 8px; flex-direction: column; justify-content: center; }
body.side-collapsed .sidebar-collapse { transform: rotate(180deg); }
body.side-collapsed .brand { display: none; }
body.side-collapsed .main { margin-left: 64px; }

.main { flex: 1; margin-left: var(--side-w); min-width: 0; display: flex; flex-direction: column; transition: margin-left .18s ease; }
.topbar { height: var(--top-h); background: var(--side-bg); display: flex; align-items: center; gap: 12px; padding: 0 16px; position: sticky; top: 0; z-index: 30; }
.global-search { position: relative; flex: 0 1 420px; }
.global-search input { width: 100%; height: 36px; border-radius: 18px; border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.08); color: #fff; padding: 0 40px 0 16px; font: inherit; outline: none; }
.global-search input::placeholder { color: var(--side-text); }
.global-search input:focus { background: #fff; color: var(--text); border-color: #fff; }
.global-search input:focus::placeholder { color: var(--muted); }
.global-search .search-icon { position: absolute; right: 14px; top: 9px; color: var(--side-text); pointer-events: none; }
.global-search input:focus + .search-icon { color: var(--muted); }
.search-results { position: absolute; top: 42px; left: 0; right: 0; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg); max-height: 70vh; overflow: auto; padding: 6px 0; z-index: 50; }
.search-group-label { font-size: 11px; text-transform: uppercase; color: var(--muted); padding: 8px 14px 2px; letter-spacing: .05em; }
.search-item { display: flex; gap: 10px; align-items: center; padding: 8px 14px; color: var(--text); }
.search-item:hover, .search-item.focus { background: var(--primary-soft); text-decoration: none; }
.search-item .bi { color: var(--muted); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.topbar-btn { color: #fff; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 6px; font-weight: 600; }
.topbar-btn:hover { background: rgba(255,255,255,.1); text-decoration: none; }
.upgrade-btn .bi { color: #8de0b8; }
.topbar-sep { width: 1px; height: 24px; background: rgba(255,255,255,.18); margin: 0 6px; }
.topbar-icon { color: var(--side-text); position: relative; }
.topbar-icon:hover { background: rgba(255,255,255,.1); color: #fff; }
.dot-badge { position: absolute; top: 2px; right: 0; background: #f2545b; color: #fff; font-size: 10px; border-radius: 8px; padding: 0 5px; line-height: 15px; font-weight: 700; }
.account-btn { display: flex; align-items: center; gap: 8px; background: none; border: 0; color: #fff; font: inherit; font-weight: 600; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.account-btn:hover { background: rgba(255,255,255,.1); }
.account-menu { min-width: 280px; }
.account-head { display: flex; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.content { flex: 1; padding: 24px 28px; min-width: 0; }
.content-flush { padding: 0; }
.content-settings { padding: 0; }
.mobile-only { display: none; }

/* ---------- Buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid transparent; font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; text-decoration: none !important; transition: background .12s, border-color .12s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: #fff; color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); border-color: #a9b9ca; }
.btn-light { background: #fff; color: var(--side-bg); }
.btn-light:hover { background: var(--primary-soft); }
.btn-link { background: none; color: var(--primary); padding: 0 8px; }
.btn-link:hover { text-decoration: underline !important; }
.btn-link.danger { color: var(--danger); }
.btn-sm { height: 30px; padding: 0 12px; font-size: 13px; }
.btn-xs { height: 24px; padding: 0 8px; font-size: 12px; }
.btn-lg { height: 44px; padding: 0 22px; font-size: 15px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }
.btn-link.small, button.btn-link { font: inherit; border: 0; cursor: pointer; }
.btn-link.strong { font-weight: 600; padding: 0; font-size: 14px; color: var(--primary); }
.icon-btn { background: none; border: 0; width: 34px; height: 34px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-2); font-size: 16px; }
.icon-btn:hover { background: rgba(0,0,0,.06); }
.icon-btn.xs { width: 26px; height: 26px; font-size: 13px; }
.icon-btn[disabled] { opacity: .35; cursor: not-allowed; }
.input { width: 100%; height: 38px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 0 12px; font: inherit; color: var(--text); background: var(--surface-2); outline: none; transition: border-color .12s, box-shadow .12s; }
textarea.input { height: auto; padding: 10px 12px; resize: vertical; min-height: 70px; }
select.input { padding-right: 28px; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); background: #fff; }
.input-sm { height: 30px; font-size: 13px; padding: 0 8px; }
.input:disabled { background: #eef2f6; color: var(--muted); }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-prefix { position: absolute; left: 10px; color: var(--muted); pointer-events: none; }
.input-wrap .input-prefix + .input { padding-left: 22px; }
.input-wrap.sm { display: inline-flex; width: 130px; }
.num-input { width: 90px; text-align: right; }
.title-input { font-size: 20px; font-weight: 600; height: 44px; background: transparent; border-color: transparent; max-width: 520px; }
.title-input:hover { border-color: var(--border); }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span, .field > label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.req { color: var(--danger); }
.hint { font-size: 12px; color: var(--muted); }
.hint-icon { color: var(--muted); cursor: help; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.check input { accent-color: var(--primary); width: 16px; height: 16px; margin: 0; }
.radio-list { display: flex; flex-direction: column; gap: 6px; }
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; }
.inline-label { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.inline-label .input { width: auto; }
input[type=checkbox] { accent-color: var(--primary); }
.round-check { width: 18px; height: 18px; cursor: pointer; }

/* ---------- Generic UI ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-head h3 { display: flex; align-items: center; gap: 8px; }
.count { display: inline-block; background: #eaf0f6; color: var(--text-2); font-size: 12px; font-weight: 600; border-radius: 10px; padding: 0 8px; line-height: 20px; }
.pill { display: inline-flex; align-items: center; gap: 4px; background: #eaf0f6; color: var(--text-2); font-size: 12px; font-weight: 600; border-radius: 12px; padding: 1px 10px; white-space: nowrap; }
.pill-green { background: var(--primary-soft); color: var(--primary-hover); }
.stage-pill { display: inline-block; border: 1px solid var(--border-strong); background: #fff; border-radius: 4px; padding: 1px 8px; font-size: 12.5px; white-space: nowrap; }
.stage-pill.won { background: var(--primary-soft); border-color: #a7dcc4; color: var(--primary-hover); }
.stage-pill.lost { background: #f4f5f7; color: var(--muted); }
.prio { font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 4px; background: #eef2f6; color: var(--text-2); }
.prio-high, .prio-urgent { background: #fde8e8; color: #b42318; }
.prio-medium { background: #fff4e0; color: #9a5b00; }
.prio-low { background: #e8f1fb; color: #1d5fa7; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; color: #fff; font-size: 12px; font-weight: 700; flex: none; letter-spacing: .02em; }
.avatar.xs { width: 22px; height: 22px; font-size: 9.5px; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }
.avatar.xl { width: 64px; height: 64px; font-size: 22px; }
.logo-sq { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 6px; background: #eaf0f6; color: var(--text-2); font-weight: 700; font-size: 12px; flex: none; }
.logo-sq.xl { width: 64px; height: 64px; font-size: 28px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); }
.owner-cell { display: inline-flex; align-items: center; gap: 8px; }
.alert { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 12px; }
.alert-error { background: var(--danger-soft); color: #8f1f1f; border: 1px solid #f5c2c2; }
.alert-info { background: var(--info-soft); color: #1d4f86; border: 1px solid #c4dbf3; }
.alert ul { margin: 6px 0 0; padding-left: 18px; }
.empty-state { text-align: center; padding: 48px 20px; }
.empty-state.small-pad { padding: 20px; }
.empty-state.big { padding: 90px 20px; }
.empty-icon { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 28px; }
.empty-state h3 { margin-bottom: 6px; }
.empty-state .btn { margin-top: 12px; }
.progress { height: 8px; background: #e8eef3; border-radius: 4px; overflow: hidden; min-width: 80px; }
.progress-bar { height: 100%; background: var(--primary); border-radius: 4px; }
.progress-bar.warn { background: var(--warn); }
td .progress { display: inline-block; width: 120px; vertical-align: middle; margin-right: 8px; }
.chip-link { display: inline-flex; align-items: center; gap: 4px; background: #f1f5f8; border-radius: 4px; padding: 1px 8px; margin: 1px 4px 1px 0; font-size: 12.5px; color: var(--text-2); }

/* dropdowns */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu { position: absolute; top: calc(100% + 4px); left: 0; min-width: 210px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px 0; z-index: 60; display: none; color: var(--text); }
.dropdown-menu.right { left: auto; right: 0; }
.dropdown.open > .dropdown-menu { display: block; }
.dropdown-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 14px; border: 0; background: none; font: inherit; font-size: 14px; color: var(--text); text-align: left; cursor: pointer; white-space: nowrap; }
.dropdown-item:hover { background: var(--primary-soft); text-decoration: none; }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item .bi { color: var(--muted); width: 16px; }
.dropdown-label { padding: 6px 14px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.dropdown-sep { height: 1px; background: var(--border); margin: 6px 0; }
.dropdown-menu form { margin: 0; }

/* ---------- Page headers ---------- */
.page { max-width: 1320px; margin: 0 auto; }
.page.narrow { max-width: 980px; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.index-page .page-header { padding: 20px 24px 0; margin-bottom: 14px; }
.page-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.record-count { color: var(--muted); font-size: 13px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: 13px; margin-bottom: 8px; }
.group-title { margin: 18px 0 10px; font-size: 14px; color: var(--text-2); }
.section-title { margin: 32px 0 14px; }
.section-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 6px; }

/* ---------- Index (table) page ---------- */
.index-page { background: var(--surface); min-height: calc(100vh - var(--top-h)); }
.view-tabs { display: flex; align-items: flex-end; gap: 2px; padding: 0 24px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.view-tab { padding: 10px 14px; border: 1px solid transparent; border-bottom: 0; border-radius: 6px 6px 0 0; color: var(--text-2); font-weight: 500; white-space: nowrap; background: none; font: inherit; font-size: 14px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; position: relative; top: 1px; }
.view-tab:hover { background: var(--surface-2); text-decoration: none; }
.view-tab.active { background: #fff; border-color: var(--border); color: var(--text); font-weight: 600; box-shadow: inset 0 3px 0 var(--primary); }
.view-tab.add { color: var(--primary); font-weight: 600; }
.view-switch { margin-left: auto; display: flex; border: 1px solid var(--border-strong); border-radius: 6px; overflow: hidden; margin-bottom: 6px; flex: none; }
.seg-btn { padding: 5px 12px; color: var(--text-2); }
.seg-btn.active { background: var(--primary-soft); color: var(--primary); }
.seg-btn:hover { text-decoration: none; background: var(--surface-2); }
.filter-bar { display: flex; align-items: center; gap: 8px; padding: 12px 24px; flex-wrap: wrap; border-bottom: 1px solid var(--border); background: var(--surface); }
.filter-bar.no-pad { padding: 0 0 14px; border: 0; background: none; }
.filter-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 16px; border: 1px solid var(--border-strong); background: #fff; color: var(--text); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.filter-chip:hover { border-color: var(--primary); }
.filter-chip.on { background: var(--primary-soft); border-color: #9fd7bf; color: var(--primary-hover); font-weight: 600; }
.filter-chip.static { cursor: default; }
.filter-chip.adv { color: var(--primary); font-weight: 600; border-style: dashed; }
.qf-menu { width: 280px; padding: 10px; }
.qf-options { max-height: 260px; overflow: auto; display: flex; flex-direction: column; gap: 4px; margin: 8px 0; }
.qf-options .check { padding: 4px 6px; border-radius: 4px; font-size: 13.5px; }
.qf-options .check:hover { background: var(--surface-2); }
.qf-actions { display: flex; justify-content: space-between; border-top: 1px solid var(--border); padding-top: 8px; margin-top: 4px; }
.board-filters { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.table-toolbar { display: flex; align-items: center; gap: 12px; padding: 12px 24px; flex-wrap: wrap; }
.table-search { position: relative; display: flex; align-items: center; }
.table-search .bi { position: absolute; left: 10px; color: var(--muted); }
.table-search input { height: 34px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 0 12px 0 32px; width: 280px; font: inherit; background: var(--surface-2); outline: none; }
.table-search input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); background: #fff; }
.table-search.sm input { width: 200px; height: 30px; font-size: 13px; }
.table-search.wide { margin-bottom: 16px; } .table-search.wide input { width: 100%; height: 42px; }
.toolbar-right { margin-left: auto; display: flex; gap: 8px; }
.bulk-bar { display: flex; align-items: center; gap: 4px; background: var(--primary-soft); border-radius: 6px; padding: 2px 8px; }
.bulk-count { font-size: 13px; padding-right: 6px; }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.data-table th { text-align: left; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--text-2); background: #f5f8fa; padding: 10px 12px; border-bottom: 1px solid var(--border); border-top: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.card .data-table th { border-top: 0; }
.data-table td { padding: 10px 12px; border-bottom: 1px solid #edf1f5; vertical-align: middle; }
.data-table tbody tr:hover td { background: #f8fbfa; }
.data-table.compact td, .data-table.compact th { padding: 7px 12px; }
.data-table tfoot td { font-weight: 600; background: var(--surface-2); }
.data-table th.num { text-align: right; }
.data-table th.center, .data-table td.center { text-align: center; }
.th-sort { color: inherit; display: inline-flex; align-items: center; gap: 4px; }
.th-sort:hover { text-decoration: none; color: var(--primary); }
.th-sort .sort-hint { opacity: 0; }
.th-sort:hover .sort-hint { opacity: .6; }
.th-sort.sorted { color: var(--primary); }
.col-check { width: 40px; padding-left: 24px !important; }
.col-primary { min-width: 240px; }
.primary-cell { display: flex; align-items: center; gap: 10px; }
.record-link { font-weight: 600; }
.preview-btn { opacity: 0; margin-left: auto; }
tr:hover .preview-btn { opacity: 1; }
.row-done td { color: var(--muted); }
.row-done .task-title { text-decoration: line-through; }
.pager { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 16px 24px; }
.page-num { min-width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; color: var(--text-2); font-weight: 600; }
.page-num:hover { background: var(--surface-2); text-decoration: none; }
.page-num.active { background: var(--primary); color: #fff; }
.per-select { width: auto; margin-left: 12px; }

/* side panel (advanced filters) */
.side-panel { position: fixed; top: 0; right: 0; bottom: 0; width: 440px; max-width: 100%; background: #fff; z-index: 70; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; }
.filter-builder { display: flex; flex-direction: column; gap: 10px; }
.fb-group { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; background: var(--surface-2); display: flex; flex-direction: column; gap: 10px; }
.fb-group-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.fb-cond { background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 10px; display: flex; flex-direction: column; gap: 8px; position: relative; }
.fb-cond-head { display: flex; gap: 6px; align-items: center; }
.fb-cond .fb-remove { position: absolute; top: 6px; right: 6px; }
.fb-and { font-size: 11px; font-weight: 700; color: var(--muted); text-align: center; }
.fb-or { align-self: center; }
.fb-value-multi { max-height: 160px; overflow: auto; border: 1px solid var(--border); border-radius: 6px; padding: 6px; display: flex; flex-direction: column; gap: 3px; }
.fb-value-multi .check { font-size: 13px; }
.or-badge { display: inline-block; background: var(--text-2); color: #fff; font-size: 11px; font-weight: 700; border-radius: 10px; padding: 0 8px; margin: 6px 0; }
.filter-summary { padding: 0 24px 12px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }

/* columns editor */
.columns-editor { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.columns-list { max-height: 380px; overflow: auto; margin-top: 8px; }
.col-group-label { font-size: 11px; text-transform: uppercase; font-weight: 700; color: var(--muted); margin: 10px 0 4px; }
.columns-list .check { padding: 3px 0; font-size: 13.5px; }
.columns-selected { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 400px; overflow: auto; }
.columns-selected li { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; background: #fff; cursor: grab; font-size: 13.5px; }
.columns-selected li.locked { background: var(--surface-2); cursor: default; color: var(--muted); }
.columns-selected li button { margin-left: auto; }
.columns-selected li.dragging { opacity: .4; }

/* ---------- Drawer & modal ---------- */
.drawer-backdrop, .modal-backdrop { position: fixed; inset: 0; background: rgba(23,36,48,.45); z-index: 80; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 480px; max-width: 100%; background: #fff; z-index: 90; transform: translateX(100%); transition: transform .2s ease; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
.drawer.open { transform: none; }
.drawer-head { background: var(--side-bg); color: #fff; padding: 0 12px 0 20px; height: 56px; display: flex; align-items: center; justify-content: space-between; flex: none; }
.drawer-head h3 { color: #fff; }
.drawer-head .icon-btn { color: #fff; }
.drawer-head .icon-btn:hover { background: rgba(255,255,255,.12); }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px; }
.drawer-foot { border-top: 1px solid var(--border); padding: 12px 20px; display: flex; gap: 8px; align-items: center; background: #fff; }
.drawer-foot.sticky { position: sticky; bottom: -20px; margin: 0 -20px -20px; }
.side-panel .drawer-foot { justify-content: space-between; }
.assoc-section { border-top: 1px solid var(--border); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.assoc-chip { display: inline-flex; gap: 6px; align-items: center; background: var(--primary-soft); border-radius: 6px; padding: 4px 10px; font-weight: 600; font-size: 13px; align-self: flex-start; }
.form-errors { background: var(--danger-soft); color: #8f1f1f; border-radius: 6px; padding: 10px 12px; font-size: 13px; }
.record-picker { position: relative; }
.picker-results { position: absolute; top: 40px; left: 0; right: 0; background: #fff; border: 1px solid var(--border); border-radius: 6px; box-shadow: var(--shadow-lg); z-index: 5; max-height: 240px; overflow: auto; }
.picker-results button { display: flex; flex-direction: column; align-items: flex-start; width: 100%; border: 0; background: none; padding: 7px 12px; text-align: left; cursor: pointer; font: inherit; }
.picker-results button:hover { background: var(--primary-soft); }
.picker-results .empty { padding: 8px 12px; color: var(--muted); font-size: 13px; }
.picker-selected { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.picker-selected .assoc-chip button { border: 0; background: none; cursor: pointer; padding: 0; color: var(--muted); }

.modal-backdrop { display: flex; align-items: flex-start; justify-content: center; padding: 60px 16px; overflow-y: auto; }
.modal { background: #fff; border-radius: 10px; width: 600px; max-width: 100%; box-shadow: var(--shadow-lg); overflow: hidden; }
.modal.wide { width: 860px; }
.modal-head { background: var(--side-bg); padding: 0 12px 0 20px; height: 52px; display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { color: #fff; }
.modal-head .icon-btn { color: #fff; }
.modal-head .icon-btn:hover { background: rgba(255,255,255,.12); }
.modal-body { padding: 20px; max-height: calc(100vh - 180px); overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--border); margin: 6px -20px -20px; padding: 12px 20px; background: var(--surface-2); }

.toasts { position: fixed; top: 68px; right: 20px; z-index: 120; display: flex; flex-direction: column; gap: 8px; }
.toast { display: flex; align-items: center; gap: 10px; background: #fff; border-left: 4px solid var(--primary); border-radius: 6px; box-shadow: var(--shadow-lg); padding: 10px 8px 10px 14px; min-width: 300px; max-width: 440px; font-size: 13.5px; animation: toastIn .2s ease; }
.toast .bi-check-circle { color: var(--primary); font-size: 18px; }
.toast-error { border-left-color: var(--danger); }
.toast-error .bi { color: var(--danger); font-size: 18px; }
.toast span { flex: 1; }
@keyframes toastIn { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Record page ---------- */
.record-page { display: grid; grid-template-columns: 340px minmax(0, 1fr) 340px; min-height: calc(100vh - var(--top-h)); }
.record-left, .record-right { background: #fff; border-right: 1px solid var(--border); padding: 16px 18px; }
.record-right { border-right: 0; border-left: 1px solid var(--border); }
.record-left-top { display: flex; justify-content: space-between; align-items: center; }
.record-identity { display: flex; gap: 14px; align-items: center; margin: 14px 0 18px; }
.record-name { font-size: 20px; word-break: break-word; }
.record-sub { color: var(--text-2); font-size: 13px; display: flex; align-items: center; gap: 2px; word-break: break-all; }
.quick-actions { display: flex; justify-content: space-between; gap: 4px; padding-bottom: 16px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.quick-action { display: flex; flex-direction: column; align-items: center; gap: 4px; background: none; border: 0; font: inherit; font-size: 12px; color: var(--text-2); cursor: pointer; padding: 0; }
.qa-icon { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border-strong); display: flex; align-items: center; justify-content: center; font-size: 16px; color: var(--primary); background: #fff; transition: all .12s; }
.quick-action:hover .qa-icon { background: var(--primary); color: #fff; border-color: var(--primary); }
.card-section { border-bottom: 1px solid var(--border); padding: 10px 0; }
.card-section > summary { cursor: pointer; font-weight: 700; font-size: 14px; padding: 6px 0; list-style: none; display: flex; align-items: center; gap: 6px; }
.card-section > summary::-webkit-details-marker { display: none; }
.card-section > summary::before { content: '\F282'; font-family: 'bootstrap-icons'; font-size: 11px; transition: transform .15s; color: var(--muted); }
.card-section[open] > summary::before { transform: rotate(180deg); }
.card-section .add-assoc { margin-left: auto; }
.prop-list { display: flex; flex-direction: column; gap: 2px; padding-top: 6px; }
.prop-row { padding: 6px 8px; margin: 0 -8px; border-radius: 6px; }
.prop-row:hover:not(.readonly) { background: var(--surface-2); }
.prop-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.prop-value { font-size: 14px; min-height: 20px; cursor: pointer; display: flex; align-items: flex-start; gap: 6px; word-break: break-word; outline: none; }
.readonly .prop-value { cursor: default; }
.edit-pencil { margin-left: auto; color: var(--primary); opacity: 0; font-size: 12px; }
.prop-row:hover .edit-pencil { opacity: 1; }
.prop-editor { margin-top: 4px; display: flex; flex-direction: column; gap: 6px; }
.prop-editor-actions { display: flex; gap: 4px; }
.record-main { padding: 16px 20px; min-width: 0; }
.stage-card { padding: 14px 16px; }
.stage-card-head { display: flex; gap: 28px; flex-wrap: wrap; margin-bottom: 12px; font-size: 14px; }
.stage-card-head .muted { display: block; }
.stage-path { display: flex; gap: 2px; overflow-x: auto; }
.stage-step { flex: 1; min-width: 92px; border: 0; background: #e8eef3; color: var(--text-2); padding: 8px 14px 8px 18px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-step:first-child { clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%); border-radius: 4px 0 0 4px; }
.stage-step:hover { background: #d5e2ea; }
.stage-step.done { background: #b9e4d1; color: var(--primary-hover); }
.stage-step.current { background: var(--primary); color: #fff; }
.stage-step.current.lost { background: #7b8a99; }
.activity-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); padding: 0 12px; overflow-x: auto; }
.act-tab { padding: 12px 14px; color: var(--text-2); font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; }
.act-tab:hover { text-decoration: none; color: var(--text); }
.act-tab.active { color: var(--text); border-bottom-color: var(--primary); }
.activity-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px; }
.activity-toolbar .input { max-width: 260px; }
.timeline { padding: 0 16px 16px; }
.timeline-month { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 14px 0 8px; }
.tl-item { display: flex; gap: 12px; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; background: #fff; }
.tl-item:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.tl-icon { width: 32px; height: 32px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; flex: none; }
.tl-icon.sm { width: 28px; height: 28px; font-size: 13px; }
.tl-task .tl-icon { background: #fff4e0; color: #9a5b00; }
.tl-call .tl-icon { background: #e8f1fb; color: #1d5fa7; }
.tl-meeting .tl-icon { background: #f1eafd; color: #6b3fc4; }
.tl-body { flex: 1; min-width: 0; }
.tl-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.tl-head > div:first-child { display: flex; align-items: center; gap: 8px; }
.tl-meta { display: flex; align-items: center; gap: 4px; font-size: 12px; white-space: nowrap; }
.tl-facts { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; margin-top: 6px; }
.tl-facts .muted { margin-right: 4px; }
.tl-text { margin-top: 8px; font-size: 13.5px; color: var(--text); white-space: normal; word-break: break-word; }
.task-check input { width: 18px; height: 18px; cursor: pointer; }
.assoc-card { padding: 8px 0; }
.assoc-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; margin: 8px 0; }
.assoc-main { min-width: 0; word-break: break-word; }
.assoc-full { display: flex; flex-direction: column; }
.mini-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; font-size: 13px; }

/* ---------- Board ---------- */
.board { display: flex; gap: 12px; padding: 16px 24px 24px; overflow-x: auto; align-items: flex-start; min-height: calc(100vh - 220px); background: var(--bg); }
.board-col { flex: 0 0 272px; background: #eef2f5; border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 240px); }
.board-col-head { padding: 12px 14px 8px; }
.board-col-title { font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .03em; display: flex; align-items: center; gap: 8px; }
.board-cards { flex: 1; overflow-y: auto; padding: 4px 8px 8px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.board-cards.drag-over { background: var(--primary-soft); border-radius: 6px; outline: 2px dashed #9fd7bf; }
.board-card { background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; cursor: grab; box-shadow: var(--shadow); font-size: 13px; }
.board-card:hover { border-color: var(--primary); }
.board-card.dragging { opacity: .5; }
.board-card-title { font-weight: 600; display: block; margin-bottom: 6px; }
.board-card-line { margin-bottom: 3px; }
.board-card-foot { display: flex; align-items: center; gap: 6px; border-top: 1px solid #edf1f5; margin-top: 8px; padding-top: 8px; }
.board-col-foot { border-top: 1px solid var(--border); padding: 10px 14px; font-size: 13px; background: #e6ecf0; border-radius: 0 0 var(--radius) var(--radius); }

/* ---------- Home / reports ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); color: var(--text); display: block; }
a.kpi:hover { border-color: var(--primary); text-decoration: none; }
.kpi-label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.kpi-value { font-size: 26px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi-value.sm { font-size: 20px; }
.home-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.home-grid .card { margin-bottom: 0; }
.span-2 { grid-column: span 2; }
.chart-box { position: relative; height: 280px; padding: 12px 16px; }
.task-list { list-style: none; margin: 0; padding: 4px 0; }
.task-list li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 18px; border-bottom: 1px solid #edf1f5; }
.task-list li:last-child { border-bottom: 0; }
.task-title { font-weight: 600; }
.feed { padding: 4px 0; }
.feed-item { display: flex; gap: 12px; align-items: flex-start; padding: 10px 18px; border-bottom: 1px solid #edf1f5; font-size: 13.5px; }
.feed-item:last-child { border-bottom: 0; }
.feed-item > div { flex: 1; min-width: 0; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 16px; margin-top: 10px; }
.month-nav strong { min-width: 130px; text-align: center; }
.seq-steps { list-style: none; margin: 0; padding: 8px 18px; }
.seq-steps li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid #edf1f5; }
.steps-list { display: flex; flex-direction: column; gap: 12px; }
.step-row { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.step-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.step-head .input { width: auto; }
.playbook-content { white-space: normal; line-height: 1.7; }

/* ---------- Segments ---------- */
.segment-editor { background: #fff; min-height: calc(100vh - var(--top-h)); display: flex; flex-direction: column; }
.editor-head { display: flex; align-items: center; gap: 14px; padding: 12px 24px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.editor-head .back-link { margin: 0; }
.segment-body { display: grid; grid-template-columns: 460px 1fr; flex: 1; }
.segment-filters { padding: 20px 24px; border-right: 1px solid var(--border); background: var(--surface-2); }
.segment-filters h3 { margin-bottom: 6px; }
.segment-preview .card-head { border-bottom: 1px solid var(--border); }
.preview-list .assoc-item { margin: 0; border: 0; border-bottom: 1px solid #edf1f5; border-radius: 0; padding: 10px 20px; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.choice { display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; }
.choice span { display: block; border: 1px solid var(--border-strong); border-radius: 6px; padding: 10px 12px; font-weight: 600; font-size: 13.5px; }
.choice.wide span { font-weight: 400; margin-bottom: 8px; }
.choice input:checked + span { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 1px var(--primary); }
.icon-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.icon-choice input { position: absolute; opacity: 0; }
.icon-choice span { width: 40px; height: 40px; border: 1px solid var(--border-strong); border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 18px; cursor: pointer; }
.icon-choice input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }

/* ---------- Settings ---------- */
.settings-layout { display: grid; grid-template-columns: 250px 1fr; min-height: calc(100vh - var(--top-h)); }
.settings-nav { background: #fff; border-right: 1px solid var(--border); padding: 20px 12px; }
.settings-nav h2 { padding: 0 10px 12px; }
.settings-nav-group { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 14px 10px 4px; }
.settings-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; color: var(--text); font-weight: 500; }
.settings-link:hover { background: var(--surface-2); text-decoration: none; }
.settings-link.active { background: var(--primary-soft); color: var(--primary-hover); font-weight: 600; }
.settings-main { padding: 24px 28px; min-width: 0; max-width: 1200px; }
.settings-main > h1 { margin-bottom: 16px; }
.narrow-form { max-width: 640px; }
.profile-head { display: flex; align-items: center; gap: 20px; }
.profile-head input[type=color] { width: 60px; height: 34px; border: 1px solid var(--border-strong); border-radius: 6px; padding: 2px; }
.options-rows { display: flex; flex-direction: column; gap: 6px; }
.option-row { display: flex; align-items: center; gap: 6px; }
.stages-table td .input { min-width: 0; }
.stages-table tr[draggable] .drag { cursor: grab; width: 30px; }
.usage-row { margin: 10px 0; }
.usage-label { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.props-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; }
.sticky-bottom { position: sticky; bottom: 0; background: #fff; padding: 12px 0 4px; border-top: 1px solid var(--border); margin-top: 20px; }
.steps { display: flex; list-style: none; padding: 0; margin: 0 0 18px; gap: 8px; counter-reset: s; }
.steps li { flex: 1; padding: 10px 14px; background: #eef2f5; border-radius: 6px; font-weight: 600; color: var(--muted); counter-increment: s; }
.steps li::before { content: counter(s) '. '; }
.steps li.active { background: var(--primary); color: #fff; }
.steps li.done { background: var(--primary-soft); color: var(--primary-hover); }
.dropzone { border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 32px; text-align: center; background: var(--surface-2); }
.big-icon { font-size: 40px; color: var(--primary); }

/* ---------- Pricing / upsell ---------- */
.pricing-hero { text-align: center; margin: 12px 0 28px; }
.pricing-hero h1 { font-size: 30px; margin-bottom: 8px; }
.plan-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.plan { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 24px 20px; display: flex; flex-direction: column; gap: 12px; position: relative; box-shadow: var(--shadow); }
.plan.featured { border: 2px solid var(--primary); }
.plan.current { background: var(--surface-2); }
.plan-ribbon { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--primary); color: #fff; font-size: 12px; font-weight: 700; padding: 3px 12px; border-radius: 12px; }
.plan-tagline { min-height: 40px; margin: 0; }
.plan-price { font-size: 34px; font-weight: 700; }
.plan-price span { font-size: 13px; color: var(--muted); font-weight: 500; }
.plan-list { list-style: none; padding: 0; margin: 4px 0 0; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }
.plan-list li { display: flex; gap: 8px; }
.plan-list .bi { color: var(--primary); }
.plan-list li.plain { font-weight: 600; }
.compare td:not(:first-child), .compare th:not(:first-child) { text-align: center; }
.compare .cur { background: #f2faf6; }
.compare .group-row td { background: var(--surface-2); font-weight: 700; text-transform: uppercase; font-size: 12px; color: var(--muted); }
.upsell { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 48px; box-shadow: var(--shadow); margin-top: 20px; }
.upsell h1 { font-size: 32px; margin: 14px 0 10px; }
.lead { font-size: 16px; color: var(--text-2); margin: 0 0 16px; }
.upsell-actions { display: flex; gap: 10px; margin-top: 24px; flex-wrap: wrap; }
.upsell-art { position: relative; height: 280px; background: linear-gradient(135deg, var(--primary-soft), #f4fbf8); border-radius: 14px; overflow: hidden; }
.upsell-circle { position: absolute; top: 40px; left: 50%; transform: translateX(-50%); width: 110px; height: 110px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 46px; box-shadow: 0 10px 30px rgba(10,125,85,.35); }
.ghost-card { position: absolute; left: 30px; right: 60px; bottom: 60px; background: #fff; border-radius: 8px; padding: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; }
.ghost-card.offset { left: 80px; right: 24px; bottom: 18px; }
.ghost-line { height: 8px; border-radius: 4px; background: #e2ebe7; }
.w40 { width: 40%; } .w50 { width: 50%; } .w60 { width: 60%; } .w80 { width: 80%; } .w90 { width: 90%; }

/* ---------- Auth ---------- */
.auth-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: radial-gradient(ellipse at top, #12573f, var(--side-bg) 70%); }
.auth-card { background: #fff; border-radius: 14px; width: 400px; max-width: 100%; padding: 32px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 14px; }
.auth-card.wide { width: 520px; }
.auth-logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.auth-card h1 { font-size: 24px; }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .record-page { grid-template-columns: 300px minmax(0, 1fr); }
  .record-right { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--border); display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0 24px; }
  .plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .home-grid, .segment-body, .upsell, .settings-layout { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .record-page { grid-template-columns: 1fr; }
  .record-left { border-right: 0; border-bottom: 1px solid var(--border); }
  .upsell-art { display: none; }
  .upsell { padding: 28px; }
  .settings-nav { border-right: 0; border-bottom: 1px solid var(--border); }
  .props-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; width: var(--side-w) !important; }
  body.side-open .sidebar { transform: none; }
  body.side-open .nav-text, body.side-open .nav-section-label, body.side-open .plan-card { display: initial; }
  .main, body.side-collapsed .main { margin-left: 0; }
  .mobile-only { display: inline-flex; color: #fff; }
  .sidebar-collapse { display: none; }
  .hide-sm { display: none; }
  .global-search { flex: 1; }
  .content { padding: 16px; }
  .index-page .page-header, .view-tabs, .filter-bar, .table-toolbar, .board { padding-left: 16px; padding-right: 16px; }
  .table-search input { width: 100%; }
  .table-search { flex: 1; }
  .toolbar-right { margin-left: 0; }
  .plan-grid, .grid-2, .grid-3, .columns-editor { grid-template-columns: 1fr; }
  .drawer, .side-panel { width: 100%; }
  .kpi-value { font-size: 22px; }
  .settings-main { padding: 16px; }
  .toasts { left: 16px; right: 16px; } .toast { min-width: 0; }
}

/* ---------- specificity fixes ---------- */
.topbar .topbar-icon { color: var(--side-text); }
.topbar .topbar-icon:hover { color: #fff; background: rgba(255,255,255,.1); }
.topbar .icon-btn.mobile-only { display: none; color: #fff; }
@media (max-width: 768px) { .topbar .icon-btn.mobile-only { display: inline-flex; } }
.card > .table-wrap, .card .table-wrap { border-radius: 0 0 var(--radius) var(--radius); }
.card .dropdown-menu { z-index: 70; }
.prop-links { display: flex; gap: 12px; flex-wrap: wrap; padding-top: 8px; }
.prop-links .btn-link { font-size: 12px; padding: 0; }
.main { overflow-x: clip; }
@media (max-width: 768px) {
  .content.content-flush, .content.content-settings { padding: 0; }
  .topbar { gap: 6px; padding: 0 8px; }
  .topbar .hide-sm, .topbar-sep, .topbar a.topbar-icon[title="Plans & help"], .topbar a.topbar-icon[title="Settings"] { display: none; }
  .global-search { min-width: 0; }
  .record-left, .record-right, .record-main { padding: 14px 16px; }
  .quick-actions { flex-wrap: wrap; justify-content: flex-start; gap: 10px; }
}
@media (max-width: 960px) { .record-page { grid-template-columns: minmax(0, 1fr); } .record-right { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 768px) {
  .global-search { flex: 1 1 0; }
  .global-search input { min-width: 0; }
  .topbar-right { flex: none; gap: 0; }
  .account-btn { padding: 4px; }
  .account-btn .bi { display: none; }
}
.lead-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-left: 4px solid var(--primary); }

/* ==========================================================
   Final polish
   ========================================================== */
:root { --danger-hover: #a92f2f; }
::selection { background: #bfe8d6; }
* { scrollbar-width: thin; scrollbar-color: #c3cfd9 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #c3cfd9; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: #9fb1c0; }
.sidebar ::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.sidebar :focus-visible, .topbar :focus-visible { outline-color: #8de0b8; }
.btn:focus-visible { box-shadow: 0 0 0 3px var(--primary-ring); outline: none; }
.d-block { display: block; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }
.input-lg { height: 44px; font-size: 15px; }
.btn { transition: background .12s, border-color .12s, box-shadow .12s, transform .05s; }
.btn:active { transform: translateY(1px); }

/* loading buttons */
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; animation: spin .7s linear infinite; }
.btn-secondary.is-loading::after, .btn-link.is-loading::after { border-color: rgba(10,125,85,.25); border-top-color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }

/* menus, modals and drawers animate in */
.dropdown.open > .dropdown-menu { animation: menuIn .12s ease-out; }
@keyframes menuIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.modal-backdrop:not([hidden]) .modal { animation: modalIn .16s ease-out; }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.drawer-backdrop:not([hidden]), .modal-backdrop:not([hidden]) { animation: fadeIn .15s ease-out; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.dropdown-menu { max-height: 70vh; overflow-y: auto; }

/* confirm dialog */
.confirm-backdrop { position: fixed; inset: 0; background: rgba(23,36,48,.45); z-index: 200; display: flex; align-items: flex-start; justify-content: center; padding: 120px 16px; animation: fadeIn .12s ease-out; }
.confirm-box { background: #fff; border-radius: 12px; width: 440px; max-width: 100%; box-shadow: var(--shadow-lg); padding: 22px 22px 18px; display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; animation: modalIn .16s ease-out; }
.confirm-icon { width: 40px; height: 40px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 19px; grid-row: span 2; }
.confirm-icon.danger { background: var(--danger-soft); color: var(--danger); }
.confirm-text h3 { margin-bottom: 4px; }
.confirm-text p { margin: 0; color: var(--text-2); }
.confirm-actions { grid-column: 2; display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

/* tables: one line per row, long values truncate */
#dataTable td { white-space: nowrap; max-width: 300px; overflow: hidden; text-overflow: ellipsis; }
#dataTable td.col-primary { max-width: 360px; }
.primary-cell .record-link { overflow: hidden; text-overflow: ellipsis; }
.data-table td.nowrap, .data-table .owner-cell { white-space: nowrap; }
.data-table tbody tr:has(.row-check:checked) td { background: #eef8f3; }
.btn-link.strong { text-align: left; }

/* label pills (Hot / Warm / Cold) */
.label-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; border-radius: 12px; padding: 1px 9px 1px 7px; white-space: nowrap; }
.label-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.label-hot { background: #fde8e8; color: #b42318; }
.label-warm { background: #fff4e0; color: #9a5b00; }
.label-cold { background: #e8f1fb; color: #1d5fa7; }
.board-card-line.tags { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0; }

/* record page: side columns scroll on their own, like HubSpot */
@media (min-width: 1281px) {
  .record-left, .record-right { position: sticky; top: var(--top-h); height: calc(100vh - var(--top-h)); overflow-y: auto; }
  .record-page { grid-template-columns: 320px minmax(0, 1fr) 320px; }
}
.stage-step { white-space: normal; line-height: 1.2; min-height: 38px; display: flex; align-items: center; justify-content: center; text-align: center; min-width: 72px; padding: 6px 14px 6px 18px; }
.quick-action:focus-visible { outline: none; }
.quick-action:focus-visible .qa-icon { box-shadow: 0 0 0 3px var(--primary-ring); }

/* board */
.board { min-height: calc(100vh - 190px); }
.board-card { transition: border-color .12s, box-shadow .12s, transform .12s; }
.board-card:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(16,40,30,.1); }
.board-col-head .count { background: #dfe7ed; }

/* notifications */
.notif-menu { width: 340px; padding: 0; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.notif-item { display: flex; gap: 10px; padding: 10px 14px; color: var(--text); border-bottom: 1px solid #edf1f5; }
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--primary-soft); text-decoration: none; }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); margin-top: 6px; flex: none; }
.notif-dot.late { background: var(--danger); }
.notif-empty { text-align: center; padding: 26px 16px; color: var(--text-2); }
.notif-empty .bi { font-size: 26px; color: var(--muted); display: block; margin-bottom: 6px; }

/* KPI hover accent */
.kpi { position: relative; overflow: hidden; }
.kpi::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--primary); opacity: 0; transition: opacity .12s; }
a.kpi:hover::after { opacity: 1; }

/* ---------- Login ---------- */
.login-body { min-height: 100vh; background: #fff; }
.login-split { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }
.login-brand { background: radial-gradient(120% 90% at 0% 0%, #17694d 0%, var(--side-bg) 55%, #082a20 100%); color: #e3f4ec; padding: 40px 56px; display: flex; flex-direction: column; gap: 40px; position: relative; overflow: hidden; }
.auth-logo.light { color: #fff; }
.login-pitch { max-width: 460px; margin-top: auto; }
.login-pitch h2 { color: #fff; font-size: 32px; line-height: 1.2; margin-bottom: 14px; }
.login-pitch p { color: #b9dccb; font-size: 15.5px; margin: 0 0 20px; }
.login-pitch ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.login-pitch li { display: flex; gap: 12px; align-items: center; font-size: 14.5px; }
.login-pitch li .bi { width: 32px; height: 32px; border-radius: 8px; background: rgba(255,255,255,.1); display: inline-flex; align-items: center; justify-content: center; color: #8de0b8; flex: none; }
.login-mock { display: flex; gap: 12px; margin-bottom: auto; opacity: .9; }
.mock-col { flex: 1; background: rgba(255,255,255,.06); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 8px; max-width: 170px; }
.mock-col > span { height: 8px; width: 55%; border-radius: 4px; background: rgba(255,255,255,.25); }
.mock-card { background: rgba(255,255,255,.92); border-radius: 7px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.mock-card i { height: 7px; width: 75%; border-radius: 4px; background: #0a7d55; opacity: .7; }
.mock-card b { height: 6px; width: 45%; border-radius: 4px; background: #cfd9e1; }
.mock-card.won { box-shadow: inset 3px 0 0 #19c37d; }
.login-form-wrap { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.login-form { width: 400px; max-width: 100%; display: flex; flex-direction: column; gap: 14px; }
.login-form h1 { font-size: 28px; }
.login-form > p { margin: 0; }
.pw-wrap { position: relative; display: block; }
.pw-wrap .input { padding-right: 44px; }
.pw-toggle { position: absolute; right: 5px; top: 5px; color: var(--muted); }
@media (max-width: 900px) {
  .login-split { grid-template-columns: 1fr; }
  .login-brand { padding: 24px; gap: 0; }
  .login-pitch, .login-mock { display: none; }
}

/* ==========================================================
   Compact sizing: smaller text, buttons and inputs
   ========================================================== */
body { font-size: 13px; }
h1 { font-size: 19px; } h2 { font-size: 16px; } h3 { font-size: 14px; } h4 { font-size: 13px; }
.small { font-size: 11.5px; }

/* buttons */
.btn { height: 32px; padding: 0 13px; font-size: 13px; gap: 5px; }
.btn-sm { height: 27px; padding: 0 10px; font-size: 12px; }
.btn-xs { height: 22px; padding: 0 7px; font-size: 11.5px; }
.btn-lg { height: 38px; padding: 0 18px; font-size: 14px; }
.icon-btn { width: 30px; height: 30px; font-size: 15px; }
.icon-btn.xs { width: 24px; height: 24px; font-size: 12px; }

/* inputs */
.input { height: 34px; font-size: 13px; padding: 0 10px; }
.input-sm { height: 27px; font-size: 12px; padding: 0 7px; }
.input-lg { height: 40px; font-size: 14px; }
textarea.input { padding: 8px 10px; }
.field > span, .field > label { font-size: 12px; }
.check { font-size: 13px; }
.form-stack { gap: 12px; }

/* sidebar & topbar */
.nav-link { font-size: 13px; padding: 7px 11px; gap: 10px; }
.nav-link .bi { font-size: 15px; }
.nav-group > a.nav-link { font-size: 12.5px; padding-left: 40px; }
.nav-section-label { font-size: 10.5px; }
.brand { font-size: 14px; }
.logo-mark { width: 28px; height: 28px; font-size: 14px; }
.plan-card { font-size: 12px; }
.global-search input { height: 32px; font-size: 13px; }
.global-search .search-icon { top: 7px; }
.topbar-btn, .account-btn { font-size: 13px; }

/* menus, pills, tabs */
.dropdown-item { font-size: 13px; padding: 7px 12px; }
.dropdown-menu { min-width: 190px; }
.pill, .count, .stage-pill, .prio, .label-pill { font-size: 11px; }
.view-tab { font-size: 13px; padding: 8px 12px; }
.filter-chip { height: 27px; font-size: 12px; padding: 0 10px; }
.act-tab { font-size: 13px; padding: 10px 12px; }
.table-search input { height: 30px; font-size: 13px; }
.table-search.sm input { height: 27px; font-size: 12px; }
.page-num { min-width: 27px; height: 27px; font-size: 12px; }

/* tables & cards */
.data-table { font-size: 12.5px; }
.data-table th { font-size: 11px; padding: 8px 10px; }
.data-table td { padding: 8px 10px; }
.data-table.compact td, .data-table.compact th { padding: 6px 10px; }
.card-head { padding: 11px 16px; }
.kpi { padding: 12px 14px; }
.kpi-label { font-size: 11px; }
.kpi-value { font-size: 22px; }
.kpi-value.sm { font-size: 17px; }
.avatar.sm { width: 25px; height: 25px; font-size: 10px; }
.avatar.xs { width: 20px; height: 20px; font-size: 9px; }
.avatar.xl { width: 56px; height: 56px; font-size: 19px; }
.logo-sq { width: 25px; height: 25px; font-size: 11px; }
.logo-sq.xl { width: 56px; height: 56px; font-size: 24px; }

/* record page */
.record-name { font-size: 17px; }
.record-sub { font-size: 12px; }
.qa-icon { width: 34px; height: 34px; font-size: 14px; }
.quick-action { font-size: 11px; }
.card-section > summary { font-size: 13px; }
.prop-label { font-size: 11px; }
.prop-value { font-size: 13px; }
.stage-card-head { font-size: 13px; }
.stage-step { font-size: 11px; min-height: 32px; }
.tl-item { padding: 10px 12px; }
.tl-icon { width: 28px; height: 28px; font-size: 13px; }
.tl-facts, .tl-text { font-size: 12.5px; }

/* board */
.board-card { font-size: 12px; padding: 9px 11px; }
.board-col-title { font-size: 12px; }
.board-col { flex-basis: 252px; }

/* drawer & modal */
.drawer-head, .modal-head { height: 48px; }
.modal-body, .drawer-body { padding: 16px 18px; }
.modal-foot { margin: 6px -18px -16px; padding: 10px 18px; }
.drawer-foot.sticky { margin: 0 -18px -16px; bottom: -16px; }
.toast { font-size: 12.5px; }

/* settings, pricing, login */
.settings-link { font-size: 13px; padding: 7px 10px; }
.settings-nav-group { font-size: 10.5px; }
.pricing-hero h1 { font-size: 26px; }
.plan-price { font-size: 28px; }
.plan-list { font-size: 12.5px; }
.upsell h1 { font-size: 26px; }
.login-form h1 { font-size: 24px; }
.login-pitch h2 { font-size: 27px; }
.stage-path { overflow-x: auto; padding-bottom: 2px; }
.stage-step { flex: 1 0 auto; white-space: nowrap; min-width: 0; padding: 6px 16px 6px 20px; }
.import-tips { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.import-tips ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.import-tips li { display: flex; gap: 8px; align-items: baseline; }
.import-tips .bi { color: var(--primary); }
.alert ul { max-height: 260px; overflow: auto; }

/* ==========================================================
   Mobile fixes
   ========================================================== */
/* never let anything widen the page sideways (Safari counts off-screen panels) */
html, body { max-width: 100%; overflow-x: hidden; }
@supports (overflow: clip) { html, body { overflow-x: clip; } }
/* closed side panels take no space and can't be reached */
.drawer:not(.open) { visibility: hidden; }
.drawer { transition: transform .2s ease, visibility 0s linear .2s; }
.drawer.open { transition: transform .2s ease, visibility 0s; }

/* grids and cards shrink to the screen instead of being cut off */
.home-grid > *, .kpi-row > *, .plan-grid > *, .record-page > *, .settings-layout > *, .segment-body > * { min-width: 0; }
.chart-box canvas { max-width: 100%; }
code { overflow-wrap: anywhere; }
.import-tips li { display: block; }
.import-tips li .bi { margin-right: 6px; }

@media (max-width: 960px) {
  .home-grid { grid-template-columns: minmax(0, 1fr); }
  .settings-layout { grid-template-columns: minmax(0, 1fr); }
  /* tables inside cards scroll sideways instead of being cut off */
  .card > .data-table, form.card > .data-table, .card > form > .data-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .settings-nav { padding: 12px; }
  .settings-nav h2 { display: none; }
}

@media (max-width: 768px) {
  /* inputs at 16px stop iPhone from zooming in when a field is tapped */
  .input, .input-sm, .input-lg, select.input, textarea.input, .table-search input, .global-search input, .title-input { font-size: 16px; }
  .input-sm { height: 32px; }

  /* mobile menu: slide-in sidebar with a dimmed backdrop */
  .sidebar { width: 264px !important; transform: translateX(-100%); box-shadow: none; transition: transform .22s ease, box-shadow .22s; z-index: 95; }
  body.side-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.35); }
  body.side-open .nav-text, body.side-open .nav-section-label, body.side-open .plan-card, body.side-open .nav-badge, body.side-open .chev { display: initial; }
  body.side-open .brand { display: flex; }
  .app::after { content: ""; position: fixed; inset: 0; background: rgba(15,25,20,.45); z-index: 90; opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.side-open .app::after { opacity: 1; pointer-events: auto; }
  body.side-open { overflow: hidden; }
  .sidebar-collapse { display: none; }
  .topbar .icon-btn.mobile-only { display: inline-flex; width: 38px; height: 38px; font-size: 20px; color: #fff; }

  /* page headers stack neatly */
  .page-header { align-items: flex-start; }
  .page-actions { width: 100%; }
  .index-page .page-actions .btn-primary { margin-left: auto; }
  .content { padding: 14px 12px; }
  .pager { flex-wrap: wrap; }
  .per-select { margin-left: 0; }
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-value { font-size: 19px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .board { padding: 12px; }
  .board-col { flex-basis: 240px; }
  .editor-head { padding: 10px 12px; }
  .editor-head .right { margin-left: 0; width: 100%; }
  .segment-filters { padding: 14px 12px; }
  .upsell { padding: 20px; }
  .modal-backdrop { padding: 12px 8px; }
  .modal-body { max-height: calc(100vh - 110px); }
  .confirm-backdrop { padding: 60px 12px; }
  .notif-menu, .account-menu { width: calc(100vw - 24px); max-width: 360px; }
  .dropdown-menu { max-width: calc(100vw - 16px); }
  .toasts { top: 64px; }
  .side-panel { width: 100%; }
}
@media (max-width: 480px) {
  .tl-head { flex-wrap: wrap; }
  .tl-head > div:first-child { flex-wrap: wrap; min-width: 0; }
  .tl-meta { white-space: normal; margin-left: auto; }
  .tl-item { gap: 10px; padding: 10px; }
  .tl-icon { display: none; }
  .stage-card-head { gap: 14px; }
  .quick-actions { gap: 6px; }
}
