/* RAW Athletic — Bone Signal UI
   Balanced density, Attio-flavored, command-palette driven. */

/* ---------- Brand fonts --------------------------------------------- */
/* Helvetica Neue subset: Regular / Medium / Bold / Black as woff2.
   Review Condensed Bold is available as a display family via `--display`. */
@font-face {
  font-family: 'Helvetica Neue';
  src: url('brand/fonts/HelveticaNeue-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Helvetica Neue';
  src: url('brand/fonts/HelveticaNeue-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Helvetica Neue';
  src: url('brand/fonts/HelveticaNeue-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Helvetica Neue';
  src: url('brand/fonts/HelveticaNeue-Black.woff2') format('woff2');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Review Condensed';
  src: url('brand/fonts/ReviewCondensed-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bone:       #F2EFE8;
  --bone-2:     #EBE7DE;
  --bone-3:     #E2DED2;
  --ink:        #0E0E0C;
  --ink-2:      #2A2A26;
  --muted:      rgba(14, 14, 12, 0.55);
  --muted-2:    rgba(14, 14, 12, 0.38);
  --line:       rgba(14, 14, 12, 0.10);
  --line-2:     rgba(14, 14, 12, 0.06);
  /* RAW Bright Orange (#fe3b1f, from the R monogram) drives signal/accent.
     The red wordmark hue #ee4028 is reserved for full-logo lockups. */
  --signal:     #fe3b1f;
  --signal-ink: #c22a13;
  --signal-soft: #ffe4dd;
  --green:      oklch(0.58 0.12 155);
  --green-soft: oklch(0.94 0.04 155);
  --blue:       oklch(0.55 0.13 245);
  --blue-soft:  oklch(0.94 0.04 245);
  --warn:       oklch(0.65 0.16 30);
  --warn-soft:  oklch(0.94 0.04 35);
  --radius:     8px;
  --radius-sm:  6px;
  --sans:       'Helvetica Neue', 'Inter Tight', ui-sans-serif, system-ui, sans-serif;
  --mono:       'JetBrains Mono', ui-monospace, monospace;
  --display:    'Review Condensed', 'Helvetica Neue', var(--sans);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bone);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
}

button { font-family: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }

/* ---------- Top rail ------------------------------------------------ */
.rail {
  position: sticky; top: 0; z-index: 20;
  height: 48px;
  background: rgba(242, 239, 232, 0.85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.rail-inner {
  height: 100%;
  max-width: none;
  margin: 0;
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.rail .brand {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  line-height: 0;
}
.rail .brand img {
  width: 20px;
  height: 20px;
  display: block;
}
.rail .crumbs {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--muted);
  display: flex; align-items: center; gap: 8px;
}
.rail .crumbs .sep { opacity: 0.4; }
.rail .crumbs b { color: var(--ink); font-weight: 500; }
.rail .spacer { flex: 1; }
.rail .search-pill {
  height: 30px;
  padding: 0 10px 0 12px;
  background: var(--bone-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; gap: 10px;
  font-size: 13px;
  color: var(--muted);
  min-width: 360px;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.rail .search-pill > span:first-child {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rail .search-pill:hover { background: var(--bone-3); border-color: rgba(14,14,12,0.18); }
.rail .search-pill .kbd {
  margin-left: auto;
  display: inline-flex; gap: 2px;
}
.kbd-key {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  border-radius: 4px;
  background: rgba(14,14,12,0.06);
  border: 1px solid var(--line);
  font-family: var(--mono); font-size: 10px;
  color: var(--muted);
}
.rail .user-chip {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px;
  color: var(--muted);
}
.bell-wrap {
  position: relative;
}
.bell-btn {
  position: relative;
  width: 32px;
  padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-2);
}
.bell-btn:hover { color: var(--ink); background: var(--bone-2); }
.bell-badge {
  position: absolute;
  top: -3px; right: -3px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--signal);
  color: #fff;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  line-height: 16px;
  letter-spacing: 0;
  display: inline-flex;
  align-items: center; justify-content: center;
  border: 2px solid var(--bone);
}
.bell-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 380px;
  max-width: calc(100vw - 40px);
  background: #FBF9F3;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow:
    0 18px 40px -10px rgba(14,14,12,0.25),
    0 2px 6px rgba(14,14,12,0.06);
  z-index: 60;
  overflow: hidden;
  animation: bellRise 0.14s cubic-bezier(.2,.9,.3,1.1);
}
@keyframes bellRise {
  from { transform: translateY(-4px); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}
.bell-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-2);
  background: #F7F4EE;
}
.bell-hd-title {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}
.bell-markall {
  background: transparent;
  border: none;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--signal-ink);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  transition: background 0.12s;
}
.bell-markall:hover { background: var(--signal-soft); }
.bell-list {
  max-height: 60vh;
  overflow-y: auto;
  padding: 4px 0;
}
.bell-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--muted-2);
  font-size: 13px;
}
.bell-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line-2);
  cursor: pointer;
  text-align: left;
  transition: background 0.1s;
  font-family: var(--sans);
}
.bell-item:last-child { border-bottom: none; }
.bell-item:hover { background: var(--bone-2); }
.bell-item.unread { background: rgba(254,59,31,0.04); }
.bell-item.unread:hover { background: rgba(254,59,31,0.08); }
.bell-item.unread::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--signal);
}
.bell-item { position: relative; }
.bell-ico {
  width: 22px; height: 22px;
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  background: var(--bone-2);
  border-radius: 4px;
  margin-top: 1px;
}
.bell-item.unread .bell-ico { color: var(--signal-ink); background: var(--signal-soft); }
.bell-body { flex: 1; min-width: 0; }
.bell-title {
  font-size: 13px;
  color: var(--ink);
  line-height: 1.35;
}
.bell-item.unread .bell-title { font-weight: 500; }
.bell-contact {
  color: var(--muted);
  font-weight: 400;
}
.bell-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.bell-time {
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted-2);
  white-space: nowrap;
  margin-top: 3px;
}
.avatar {
  width: 24px; height: 24px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 10px; font-weight: 500;
  color: #F2EFE8;
  letter-spacing: 0.03em;
}
.avatar.lg { width: 36px; height: 36px; font-size: 12px; }
.avatar.xl { width: 48px; height: 48px; font-size: 14px; }

