/* =========================================================================
   views/lead-drawer.css — Lead detail drawer + call recording (recorder / player / transcript)
   Split from the old monolithic styles/views.css. LOAD ORDER MATTERS:
   the <link> order in Magnet CRM.html / Client App.html reproduces the
   original file order, so the cascade is unchanged — add new rules to the
   matching feature file, not the end of the list.
   ========================================================================= */
/* ============================ LEAD DETAIL DRAWER ====================== */
.drawer-scrim {
  position: absolute; inset: 0; z-index: var(--z-toolbar);
  background: rgba(27, 27, 35, 0.28);
  opacity: 0; transition: opacity var(--motion-overlay) var(--ease-enter);
}
.drawer-scrim.show { opacity: 1; }
/* Opened from inside a modal (the client leads list): the list stays behind the
   sheet, so scrim + drawer have to clear the modal's own layer — otherwise the
   dim slides UNDER the modal and the list sits bright on top of its own sheet.
   drawerShell adds .over-modal only when a modal is actually open. */
.drawer-scrim.over-modal { z-index: calc(var(--z-popover) + 10); }
.drawer.over-modal { z-index: calc(var(--z-popover) + 11); }
.drawer {
  position: absolute; top: 0; right: 0; height: 100%; z-index: var(--z-popover);
  --dw-w: clamp(420px, 34vw, 520px);   /* resting (lead-detail) width */
  width: var(--dw-w); max-width: 100%;
  background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: -18px 0 48px rgba(27, 27, 35, 0.14);
  transform: translateX(100%); transition: transform var(--dur-slow) var(--ease), width var(--dur-slow) var(--ease);
  display: flex; flex-direction: column; min-height: 0;
}
.drawer.show { transform: translateX(0); }

/* ===== Record-call: drawer split + recorder / player / transcript panel =====
   The lead detail is wrapped in .drawer-main; .rec-panel is a hidden sibling that
   appears (and widens the drawer into two columns) only on desktop when recording
   or viewing a recording. Default + mobile layouts are unchanged (.drawer-main
   simply fills the column drawer). */
.drawer-main { flex: 1; display: flex; flex-direction: column; min-height: 0; min-width: 0; position: relative; }
.rec-panel { display: none; background: var(--surface); }
@media (min-width: 641px) {
  /* widen into the split view — same width transition both directions (close = reverse) */
  .drawer.recording, .drawer.tx-open { width: min(82%, 1180px); flex-direction: row; }
  .drawer.recording .drawer-main, .drawer.tx-open .drawer-main { flex: 0 0 var(--dw-w); border-right: 1px solid var(--border); }
  .drawer.recording .rec-panel, .drawer.tx-open .rec-panel { display: flex; flex-direction: column; flex: 1 1 0; min-width: 0; min-height: 0; }
}
/* inner panel enter animations — fade + nudge over the same curve/duration as the widen */
.drawer-rec { opacity: 0; transform: scale(0.99); pointer-events: none; transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease); }
.drawer.recording .drawer-rec { opacity: 1; transform: none; pointer-events: auto; }
.drawer-tx { flex: 1; min-height: 0; display: flex; flex-direction: column; opacity: 0; transform: translateX(12px); pointer-events: none; transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease); }
.drawer.tx-open .drawer-tx { opacity: 1; transform: none; pointer-events: auto; }
.rec-canvas { width: 100%; max-width: 460px; height: 120px; display: block; }

/* global "recording in progress" mini-bar — fixed, persists across the whole app
   while a session is active. Hidden while the drawer's full recorder is open. */
.rec-minibar {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 1200; display: flex; align-items: center; gap: var(--space-3);
  padding: 8px 8px 8px var(--space-4); border-radius: var(--radius-full);
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: 0 12px 32px rgba(27, 27, 35, 0.20);
  cursor: pointer;   /* click anywhere (except Stop) reopens the lead */
}
@media (hover: hover) and (pointer: fine) { .rec-minibar:hover { box-shadow: 0 16px 40px rgba(27, 27, 35, 0.26); } }
.rec-mini-canvas { width: 56px; height: 26px; display: block; flex-shrink: 0; }
.rec-mini-meta { display: flex; flex-direction: column; line-height: 1.2; }
.rec-mini-title { font-size: var(--text-sm); font-weight: var(--fw-semibold); color: var(--text-strong); white-space: nowrap; }
.rec-mini-sub { font-size: var(--text-2xs); color: var(--text-soft); white-space: nowrap; }
.rec-mini-time { font-size: var(--text-sm); font-weight: var(--fw-bold); color: var(--text-strong); font-variant-numeric: tabular-nums; margin-left: var(--space-1); }
.rec-mini-stop { height: 38px; border-radius: var(--radius-full); flex-shrink: 0; }

