/* ===========================================================================
   Mage Marketer — Sales design layer
   A quiet sales desk: flat surfaces on hairlines, numbers set large in a
   semi-condensed grotesque, orange only where something needs doing or
   belongs to "now". One raised element per page carries the focus.
   Scoped to .sales-ui (the <main> of the sales pages, set by render_header)
   so the rest of the app keeps its own look. Light + dark.
   =========================================================================== */

:root {
  --sx-page: #F5F4F2;
  --sx-card: #FFFFFF;
  --sx-sunken: #F3F2F0;
  --sx-hover: #F9F8F7;
  --sx-line: #E8E6E2;
  --sx-line-2: #D9D6D1;
  --sx-ink: #1A1714;
  --sx-ink-2: #45403B;
  --sx-muted: #77706A;
  --sx-faint: #A39C95;

  --sx-accent: #C2560F;                    /* text + filled buttons, 4.5:1 on white */
  --sx-accent-hover: #A84A0C;
  --sx-brand: #F26B1D;                     /* fills: bars, rings, current period */
  --sx-brand-soft: #FEF0E6;
  --sx-track: #ECEAE6;                     /* unfilled part of meters and rings */
  --sx-focus: rgba(242, 107, 29, .24);

  --sx-ok: #15803D;   --sx-ok-fill: #22A35A;   --sx-ok-soft: #E9F6EE;
  --sx-warn: #A15C07; --sx-warn-fill: #F59E0B; --sx-warn-soft: #FEF3E2;
  --sx-bad: #B42318;  --sx-bad-fill: #E5484D;  --sx-bad-soft: #FDEDEC;
  --sx-info: #1D5FA5; --sx-info-soft: #E8F2FB;

  /* Categorical chart slots (validated: adjacent CVD ΔE ≥ 10.9, light) + "other" gray */
  --c0: #F26B1D; --c1: #6366F1; --c2: #14B8A6; --c3: #F59E0B;
  --c4: #0EA5E9; --c5: #EC4899; --c6: #8B5CF6; --c-other: #A8A29E;

  /* Pipeline stages (small identity dots) */
  --st-new: #0EA5E9; --st-contacted: #14B8A6; --st-meeting: #F59E0B; --st-proposal: #F26B1D;
  --st-negotiation: #8B5CF6; --st-won: #22A35A; --st-lost: #A8A29E;

  --sx-raise: 0 1px 2px rgba(26, 23, 20, .04), 0 8px 24px -12px rgba(26, 23, 20, .14);
  --sx-pop: 0 18px 48px -14px rgba(26, 23, 20, .30), 0 2px 6px rgba(26, 23, 20, .06);
  --sx-r: 18px;
  --sx-pad: 22px;
  --sx-display: var(--font);
  --sx-select: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2377706A' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

html[data-theme="dark"] {
  --sx-page: #100E0D;
  --sx-card: #181614;
  --sx-sunken: #201D1A;
  --sx-hover: #1D1A18;
  --sx-line: rgba(255, 255, 255, .075);
  --sx-line-2: rgba(255, 255, 255, .14);
  --sx-ink: #F3F1EE;
  --sx-ink-2: #D3CEC8;
  --sx-muted: #A39C95;
  --sx-faint: #78716C;
  --sx-accent: #FB8B3C;
  --sx-accent-hover: #FF9F5B;
  --sx-brand: #E8681F;
  --sx-brand-soft: rgba(232, 104, 31, .14);
  --sx-track: rgba(255, 255, 255, .09);
  --sx-focus: rgba(251, 139, 60, .3);
  --sx-ok: #4ADE80;   --sx-ok-fill: #22A35A;   --sx-ok-soft: rgba(34, 163, 90, .16);
  --sx-warn: #FBBF24; --sx-warn-fill: #D97706; --sx-warn-soft: rgba(217, 119, 6, .16);
  --sx-bad: #F87171;  --sx-bad-fill: #E5484D;  --sx-bad-soft: rgba(229, 72, 77, .16);
  --sx-info: #7DC4F0; --sx-info-soft: rgba(2, 132, 199, .18);
  /* dark steps of the same slots (validated against #181614) */
  --c0: #E8681F; --c1: #6366F1; --c2: #0D9488; --c3: #D97706;
  --c4: #0284C7; --c5: #DB2777; --c6: #8B5CF6; --c-other: #78716C;
  --st-new: #0284C7; --st-contacted: #0D9488; --st-meeting: #D97706; --st-proposal: #E8681F;
  --st-negotiation: #8B5CF6; --st-won: #22A35A; --st-lost: #78716C;
  --sx-raise: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px -12px rgba(0, 0, 0, .6);
  --sx-pop: 0 24px 60px -16px rgba(0, 0, 0, .8);
  --sx-select: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23A39C95' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

body.sales-page { background: var(--sx-page); }

/* Chart tooltip: appended to <body> by assets/sales.js, so not scoped. */
.s-tip {
  position: fixed; z-index: 90; pointer-events: none; max-width: 240px;
  padding: 7px 10px; border-radius: 9px; background: var(--sx-ink); color: var(--sx-card);
  font: 500 12px/1.35 var(--font); box-shadow: var(--sx-pop);
  opacity: 0; transform: translate(-50%, calc(-100% - 6px)); transition: opacity .12s ease;
}
.s-tip.show { opacity: 1; }
.s-tip strong { display: block; font-size: 13.5px; font-weight: 600; }
.s-tip span { opacity: .72; }

/* ── Base ─────────────────────────────────────────────────────────────── */
.sales-ui {
  color: var(--sx-ink); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  width: min(1240px, calc(100% - 56px)); margin-top: 30px;
}
.sales-ui h1, .sales-ui h2, .sales-ui h3 { color: var(--sx-ink); }
.sales-ui h1 { font-family: var(--sx-display); font-size: 28px; font-weight: 700; letter-spacing: -.01em; line-height: 1.15; }
.sales-ui h2 { font-family: var(--font); font-size: 15px; font-weight: 600; letter-spacing: -.005em; }
.sales-ui h3 { font-family: var(--font); font-size: 13px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--sx-ink-2); margin: 18px 0 8px; }
.sales-ui .muted, .sales-ui small, .sales-ui .page-title p { color: var(--sx-muted); }
.sales-ui .muted-sm { color: var(--sx-muted); font-size: 12.5px; }
.sales-ui .s-icon { flex: none; display: block; }
.sales-ui :focus-visible { outline: 2px solid var(--sx-brand); outline-offset: 2px; }
.sales-ui ::selection { background: var(--sx-brand-soft); }
.sales-ui .s-fig { font-family: var(--sx-display); font-weight: 600; letter-spacing: 0; line-height: 1; }

/* ── Page header ──────────────────────────────────────────────────────── */
.sales-ui .s-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px 24px; flex-wrap: wrap; margin: 0 0 24px; }
.sales-ui .s-head-text { min-width: 0; }
.sales-ui .s-head h1 { margin: 0; }
.sales-ui .s-head p { margin: 6px 0 0; color: var(--sx-muted); font-size: 13.5px; }
.sales-ui .s-eyebrow { display: block; font-size: 13px; font-weight: 500; color: var(--sx-muted); margin-bottom: 4px; }
.sales-ui .s-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sales-ui .s-head-actions form { display: contents; }
/* The views of one menu item (Today | Dashboard, List | Pipeline, Chats | Campaigns | Templates). */
.sales-ui .s-switch { display: inline-flex; gap: 2px; max-width: 100%; margin: 0 0 16px; padding: 3px; border-radius: 12px; background: var(--sx-sunken); overflow-x: auto; scrollbar-width: none; }
.sales-ui .s-switch::-webkit-scrollbar { display: none; }
.sales-ui .s-switch a { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 6px 16px; border-radius: 9px; color: var(--sx-muted); font-size: 13.5px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.sales-ui .s-switch a:hover { color: var(--sx-ink); }
.sales-ui .s-switch a.active { background: var(--sx-card); color: var(--sx-ink); box-shadow: 0 1px 2px rgba(26, 23, 20, .1); }
.sales-ui .s-switch a:focus-visible { outline: 2px solid var(--sx-brand); outline-offset: 1px; }
.sales-ui .s-switch-n { min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--sx-brand); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
@media print { .sales-ui .s-switch { display: none !important; } }
.sales-ui .page-title { margin-bottom: 22px; }
.sales-ui .page-title h1 { margin: 0; }
.sales-ui .page-title p { margin: 6px 0 0; font-size: 13.5px; }

/* ── Buttons ──────────────────────────────────────────────────────────── */
/* The plain button look has zero specificity (:where), so every class-based button rule below wins in both themes. */
:where(.sales-ui) button, .sales-ui .s-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 36px; padding: 7px 14px; border-radius: 9px; border: 1px solid transparent;
  background: var(--sx-accent); color: #fff;
  font: 600 13.5px/1.25 var(--font); letter-spacing: 0; text-decoration: none; cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 1px 2px rgba(26, 23, 20, .16);
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
:where(html[data-theme="dark"] .sales-ui) button, html[data-theme="dark"] .sales-ui .s-btn { color: #1A0F06; }
:where(.sales-ui) button:hover:not(:disabled), .sales-ui .s-btn:hover { background: var(--sx-accent-hover); color: #fff; transform: none; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 1px 2px rgba(26, 23, 20, .16); }
:where(html[data-theme="dark"] .sales-ui) button:hover:not(:disabled), html[data-theme="dark"] .sales-ui .s-btn:hover { color: #1A0F06; }
:where(.sales-ui) button:active:not(:disabled), .sales-ui .s-btn:active { transform: translateY(.5px); box-shadow: none; }
:where(.sales-ui) button:disabled { opacity: .5; cursor: not-allowed; }
/* Links and summaries styled as buttons get the same shape as real buttons. */
.sales-ui .btn-ghost, .sales-ui .share-btn, .sales-ui a.s-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 36px; padding: 7px 14px; border-radius: 9px; border: 1px solid transparent;
  font: 500 13.5px/1.25 var(--font); letter-spacing: 0; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.sales-ui .share-btn { background: var(--sx-accent); color: #fff; font-weight: 600; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 1px 2px rgba(26, 23, 20, .16); }
.sales-ui .share-btn:hover:not(:disabled) { background: var(--sx-accent-hover); color: #fff; }
html[data-theme="dark"] .sales-ui .share-btn:not(.wa) { color: #1A0F06; }
.sales-ui summary.btn-ghost { list-style: none; }
.sales-ui summary.btn-ghost::-webkit-details-marker { display: none; }
.sales-ui .share-btn .s-icon { color: currentColor; }

.sales-ui .btn-ghost, .sales-ui .s-btn.secondary, html[data-theme="dark"] .sales-ui .s-btn.secondary {
  background: var(--sx-card); color: var(--sx-ink); border-color: var(--sx-line-2); box-shadow: 0 1px 1px rgba(26, 23, 20, .04); font-weight: 500;
}
.sales-ui .btn-ghost:hover:not(:disabled), .sales-ui .s-btn.secondary:hover, html[data-theme="dark"] .sales-ui .s-btn.secondary:hover { background: var(--sx-hover); color: var(--sx-ink); border-color: var(--sx-faint); box-shadow: 0 1px 1px rgba(26, 23, 20, .04); }
.sales-ui a.btn-ghost, .sales-ui .followup-actions a.btn-ghost { display: inline-flex; text-decoration: none; }
.sales-ui .btn-ghost.xs, .sales-ui .s-btn.sm { min-height: 30px; padding: 4px 10px; font-size: 12.5px; border-radius: 8px; gap: 6px; }
.sales-ui .btn-ghost.danger, .sales-ui .s-btn.danger { color: var(--sx-bad); border-color: color-mix(in srgb, var(--sx-bad) 35%, var(--sx-line-2)); background: var(--sx-card); }
.sales-ui .btn-ghost.danger:hover:not(:disabled), .sales-ui .s-btn.danger:hover { background: var(--sx-bad-soft); color: var(--sx-bad); border-color: var(--sx-bad); }
.sales-ui .s-btn.quiet, html[data-theme="dark"] .sales-ui .s-btn.quiet { background: transparent; border-color: transparent; color: var(--sx-ink-2); box-shadow: none; }
.sales-ui .s-btn.quiet:hover, html[data-theme="dark"] .sales-ui .s-btn.quiet:hover { background: var(--sx-sunken); color: var(--sx-ink); box-shadow: none; }
.sales-ui .s-icon-btn { width: 32px; min-height: 32px; padding: 0; border-radius: 8px; }
.sales-ui .btn-ghost .s-icon, .sales-ui .s-btn.secondary .s-icon, .sales-ui .s-btn.quiet .s-icon { color: var(--sx-muted); }
.sales-ui .btn-ghost:hover .s-icon, .sales-ui .s-btn.secondary:hover .s-icon, .sales-ui .s-btn.quiet:hover .s-icon { color: var(--sx-ink); }
.sales-ui .s-btn.wa .s-icon { color: #1F8F4E; }
.sales-ui .link-btn, .sales-ui .card a.link-btn { display: inline-flex; align-items: center; gap: 4px; color: var(--sx-accent); font-weight: 600; font-size: 13px; text-decoration: none; }
.sales-ui .link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }
.sales-ui .share-btn.wa { background: #1F8F4E; color: #fff; }
.sales-ui .share-btn.wa:hover:not(:disabled) { background: #177A41; color: #fff; }

/* ── Forms ────────────────────────────────────────────────────────────── */
.sales-ui label { font-weight: 500; font-size: 13px; color: var(--sx-ink-2); gap: 6px; }
.sales-ui input, .sales-ui select, .sales-ui textarea {
  min-height: 38px; padding: 8px 11px; border: 1px solid var(--sx-line-2); border-radius: 9px;
  background-color: var(--sx-card); color: var(--sx-ink); font-size: 14px; line-height: 1.35;
  box-shadow: 0 1px 1px rgba(26, 23, 20, .03);
}
.sales-ui textarea { min-height: 76px; }
.sales-ui select { appearance: none; -webkit-appearance: none; background-image: var(--sx-select); background-repeat: no-repeat; background-position: right 11px center; padding-right: 32px; cursor: pointer; }
.sales-ui input:hover, .sales-ui select:hover, .sales-ui textarea:hover { border-color: var(--sx-faint); }
.sales-ui input:focus, .sales-ui select:focus, .sales-ui textarea:focus { outline: none; border-color: var(--sx-brand); box-shadow: 0 0 0 3px var(--sx-focus); }
.sales-ui input[type="checkbox"], .sales-ui input[type="radio"] { min-height: 0; box-shadow: none; accent-color: var(--sx-accent); }
.sales-ui input[type="file"] { padding: 6px 8px; }
.sales-ui input::placeholder, .sales-ui textarea::placeholder { color: var(--sx-faint); }
.sales-ui fieldset { border-color: var(--sx-line); }
.sales-ui .s-select { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; font-weight: 500; color: var(--sx-muted); }
.sales-ui .s-select select { width: auto; min-width: 150px; min-height: 36px; padding: 6px 30px 6px 11px; font-size: 13.5px; font-weight: 500; }

/* ── Surfaces ─────────────────────────────────────────────────────────── */
.sales-ui .card {
  background: var(--sx-card); border: 1px solid var(--sx-line); border-radius: var(--sx-r);
  padding: 20px var(--sx-pad); box-shadow: none; margin-bottom: 16px;
}
.sales-ui .card.is-raised { box-shadow: var(--sx-raise); border-color: color-mix(in srgb, var(--sx-line-2) 60%, var(--sx-line)); }
.sales-ui .card-head { align-items: flex-start; margin-bottom: 14px; gap: 10px 16px; }
.sales-ui .card-head h2 { margin: 0; font-size: 15px; }
.sales-ui .card-head p { margin: 3px 0 0; font-size: 13px; color: var(--sx-muted); }
.sales-ui .card > h2:first-child { margin: 0 0 12px; font-size: 15px; }
.sales-ui .s-sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 14px; flex-wrap: wrap; margin-bottom: 14px; }
.sales-ui .s-sec-head h2 { margin: 0; display: inline-flex; align-items: center; gap: 8px; }
.sales-ui .s-sec-head p { flex-basis: 100%; margin: -8px 0 0; font-size: 13px; color: var(--sx-muted); }
.sales-ui .s-count { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 999px; background: var(--sx-sunken); color: var(--sx-ink-2); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sales-ui .s-count.hot { background: var(--sx-bad-soft); color: var(--sx-bad); }
/* Flat sections that sit straight on the page (side column, secondary info) */
.sales-ui .s-flat { padding: 18px 0 0; border-top: 1px solid var(--sx-line); margin-bottom: 22px; }
.sales-ui .s-flat:first-child { padding-top: 0; border-top: 0; }
.sales-ui .s-flat .s-sec-head { margin-bottom: 10px; }
.sales-ui .s-flat h2 { font-size: 14px; }

/* ── Layout ───────────────────────────────────────────────────────────── */
.sales-ui .s-split { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: start; }
.sales-ui .s-split > * { min-width: 0; }
.sales-ui .s-grid { display: grid; gap: 16px; margin-bottom: 16px; }
.sales-ui .s-grid > .card { margin-bottom: 0; min-width: 0; }
.sales-ui .s-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sales-ui .s-grid-wide { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.sales-ui .s-stack { display: grid; gap: 16px; align-content: start; min-width: 0; }
.sales-ui .s-stack > .card { margin-bottom: 0; min-width: 0; }
/* Client page (client.php) */
.sales-ui .s-strip-value.s-strip-text { font-size: 24px; }
.sales-ui .client-work { list-style: none; margin: 0; padding: 0; display: grid; }
.sales-ui .client-work li { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(80px, 1fr) 44px; align-items: center; gap: 14px; padding: 11px 0; border-top: 1px solid var(--sx-line); }
.sales-ui .client-work li:first-child { border-top: 0; padding-top: 2px; }
.sales-ui .client-work-dept { display: grid; gap: 2px; min-width: 0; font-size: 13.5px; }
.sales-ui .client-work-dept small { color: var(--sx-muted); font-size: 12.5px; }
.sales-ui .client-work-pct { text-align: right; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sales-ui .client-todo { margin: 12px 0 10px; padding-left: 18px; display: grid; gap: 6px; font-size: 13.5px; }
@media (max-width: 560px) {
  .sales-ui .client-work li { grid-template-columns: minmax(0, 1fr) 44px; }
  .sales-ui .client-work li .s-meter { grid-column: 1 / -1; grid-row: 2; }
}

/* ── Number strip (headline numbers in one band) ──────────────────────── */
.sales-ui .s-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 24px; background: var(--sx-card); border: 1px solid var(--sx-line); border-radius: var(--sx-r); overflow: hidden; }
.sales-ui .s-strip > * { display: grid; gap: 6px; align-content: start; padding: 16px 20px 18px; min-width: 0; color: inherit; text-decoration: none; border-left: 1px solid var(--sx-line); transition: background .12s ease; }
.sales-ui .s-strip > :first-child { border-left: 0; }
.sales-ui .s-strip > a:hover { background: var(--sx-hover); }
.sales-ui .s-strip-label { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; color: var(--sx-muted); }
.sales-ui .s-strip-label .s-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--sx-line-2); }
.sales-ui .s-strip-value { font-family: var(--sx-display); font-size: 30px; font-weight: 700; letter-spacing: -.01em; line-height: 1.1; }
.sales-ui .s-strip-foot { font-size: 12.5px; color: var(--sx-muted); }
.sales-ui .s-strip .is-bad .s-strip-value { color: var(--sx-bad); }
.sales-ui .s-strip .is-bad .s-dot { background: var(--sx-bad-fill); }
.sales-ui .s-strip .is-now .s-dot { background: var(--sx-brand); }
.sales-ui .s-strip .is-ok .s-dot { background: var(--sx-ok-fill); }

/* ── Pills and badges ─────────────────────────────────────────────────── */
.sales-ui .stage-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 1px 9px 1px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 500; line-height: 1.6; white-space: nowrap;
  background: var(--sx-card); color: var(--sx-ink-2); border: 1px solid var(--sx-line-2);
}
.sales-ui .stage-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--st, var(--sx-faint)); flex: none; }
.sales-ui .stage-new, .sales-ui .st-new { --st: var(--st-new); }
.sales-ui .stage-contacted, .sales-ui .st-contacted { --st: var(--st-contacted); }
.sales-ui .stage-meeting, .sales-ui .st-meeting { --st: var(--st-meeting); }
.sales-ui .stage-proposal, .sales-ui .st-proposal { --st: var(--st-proposal); }
.sales-ui .stage-negotiation, .sales-ui .st-negotiation { --st: var(--st-negotiation); }
.sales-ui .stage-won, .sales-ui .st-won { --st: var(--st-won); }
.sales-ui .stage-lost, .sales-ui .st-lost { --st: var(--st-lost); }
.sales-ui .stage-badge.stage-won { background: var(--sx-ok-soft); border-color: transparent; color: var(--sx-ok); }
.sales-ui .stage-badge.stage-lost { background: var(--sx-sunken); border-color: transparent; color: var(--sx-muted); }
.sales-ui .score-badge { display: inline-flex; align-items: center; border-radius: 6px; padding: 0 7px; font-size: 11.5px; font-weight: 600; line-height: 1.7; letter-spacing: 0; text-transform: none; }
.sales-ui .score-badge.score-hot { background: var(--sx-bad-soft); color: var(--sx-bad); }
.sales-ui .score-badge.score-warm { background: var(--sx-warn-soft); color: var(--sx-warn); }
.sales-ui .score-badge.score-cold { background: var(--sx-info-soft); color: var(--sx-info); }
.sales-ui .lead-tag { border-radius: 6px; padding: 0 7px; font-size: 11.5px; font-weight: 500; line-height: 1.7; background: var(--sx-sunken); color: var(--sx-ink-2); }
.sales-ui .lead-tag.tag-client { background: var(--sx-ok-soft); color: var(--sx-ok); }
.sales-ui .lead-tag.tag-returning { background: var(--sx-info-soft); color: var(--sx-info); }
.sales-ui .lead-tag.tag-notsales { background: var(--sx-sunken); color: var(--sx-muted); }
.sales-ui .lead-next { font-size: 12px; font-weight: 500; color: var(--sx-muted); }
.sales-ui .lead-next.late { color: var(--sx-bad); }
.sales-ui .lead-next.warn { color: var(--sx-warn); }
.sales-ui .status, .sales-ui .quote-status { font-size: 12px; font-weight: 500; padding: 1px 9px; }
.sales-ui .dept-tag { font-size: 11.5px; font-weight: 500; background: var(--sx-sunken); border-color: transparent; color: var(--sx-muted); }

/* Initials avatars: a soft tint per name */
.sales-ui .s-avatar {
  --av: #F26B1D; width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: inline-grid; place-items: center; font-size: 12px; font-weight: 600;
  color: color-mix(in srgb, var(--av) 72%, #1A1714); background: color-mix(in srgb, var(--av) 13%, #fff);
}
.sales-ui .s-avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.sales-ui .s-avatar.lg { width: 48px; height: 48px; font-size: 16px; }
.sales-ui .av-0 { --av: #F26B1D; } .sales-ui .av-1 { --av: #6366F1; } .sales-ui .av-2 { --av: #0D9488; } .sales-ui .av-3 { --av: #D97706; }
.sales-ui .av-4 { --av: #DB2777; } .sales-ui .av-5 { --av: #0284C7; } .sales-ui .av-6 { --av: #7C3AED; } .sales-ui .av-7 { --av: #57534E; }
html[data-theme="dark"] .sales-ui .s-avatar { color: color-mix(in srgb, var(--av) 62%, #fff); background: color-mix(in srgb, var(--av) 22%, #181614); }

/* ── Lists (to-dos, follow-ups, approvals) ────────────────────────────── */
.sales-ui .followup-list { display: block; margin: 0 calc(var(--sx-pad) * -1); border-top: 1px solid var(--sx-line); }
.sales-ui .card > .followup-list:last-child { margin-bottom: -20px; }
.sales-ui .followup-list > :last-child { border-bottom: 0; border-radius: 0 0 var(--sx-r) var(--sx-r); }
.sales-ui .followup-row {
  display: flex; align-items: center; gap: 14px; flex-wrap: nowrap; min-height: 60px;
  padding: 11px var(--sx-pad); border: 0; border-bottom: 1px solid var(--sx-line); border-radius: 0;
  background: transparent; color: var(--sx-ink); text-decoration: none; transition: background .12s ease;
}
.sales-ui .followup-row:hover, .sales-ui .followup-row.plain:hover { background: var(--sx-hover); border-color: var(--sx-line); }
.sales-ui .followup-main { flex: 1; min-width: 0; display: grid; gap: 3px; color: var(--sx-ink); text-decoration: none; }
.sales-ui .followup-main strong { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sales-ui .followup-main .s-co { font-weight: 400; color: var(--sx-muted); margin-left: 6px; }
.sales-ui .followup-main small { font-size: 12.5px; color: var(--sx-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sales-ui .s-meta { display: flex; align-items: center; gap: 4px 14px; flex-wrap: nowrap; min-width: 0; font-size: 12.5px; color: var(--sx-muted); overflow: hidden; }
.sales-ui .s-meta > span { white-space: nowrap; }
.sales-ui .s-meta > .s-quote { overflow: hidden; text-overflow: ellipsis; flex: 1 1 auto; min-width: 0; color: var(--sx-ink-2); }
.sales-ui .followup-actions { display: flex; gap: 6px; align-items: center; flex-wrap: nowrap; flex: none; }
.sales-ui .followup-actions select { width: auto; min-height: 30px; padding: 4px 28px 4px 9px; font-size: 12.5px; background-position: right 8px center; }
.sales-ui .sla {
  font-family: var(--font); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
  width: 84px; padding: 3px 8px; border-radius: 7px; text-align: center; flex: none;
  background: var(--sx-sunken); color: var(--sx-ink-2);
}
.sales-ui .sla.late { background: var(--sx-bad-soft); color: var(--sx-bad); }
.sales-ui .sla.now { background: var(--sx-brand-soft); color: var(--sx-accent); }
.sales-ui .s-mini-list { display: grid; }
.sales-ui .s-mini { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--sx-line); color: inherit; text-decoration: none; font-size: 13px; }
.sales-ui .s-mini:last-child { border-bottom: 0; }
.sales-ui a.s-mini:hover strong { color: var(--sx-accent); }
.sales-ui .s-mini time { font-size: 12px; font-weight: 600; color: var(--sx-ink-2); font-variant-numeric: tabular-nums; line-height: 1.35; }
.sales-ui .s-mini time small { display: block; font-weight: 500; font-size: 11.5px; }
.sales-ui .s-mini strong { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sales-ui .s-mini small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }

/* Empty states: say what's next */
.sales-ui .s-empty { display: flex; align-items: center; gap: 10px; padding: 14px 0 2px; color: var(--sx-muted); font-size: 13.5px; }
.sales-ui .s-empty .s-icon { color: var(--sx-ok-fill); }

/* Notes and banners */
.sales-ui .ai-note, .sales-ui .s-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: -10px 0 22px; padding: 0;
  background: none; border: 0; font-size: 13.5px; color: var(--sx-ink-2);
}
.sales-ui .s-banner > .s-icon { color: var(--sx-brand); }
.sales-ui .report-note { margin: -10px 0 22px; }

/* ── Tables ───────────────────────────────────────────────────────────── */
.sales-ui .data-table, .sales-ui .scoreboard { font-size: 13.5px; }
.sales-ui .data-table th, .sales-ui .scoreboard th {
  font-size: 12px; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--sx-muted);
  padding: 9px 12px; border-bottom: 1px solid var(--sx-line); background: transparent; white-space: nowrap;
}
.sales-ui .data-table td, .sales-ui .scoreboard td { padding: 12px; border-bottom: 1px solid var(--sx-line); }
.sales-ui .data-table tbody tr:last-child td, .sales-ui .scoreboard tbody tr:last-child td { border-bottom: 0; }
.sales-ui .data-table tbody tr:hover, .sales-ui .scoreboard tbody tr:hover { background: var(--sx-hover); }
.sales-ui .card > .table-wrap, .sales-ui .card form > .table-wrap { margin: 0 calc(var(--sx-pad) * -1); border-top: 1px solid var(--sx-line); }
.sales-ui .card > .table-wrap :is(th, td):first-child, .sales-ui .card form > .table-wrap :is(th, td):first-child { padding-left: var(--sx-pad); }
.sales-ui .card > .table-wrap :is(th, td):last-child, .sales-ui .card form > .table-wrap :is(th, td):last-child { padding-right: var(--sx-pad); }
.sales-ui .card > .table-wrap:last-child { margin-bottom: -20px; }
.sales-ui .num, .sales-ui th.num { text-align: right; font-variant-numeric: tabular-nums; }
.sales-ui .cell-bad { color: var(--sx-bad); font-weight: 600; }
.sales-ui .who-cell { display: flex; align-items: center; gap: 10px; }
.sales-ui .scoreboard tr.is-self td { background: color-mix(in srgb, var(--sx-brand) 5%, transparent); }

/* ── Chips and switches ───────────────────────────────────────────────── */
.sales-ui .stage-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.sales-ui .chip-btn {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; padding: 5px 11px;
  border-radius: 8px; border: 1px solid var(--sx-line-2); background: var(--sx-card); color: var(--sx-ink-2);
  text-decoration: none; box-shadow: none;
}
.sales-ui .chip-btn:hover { border-color: var(--sx-faint); color: var(--sx-ink); transform: none; }
.sales-ui .chip-btn.active { background: var(--sx-ink); border-color: var(--sx-ink); color: var(--sx-card); }
.sales-ui .s-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--sx-sunken); }
.sales-ui .s-seg a {
  min-height: 28px; padding: 3px 11px; border-radius: 7px; color: var(--sx-muted);
  font-size: 12.5px; font-weight: 500; text-decoration: none; display: inline-flex; align-items: center;
}
.sales-ui .s-seg a:hover { color: var(--sx-ink); }
.sales-ui .s-seg a.active { background: var(--sx-card); color: var(--sx-ink); box-shadow: 0 1px 2px rgba(26, 23, 20, .1); }

/* ── Charts ───────────────────────────────────────────────────────────── */
.sales-ui .tone-accent { --tone: var(--sx-brand); }
.sales-ui .tone-ok { --tone: var(--sx-ok-fill); }
.sales-ui .tone-warn { --tone: var(--sx-warn-fill); }
.sales-ui .tone-bad { --tone: var(--sx-bad-fill); }
.sales-ui .tone-muted { --tone: var(--c-other); }
.sales-ui .tone-c1 { --tone: var(--c1); }
.sales-ui [data-tip] { cursor: default; }

/* Columns: ≤24px marks, 4px rounded data-end, square at the baseline */
.sales-ui .s-cols { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 10px; }
.sales-ui .s-cols-y { position: relative; grid-row: 1; font-size: 11.5px; color: var(--sx-muted); font-variant-numeric: tabular-nums; text-align: right; }
.sales-ui .s-cols-y span { position: absolute; right: 0; transform: translateY(50%); white-space: nowrap; }
.sales-ui .s-cols-y .s-cols-y-pad { position: static; visibility: hidden; transform: none; }
.sales-ui .s-cols-plot { grid-row: 1; grid-column: 2; padding-top: 22px; box-sizing: border-box; }
.sales-ui .s-cols-inner { position: relative; height: 100%; display: flex; align-items: flex-end; }
.sales-ui .s-cols-grid { position: absolute; inset: 0; pointer-events: none; }
.sales-ui .s-cols-grid i { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid var(--sx-line); }
.sales-ui .s-cols-grid i.base { border-color: var(--sx-line-2); }
.sales-ui .s-col { position: relative; flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; outline-offset: -2px; }
.sales-ui .s-col i { position: relative; display: block; width: 24px; min-height: 2px; border-radius: 4px 4px 0 0; background: color-mix(in srgb, var(--tone, var(--sx-brand)) 30%, transparent); transition: background .15s ease; }
.sales-ui .s-col.is-current i { background: var(--tone, var(--sx-brand)); }
.sales-ui .s-col:hover i, .sales-ui .s-col:focus-visible i { background: color-mix(in srgb, var(--tone, var(--sx-brand)) 55%, transparent); }
.sales-ui .s-col.is-current:hover i, .sales-ui .s-col.is-current:focus-visible i { background: var(--tone, var(--sx-brand)); filter: brightness(1.06); }
.sales-ui .s-col b { position: absolute; bottom: calc(100% + 5px); left: 50%; transform: translateX(-50%); font-size: 12px; font-weight: 600; color: var(--sx-ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.sales-ui .s-cols-target { position: absolute; left: 0; right: 0; height: 0; border-top: 1.5px dashed color-mix(in srgb, var(--sx-ink) 50%, transparent); z-index: 2; pointer-events: none; }
.sales-ui .s-cols-target em { position: absolute; right: 0; bottom: 4px; font-style: normal; font-size: 11.5px; font-weight: 600; color: var(--sx-ink-2); background: var(--sx-card); padding: 0 0 0 6px; }
.sales-ui .s-cols-x { grid-column: 2; display: flex; margin-top: 8px; }
.sales-ui .s-cols-x span { flex: 1; text-align: center; font-size: 12px; color: var(--sx-muted); white-space: nowrap; }
.sales-ui .s-cols-x span.is-current { color: var(--sx-ink); font-weight: 600; }

/* Horizontal bars: value at the tip, label to the left */
.sales-ui .s-hbars { display: grid; gap: 2px; }
.sales-ui .s-hbar { display: grid; grid-template-columns: minmax(96px, 30%) minmax(0, 1fr) minmax(72px, auto); gap: 14px; align-items: center; min-height: 34px; padding: 4px 8px; margin: 0 -8px; border-radius: 8px; color: inherit; text-decoration: none; font-size: 13.5px; }
.sales-ui a.s-hbar:hover, .sales-ui .s-hbar:focus-visible { background: var(--sx-hover); }
.sales-ui .s-hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--sx-ink-2); }
.sales-ui .s-hbar-track { position: relative; height: 10px; }
.sales-ui .s-hbar-track i, .sales-ui .s-hbar-track b { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 0 4px 4px 0; }
.sales-ui .s-hbar-track i { background: var(--tone, var(--sx-brand)); }
.sales-ui .s-hbar-track i:not(:only-child) { background: color-mix(in srgb, var(--tone, var(--sx-brand)) 28%, transparent); }
.sales-ui .s-hbar-track b { background: var(--tone, var(--sx-brand)); border-right: 2px solid var(--sx-card); box-sizing: content-box; }
.sales-ui .s-hbar-val { font-weight: 600; white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; color: var(--sx-ink); }
.sales-ui .s-hbar-val small { font-weight: 500; font-size: 12px; margin-left: 4px; }
.sales-ui .s-key { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--sx-muted); margin: 0 0 10px; }
.sales-ui .s-key span { display: inline-flex; align-items: center; gap: 6px; }
.sales-ui .s-key i { width: 10px; height: 10px; border-radius: 2px; background: var(--tone, var(--sx-brand)); }
.sales-ui .s-key i.light { background: color-mix(in srgb, var(--tone, var(--sx-brand)) 28%, transparent); }

/* Ring meter: fill carries the state, track is a lighter step of it */
.sales-ui .s-ring { position: relative; display: inline-block; flex: none; container-type: inline-size; }
.sales-ui .s-ring svg { display: block; width: 100%; height: 100%; }
.sales-ui .s-ring-track { stroke: var(--sx-track); }
.sales-ui .s-ring-bar { stroke: var(--tone, var(--sx-brand)); }
.sales-ui .s-ring-pace { stroke: var(--sx-ink); stroke-width: 1.5; stroke-linecap: round; opacity: .5; }
.sales-ui .s-ring-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.sales-ui .s-ring-center strong { font-family: var(--sx-display); font-size: 16px; font-size: 24cqi; font-weight: 700; letter-spacing: -.01em; line-height: 1; }
.sales-ui .s-ring-center small { font-size: 10px; font-size: 11cqi; color: var(--sx-muted); margin-top: 2px; }

/* Funnel: one hue, the bar length is the count */
.sales-ui .s-funnel { display: grid; gap: 4px; }
.sales-ui .s-funnel-row { display: grid; grid-template-columns: 112px minmax(0, 1fr) 84px; gap: 14px; align-items: center; padding: 3px 8px; margin: 0 -8px; border-radius: 8px; color: inherit; text-decoration: none; font-size: 13.5px; }
.sales-ui a.s-funnel-row:hover, .sales-ui .s-funnel-row:focus-visible { background: var(--sx-hover); }
.sales-ui .s-funnel-label { color: var(--sx-ink-2); display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.sales-ui .s-funnel-label::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--st); flex: none; }
.sales-ui .s-funnel-track { display: flex; justify-content: center; height: 30px; }
.sales-ui .s-funnel-track i { height: 100%; min-width: 30px; border-radius: 5px; display: grid; place-items: center; background: color-mix(in srgb, var(--sx-brand) 16%, var(--sx-card)); }
.sales-ui a.s-funnel-row:hover .s-funnel-track i { background: color-mix(in srgb, var(--sx-brand) 26%, var(--sx-card)); }
.sales-ui .s-funnel-track b { font-size: 13px; font-weight: 600; color: var(--sx-ink); font-variant-numeric: tabular-nums; }
.sales-ui .s-funnel-val { text-align: right; font-size: 13px; color: var(--sx-ink-2); font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Trend line: 2px line, 10% wash, end dot with a surface ring */
.sales-ui .s-area-plot { position: relative; margin-top: 24px; }
.sales-ui .s-area-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.sales-ui .s-area-fill { fill: color-mix(in srgb, var(--tone, var(--sx-brand)) 10%, transparent); }
.sales-ui .s-area-line { fill: none; stroke: var(--tone, var(--sx-brand)); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.sales-ui .s-area-hit { position: absolute; top: 0; bottom: 0; transform: translateX(-50%); }
.sales-ui .s-area-hit::after { content: ""; position: absolute; left: 50%; top: var(--y); width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--tone, var(--sx-brand)); box-shadow: 0 0 0 2px var(--sx-card); opacity: 0; transition: opacity .12s ease; }
.sales-ui .s-area-hit::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; border-left: 1px solid var(--sx-line-2); opacity: 0; }
.sales-ui .s-area-hit:hover::after, .sales-ui .s-area-hit:hover::before, .sales-ui .s-area-hit:focus-visible::after, .sales-ui .s-area-hit.is-last::after { opacity: 1; }
.sales-ui .s-area-last { position: absolute; transform: translate(-100%, calc(-100% - 10px)); font-size: 12px; font-weight: 600; color: var(--sx-ink); white-space: nowrap; pointer-events: none; }
.sales-ui .s-area-x { position: relative; height: 18px; margin-top: 8px; }
.sales-ui .s-area-x span { position: absolute; transform: translateX(-50%); font-size: 11.5px; color: var(--sx-muted); white-space: nowrap; }
.sales-ui .s-area-x span:first-child { transform: none; }
.sales-ui .s-area-x span:last-child { transform: translateX(-100%); }

/* Linear meter */
.sales-ui .s-meter { position: relative; height: 6px; border-radius: 999px; background: var(--sx-track); }
.sales-ui .s-meter > i { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--tone, var(--sx-brand)); max-width: 100%; }
.sales-ui .s-meter > b { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--sx-ink); opacity: .45; }
.sales-ui .s-meter.is-empty { background: var(--sx-track); opacity: .6; }

/* ── Sales Today ──────────────────────────────────────────────────────── */
.sales-ui .s-month { display: grid; gap: 14px; }
.sales-ui .s-month-top { display: flex; align-items: center; gap: 16px; }
.sales-ui .s-month-text { display: grid; gap: 4px; min-width: 0; }
.sales-ui .s-month-text strong { font-family: var(--sx-display); font-size: 24px; font-weight: 700; letter-spacing: -.01em; line-height: 1; }
.sales-ui .s-month-text span { font-size: 12.5px; color: var(--sx-muted); }
.sales-ui .s-month-rows { display: grid; gap: 10px; }
.sales-ui .s-month-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; font-size: 13px; }
.sales-ui .s-month-row span { color: var(--sx-ink-2); }
.sales-ui .s-month-row b { font-weight: 600; font-variant-numeric: tabular-nums; }
.sales-ui .s-month-row b small { font-weight: 500; }
.sales-ui .s-month-row .s-meter { grid-column: 1 / -1; height: 4px; }

/* AI brief: marked by its icon and footer, not by decoration */
.sales-ui .brief-card h2 { display: flex; align-items: center; gap: 8px; }
.sales-ui .brief-card h2 .s-icon { color: var(--sx-brand); }
.sales-ui .brief-headline { margin: 6px 0 0; font-size: 14px; font-weight: 500; color: var(--sx-ink-2); }
.sales-ui .brief-list { margin: 0 0 12px; padding: 0 0 0 20px; display: grid; gap: 10px; }
.sales-ui .brief-list li { padding-left: 4px; }
.sales-ui .brief-list li::marker { color: var(--sx-muted); font-weight: 600; font-size: 13px; }
.sales-ui .brief-list li strong { display: block; font-weight: 600; font-size: 13.5px; }
.sales-ui .brief-list li strong a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--sx-line-2); }
.sales-ui .brief-list li strong a:hover { color: var(--sx-accent); border-color: currentColor; }
.sales-ui .brief-list li small { font-size: 12.5px; }
.sales-ui .brief-notes { margin: 0 0 12px; padding-left: 18px; font-size: 13px; color: var(--sx-ink-2); }
.sales-ui .brief-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--sx-line); }
.sales-ui .brief-empty { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.sales-ui .brief-empty h2 { margin: 0; display: flex; align-items: center; gap: 8px; }
.sales-ui .brief-empty h2 .s-icon { color: var(--sx-brand); }
.sales-ui .brief-empty p { margin: 3px 0 0; font-size: 13px; }

/* ── Sales dashboard ──────────────────────────────────────────────────── */
.sales-ui .s-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sales-ui .s-toolbar form { display: contents; }
.sales-ui .s-month-nav { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border: 1px solid var(--sx-line-2); border-radius: 10px; background: var(--sx-card); }
.sales-ui .s-month-nav a { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; color: var(--sx-muted); text-decoration: none; }
.sales-ui .s-month-nav a:hover { background: var(--sx-sunken); color: var(--sx-ink); }
.sales-ui .s-month-nav .disabled { opacity: .3; pointer-events: none; }
.sales-ui .s-month-nav select { border: 0; box-shadow: none; min-height: 30px; padding: 4px 24px 4px 6px; font-weight: 600; font-size: 13.5px; background-position: right 5px center; min-width: 0; width: auto; }
.sales-ui .s-month-nav select:focus { box-shadow: none; }

.sales-ui .s-hero { display: grid; grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr)); padding: 0; overflow: hidden; }
.sales-ui .s-hero-main, .sales-ui .s-goal { display: grid; grid-template-rows: auto 1fr auto auto; gap: 12px; padding: 22px 24px; min-width: 0; }
.sales-ui .s-goal { border-left: 1px solid var(--sx-line); }
.sales-ui .s-hero-label, .sales-ui .s-goal-label { font-size: 13px; font-weight: 500; color: var(--sx-muted); }
.sales-ui .s-hero-fig { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; align-self: end; }
.sales-ui .s-hero-fig strong { font-family: var(--sx-display); font-size: 46px; font-weight: 700; letter-spacing: -.015em; line-height: 1; }
.sales-ui .s-hero-fig span { font-size: 14px; }
.sales-ui .s-hero-foot { display: flex; align-items: center; gap: 4px 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--sx-muted); }
.sales-ui .s-goal-fig { align-self: end; font-family: var(--sx-display); font-size: 28px; font-weight: 700; letter-spacing: -.01em; line-height: 1; }
.sales-ui .s-goal-fig small { font-family: var(--font); font-size: 13px; font-weight: 500; letter-spacing: 0; margin-left: 5px; }
.sales-ui .tt-of { display: inline; margin: 0; font-size: 13px; font-weight: 500; color: var(--sx-muted); }
.sales-ui .tt-state { justify-self: start; display: inline-flex; align-items: center; gap: 6px; padding: 0; border-radius: 0; background: none; font-size: 12.5px; font-weight: 500; white-space: nowrap; color: var(--sx-muted); }
.sales-ui .tt-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--sx-faint); }
.sales-ui .tt-state.hit, .sales-ui .tt-state.on_track { color: var(--sx-ok); background: none; }
.sales-ui .tt-state.hit::before, .sales-ui .tt-state.on_track::before { background: var(--sx-ok-fill); }
.sales-ui .tt-state.behind { color: var(--sx-warn); background: none; }
.sales-ui .tt-state.behind::before { background: var(--sx-warn-fill); }
.sales-ui .tt-state.missed { color: var(--sx-bad); background: none; }
.sales-ui .tt-state.missed::before { background: var(--sx-bad-fill); }
.sales-ui .tt-state.none { background: none; }