/* ---------- Buttons ------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 30px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  border: 1px solid var(--line);
  background: var(--bone);
  color: var(--ink);
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.btn > * { white-space: nowrap; }
.btn:hover { background: var(--bone-2); }
.btn.primary {
  background: var(--ink); color: var(--bone); border-color: var(--ink);
}
.btn.primary:hover { background: #000; }
.btn.ghost {
  background: transparent; border-color: transparent;
}
.btn.ghost:hover { background: var(--bone-2); }
.btn.danger { color: var(--warn); border-color: var(--warn-soft); background: var(--warn-soft); }
.btn.sm { height: 26px; padding: 0 10px; font-size: 12px; }
.btn .icon { width: 14px; height: 14px; }

/* ---------- Card / panel -------------------------------------------- */
.card {
  background: #FBF9F3;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.card .hd {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-2);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.card .hd .title {
  font-family: var(--mono);
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted);
  display: flex; align-items: center; gap: 10px;
}
.card .hd .title b { color: var(--ink); font-weight: 500; }
.card .hd .aside { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 8px; }
.card .bd { padding: 18px; }
.card .bd.p0 { padding: 0; }

/* ---------- Chips / tags -------------------------------------------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px;
  padding: 0 8px;
  border-radius: 11px;
  font-size: 11px; font-weight: 500;
  font-family: var(--mono); letter-spacing: 0.04em;
  border: 1px solid var(--line);
  background: var(--bone-2);
  color: var(--ink);
  text-transform: lowercase;
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.7; }
.chip.stage-new      { color: var(--signal-ink); background: var(--signal-soft); border-color: transparent; }
.chip.stage-contacted{ color: var(--blue);       background: var(--blue-soft);   border-color: transparent; }
.chip.stage-booked   { color: var(--green);      background: var(--green-soft);  border-color: transparent; }
.chip.stage-reschedule { color: var(--warn);     background: var(--warn-soft);   border-color: transparent; }
.chip.stage-member   { color: var(--ink);        background: var(--bone-3);      border-color: transparent; }
.chip.stage-churned  { color: var(--muted);      background: var(--bone-2);      border-color: transparent; text-decoration: line-through; text-decoration-color: rgba(14,14,12,0.25); }
/* Sidekick chip rendered next to the main stage chip on lead-detail when the
   contact is in NEEDS_RESCHEDULE — surfaces how long they've been waiting. */
.chip.reschedule-wait { color: var(--warn); background: var(--warn-soft); border-color: transparent; text-transform: none; }

.chip.tommy-pending  { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.chip.tommy-drafting { color: var(--blue); background: var(--blue-soft); border-color: transparent; }
.chip.tommy-unanswered{ color: var(--warn); background: var(--warn-soft); border-color: transparent; }

.kicker {
  font-family: var(--mono);
  font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--muted-2);
}

/* ---------- Tables -------------------------------------------------- */
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.tbl th {
  font-family: var(--mono);
  font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted-2);
  font-weight: 500;
  text-align: left;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: #F7F4EE;
  position: sticky; top: 0; z-index: 1;
}
.tbl td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}
.tbl tr { transition: background 0.12s; }
.tbl tbody tr:hover { background: var(--bone-2); cursor: pointer; }
.tbl td.name { font-weight: 500; }
.tbl td.mono { font-family: var(--mono); font-size: 12px; color: var(--muted); letter-spacing: 0.02em; }

/* ---------- Command palette ---------------------------------------- */
.cmd-scrim {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(14,14,12,0.32);
  backdrop-filter: blur(4px);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 13vh;
  animation: fadeIn 0.12s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.cmd {
  width: 620px; max-width: calc(100vw - 32px);
  background: #FBF9F3;
  border: 1px solid rgba(14,14,12,0.18);
  border-radius: 12px;
  box-shadow: 0 28px 60px -20px rgba(14,14,12,0.35),
              0 2px 8px rgba(14,14,12,0.08);
  overflow: hidden;
  animation: rise 0.16s cubic-bezier(.2,.9,.3,1.1);
}
@keyframes rise { from { transform: translateY(6px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.cmd .cmd-input {
  width: 100%;
  height: 54px;
  padding: 0 20px;
  font-family: var(--sans);
  font-size: 16px;
  border: none; outline: none;
  background: transparent;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}
.cmd .cmd-input::placeholder { color: var(--muted-2); }
.cmd .cmd-list {
  max-height: 48vh;
  overflow: auto;
  padding: 8px 0;
}
.cmd .cmd-group {
  font-family: var(--mono);
  font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted-2);
  padding: 10px 20px 6px;
}
.cmd .cmd-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 20px;
  font-size: 14px;
  cursor: pointer;
}
.cmd .cmd-item .cmd-ico {
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted);
  font-family: var(--mono); font-size: 11px;
  background: var(--bone-2);
  border-radius: 4px;
}
.cmd .cmd-item .cmd-label { flex: 1; }
.cmd .cmd-item .cmd-hint {
  color: var(--muted-2);
  font-family: var(--mono); font-size: 11px;
}
.cmd .cmd-item.active { background: var(--bone-2); }
.cmd .cmd-item.active .cmd-ico { background: var(--ink); color: var(--bone); }
.cmd-foot {
  padding: 9px 20px;
  border-top: 1px solid var(--line);
  display: flex; gap: 18px; align-items: center;
  font-size: 11px; color: var(--muted);
  font-family: var(--mono);
  letter-spacing: 0.04em;
  background: #F7F4EE;
}
.cmd-foot .g { display: inline-flex; align-items: center; gap: 5px; }

/* ---------- Login --------------------------------------------------- */
.login-root {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.login-poster {
  background: var(--ink);
  color: var(--bone);
  padding: 56px 64px;
  position: relative;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.login-poster .poster-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: rgba(242,239,232,0.55);
}
.login-poster .poster-head .dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--signal); margin-right: 10px; vertical-align: 2px;
}
.login-poster .poster-head b { color: var(--bone); font-weight: 500; }

.login-poster .poster-mark {
  flex: 1;
  display: flex; flex-direction: column; justify-content: center;
  margin-top: -40px;
}
.login-poster .poster-wordmark {
  margin: 0;
  display: block;
  line-height: 0;
}
.login-poster .poster-wordmark img {
  display: block;
  width: 100%;
  max-width: 520px;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}