/* live recorder */
.rec-live { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-5); padding: var(--space-8); text-align: center; }
.rec-status { display: inline-flex; align-items: center; gap: 8px; font-size: var(--text-sm); font-weight: var(--fw-semibold); color: var(--text-strong); }
.rec-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--danger-600); animation: rec-pulse 1.4s ease-in-out infinite; }
@keyframes rec-pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .4; transform: scale(.7); } }
.rec-timer { font-size: 40px; font-weight: var(--fw-bold); color: var(--text-strong); font-variant-numeric: tabular-nums; }
.rec-hint { color: var(--text-muted); max-width: 320px; font-size: var(--text-sm); }
/* dead-mic warning (recorder hint + mini-bar subtitle) */
.rec-hint--warn { color: var(--danger-600); font-weight: var(--fw-medium); }
.rec-actions { display: flex; gap: var(--space-3); margin-top: var(--space-2); }
.rec-actions .btn { min-width: 110px; }

/* waveform bars (decorative) */
.rec-bars { display: flex; align-items: center; gap: 2px; height: 56px; }
.rec-bars i { display: block; width: 3px; border-radius: var(--radius-full); background: var(--primary-400); }

/* Seekable playback waveform (Snapchat-style): tap/drag to skip, played portion
   fills. touch-action:none so a horizontal drag scrubs instead of scrolling the
   sheet. Scoped to .rec-wave-seek so the decorative timeline mini-chips are
   unaffected. */
.rec-wave-seek { cursor: pointer; touch-action: none; }
.rec-wave-seek .rec-bars i { background: var(--primary-200); transition: background 90ms linear; }
.rec-wave-seek .rec-bars i.played { background: var(--primary-600); }
@media (hover: hover) and (pointer: fine) {
  .rec-wave-seek:hover .rec-bars i:not(.played) { background: var(--primary-300); }
}
@media (prefers-reduced-motion: reduce) { .rec-wave-seek .rec-bars i { transition: none; } }
@media (prefers-reduced-motion: reduce) { .rec-dot { animation: none; } }