.sales-ui .s-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0 0 24px; }
.sales-ui .s-facts > div { display: grid; gap: 4px; padding: 0 20px; border-left: 1px solid var(--sx-line); min-width: 0; }
.sales-ui .s-facts > div:first-child { padding-left: 0; border-left: 0; }
.sales-ui .s-facts span { font-size: 13px; color: var(--sx-muted); font-weight: 500; }
.sales-ui .s-facts strong { font-family: var(--sx-display); font-size: 24px; font-weight: 700; letter-spacing: -.01em; line-height: 1.05; }
.sales-ui .s-facts small { font-size: 12.5px; }
.sales-ui .s-rank { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; font-size: 12px; font-weight: 600; color: var(--sx-muted); font-variant-numeric: tabular-nums; }
.sales-ui .s-rank.r1 { background: var(--sx-brand-soft); color: var(--sx-accent); }
.sales-ui .target-form input { min-width: 96px; min-height: 34px; padding: 6px 9px; }
.sales-ui .target-actions { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; margin-top: 16px; }
.sales-ui .target-actions label { margin-left: auto; display: grid; gap: 4px; }
.sales-ui .target-actions label input { width: 120px; }

/* ── Dialogs ──────────────────────────────────────────────────────────── */
.sales-ui .celebrate-scrim { background: rgba(15, 13, 12, .42); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.sales-ui .sales-dialog, .sales-ui .celebrate-card { border-radius: 16px; border: 1px solid var(--sx-line); background: var(--sx-card); box-shadow: var(--sx-pop); }
.sales-ui .sales-dialog { padding: 24px; }
.sales-ui .sales-dialog h2 { font-size: 18px; margin-bottom: 4px; }
.sales-ui .chip-radios span { border-radius: 8px; padding: 6px 11px; font-weight: 500; font-size: 13px; border-color: var(--sx-line-2); background: var(--sx-card); color: var(--sx-ink-2); }
.sales-ui .chip-radios span:hover { border-color: var(--sx-faint); }
.sales-ui .chip-radios input:checked + span { background: var(--sx-ink); border-color: var(--sx-ink); color: var(--sx-card); }
.sales-ui .chip-radios.small span { padding: 4px 9px; font-size: 12.5px; }
.sales-ui .outcome-group { background: var(--sx-sunken); border-radius: 12px; }
.sales-ui .log-label { font-weight: 600; font-size: 13px; color: var(--sx-ink-2); }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 1180px) {
  .sales-ui .s-split { grid-template-columns: minmax(0, 1fr); }
  .sales-ui .s-split > aside { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; }
  .sales-ui .s-split > aside .s-flat:nth-child(2) { padding-top: 0; border-top: 0; }
}
@media (max-width: 960px) {
  .sales-ui .s-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sales-ui .s-strip > :nth-child(3) { border-left: 0; }
  .sales-ui .s-strip > :nth-child(n+3) { border-top: 1px solid var(--sx-line); }
  .sales-ui .s-grid-2, .sales-ui .s-grid-wide { grid-template-columns: minmax(0, 1fr); }
  .sales-ui .s-hero { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sales-ui .s-hero-main { grid-column: 1 / -1; border-bottom: 1px solid var(--sx-line); }
  .sales-ui .s-hero-main + .s-goal { border-left: 0; }
}
@media (max-width: 640px) {
  .sales-ui { width: calc(100% - 32px); margin-top: 20px; --sx-pad: 16px; }
  .sales-ui h1, .sales-ui .s-head h1 { font-size: 26px; }
  .sales-ui .card { padding: 16px var(--sx-pad); }
  .sales-ui .card > .followup-list:last-child, .sales-ui .card > .table-wrap:last-child { margin-bottom: -16px; }
  .sales-ui .s-head { align-items: stretch; flex-direction: column; margin-bottom: 18px; }
  .sales-ui .s-head-actions .s-select { flex: 1; }
  .sales-ui .s-head-actions .s-select select { flex: 1; min-width: 0; width: 100%; }
  .sales-ui .s-strip > * { padding: 14px 16px; }
  .sales-ui .s-strip-value { font-size: 28px; }
  .sales-ui .s-split > aside { display: block; }
  .sales-ui .s-split > aside .s-flat:nth-child(2) { padding-top: 18px; border-top: 1px solid var(--sx-line); }
  .sales-ui .followup-row { flex-wrap: wrap; gap: 8px 12px; padding: 12px var(--sx-pad); }
  .sales-ui .followup-row > .s-avatar { display: none; }
  .sales-ui .followup-main { flex-basis: calc(100% - 80px); }
  .sales-ui .s-meta { flex-wrap: wrap; }
  .sales-ui .s-meta > .s-quote { flex-basis: 100%; white-space: normal; }
  .sales-ui .followup-actions { width: 100%; flex-wrap: wrap; }
  .sales-ui .s-hero { grid-template-columns: minmax(0, 1fr); }
  .sales-ui .s-hero-main { padding: 18px; }
  .sales-ui .s-hero-fig strong { font-size: 46px; }
  .sales-ui .s-goal { padding: 14px 18px; border-left: 0; border-top: 1px solid var(--sx-line); grid-template-rows: none; }
  .sales-ui .s-hero-main + .s-goal { border-top: 0; }
  .sales-ui .s-facts { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .sales-ui .s-facts > div { padding: 0; border-left: 0; }
  .sales-ui .s-hbar { grid-template-columns: minmax(80px, 36%) minmax(0, 1fr) auto; gap: 10px; }
  .sales-ui .s-funnel-row { grid-template-columns: 96px minmax(0, 1fr) 64px; gap: 8px; }
  .sales-ui .target-actions label { margin-left: 0; }
}

/* Dashboard extras and chart details */
.sales-ui .s-toolbar > label:not(.s-select) { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; font-weight: 500; color: var(--sx-muted); }
.sales-ui .s-toolbar > label:not(.s-select) select { width: auto; min-width: 150px; min-height: 36px; padding: 6px 30px 6px 11px; font-size: 13.5px; font-weight: 500; }
.sales-ui .s-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--sx-line); }
.sales-ui .s-card-foot strong { color: var(--sx-ink); font-weight: 600; }
.sales-ui .s-sec-head > .muted-sm strong { color: var(--sx-ink); font-weight: 600; }
.sales-ui .s-details { margin-top: 14px; }
.sales-ui .s-details > summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; list-style: none; font-size: 13px; font-weight: 600; color: var(--sx-accent); }
.sales-ui .s-details > summary::-webkit-details-marker { display: none; }
.sales-ui .s-details > summary::after { content: ""; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform .15s ease; }
.sales-ui .s-details[open] > summary::after { transform: rotate(-135deg) translateY(-1px); }
.sales-ui .s-details[open] > summary { margin-bottom: 10px; }
.sales-ui .s-details .table-wrap { margin: 0 calc(var(--sx-pad) * -1) -20px; border-top: 1px solid var(--sx-line); }
.sales-ui .s-details .table-wrap :is(th, td):first-child { padding-left: var(--sx-pad); }
.sales-ui .s-details .table-wrap :is(th, td):last-child { padding-right: var(--sx-pad); }
@media (max-width: 640px) {
  .sales-ui .s-details .table-wrap { margin-bottom: -16px; }
  .sales-ui .sla { width: auto; min-width: 58px; }
}
.sales-ui :is(.s-cols, .s-hbars, .s-funnel, .s-meter, .s-key, .s-strip) i { font-style: normal; }
.sales-ui .s-hbars.has-parts .s-hbar-track i { background: color-mix(in srgb, var(--tone, var(--sx-brand)) 28%, transparent); }
.sales-ui .s-lb { display: grid; gap: 6px; min-width: 170px; max-width: 260px; }
.sales-ui .s-lb-foot { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--sx-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── Leads ────────────────────────────────────────────────────────────── */
.sales-ui .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.sales-ui .s-tabs { display: flex; align-items: center; gap: 2px; margin: -4px 0 16px; border-bottom: 1px solid var(--sx-line); overflow-x: auto; scrollbar-width: none; }
.sales-ui .s-tabs::-webkit-scrollbar { display: none; }
.sales-ui .s-tabs a { display: inline-flex; align-items: center; gap: 7px; padding: 9px 12px 11px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--sx-muted); font-size: 13.5px; font-weight: 500; text-decoration: none; white-space: nowrap; }
.sales-ui .s-tabs a:hover { color: var(--sx-ink); }
.sales-ui .s-tabs a.active { color: var(--sx-ink); font-weight: 600; border-bottom-color: var(--sx-ink); }
.sales-ui .s-tabs .s-tabs-end { margin-left: auto; }
.sales-ui .s-tabs .s-tabs-end .s-icon { color: var(--sx-brand); }
.sales-ui .s-tab-n { font-size: 12px; font-weight: 500; color: var(--sx-faint); font-variant-numeric: tabular-nums; }
.sales-ui .s-tabs a.active .s-tab-n { color: var(--sx-muted); }
.sales-ui .s-tab-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--st, var(--sx-faint)); flex: none; }
.sales-ui .s-table-card { padding-top: 14px; }
.sales-ui .s-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.sales-ui .s-filters > label:not(.s-search) { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; font-weight: 500; color: var(--sx-muted); }
.sales-ui .s-filters > label:not(.s-search) select { width: auto; min-width: 140px; min-height: 36px; padding: 6px 30px 6px 11px; font-size: 13.5px; }
.sales-ui .s-search { position: relative; flex: 1 1 280px; display: block; margin: 0; }
.sales-ui .s-search .s-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--sx-faint); pointer-events: none; }
.sales-ui .s-search input { min-height: 36px; padding-left: 36px; }
.sales-ui .s-table-note { margin: 14px 0 0; }
.sales-ui .s-leads td { vertical-align: middle; }
.sales-ui .s-leads tbody tr[data-href] { cursor: pointer; }
.sales-ui .s-lead-cell { display: flex; align-items: center; gap: 11px; min-width: 220px; }
.sales-ui .s-lead-text { display: grid; gap: 2px; min-width: 0; }
.sales-ui .s-lead-line { display: flex; align-items: center; gap: 7px; }
.sales-ui .s-lead-name { color: var(--sx-ink); font-weight: 600; text-decoration: none; }
.sales-ui .s-lead-name:hover { color: var(--sx-accent); }
.sales-ui .s-lead-sub { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; color: var(--sx-muted); }
.sales-ui .s-money { font-weight: 600; color: var(--sx-ink); white-space: nowrap; }
.sales-ui .s-src { display: block; white-space: nowrap; color: var(--sx-ink-2); }
.sales-ui .s-leads td small { display: block; font-size: 12px; }
.sales-ui .s-leads td.muted { white-space: nowrap; font-size: 12.5px; }