.login-poster .tagline {
  margin-top: 28px;
  display: flex; align-items: center; gap: 20px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(242,239,232,0.75);
}
.login-poster .tagline .bar { width: 56px; height: 1px; background: var(--signal); }

.login-poster .poster-foot {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 28px;
  padding-top: 24px;
  border-top: 1px solid rgba(242,239,232,0.16);
  font-family: var(--mono);
  font-size: 11px;
  color: rgba(242,239,232,0.6);
  line-height: 1.6;
  letter-spacing: 0.02em;
}
.login-poster .poster-foot .label {
  display: block;
  font-size: 9px; letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(242,239,232,0.38);
  margin-bottom: 6px;
}
.login-poster .poster-foot b { color: var(--bone); font-weight: 500; }

.login-form-pane {
  padding: 56px 64px;
  display: flex; flex-direction: column; justify-content: center;
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
}
/* Hidden on desktop — the .login-poster shows the wordmark there.
   The mobile media query un-hides this for phones (poster is gone). */
.login-form-mark { display: none; }
.login-form-pane .eyebrow {
  font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 24px;
}
.login-form-pane h1 {
  font-weight: 700;
  font-size: 36px;
  letter-spacing: -0.02em;
  line-height: 1.08;
  margin: 0 0 10px;
}
.login-form-pane .lede {
  color: var(--muted);
  font-size: 15px;
  margin: 0 0 36px;
  max-width: 420px;
}
.field {
  display: block;
  margin-bottom: 16px;
}
.field .flbl {
  display: block;
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  font-family: var(--sans); font-size: 15px;
  color: var(--ink);
  background: #FBF9F3;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.field input:focus { border-color: var(--ink); background: #fff; }
.login-form-pane .row {
  display: flex; justify-content: space-between; align-items: center;
  margin: 4px 0 28px;
  font-size: 13px; color: var(--muted);
}
.login-form-pane .row a { text-decoration: underline; text-underline-offset: 3px; }
.login-form-pane .sub-link {
  margin-top: 28px;
  font-size: 13px; color: var(--muted);
  padding-top: 20px;
  border-top: 1px solid var(--line-2);
}
.login-form-pane .sub-link a { color: var(--ink); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }

.login-form-pane .btn.primary { height: 44px; padding: 0 18px; font-size: 14px; width: 100%; justify-content: center; }

/* ---------- App shell (sidebar + main col) -------------------------- */
.app-shell {
  min-height: 100vh;
  display: flex; flex-direction: row;
  align-items: stretch;
}
.main-col {
  flex: 1;
  min-width: 0;  /* allow flex child to shrink below content width */
  display: flex; flex-direction: column;
}
.app-main {
  flex: 1;
  padding: 28px 32px 48px;
  max-width: 1480px; width: 100%; margin: 0 auto;
}

/* ---------- Sidebar ------------------------------------------------- */
.sidebar {
  width: 232px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  background: #F7F4EE;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 20px 0 10px;
}
.sb-brand {
  padding: 0 20px 18px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line-2);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  line-height: 0;
}
.sb-brand:hover { opacity: 0.85; }
.sb-brand-img {
  width: 140px;
  height: auto;
  display: block;
}
.sb-brand-sub {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-2);
  white-space: nowrap;
  line-height: 1;
}
.sb-section-label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted-2);
  padding: 14px 20px 6px;
}
.sb-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0 10px;
}
.sb-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: none;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  font-family: var(--sans);
  text-align: left;
  border-radius: var(--radius-sm);
  transition: background 0.12s, color 0.12s;
  cursor: pointer;
}
.sb-item:hover { background: var(--bone-2); }
.sb-item.active {
  background: var(--bone-3);
  color: var(--ink);
  font-weight: 500;
}
.sb-item .sb-ico {
  width: 18px;
  height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted);
  flex-shrink: 0;
}
.sb-item.active .sb-ico { color: var(--signal); }
.sb-item .sb-label { flex: 1; }
.sb-item .sb-ndot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}

