/* Platform console (main site, platform team only). Plain CSS, no build step, no external assets. */

:root {
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-2: #475569;
  --muted: #64748b;
  --brand: #116dff;
  --brand-dark: #0a55cc;
  --brand-soft: #e8f1ff;
  --nav-bg: #0b1220;
  --nav-text: #94a3b8;
  --nav-active: #ffffff;
  --green: #0f7b45;
  --green-bg: #e3f6ec;
  --amber: #a15c07;
  --amber-bg: #fdf1d8;
  --red: #b42318;
  --red-bg: #fde8e6;
  --blue: #0a55cc;
  --blue-bg: #e8f1ff;
  --gray: #475569;
  --gray-bg: #eef1f6;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 1px 3px rgba(15, 23, 42, 0.04);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.icon { flex: none; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: var(--nav-bg);
  color: var(--nav-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: #fff; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; background: var(--brand);
  display: grid; place-items: center; font-weight: 700; font-size: 16px; color: #fff;
}
.brand-name { font-weight: 650; font-size: 15px; letter-spacing: -0.01em; }
.brand-sub { display: block; font-size: 11px; color: var(--nav-text); font-weight: 500; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-heading { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: #64748b; padding: 14px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  color: var(--nav-text); font-weight: 500; text-decoration: none;
}
.nav a:hover { background: rgba(255, 255, 255, 0.06); color: #e2e8f0; }
.nav a[aria-current="page"] { background: rgba(17, 109, 255, 0.18); color: var(--nav-active); }
.nav .count { margin-left: auto; font-size: 11.5px; background: rgba(255, 255, 255, 0.1); border-radius: 999px; padding: 1px 8px; color: #cbd5e1; }
.sidebar-foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid rgba(255, 255, 255, 0.08); font-size: 12px; }
.sidebar-foot a { color: var(--nav-text); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: 60px; display: flex; align-items: center; gap: 14px;
  padding: 0 28px; background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.menu-btn { display: none; background: none; border: 0; padding: 6px; border-radius: 8px; color: var(--text); cursor: pointer; }
.topbar-search { position: relative; flex: 1; max-width: 420px; }
.topbar-search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.topbar-search input {
  width: 100%; height: 36px; padding: 0 12px 0 36px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-2); font: inherit; color: var(--text);
}
.topbar-search input:focus { background: #fff; border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px rgba(17, 109, 255, 0.15); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.who { text-align: right; line-height: 1.25; }
.who strong { display: block; font-size: 13px; font-weight: 600; }
.who span { font-size: 11.5px; color: var(--muted); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark);
  display: grid; place-items: center; font-weight: 700;
}
.content { padding: 28px; max-width: 1360px; width: 100%; margin: 0 auto; }
/* The CRM (contact lists, the board, a contact's page) uses the whole width next to the sidebar. */
.content-wide { max-width: none; }

/* ---------- page header ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; letter-spacing: -0.02em; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.crumbs { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-head h2 { font-size: 14.5px; font-weight: 650; }
.card-body { padding: 18px; }
.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.stack { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
.grid > *, .stack > * { min-width: 0; }

.kpi { padding: 16px 18px; }
.kpi-label { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.kpi-value { font-size: 28px; font-weight: 650; letter-spacing: -0.03em; margin: 4px 0 6px; }
.kpi-foot { display: flex; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--gray-bg); color: var(--gray); white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.8; }
.badge.plain::before { display: none; }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.blue { background: var(--blue-bg); color: var(--blue); }

/* ---------- buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
  border: 1px solid var(--border-strong); border-radius: 8px; background: #fff; color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { background: #fff; border-color: #f3b8b2; color: var(--red); }
.btn.danger:hover { background: var(--red-bg); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 600; font-size: 13px; }
.field .hint { font-size: 12px; color: var(--muted); }
.field .error { font-size: 12.5px; color: var(--red); }
.input, select.input {
  height: 38px; width: 100%; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: #fff;
  font: inherit; color: var(--text);
}
.input:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px rgba(17, 109, 255, 0.15); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.inline-form { display: inline-flex; gap: 8px; align-items: center; margin: 0; }

/* ---------- alerts ---------- */
.alerts { display: grid; gap: 10px; margin-bottom: 18px; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 8px; border: 1px solid var(--border); background: #fff; }
.alert.success { background: var(--green-bg); border-color: #b7e4cb; color: var(--green); }
.alert.error { background: var(--red-bg); border-color: #f3b8b2; color: var(--red); }
.alert.warning { background: var(--amber-bg); border-color: #f0d598; color: var(--amber); }
.alert.info { background: var(--blue-bg); border-color: #bcd5fb; color: var(--blue); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted);
  padding: 10px 18px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap;
}
td { padding: 12px 18px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafbfd; }
.cell-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-id .avatar { width: 36px; height: 36px; border-radius: 9px; font-size: 14px; }
.cell-id strong { display: block; font-weight: 600; }
.cell-id span { font-size: 12.5px; color: var(--muted); }
.row-actions { display: flex; gap: 8px; justify-content: flex-end; }
.empty { padding: 44px 18px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }

/* ---------- filters / tabs / pagination ---------- */
.toolbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab { padding: 6px 12px; border-radius: 8px; font-weight: 600; color: var(--text-2); text-decoration: none; font-size: 13px; }
.tab:hover { background: var(--gray-bg); text-decoration: none; }
.tab[aria-current="true"] { background: var(--brand-soft); color: var(--brand-dark); }
.tab small { font-weight: 500; color: var(--muted); margin-left: 4px; }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filters .input { width: 230px; height: 34px; }
.filters select.input { width: auto; }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.pager .btns { display: flex; gap: 6px; }

/* ---------- details ---------- */
.dl { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 10px 16px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.token { display: inline-flex; align-items: center; gap: 6px; }
.token code { font-family: var(--mono); font-size: 12px; background: var(--gray-bg); padding: 2px 7px; border-radius: 6px; overflow-wrap: anywhere; max-width: 230px; }
.copy { border: 0; background: none; color: var(--brand); cursor: pointer; padding: 2px; border-radius: 4px; }

/* ---------- chart ---------- */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding-top: 6px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.bar i { display: block; width: 100%; min-height: 3px; background: var(--brand); border-radius: 4px 4px 0 0; opacity: 0.85; }
.bar i.zero { background: var(--border); opacity: 1; }
.bar span { font-size: 10.5px; color: var(--muted); }

/* ---------- system checks ---------- */
.check-row { display: flex; align-items: center; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--border); }
.check-row:last-child { border-bottom: 0; }
.check-row .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); flex: none; }
.check-row .dot.warn { background: #d97706; }
.check-row .dot.fail { background: var(--red); }
.check-row .grow { flex: 1; min-width: 0; }
.check-row small { color: var(--muted); display: block; }

/* ---------- login ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(160deg, #0b1220 0%, #12203d 100%); }
.login-card { width: 100%; max-width: 400px; background: #fff; border-radius: 14px; padding: 32px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35); }
.login-card .brand { color: var(--text); padding: 0 0 18px; }
.login-card h1 { font-size: 21px; letter-spacing: -0.02em; margin-bottom: 4px; }
.login-card p.lead { color: var(--muted); margin: 0 0 20px; }
.login-foot { margin-top: 18px; font-size: 12px; color: var(--muted); text-align: center; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: minmax(0, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform 0.18s ease; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(15, 23, 42, 0.45); }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 0 16px; }
  .content { padding: 18px 16px; }
  .who { display: none; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .dl { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .dl dt { margin-top: 10px; }
}
@media (max-width: 520px) {
  .grid-4 { grid-template-columns: minmax(0, 1fr); }
  th, td { padding-left: 12px; padding-right: 12px; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

/* ---------- billing ---------- */
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
textarea.input { height: auto; min-height: 64px; padding: 8px 12px; resize: vertical; }
.meter { display: grid; gap: 4px; margin-bottom: 12px; }
.meter-head { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.meter-head span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; }
.meter-bar { height: 6px; border-radius: 999px; background: var(--gray-bg); overflow: hidden; }
.meter-bar i { display: block; height: 100%; border-radius: inherit; background: var(--brand); }
.meter-bar i.over { background: var(--red); }
.meter-bar i.near { background: var(--amber); }
.action { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 14px; }
.action summary { cursor: pointer; font-weight: 600; font-size: 13px; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.action summary::-webkit-details-marker { display: none; }
.action summary::after { content: "+"; color: var(--muted); font-weight: 400; font-size: 16px; }
.action[open] summary::after { content: "–"; }
.action[open] summary { margin-bottom: 10px; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.field-row > *, .field-row .input { min-width: 0; }
.total-row td { font-weight: 650; border-top: 2px solid var(--border); }

/* ---------------------------------------------------------------- CRM (platform growth) */
.small { font-size: 12px; }
.score { display: inline-flex; min-width: 30px; justify-content: center; padding: 2px 7px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-dark); font-weight: 650; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.score.green { background: var(--green-bg); color: var(--green); }
.score.gray { background: var(--gray-bg); color: var(--gray); }
.score.lg { font-size: 15px; padding: 3px 10px; }

/* avatars: five steady colours by contact id */
.av { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; font-weight: 700; font-size: 13.5px; }
.av.sm { width: 22px; height: 22px; border-radius: 6px; font-size: 10.5px; }
.av.xl { width: 56px; height: 56px; border-radius: 14px; font-size: 22px; }
.av-0 { background: #e8f1ff; color: #0a55cc; }
.av-1 { background: #e3f6ec; color: #0f7b45; }
.av-2 { background: #fdf1d8; color: #a15c07; }
.av-3 { background: #efe9fe; color: #5b3cc4; }
.av-4 { background: #dff5f5; color: #0e6f73; }
.who-chip { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.who-chip .av.sm { background: var(--gray-bg); color: var(--text-2); }

/* sub-navigation shared by every CRM page */
.crm-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin: -8px 0 20px; }
.crm-nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.crm-nav::-webkit-scrollbar { display: none; }
.crm-nav a { display: inline-flex; align-items: center; gap: 7px; padding: 10px 12px; color: var(--text-2); font-weight: 600; font-size: 13.5px; text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.crm-nav a:hover { color: var(--text); text-decoration: none; }
.crm-nav a[aria-current="true"] { color: var(--brand-dark); border-bottom-color: var(--brand); }
.crm-nav .pill { font-size: 11px; font-weight: 700; padding: 0 7px; border-radius: 999px; background: var(--red-bg); color: var(--red); line-height: 18px; }

/* KPI row and pipeline funnel */
.crm-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.crm-kpi { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; text-decoration: none; color: inherit; }
a.crm-kpi:hover { text-decoration: none; border-color: var(--border-strong); }
.crm-kpi .kpi-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none; background: var(--gray-bg); color: var(--text-2); }
.crm-kpi .kpi-icon.blue { background: var(--blue-bg); color: var(--blue); }
.crm-kpi .kpi-icon.amber { background: var(--amber-bg); color: var(--amber); }
.crm-kpi .kpi-icon.green { background: var(--green-bg); color: var(--green); }
.crm-kpi .kpi-icon.red { background: var(--red-bg); color: var(--red); }
.crm-kpi .kpi-value { font-size: 24px; margin: 0; line-height: 1.15; }
.crm-kpi .kpi-foot { margin-top: 2px; }
.funnel { display: grid; grid-template-columns: repeat(9, minmax(92px, 1fr)); overflow-x: auto; border-bottom: 1px solid var(--border); }
.funnel a { display: grid; gap: 3px; padding: 12px 14px 10px; text-decoration: none; color: inherit; border-right: 1px solid var(--border); position: relative; }
.funnel a:last-child { border-right: 0; }
.funnel a:hover { background: var(--surface-2); text-decoration: none; }
.funnel a[aria-current="true"] { background: var(--brand-soft); }
.funnel a[aria-current="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--brand); }
.funnel .f-label { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.funnel .f-count { font-size: 19px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.funnel .f-bar { height: 4px; border-radius: 999px; background: var(--gray-bg); overflow: hidden; }
.funnel .f-bar i { display: block; height: 100%; border-radius: inherit; background: var(--gray); opacity: 0.55; }
.funnel .f-bar i.blue { background: var(--brand); opacity: 0.8; }
.funnel .f-bar i.amber { background: #d97706; opacity: 0.8; }
.funnel .f-bar i.green { background: var(--green); opacity: 0.85; }
.funnel .f-bar i.red { background: var(--red); opacity: 0.7; }

/* list filters and table */
.crm-filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.crm-search { position: relative; flex: 1 1 240px; max-width: 340px; }
.crm-search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.crm-search .input { padding-left: 34px; height: 34px; }
.crm-filters select.input { width: auto; height: 34px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding: 10px 18px; border-bottom: 1px solid var(--border); font-size: 12.5px; color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 3px 2px 10px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-dark); font-size: 12.5px; font-weight: 600; }
.chip a { color: inherit; padding: 0 6px; border-radius: 999px; text-decoration: none; font-weight: 700; }
.chip a:hover { background: rgba(17, 109, 255, 0.15); text-decoration: none; }
.score-cell { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.score-cell .meter-bar { width: 48px; height: 5px; }
.meter-bar i.green { background: var(--green); }
.meter-bar i.gray { background: var(--border-strong); }
.due { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; white-space: nowrap; color: var(--text-2); }
.due.red { color: var(--red); }
.due.amber { color: var(--amber); }
.crm-table td { padding-top: 10px; padding-bottom: 10px; }
.crm-table .sub { display: block; font-size: 12.5px; color: var(--muted); }
.crm-table .name { font-weight: 600; color: var(--text); }
.crm-table tr:hover .name { color: var(--brand); }

/* contact page */
.profile { padding: 18px 20px; display: grid; gap: 16px; margin-bottom: 18px; grid-template-columns: minmax(0, 1fr); }
.profile > * { min-width: 0; }
.profile-top { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.profile-id { flex: 1; min-width: 220px; }
.profile-id h1 { font-size: 21px; letter-spacing: -0.02em; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.profile-id p { margin: 3px 0 0; color: var(--muted); }
.reach { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.reach > a, .reach > span { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); font-size: 12.5px; font-weight: 600; text-decoration: none; }
.reach > a:hover { border-color: var(--border-strong); color: var(--text); text-decoration: none; }
.reach .mono { font-weight: 500; }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); }
.fact { padding: 10px 14px; border-right: 1px solid var(--border); min-width: 0; }
.fact:last-child { border-right: 0; }
.fact-label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.fact-value { margin-top: 3px; font-weight: 600; display: flex; align-items: center; gap: 8px; min-width: 0; }
.fact-value .meter-bar { flex: 1; max-width: 90px; height: 5px; }
.fact form { display: flex; gap: 6px; margin: 0; }
.fact select.input { height: 30px; padding: 0 8px; font-weight: 600; min-width: 0; }
.stepper { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 3px; overflow-x: auto; scrollbar-width: thin; }
.step { flex: 1 0 auto; display: flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 16px; font-size: 12.5px; font-weight: 600; color: var(--muted); background: var(--gray-bg); clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%); white-space: nowrap; }
.step:first-child { clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%); border-radius: 7px 0 0 7px; }
.step:last-child { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 10px 50%); border-radius: 0 7px 7px 0; }
.step.done { background: #d6e6ff; color: var(--brand-dark); }
.step.current { background: var(--brand); color: #fff; }
.step.off { opacity: 0.55; }
.stage-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.stage-row .stepper { flex: 1 1 520px; min-width: 0; }
.stage-move { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 0; }
.stage-move select.input { width: auto; height: 32px; }
.stage-move .input { height: 32px; width: 190px; }
.stage-note { font-size: 12px; color: var(--muted); margin: 0; }
.off-path { display: flex; gap: 8px; align-items: center; padding: 9px 12px; border-radius: 8px; background: var(--red-bg); color: var(--red); font-weight: 600; font-size: 13px; }
.off-path.gray { background: var(--gray-bg); color: var(--text-2); }

.composer textarea.input { min-height: 84px; border: 0; padding: 14px 18px; border-radius: var(--radius) var(--radius) 0 0; box-shadow: none; resize: vertical; display: block; }
.composer textarea.input:focus { box-shadow: none; }
.composer:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(17, 109, 255, 0.12); }
.composer-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.composer-foot .hint { font-size: 12px; color: var(--muted); }

.timeline { list-style: none; margin: 0; padding: 4px 18px 10px; }
.tl-day { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 12px 0 8px; }
.tl-item { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; position: relative; padding-bottom: 14px; }
.tl-item::before { content: ""; position: absolute; left: 14.5px; top: 32px; bottom: 2px; width: 1px; background: var(--border); }
.tl-item:last-child::before { display: none; }
.tl-dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--gray-bg); color: var(--text-2); }
.tl-dot.blue { background: var(--blue-bg); color: var(--blue); }
.tl-dot.green { background: var(--green-bg); color: var(--green); }
.tl-dot.amber { background: var(--amber-bg); color: var(--amber); }
.tl-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); padding-top: 5px; }
.tl-head strong { color: var(--text); font-size: 13px; }
.tl-body { margin-top: 3px; white-space: pre-line; overflow-wrap: anywhere; }
.tl-item.note .tl-body { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; margin-top: 6px; }

.side-card .card-head { padding: 12px 16px; }
.side-card .card-body { padding: 14px 16px; }
.task { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.task:first-child { padding-top: 0; }
.task-title { font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.task-sub { grid-column: 1 / 2; font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.task-actions { display: flex; gap: 4px; align-items: start; grid-row: 1 / 3; grid-column: 2; }
.task-actions .btn.sm { height: 28px; padding: 0 8px; }
.kv { display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 8px 12px; margin: 0; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.score-parts { display: grid; gap: 7px; margin: 0; }
.score-part { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.score-part span { color: var(--text-2); }
.score-part b { font-variant-numeric: tabular-nums; color: var(--green); font-weight: 650; }
.score-part b.zero { color: var(--muted); }
.score-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.score-head .meter-bar { flex: 1; height: 7px; margin: 0; }
.consent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.consent { padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 12px; color: var(--muted); }
.consent strong { display: block; font-size: 13px; color: var(--text); }
.consent.yes { border-color: #b7e4cb; background: var(--green-bg); color: var(--green); }
.consent.no { border-color: #f3b8b2; background: var(--red-bg); color: var(--red); }
.tags { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.crm-shop { padding: 10px 0; border-bottom: 1px solid var(--border); }
.crm-shop:first-child { padding-top: 0; }
.crm-shop p { margin: 2px 0 0; }
.crm-shop-name { display: flex; gap: 8px; align-items: center; justify-content: space-between; font-weight: 600; }

/* board */
.board-tools { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: 0 0 12px; }
.board-tools .input { width: auto; height: 34px; }
.board-hint { font-size: 12.5px; color: var(--muted); }
.board { display: grid; gap: 10px; }
.board-open { display: grid; grid-template-columns: repeat(5, minmax(200px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 4px; scroll-snap-type: x proximity; }
.board-col { display: flex; flex-direction: column; min-width: 0; background: var(--gray-bg); border: 1px solid var(--border); border-top: 3px solid var(--border-strong); border-radius: var(--radius); scroll-snap-align: start; transition: background 0.12s, border-color 0.12s, opacity 0.12s; min-height: calc(100vh - 360px); }
.board-col.tone-blue { border-top-color: var(--brand); }
.board-col.tone-amber { border-top-color: #d97706; }
.board-col.tone-green { border-top-color: var(--green); }
.board-col.tone-red { border-top-color: var(--red); }
.board-col.can-drop { border-color: var(--brand); background: var(--brand-soft); }
.board-col.cannot-drop { opacity: 0.45; }
.board-col.over { box-shadow: inset 0 0 0 2px var(--brand); }
.board-col-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px 8px; }
.board-col-head h2 { font-size: 13px; font-weight: 650; }
.board-col-head .n { font-size: 12px; font-weight: 700; color: var(--text-2); background: rgba(255, 255, 255, 0.75); border-radius: 999px; padding: 0 8px; line-height: 20px; font-variant-numeric: tabular-nums; }
.board-list { list-style: none; margin: 0; padding: 0 8px 8px; display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 60px; }
.board-list:not(:has(.board-card))::after { content: "Drop a card here"; display: block; font-size: 12px; color: var(--muted); text-align: center; padding: 16px 8px; border: 1px dashed var(--border-strong); border-radius: 8px; }
.board-card { background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 10px 10px 8px; box-shadow: var(--shadow); cursor: grab; font-size: 13px; display: grid; gap: 8px; }
.board-card:hover { border-color: var(--border-strong); }
.board-card.dragging { opacity: 0.45; }
.board-card-top { display: flex; gap: 9px; align-items: center; min-width: 0; }
.board-card-top .grow { flex: 1; min-width: 0; }
.board-card-top a { display: block; font-weight: 650; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-card-top a:hover { color: var(--brand); }
.board-card-top .biz { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-card-meta { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); min-width: 0; }
.board-move { font-size: 12.5px; }
.board-move summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-weight: 600; padding: 1px 6px; margin-left: -6px; border-radius: 6px; }
.board-move summary::-webkit-details-marker { display: none; }
.board-move summary:hover { background: var(--gray-bg); color: var(--text); }
.board-move form { display: grid; gap: 6px; margin-top: 6px; }
.board-move .input { height: 32px; }
.board-shelf { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.board-col.closed { min-height: 0; flex-direction: row; align-items: center; gap: 12px; padding: 10px 14px; border-top-width: 1px; border-top-color: var(--border); border-left: 3px solid var(--border-strong); }
.board-col.closed.tone-green { border-left-color: var(--green); }
.board-col.closed.tone-red { border-left-color: var(--red); }
.board-col.closed .n { font-size: 20px; font-weight: 650; min-width: 28px; font-variant-numeric: tabular-nums; }
.board-col.closed .grow { flex: 1; min-width: 0; }
.board-col.closed .board-list { display: none; }
.board-col.closed .sub { display: block; font-size: 12px; color: var(--muted); }
.board-more { display: block; padding: 0 12px 10px; font-size: 12.5px; }

/* today */
.today-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.row-item { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--border); }
.row-item:last-child { border-bottom: 0; }
.row-item .grow { flex: 1; min-width: 0; }
.row-item .grow a { font-weight: 600; color: var(--text); }
.row-item .grow a:hover { color: var(--brand); }
.row-item .sub { display: block; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-item .end { display: flex; gap: 8px; align-items: center; flex: none; }
.empty-sm { padding: 28px 18px; text-align: center; color: var(--muted); display: grid; gap: 6px; justify-items: center; }
.empty-sm .icon { color: var(--green); }

@media (max-width: 1100px) {
  .crm-kpis, .today-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fact:nth-child(2) { border-right: 0; }
  .fact:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
}
@media (max-width: 860px) {
  .crm-hide-sm { display: none; }
  .stage-move { width: 100%; }
  .stage-move .input { flex: 1; width: auto; }
}
@media (max-width: 640px) {
  .board-open { grid-template-columns: repeat(5, 80vw); }
  .board-shelf { grid-template-columns: minmax(0, 1fr); }
  .crm-kpis, .today-strip { gap: 10px; }
  .crm-kpi { padding: 12px; }
  .crm-kpi .kpi-icon { display: none; }
  .crm-search { max-width: none; }
  .profile { padding: 16px; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .kv dt { margin-top: 8px; }
  .row-item { padding: 10px 14px; flex-wrap: wrap; }
}

/* Chatbot: a conversation transcript and the reply box (console/bot/conversation.html). */
.chat-log { display: flex; flex-direction: column; gap: 10px; padding: 18px; max-height: 70vh; overflow-y: auto; background: var(--surface-2); }
.bubble { max-width: min(78%, 620px); padding: 9px 13px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); }
.bubble p { margin: 2px 0 0; overflow-wrap: anywhere; }
.bubble.visitor { align-self: flex-start; }
.bubble.bot { align-self: flex-end; background: var(--brand-soft); border-color: #cfe0ff; }
.bubble.agent { align-self: flex-end; background: var(--green-bg); border-color: #b7e4cb; }
.bubble-who { font-size: 11.5px; font-weight: 650; color: var(--muted); }
.chat-note { align-self: center; margin: 2px 0; font-size: 12px; color: var(--muted); }
.chat-reply { display: flex; gap: 10px; align-items: flex-end; padding: 14px 18px; border-top: 1px solid var(--border); }
.chat-reply textarea { flex: 1; min-height: 64px; }
.chat-hint { margin: 0; padding: 12px 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
@media (max-width: 640px) {
  .bubble { max-width: 92%; }
  .chat-reply { flex-direction: column; align-items: stretch; }
}