/* ── Pipeline board ───────────────────────────────────────────────────── */
.sales-ui .s-board-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px 18px; flex-wrap: wrap; margin: -4px 0 16px; }
.sales-ui .s-board-bar .board-filter { display: flex; margin: 0; max-width: none; }
.sales-ui .s-board-bar .board-filter > label { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; font-weight: 500; color: var(--sx-muted); }
.sales-ui .s-board-bar .board-filter select { width: auto; min-width: 180px; min-height: 36px; padding: 6px 30px 6px 11px; font-size: 13.5px; }
.sales-ui .board-summary { margin: 0; font-size: 13.5px; color: var(--sx-ink-2); }
.sales-ui .board-summary .link-btn { margin-left: 6px; }
.sales-ui .board-wrap { margin: 0 -4px; padding-bottom: 10px; }
.sales-ui .board { grid-auto-columns: minmax(218px, 1fr); gap: 14px; }
.sales-ui .board-col { background: var(--sx-sunken); border: 0; border-radius: 14px; padding: 12px; gap: 10px; min-height: 220px; }
.sales-ui .board-col-head { padding: 2px 4px 4px; }
.sales-ui .board-col-name { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--sx-ink); }
.sales-ui .board-col-name .s-count { background: var(--sx-card); }
.sales-ui .board-col-sum { font-size: 12.5px; font-weight: 500; color: var(--sx-muted); font-variant-numeric: tabular-nums; }
.sales-ui .board-cards { gap: 8px; }
.sales-ui .board-empty { margin: 0; padding: 22px 8px; text-align: center; font-size: 12.5px; color: var(--sx-faint); border: 1px dashed var(--sx-line-2); border-radius: 10px; }
.sales-ui .lead-card { gap: 4px; padding: 12px 13px; border: 1px solid var(--sx-line); border-radius: 11px; background: var(--sx-card); color: var(--sx-ink); box-shadow: 0 1px 2px rgba(26, 23, 20, .04); transition: border-color .15s ease, box-shadow .15s ease; }
.sales-ui .lead-card:hover { border-color: var(--sx-line-2); box-shadow: var(--sx-raise); transform: none; }
.sales-ui .lead-card-top { gap: 6px; flex-wrap: nowrap; }
.sales-ui .lead-card-top strong { font-size: 14px; font-weight: 600; margin-right: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sales-ui .lead-company { font-size: 12.5px; color: var(--sx-muted); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sales-ui .lead-meta { gap: 4px 10px; font-size: 12px; color: var(--sx-muted); margin-top: 4px; }
.sales-ui .lead-value { color: var(--sx-ink); font-weight: 600; }
.sales-ui .lead-card-tags { display: flex; gap: 5px; flex-wrap: wrap; }
.sales-ui .lead-card-foot { display: flex; flex-wrap: nowrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--sx-line); min-height: 24px; }
.sales-ui .lead-card-foot:empty { display: none; }
.sales-ui .lead-owner-av { margin-left: auto; }

@media (max-width: 760px) {
  .sales-ui .s-leads thead { display: none; }
  .sales-ui .s-leads, .sales-ui .s-leads tbody, .sales-ui .s-leads tr, .sales-ui .s-leads td { display: block; }
  .sales-ui .s-leads tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; padding: 14px var(--sx-pad); border-bottom: 1px solid var(--sx-line); }
  .sales-ui .s-leads tbody tr:last-child { border-bottom: 0; }
  .sales-ui .card > .table-wrap .s-leads td, .sales-ui .s-leads td { padding: 0; border: 0; text-align: left; }
  .sales-ui .s-leads td:first-child { grid-column: 1 / -1; margin-bottom: 4px; }
  .sales-ui .s-leads td[data-label]::before { content: attr(data-label); display: block; font-size: 11.5px; color: var(--sx-faint); margin-bottom: 1px; }
  .sales-ui .s-lead-cell { min-width: 0; }
  .sales-ui .s-filters > label:not(.s-search) { flex: 1 1 140px; }
  .sales-ui .s-filters > label:not(.s-search) select { flex: 1; min-width: 0; }
}
.sales-ui .lead-card-foot .lead-next { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Lead page ────────────────────────────────────────────────────────── */
.sales-ui .back-link { display: inline-flex; align-items: center; gap: 4px; margin: -6px 0 14px; font-size: 13px; font-weight: 500; color: var(--sx-muted); text-decoration: none; }
.sales-ui .back-link:hover { color: var(--sx-ink); }
.sales-ui .s-lead-head { padding: 22px 24px 20px; display: grid; gap: 20px; }
.sales-ui .s-lead-id { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px; align-items: start; }
.sales-ui .s-lead-id-text { display: grid; gap: 6px; min-width: 0; }
.sales-ui .s-lead-id h1 { margin: 0; font-size: 28px; overflow-wrap: anywhere; }
.sales-ui .s-lead-id h1 small { font-family: var(--font); font-size: 14px; font-weight: 500; letter-spacing: 0; color: var(--sx-muted); margin-left: 4px; }
.sales-ui .s-lead-id-sub { display: flex; flex-wrap: wrap; gap: 2px 14px; margin: 0; font-size: 13.5px; color: var(--sx-muted); }
.sales-ui .s-lead-co { color: var(--sx-ink-2); font-weight: 600; }
.sales-ui .s-lead-head .lead-badges { margin-top: 2px; }
.sales-ui .s-lead-head .lead-badges:empty { display: none; }
.sales-ui .s-lead-note { margin: 0; }
.sales-ui .lead-owner { display: grid; gap: 4px; min-width: 200px; }
.sales-ui .lead-owner form { margin: 0; }
.sales-ui .lead-owner select { min-height: 36px; }
.sales-ui .s-lead-stage { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 20px; align-items: center; padding-top: 18px; border-top: 1px solid var(--sx-line); }
.sales-ui .stage-track { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; margin: 0; padding: 0; list-style: none; }
.sales-ui .stage-track li { padding: 9px 0 0; border-top: 3px solid var(--sx-line); border-radius: 0; background: none; text-align: left; font-size: 12.5px; font-weight: 500; color: var(--sx-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sales-ui .stage-track li.passed { border-color: color-mix(in srgb, var(--sx-brand) 40%, var(--sx-line)); color: var(--sx-ink-2); background: none; }
.sales-ui .stage-track li.current { border-color: var(--sx-brand); color: var(--sx-ink); font-weight: 600; background: none; }
.sales-ui .stage-track li.current.won { border-color: var(--sx-ok-fill); color: var(--sx-ok); background: none; }
.sales-ui .stage-track li.current.lost { border-color: var(--sx-faint); color: var(--sx-muted); background: none; }
.sales-ui .stage-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sales-ui .stage-actions form { margin: 0; display: flex; }
.sales-ui .stage-actions .won-btn { color: var(--sx-ok); border-color: color-mix(in srgb, var(--sx-ok-fill) 45%, var(--sx-line-2)); background: var(--sx-card); padding: 7px 14px; font-size: 13.5px; }
.sales-ui .stage-actions .won-btn:hover:not(:disabled) { background: var(--sx-ok-soft); color: var(--sx-ok); border-color: var(--sx-ok-fill); }
.sales-ui .stage-actions .won-btn .s-icon { color: currentColor; }
.sales-ui .stage-actions .danger { padding: 7px 14px; font-size: 13.5px; }
.sales-ui .stage-jump select { width: auto; min-height: 36px; padding: 6px 30px 6px 11px; font-size: 13.5px; }
.sales-ui .s-lost-why { grid-column: 1 / -1; margin: 0; font-size: 13.5px; color: var(--sx-ink-2); }

.sales-ui .lead-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 22px; }
.sales-ui .action-btn, .sales-ui .action-menu > summary.action-btn {
  display: inline-flex; align-items: center; gap: 8px; width: auto; min-height: 38px; padding: 7px 14px;
  border: 1px solid var(--sx-line-2); border-radius: 10px; background: var(--sx-card); color: var(--sx-ink);
  font: 500 13.5px/1.25 var(--font); text-decoration: none; cursor: pointer; box-shadow: 0 1px 1px rgba(26, 23, 20, .04);
}
.sales-ui .action-btn:hover, .sales-ui .action-menu[open] > .action-btn { border-color: var(--sx-faint); background: var(--sx-hover); color: var(--sx-ink); transform: none; box-shadow: 0 1px 1px rgba(26, 23, 20, .04); }
.sales-ui .action-btn .s-icon { color: var(--sx-muted); }
.sales-ui .action-btn span { display: inline-flex; align-items: baseline; gap: 7px; font-weight: 600; }
.sales-ui .action-btn small { font-weight: 400; font-size: 12.5px; color: var(--sx-muted); max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sales-ui .action-btn.is-log { margin-left: auto; background: var(--sx-ink); border-color: var(--sx-ink); color: var(--sx-card); }
.sales-ui .action-btn.is-log .s-icon, .sales-ui .action-btn.is-log small { color: color-mix(in srgb, var(--sx-card) 70%, transparent); }
.sales-ui .action-btn.is-log:hover { background: var(--sx-ink-2); border-color: var(--sx-ink-2); color: var(--sx-card); }
.sales-ui .action-btn[data-ai-draft-open] .s-icon { color: var(--sx-brand); }
.sales-ui .action-menu-list { min-width: 260px; border-color: var(--sx-line); border-radius: 12px; box-shadow: var(--sx-pop); padding: 6px; background: var(--sx-card); }
.sales-ui .action-menu-list a, .sales-ui .action-menu-list button { padding: 8px 10px; border-radius: 8px; font-size: 13.5px; color: var(--sx-ink); }
.sales-ui .action-menu-list button { all: unset; display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 8px; font-size: 13.5px; color: var(--sx-ink); cursor: pointer; }
.sales-ui .action-menu-list a:hover, .sales-ui .action-menu-list button:hover { background: var(--sx-sunken); color: var(--sx-ink); }
.sales-ui .action-menu-list strong { font-weight: 500; }

.sales-ui .lead-columns { grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; }
.sales-ui .lead-col-main > .card, .sales-ui .lead-col-side > .card { margin-bottom: 16px; }
.sales-ui .s-empty.is-warn .s-icon { color: var(--sx-warn-fill); }
.sales-ui .s-empty.is-warn { color: var(--sx-ink-2); }
.sales-ui .add-followup { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--sx-line); }
.sales-ui .card > .followup-list + .add-followup { border-top: 1px solid var(--sx-line); }
.sales-ui .add-followup-fields label { font-size: 12.5px; }
.sales-ui .inline-edit-form { border-color: var(--sx-line); border-radius: 12px; box-shadow: var(--sx-pop); background: var(--sx-card); }
.sales-ui .quick-note { gap: 8px; margin-bottom: 18px; }
.sales-ui .timeline { gap: 0; }
.sales-ui .tl-item { grid-template-columns: 20px minmax(0, 1fr); gap: 12px; padding-bottom: 18px; }
.sales-ui .tl-item::before { left: 9px; top: 20px; width: 1px; background: var(--sx-line); }
.sales-ui .tl-dot { width: 20px; height: 20px; margin-top: 0; border-radius: 50%; background: var(--sx-card); border: 1px solid var(--sx-line-2); position: relative; }
.sales-ui .tl-dot::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--sx-faint); }
.sales-ui .tl-call .tl-dot::after, .sales-ui .tl-whatsapp .tl-dot::after, .sales-ui .tl-email .tl-dot::after, .sales-ui .tl-meeting .tl-dot::after { background: var(--c2); }
.sales-ui .tl-stage .tl-dot::after, .sales-ui .tl-ai .tl-dot::after, .sales-ui .tl-ai_fix .tl-dot::after { background: var(--sx-brand); }
.sales-ui .tl-enquiry .tl-dot::after { background: var(--c4); }
.sales-ui .tl-quote .tl-dot::after, .sales-ui .tl-payment .tl-dot::after, .sales-ui .tl-handoff .tl-dot::after { background: var(--sx-ok-fill); }
.sales-ui .tl-ai .tl-dot, .sales-ui .tl-ai_fix .tl-dot { box-shadow: none; }
.sales-ui .tl-head { gap: 4px 10px; font-size: 13.5px; }
.sales-ui .tl-head strong { font-weight: 600; }
.sales-ui .tl-outcome { font-size: 12px; font-weight: 500; background: var(--sx-sunken); color: var(--sx-ink-2); border-radius: 6px; padding: 0 7px; }
.sales-ui .tl-body p { margin: 4px 0 0; color: var(--sx-ink-2); font-size: 13.5px; line-height: 1.55; }