.sb-pipeline {
  margin-top: auto;
  padding: 14px 20px 12px;
  border-top: 1px solid var(--line-2);
}
.sb-pipeline-total {
  display: flex; justify-content: space-between; align-items: baseline;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.sb-pipeline-total b {
  color: var(--ink);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.01em;
  font-family: var(--sans);
  text-transform: none;
  font-variant-numeric: tabular-nums;
}
.sb-pipeline-rows {
  display: flex; flex-direction: column; gap: 5px;
}
.sb-pipeline-row {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.sb-pipeline-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  opacity: 0.9;
}
.sb-pipeline-label { flex: 1; }
.sb-pipeline-n {
  color: var(--ink);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.sb-bottom {
  padding: 12px 14px 4px;
  border-top: 1px solid var(--line-2);
  display: flex; flex-direction: column; gap: 8px;
}
.sb-lead-btn {
  height: 36px;
  background: var(--signal);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--sans);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.15s;
}
.sb-lead-btn:hover { background: var(--signal-ink); }
.sb-tommy,
.sb-signout {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  height: 32px;
  padding: 0 10px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
  transition: background 0.12s;
  text-align: left;
}
.sb-tommy:hover,
.sb-signout:hover { background: var(--bone-2); }
.sb-tommy-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--muted-2);
  transition: background 0.15s;
}
.sb-tommy.on .sb-tommy-dot { background: var(--green); }
.sb-tommy-label { flex: 1; }
.sb-tommy-toggle-word {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-2);
  border: 1px solid var(--line);
  padding: 2px 6px;
  border-radius: 3px;
}
.sb-signout-ico {
  color: var(--muted);
  width: 18px;
  height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* ---------- Lead registration modal --------------------------------- */
.lead-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(14, 14, 12, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 80;
  animation: leadModalFade 0.15s ease-out;
}
@keyframes leadModalFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.lead-modal-card {
  width: 440px;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  background: #FBF9F3;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow:
    0 24px 60px -12px rgba(14,14,12,0.35),
    0 4px 12px rgba(14,14,12,0.08);
  animation: leadModalRise 0.18s cubic-bezier(.2,.9,.3,1.05);
}
@keyframes leadModalRise {
  from { transform: translateY(6px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.lead-modal-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line-2);
}
.lead-modal-title {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}
.lead-modal-close {
  background: transparent;
  border: none;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
  padding: 0 4px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.12s, color 0.12s;
}
.lead-modal-close:hover { background: var(--bone-2); color: var(--ink); }
.lead-modal-close:disabled { opacity: 0.4; cursor: not-allowed; }
.lead-modal-bd {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}
.lead-modal-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.lead-modal-lbl {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.lead-modal-lbl .req { color: var(--signal); margin-left: 2px; }
.lead-modal-field input,
.lead-modal-field select,
.lead-modal-field textarea {
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  padding: 8px 10px;
  background: var(--bone);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.12s, background 0.12s;
}
.lead-modal-field textarea { resize: vertical; min-height: 60px; }
.lead-modal-field input:focus,
.lead-modal-field select:focus,
.lead-modal-field textarea:focus {
  border-color: var(--signal);
  background: #fff;
}
.lead-modal-field input:disabled,
.lead-modal-field select:disabled,
.lead-modal-field textarea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.lead-modal-err {
  font-size: 13px;
  color: var(--signal-ink);
  background: var(--signal-soft);
  border: 1px solid var(--signal);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.lead-modal-ft {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--line-2);
  background: #F7F4EE;
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
}

/* ---------- Settings page ------------------------------------------ */
.settings-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 20px;
  align-items: flex-start;
}
.settings-nav {
  position: sticky;
  top: 64px;
  display: flex; flex-direction: column;
  gap: 2px;
  background: #FBF9F3;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px;
}
.settings-tab {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border: none;
  background: transparent;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.settings-tab:hover { background: var(--bone-2); color: var(--ink-2); }
.settings-tab.active { background: var(--ink); color: var(--bone); }
.settings-tab.active .settings-tab-ico { color: var(--signal); }
.settings-tab-ico {
  width: 16px;
  display: inline-flex; justify-content: center;
  font-size: 12px;
  color: var(--muted-2);
}

.settings-content {
  display: flex; flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.settings-card {
  background: #FBF9F3;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
}
.settings-card.danger { border-color: rgba(254,59,31,0.2); }
.settings-card-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 14px;
}
.settings-card-hd {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.settings-card-hd .settings-card-label { margin-bottom: 0; }
.settings-muted { color: var(--muted); font-size: 12px; font-family: var(--mono); letter-spacing: 0.04em; }
.settings-mono-inline { font-family: var(--mono); font-size: 11px; color: var(--ink-2); background: var(--bone-2); padding: 1px 5px; border-radius: 3px; }
.settings-cap { text-transform: capitalize; }
.settings-mono { font-family: var(--mono); font-size: 13px; letter-spacing: 0.01em; }

.settings-field {
  padding: 10px 0;
  border-bottom: 1px solid var(--line-2);
}
.settings-field:last-of-type { border-bottom: none; }
.settings-field-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 4px;
}
.settings-field-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.settings-field-value {
  font-size: 14px;
  color: var(--ink);
  font-weight: 500;
  letter-spacing: -0.005em;
}
.settings-input {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  font-family: var(--sans);
  font-size: 14px;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--ink);
  border-radius: var(--radius-sm);
  outline: none;
}
.settings-edit-btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 11px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.12s;
}
.settings-edit-btn:hover { background: var(--bone-2); color: var(--ink); }
.settings-active-badge {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--green);
}
.settings-pills {
  display: flex; flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.settings-pill {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--bone-2);
  border: 1px solid var(--line);
  padding: 4px 10px;
  border-radius: 999px;
}

.settings-danger-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-2);
}
.settings-danger-row:last-child { border-bottom: none; }
.settings-danger-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}
.settings-danger-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.settings-card.danger .btn.danger {
  border: 1px solid var(--warn);
  color: var(--warn);
  background: transparent;
}
.settings-card.danger .btn.danger:hover { background: var(--warn-soft); }

.settings-table-wrap {
  margin: 4px -22px -20px;
  border-top: 1px solid var(--line-2);
}
.settings-role-pill {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 10px;
  color: var(--muted);
  background: var(--bone-2);
}
.settings-role-pill.admin { color: var(--signal-ink); background: var(--signal-soft); }
.settings-role-select {
  height: 24px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  outline: none;
  text-transform: lowercase;
}
.settings-role-select:focus { border-color: var(--ink); }

.settings-empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--muted-2);
  font-size: 13px;
}

.settings-integ-list {
  display: flex; flex-direction: column;
  margin: 0 -22px -20px;
  border-top: 1px solid var(--line-2);
}
.settings-integ-row {
  display: grid;
  grid-template-columns: 24px 1fr 220px 110px;
  gap: 14px;
  align-items: center;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line-2);
}
.settings-integ-row:last-child { border-bottom: none; }
.settings-integ-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--muted-2);
  box-shadow: 0 0 0 4px var(--bone-2);
}
.settings-integ-dot.ok   { background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.settings-integ-dot.down { background: var(--warn);  box-shadow: 0 0 0 4px var(--warn-soft); }
.settings-integ-dot.planned { background: var(--muted-2); }
.settings-integ-body { min-width: 0; }
.settings-integ-name { font-weight: 500; font-size: 14px; }
.settings-integ-detail { font-size: 12px; color: var(--muted); margin-top: 2px; }
.settings-integ-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}
.settings-status-pill {
  justify-self: end;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 10px;
}
.settings-status-pill.ok      { color: var(--green);     background: var(--green-soft); }
.settings-status-pill.down    { color: var(--warn);      background: var(--warn-soft); }
.settings-status-pill.planned { color: var(--muted);     background: var(--bone-2); }

