/* CRM Pro — base styles. Matches TLP's general look: dark-blue topbar, dense tables. */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  font-size: 14px;
  color: #1f2937;
  background: #f3f4f6;
}

a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }
a.disabled { color: #9ca3af; pointer-events: none; }
.link-muted { color: #6b7280; font-size: 0.85rem; }

/* ============= App shell: topbar + sidebar + content ============= */
body.app-shell { display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  background: linear-gradient(90deg, #0f1e33 0%, #1e3a5f 50%, #2c4a6b 100%);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 1rem;
  min-height: 56px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.2);
  position: sticky; top: 0; z-index: 10;
}
.topbar-left { display: flex; align-items: center; gap: 1rem; }
.brand {
  font-weight: 700; font-size: 1.05rem;
  color: #fff; letter-spacing: 0.02em;
  display: inline-flex; align-items: center; gap: 0.4rem;
}
.brand:hover { text-decoration: none; }
.brand-mark { color: #60a5fa; }
.tenant { opacity: 0.75; font-size: 0.85rem; border-left: 1px solid rgba(255,255,255,0.25); padding-left: 1rem; }

.quick-submit {
  flex: 1; display: flex; gap: 0.25rem;
  background: rgba(255,255,255,0.08);
  padding: 0.25rem; border-radius: 6px;
  align-items: center; max-width: 620px;
  border: 1px solid rgba(255,255,255,0.08);
}
.quick-submit input {
  flex: 1; min-width: 0;
  padding: 0.35rem 0.6rem;
  border: none; border-radius: 4px;
  background: rgba(255,255,255,0.1);
  color: #fff; font-size: 0.85rem;
}
.quick-submit input::placeholder { color: #cbd5e1; }
.quick-submit input:focus { background: rgba(255,255,255,0.2); outline: none; }
.quick-submit button {
  padding: 0.35rem 0.9rem;
  border: none; border-radius: 4px;
  background: #10b981; color: #fff;
  cursor: pointer; font-size: 0.85rem; font-weight: 600;
}
.quick-submit button:hover { background: #059669; }

.super-search-form {
  display: flex; align-items: center;
  background: rgba(255,255,255,0.1);
  padding: 0.2rem; border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.08);
}
.super-search-form input {
  border: none; background: transparent;
  color: #fff; padding: 0.35rem 0.6rem;
  font-size: 0.85rem; width: 220px;
}
.super-search-form input::placeholder { color: #cbd5e1; }
.super-search-form input:focus { outline: none; }

.topbar-right { display: flex; align-items: center; gap: 0.5rem; }

.iconbtn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 8px;
  color: #fff; background: transparent; border: none;
  cursor: pointer;
}
.iconbtn:hover { background: rgba(255,255,255,0.1); text-decoration: none; }
.iconbtn .pip {
  position: absolute; top: 2px; right: 2px;
  background: #ef4444; color: #fff;
  border-radius: 10px; font-size: 0.65rem;
  padding: 0 0.35rem; min-width: 16px;
  text-align: center; font-weight: 700;
  box-shadow: 0 0 0 2px #1e3a5f;
}

.me {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.25rem 0.6rem 0.25rem 0.3rem;
  border-radius: 20px;
  color: #fff; background: rgba(255,255,255,0.08);
}
.me:hover { background: rgba(255,255,255,0.15); text-decoration: none; }
.me-name { font-size: 0.85rem; font-weight: 600; }

.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  color: #fff; font-size: 0.7rem; font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.2);
}

form.inline { display: inline; }
button.link {
  background: none; border: none; color: #93c5fd; cursor: pointer; padding: 0; font: inherit;
}
button.link:hover { text-decoration: underline; }

/* App body: sidebar + content */
.app {
  display: grid;
  grid-template-columns: 228px 1fr;
  flex: 1; min-height: 0;
}
.sidebar {
  background: #f9fafb;
  border-right: 1px solid #e5e7eb;
  padding: 0.75rem 0.5rem;
  overflow-y: auto;
  display: flex; flex-direction: column;
}
.sidenav { display: flex; flex-direction: column; gap: 2px; }
.sidenav-item {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.45rem 0.75rem;
  color: #374151; border-radius: 6px;
  font-size: 0.9rem; text-decoration: none;
}
.sidenav-item:hover { background: #eef2ff; color: #1e3a5f; text-decoration: none; }
.sidenav-item svg { color: #6b7280; flex-shrink: 0; }
.sidenav-item:hover svg { color: #1e3a5f; }
.sidenav-item.active {
  background: #1e3a5f; color: #fff; font-weight: 600;
}
.sidenav-item.active svg { color: #fff; }
.sidenav-divider { height: 1px; background: #e5e7eb; margin: 0.5rem 0.75rem; }

.sidecal {
  margin-top: auto; padding: 0.75rem 0.5rem 0.25rem;
  border-top: 1px solid #e5e7eb;
}
.sidecal-head {
  font-size: 0.75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: #6b7280; text-align: center; margin-bottom: 0.4rem;
}
.sidecal-grid { width: 100%; border-collapse: collapse; font-size: 0.72rem; }
.sidecal-grid th, .sidecal-grid td {
  text-align: center; padding: 0;
  color: #374151;
}
.sidecal-grid th { color: #9ca3af; font-weight: 600; padding: 2px; }
.sidecal-grid td a {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  color: inherit; text-decoration: none;
  position: relative;
}
.sidecal-grid td a:hover {
  background: #e0e7ff; color: #1e3a5f; text-decoration: none;
}
.sidecal-grid td.cal-today a {
  background: #1e3a5f; color: #fff; font-weight: 700;
}
.sidecal-grid td.cal-today a:hover { background: #2c4a6b; }
/* Days with scheduled tasks get a small dot under the number */
.sidecal-grid td.cal-hot a::after {
  content: "";
  position: absolute; bottom: 1px; left: 50%;
  transform: translateX(-50%);
  width: 4px; height: 4px;
  background: #ef4444; border-radius: 50%;
}
.sidecal-grid td.cal-today.cal-hot a::after { background: #fde68a; }

.sidecal-title {
  color: inherit; text-decoration: none;
}
.sidecal-title:hover { color: #1e3a5f; text-decoration: none; }

.content {
  padding: 1.25rem 1.5rem;
  min-width: 0;             /* prevents children from blowing out the grid */
  overflow-x: auto;
}
.content-nochrome { padding: 2rem 1rem; }

/* Page headers */
.page-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.page-header h1 { margin: 0; font-size: 1.5rem; }
h2 { font-size: 1.1rem; margin: 0 0 0.75rem; }
.muted { color: #6b7280; }

/* Buttons */
.btn, button, input[type="submit"] {
  padding: 0.5rem 0.9rem;
  background: #1e3a5f;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn:hover, button:hover { background: #2c4a6b; text-decoration: none; }
button.small { padding: 0.25rem 0.6rem; font-size: 0.8rem; }
button.danger { background: #dc2626; }
button.danger:hover { background: #b91c1c; }

/* Filter row */
.filter-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  align-items: center;
}
.filter-row input, .filter-row select {
  padding: 0.4rem 0.6rem;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 0.9rem;
}
.filter-row input[type="search"] { flex: 1; max-width: 400px; }

/* Tiles (home dashboard) */
.tile-row { display: flex; gap: 1rem; margin: 1.5rem 0; flex-wrap: wrap; }
.tile {
  flex: 1; min-width: 180px;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 6px;
  padding: 1rem 1.25rem;
}
.tile-label {
  font-size: 0.8rem; color: #6b7280;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.tile-value {
  font-size: 2rem; font-weight: 600; color: #1e3a5f; margin-top: 0.25rem;
}

.empty-note {
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  background: #fefce8;
  border: 1px solid #fde68a;
  border-radius: 6px;
  color: #713f12;
}

/* Data tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  overflow: hidden;
}
.data-table th, .data-table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid #f3f4f6;
  font-size: 0.9rem;
  vertical-align: top;
}
.data-table th {
  background: #f9fafb;
  font-weight: 600;
  color: #374151;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.data-table tr:hover td { background: #f9fafb; }

/* Login */
.login-wrap { min-height: 80vh; display: flex; align-items: center; justify-content: center; }
.login-card {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 8px;
  padding: 2rem; width: 100%; max-width: 380px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.login-card h1 { margin: 0 0 0.25rem; color: #1e3a5f; text-align: center; }
.tenant-label { margin: 0 0 1.5rem; text-align: center; color: #6b7280; }
.login-card label { display: block; margin-bottom: 1rem; font-size: 0.85rem; color: #374151; }
.login-card input {
  width: 100%; padding: 0.5rem; margin-top: 0.25rem;
  border: 1px solid #d1d5db; border-radius: 4px; font-size: 0.95rem;
}
.login-card button { width: 100%; padding: 0.6rem; font-size: 0.95rem; }
.alert {
  background: #fef2f2; border: 1px solid #fecaca; color: #991b1b;
  padding: 0.5rem 0.75rem; border-radius: 4px; margin-bottom: 1rem; font-size: 0.9rem;
}

/* Forms */
.form-grid { background: #fff; border: 1px solid #e5e7eb; border-radius: 6px; padding: 1.25rem; }
.form-grid fieldset { border: none; padding: 0; margin: 0 0 1.25rem; }
.form-grid legend { font-weight: 600; color: #374151; margin-bottom: 0.5rem; padding: 0; }
.form-grid label {
  display: block; margin-bottom: 0.75rem; font-size: 0.85rem; color: #4b5563;
}
.form-grid input, .form-grid select, .form-grid textarea {
  width: 100%; padding: 0.4rem 0.6rem; margin-top: 0.15rem;
  border: 1px solid #d1d5db; border-radius: 4px; font-size: 0.9rem; font-family: inherit;
}
.form-grid label.checkbox { display: flex; align-items: center; gap: 0.4rem; }
.form-grid label.checkbox input { width: auto; margin: 0; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.row-3 { display: grid; grid-template-columns: 1fr 80px 1fr; gap: 0.75rem; }
.row-4 { display: grid; grid-template-columns: 2fr 80px 1fr 120px; gap: 0.75rem; }
.form-actions { display: flex; gap: 0.75rem; align-items: center; margin-top: 1rem; }

/* Lead detail */
.lead-header {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 6px;
  padding: 1rem 1.25rem; margin-bottom: 1rem;
}
.lead-header-main {
  display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-bottom: 0.5rem;
}
.lead-header-main h1 { margin: 0; font-size: 1.3rem; }
.lead-header-contact {
  display: flex; gap: 1.5rem; flex-wrap: wrap;
  font-size: 0.9rem; color: #4b5563;
}

.step-pill {
  padding: 0.2rem 0.7rem; color: #fff; border-radius: 12px;
  font-size: 0.8rem; font-weight: 600;
}
.status-pill {
  padding: 0.15rem 0.55rem; border-radius: 3px;
  font-size: 0.75rem; font-weight: 600;
}
.status-closed_dead, .status-pill.status-closed_dead { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.status-sold, .status-pill.status-sold { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }

.contact-status {
  display: inline-block;
  padding: 0.15rem 0.55rem; border-radius: 3px;
  font-size: 0.75rem; font-weight: 600;
  text-transform: uppercase;
}
.contact-status.status-hot     { background: #fef2f2; color: #991b1b; }
.contact-status.status-warm    { background: #fef3c7; color: #92400e; }
.contact-status.status-cold    { background: #dbeafe; color: #1e40af; }
.contact-status.status-dead    { background: #f3f4f6; color: #374151; }
.contact-status.status-customer{ background: #ecfdf5; color: #065f46; }

.lead-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.card {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 6px;
  padding: 1rem 1.25rem; margin-bottom: 1rem;
}
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1rem; margin: 0; }
dl.kv dt { color: #6b7280; font-size: 0.85rem; }
dl.kv dd { margin: 0; }

.action-block { border-bottom: 1px solid #f3f4f6; padding: 0.75rem 0; }
.action-block:last-child { border-bottom: none; }
.action-block summary {
  font-weight: 600; cursor: pointer; color: #1e3a5f; padding: 0.25rem 0;
}
.action-block .stack { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.5rem; }
.action-block .stack label { font-size: 0.85rem; color: #4b5563; display: block; }
.action-block .stack input,
.action-block .stack select,
.action-block .stack textarea {
  width: 100%; padding: 0.35rem 0.5rem; margin-top: 0.15rem;
  border: 1px solid #d1d5db; border-radius: 4px; font-size: 0.9rem; font-family: inherit;
}

/* Pills (log types, activities, statuses) */
.pill {
  display: inline-block; padding: 0.15rem 0.5rem;
  border-radius: 3px; font-size: 0.75rem; font-weight: 600;
  background: #e5e7eb; color: #374151;
}
.pill-log { background: #1e3a5f; color: #fff; }
.pill-activity { background: #475569; color: #fff; }
.pill-status.pill-open     { background: #fef3c7; color: #92400e; }
.pill-status.pill-overdue  { background: #fef2f2; color: #991b1b; }
.pill-status.pill-completed { background: #ecfdf5; color: #065f46; }
.pill-status.pill-completed-late { background: #ffedd5; color: #9a3412; }

/* Step circle (planner list) */
.step-circle {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid; font-weight: 700;
}

/* Planner buckets */
.bucket { margin-bottom: 1.5rem; }
.bucket-header {
  font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 0.5rem 0.75rem; border-radius: 4px;
  margin: 0 0 0.5rem; color: #374151;
}
.bucket-today .bucket-header       { background: #dcfce7; color: #14532d; }
.bucket-overdue-1 .bucket-header   { background: #fef3c7; color: #78350f; }
.bucket-overdue-2 .bucket-header   { background: #ffedd5; color: #7c2d12; }
.bucket-overdue-3 .bucket-header   { background: #fee2e2; color: #7f1d1d; }
.bucket-upcoming .bucket-header    { background: #e0e7ff; color: #3730a3; }

/* Kanban */
.scope-toggle { display: flex; gap: 0.25rem; }
.scope-toggle a {
  padding: 0.35rem 0.75rem; border: 1px solid #d1d5db; border-radius: 4px;
  font-size: 0.85rem; color: #4b5563; background: #fff;
}
.scope-toggle a.active { background: #1e3a5f; color: #fff; border-color: #1e3a5f; }
.scope-toggle a:hover { text-decoration: none; }

.kanban {
  display: flex; gap: 0.5rem;
  overflow-x: auto; padding-bottom: 1rem;
  align-items: flex-start;
}
.kanban-col {
  flex: 0 0 240px; background: #f9fafb; border-radius: 6px;
  display: flex; flex-direction: column;
  max-height: 75vh;
}
.kanban-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.5rem 0.75rem;
  background: #fff; border-top: 3px solid #ccc;
  border-radius: 6px 6px 0 0;
  border-bottom: 1px solid #e5e7eb;
  position: sticky; top: 0;
}
.kanban-step { font-weight: 700; font-size: 0.85rem; color: #374151; }
.kanban-count {
  background: #e5e7eb; color: #374151;
  padding: 0.1rem 0.5rem; border-radius: 10px;
  font-size: 0.75rem; font-weight: 600;
}
.kanban-cards { padding: 0.5rem; overflow-y: auto; flex: 1; }
.kanban-card {
  display: block; background: #fff; border: 1px solid #e5e7eb;
  border-radius: 4px; padding: 0.6rem 0.75rem; margin-bottom: 0.5rem;
  color: #1f2937;
}
.kanban-card:hover { border-color: #1e3a5f; text-decoration: none; }
.kanban-name { font-weight: 600; color: #1e3a5f; font-size: 0.9rem; }
.kanban-meta {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 0.25rem; font-size: 0.75rem;
}
.last-log { font-weight: 600; color: #475569; }
.owner {
  padding: 0.05rem 0.4rem; background: #e5e7eb;
  border-radius: 2px; font-size: 0.7rem; font-weight: 600;
}
.kanban-unit { font-size: 0.75rem; margin-top: 0.25rem; }
.kanban-legend { margin-top: 1rem; font-size: 0.8rem; }

.dot { font-size: 1rem; line-height: 1; }
.dot.overdue { color: #dc2626; }
.dot.upcoming { color: #2563eb; }

/* Unit condition / status pills (Inventory) */
.pill-cond-new    { background: #dcfce7; color: #14532d; }
.pill-cond-used   { background: #fef3c7; color: #78350f; }
.pill-cond-demo   { background: #ede9fe; color: #4c1d95; }
/* Unit status pills — Bangor's workflow */
.pill-status-on_floor    { background: #ecfdf5; color: #065f46; }   /* green — on showroom */
.pill-status-built       { background: #dbeafe; color: #1e40af; }   /* blue — assembled / PDI'd */
.pill-status-pending     { background: #fef3c7; color: #78350f; }   /* amber — deposit / in motion */
.pill-status-sold        { background: #f3f4f6; color: #374151; }   /* gray — completed */
.pill-status-stop_sale   { background: #fef2f2; color: #991b1b; }   /* red — don't sell */
.pill-status-warehouse   { background: #ede9fe; color: #4c1d95; }   /* purple — off-floor stock */
/* Legacy aliases kept so old rows still render correctly if any are encountered */
.pill-status-available   { background: #ecfdf5; color: #065f46; }
.pill-status-on_deal     { background: #fef3c7; color: #78350f; }
.pill-status-transferred { background: #dbeafe; color: #1e40af; }
.pill-status-held        { background: #fee2e2; color: #7f1d1d; }

/* Generic bucket header (Today's Logs) */
.bucket-generic { background: #f3f4f6; color: #374151; }

/* Wrap long comment text in tables */
.data-table td.wrap { white-space: normal; max-width: 420px; }

/* Admin landing tiles & reports hub */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}
.admin-tile {
  display: block;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 1rem 1.25rem;
  color: #1f2937;
}
.admin-tile:hover { border-color: #1e3a5f; text-decoration: none; }
.admin-tile h3 { margin: 0 0 0.25rem; color: #1e3a5f; font-size: 1rem; }
.admin-tile p { margin: 0; font-size: 0.85rem; }

.subnav-end { margin-left: auto; }

pre.code-block {
  background: #0f172a; color: #e2e8f0;
  padding: 0.75rem 1rem; border-radius: 4px;
  overflow-x: auto;
  font-size: 0.85rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* Realtime inline-SVG-style bar charts (built with flex, no SVG needed) */
.chart {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  min-height: 200px;
  padding: 1rem 0;
  overflow-x: auto;
}
.chart-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 80px;
}
.chart-stack {
  display: flex;
  flex-direction: column-reverse;
  height: 160px;
  justify-content: flex-start;
  width: 40px;
}
.chart-stack .bar {
  width: 100%;
  border-top: 1px solid rgba(255,255,255,0.3);
}
.chart-stack .bar:first-child { border-top: none; }
.chart-user { margin-top: 0.5rem; font-size: 0.8rem; font-weight: 600; color: #374151; }
.chart-legend {
  display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem;
  margin-top: 0.75rem;
  font-size: 0.8rem;
}
.legend-item { display: inline-flex; align-items: center; gap: 0.25rem; }
.legend-swatch {
  display: inline-block; width: 12px; height: 12px;
  border-radius: 2px;
}

/* Lead index */
tr.row-muted td { color: #9ca3af; }
tr.row-muted a { color: #6b7280; }
.pill-type {
  background: #e5e7eb; color: #374151;
  text-transform: lowercase;
}

/* Pagination */
.pagination {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 1rem; padding: 0.5rem 0;
  gap: 1rem;
}
.pagination a { color: #1e3a5f; font-weight: 600; }

/* Messaging thread */
.thread { margin-top: 0.75rem; max-height: 480px; overflow-y: auto; }
.thread-msg {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.5rem;
  background: #fff;
}
.thread-in { background: #f9fafb; border-color: #d1d5db; }
.thread-out { background: #eff6ff; border-color: #bfdbfe; }
.thread-head { font-size: 0.85rem; display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: baseline; }
.thread-body {
  margin: 0.4rem 0 0;
  font-family: inherit;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 0.9rem;
}
.pill-email-sent, .pill-sms-sent { background: #ecfdf5; color: #065f46; }
.pill-email-delivered, .pill-sms-delivered { background: #ecfdf5; color: #065f46; }
.pill-email-opened { background: #ede9fe; color: #4c1d95; }
.pill-email-bounced, .pill-email-failed, .pill-sms-failed { background: #fef2f2; color: #991b1b; }
.pill-email-queued, .pill-sms-queued { background: #fef3c7; color: #78350f; }

/* Kanban drag-and-drop helpers */
.kanban-card-ghost {
  opacity: 0.4;
  background: #dbeafe !important;
}
.kanban-col { cursor: default; }
.kanban-card { cursor: grab; }
.kanban-card:active { cursor: grabbing; }

/* Visual sales funnel */
.funnel { margin: 1rem 0; }
.funnel-row {
  display: grid;
  grid-template-columns: 120px 1fr 80px;
  gap: 1rem;
  align-items: center;
  margin-bottom: 0.5rem;
}
.funnel-label { font-weight: 600; color: #374151; font-size: 0.9rem; }
.funnel-bar-wrap { position: relative; }
.funnel-bar {
  height: 32px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  padding: 0 0.75rem;
  min-width: 48px;
  color: #fff;
  font-weight: 700;
}
.funnel-count { font-size: 0.95rem; }
.funnel-current {
  position: absolute;
  right: -140px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8rem;
  white-space: nowrap;
}
.funnel-conv { text-align: right; font-weight: 700; font-size: 0.9rem; }
.conv-low { color: #dc2626; }
.conv-ok { color: #10b981; }

/* Saved-search chips */
.saved-searches {
  display: flex; gap: 0.5rem; flex-wrap: wrap;
  margin: 0.5rem 0 1rem;
  align-items: center;
}
.chip {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.3rem 0.7rem;
  background: #e0e7ff; color: #1e3a8a;
  border-radius: 14px;
  font-size: 0.85rem;
  text-decoration: none;
}
.chip:hover { background: #c7d2fe; text-decoration: none; }
.chip-x {
  background: none !important; color: inherit !important;
  padding: 0 !important; font-size: 1rem; line-height: 1; cursor: pointer;
  border: none; font-weight: 700;
}
.chip-new {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.15rem 0.35rem;
  background: #f3f4f6;
  border: 1px dashed #d1d5db;
  border-radius: 14px;
}
.chip-new input[name="name"] {
  border: none; background: transparent; font-size: 0.85rem;
  padding: 0.15rem 0.4rem; width: 180px;
}
.chip-new button {
  padding: 0.2rem 0.6rem; font-size: 0.8rem;
}
.chip-check { font-size: 0.8rem; color: #6b7280; display: inline-flex; align-items: center; gap: 0.25rem; }
.chip-check input { margin: 0; }

/* Contact tags */
.tag-pill {
  display: inline-flex; align-items: center;
  padding: 0.2rem 0.6rem;
  color: #fff; border-radius: 12px;
  font-size: 0.8rem; font-weight: 600;
}
.tag-row { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }

/* Notification bell */
.bell {
  position: relative;
  color: #fff; font-size: 1.1rem; text-decoration: none;
  display: inline-flex; align-items: center; padding: 0 0.35rem;
}
.bell:hover { text-decoration: none; opacity: 0.85; }
.bell-count {
  position: absolute;
  top: -4px; right: -8px;
  background: #dc2626; color: #fff;
  border-radius: 10px;
  padding: 0 0.4rem;
  font-size: 0.7rem; font-weight: 700;
  min-width: 18px; text-align: center;
}

/* Inline code block for routing rule JSON */
pre.code-inline {
  display: inline-block;
  margin: 0; padding: 0.2rem 0.4rem;
  background: #f3f4f6; color: #374151;
  font-size: 0.8rem; border-radius: 3px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  max-width: 280px;
}

/* Bulk actions bar (sticks to bottom of leads index when rows are selected) */
.bulk-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.75rem 1rem;
  background: #1e3a5f;
  color: #fff;
  border-radius: 6px;
  margin-top: 1rem;
  box-shadow: 0 -4px 10px rgba(0,0,0,0.1);
}
.bulk-bar select, .bulk-bar input {
  padding: 0.35rem 0.6rem;
  border-radius: 4px;
  border: 1px solid #475569;
  background: #fff;
  color: #1f2937;
  font-size: 0.9rem;
}
.bulk-bar button {
  background: #10b981;
  padding: 0.4rem 1rem;
}
.bulk-bar button:hover { background: #059669; }

/* Super search in topbar */
.super-search-form {
  display: flex; align-items: center;
  background: #2c4a6b; padding: 0.25rem;
  border-radius: 4px; max-width: 280px;
}
.super-search-form input {
  border: none; background: #3a5877;
  color: #fff;
  padding: 0.35rem 0.6rem;
  border-radius: 3px; font-size: 0.85rem;
  width: 260px;
}
.super-search-form input::placeholder { color: #cbd5e1; }
.super-search-form input:focus { outline: 2px solid #60a5fa; }

/* Calendar */
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 0.5rem; margin-top: 1rem;
}
.cal-col {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 6px;
  min-height: 300px; display: flex; flex-direction: column;
}
.cal-col.cal-today { border-color: #1e3a5f; box-shadow: 0 0 0 2px rgba(30,58,95,0.1); }
.cal-header {
  padding: 0.5rem; border-bottom: 1px solid #f3f4f6;
  text-align: center; background: #f9fafb;
}
.cal-col.cal-today .cal-header { background: #1e3a5f; color: #fff; }
.cal-day { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: #6b7280; }
.cal-col.cal-today .cal-day { color: #dbeafe; }
.cal-date { font-size: 1.25rem; font-weight: 700; }
.cal-items { padding: 0.25rem; flex: 1; overflow-y: auto; }
.cal-item {
  display: block; background: #eff6ff; border: 1px solid #bfdbfe;
  border-radius: 4px; padding: 0.35rem 0.5rem; margin-bottom: 0.25rem;
  font-size: 0.8rem; color: #1f2937;
}
.cal-item:hover { border-color: #1e3a5f; text-decoration: none; }
.cal-item.cal-done { background: #f0fdf4; border-color: #bbf7d0; opacity: 0.6; text-decoration: line-through; }
.cal-item.cal-overdue { background: #fef2f2; border-color: #fecaca; }
.cal-time { font-weight: 700; color: #1e3a5f; }
.cal-name { font-weight: 600; margin-top: 0.1rem; }
.cal-meta { font-size: 0.7rem; color: #6b7280; }
.cal-unit { font-size: 0.7rem; margin-top: 0.1rem; }
.cal-empty { text-align: center; padding: 2rem 0; font-size: 0.8rem; }

/* Contact notes */
.note-card {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 4px;
  padding: 0.5rem 0.75rem; margin-bottom: 0.4rem;
}
.note-card.note-pinned { background: #fefce8; border-color: #fde68a; }
.note-head { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; margin-bottom: 0.25rem; }
.note-body { white-space: pre-wrap; font-size: 0.9rem; }

/* Sortable table headers */
.data-table th a.sort-link {
  color: inherit;
  text-decoration: none;
  display: block;
  white-space: nowrap;
}
.data-table th a.sort-link:hover {
  color: #1e3a5f;
  text-decoration: none;
}

/* Inventory row coloring by brand / condition (Bangor spec) */
.data-table tr.row-brp    td { background: #fef9c3; }  /* Can-Am / Sea-Doo / Ski-Doo — yellow */
.data-table tr.row-kawa   td { background: #dcfce7; }  /* Kawasaki — green */
.data-table tr.row-honda  td { background: #fee2e2; }  /* Honda — red */
.data-table tr.row-arctic td { background: #ccfbf1; }  /* Arctic Cat — teal */
.data-table tr.row-used   td { background: #ffedd5; }  /* Used — orange (beats brand) */
/* Hover — slightly deeper shade so color coding stays visible */
.data-table tr.row-brp:hover    td { background: #fef08a; }
.data-table tr.row-kawa:hover   td { background: #bbf7d0; }
.data-table tr.row-honda:hover  td { background: #fecaca; }
.data-table tr.row-arctic:hover td { background: #99f6e4; }
.data-table tr.row-used:hover   td { background: #fed7aa; }

/* Team chat */
.chat-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1rem;
  height: calc(100vh - 160px);
  min-height: 500px;
}
.chat-sidebar {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 0.75rem;
  overflow-y: auto;
}
.chat-sidebar h3 {
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: #6b7280; margin: 0 0 0.4rem;
}
.chat-list { list-style: none; padding: 0; margin: 0; }
.chat-list li { margin-bottom: 0.15rem; }
.chat-list li a, .chat-list li .link-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.3rem 0.5rem; border-radius: 4px;
  color: #1f2937; text-decoration: none;
  background: transparent; border: none; width: 100%; text-align: left;
  font: inherit; cursor: pointer;
}
.chat-list li a:hover, .chat-list li .link-row:hover { background: #eef2ff; text-decoration: none; }
.chat-list li.active a { background: #1e3a5f; color: #fff; font-weight: 600; }
.chat-list .badge {
  background: #dc2626; color: #fff;
  padding: 0 0.4rem; border-radius: 10px;
  font-size: 0.7rem; font-weight: 700;
}
.chat-list li.active .badge { background: #fff; color: #1e3a5f; }

.chat-main {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  overflow: hidden;
}
.chat-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}
.chat-header h2 { margin: 0; font-size: 1rem; color: #1e3a5f; }
.chat-header .muted { font-size: 0.8rem; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 1rem;
}
.chat-msg {
  margin-bottom: 0.75rem;
  max-width: 75%;
}
.chat-msg-self { margin-left: auto; text-align: right; }
.chat-msg-head { font-size: 0.75rem; margin-bottom: 0.1rem; }
.chat-msg-body {
  display: inline-block;
  padding: 0.5rem 0.75rem;
  background: #eef2ff;
  color: #1f2937;
  border-radius: 10px;
  text-align: left;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.chat-msg-self .chat-msg-body { background: #1e3a5f; color: #fff; }

.chat-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
}
.chat-form input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 0.95rem;
}

/* Visual polish layer (final pass) */
body { background: #f1f5f9; }

.page-header h1 {
  font-size: 1.35rem; color: #0f1e33;
  letter-spacing: -0.01em;
}

/* Cards get a soft lift */
.card, .tile, .form-grid, .admin-tile {
  box-shadow: 0 1px 2px rgba(15, 30, 51, 0.05), 0 1px 3px rgba(15, 30, 51, 0.03);
  border-color: #e2e8f0;
}
.admin-tile { transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease; }
.admin-tile:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(15, 30, 51, 0.08);
  border-color: #1e3a5f;
}

/* Dashboard tiles — bolder numbers */
.tile {
  border-left: 3px solid #1e3a5f;
  padding: 1rem 1.25rem 1.1rem;
}
.tile-value {
  font-size: 2.2rem; font-weight: 700;
  color: #0f1e33; margin-top: 0.2rem;
}
.tile-label {
  font-size: 0.72rem; color: #64748b;
  text-transform: uppercase; letter-spacing: 0.07em;
  font-weight: 600;
}

/* Tables — tighter, cleaner */
.data-table {
  box-shadow: 0 1px 2px rgba(15,30,51,0.04);
  border-color: #e2e8f0;
}
.data-table th {
  background: #f8fafc; color: #475569;
  font-size: 0.72rem; letter-spacing: 0.06em;
}
.data-table tr:hover td { background: #f8fafc; }
.data-table td { border-bottom-color: #f1f5f9; }

/* Step circle — bigger, bolder, like TLP */
.step-circle {
  width: 32px; height: 32px;
  border-width: 2.5px;
  font-size: 0.95rem;
  background: #fff;
}

/* Buttons — smoother */
.btn, button {
  font-weight: 600;
  transition: background 100ms ease, transform 80ms ease;
}
.btn:hover, button:hover { transform: translateY(-1px); }

/* Page-header action buttons */
.page-header .btn {
  background: #10b981; padding: 0.5rem 1rem;
  border-radius: 6px; font-size: 0.85rem;
}
.page-header .btn:hover { background: #059669; }

/* Filter row — panel vibe */
.filter-row {
  background: #fff;
  padding: 0.6rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(15,30,51,0.03);
  margin-bottom: 1rem;
}

/* Section cards get more breathing room */
h2 { color: #0f1e33; font-weight: 700; }
h1 { color: #0f1e33; font-weight: 700; }

/* Pills — rounder, smaller */
.pill {
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Inventory row colors are still driven by tr.row-* classes — keep them */

/* Chat — already has its own layout, tighten colors */
.chat-layout { height: calc(100vh - 200px); }
.chat-sidebar { background: #fff; }

/* Empty state polish */
.empty-note {
  background: linear-gradient(180deg, #fefce8 0%, #fef9c3 100%);
  border-color: #fde68a;
  box-shadow: 0 1px 3px rgba(146, 64, 14, 0.05);
}

/* Login card polish */
.login-card {
  box-shadow: 0 10px 30px rgba(15, 30, 51, 0.12);
  border: none;
}

/* Avatar chip — shared by lead rows, kanban cards, planner, chat */
.avatar-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  vertical-align: middle;
  box-shadow: inset 0 0 0 1.5px rgba(255,255,255,0.25);
}
.avatar-chip + span { margin-left: 0.35rem; }
/* Inline row with avatar + name */
.owner-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

/* Keyboard shortcut help overlay */
.kb-help {
  position: fixed; inset: 0;
  background: rgba(15, 30, 51, 0.55);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
}
.kb-help-card {
  background: #fff;
  max-width: 560px;
  width: 90%;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  overflow: hidden;
}
.kb-help-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e5e7eb;
}
.kb-help-head h2 { margin: 0; font-size: 1rem; }
.kb-help-head .iconbtn { color: #1f2937; }
.kb-help-head .iconbtn:hover { background: #f1f5f9; }
.kb-help-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 1rem; padding: 1rem 1.25rem 1.25rem;
}
.kb-help-col h3 {
  font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.06em; color: #6b7280; margin: 0 0 0.5rem;
}
.kb-help-col dl {
  display: grid; grid-template-columns: max-content 1fr;
  gap: 0.3rem 1rem; margin: 0;
}
.kb-help-col dt { white-space: nowrap; }
.kb-help-col dd { margin: 0; font-size: 0.9rem; }
.kb-help-col ul { margin: 0; padding-left: 1rem; font-size: 0.85rem; color: #4b5563; }
.kb-help-col ul li { margin-bottom: 0.3rem; }
kbd {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-bottom-width: 2px;
  border-radius: 3px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.75rem;
  font-weight: 600;
  color: #1f2937;
}
