/* Syrow Sales CRM */
:root {
  --primary: #3466ef;
  --primary-dark: #2451c9;
  --primary-soft: rgba(52, 102, 239, .12);
  --sidebar: #131a30;
  --sidebar-2: #1b2340;
  --bg: #f1f5f9;
  --card: #ffffff;
  --card-2: #f8fafc;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --border-soft: #f1f5f9;
  --danger: #dc2626;
  --success: #16a34a;
  --col-bg: #eaeef4;
  --highlight: #fefce8;
  --highlight-border: #fde68a;
  --highlight-accent: #b45309;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 4px 16px -8px rgba(15, 23, 42, .08);
  color-scheme: light;
}
html[data-theme="dark"] {
  --primary: #5b83f5;
  --primary-dark: #3f66e0;
  --primary-soft: rgba(91, 131, 245, .16);
  --sidebar: #0c1226;
  --sidebar-2: #131b36;
  --bg: #0b1020;
  --card: #151c31;
  --card-2: #1a2340;
  --text: #e6ebf4;
  --muted: #93a0b8;
  --border: #263352;
  --border-soft: #1d2742;
  --col-bg: #10172b;
  --highlight: #2b2611;
  --highlight-border: #5b4d1d;
  --highlight-accent: #fbbf24;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px -10px rgba(0, 0, 0, .5);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100vh; min-height: 100dvh; }
.sidebar {
  width: 232px; flex: 0 0 232px; position: sticky; top: 0; height: 100vh; height: 100dvh;
  background: linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
  color: #cbd5e1; display: flex; flex-direction: column; padding: 18px 14px;
  z-index: 90;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: inherit; }
a.brand:hover .brand-name { color: #7ea2ff; }
.brand-icon { width: 40px; height: 40px; border-radius: 10px; background: #fff; padding: 3px; object-fit: contain; box-shadow: 0 4px 14px -4px rgba(52, 102, 239, .7); }
.brand-name { color: #fff; font-weight: 800; font-size: 16px; line-height: 1.1; }
.brand-sub { font-size: 11px; color: #7ea2ff; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 11px; color: #9fb4e8; padding: 10px 12px;
  border-radius: 9px; font-weight: 500; transition: background .15s, color .15s;
}
.nav a svg { width: 18px; height: 18px; opacity: .85; }
.nav a:hover { background: rgba(255, 255, 255, .06); color: #dbe6ff; }
.nav a.active { background: var(--primary); color: #fff; box-shadow: 0 4px 14px -6px rgba(52, 102, 239, .9); }
.nav-badge {
  margin-left: auto; background: rgba(255, 255, 255, .14); color: #dbe6ff;
  font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 999px; line-height: 1.4;
}
.nav a.active .nav-badge { background: rgba(255, 255, 255, .25); color: #fff; }
.sidebar-user { display: flex; align-items: center; gap: 8px; border-top: 1px solid rgba(255,255,255,.08); padding-top: 14px; }
.user-chip { display: flex; align-items: center; gap: 10px; color: #e2e8f0; flex: 1; min-width: 0; }
.user-meta { min-width: 0; display: flex; flex-direction: column; }
.user-meta b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta small { color: #7ea2ff; font-size: 11px; }
.logout { color: #64748b; padding: 8px; border-radius: 8px; }
.logout:hover { color: #f87171; background: rgba(255,255,255,.06); }
.logout svg { width: 18px; height: 18px; display: block; }
.backdrop { display: none; }

.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex: 0 0 auto;
}
.avatar.sm { width: 26px; height: 26px; font-size: 10px; }
.avatar.lg { width: 56px; height: 56px; font-size: 20px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 28px; background: var(--card); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 19px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.2); flex: 0 0 auto; }
.live-dot.off { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,.2); }
.content { padding: 24px 28px 48px; display: flex; flex-direction: column; gap: 18px; }

/* Icon buttons (topbar, eye toggles, field links) */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--card); color: var(--muted); cursor: pointer; padding: 0;
}
.icon-btn:hover { color: var(--primary); border-color: var(--primary); }
/* The 'display' above is an author rule and wins over the UA's [hidden]{display:none}
   regardless of specificity (origin beats specificity in the cascade) — restate it
   explicitly here so JS-driven hidden toggles (e.g. the notif bell) actually hide. */
.icon-btn[hidden] { display: none; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.sm { width: 28px; height: 28px; border-radius: 7px; }
.icon-btn.sm svg { width: 15px; height: 15px; }
.icon-btn.off { color: #b6c2d4; background: transparent; }
.hamburger { display: none; }
html[data-theme="light"] .ic-sun { display: none; }
html[data-theme="dark"] .ic-moon { display: none; }

/* Reminder-alert bell: swap icon by permission state, nudge attention when off */
.notif-bell .ic-bell-off { display: none; }
.notif-bell[data-state="muted"] .ic-bell,
.notif-bell[data-state="denied"] .ic-bell { display: none; }
.notif-bell[data-state="muted"] .ic-bell-off,
.notif-bell[data-state="denied"] .ic-bell-off { display: inline; }
.notif-bell[data-state="granted"] { color: var(--primary); border-color: var(--primary); }
.notif-bell[data-state="muted"],
.notif-bell[data-state="denied"] { color: #b6c2d4; }
/* "default" = never asked: pulse a dot so users discover the feature */
.notif-bell[data-state="default"] { position: relative; }
.notif-bell[data-state="default"]::after {
  content: ""; position: absolute; top: 6px; right: 6px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 2px var(--card);
  animation: notifPulse 1.8s ease-in-out infinite;
}
@keyframes notifPulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* Login "enable reminder alerts?" soft-prompt */
.notif-prompt-head { display: flex; align-items: flex-start; gap: 14px; }
.notif-prompt-ic {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: 12px; color: var(--primary);
  background: rgba(52, 102, 239, .14);
}
.notif-prompt-ic svg { width: 22px; height: 22px; }
#notif-prompt-dialog h3 { margin: 0 0 3px; }
#notif-prompt-dialog p { margin: 0; font-size: 13.5px; line-height: 1.5; }
.notif-prompt-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 4px; }

.icon-link {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 6px; vertical-align: middle; margin-left: 4px;
  color: var(--primary); background: var(--primary-soft);
}
.icon-link:hover { background: var(--primary); color: #fff; }
.icon-link svg { width: 13px; height: 13px; }

/* ---------- Cards / grids ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h3 { font-size: 15px; display: inline-flex; align-items: center; gap: 7px; }
.head-ic { width: 16px; height: 16px; color: var(--primary); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: 1fr; } }
.chart-box { height: 240px; position: relative; }
.chart-box.tall { height: 300px; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.kpi { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi small { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; display: flex; align-items: center; gap: 6px; }
.kpi b { display: block; font-size: 24px; margin-top: 6px; }
.kpi-foot { color: var(--muted); font-size: 11px; }
.kpi-main { background: linear-gradient(135deg, #3466ef, #6d3ef0); border: none; color: #fff; }
.kpi-main b { color: #fff; }
.kpi-main small, .kpi-main .kpi-foot { color: #c7d7fe; }
.kpi-warn { border-color: #fbbf24; }
a.kpi { display: block; text-decoration: none; color: inherit; transition: transform .12s, box-shadow .12s, border-color .12s; }
a.kpi:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(15, 23, 42, .1); border-color: var(--primary); }
a.kpi.kpi-main:hover { box-shadow: 0 6px 18px rgba(52, 102, 239, .35); }
a.kpi.kpi-warn:hover { border-color: #fbbf24; }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 10px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table.clickable tbody tr { cursor: pointer; }
.table.clickable tbody tr:hover { background: var(--card-2); }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-foot { display: flex; align-items: center; justify-content: space-between; padding-top: 12px; flex-wrap: wrap; gap: 8px; }
.pager { display: flex; align-items: center; gap: 10px; }
.w-check { width: 38px; }
.row-muted { opacity: .55; }
.row-overdue td:first-child b { color: var(--danger); }
.mono { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: 12px; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.t-right { text-align: right; }
.inline { display: inline-block; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.int-new { background: #dbeafe; color: #1d4ed8; }
.int-pending { background: #fef3c7; color: #b45309; }
.int-hold { background: #e2e8f0; color: #475569; }
.int-refund { background: #fee2e2; color: #b91c1c; }
.int-completed { background: #dcfce7; color: #15803d; }
.int-junk { background: #f5f5f4; color: #78716c; }
.st-pending { background: #dbeafe; color: #1d4ed8; }
.st-done { background: #dcfce7; color: #15803d; }
.st-cancelled { background: #fee2e2; color: #b91c1c; }
.st-overdue { background: #ffe4d5; color: #c2410c; box-shadow: inset 0 0 0 1px #fdba74; }
.role-primary { background: #ede9fe; color: #6d28d9; }
.role-spoc { background: #dbeafe; color: #1d4ed8; }
.role-staff { background: #e2e8f0; color: #475569; }
.role-decision_maker { background: #ffedd5; color: #c2410c; }
.role-u-admin { background: #ede9fe; color: #6d28d9; }
.role-u-manager { background: #dbeafe; color: #1d4ed8; }
.role-u-executive { background: #dcfce7; color: #15803d; }
html[data-theme="dark"] .badge { filter: saturate(.9); }
html[data-theme="dark"] .int-hold, html[data-theme="dark"] .role-staff { background: #2a3654; color: #b5c3dc; }
html[data-theme="dark"] .int-junk { background: #2a2e3a; color: #a8adb9; }

/* ---------- Forms ---------- */
.input {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 9px;
  font: inherit; color: var(--text); background: var(--card); transition: border .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
textarea.input { resize: vertical; }
select.input { appearance: auto; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--muted); display: flex; align-items: center; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid.compact { margin-bottom: 14px; }
.form-grid .span2 { grid-column: span 2; }
.stack { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; }
.filters .input { width: auto; }
.filters .grow { flex: 1; min-width: 180px; }
.pseudo-input { padding: 9px 12px; background: var(--card-2); border: 1px dashed var(--border); border-radius: 9px; color: var(--muted); min-height: 38px; }

/* Leads list: masked phone/email reveal button */
.reveal-btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px dashed var(--border); background: var(--card-2);
  color: var(--muted); font: inherit; font-size: 13px; letter-spacing: .03em; padding: 3px 9px; border-radius: 7px;
  cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.reveal-btn:hover { border-color: var(--primary); color: var(--primary); }
.reveal-btn.revealed { border-style: solid; border-color: var(--primary); background: var(--primary-soft); color: var(--text); font-family: inherit; letter-spacing: normal; cursor: copy; }
.reveal-btn .reveal-text { pointer-events: none; }
.mini-label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; display: block; margin-bottom: 4px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px;
  border-radius: 9px; border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer;
  transition: background .15s, box-shadow .15s; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 14px -6px rgba(52, 102, 239, .7); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-ghost:hover { background: var(--card-2); color: var(--text); }
.btn-ghost.danger { color: var(--danger); }
.btn-sm { padding: 5px 11px; font-size: 12.5px; border-radius: 7px; }
.btn-lg { padding: 12px 18px; font-size: 15px; border-radius: 11px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Auth ---------- */
.auth-body {
  min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(52, 102, 239, .35) 0%, transparent 60%),
    radial-gradient(800px 500px at 110% 110%, rgba(109, 62, 240, .3) 0%, transparent 55%),
    linear-gradient(160deg, #0c1226 0%, #131a30 100%);
  padding: 20px;
}
.auth-split {
  display: flex; width: 100%; max-width: 880px; min-height: 520px;
  background: var(--card); border-radius: 22px; overflow: hidden;
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .6);
}
.auth-split.single { max-width: 440px; min-height: 0; }
.auth-hero {
  flex: 1 1 46%; position: relative; overflow: hidden; color: #fff;
  background: linear-gradient(160deg, #3466ef 0%, #2547b8 55%, #1b2f7e 100%);
  display: flex; align-items: center; justify-content: center; padding: 40px;
}
.auth-hero-inner { position: relative; z-index: 2; text-align: center; }
.auth-hero-icon {
  width: 96px; height: 96px; border-radius: 24px; background: #fff; padding: 10px;
  object-fit: contain; box-shadow: 0 20px 50px -15px rgba(0, 0, 0, .55); margin-bottom: 18px;
}
.auth-hero h2 { font-size: 26px; font-weight: 800; letter-spacing: .01em; }
.auth-hero p { color: #c7d7fe; margin: 10px 0 0; line-height: 1.6; font-size: 14.5px; }
.hero-tag { display: inline-block; margin-top: 10px; font-weight: 700; color: #fff; background: rgba(255,255,255,.14); padding: 4px 14px; border-radius: 999px; font-size: 13px; }
.auth-hero-glow { position: absolute; border-radius: 50%; filter: blur(10px); opacity: .5; }
.auth-hero-glow.g1 { width: 340px; height: 340px; border: 44px solid rgba(255,255,255,.08); top: -140px; right: -120px; }
.auth-hero-glow.g2 { width: 280px; height: 280px; border: 36px solid rgba(255,255,255,.07); bottom: -120px; left: -100px; }
.auth-panel { flex: 1 1 54%; padding: 46px 44px; display: flex; flex-direction: column; justify-content: center; }
.auth-logo-chip { margin-bottom: 22px; }
.auth-logo-chip img { height: 44px; width: auto; display: block; background: #fff; border-radius: 10px; padding: 5px 12px; box-shadow: 0 2px 10px -2px rgba(15, 23, 42, .18); }
.auth-panel h1 { font-size: 24px; }
.auth-sub { color: var(--muted); margin: 6px 0 22px; }
.auth-panel form { display: flex; flex-direction: column; gap: 14px; }
.auth-foot { margin-top: 18px; font-size: 13px; }
.alert { padding: 10px 14px; border-radius: 9px; font-size: 13px; margin-bottom: 14px; }
.alert-error { background: #fee2e2; color: #b91c1c; }
.alert-success { background: #dcfce7; color: #15803d; }
@media (max-width: 760px) {
  .auth-body { padding: 14px; align-items: flex-start; padding-top: 6vh; }
  .auth-split { flex-direction: column; min-height: 0; max-width: 440px; }
  .auth-hero { padding: 26px; flex: 0 0 auto; }
  .auth-hero-icon { width: 64px; height: 64px; border-radius: 16px; margin-bottom: 10px; }
  .auth-hero h2 { font-size: 20px; }
  .auth-hero p { font-size: 13px; }
  .auth-panel { padding: 26px 22px 30px; }
}

/* ---------- Kanban ---------- */
.board-hint { font-size: 12.5px; }
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 14px; align-items: flex-start; -webkit-overflow-scrolling: touch; }
.col { flex: 0 0 262px; background: var(--col-bg); border-radius: var(--radius); max-height: calc(100vh - 210px); display: flex; flex-direction: column; }
.col header {
  display: flex; align-items: center; gap: 8px; padding: 11px 13px;
  border-top: 3px solid #94a3b8; border-radius: var(--radius) var(--radius) 0 0; background: var(--card);
  border-bottom: 1px solid var(--border); position: sticky; top: 0;
}
.col header h4 { font-size: 12.5px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col header .count { background: var(--card-2); color: var(--muted); font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.col.locked { opacity: .75; }
/* Column reordering */
.col:not(.pinned) > header { cursor: grab; }
.col:not(.pinned) > header:active { cursor: grabbing; }
.col header .col-grip { color: var(--muted); font-size: 13px; line-height: 1; opacity: .45; letter-spacing: -1px; }
.col:not(.pinned) > header:hover .col-grip { opacity: .9; }
.col-ghost { opacity: .35; }
.col-chosen > header { box-shadow: 0 0 0 2px var(--primary) inset; }
.col-drag { box-shadow: 0 8px 24px rgba(15, 23, 42, .22); }
/* Kanban executive filter */
.board-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 12px; }
.filter-menu { position: relative; }
.filter-menu > summary { list-style: none; }
.filter-menu > summary::-webkit-details-marker { display: none; }
.filter-menu > summary .caret { transition: transform .15s; font-size: 10px; }
.filter-menu[open] > summary .caret { transform: rotate(180deg); }
.filter-badge { background: var(--primary); color: #fff; font-size: 11px; font-weight: 700; min-width: 18px; text-align: center; padding: 1px 6px; border-radius: 999px; }
.filter-pop {
  position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; min-width: 220px;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow); padding: 6px; max-height: 320px; overflow-y: auto;
}
.filter-opt { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 7px; cursor: pointer; font-size: 13px; }
.filter-opt:hover { background: var(--card-2); }
.filter-opt input { width: 15px; height: 15px; accent-color: var(--primary); }
.filter-actions { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 6px; text-align: right; }
.filter-summary { font-size: 12.5px; }
.kcard.filtered-out { display: none; }
.col-body { list-style: none; margin: 0; padding: 10px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; flex: 1; min-height: 60px; }
.kcard {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 11px 12px;
  cursor: grab; box-shadow: 0 1px 2px rgba(15, 23, 42, .06); display: flex; flex-direction: column; gap: 5px;
  touch-action: none;
}
.kcard:active { cursor: grabbing; }
.kcard b { font-size: 13px; }
.kcard .ktop { display: flex; align-items: flex-start; gap: 6px; }
.kcard .ktop b { flex: 1; min-width: 0; }
/* per-card stage picker */
.kmove {
  flex: 0 0 auto; width: 20px; height: 20px; margin: -2px -3px 0 0; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid transparent; border-radius: 6px;
  color: var(--muted); cursor: pointer; opacity: .5; transition: opacity .15s, background .15s;
}
.kmove svg { width: 13px; height: 13px; }
.kcard:hover .kmove { opacity: 1; }
.kmove:hover, .kmove.open { opacity: 1; background: var(--card-2); border-color: var(--border); color: var(--text); }
.kmove-pop {
  position: fixed; z-index: 60; min-width: 208px; max-height: 340px; overflow-y: auto;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow); padding: 6px;
}
.kmove-head { font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 4px 10px 6px; }
.kmove-item {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  padding: 7px 10px; border: 0; border-radius: 7px; background: transparent;
  color: var(--text); font: inherit; font-size: 13px; cursor: pointer;
}
.kmove-item:hover { background: var(--card-2); }
.kmove-item .kmove-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kmove-item.current, .kmove-item.current:hover { color: var(--muted); background: transparent; cursor: default; }
.kmove-cur { font-size: 10.5px; color: var(--muted); }
.kcard.moving { opacity: .5; }
.kcard.just-moved { box-shadow: 0 0 0 2px var(--primary); }
.kcard .kco { color: var(--muted); font-size: 12px; }
.kcard .kmeta { display: flex; gap: 6px; flex-wrap: wrap; }
.kcard .kfoot { display: flex; align-items: center; justify-content: space-between; font-size: 11px; margin-top: 2px; }
.sortable-ghost { opacity: .4; }
.sortable-drag { transform: rotate(2deg); }
.chip { background: var(--card-2); border: 1px solid var(--border-soft); border-radius: 999px; padding: 2px 9px; font-size: 11px; color: var(--muted); display: inline-block; }
.chip.val { background: #dcfce7; color: #15803d; border: none; font-weight: 700; }
.chip.chip-source { background: #ffedd5; border-color: #fed7aa; color: #c2410c; font-weight: 600; }
html[data-theme="dark"] .chip.chip-source { background: #3a2416; border-color: #6b3b18; color: #fdba74; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

/* ---------- Lead detail ---------- */
.lead-head { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.lead-nav { flex-basis: 100%; display: flex; align-items: center; gap: 8px; }
.lead-nav .spacer { flex: 1; }
.lead-nav-pos { font-size: 12px; white-space: nowrap; }
.btn.disabled { opacity: .45; pointer-events: none; }
kbd {
  background: var(--card-2); border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: 5px; padding: 0 5px; font-size: 11px; font-family: inherit;
}
.kbd-hint { font-size: 11px; white-space: nowrap; }
@media (max-width: 860px) { .kbd-hint { display: none; } }
.backlink { font-size: 12.5px; display: inline-block; margin-bottom: 6px; }
.lead-nav .backlink { margin-bottom: 0; }
.lead-head h2 { font-size: 20px; }
.lead-controls { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.inline-form { min-width: 210px; }
.lead-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .lead-grid { grid-template-columns: 1fr; } }
.lead-col { display: flex; flex-direction: column; gap: 18px; }

.check-inline { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.check-inline input { width: 14px; height: 14px; accent-color: var(--primary); }

.notes-card {
  border: 1px solid var(--highlight-border);
  background: var(--highlight);
  box-shadow: 0 6px 24px -12px rgba(180, 130, 20, .4);
  position: relative;
}
.notes-card .card-head h3 { color: var(--highlight-accent); }
.notes-card .card-head h3 .head-ic { color: var(--highlight-accent); }
.notes-card .timeline li { border-left-color: var(--highlight-border); }
.notes-card .timeline li::before { background: var(--highlight-accent); }
textarea.highlight-y { background: var(--highlight); border-color: var(--highlight-border); }

.activity-card {
  border: 1px solid var(--highlight-border);
  background: var(--highlight);
}
.activity-card .card-head h3 { color: var(--highlight-accent); }
button.icon-link { border: 0; cursor: pointer; padding: 0; font: inherit; }

.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.timeline li { padding: 10px 0 10px 16px; border-left: 2px solid var(--border); position: relative; }
.timeline li::before {
  content: ''; position: absolute; left: -5px; top: 16px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--primary);
}
.timeline.slim li { padding: 7px 0 7px 16px; }
.tl-meta { font-size: 11.5px; color: var(--muted); margin-bottom: 3px; }
.tl-body { font-size: 13px; }
.pre { white-space: pre-wrap; word-break: break-word; }
.history summary { cursor: pointer; font-weight: 600; color: var(--primary); font-size: 13px; margin-top: 10px; }
.profile-row { display: flex; gap: 14px; align-items: center; }

/* ---------- Tabs / misc ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; flex-wrap: wrap; }
.tabs.no-border { border-bottom: none; margin-bottom: 0; }
.tab { padding: 9px 14px; border-radius: 9px 9px 0 0; color: var(--muted); font-weight: 600; font-size: 13px; }
.tab.active { color: var(--primary); box-shadow: inset 0 -2px 0 var(--primary); }
.tab .count { font-size: 11px; background: var(--card-2); border: 1px solid var(--border-soft); padding: 1px 7px; border-radius: 999px; }
/* Tabs that need to stand apart from the neutral set. */
.tab.t-overdue { color: #c2410c; }
.tab.t-overdue.active { color: #c2410c; box-shadow: inset 0 -2px 0 #ea580c; }
.tab.t-overdue .count { background: #ffe4d5; border-color: #fdba74; color: #c2410c; }
.tab.t-future { color: #6d28d9; }
.tab.t-future.active { color: #6d28d9; box-shadow: inset 0 -2px 0 #7c3aed; }
.tab.t-future .count { background: #ede9fe; border-color: #ddd6fe; color: #6d28d9; }
html[data-theme="dark"] .tab.t-overdue, html[data-theme="dark"] .tab.t-overdue.active { color: #fb923c; }
html[data-theme="dark"] .tab.t-overdue .count { background: #3a2416; border-color: #6b3b18; color: #fdba74; }
html[data-theme="dark"] .tab.t-future, html[data-theme="dark"] .tab.t-future.active { color: #c4b5fd; }
html[data-theme="dark"] .tab.t-future .count { background: #2b2350; border-color: #4c3f8a; color: #ddd6fe; }
html[data-theme="dark"] .st-overdue { background: #3a2416; color: #fdba74; box-shadow: inset 0 0 0 1px #6b3b18; }
.bulkbar { display: flex; align-items: center; gap: 12px; border: 1px solid var(--primary); background: var(--primary-soft); flex-wrap: wrap; }
.bulkbar .input { width: auto; }
.empty-state { text-align: center; padding: 60px 20px; }
.empty-state h2 { font-size: 44px; color: var(--border); }
.empty-state p { color: var(--muted); margin: 10px 0 20px; }

.dialog { border: none; border-radius: 14px; padding: 22px; width: 420px; max-width: 92vw; box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .45); background: var(--card); color: var(--text); }
.dialog::backdrop { background: rgba(6, 10, 24, .55); backdrop-filter: blur(2px); }
.dialog h3 { margin-bottom: 4px; }

#toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 999; max-width: calc(100vw - 40px); }
.toast {
  background: #0f172a; color: #f1f5f9; padding: 11px 16px; border-radius: 10px; font-size: 13px;
  box-shadow: 0 10px 30px -8px rgba(0, 0, 0, .5); animation: toast-in .25s ease; max-width: 340px;
}
html[data-theme="dark"] .toast { background: #263352; }
.toast.success { border-left: 3px solid #22c55e; }
.toast.error { border-left: 3px solid #ef4444; }
.toast.info { border-left: 3px solid var(--primary); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Mobile ---------- */
@media (max-width: 860px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; height: 100dvh; width: 262px;
    transform: translateX(-105%); transition: transform .22s ease;
    box-shadow: 0 0 60px rgba(0, 0, 0, .5);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  .backdrop { position: fixed; inset: 0; background: rgba(6, 10, 24, .5); z-index: 80; }
  body:not(.nav-open) .backdrop { display: none; }
  body.nav-open .backdrop { display: block; }
  body.nav-open { overflow: hidden; }
  .hamburger { display: inline-flex; }
  .topbar { padding: 12px 14px; }
  .topbar-right .now { display: none; }
  .content { padding: 14px 14px 40px; gap: 14px; }
  .card { padding: 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span2 { grid-column: span 1; }
  .filters .input { flex: 1 1 45%; }
  .filters .grow { flex-basis: 100%; }
  .lead-controls { width: 100%; }
  .inline-form { flex: 1; min-width: 150px; }
  .col { flex-basis: 240px; max-height: calc(100dvh - 190px); }
  .kpi b { font-size: 20px; }
  .chart-box { height: 210px; }
  .chart-box.tall { height: 250px; }
  .pager { margin-left: auto; }
  .dialog { width: 94vw; padding: 18px; }
}

/* ---------- Reports ---------- */
.t-center { text-align: center; }
.fld { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
.fld .input { width: auto; }
.rep-presets { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.rep-presets .chip { padding: 5px 12px; font-size: 12px; text-decoration: none; transition: background .15s, color .15s; }
.rep-presets .chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.rep-card .card-head h3 { display: flex; align-items: center; gap: 9px; }
.rep-table th.grp { border-bottom: 1px solid var(--border); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.rep-table th.stage-col { font-weight: 600; padding: 6px 8px; }
.rep-table td, .rep-table th { padding: 8px 10px; }
.rep-table td.t-center, .rep-table th.t-center { min-width: 46px; }
.rep-table .z { color: var(--border); }
.rep-table tfoot .rep-total td { font-weight: 800; border-top: 2px solid var(--border); border-bottom: none; background: var(--card-2); }
.rep-note { margin: 4px 2px 18px; font-size: 12px; line-height: 1.5; }