.settings-cfg-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px 24px;
}
.settings-cfg-grid > div { padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.settings-cfg-grid > div:nth-last-child(-n+2) { border-bottom: none; }
.settings-cfg-grid .settings-field-label { margin-bottom: 4px; }
.settings-triggers {
  margin: 6px 0 0;
  padding: 0 0 0 18px;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.7;
}

.settings-jobs-list {
  display: flex; flex-direction: column;
  margin: 0 -22px -20px;
  border-top: 1px solid var(--line-2);
}
.settings-job-row {
  display: grid;
  grid-template-columns: 1fr 180px 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px 22px;
  border-bottom: 1px solid var(--line-2);
  font-size: 13px;
}
.settings-job-row:last-child { border-bottom: none; }
.settings-job-name { font-weight: 500; }
.settings-job-cadence {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.settings-job-detail {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted-2);
  text-align: right;
}

.settings-pref-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-2);
}
.settings-pref-row:last-of-type { border-bottom: none; }
.settings-pref-label { font-weight: 500; font-size: 14px; }
.settings-pref-desc  { font-size: 12px; color: var(--muted); margin-top: 2px; }
.settings-pref-foot  {
  padding-top: 12px;
  font-size: 11px; color: var(--muted-2);
  font-family: var(--mono);
  letter-spacing: 0.04em;
}

.settings-toggle {
  width: 40px; height: 22px;
  border-radius: 12px;
  background: var(--bone-3);
  border: none; padding: 0;
  position: relative;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}
.settings-toggle.on { background: var(--ink); }
.settings-toggle[disabled] { opacity: 0.5; cursor: not-allowed; }
.settings-toggle-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
  transition: left 0.15s, background 0.15s;
}
.settings-toggle.on .settings-toggle-thumb { left: 20px; background: var(--bone); }
.page-hd {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-bottom: 24px;
}
.page-hd h1 {
  margin: 0;
  font-weight: 700;
  font-size: 34px;
  letter-spacing: -0.025em;
}
.page-hd .sub {
  color: var(--muted); font-size: 14px; margin-top: 4px;
  white-space: nowrap;
}
.kpi .kpi-foot span { white-space: nowrap; }
.page-hd .actions { display: flex; gap: 8px; }

.period-pill-row {
  display: flex;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.month-pick-pop {
  position: fixed;
  min-width: 160px;
  max-height: 280px;
  overflow-y: auto;
  background: #FBF9F3;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow:
    0 12px 28px -8px rgba(14,14,12,0.22),
    0 2px 4px rgba(14,14,12,0.05);
  z-index: 50;
  padding: 4px 0;
}
.month-pick-item {
  display: block;
  width: 100%;
  padding: 6px 12px;
  border: none;
  background: transparent;
  text-align: left;
  font: inherit;
  color: var(--ink-2);
  cursor: pointer;
  font-size: 13px;
}
.month-pick-item:hover { background: var(--bone-2); }
.month-pick-item.selected {
  background: var(--ink);
  color: var(--bone);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.kpi {
  background: #FBF9F3;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px 16px;
  position: relative;
  overflow: hidden;
}
.kpi .kpi-label {
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted-2);
}
.kpi .kpi-value {
  margin-top: 10px;
  font-weight: 700;
  font-size: 40px;
  letter-spacing: -0.035em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.kpi .kpi-foot {
  margin-top: 10px;
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; color: var(--muted);
}
.kpi .delta {
  font-family: var(--mono);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: 0.02em;
}
.kpi .delta.up   { color: var(--green); background: var(--green-soft); }
.kpi .delta.down { color: var(--warn);  background: var(--warn-soft); }
.kpi .spark {
  position: absolute;
  right: 12px; top: 14px;
  width: 96px; height: 32px;
}

.home-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 16px;
}
.home-grid .col { display: flex; flex-direction: column; gap: 16px; }

/* follow-ups */
.fup-row {
  display: grid;
  grid-template-columns: 64px 1fr 140px 160px 80px;
  gap: 12px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-2);
  cursor: pointer;
  transition: background 0.12s;
}
.fup-row:hover { background: var(--bone-2); }
.fup-row:last-child { border-bottom: none; }
.fup-time {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.fup-time b { color: var(--ink); font-weight: 500; display: block; font-size: 14px; letter-spacing: -0.01em; font-family: var(--sans); }
.fup-name { font-weight: 500; font-size: 14px; }
.fup-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* tommy module */
.tommy-card { background: #FBF9F3; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tommy-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-2);
  display: flex; justify-content: space-between; align-items: center;
}
.tommy-head .title {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted);
}
.tommy-head .title b { color: var(--ink); font-weight: 500; }
.tommy-head .pending-count {
  font-family: var(--mono); font-size: 10px;
  padding: 1px 6px;
  background: var(--warn-soft); color: var(--warn);
  border-radius: 4px;
}
.approval {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line-2);
}
.approval:last-child { border-bottom: none; }
.approval .a-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px;
}
.approval .a-name { font-weight: 500; font-size: 14px; }
.approval .a-reason { font-size: 12px; color: var(--muted); margin-top: 1px; }
.approval .a-draft {
  background: var(--bone-2);
  border-left: 2px solid var(--signal);
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 12px;
  overflow-wrap: anywhere;
  word-break: break-word;
}
/* Inbound bubble + Tommy draft bubble in /tommy view + any inline message
   bubble carrying user-supplied text. Without overflow-wrap a long URL
   (e.g. booking link) makes the row wider than the viewport and drags
   sibling cards along. */
.msg-bubble {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.approval .a-actions {
  display: flex; gap: 6px; align-items: center;
}
.approval .a-meta { flex: 1; font-size: 11px; color: var(--muted); font-family: var(--mono); letter-spacing: 0.04em; }

/* tommy approval row (pending approvals list) */
.tommy-approval-row {
  padding: 20px 24px;
  border-bottom: 1px solid var(--line-2);
  display: grid;
  grid-template-columns: 220px 1fr 300px;
  gap: 24px;
}
.tommy-approval-row:last-child { border-bottom: none; }
.tommy-approval-row .tar-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.tommy-approval-row .tar-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
  line-height: 1.7;
}
.tommy-approval-row .tar-meta > div {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tommy-approval-row .tar-actions {
  display: flex;
  gap: 6px;
  margin-top: auto;
  flex-wrap: wrap;
}

/* activity */
.act-row {
  display: grid;
  grid-template-columns: 54px 1fr 60px;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line-2);
  font-size: 13px;
}
.act-row:last-child { border-bottom: none; }
.act-row .act-ico {
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted-2);
  padding-top: 2px;
}
.act-row .act-body b { font-weight: 500; }
.act-row .act-body .det { color: var(--muted); }
.act-row .act-t {
  font-family: var(--mono); font-size: 11px;
  color: var(--muted);
  text-align: right;
}