/* playback panel */
.rec-panel-head { display: flex; align-items: center; gap: var(--space-3); height: var(--shell-header-height); padding: 0 var(--space-5); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.rec-panel-title { display: flex; flex-direction: column; line-height: 1.25; }
.rec-panel-title > span:first-child { font-size: 16px; font-weight: var(--fw-semibold); color: var(--text-strong); }
.rec-panel-sub { font-size: var(--text-xs); color: var(--text-soft); }
/* Right-side action group: download then delete. margin-left:auto on the FIRST
   (download) pushes both to the right; the header gap spaces them apart. */
.rec-dl { margin-left: auto; width: 32px; height: 32px; border-radius: var(--radius-sm); display: inline-flex; align-items: center; justify-content: center; color: var(--text-soft); }
@media (hover: hover) and (pointer: fine) { .rec-dl:hover { background: var(--primary-50); color: var(--primary-600); } }
.rec-dl svg { width: 17px; height: 17px; }
.rec-dl.is-busy { opacity: 0.55; pointer-events: none; }
.rec-del { width: 32px; height: 32px; border-radius: var(--radius-sm); display: inline-flex; align-items: center; justify-content: center; color: var(--text-soft); }
@media (hover: hover) and (pointer: fine) { .rec-del:hover { background: var(--danger-bg); color: var(--danger-600); } }
.rec-del svg { width: 17px; height: 17px; }
.rec-player { display: flex; align-items: center; gap: var(--space-3); margin: var(--space-5); padding: var(--space-3) var(--space-4); border-radius: var(--radius-lg); background: color-mix(in srgb, var(--primary-600) 6%, var(--surface)); border: 1px solid var(--border-faint); flex-shrink: 0; }
.rec-play, .rec-chip-play { width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%; background: var(--primary-600); color: var(--on-primary); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.rec-play svg, .rec-chip-play svg { width: 18px; height: 18px; }
.rec-play:active, .rec-chip-play:active { transform: scale(0.94); }
.rec-player .rec-wave { flex: 1; overflow: hidden; }
.rec-player-time { font-size: var(--text-sm); font-weight: var(--fw-semibold); color: var(--text-muted); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.rec-loading { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--text-soft); }

/* transcript */
.rec-transcript { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 var(--space-6) var(--space-6); }
.rec-transcript-label { font-size: var(--text-2xs); font-weight: var(--fw-bold); letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-soft); margin-bottom: var(--space-4); }
.tr-seg { margin-bottom: var(--space-4); }
/* speaker label colour keys off WHO is talking, not row position: "You" (the
   recording admin) = accent; every other speaker = strong/black. */
.tr-spk { display: flex; align-items: baseline; gap: var(--space-2); font-weight: var(--fw-semibold); color: var(--text-strong); font-size: var(--text-sm); margin-bottom: 2px; }
.tr-spk.is-me { color: var(--primary-600); }
.tr-at { font-size: var(--text-2xs); font-weight: var(--fw-medium); color: var(--text-soft); }
.tr-seg p { color: var(--text); font-size: var(--text-md); }
.tr-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: var(--space-10) var(--space-4); }
.tr-empty svg { width: 28px; height: 28px; color: var(--text-soft); margin-bottom: var(--space-2); }
.rec-spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--border); border-top-color: var(--primary-600); animation: spin 0.8s linear infinite; margin-bottom: var(--space-2); }
.rec-spinner-sm { width: 16px; height: 16px; border-width: 2px; margin: 0; border-color: rgba(255, 255, 255, 0.45); border-top-color: #fff; }
.rec-chip-pending { opacity: 0.72; cursor: default; pointer-events: none; }
/* upload-failed chip: audio is already downloaded to the device; Retry re-uploads */
.rec-chip-failed { cursor: default; border-color: color-mix(in srgb, var(--danger-600) 45%, var(--border)); background: color-mix(in srgb, var(--danger-600) 6%, var(--surface)); }
.rec-chip-warn { background: color-mix(in srgb, var(--danger-600) 18%, var(--surface)); color: var(--danger-600); }
.rec-chip-failed .rec-chip-transcript { color: var(--primary-600); font-weight: var(--fw-semibold); }
.tr-empty p { color: var(--text-muted); font-weight: var(--fw-medium); }
.tr-empty span { font-size: var(--text-sm); color: var(--text-soft); max-width: 280px; }

/* saved-recording chips in the notes section */
.dw-recordings { display: flex; flex-direction: column; gap: var(--space-2); }
.dw-recordings:empty { display: none; }
.rec-chip { display: flex; align-items: center; gap: var(--space-3); padding: 8px 12px; border: 1px solid var(--primary-200); border-radius: var(--radius-md); background: color-mix(in srgb, var(--primary-600) 5%, var(--surface)); cursor: pointer; transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease); }
@media (hover: hover) and (pointer: fine) { .rec-chip:hover { background: color-mix(in srgb, var(--primary-600) 9%, var(--surface)); border-color: var(--primary-300); } }
.rec-chip-play { width: 32px; height: 32px; }
.rec-chip .rec-wave-mini { flex: 1; min-width: 24px; overflow: hidden; }
.rec-wave-mini .rec-bars { height: 26px; }
.rec-chip-meta { display: flex; flex-direction: column; line-height: 1.25; flex-shrink: 0; }
.rec-chip-title { font-size: var(--text-sm); font-weight: var(--fw-semibold); color: var(--text-strong); }
.rec-chip-sub { font-size: var(--text-2xs); color: var(--text-soft); }
.rec-chip-transcript { margin-left: var(--space-1); display: inline-flex; align-items: center; gap: 2px; font-size: var(--text-sm); font-weight: var(--fw-semibold); color: var(--primary-600); flex-shrink: 0; cursor: pointer; }
.rec-chip-transcript svg { width: 15px; height: 15px; }

