/* ============================================================
   Highlister — design system
   ============================================================ */
:root {
    /* Surfaces */
    --bg: #f6f8fb;
    --bg-grad: radial-gradient(1200px 600px at 100% -10%, #eef3ff 0%, rgba(238,243,255,0) 55%), var(--bg);
    --surface: #ffffff;
    --surface-2: #f3f5f9;
    --surface-3: #eef1f6;
    --border: #e6eaf0;
    --border-strong: #d6dce6;

    /* Text */
    --text: #131a26;
    --text-2: #3c4658;
    --muted: #76808f;

    /* Brand */
    --primary: #4f6bff;
    --primary-d: #3a52e0;
    --primary-grad: linear-gradient(135deg, #5b7bff 0%, #4f6bff 55%, #6a5bff 100%);
    --primary-tint: #eef1ff;
    --primary-tint-2: #e3e8ff;

    /* Status */
    --green: #12915a; --green-bg: #e4f7ec; --green-bd: #bce8cf;
    --amber: #a8690e; --amber-bg: #fdf1dd; --amber-bd: #f2dcb0;
    --red:   #d6394f; --red-bg:   #fde7eb; --red-bd:   #f6c5cf;
    --violet:#6b46c1; --violet-bg:#efeaff; --violet-bd:#ddd2fb;
    --blue:  #2563c9; --blue-bg:  #e7efff; --blue-bd:  #c8dbff;

    /* Effects */
    --radius: 14px;
    --radius-sm: 10px;
    --shadow-xs: 0 1px 2px rgba(16,24,40,.05);
    --shadow-sm: 0 1px 3px rgba(16,24,40,.07), 0 1px 2px rgba(16,24,40,.04);
    --shadow-md: 0 6px 20px -6px rgba(16,24,40,.14), 0 2px 6px rgba(16,24,40,.05);
    --shadow-lg: 0 18px 48px -12px rgba(28,39,76,.22);
    --ring: 0 0 0 4px var(--primary-tint-2);
    --speed: .16s;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-grad);
    background-attachment: fixed;
    color: var(--text);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
a { color: var(--primary-d); text-decoration: none; transition: color var(--speed); }
a:hover { text-decoration: underline; }
h1, h2, h3 { letter-spacing: -.015em; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
    width: 248px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 22px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
}
.brand { font-weight: 800; font-size: 19px; display: flex; align-items: center; gap: 11px; margin-bottom: 30px; padding: 0 6px; letter-spacing: -.02em; }
.brand-mark {
    background: var(--primary-grad); color: #fff; width: 32px; height: 32px; border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 17px;
    box-shadow: 0 4px 10px -2px rgba(79,107,255,.5);
}
.sidebar nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-label { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); padding: 0 12px; margin: 6px 0 8px; }
.sidebar nav a {
    color: var(--text-2); padding: 9px 12px; border-radius: var(--radius-sm); font-weight: 550;
    display: flex; align-items: center; gap: 11px; transition: background var(--speed), color var(--speed);
}
.sidebar nav a svg { width: 18px; height: 18px; flex: none; opacity: .7; }
.sidebar nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.sidebar nav a.active { background: var(--primary-tint); color: var(--primary-d); font-weight: 650; }
.sidebar nav a.active svg { opacity: 1; }
.sidebar-foot { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 8px; }
.sidebar-foot .who { display: flex; align-items: center; gap: 10px; padding: 4px 6px 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary-grad); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex: none; }
.sidebar-foot .user { font-weight: 650; font-size: 13.5px; line-height: 1.2; }
.sidebar-foot .role { font-size: 11.5px; color: var(--muted); text-transform: capitalize; }
.sidebar-foot .foot-link { color: var(--text-2); font-size: 13px; font-weight: 550; display: flex; align-items: center; gap: 9px; padding: 8px 8px; border-radius: 8px; }
.sidebar-foot .foot-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.sidebar-foot .foot-link svg { width: 17px; height: 17px; opacity: .7; }
.sidebar-foot .logout { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 9px; padding: 8px 8px; border-radius: 8px; }
.sidebar-foot .logout svg { width: 17px; height: 17px; }
.sidebar-foot .logout:hover { color: var(--red); text-decoration: none; }