/* ---------- Leads list --------------------------------------------- */
.leads-toolbar {
  display: flex; gap: 8px; align-items: center;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  background: #F7F4EE;
}
.leads-toolbar .flt {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bone);
  font-size: 12px;
  color: var(--ink);
  cursor: pointer;
}
.leads-toolbar .flt.active { background: var(--ink); color: var(--bone); border-color: var(--ink); }
.leads-toolbar .flt .cnt { font-family: var(--mono); font-size: 10px; opacity: 0.7; }
.leads-toolbar .spacer { flex: 1; }
.leads-toolbar .mono-meta { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: 0.04em; }

.leads-table-wrap {
  border: 1px solid var(--line);
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
  background: #FBF9F3;
}
.leads-table-wrap .tbl th:first-child, .leads-table-wrap .tbl td:first-child { padding-left: 20px; }

/* Mobile leads cards (substitute for the 7-col table at <=480px). The
   JSX-side useMediaQuery picks which one to render so we don't ship
   both DOMs to the browser. Card columns: 32px avatar | content | 50px
   right-aligned activity time. Avatar + content + time fit 360-450px
   without horizontal scroll. */
.leads-cards {
  border: 1px solid var(--line);
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
  background: #FBF9F3;
}
.lead-card {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-2);
  align-items: flex-start;
  cursor: pointer;
}
.lead-card:last-child { border-bottom: none; }
.lead-card:active { background: var(--bone-2); }
.lead-card .lc-avatar {
  width: 32px; height: 32px;
  font-size: 11px;
  background: var(--bone-3);
  color: var(--ink);
}
.lead-card .lc-body { min-width: 0; }
.lead-card .lc-top {
  display: flex; align-items: baseline; gap: 8px;
  min-width: 0;
}
.lead-card .lc-name {
  font-weight: 500; font-size: 14px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  min-width: 0; flex: 1 1 auto;
}
.lead-card .lc-hot {
  color: var(--warn);
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.08em;
  flex: 0 0 auto;
}
.lead-card .lc-phone {
  font-family: var(--mono); font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lead-card .lc-meta {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 8px;
  align-items: center;
}
.lead-card .lc-meta .chip { white-space: nowrap; }
.lead-card .lc-sched,
.lead-card .lc-source {
  font-family: var(--mono); font-size: 10px;
  color: var(--muted); letter-spacing: 0.04em;
}
.lead-card .lc-time {
  font-family: var(--mono); font-size: 11px;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
  align-self: flex-start;
  padding-top: 4px;
}

/* ---------- Lead detail -------------------------------------------- */
.lead-detail {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 16px;
  min-height: calc(100vh - 48px - 76px);
}
.lead-conv {
  background: #FBF9F3;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.lead-conv .conv-hd {
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
}
.lead-conv .conv-hd .l { display: flex; align-items: center; gap: 14px; }
.lead-conv .conv-hd .name-blk .n { font-weight: 600; font-size: 18px; letter-spacing: -0.01em; }
.lead-conv .conv-hd .name-blk .ph { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 2px; letter-spacing: 0.02em; }
.lead-conv .conv-hd .actions { display: flex; gap: 6px; }

.conv-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 8px;
  display: flex; flex-direction: column; gap: 10px;
}
.msg {
  max-width: 72%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  position: relative;
}
.msg .msg-t {
  font-family: var(--mono); font-size: 10px;
  color: var(--muted-2); letter-spacing: 0.04em;
  margin-top: 4px;
}
.msg.them {
  align-self: flex-start;
  background: var(--bone-2);
  color: var(--ink);
  border-bottom-left-radius: 4px;
}
.msg.tommy, .msg.staff {
  align-self: flex-end;
  background: var(--ink);
  color: var(--bone);
  border-bottom-right-radius: 4px;
}
.msg.tommy .msg-t { color: rgba(242,239,232,0.5); }
.msg.staff .msg-t { color: rgba(242,239,232,0.5); }
.msg .msg-from {
  font-family: var(--mono); font-size: 9px;
  letter-spacing: 0.18em; text-transform: uppercase;
  margin-bottom: 4px;
  opacity: 0.6;
}

.draft-box {
  border-top: 1px solid var(--line);
  padding: 14px 18px;
  background: #F7F4EE;
  display: flex; flex-direction: column; gap: 10px;
}
.draft-box .draft-lbl {
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted);
  display: flex; align-items: center; gap: 10px;
}
.draft-box .draft-lbl .tag {
  color: var(--warn); background: var(--warn-soft);
  padding: 1px 6px; border-radius: 4px;
}
.draft-box .draft-text {
  background: var(--bone);
  border: 1px solid var(--line);
  border-left: 2px solid var(--signal);
  padding: 12px 14px;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1.5;
}
.draft-box .draft-actions {
  display: flex; gap: 6px;
}
.draft-box .draft-actions .meta { flex: 1; font-size: 11px; color: var(--muted); font-family: var(--mono); letter-spacing: 0.04em; display: flex; align-items: center; }

/* side panel */
.lead-side { display: flex; flex-direction: column; gap: 16px; }
.side-card {
  background: #FBF9F3;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.side-card .sc-hd {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-2);
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted);
}
.side-card .sc-bd { padding: 14px 16px; }
.side-card .kv {
  display: grid; grid-template-columns: 90px 1fr;
  gap: 10px;
  padding: 6px 0;
  font-size: 13px;
}
.side-card .kv .k {
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted-2);
  padding-top: 2px;
}
.side-card .kv .v { color: var(--ink); }

/* empty */
.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* Scrollbar polish */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(14,14,12,0.14); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(14,14,12,0.24); border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Mobile -------------------------------------------------- */
/* Adds hard 768px / 480px breakpoints, a modal-shadow drawer,
   reduced-motion support, and 44px touch targets. */
.mobile-nav-btn,
.mobile-rail-brand,
.mobile-scrim,
.mobile-nav-close {
  display: none;
}