.drawer-head {
  display: flex; align-items: center; gap: var(--space-3);
  height: var(--shell-header-height); padding: 0 var(--space-6);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.drawer-head .drawer-title { font-size: 16px; font-weight: var(--fw-semibold); color: var(--text-strong); }
.drawer-close {
  width: 32px; height: 32px; border-radius: var(--radius-sm); flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-muted); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--btn-shadow);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
@media (hover: hover) and (pointer: fine) {
  .drawer-close:hover { background: var(--gray-50); border-color: var(--border-strong); }
}
.drawer-close svg { width: 17px; height: 17px; }

/* overflow-x: hidden — the body declares overflow-y, which would otherwise
   promote overflow-x to `auto` and let a few px of content (a long value, an
   input's intrinsic width, sub-pixel rounding) scroll the sheet sideways on
   mobile + desktop. Pin it so the body only ever scrolls vertically. */
.drawer-body { flex: 1; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; min-height: 0; padding: var(--space-4) var(--space-5) var(--space-5); display: flex; flex-direction: column; gap: var(--space-6); }
/* second top row — mirrors the app toolbar row so the drawer matches the
   two-row app shell and content below lines up with the main view */
.drawer-subhead { flex-shrink: 0; min-height: var(--shell-toolbar-height); padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.dw-section { display: flex; flex-direction: column; gap: var(--space-3); }
.dw-label { font-size: var(--text-2xs); font-weight: var(--fw-bold); letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-soft); }

/* summary — a 2-col grid: [ name | status pill ] on row 1, and the "· Submitted
   …" line SPANNING THE FULL WIDTH on row 2. On mobile the status pill is
   relocated in here (drawerShell) and sits top-right next to the name; the sub
   line still gets the whole width instead of being squeezed into a narrow
   column. On desktop there's no pill child, so it's just name-over-sub. */
.dw-summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: var(--space-3); row-gap: 4px; flex: 1; min-width: 0; }
/* clip the business name with an ellipsis instead of letting it run full-width
   and shove the status pill off the edge. */
.dw-summary .biz { grid-column: 1; grid-row: 1; font-size: var(--text-2xl); font-weight: var(--fw-bold); color: var(--text-strong); letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.dw-summary > .status-dd { grid-column: 2; grid-row: 1; justify-self: end; }
.dw-sub { grid-column: 1 / -1; grid-row: 2; display: flex; align-items: flex-start; gap: 6px; font-size: var(--text-sm); color: var(--text-muted); min-width: 0; }
.dw-sub > span { overflow-wrap: anywhere; }
.dw-sub .avatar { width: 20px; height: 20px; font-size: 9px; flex-shrink: 0; }
.dw-label-sub { margin-top: var(--space-2); }
/* full-bleed separator under the lead summary */
.dw-divider { height: 1px; background: var(--border); margin: calc(-1 * var(--space-2)) calc(-1 * var(--space-5)); }

/* status dropdown */
.status-dd { position: relative; flex-shrink: 0; display: inline-flex; align-items: center; gap: var(--space-2); }
.status-trigger { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 7px 0 4px; border: 1px solid var(--border); border-radius: var(--radius-full); background: var(--surface); box-shadow: var(--btn-shadow); cursor: pointer; transition: border-color var(--dur) var(--ease); }
@media (hover: hover) and (pointer: fine) {
  .status-trigger:hover { border-color: var(--border-strong); }
}
.status-trigger svg { width: 14px; height: 14px; color: var(--text-soft); }
.status-trigger .stage { padding-left: 6px; }
.status-menu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 5; min-width: 168px; padding: 4px; display: flex; flex-direction: column; gap: 2px; }
.status-menu[hidden] { display: none; }
.status-opt { display: flex; align-items: center; padding: 7px 10px; border-radius: var(--radius-sm); cursor: pointer; transition: background var(--dur) var(--ease); }
@media (hover: hover) and (pointer: fine) {
  .status-opt:hover { background: var(--gray-100); }
}
.status-opt.active { background: var(--nav-active-bg); }