/* Global top bar + search */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; padding: 12px 34px; background: rgba(255, 255, 255, .82); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.topbar-search { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 440px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); padding: 9px 13px; border-radius: 10px; font-size: 13.5px; font-weight: 500; cursor: pointer; font-family: inherit; transition: border-color var(--speed), background var(--speed); }
.topbar-search:hover { border-color: var(--border-strong); background: var(--surface); }
.topbar-search svg { width: 16px; height: 16px; flex: none; }
.topbar-search span { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-search kbd, .palette kbd { font-family: inherit; font-size: 10.5px; font-weight: 600; color: var(--muted); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 5px; padding: 1px 5px; flex: none; }

/* Command palette */
.palette { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh; }
.palette[hidden] { display: none; }
.palette-backdrop { position: absolute; inset: 0; background: rgba(19, 26, 38, .45); backdrop-filter: blur(2px); animation: fade-in .15s ease; }
.palette-box { position: relative; width: 600px; max-width: calc(100vw - 32px); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; animation: pop-in .16s cubic-bezier(.2,.7,.3,1); }
@keyframes pop-in { from { opacity: 0; transform: translateY(-8px) scale(.99); } to { opacity: 1; transform: none; } }
.palette-input-row { display: flex; align-items: center; gap: 11px; padding: 15px 18px; border-bottom: 1px solid var(--border); }
.palette-input-row svg { width: 19px; height: 19px; color: var(--muted); flex: none; }
.palette-input { border: none; outline: none; box-shadow: none; font-size: 16px; padding: 0; background: transparent; flex: 1; }
.palette-input:focus { box-shadow: none; }
.palette-results { max-height: 50vh; overflow-y: auto; padding: 8px; }
.pal-group { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 10px 12px 6px; }
.pal-item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 9px; cursor: pointer; }
.pal-item.active { background: var(--primary-tint); }
.pal-kind { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-3); border-radius: 6px; padding: 3px 7px; flex: none; width: 54px; text-align: center; }
.pal-item.active .pal-kind { background: #fff; color: var(--primary-d); }
.pal-main { display: flex; flex-direction: column; min-width: 0; }
.pal-label { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-empty { padding: 28px; text-align: center; color: var(--muted); font-size: 13px; }
.palette-foot { display: flex; gap: 16px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); background: var(--surface-2); }
.palette-foot kbd { margin-right: 2px; }

/* Notifications bell */
.notif { position: relative; margin-left: auto; }
.install-btn { display: inline-flex; align-items: center; gap: 7px; flex: none; height: 40px; padding: 0 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background var(--speed), border-color var(--speed), color var(--speed); }
.install-btn:hover { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.install-btn svg { width: 17px; height: 17px; flex: none; }
.install-btn[hidden] { display: none; }
/* Demo / privacy mode toggle */
.demo-form { flex: none; margin: 0; }
.demo-btn { display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 13px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background var(--speed), border-color var(--speed), color var(--speed); }
.demo-btn:hover { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.demo-btn svg { width: 17px; height: 17px; flex: none; }
.demo-btn.on { background: #fff4e5; border-color: #f0a93b; color: #b9740d; }
.demo-btn.on:hover { background: #ffedd4; }
@media (max-width: 600px) { .demo-btn span { display: none; } .demo-btn { padding: 0; width: 40px; justify-content: center; } }
/* Mobile & tablet only — hide on desktop/laptop (mouse + hover = pointing device). */
@media (pointer: fine) and (hover: hover) { .install-btn { display: none !important; } }
@media (max-width: 600px) { .install-btn span { display: none; } .install-btn { width: 40px; padding: 0; justify-content: center; } .topbar-search kbd { display: none; } }
.notif-bell { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); cursor: pointer; transition: background var(--speed), border-color var(--speed); }
.notif-bell:hover { background: var(--surface); border-color: var(--border-strong); }
.notif-bell svg { width: 19px; height: 19px; }
.notif-badge { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px var(--surface); }
.notif-pop { position: absolute; right: 0; top: calc(100% + 8px); width: 340px; max-width: calc(100vw - 32px); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); z-index: 40; overflow: hidden; animation: pop-in .16s cubic-bezier(.2,.7,.3,1); }
.notif-head { padding: 13px 16px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 14px; }
.notif-list { max-height: 360px; overflow-y: auto; overscroll-behavior: contain; }
.notif-empty { padding: 28px; text-align: center; color: var(--muted); font-size: 13px; }
.notif-item { display: flex; gap: 11px; align-items: center; padding: 11px 16px; border-bottom: 1px solid var(--border); }
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--surface-2); text-decoration: none; }
.notif-type { flex: none; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 3px 7px; border-radius: 6px; width: 64px; text-align: center; }
.notif-type-follow-up { background: var(--amber-bg); color: var(--amber); }
.notif-type-task { background: var(--red-bg); color: var(--red); }
.notif-type-cold { background: var(--blue-bg); color: var(--blue); }
.notif-main { display: flex; flex-direction: column; min-width: 0; }
.notif-title { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-foot { display: block; padding: 11px 16px; text-align: center; font-size: 12.5px; font-weight: 600; border-top: 1px solid var(--border); background: var(--surface-2); }

.nav-toggle { display: none; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); cursor: pointer; flex: none; }
.nav-toggle svg { width: 20px; height: 20px; }
.nav-backdrop { display: none; }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content-body { padding: 28px 34px; max-width: 1220px; width: 100%; animation: fade-in .3s ease; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 24px; gap: 16px; }
.page-head h1 { font-size: 25px; margin: 0; font-weight: 750; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- Stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 22px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); }
.stat { position: relative; overflow: hidden; transition: transform var(--speed), box-shadow var(--speed); }
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat .stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat .label { color: var(--muted); font-size: 13px; font-weight: 550; }
.stat .value { font-size: 28px; font-weight: 750; margin-top: 8px; letter-spacing: -.02em; }
.stat .stat-ico { width: 38px; height: 38px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; }
.stat .stat-ico svg { width: 19px; height: 19px; }
.ico-blue { background: var(--blue-bg); color: var(--blue); }
.ico-green { background: var(--green-bg); color: var(--green); }
.ico-violet { background: var(--violet-bg); color: var(--violet); }
.ico-amber { background: var(--amber-bg); color: var(--amber); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 18px; }
.pl-fill.temp-fill-hot  { background: #ef4444; }
.pl-fill.temp-fill-warm { background: #f0a93b; }
.pl-fill.temp-fill-cold { background: #3b82f6; }
.card h2 { font-size: 15px; margin: 0 0 16px; font-weight: 700; }
/* What's New — topbar dropdown */
.whatsnew-menu { position: relative; flex: none; }
.wn-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); cursor: pointer; transition: background var(--speed), border-color var(--speed); }
.wn-btn:hover { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.wn-btn svg { width: 18px; height: 18px; }
.wn-dot { position: absolute; top: -3px; right: -3px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 2px var(--surface); }
.wn-pop { position: absolute; right: 0; top: calc(100% + 8px); width: 360px; max-width: calc(100vw - 32px); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); z-index: 40; overflow: hidden; animation: pop-in .16s cubic-bezier(.2,.7,.3,1); }
.wn-head { padding: 13px 16px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 14px; }
.wn-list { max-height: 60vh; overflow-y: auto; overscroll-behavior: contain; padding: 14px 16px; display: flex; flex-direction: column; gap: 16px; }
.wn-entry { padding-left: 12px; border-left: 2px solid var(--border-strong); }
.wn-meta { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; margin-bottom: 4px; }
.wn-date { font-size: 11px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.wn-title { font-size: 13.5px; font-weight: 700; color: var(--text); }
.wn-items { margin: 0; padding-left: 17px; color: var(--text-2); font-size: 12.5px; line-height: 1.55; }
/* On phones the panel spans the viewport (the button isn't at the screen edge,
   so right:0 anchoring would push it off-screen). */
@media (max-width: 600px) {
    .wn-pop { position: fixed; top: 62px; left: 12px; right: 12px; width: auto; max-width: none; }
    .wn-list { max-height: calc(100vh - 130px); }
}

/* Wide tables inside cards scroll within the card instead of overflowing the page. */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll table { min-width: 100%; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-head h2 { margin: 0; }

/* Pipeline bars */
.pipeline { display: flex; flex-direction: column; gap: 13px; }
.pl-row { display: grid; grid-template-columns: 84px 1fr 32px; align-items: center; gap: 12px; }
.pl-row .pl-label { color: var(--text-2); text-transform: capitalize; font-size: 13px; font-weight: 550; }
.pl-bar { background: var(--surface-3); border-radius: 999px; height: 9px; overflow: hidden; }
.pl-fill { height: 100%; background: var(--primary-grad); border-radius: 999px; transition: width .5s cubic-bezier(.2,.7,.3,1); }
.pl-row .pl-count { text-align: right; font-weight: 700; font-size: 13px; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; }
thead th { text-align: left; color: var(--muted); font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; padding: 11px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
tbody td { padding: 13px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--speed); }
tbody tr:hover { background: var(--primary-tint); }
.table-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.table-card thead th:first-child, .table-card tbody td:first-child { padding-left: 18px; }
.muted { color: var(--muted); }
.empty { padding: 56px 40px; text-align: center; color: var(--muted); }
.empty-ico { width: 46px; height: 46px; margin: 0 auto 14px; color: var(--border-strong); }
.done-row td { opacity: .5; }
.done-row .t-title { text-decoration: line-through; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; text-transform: capitalize; background: var(--surface-3); color: var(--muted); border: 1px solid transparent; line-height: 1.5; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge.new, .badge.todo, .badge.low, .badge.role-member { background: var(--blue-bg); color: var(--blue); border-color: var(--blue-bd); }
.badge.contacted, .badge.in_progress, .badge.paused, .badge.medium { background: var(--amber-bg); color: var(--amber); border-color: var(--amber-bd); }
.badge.qualified, .badge.proposal, .badge.role-admin { background: var(--violet-bg); color: var(--violet); border-color: var(--violet-bd); }
.badge.won, .badge.done, .badge.active { background: var(--green-bg); color: var(--green); border-color: var(--green-bd); }
.badge.lost, .badge.former, .badge.high { background: var(--red-bg); color: var(--red); border-color: var(--red-bd); }
.overdue { color: var(--red); font-weight: 650; }
.score-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.score-high { background: var(--green-bg); color: var(--green); }
.score-medium { background: var(--amber-bg); color: var(--amber); }
.score-low { background: var(--surface-3); color: var(--muted); }
.cold-chip { display: inline-block; font-size: 11px; font-weight: 600; color: #2563c9; background: #e7f0ff; border: 1px solid #c8dbff; border-radius: 999px; padding: 1px 8px; vertical-align: middle; }
.refcode { font-variant-numeric: tabular-nums; font-size: 12.5px; letter-spacing: .02em; white-space: nowrap; }
.ref-chip { display: inline-block; vertical-align: middle; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface-3); border: 1px solid var(--border); padding: 2px 9px; border-radius: 7px; letter-spacing: .02em; }
.kc-ref { font-size: 10.5px; font-weight: 600; color: var(--muted); background: var(--surface-3); padding: 1px 6px; border-radius: 5px; white-space: nowrap; }
/* Lead funnel temperature */
.badge.temp-cold { background: #e7f0ff; color: #2563c9; border-color: #c8dbff; }
.badge.temp-warm { background: #fdf0db; color: #b06d0e; border-color: #f2d9a8; }
.badge.temp-hot  { background: #fde6e6; color: #d23b3b; border-color: #f6c2c2; }
.badge.temp-cold::before { background: #2563c9; }
.badge.temp-warm::before { background: #f0a93b; }
.badge.temp-hot::before  { background: #ef4444; }
.temp-mini { font-size: 11px; padding: 1px 7px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); padding: 9px 15px; border-radius: 10px; font-size: 13px; font-weight: 600; cursor: pointer; box-shadow: var(--shadow-xs); transition: background var(--speed), border-color var(--speed), transform var(--speed), box-shadow var(--speed); white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; border-color: #c4ccd8; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--primary-grad); border: none; color: #fff; box-shadow: 0 4px 12px -3px rgba(79,107,255,.5); }
/* Must restate background + color: `.btn:hover` is more specific than `.btn-primary` and would otherwise win. */
.btn-primary:hover { background: var(--primary-grad); color: #fff; border: none; filter: brightness(1.06); box-shadow: 0 6px 16px -3px rgba(79,107,255,.55); }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 8px; }
.btn-danger { color: var(--red); }
.btn-link { background: none; border: none; color: var(--muted); cursor: pointer; padding: 6px 8px; font-size: 12px; font-weight: 600; border-radius: 7px; transition: background var(--speed), color var(--speed); }
.btn-link:hover { color: var(--text); background: var(--surface-2); }
.btn-link.btn-danger:hover { color: var(--red); background: var(--red-bg); }
.actions { display: flex; gap: 4px; align-items: center; }
.quick-actions { gap: 8px; }
.btn-wa { background: #25d366; border-color: #25d366; color: #fff; }
.btn-wa:hover { background: #1eb955; border-color: #1eb955; color: #fff; }
form.inline { display: inline; }

/* ---------- Filters / search ---------- */
.filters { display: flex; gap: 7px; flex-wrap: wrap; }
.filters a { padding: 7px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); font-size: 13px; font-weight: 550; transition: all var(--speed); }
.filters a:hover { border-color: var(--border-strong); text-decoration: none; }
.filters a.active { background: var(--primary-grad); color: #fff; border-color: transparent; box-shadow: 0 3px 9px -2px rgba(79,107,255,.5); }
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 18px; }
.filter-bar select { width: auto; min-width: 140px; padding: 9px 11px; cursor: pointer; }
.filter-bar .search { flex: 0 1 210px; max-width: 230px; }
.filter-bar .search input { width: 100%; }
.filter-bar .btn-link { color: var(--muted); }
.bulk-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; padding: 10px 14px; background: var(--primary-tint); border: 1px solid var(--primary-tint-2); border-radius: 11px; }
.bulk-bar .bulk-count { font-size: 13px; font-weight: 650; color: var(--primary-d); }
.bulk-bar select { width: auto; min-width: 150px; }
.search { position: relative; }
.search input { width: 240px; padding-left: 34px; }
.search::before { content: ""; position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; background: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2376808f' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E"); }

/* ---------- Column manager ---------- */
.col-hidden { display: none !important; }
.col-menu { position: relative; display: inline-block; }
.col-menu-pop { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--border); border-radius: 11px; box-shadow: var(--shadow-md); padding: 6px; min-width: 190px; z-index: 30; max-height: 320px; overflow-y: auto; }
.col-opt { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 7px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--text-2); }
.col-opt:hover { background: var(--surface-2); }
.col-opt input { width: auto; }

/* ---------- Forms ---------- */
.form-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; max-width: 760px; box-shadow: var(--shadow-sm); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-row { display: flex; flex-direction: column; gap: 7px; }
.form-row.full { grid-column: 1 / -1; }
label { font-size: 13px; color: var(--text-2); font-weight: 600; }
input, select, textarea {
    background: var(--surface); border: 1px solid var(--border-strong); color: var(--text);
    border-radius: 10px; padding: 10px 12px; font-size: 14px; font-family: inherit; width: 100%;
    transition: border-color var(--speed), box-shadow var(--speed);
}
input::placeholder, textarea::placeholder { color: #9aa4b2; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
textarea { resize: vertical; min-height: 90px; }
.form-actions { display: flex; gap: 10px; margin-top: 24px; }
.field-hint { font-size: 12px; color: var(--muted); font-weight: 400; line-height: 1.5; }
.phone-group { display: flex; gap: 8px; }
.phone-group .cc-select { width: 104px; flex: none; padding-left: 9px; padding-right: 6px; }
/* Password show/hide eye toggle */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { width: 100%; padding-right: 42px; }
.pw-toggle { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0; background: none; border: none; border-radius: 7px; color: var(--muted); cursor: pointer; transition: color var(--speed), background var(--speed); }
.pw-toggle:hover { color: var(--text-2); background: var(--surface-2); }
.pw-toggle:focus { outline: none; box-shadow: none; }
.pw-toggle svg { width: 18px; height: 18px; }
.field-hint code { background: var(--surface-3); padding: 1px 6px; border-radius: 5px; font-size: 11.5px; color: var(--text-2); }

/* ---------- Activity timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow-y: auto; }
.timeline:not(:hover) { scrollbar-width: thin; }
.tl-item { position: relative; display: flex; gap: 12px; padding: 0 0 16px 4px; }
.tl-item:not(:last-child)::before { content: ""; position: absolute; left: 8px; top: 16px; bottom: 0; width: 2px; background: var(--border); }
.tl-dot { position: relative; z-index: 1; flex: none; width: 11px; height: 11px; margin-top: 4px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.tl-body { display: flex; flex-direction: column; }
.tl-action { font-weight: 600; color: var(--text); font-size: 13.5px; }
.tl-meta { font-size: 12px; color: var(--muted); }
.tl-dot-call { background: var(--green); }
.tl-dot-email { background: var(--violet); }
.tl-dot-whatsapp { background: #25d366; }
.tl-dot-meeting { background: var(--amber); }
.tl-dot-note { background: var(--blue); }
.tl-kind { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); margin-right: 4px; }

/* Pending follow-up banner */
.followup-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-radius: 11px; margin-bottom: 14px; background: var(--violet-bg); border: 1px solid var(--violet-bd); color: var(--text); font-size: 13.5px; flex-wrap: wrap; }
.followup-banner.is-due { background: var(--amber-bg); border-color: var(--amber-bd); }
.followup-banner .fu-due { color: var(--amber); font-weight: 700; }

/* Add-activity form */
.activity-add { border: 1px solid var(--border); border-radius: 11px; padding: 12px; margin-bottom: 24px; background: var(--surface-2); }
.activity-add-foot { margin-bottom: 2px; }
.timeline { padding-top: 6px; }
.activity-add-row { display: flex; gap: 8px; }
.activity-add .activity-kind { width: 140px; flex: none; }
.activity-add .activity-body { flex: 1; }
.activity-add-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.activity-follow { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.activity-follow input { width: auto; }

/* 12-hour AM/PM date-time picker */
.dt12 { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dt12 .dt12-date { width: auto; }
.dt12 select { width: auto; min-width: 56px; padding: 9px 8px; }
.dt12 .dt12-colon { color: var(--muted); font-weight: 700; }

/* ---------- Flash ---------- */
.flash { display: flex; align-items: center; gap: 10px; background: var(--green-bg); color: var(--green); border: 1px solid var(--green-bd); padding: 13px 16px; border-radius: 11px; margin-bottom: 20px; font-weight: 550; box-shadow: var(--shadow-xs); animation: slide-down .35s cubic-bezier(.2,.7,.3,1); }
.flash svg { width: 18px; height: 18px; flex: none; }
@keyframes slide-down { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--bg-grad); position: relative; overflow: hidden; }
.login-wrap::before, .login-wrap::after { content: ""; position: absolute; border-radius: 50%; filter: blur(70px); opacity: .5; }
.login-wrap::before { width: 380px; height: 380px; background: #c3d0ff; top: -120px; right: -80px; }
.login-wrap::after { width: 320px; height: 320px; background: #d9c8ff; bottom: -120px; left: -80px; }
.login-card { position: relative; background: rgba(255,255,255,.85); backdrop-filter: blur(12px); border: 1px solid rgba(255,255,255,.7); border-radius: 20px; padding: 38px 36px; width: 384px; box-shadow: var(--shadow-lg); }
.login-card .brand { justify-content: center; font-size: 23px; margin-bottom: 6px; }
.login-card .login-sub { text-align: center; color: var(--muted); margin: 0 0 26px; font-size: 13.5px; }
.login-card .form-row { margin-bottom: 16px; }
.login-card .btn-primary { width: 100%; justify-content: center; padding: 11px; font-size: 14px; margin-top: 4px; }
.login-error { display: flex; align-items: center; gap: 9px; background: var(--red-bg); color: var(--red); border: 1px solid var(--red-bd); padding: 11px 14px; border-radius: 10px; margin-bottom: 18px; font-size: 13px; font-weight: 550; }
.login-error svg { width: 18px; height: 18px; flex: none; }
.login-hint { color: var(--muted); font-size: 12px; text-align: center; margin-top: 22px; }
.login-forgot { color: var(--muted); font-size: 12.5px; text-align: center; margin: 16px 0 0; }

/* ---------- Ask AI ---------- */
.nav-ai svg { color: var(--violet); opacity: 1; }
.ai-wrap { max-width: 820px; }
.ai-search { position: relative; display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 14px; padding: 8px 8px 8px 46px; box-shadow: var(--shadow-sm); transition: border-color var(--speed), box-shadow var(--speed); }
.ai-search:focus-within { border-color: var(--primary); box-shadow: var(--ring); }
.ai-spark { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--violet); display: inline-flex; }
.ai-spark svg { width: 20px; height: 20px; }
.ai-search input { border: none; box-shadow: none; padding: 8px 4px; font-size: 15px; background: transparent; }
.ai-search input:focus { box-shadow: none; }
.ai-search .btn-primary { flex: none; }

.ai-answer { margin-top: 18px; animation: slide-down .3s cubic-bezier(.2,.7,.3,1); }
.ai-answer-head { margin-bottom: 10px; }
.ai-badge { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--violet); background: var(--violet-bg); border: 1px solid var(--violet-bd); padding: 3px 9px; border-radius: 999px; }
.ai-answer-text { font-size: 16px; line-height: 1.6; margin: 0 0 4px; color: var(--text); }
.ai-answer-text strong { font-weight: 750; }

.ai-results { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.ai-result { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); transition: border-color var(--speed), background var(--speed), transform var(--speed); }
.ai-result:hover { text-decoration: none; border-color: var(--primary); background: var(--primary-tint); transform: translateX(2px); }
.ai-result-type { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--surface-3); padding: 3px 7px; border-radius: 6px; flex: none; width: 56px; text-align: center; }
.ai-result-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.ai-result-title { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-result-sub { font-size: 12.5px; color: var(--muted); }

.ai-suggest { margin-top: 22px; }
.ai-suggest-label { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 10px; }
.ai-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-chip { background: var(--surface); border: 1px solid var(--border-strong); color: var(--text-2); padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 550; cursor: pointer; font-family: inherit; transition: all var(--speed); }
.ai-chip:hover { border-color: var(--violet); color: var(--violet); background: var(--violet-bg); }
.ai-foot { margin-top: 24px; font-size: 12.5px; }
.ai-foot code { background: var(--surface-3); padding: 1px 6px; border-radius: 5px; }

/* ---------- Pagination ---------- */
.pagination { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 16px; }
.pagination .pg-info { color: var(--muted); font-size: 12.5px; margin-right: auto; }
.pg-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 34px; padding: 0 9px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: 13px; font-weight: 600; cursor: pointer; }
.pg-btn:hover { background: var(--surface-2); text-decoration: none; border-color: var(--border-strong); }
.pg-btn.active { background: var(--primary-grad); color: #fff; border-color: transparent; }
.pg-btn.disabled { opacity: .45; pointer-events: none; }
.pg-gap { color: var(--muted); padding: 0 2px; }

/* ---------- View toggle (List / Board) ---------- */
.view-toggle { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.view-toggle a { padding: 6px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.view-toggle a:hover { color: var(--text); text-decoration: none; }
.view-toggle a.active { background: var(--surface); color: var(--primary-d); box-shadow: var(--shadow-xs); }

/* ---------- Kanban ---------- */
.kanban { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 14px; align-items: flex-start; }
.kanban-col { flex: 0 0 270px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 200px); }
.kanban-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 14px; border-bottom: 1px solid var(--border); }
.kanban-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13.5px; }
.kdot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.kcol-new .kdot { background: var(--blue); }
.kcol-contacted .kdot { background: var(--amber); }
.kcol-qualified .kdot, .kcol-proposal .kdot { background: var(--violet); }
.kcol-won .kdot { background: var(--green); }
.kcol-lost .kdot { background: var(--red); }
.kcol-todo .kdot { background: var(--blue); }
.kcol-in_progress .kdot { background: var(--amber); }
.kcol-done .kdot { background: var(--green); }
.kc-due { font-size: 12px; color: var(--muted); }
.kc-due.overdue { color: var(--red); font-weight: 600; }
.kanban-meta { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
.kcount { font-weight: 700; font-size: 13px; }
.ktotal { font-size: 11.5px; color: var(--muted); }
.kanban-cards { padding: 10px; display: flex; flex-direction: column; gap: 9px; overflow-y: auto; min-height: 80px; flex: 1; transition: background var(--speed); border-radius: 0 0 var(--radius) var(--radius); }
.kanban-cards.over { background: var(--primary-tint); box-shadow: inset 0 0 0 2px var(--primary); }
.kanban-card { background: var(--surface); border: 1px solid var(--border); border-radius: 11px; padding: 12px; box-shadow: var(--shadow-xs); cursor: grab; transition: box-shadow var(--speed), transform var(--speed), border-color var(--speed); }
.kanban-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.kanban-card.dragging { opacity: .5; transform: rotate(1.5deg); cursor: grabbing; }
.kanban-card.flash-ok { animation: flash-ok .7s ease; }
@keyframes flash-ok { 0% { box-shadow: 0 0 0 3px var(--green-bd); } 100% { box-shadow: var(--shadow-xs); } }
.kc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; }
.kc-name { font-weight: 650; color: var(--text); font-size: 14px; line-height: 1.3; }
.kc-grip { color: var(--border-strong); font-size: 11px; letter-spacing: -2px; cursor: grab; user-select: none; }
.kc-company { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.kc-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 11px; gap: 8px; }
.kc-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.kc-value { font-weight: 700; font-size: 13.5px; color: var(--text); }
.kc-owner { width: 24px; height: 24px; border-radius: 50%; background: var(--primary-grad); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }
.kanban-empty { text-align: center; color: var(--border-strong); font-size: 12px; padding: 14px 0 6px; font-weight: 600; pointer-events: none; }
.kanban-cards .kanban-card ~ .kanban-empty { display: none; }

/* ---------- Responsive (mobile / tablet) ----------
   Kept at the END of the file so these overrides win over the base rules
   above them regardless of equal specificity (later rule wins). */
@media (max-width: 900px) {
    .grid-2 { grid-template-columns: 1fr; }
    .nav-toggle { display: inline-flex; }
    /* Sidebar becomes an off-canvas drawer */
    .sidebar { position: fixed; top: 0; left: 0; height: 100vh; height: 100dvh; overflow-y: auto; transform: translateX(-100%); transition: transform .25s ease; z-index: 60; box-shadow: var(--shadow-lg); }
    body.nav-open .sidebar { transform: translateX(0); }
    .nav-backdrop { display: block; position: fixed; inset: 0; background: rgba(19,26,38,.45); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .25s; }
    body.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }
    body.nav-open { overflow: hidden; }
    .content-body { padding: 20px 16px; }
    .page-head { flex-wrap: wrap; gap: 12px; align-items: flex-start; }
    .topbar { padding: 10px 14px; }
    .topbar-search { flex: 1; min-width: 0; max-width: none; }
    /* Single-column forms so fields (incl. the phone country-code group) get full width */
    .form-grid { grid-template-columns: 1fr; }
    .form-card { padding: 18px; }
    .page-head h1 { font-size: 21px; }
    /* Wide tables scroll horizontally instead of breaking the layout */
    .table-card { overflow-x: auto; }
    .table-card table { min-width: 680px; }
}
@media (max-width: 480px) {
    /* Keep the phone country-code compact so the number input stays visible */
    .phone-group .cc-select { width: 92px; }
}