@media (max-width: 768px) {
  /* `overflow-x: clip` is the modern equivalent of `hidden` but does NOT
     create a scroll container, so descendants with `position: sticky`
     (like .rail) keep working on Safari iOS. Switching from `hidden`
     restores the sticky top header on phones. Available iOS 16+/Chromium 90+. */
  html, body { width: 100%; overflow-x: clip; }

  .login-root {
    min-height: 100dvh;
    grid-template-columns: 1fr;
    background: var(--bone);
  }
  .login-poster { display: none; }
  .login-form-pane {
    min-height: 100dvh;
    max-width: 560px;
    padding: 40px 28px 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  /* The poster (and its logo) is hidden on phones — surface a compact
     wordmark inside the form pane so users still see the brand. */
  .login-form-mark {
    display: block;
    width: 100%;
    max-width: 200px;
    margin: 0 0 28px;
  }
  .login-form-mark img { display: block; width: 100%; height: auto; }

  .app-shell { display: block; min-width: 0; }
  .main-col,
  .app-main { width: 100%; min-width: 0; }
  .app-main {
    padding: 20px 16px 36px;
    overflow-x: hidden;
  }

  /* ---------- Mobile rail ------------------------------------------- */
  .rail { height: 52px; }
  .rail-inner { padding: 0 14px; gap: 10px; }
  .mobile-nav-btn,
  .mobile-rail-brand,
  .bell-btn {
    min-width: 44px;
    min-height: 44px;
    flex: 0 0 44px;
  }
  .mobile-nav-btn,
  .mobile-rail-brand {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 12px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--ink-2);
    transition: background 0.12s, border-color 0.12s, color 0.12s;
  }
  .mobile-nav-btn:hover,
  .mobile-nav-btn:focus-visible,
  .mobile-rail-brand:hover,
  .mobile-rail-brand:focus-visible {
    background: var(--bone-2);
    border-color: var(--line);
  }
  .mobile-nav-btn { flex-direction: column; gap: 4px; }
  .mobile-nav-btn span {
    display: block;
    width: 18px;
    height: 1px;
    background: currentColor;
  }
  .mobile-rail-brand img { width: 22px; height: 22px; display: block; }
  .rail .crumbs {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
  }
  .rail .crumbs span:not(:last-child),
  .rail .search-pill,
  .rail .user-chip { display: none; }
  .rail .crumbs b { overflow: hidden; text-overflow: ellipsis; }
  .bell-dropdown {
    position: fixed;
    top: 58px;
    right: 12px;
    left: 12px;
    width: auto;
    max-width: none;
  }

  /* ---------- Mobile drawer ----------------------------------------- */
  .mobile-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 70;
    background: var(--ink-2);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
  }
  .mobile-scrim.open { opacity: 0.42; pointer-events: auto; }
  .sidebar {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    z-index: 80;
    width: 288px;
    max-width: calc(100vw - 56px);
    height: 100dvh;
    padding-top: 20px;
    border-right: 1px solid var(--line);
    box-shadow: 0 28px 60px -20px rgba(14,14,12,0.35);
    transform: translateX(-100%);
    transition: transform 0.15s ease;
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .mobile-nav-close {
    display: inline-flex; align-items: center; justify-content: center;
    position: absolute;
    top: 10px;
    right: 10px;
    min-width: 44px;
    min-height: 44px;
    padding: 12px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--ink-2);
    transition: background 0.12s, border-color 0.12s, color 0.12s;
  }
  .mobile-nav-close:hover,
  .mobile-nav-close:focus-visible {
    background: var(--bone-2);
    border-color: var(--line);
  }
  .mobile-nav-close span {
    position: absolute;
    width: 18px;
    height: 1px;
    background: currentColor;
  }
  .mobile-nav-close span:first-child { transform: rotate(45deg); }
  .mobile-nav-close span:last-child { transform: rotate(-45deg); }
  .sb-brand { min-height: 76px; padding-right: 62px; }
  .sb-item,
  .sb-lead-btn,
  .sb-tommy,
  .sb-signout { min-height: 44px; }

  /* ---------- Mobile layout ----------------------------------------- */
  .page-hd,
  .card .hd,
  .tommy-head,
  .lead-conv .conv-hd,
  .settings-card-hd {
    align-items: stretch;
    flex-direction: column;
  }
  .page-hd { gap: 16px; margin-bottom: 18px; }
  .page-hd h1 { font-size: 30px; line-height: 1.08; }
  .page-hd .sub { white-space: normal; }
  /* ⌘K is desktop-only — touch keyboards have no command key. */
  .quick-jump-btn { display: none; }
  .page-hd .actions,
  .card .hd .aside,
  .lead-conv .conv-hd .actions,
  .cmd-foot { flex-wrap: wrap; }
  .page-hd .actions > .btn,
  .page-hd .actions > div,
  .btn.primary,
  .period-pill-row .btn,
  .approval .a-actions .btn,
  .draft-box .draft-actions .btn,
  .lead-conv .conv-hd .btn { min-height: 44px; }
  .period-pill-row {
    flex-wrap: wrap;
    overflow: visible;
    border-radius: var(--radius-sm);
  }
  .period-pill-row .btn { flex: 1 0 auto; }
  .month-pick-pop { max-width: calc(100vw - 32px); }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .kpi { padding: 16px; }
  .kpi .kpi-value { font-size: 34px; }
  .kpi .spark {
    position: static;
    width: 100%;
    margin-top: 10px;
  }
  .home-grid,
  .lead-detail,
  .settings-grid,
  .settings-cfg-grid,
  .app-main > div[style*="display: grid"] { grid-template-columns: 1fr !important; }

  .fup-row,
  .act-row,
  .side-card .kv,
  .settings-integ-row,
  .settings-job-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .fup-time b,
  .act-row .act-t,
  .settings-integ-status,
  .settings-status-pill,
  .settings-job-detail {
    display: inline;
    justify-self: start;
    text-align: left;
  }
  .approval .a-head,
  .approval .a-actions,
  .settings-danger-row,
  .settings-pref-row,
  .draft-box .draft-actions {
    align-items: stretch;
    flex-direction: column;
  }
  /* settings-field-row stays inline on phones — its only contents are a
     short label + a small inline action (Edit pill, Active badge). The
     column-stretch above used to inflate that pill into a full-width
     button that dominated the field and stole visual weight from the
     actual value below. */
  .settings-field-row {
    align-items: center;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }
  /* Approval action grid: Open/Dismiss share a row, Reject is solo to avoid
     mistap, Approve is full-width primary at the bottom. Mirrors the
     .tar-actions pattern from the dedicated /tommy view. The display: grid
     here overrides the flex column-stretch above (last rule wins). */
  .approval .a-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    align-items: stretch;
  }
  .approval .a-actions .a-meta {
    grid-column: 1 / -1;
    text-align: left;
  }
  .approval .a-actions .btn { min-height: 44px; justify-content: center; }
  .approval .a-actions .btn:nth-of-type(3) { grid-column: 1 / -1; } /* Reject */
  .approval .a-actions .btn.primary {
    grid-column: 1 / -1;
    order: 99;
    min-height: 48px;
  }
  .approval .a-actions .btn,
  .draft-box .draft-actions .btn,
  .lead-conv .conv-hd .btn { justify-content: center; }
  .draft-box .draft-actions .meta { flex: none; }

  /* ---------- Mobile tables ----------------------------------------- */
  .tbl-wrap,
  .leads-table-wrap,
  .settings-table-wrap,
  .card .bd.p0 {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .tbl { min-width: 680px; }
  .leads-table-wrap .tbl th:first-child,
  .leads-table-wrap .tbl td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--bone);
    box-shadow: 1px 0 0 var(--line);
  }
  .leads-table-wrap .tbl th:first-child {
    z-index: 3;
    background: var(--bone-2);
  }
  .leads-toolbar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
  }
  .leads-toolbar .spacer { display: none; }
  .leads-toolbar .flt { min-height: 44px; }
  .leads-toolbar input {
    flex: 1 0 100%;
    min-width: 0 !important;
    height: 44px !important;
  }
  .leads-toolbar .mono-meta { width: 100%; }

  /* ---------- Mobile detail surfaces -------------------------------- */
  .tommy-approval-row {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 16px;
  }
  .tommy-approval-row .tar-meta > div { white-space: normal; }
  /* Approval action grid: 2x2 explicit grid for predictable layout. */
  .tommy-approval-row .tar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  .tommy-approval-row .tar-actions .btn {
    min-height: 44px;
    justify-content: center;
  }
  /* Approve is the primary action. Full-width row at the bottom. */
  .tommy-approval-row .tar-actions .btn.primary {
    grid-column: 1 / -1;
    order: 99;
    min-height: 48px;
  }
  /* Reject is destructive. Full-width to avoid mistaps on phone. */
  .tommy-approval-row .tar-actions .btn:nth-child(3) {
    grid-column: 1 / -1;
  }
  .lead-conv { min-height: calc(100dvh - 120px); }
  .lead-conv .conv-hd .l { align-items: flex-start; }
  .conv-scroll { padding: 16px; }
  .msg { max-width: 92%; }
  .lead-side { min-width: 0; }
  .lead-modal-backdrop {
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
  }
  .lead-modal-card {
    width: 100%;
    max-width: none;
    max-height: none;
    height: 100dvh;
    border: none;
    border-radius: 0;
    box-shadow: none;
  }
  .lead-modal-hd,
  .lead-modal-ft {
    padding-left: 16px;
    padding-right: 16px;
  }
  .lead-modal-bd { flex: 1; padding: 16px; }
  .lead-modal-close,
  .lead-modal-field input,
  .lead-modal-field select,
  .lead-modal-ft .btn { min-height: 44px; }
  .lead-modal-close { min-width: 44px; }
  .lead-modal-field textarea { min-height: 88px; }
  .lead-modal-ft {
    align-items: stretch;
    flex-direction: column-reverse;
    border-radius: 0;
  }
  .lead-modal-ft .btn { justify-content: center; }

  /* ---------- Mobile settings and overlays -------------------------- */
  .settings-nav {
    position: static;
    overflow-x: auto;
    flex-direction: row;
  }
  .settings-tab { min-height: 44px; flex: 0 0 auto; }
  .settings-card { padding: 18px 16px; }
  .settings-table-wrap,
  .settings-integ-list,
  .settings-jobs-list {
    margin-left: -16px;
    margin-right: -16px;
  }
  .cmd-scrim { padding: 64px 12px 12px; }
  .cmd {
    max-width: none;
    width: 100%;
    border-radius: var(--radius);
  }
  .app-main > div[style*="display: flex"] { flex-wrap: wrap !important; }
  .app-main > div[style*="display: flex"] > div { min-width: min(100%, 220px); }
  .app-main > div[style*="overflow: hidden"] {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  .app-main > div[style*="overflow: hidden"] > div { min-width: 760px; }
  .card .bd > div[style*="grid-template-columns: 180px"] {
    grid-template-columns: 1fr !important;
    gap: 6px !important;
  }
  .card .bd > div[style*="grid-template-columns: 180px"] span { text-align: left !important; }
}