.sales-ui .ai-card { border-color: var(--sx-line); }
.sales-ui .s-ai-title { display: flex; align-items: center; gap: 8px; }
.sales-ui .s-ai-title .s-icon { color: var(--sx-brand); }
.sales-ui .ai-summary { font-weight: 500; font-size: 14px; color: var(--sx-ink); }
.sales-ui .ai-fix summary { color: var(--sx-accent); font-weight: 500; }
.sales-ui .enquiry-text { background: var(--sx-sunken); border-radius: 10px; padding: 12px 14px; font-size: 13.5px; line-height: 1.55; color: var(--sx-ink-2); }
.sales-ui .service-tags .dept-tag { font-size: 12px; padding: 2px 9px; }
.sales-ui .lead-facts { grid-template-columns: 112px minmax(0, 1fr); gap: 0; font-size: 13.5px; border-top: 1px solid var(--sx-line); }
.sales-ui .lead-facts dt, .sales-ui .lead-facts dd { padding: 8px 0; border-bottom: 1px solid var(--sx-line); }
.sales-ui .lead-facts dt { color: var(--sx-muted); font-weight: 500; }
.sales-ui .lead-facts dd { color: var(--sx-ink); }
.sales-ui .lead-facts dt:last-of-type, .sales-ui .lead-facts dd:last-of-type { border-bottom: 0; }
.sales-ui .edit-details > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
.sales-ui .edit-details > summary::-webkit-details-marker { display: none; }
.sales-ui .edit-details > summary::after { content: ""; width: 7px; height: 7px; border-right: 1.5px solid var(--sx-muted); border-bottom: 1.5px solid var(--sx-muted); transform: rotate(45deg); transition: transform .15s ease; }
.sales-ui .edit-details[open] > summary::after { transform: rotate(-135deg); }
.sales-ui .edit-details summary h2 { font-size: 15px; margin: 0; }
.sales-ui .service-picks { border-color: var(--sx-line); border-radius: 12px; }
.sales-ui .service-picks .pick span { border-color: var(--sx-line-2); border-radius: 8px; font-weight: 500; font-size: 12.5px; padding: 4px 10px; }
.sales-ui .service-picks .pick input:checked + span { background: var(--sx-ink); border-color: var(--sx-ink); color: var(--sx-card); }