/* compact two-column contact grid */
.dw-grid { display: flex; flex-direction: column; gap: var(--space-4); }
.dw-cell { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dw-cell .fk { font-size: var(--text-xs); color: var(--text-soft); }
.dw-cell .fv { font-size: var(--text-md); color: var(--text-strong); font-weight: var(--fw-medium); white-space: pre-wrap; overflow-wrap: anywhere; }

/* quick actions */
.dw-actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
.dw-actions .btn { width: 100%; text-decoration: none; }
.dw-actions .btn-wide { grid-column: 1 / -1; }
/* Call / Send text read larger + more tappable — match the primary CTA height */
.dw-actions .btn:not(.btn-wide) { height: 46px; font-size: var(--text-base); }
.dw-actions .btn:not(.btn-wide) svg { width: 18px; height: 18px; }
/* the Schedule Consultation CTAs read slightly larger (lead detail + booking) */
.dw-actions .btn-primary.btn-wide,
.sched-foot .btn-primary.btn-wide {
  height: 46px;
  font-size: var(--text-base);
}
.dw-actions .btn-primary.btn-wide svg,
.sched-foot .btn-primary.btn-wide svg { width: 19px; height: 19px; }

/* notes */
.dw-notes { width: 100%; min-height: 92px; resize: vertical; padding: var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); font: inherit; font-size: var(--text-md); color: var(--text); box-shadow: var(--btn-shadow); transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.dw-notes:focus { outline: none; border-color: var(--primary-400); box-shadow: var(--ring-primary); }
.dw-notes::placeholder { color: var(--text-soft); }
/* Record call — admin desktop only (the !clientMode gate is in leadDrawerHTML;
   this hides it on mobile). Full-width bordered button matching the note field. */
.dw-record-call {
  display: flex; align-items: center; justify-content: center; gap: var(--space-2);
  width: 100%; height: 44px; padding: 0 var(--space-3);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--surface); box-shadow: var(--btn-shadow);
  font: inherit; font-size: var(--text-md); font-weight: var(--fw-medium); color: var(--text-strong);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.dw-record-call svg { width: 18px; height: 18px; color: var(--primary-600); }
.dw-record-call:active { transform: scale(0.99); }
@media (hover: hover) and (pointer: fine) {
  .dw-record-call:hover { background: var(--surface-hover); border-color: var(--border-strong); }
}
@media (max-width: 640px) { .dw-record-call { display: none; } }   /* desktop only */
.dw-notes-row { display: flex; align-items: center; gap: var(--space-3); }
.dw-saved { font-size: var(--text-sm); color: var(--success-600); opacity: 0; transition: opacity var(--dur) var(--ease); }
.dw-saved.show { opacity: 1; }

/* to-do list */
.dw-todo-field { display: flex; align-items: center; gap: var(--space-2); height: 46px; padding: 0 8px 0 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--btn-shadow); transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.dw-todo-field:focus-within { border-color: var(--primary-400); box-shadow: var(--ring-primary); }
.dw-todo-field > svg { width: 16px; height: 16px; color: var(--text-soft); flex-shrink: 0; }
.dw-todo-input { flex: 1; min-width: 0; height: 100%; border: none; background: none; box-shadow: none; padding: 0; font: inherit; font-size: var(--text-md); color: var(--text); }
.dw-todo-input:focus { outline: none; box-shadow: none; }
.dw-todo-input::placeholder { color: var(--text-soft); }
.dw-enter { flex-shrink: 0; display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border: 1px solid var(--border); border-radius: var(--radius-xs); background: var(--gray-50); color: var(--text-soft); font-family: var(--font-sans); font-size: var(--text-2xs); font-weight: var(--fw-semibold); letter-spacing: 0.02em; }
.dw-todos { display: flex; flex-direction: column; gap: 6px; }
.dw-todos:empty { display: none; }
.dw-todo { display: flex; align-items: center; gap: var(--space-3); padding: 8px 10px; border: 1px solid var(--border-faint); border-radius: var(--radius-md); background: var(--surface); }
.dw-todo-check { width: 18px; height: 18px; flex-shrink: 0; border: 1.5px solid var(--gray-300); border-radius: var(--radius-xs); display: inline-flex; align-items: center; justify-content: center; color: #fff; transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease); }
.dw-todo-check svg { width: 12px; height: 12px; opacity: 0; }
.dw-todo.done .dw-todo-check { background: var(--primary-600); border-color: var(--primary-600); }
.dw-todo.done .dw-todo-check svg { opacity: 1; }
.dw-todo-text { flex: 1; min-width: 0; font-size: var(--text-md); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dw-todo.done .dw-todo-text { color: var(--text-soft); text-decoration: line-through; }
.dw-todo-del { width: 24px; height: 24px; flex-shrink: 0; border-radius: var(--radius-xs); display: inline-flex; align-items: center; justify-content: center; color: var(--text-soft); opacity: 0; transition: opacity var(--dur) var(--ease), background var(--dur) var(--ease); }
@media (hover: hover) and (pointer: fine) {
  .dw-todo:hover .dw-todo-del { opacity: 1; }
  .dw-todo-del:hover { background: var(--danger-bg); color: var(--danger-600); }
}
.dw-todo-del svg { width: 14px; height: 14px; }

/* ============================ DRAWER V2 (admin) ======================== */
/* Two tabs under the name; quick actions pinned in the footer. The client
   portal keeps the original layout — none of these classes render there. */

/* tab strip under the subhead */
.dw-tabs { flex-shrink: 0; padding: var(--space-3) var(--space-5); border-bottom: 1px solid var(--border); }
/* the shared .segmented button is display:block — the tab label carries an
   icon + count chip, so lay it out as a centered row here */
.dw-tabs .segmented button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.dw-tabs .segmented button svg { width: 15px; height: 15px; }
.dw-tab-count {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--radius-full);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--text-2xs); font-weight: var(--fw-semibold);
  background: var(--gray-150); color: var(--gray-600);
}
.dw-tabs .segmented button.active .dw-tab-count { background: var(--primary-100); color: var(--primary-700); }
.dw-tab-panel { display: flex; flex-direction: column; gap: var(--space-6); }
.dw-tab-panel[hidden] { display: none; }

/* notes composer + entries */
.dw-composer { display: flex; flex-direction: column; gap: var(--space-2); }
.dw-composer .dw-notes { min-height: 74px; }
.dw-composer-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.dw-composer-hint { font-size: var(--text-xs); color: var(--text-soft); }
.dw-note-entries { display: flex; flex-direction: column; gap: var(--space-2); }
.dw-note-entries:empty { display: none; }
.dw-note-entry { display: flex; gap: var(--space-3); padding: var(--space-3); border: 1px solid var(--border-faint); border-radius: var(--radius-md); background: var(--surface); }
.dw-note-avatar {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: var(--fw-bold); background: var(--primary-100); color: var(--primary-700);
}
.dw-note-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.dw-note-head { display: flex; align-items: baseline; gap: var(--space-2); }
.dw-note-author { font-size: var(--text-sm); font-weight: var(--fw-semibold); color: var(--text-strong); }
.dw-note-time { font-size: var(--text-2xs); color: var(--text-soft); }
.dw-note-body { font-size: var(--text-md); color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }

/* activity timeline */
.dw-timeline { display: flex; flex-direction: column; }
.dw-tl-loading, .dw-tl-error { font-size: var(--text-sm); color: var(--text-soft); padding: var(--space-2) 0; display: flex; align-items: center; gap: var(--space-3); }
.dw-tl-item { position: relative; display: flex; gap: var(--space-3); padding: 0 0 var(--space-5); }
.dw-tl-item::before {
  content: ""; position: absolute; left: 13px; top: 30px; bottom: 2px; width: 2px;
  background: var(--border); border-radius: 1px;
}
.dw-tl-item:last-child { padding-bottom: 0; }
.dw-tl-item:last-child::before { display: none; }
.dw-tl-icon {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; z-index: 1;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-faint);
}
.dw-tl-icon svg { width: 14px; height: 14px; }
.dw-tl-icon--stage    { background: var(--primary-100); color: var(--primary-700); }
.dw-tl-icon--consult  { background: var(--warning-bg);  color: var(--warning-600); }
.dw-tl-icon--call     { background: var(--primary-100); color: var(--primary-600); }
.dw-tl-icon--followup { background: var(--info-bg);     color: var(--info-600); }
.dw-tl-icon--web      { background: var(--chan-web-bg); color: var(--chan-web-fg); }
/* a recording chip sits as the body of a timeline item — trim its top margin so
   it aligns with the item's title row instead of double-gapping */