@media (max-width: 480px) {
  .login-form-pane { padding: 28px 20px 40px; }
  .login-form-pane h1 { font-size: 30px; }
  .app-main { padding: 18px 12px 32px; }
  .rail-inner { padding: 0 8px; gap: 8px; }
  .rail .crumbs { font-size: 10px; }
  .bell-dropdown { left: 8px; right: 8px; }
  .sidebar {
    width: 304px;
    max-width: calc(100vw - 32px);
  }
  .page-hd h1 { font-size: 28px; }
  /* Segmented controls and secondary actions stay inline; only the primary
     CTA forces its own full-width line via flex-basis: 100%. Old rule made
     every button full-width which stacked 7d/30d/90d into 3 rows. */
  .page-hd .actions > .btn,
  .page-hd .actions > div { width: auto; }
  .page-hd .actions .btn.primary { flex: 1 0 100%; }
  .period-pill-row { width: 100%; }
  .page-hd .actions .btn,
  .leads-toolbar .flt { justify-content: center; }
  .kpi .kpi-value { font-size: 32px; }
  .card .bd,
  .lead-modal-bd,
  .lead-conv .conv-hd,
  .draft-box { padding: 14px; }
  .card .hd,
  .tommy-head { padding: 14px; }
  .leads-toolbar .flt { flex: 1 0 auto; }
  .msg { max-width: 100%; }
  .settings-card { padding: 16px 14px; }
  .settings-table-wrap,
  .settings-integ-list,
  .settings-jobs-list {
    margin-left: -14px;
    margin-right: -14px;
  }
}

@media (prefers-reduced-motion: reduce) and (max-width: 768px) {
  .sidebar, .mobile-scrim, .mobile-nav-btn { transition: none; }
}