/* Cards from other modules shown on the lead page */
.sales-ui .handoff-card, .sales-ui .contract-card, .sales-ui .approval-card { border-color: var(--sx-line); box-shadow: var(--sx-raise); }
.sales-ui .handoff-card { border-top: 3px solid var(--sx-ok-fill); }
.sales-ui .approval-card { border-top: 3px solid var(--sx-warn-fill); }
.sales-ui .audit-score { font-family: var(--sx-display); background: var(--sx-sunken); border-radius: 10px; }
.sales-ui .audit-pitch { border-color: var(--sx-line); background: var(--sx-sunken); border-radius: 12px; }
.sales-ui .wa-bubble { border-color: var(--sx-line); background: var(--sx-sunken); border-radius: 14px 14px 14px 4px; font-size: 14px; }
.sales-ui .wa-msg.out .wa-bubble { border-radius: 14px 14px 4px 14px; }

@media (max-width: 1100px) {
  .sales-ui .lead-columns { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .sales-ui .s-lead-id { grid-template-columns: auto minmax(0, 1fr); }
  .sales-ui .lead-owner { grid-column: 1 / -1; min-width: 0; }
  .sales-ui .s-lead-stage { grid-template-columns: minmax(0, 1fr); }
  .sales-ui .stage-track { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 10px; }
  .sales-ui .action-btn small { display: none; }
  .sales-ui .action-btn.is-log { margin-left: 0; }
  .sales-ui .s-lead-id h1 { font-size: 24px; }
}
.sales-ui .tl-who { font-size: 12.5px; color: var(--sx-ink-2); }
.sales-ui .tl-when { font-size: 12.5px; color: var(--sx-muted); }

/* ── Forms across the sales pages ─────────────────────────────────────── */
.sales-ui .grid-form { display: grid; gap: 14px 16px; }
.sales-ui form > button, .sales-ui form > .btn-ghost, .sales-ui .grid-form > button { justify-self: start; }
.sales-ui .filter-bar > button, .sales-ui .filter-bar > .btn-ghost { justify-self: start; align-self: end; }
.sales-ui .quote-head { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.sales-ui .quote-head .full { grid-column: 1 / -1; }
.sales-ui input[type="file"]::file-selector-button { margin-right: 10px; padding: 5px 11px; border: 1px solid var(--sx-line-2); border-radius: 7px; background: var(--sx-sunken); color: var(--sx-ink); font: 500 13px var(--font); cursor: pointer; }
.sales-ui .discard-form { margin: 4px 0 20px; }

/* Quote builder */
.sales-ui .quote-item { background: var(--sx-card); border-color: var(--sx-line); border-radius: 12px; padding: 14px; }
.sales-ui .quote-item:focus-within { border-color: var(--sx-line-2); box-shadow: var(--sx-raise); }
.sales-ui .qi-line { font-family: var(--sx-display); font-size: 18px; font-weight: 600; }
.sales-ui .quote-totals div { border-color: var(--sx-line); border-radius: 12px; background: var(--sx-sunken); padding: 14px 16px; }
.sales-ui .quote-totals span { text-transform: none; letter-spacing: 0; font-size: 12.5px; font-weight: 500; }
.sales-ui .quote-totals strong { font-family: var(--sx-display); font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
.sales-ui .quote-actions { gap: 12px; margin: 0 0 18px; }
.sales-ui .ai-quote { border-color: var(--sx-line); }
.sales-ui .ai-quote h2 { display: flex; align-items: center; gap: 8px; }
.sales-ui .page-title h1 .quote-status { font-family: var(--font); vertical-align: middle; }

@media (max-width: 760px) {
  .sales-ui .quote-head { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
.sales-ui .s-settings-nav { position: sticky; top: calc(var(--topbar-h) - 1px); z-index: 5; background: var(--sx-page); margin: -6px 0 20px; }
.sales-ui section[data-group][hidden] { display: none; }
html[data-theme="dark"] .sales-ui .stage-badge.stage-negotiation { background: var(--sx-card); color: var(--sx-ink-2); }
.sales-ui .s-tabs[hidden] { display: none; }
.sales-ui [id] { scroll-margin-top: calc(var(--topbar-h) + 64px); }

/* Quote builder: send actions on top, a save bar that stays in reach */
.sales-ui .s-send .quote-share { gap: 8px; }
.sales-ui .s-unsaved { display: flex; align-items: center; gap: 8px; margin: 14px 0 0; padding: 10px 14px; border-radius: 10px; background: var(--sx-warn-soft); color: var(--sx-warn); font-size: 13.5px; font-weight: 500; }
.sales-ui .s-unsaved[hidden] { display: none; }
.sales-ui .s-unsaved.flash { animation: s-nudge .5s ease; }
@keyframes s-nudge { 0%, 100% { transform: none; } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.sales-ui .s-savebar { position: sticky; bottom: calc(14px + var(--bnav-h, 0px)); z-index: 6; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 10px 14px 10px 10px; margin: 0 0 18px;
  background: color-mix(in srgb, var(--sx-card) 90%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid var(--sx-line-2); border-radius: 14px; box-shadow: var(--sx-pop); }
.sales-ui .discard-form { margin: 0 0 24px; }
@media (prefers-reduced-motion: reduce) { .sales-ui .s-unsaved.flash { animation: none; } }
/* Button labels stay on one line on desktop (they may wrap on phones); fields always use the text weight. */
:where(.sales-ui) button { white-space: nowrap; }
.sales-ui .s-savebar > button { flex: none; }
.sales-ui input, .sales-ui select, .sales-ui textarea { font-weight: 400; }
.sales-ui .s-select select, .sales-ui .s-toolbar > label select, .sales-ui .s-filters > label select, .sales-ui .s-month-nav select, .sales-ui .s-board-bar select { font-weight: 500; }
@media (max-width: 640px) { :where(.sales-ui) button { white-space: normal; } }
/* Same field heights everywhere: a label stretched by its grid row keeps its field at the normal height,
   date/time fields don't grow a pixel, and the compact toolbar fields match the 36px buttons. */
.sales-ui label { align-content: start; }
.sales-ui input:is([type="date"], [type="time"], [type="datetime-local"], [type="month"]) { height: 38px; }
.sales-ui .s-search input { height: 36px; padding-top: 6px; padding-bottom: 6px; }
.sales-ui .lead-owner select, .sales-ui .stage-jump select { height: 36px; padding: 6px 30px 6px 11px; font-size: 13.5px; font-weight: 500; }
/* Icon-only buttons (remove a row, cancel a follow-up) are small squares. */
.sales-ui .btn-ghost.icon-btn { width: 30px; min-width: 30px; padding: 0; justify-content: center; color: var(--sx-muted); }
.sales-ui .btn-ghost.icon-btn:hover:not(:disabled) { color: var(--sx-bad); border-color: color-mix(in srgb, var(--sx-bad-fill) 45%, var(--sx-line-2)); background: var(--sx-bad-soft); }
.sales-ui .client-chip { gap: 8px; padding: 5px 5px 5px 12px; border-color: var(--sx-line-2); border-radius: 10px; background: var(--sx-card); font-size: 13.5px; color: var(--sx-ink); }
/* Disclosures use the same small chevron instead of the browser's triangle. */
.sales-ui :is(.ai-fix, .audit-pitch) > summary { display: inline-flex; align-items: center; gap: 7px; list-style: none; cursor: pointer; }
.sales-ui .audit-pitch > summary { display: flex; justify-content: space-between; }
.sales-ui :is(.ai-fix, .audit-pitch) > summary::-webkit-details-marker { display: none; }
.sales-ui :is(.ai-fix, .audit-pitch, .service-row) > summary::after { content: ""; flex: none; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform .15s ease; opacity: .8; }
.sales-ui :is(.ai-fix, .audit-pitch, .service-row)[open] > summary::after { transform: rotate(-135deg) translateY(-1px); }
.sales-ui .service-row > summary { position: relative; padding-right: 22px; }
.sales-ui .service-row > summary::after { position: absolute; right: 2px; top: 50%; margin-top: -5px; color: var(--sx-muted); }
.sales-ui .service-row { border-color: var(--sx-line); background: var(--sx-card); }
.sales-ui .service-row:hover { border-color: var(--sx-line-2); }
.sales-ui .inline-edit-form { background: var(--sx-card); border-color: var(--sx-line-2); border-radius: 12px; box-shadow: var(--sx-pop); padding: 8px; }
/* "Details (optional)": the small note after a field's name stays on the name's line. */
.sales-ui label:has(> .muted-sm:first-child) { grid-template-columns: auto minmax(0, 1fr); column-gap: 5px; align-items: baseline; }
.sales-ui label:has(> .muted-sm:first-child) > .muted-sm:first-child { font-weight: 400; }
.sales-ui label:has(> .muted-sm:first-child) > :not(.muted-sm:first-child) { grid-column: 1 / -1; }
.sales-ui .sales-dialog h2 + form { margin-top: 14px; }
@media (max-width: 640px) {
  .sales-ui .s-savebar { padding: 8px; bottom: 8px; }
  .sales-ui .s-savebar > .muted-sm { display: none; }
  .sales-ui .s-savebar > button { flex: 1; justify-content: center; }
}

/* ── Pipeline board: drag and drop ───────────────────────────────────── */
.sales-ui .board-empty[hidden] { display: none; }
/* Press and hold on a phone picks the card up, so no link preview or text selection there. */
.sales-ui .lead-card[data-lead] { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.sales-ui .lead-card.is-dragging { opacity: .4; border-style: dashed; border-color: var(--sx-line-2); box-shadow: none; }
.sales-ui .lead-card.is-saving { opacity: .6; pointer-events: none; }
.sales-ui .lead-card.lead-ghost {
  position: fixed; left: 0; top: 0; z-index: 80; margin: 0; pointer-events: none; overflow: hidden;
  border-color: var(--sx-line-2); box-shadow: 0 22px 44px -16px rgba(26, 23, 20, .38), 0 6px 14px rgba(26, 23, 20, .12);
  cursor: grabbing; will-change: transform;
}
html.s-dragging, html.s-dragging * { cursor: grabbing !important; -webkit-user-select: none; user-select: none; }
html.s-dragging .sales-ui .board-col { outline: 1.5px dashed var(--sx-line-2); outline-offset: -1.5px; transition: background-color .12s ease; }
.sales-ui .board-col.is-over { background: color-mix(in srgb, var(--sx-brand) 9%, var(--sx-sunken)); outline: 2px solid color-mix(in srgb, var(--sx-brand) 55%, transparent) !important; }

.sales-ui .s-dropbar {
  position: fixed; left: 50%; bottom: calc(18px + var(--bnav-h, 0px)); z-index: 75; display: flex; gap: 10px; padding: 10px;
  background: color-mix(in srgb, var(--sx-card) 92%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 1px solid var(--sx-line-2); border-radius: 18px; box-shadow: var(--sx-pop);
  transform: translate(-50%, 28px); opacity: 0; transition: transform .18s ease, opacity .18s ease;
}
.sales-ui .s-dropbar[hidden] { display: none; }
.sales-ui .s-dropbar.show { transform: translate(-50%, 0); opacity: 1; }
.sales-ui .s-drop {
  display: flex; align-items: center; gap: 12px; width: 220px; padding: 13px 18px;
  border: 1.5px dashed; border-radius: 13px; transition: background-color .12s ease, color .12s ease, transform .12s ease;
}
.sales-ui .s-drop span { display: grid; gap: 1px; line-height: 1.2; }
.sales-ui .s-drop strong { font-size: 14.5px; font-weight: 600; }
.sales-ui .s-drop small { font-size: 12px; opacity: .8; }
.sales-ui .s-drop.won { color: var(--sx-ok); background: var(--sx-ok-soft); border-color: color-mix(in srgb, var(--sx-ok-fill) 55%, transparent); }
.sales-ui .s-drop.lost { color: var(--sx-bad); background: var(--sx-bad-soft); border-color: color-mix(in srgb, var(--sx-bad-fill) 50%, transparent); }
.sales-ui .s-drop.is-over { border-style: solid; transform: scale(1.03); }
.sales-ui .s-drop.won.is-over { background: var(--sx-ok); border-color: var(--sx-ok); color: #fff; }
.sales-ui .s-drop.lost.is-over { background: var(--sx-bad); border-color: var(--sx-bad); color: #fff; }
html[data-theme="dark"] .sales-ui .s-drop.won.is-over { background: var(--sx-ok-fill); border-color: var(--sx-ok-fill); color: #06140B; }
html[data-theme="dark"] .sales-ui .s-drop.lost.is-over { background: var(--sx-bad-fill); border-color: var(--sx-bad-fill); color: #1C0606; }

.sales-ui .won-confirm { background: var(--sx-ok); border-color: var(--sx-ok); color: #fff; }
.sales-ui .won-confirm:hover:not(:disabled) { background: color-mix(in srgb, var(--sx-ok) 88%, #000); color: #fff; }
html[data-theme="dark"] .sales-ui .won-confirm { background: var(--sx-ok-fill); border-color: var(--sx-ok-fill); color: #06140B; }
html[data-theme="dark"] .sales-ui .won-confirm:hover:not(:disabled) { background: color-mix(in srgb, var(--sx-ok-fill) 88%, #fff); color: #06140B; }
.sales-ui [data-board-dialog] .sales-dialog > p.muted { margin: 4px 0 16px; text-align: left; }
.sales-ui [data-board-dialog="lost"] .sales-dialog > p.muted { margin-bottom: 0; }

.sales-ui .s-board-toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(22px + var(--bnav-h, 0px)); z-index: 76; display: flex; align-items: center; gap: 6px 14px;
  width: fit-content; max-width: min(560px, calc(100% - 32px)); margin: 0 auto; padding: 10px 10px 10px 16px; overflow-wrap: anywhere;
  background: var(--sx-ink); color: var(--sx-card); border-radius: 12px; box-shadow: var(--sx-pop);
  font-size: 13.5px; font-weight: 500; line-height: 1.35;
}
.sales-ui .s-board-toast[hidden] { display: none; }
.sales-ui .s-board-toast.show { animation: s-toast-in .2s ease-out; }
.sales-ui .s-board-toast.error { background: var(--sx-bad); color: #fff; }
.sales-ui .s-board-toast span { flex: 1; min-width: 0; }
.sales-ui .s-board-toast a, .sales-ui .s-board-toast button {
  all: unset; flex: none; padding: 5px 10px; border-radius: 8px; font-weight: 600; color: inherit; cursor: pointer;
  background: color-mix(in srgb, currentColor 14%, transparent);
}
.sales-ui .s-board-toast a:hover, .sales-ui .s-board-toast button:hover { background: color-mix(in srgb, currentColor 24%, transparent); }
.sales-ui .s-board-toast a:focus-visible, .sales-ui .s-board-toast button:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
@keyframes s-toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

@media (max-width: 640px) {
  .sales-ui .s-dropbar { left: 10px; right: 10px; bottom: 10px; transform: translateY(28px); }
  .sales-ui .s-dropbar.show { transform: none; }
  .sales-ui .s-drop { flex: 1; width: auto; padding: 14px; }
  .sales-ui .s-board-toast { bottom: calc(12px + var(--bnav-h, 0px)); }
}
@media (prefers-reduced-motion: reduce) {
  .sales-ui .s-dropbar, .sales-ui .s-drop { transition: none; }
  .sales-ui .s-drop.is-over { transform: none; }
  .sales-ui .s-board-toast.show { animation: none; }
}
.sales-ui .lead-card.lead-ghost { transition: none; }
.sales-ui .lead-card[hidden] { display: none; }


html.s-palette-open { overflow: hidden; }
.s-palette-scrim.sales-ui {
  position: fixed; inset: 0; z-index: 90; width: auto; margin: 0; padding: 12vh 16px 16px;
  display: flex; justify-content: center; align-items: flex-start;
  background: rgba(12, 9, 7, .45); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  animation: s-pal-fade .14s ease-out;
}
.s-palette-scrim[hidden] { display: none; }
.sales-ui .s-palette {
  position: relative; width: min(640px, 100%); max-height: min(560px, 76vh); display: flex; flex-direction: column; overflow: hidden;
  background: var(--sx-card); color: var(--sx-ink); border: 1px solid var(--sx-line-2); border-radius: 16px;
  box-shadow: 0 30px 70px -20px rgba(12, 9, 7, .45), 0 8px 20px rgba(12, 9, 7, .12);
  animation: s-pal-in .16s ease-out;
}
.sales-ui .s-palette-field { display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 16px; border-bottom: 1px solid var(--sx-line); color: var(--sx-muted); }
.sales-ui .s-palette-field input {
  flex: 1; min-width: 0; height: 50px; min-height: 0; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none;
  font-size: 16px; color: var(--sx-ink); -webkit-appearance: none; appearance: none;
}
.sales-ui .s-palette-field input:focus { box-shadow: none; outline: none; }
.sales-ui .s-palette-field input::-webkit-search-cancel-button { display: none; }
.sales-ui .s-palette kbd { display: inline-block; padding: 2px 6px; border: 1px solid var(--sx-line-2); border-bottom-width: 2px; border-radius: 6px; background: var(--sx-sunken); color: var(--sx-muted); font: 600 11px/1.3 var(--font); }
.sales-ui .s-palette-esc { cursor: pointer; }
.sales-ui .s-palette-bar { height: 2px; margin-top: -1px; background: transparent; overflow: hidden; }
.sales-ui .s-palette-bar.busy { background: linear-gradient(90deg, transparent, var(--sx-brand), transparent) 0 0 / 40% 100% no-repeat; animation: s-pal-busy 1s linear infinite; }
.sales-ui .s-palette-list { flex: 1; overflow-y: auto; padding: 6px 8px 8px; overscroll-behavior: contain; }
.sales-ui .s-palette-group + .s-palette-group { margin-top: 4px; }
.sales-ui .s-palette-head { padding: 10px 10px 6px; font-size: 11.5px; font-weight: 600; letter-spacing: .02em; color: var(--sx-faint); }
.sales-ui .s-palette-opt {
  display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; color: var(--sx-ink); text-decoration: none; scroll-margin: 8px;
}
.sales-ui .s-palette-opt[aria-selected="true"] { background: color-mix(in srgb, var(--sx-brand) 8%, var(--sx-card)); box-shadow: inset 2px 0 0 var(--sx-brand); }
.sales-ui .s-palette-icon { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--sx-sunken); color: var(--sx-muted); }
.sales-ui .s-palette-icon.is-avatar { border-radius: 50%; background: var(--sx-brand-soft); color: var(--sx-accent); font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.sales-ui .kind-page .s-palette-icon { background: transparent; border: 1px solid var(--sx-line); }
.sales-ui .s-palette-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.sales-ui .s-palette-title { display: flex; align-items: baseline; gap: 8px; min-width: 0; font-size: 14px; font-weight: 600; white-space: nowrap; }
.sales-ui .s-palette-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sales-ui .s-palette-no { font-size: 12px; font-weight: 500; color: var(--sx-faint); font-variant-numeric: tabular-nums; }
.sales-ui .s-palette-sub { font-size: 12.5px; color: var(--sx-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sales-ui .s-palette mark { background: color-mix(in srgb, var(--sx-brand) 22%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.sales-ui .s-palette-side { flex: none; display: grid; justify-items: end; gap: 3px; color: var(--sx-faint); }
.sales-ui .s-palette-side .stage-badge { font-size: 11.5px; }
.sales-ui .s-palette-next { font-size: 12px; color: var(--sx-muted); white-space: nowrap; }
.sales-ui .s-palette-next.late { color: var(--sx-bad); font-weight: 500; }
.sales-ui .s-palette-empty { margin: 0; padding: 18px 12px 6px; font-size: 13.5px; color: var(--sx-muted); }
.sales-ui .s-palette-empty.error { color: var(--sx-bad); }
.sales-ui .s-palette-foot { display: flex; gap: 16px; flex-wrap: wrap; padding: 10px 16px; border-top: 1px solid var(--sx-line); background: var(--sx-sunken); font-size: 12px; color: var(--sx-muted); }
@keyframes s-pal-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes s-pal-in { from { opacity: 0; transform: translateY(-8px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes s-pal-busy { from { background-position: -40% 0; } to { background-position: 140% 0; } }
@media (max-width: 640px) {
  .s-palette-scrim.sales-ui { padding: 8px; }
  .sales-ui .s-palette { max-height: calc(100vh - 16px); border-radius: 14px; }
  .sales-ui .s-palette-foot { display: none; }
  .sales-ui .s-palette-side .s-palette-next { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .s-palette-scrim.sales-ui, .sales-ui .s-palette { animation: none; }
  .sales-ui .s-palette-bar.busy { animation: none; background: var(--sx-brand); opacity: .4; }
}
/* A signed proposal on the team's quote page */
.sales-ui .s-signed { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; margin-top: 16px; padding: 14px 18px; border: 1px solid var(--sx-line); border-radius: 12px; background: var(--sx-sunken); }
.sales-ui .s-signed-art { flex: 0 0 auto; min-width: 160px; max-width: 260px; padding: 4px 10px 6px; border-radius: 9px; background: #fff; color: #1E2A4A; border-bottom: 1px solid #433C36; }
.sales-ui .s-signed-art .sig-svg { display: block; width: 100%; height: 64px; color: #1E2A4A; }
.sales-ui .s-signed-art .sig-typed { font-family: 'Caveat', 'Segoe Script', 'Brush Script MT', cursive; font-size: 34px; font-weight: 600; line-height: 1.1; color: #1E2A4A; white-space: nowrap; }
.sales-ui .s-signed-text { flex: 1 1 260px; display: grid; gap: 4px; }
.sales-ui .s-signed-text p { margin: 0; }
.sales-ui .s-signed-ok, .sales-ui .s-signed-bad { display: inline-flex; align-items: center; gap: 5px; font-weight: 500; }
.sales-ui .s-signed-ok { color: var(--sx-ok); }
.sales-ui .s-signed-bad { color: var(--sx-bad); }

/* ── Monthly report (sales_monthly.php) ───────────────────────────────── */
.print-only { display: none; }
.sales-ui .s-head-actions > form { margin: 0; }
.sales-ui .s-delta { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.sales-ui .s-delta.up { color: var(--sx-ok); }
.sales-ui .s-delta.down { color: var(--sx-bad); }
.sales-ui .s-delta.same { color: var(--sx-muted); font-weight: 500; }
.sales-ui .s-goal-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px 10px; flex-wrap: wrap; }
.sales-ui .s-facts.s-facts-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.sales-ui .s-sent-note { display: flex; align-items: center; gap: 6px; margin: -8px 0 16px; }
.sales-ui .s-sent-note .s-icon { color: var(--sx-ok-fill); }
.sales-ui .s-card-note { margin: 12px 0 0; }
.sales-ui .s-renewals { list-style: none; margin: 0; padding: 0; display: grid; }
.sales-ui .s-renewals li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 10px 0; border-top: 1px solid var(--sx-line); font-size: 13.5px; }
.sales-ui .s-renewals li:first-child { border-top: 0; padding-top: 2px; }
.sales-ui .s-renewals span { display: grid; gap: 1px; }
.sales-ui .s-renewals small { font-size: 12px; color: var(--sx-muted); }
.sales-ui .s-renewals .num { text-align: right; }
.sales-ui .s-plain-link { color: inherit; text-decoration: none; }
.sales-ui .s-plain-link:hover { text-decoration: underline; }
.sales-ui .s-report-foot { margin: 4px 0 0; }
.sales-ui .s-print-head { margin: 0 0 14pt; padding-bottom: 10pt; border-bottom: 2pt solid var(--sx-brand); }
.sales-ui .s-print-kicker { font-size: 9pt; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--sx-accent); }
.sales-ui .s-print-head h1 { margin: 4pt 0 2pt; font-size: 22pt; }
.sales-ui .s-print-head h1 small { font-size: 12pt; font-weight: 500; color: var(--sx-muted); }
.sales-ui .s-print-head p { margin: 0; font-size: 9.5pt; color: var(--sx-muted); }
@media (max-width: 760px) {
  .sales-ui .s-facts.s-facts-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 16px; }
  .sales-ui .s-facts.s-facts-4 > div:nth-child(3) { padding-left: 0; border-left: 0; }
}
@media print {
  body:has(.s-print-head) { background: #fff !important; }
  body:has(.s-print-head) :is(.topbar, .sidebar, .site-footer, .flash, .no-print, .s-head, .s-tip) { display: none !important; }
  body:has(.s-print-head) .content { margin-left: 0 !important; padding: 0 !important; }
  body:has(.s-print-head) main.sales-ui { width: auto !important; max-width: none !important; margin: 0 !important; padding: 0 !important; font-size: 10pt; }
  body:has(.s-print-head) .print-only { display: block; }
  body:has(.s-print-head) .sales-ui * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body:has(.s-print-head) .sales-ui .card { box-shadow: none !important; border-color: #E2DFDA; break-inside: avoid; margin-bottom: 10pt; padding: 12pt 14pt; }
  body:has(.s-print-head) .sales-ui .s-hero { padding: 0; }
  body:has(.s-print-head) .sales-ui .s-hero-main, body:has(.s-print-head) .sales-ui .s-goal { padding: 12pt 14pt; }
  body:has(.s-print-head) .sales-ui .s-hero-fig strong { font-size: 30pt; }
  body:has(.s-print-head) .sales-ui .s-goal-fig { font-size: 18pt; }
  body:has(.s-print-head) .sales-ui .s-facts { margin-bottom: 12pt; break-inside: avoid; }
  body:has(.s-print-head) .sales-ui .s-facts strong { font-size: 16pt; }
  body:has(.s-print-head) .sales-ui .s-grid { gap: 10pt; }
  body:has(.s-print-head) .sales-ui .s-grid-2, body:has(.s-print-head) .sales-ui .s-grid-wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body:has(.s-print-head) .sales-ui .s-sec-head h2 { font-size: 12pt; }
  body:has(.s-print-head) .sales-ui .scoreboard { font-size: 9pt; }
  body:has(.s-print-head) .sales-ui .scoreboard :is(th, td) { padding: 6pt 8pt; }
  body:has(.s-print-head) .sales-ui tr { break-inside: avoid; }
  body:has(.s-print-head) .sales-ui .table-wrap { overflow: visible; }
  body:has(.s-print-head) .sales-ui a { color: inherit; text-decoration: none; }
  body:has(.s-print-head) .sales-ui .s-report-table .who-cell span { white-space: nowrap; }
  body:has(.s-print-head) .sales-ui .s-hbar { grid-template-columns: minmax(0, 46%) minmax(0, 1fr) auto; gap: 8px; font-size: 9pt; min-height: 22pt; }
}

/* ---------------------------------------------------------------------------
   WhatsApp inbox (sales_inbox.php): the chat list on the left, the chosen
   chat with its lead on the right; on phones one at a time.
   ------------------------------------------------------------------------- */
.sales-ui .s-inbox { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: 16px; align-items: start; }
.sales-ui .s-inbox > * { min-width: 0; }
.sales-ui .s-inbox-list { background: var(--sx-card); border: 1px solid var(--sx-line); border-radius: var(--sx-r); padding: 12px 0 6px; position: sticky; top: 76px; max-height: calc(100vh - 96px); display: flex; flex-direction: column; }
.sales-ui .s-inbox-search { display: grid; gap: 8px; padding: 0 12px 10px; }
.sales-ui .s-inbox-search input, .sales-ui .s-inbox-search select { width: 100%; }
.sales-ui .s-inbox-tabs { margin: 0 0 4px; padding: 0 8px; }
.sales-ui .s-inbox-tabs a { padding: 8px 8px 10px; font-size: 13px; }
.sales-ui .s-inbox-none { margin: 18px 16px; color: var(--sx-muted); font-size: 14px; }
.sales-ui .s-chats { list-style: none; margin: 0; padding: 0; overflow-y: auto; scrollbar-width: thin; }
.sales-ui .s-chat { display: flex; gap: 10px; padding: 11px 14px; color: inherit; text-decoration: none; border-left: 3px solid transparent; }
.sales-ui .s-chat:hover { background: var(--sx-hover); }
.sales-ui .s-chat.active { background: var(--sx-brand-soft); border-left-color: var(--sx-brand); }
.sales-ui .s-chat-main { display: grid; gap: 3px; min-width: 0; flex: 1; }
.sales-ui .s-chat-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.sales-ui .s-chat-top strong { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sales-ui .s-chat-top time { flex: none; font-size: 11.5px; color: var(--sx-faint); }
.sales-ui .s-chat-msg { font-size: 13px; color: var(--sx-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sales-ui .s-chat.unread .s-chat-top strong, .sales-ui .s-chat.unread .s-chat-msg { color: var(--sx-ink); font-weight: 700; }
.sales-ui .s-chat-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: 11.5px; }
.sales-ui .s-wait { color: var(--sx-warn); font-weight: 600; }
.sales-ui .s-wait.late { color: var(--sx-bad); }
.sales-ui .s-flag { padding: 1px 7px; border-radius: 999px; font-weight: 600; }
.sales-ui .s-flag.ai { background: var(--sx-info-soft); color: var(--sx-info); }
.sales-ui .s-flag.handed { background: var(--sx-bad-soft); color: var(--sx-bad); }
.sales-ui .s-flag.free { background: var(--sx-warn-soft); color: var(--sx-warn); }
.sales-ui .s-chat-owner, .sales-ui .s-chat-stage { color: var(--sx-faint); }
.sales-ui .s-unread { margin-left: auto; min-width: 20px; padding: 1px 6px; border-radius: 999px; background: var(--sx-ok); color: #fff; font-weight: 700; text-align: center; }
.sales-ui .s-inbox-chat { min-width: 0; }
.sales-ui .s-inbox-back { display: none; align-items: center; gap: 4px; margin-bottom: 10px; font-size: 14px; }
.sales-ui .s-chat-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 14px; padding: 14px 16px; margin-bottom: 12px; background: var(--sx-card); border: 1px solid var(--sx-line); border-radius: var(--sx-r); }
.sales-ui .s-chat-who { flex: 1 1 260px; min-width: 0; display: grid; gap: 4px; }
.sales-ui .s-chat-who h2 { margin: 0; font-size: 17px; }
.sales-ui .s-chat-who p { margin: 0; }
.sales-ui .s-chat-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.sales-ui .s-chat-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.sales-ui .s-chat-actions form { margin: 0; }
.sales-ui .s-chat-summary { margin: -4px 0 12px; padding: 10px 14px; border-radius: var(--sx-r); background: var(--sx-sunken); font-size: 13.5px; color: var(--sx-ink-2); }
.sales-ui .s-chat-summary span { display: block; font-size: 11.5px; font-weight: 600; color: var(--sx-muted); margin-bottom: 2px; }
.sales-ui .wa-card.in-inbox .wa-thread { max-height: calc(100vh - 430px); min-height: 220px; }
.sales-ui .s-inbox-empty { display: grid; place-items: center; gap: 8px; min-height: 320px; padding: 24px; text-align: center; color: var(--sx-muted); background: var(--sx-card); border: 1px dashed var(--sx-line); border-radius: var(--sx-r); }
.sales-ui .s-inbox-empty p { margin: 0; max-width: 32ch; }
.s-inbox-toast { position: fixed; bottom: calc(18px + var(--bnav-h, 0px)); left: 16px; right: 16px; width: fit-content; max-width: calc(100vw - 32px); margin: 0 auto; padding: 10px 16px; border-radius: 20px; background: #1f1a16; color: #fff; font-size: 14px; z-index: 40; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.s-inbox-toast a { color: #ffd2a8; }
.s-inbox-toast[hidden] { display: none; }
.wa-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.wa-tools select { max-width: 240px; }
@media (max-width: 899px) {
  .sales-ui .s-inbox { grid-template-columns: minmax(0, 1fr); }
  .sales-ui .s-inbox-list { position: static; max-height: none; }
  .sales-ui .s-inbox.has-chat .s-inbox-list { display: none; }
  .sales-ui .s-inbox:not(.has-chat) .s-inbox-chat { display: none; }
  .sales-ui .s-inbox-back { display: inline-flex; }
  .sales-ui .wa-card.in-inbox .wa-thread { max-height: 60vh; }
}

/* WhatsApp campaigns (sales_campaigns.php) */
.sales-ui .s-camp-tpl { display: block; }
.sales-ui .s-camp-form { display: grid; gap: 16px; }
.sales-ui .s-camp-form .card { display: grid; gap: 10px; }
.sales-ui .s-camp-form h2 { margin: 0; }
.sales-ui .s-camp-stages { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; padding: 10px 12px; border: 1px solid var(--sx-line); border-radius: var(--sx-r); }
.sales-ui .s-camp-stages legend { padding: 0 6px; font-size: 13px; color: var(--sx-muted); }
.sales-ui .s-camp-filters { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.sales-ui .s-camp-check { display: grid; gap: 10px; margin-top: 16px; }
.sales-ui .s-camp-check h2 { margin: 0; }
.sales-ui .s-camp-samples { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.sales-ui .s-camp-samples .wa-preview { margin-top: 4px; }
.sales-ui .s-camp-bar { height: 8px; border-radius: 999px; background: var(--sx-track); overflow: hidden; margin: 4px 0 10px; }
.sales-ui .s-camp-bar span { display: block; height: 100%; background: var(--sx-ok); border-radius: inherit; }
.sales-ui .s-camp-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 16px 0; }
.sales-ui .s-camp-stat { display: grid; gap: 2px; padding: 14px 16px; background: var(--sx-card); border: 1px solid var(--sx-line); border-radius: var(--sx-r); }
.sales-ui .s-camp-stat span { font-size: 13px; color: var(--sx-muted); }
.sales-ui .s-camp-stat strong { font-size: 26px; font-weight: 700; letter-spacing: -.015em; }
.sales-ui .s-camp-stat small { font-size: 12px; color: var(--sx-faint); }

/* WhatsApp templates (sales_wa_templates.php) */
.sales-ui .s-tpl-list, .sales-ui .s-tpl-new { display: grid; gap: 12px; }
.sales-ui .s-tpl-new { margin-top: 16px; scroll-margin-top: 80px; }
.sales-ui .s-tpl-list h2, .sales-ui .s-tpl-new h2 { margin: 0; }
.sales-ui .s-tpl-list-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.sales-ui .s-tpl-rows { list-style: none; margin: 0; padding: 0; }
.sales-ui .s-tpl-row { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr) auto; gap: 8px 18px; align-items: start; padding: 14px 0; border-top: 1px solid var(--sx-line); }
.sales-ui .s-tpl-row:first-child { border-top: 0; padding-top: 4px; }
.sales-ui .s-tpl-meta { display: grid; gap: 4px; justify-items: start; min-width: 0; }
.sales-ui .s-tpl-name { overflow-wrap: anywhere; }
.sales-ui .s-tpl-reason { margin: 2px 0 0; font-size: 12.5px; color: var(--sx-bad); }
.sales-ui .s-tpl-msg { display: grid; gap: 4px; min-width: 0; font-size: 14px; color: var(--sx-ink-2); }
.sales-ui .s-tpl-msg p { margin: 0; white-space: pre-line; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.sales-ui .s-tpl-msg small { color: var(--sx-faint); }
.sales-ui .s-tpl-msg mark, .sales-ui .s-tpl-bubble mark { background: color-mix(in srgb, var(--sx-brand) 16%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.sales-ui .s-tpl-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.sales-ui .s-tpl-btns span { font-size: 12px; padding: 2px 9px; border: 1px solid var(--sx-line-2); border-radius: 999px; color: var(--sx-muted); }
.sales-ui .s-tpl-ideas { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.sales-ui .s-tpl-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.sales-ui .s-tpl-form { display: grid; gap: 12px; }
.sales-ui .s-tpl-top { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.sales-ui .s-tpl-kind, .sales-ui .s-tpl-buttons { display: grid; gap: 8px; margin: 0; padding: 10px 12px; border: 1px solid var(--sx-line); border-radius: var(--sx-r); }
.sales-ui .s-tpl-kind legend, .sales-ui .s-tpl-buttons legend { padding: 0 6px; font-size: 13px; color: var(--sx-muted); }
.sales-ui .s-tpl-kind .check-line { align-items: flex-start; }
.sales-ui .s-tpl-kind .check-line > span { display: grid; gap: 1px; }
.sales-ui .s-tpl-buttons .grid-form { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.sales-ui .s-tpl-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: -4px; }
.sales-ui .s-tpl-blanks { display: grid; gap: 8px; padding: 10px 12px; background: var(--sx-sunken); border-radius: var(--sx-r); }
.sales-ui .s-tpl-blanks[hidden], .sales-ui .s-tpl-blank[hidden] { display: none; }
.sales-ui .s-tpl-blanks p { margin: 0; }
.sales-ui .s-tpl-blank { display: grid; grid-template-columns: 44px minmax(0, 1fr) minmax(0, 1fr); gap: 10px; align-items: end; }
.sales-ui .s-tpl-blank-n { font-weight: 700; font-size: 13px; padding-bottom: 10px; color: var(--sx-ink-2); }
.sales-ui .s-tpl-preview { position: sticky; top: 84px; display: grid; gap: 8px; }
.sales-ui .s-tpl-screen { display: grid; gap: 4px; padding: 18px 14px 22px; min-height: 260px; align-content: start; border-radius: 22px; border: 1px solid var(--sx-line); background: #efeae2; }
.sales-ui .s-tpl-bubble { display: grid; gap: 4px; max-width: 92%; padding: 8px 10px 6px; background: #fff; color: #111b21; border-radius: 4px 12px 12px 12px; box-shadow: 0 1px .5px rgba(11, 20, 26, .13); font-size: 14px; }
.sales-ui .s-tpl-bubble p { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.sales-ui .s-tpl-bubble small { color: #667781; font-size: 12.5px; }
.sales-ui .s-tpl-bubble [hidden], .sales-ui .s-tpl-pvbtns[hidden] { display: none; }
.sales-ui .s-tpl-pvbtns { display: grid; gap: 4px; max-width: 92%; }
.sales-ui .s-tpl-pvbtns span { padding: 8px; text-align: center; background: #fff; color: #027eb5; border-radius: 10px; font-size: 14px; font-weight: 500; box-shadow: 0 1px .5px rgba(11, 20, 26, .13); }
.sales-ui .s-tpl-pvbtns span.is-link::before { content: "↗ "; }
html[data-theme="dark"] .sales-ui .s-tpl-screen { background: #0b141a; border-color: #222d34; }
html[data-theme="dark"] .sales-ui .s-tpl-bubble, html[data-theme="dark"] .sales-ui .s-tpl-pvbtns span { background: #202c33; color: #e9edef; box-shadow: none; }
html[data-theme="dark"] .sales-ui .s-tpl-pvbtns span { color: #53bdeb; }
html[data-theme="dark"] .sales-ui .s-tpl-bubble small { color: #8696a0; }
.sales-ui .s-tpl-simple { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
@media (max-width: 899px) {
  .sales-ui .s-tpl-grid { grid-template-columns: minmax(0, 1fr); }
  .sales-ui .s-tpl-preview { position: static; }
  .sales-ui .s-tpl-screen { min-height: 0; }
  .sales-ui .s-tpl-row { grid-template-columns: minmax(0, 1fr) auto; }
  .sales-ui .s-tpl-msg { grid-column: 1 / -1; grid-row: 2; }
  .sales-ui .s-tpl-blank { grid-template-columns: 36px minmax(0, 1fr); }
  .sales-ui .s-tpl-blank label:last-child { grid-column: 2; }
  .sales-ui .s-tpl-top { grid-template-columns: minmax(0, 1fr); }
}

/* Date filters, interest, decision maker (Leads, Pipeline, Clients, Today, Dashboard, lead forms) */
.sales-ui .s-period-dates { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sales-ui .s-period-dates[hidden] { display: none; }
.sales-ui .s-period-dates label { display: inline-flex; margin: 0; }
.sales-ui .s-period-dates input[type="date"] { width: auto; min-height: 36px; padding: 5px 9px; font-size: 13.5px; }
.sales-ui .s-period-dates > span { color: var(--sx-faint); }
.sales-ui .s-month-nav input[type="date"] { border: 0; box-shadow: none; min-height: 30px; padding: 4px 6px; width: auto; font-weight: 600; font-size: 13.5px; background: transparent; }
.sales-ui .s-month-nav input[type="date"]:focus { box-shadow: none; }
.sales-ui .s-board-bar .board-filter { flex-wrap: wrap; gap: 8px; }
.sales-ui .s-board-bar .board-filter > label select { min-width: 130px; }
.sales-ui .s-filters-plain { margin: 4px 0 12px; }
.sales-ui .s-month .s-seg { display: flex; margin-bottom: 14px; }
.sales-ui .s-month .s-seg a { flex: 1; text-align: center; }
.sales-ui .s-period-row b small { font-weight: 500; margin-left: 4px; }
.sales-ui .s-period-row { grid-template-columns: 1fr auto; }
.sales-ui .s-decide { display: grid; gap: 10px; border-color: var(--sx-line); border-radius: 12px; }
.sales-ui .s-decide legend { font-size: 13px; color: var(--sx-muted); padding: 0 6px; }
.sales-ui .s-decide-who { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.sales-ui .s-decide-who[hidden] { display: none; }
.sales-ui .s-decide-who label { margin: 0; }
.sales-ui .lead-col-side .s-decide-who { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 720px) {
  .sales-ui .s-period-dates { flex: 1 1 100%; }
  .sales-ui .s-period-dates label { flex: 1; }
  .sales-ui .s-period-dates input[type="date"] { width: 100%; }
  .sales-ui .s-view-seg { display: flex; width: 100%; }
  .sales-ui .s-view-seg a { flex: 1; text-align: center; }
}

/* Inbox: channels, Auto / Manual, comments (sales_inbox.php) */
.sales-ui .s-inbox-channels { margin-bottom: 10px; }
.sales-ui .s-seg button { min-height: 28px; padding: 3px 11px; border-radius: 7px; border: 0; background: transparent; color: var(--sx-muted); font-size: 12.5px; font-weight: 500; box-shadow: none; cursor: pointer; }
.sales-ui .s-seg button:hover { color: var(--sx-ink); background: transparent; }
.sales-ui .s-seg button.active { background: var(--sx-card); color: var(--sx-ink); box-shadow: 0 1px 2px rgba(26, 23, 20, .1); }
.sales-ui .s-reply-modes { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 0 0 14px; }
.sales-ui .s-reply-mode { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--sx-ink-2); }
.sales-ui .ch-badge { display: inline-flex; align-items: center; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--sx-sunken); color: var(--sx-ink-2); }
.sales-ui .ch-badge.ch-whatsapp { background: #E3F6EA; color: #136C3A; }
.sales-ui .ch-badge.ch-instagram { background: #FBE7F1; color: #A3195B; }
.sales-ui .ch-badge.ch-messenger { background: #E4EEFD; color: #1F4FB5; }
html[data-theme="dark"] .sales-ui .ch-badge.ch-whatsapp { background: #123A24; color: #8FE0B0; }
html[data-theme="dark"] .sales-ui .ch-badge.ch-instagram { background: #44142C; color: #F5A3CB; }
html[data-theme="dark"] .sales-ui .ch-badge.ch-messenger { background: #15284A; color: #A9C4F5; }
.sales-ui .s-comments { display: grid; gap: 12px; }
.sales-ui .s-comment-list { list-style: none; margin: 0; padding: 0; display: grid; }
.sales-ui .s-comment { display: grid; gap: 8px; padding: 14px 0; border-top: 1px solid var(--sx-line); }
.sales-ui .s-comment:first-child { border-top: 0; padding-top: 2px; }
.sales-ui .s-comment-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.sales-ui .s-comment-head .status { margin-left: auto; }
.sales-ui .s-comment-text { margin: 0; font-size: 14.5px; white-space: pre-line; overflow-wrap: anywhere; }
.sales-ui .s-comment-replied { margin: 0; }
.sales-ui .s-comment-form { display: grid; gap: 8px; padding: 10px 12px; background: var(--sx-sunken); border-radius: var(--sx-r); }
.sales-ui .s-comment-form label { margin: 0; }
.sales-ui .s-comment-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.sales-ui .s-reply-table { display: grid; gap: 4px; }
.sales-ui .s-reply-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--sx-line); }
.sales-ui .s-reply-row:first-of-type { border-top: 0; }
.sales-ui .s-reply-row > span:first-child { display: grid; gap: 1px; }
.sales-ui .s-reply-table > button { justify-self: start; margin-top: 8px; }
.sales-ui .wa-card.ch-instagram h2 small, .sales-ui .wa-card.ch-messenger h2 small { font-weight: 500; font-size: 13px; }
@media (max-width: 720px) {
  .sales-ui .s-reply-modes { gap: 8px; }
  .sales-ui .s-reply-mode { width: 100%; justify-content: space-between; }
}

/* Go-live checklist (Sales Settings → Setup, Super Admin's home) */
.sales-ui .s-setup-list { list-style: none; margin: 0; padding: 0; display: grid; }
.sales-ui .s-setup-list li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: start; gap: 12px; padding: 12px 0; border-top: 1px solid var(--sx-line); }
.sales-ui .s-setup-list li:first-child { border-top: 0; padding-top: 4px; }
.sales-ui .s-setup-mark { display: grid; place-items: center; width: 20px; height: 20px; margin-top: 1px; border-radius: 50%; border: 1.5px solid var(--sx-line-2); color: #fff; }
.sales-ui .s-setup-list .is-done .s-setup-mark { background: var(--sx-ok, #2f8a57); border-color: var(--sx-ok, #2f8a57); }
.sales-ui .s-setup-text { display: grid; gap: 3px; min-width: 0; }
.sales-ui .s-setup-text strong { font-size: 14px; font-weight: 600; }
.sales-ui .s-setup-list .is-done .s-setup-text strong { color: var(--sx-muted); }
.sales-ui .s-setup-text small { font-size: 12.5px; color: var(--sx-muted); overflow-wrap: anywhere; }
.sales-ui .s-setup-list .link-btn { white-space: nowrap; margin-top: 1px; }
/* Connections cards fold to their heading until opened. */
.sales-ui section.card.is-folded > :not(.card-head) { display: none !important; }
.sales-ui section.card.is-folded { padding-bottom: 18px; }
.sales-ui section.card.is-folded .card-head { margin-bottom: 0; }
.sales-ui .s-fold-btn { flex: none; align-self: center; margin-left: auto; }
.home-setup.sales-ui { width: auto; margin: 0 0 18px; }