.dw-tl-main > .rec-chip { margin-top: 6px; }
.dw-tl-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; padding-top: 4px; }
.dw-tl-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); }
.dw-tl-title { font-size: var(--text-md); font-weight: var(--fw-medium); color: var(--text-strong); }
.dw-tl-title b { font-weight: var(--fw-semibold); }
.dw-tl-time { font-size: var(--text-2xs); color: var(--text-soft); white-space: nowrap; flex-shrink: 0; }
.dw-tl-sub { font-size: var(--text-sm); color: var(--text-muted); overflow-wrap: anywhere; }
.dw-tl-card {
  margin-top: 6px; display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--surface-sunk);
}
.dw-tl-when { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.dw-tl-when .when { font-size: var(--text-sm); font-weight: var(--fw-semibold); color: var(--text-strong); }
.dw-tl-when .kind { font-size: var(--text-xs); color: var(--text-muted); }
.dw-meet-chip {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px;
  border-radius: var(--radius-full); font-size: var(--text-2xs); font-weight: var(--fw-semibold);
  background: var(--info-bg); color: var(--info-600); flex-shrink: 0; text-decoration: none;
}
.dw-meet-chip svg { width: 12px; height: 12px; }
.dw-tl-delete {
  width: 28px; height: 28px; border-radius: var(--radius-md); flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--danger-600); background: transparent;
  transition: background var(--dur) var(--ease);
}
.dw-tl-delete:hover { background: var(--danger-bg); }
.dw-tl-delete svg { width: 15px; height: 15px; }

/* ---------------------------------------------------------------------- */
/* Integrations tab                                                       */
/* ---------------------------------------------------------------------- */
.intg-wrap { max-width: 760px; margin: 0 auto; }
/* In the client portal, Settings is a flex column (.set-page); auto side-margins
   there make each .intg-wrap shrink to its own content width and mis-align. Fill
   the column so the "Integrations" and "Personal" blocks share the same edges. */
.set-page > .intg-wrap { width: 100%; }
.intg-wrap--personal { margin-top: var(--space-5); }
.intg-head { margin-bottom: var(--space-5); }
.intg-head h3 { font-size: var(--text-xl); font-weight: var(--fw-bold); color: var(--text-strong); letter-spacing: -0.01em; }
.intg-head p { margin-top: 4px; font-size: var(--text-sm); color: var(--text-soft); max-width: 60ch; }
.intg-list { display: flex; flex-direction: column; gap: var(--space-3); }
.intg-card {
  background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs); overflow: hidden;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
@media (hover: hover) and (pointer: fine) {
  .intg-card:hover { box-shadow: var(--shadow-sm); }
}
.intg-card.is-on { border-color: var(--success-600); }
.intg-row {
  display: flex; align-items: flex-start; gap: var(--space-4); width: 100%;
  padding: var(--space-4); text-align: left; cursor: pointer; background: transparent;
}
@media (hover: hover) and (pointer: fine) {
  .intg-row:hover { background: var(--gray-25); }
}
.intg-logo {
  flex-shrink: 0; width: 48px; height: 48px; border-radius: var(--radius-md);
  display: inline-flex; align-items: center; justify-content: center;
}
.intg-logo svg { width: 26px; height: 26px; }
.intg-logo--brand { background: var(--info-bg); }
.intg-logo--meta svg { width: 30px; height: auto; }
.intg-logo--forms { background: linear-gradient(140deg, #6366f1, #8b5cf6); }
.intg-logo--forms svg { width: 24px; height: 24px; }
.intg-logo--track { background: linear-gradient(140deg, #0ea5e9, #14b8a6); }
.intg-logo--track svg { width: 24px; height: 24px; }
.intg-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.intg-name-row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: nowrap; }
.intg-name { font-size: var(--text-md); font-weight: var(--fw-semibold); color: var(--text-strong); white-space: nowrap; }
.intg-status { display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0; white-space: nowrap; font-size: var(--text-xs); font-weight: var(--fw-semibold); padding: 2px 9px 2px 7px; border-radius: 999px; }
.intg-dot { width: 7px; height: 7px; border-radius: 50%; }
.intg-status--on { color: var(--success-600); background: var(--success-bg); }
.intg-status--on .intg-dot { background: var(--success-600); }
.intg-status--off { color: var(--text-soft); background: var(--gray-100); }
.intg-status--off .intg-dot { background: var(--gray-400); }
.intg-desc { margin-top: 5px; font-size: var(--text-sm); color: var(--text-muted); line-height: var(--leading-normal); }
.intg-tag { align-self: flex-start; margin-top: 9px; font-size: var(--text-xs); font-weight: var(--fw-medium); color: var(--text-soft); background: var(--gray-50); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 2px 8px; white-space: nowrap; }
.intg-caret { flex-shrink: 0; align-self: center; color: var(--text-soft); display: inline-flex; transition: transform var(--dur) var(--ease); }
.intg-caret svg { width: 18px; height: 18px; }
.intg-card[aria-expanded="true"] .intg-caret { transform: rotate(180deg); }

/* expanding details panel */
.intg-panel { height: 0; overflow: hidden; transition: height 0.26s var(--ease); }
.intg-panel-inner { padding: 0 var(--space-4) var(--space-4); border-top: 1px solid var(--border-faint); }
.intg-note { margin: var(--space-4) 0; font-size: var(--text-sm); color: var(--text-soft); line-height: var(--leading-relaxed); max-width: 60ch; }
/* live "is data flowing?" line on the Website Tracking cards */
.intg-livecheck { margin: var(--space-3) 0 0; font-size: var(--text-sm); line-height: var(--leading-relaxed); }
.intg-livecheck[data-state="checking"] { color: var(--text-muted); }
.intg-livecheck[data-state="ok"] { color: var(--success-600, #16a34a); }
.intg-livecheck[data-state="warn"] { color: var(--warning-600, #d97706); }
/* install instructions (Website Tracking) */
.intg-install { margin: 0 0 var(--space-4); padding: var(--space-3) var(--space-4); background: var(--surface-event); border: 1px solid var(--border-faint); border-radius: var(--radius-md); }
.intg-install-label { display: block; font-size: var(--text-xs); font-weight: var(--fw-bold); letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-soft); margin-bottom: var(--space-2); }
.intg-steps { margin: 0; padding-left: 1.25em; display: flex; flex-direction: column; gap: 6px; font-size: var(--text-sm); color: var(--text); line-height: var(--leading-relaxed); }
.intg-steps li { padding-left: 2px; }
.intg-steps code { font-family: ui-monospace, Menlo, monospace; font-size: 0.92em; background: var(--gray-100); color: var(--text-strong); padding: 1px 5px; border-radius: var(--radius-sm); }
.intg-fields { display: flex; flex-direction: column; gap: var(--space-3); }
.intg-field { display: flex; flex-direction: column; gap: 5px; }
.intg-field-label { font-size: var(--text-xs); font-weight: var(--fw-semibold); color: var(--text-muted); }
.intg-input-wrap, .intg-select-wrap { position: relative; display: flex; align-items: center; }
.intg-input { width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); font-family: var(--font-sans); font-size: var(--text-sm); color: var(--text); transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease); }
.intg-input:focus { outline: none; border-color: var(--primary-400); box-shadow: var(--ring-primary); }
.intg-input[readonly] { background: var(--gray-50); color: var(--text-muted); }
.intg-input--mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: var(--text-xs); }
.intg-input-wrap .intg-input { padding-right: 40px; }
.intg-copy { position: absolute; right: 5px; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); color: var(--text-soft); cursor: pointer; transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); }
@media (hover: hover) and (pointer: fine) {
  .intg-copy:hover { background: var(--gray-100); color: var(--text-strong); }
}
.intg-copy svg { width: 15px; height: 15px; }
.intg-select-wrap select { appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer; }
.intg-select-wrap svg { position: absolute; right: 11px; width: 16px; height: 16px; color: var(--text-soft); pointer-events: none; }
