/* modals.css — MB21 c4 consolidation. LOADS LAST.
 *
 * Modal foundation (.fmn-modal-overlay, .fmn-modal-content,
 * .fmn-modal-from-modal, .fmn-modal-from-modal-overlay, .fmn-modal-popup,
 * .fmn-side-panel, .fmn-toast, .fmn-activity-picker-overlay) plus per-modal
 * rules (.tdm-*, .tom-*, .aem-*, .cem-*, .psc-*, .acp-*, .apm-*, .qm-*,
 * .qdm-*, .seqb-*, .ecd-*, .fmn-card-overlay).
 *
 * Loads LAST in the cascade so it wins source-order ties without needing
 * doubled-class selectors (v34's hack is retired here — single-class is
 * sufficient when load order is correct).
 */



/* === migrated from styles-additions-v34.css === */
/* styles-additions-v34.css — MB20 c3a cascade hoist.
 *
 * The c3a bundle (PR #41) added floating-UI foundation classes
 * (.fmn-modal-*, .fmn-popover, .fmn-side-panel, .fmn-toast) to
 * components.css at L5400+. components.css loads BEFORE v11-v33 in
 * index.html, so legacy class rules in those layer files (.ec-overlay
 * z=9000 in v11; .ecd-overlay z=9000 in v13; .psc-overlay z=10000 in
 * v21; .touch-modal-overlay/.tdm-overlay/.tom-overlay in components.css
 * itself) silently override c3a's z-index hierarchy via source-order
 * tiebreaker on equal-specificity single-class selectors.
 *
 * This file re-declares c3a's floating-UI rules in the *last* layer
 * position so they win source order against all v11-v33 legacy rules.
 * Doubled-class selectors (.fmn-modal-overlay) give
 * a +1 specificity bump (0,2,0 beats single-class 0,1,0) as defense
 * against any v## rules that happen to have higher specificity than
 * the simple .ec-overlay pattern.
 *
 * Legacy ID-based rules (#panel z=200, #panel-overlay z=199) are NOT
 * targeted here — those values are already correctly below the modal
 * layer (200 < --z-modal=1010), so the layer hierarchy is preserved.
 *
 * c5 retires the duplicate definitions in components.css + the legacy
 * .ec-overlay / .ecd-overlay / .tdm-overlay / etc. z-index rules in
 * favor of these tokens. Until then this file is the "make c3a
 * actually apply" hatch.
 */
/* ============================================================
   Standard modal layers
   ============================================================ */
.fmn-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal-backdrop, 1000);
  background-color: rgba(0, 0, 0, 0.40);
}

/* ============================================================
   MB22 c3.2 — UNIVERSAL modal scroll safety.
   Doubled-class selectors (specificity 0,2,0) win source order
   against legacy single-class per-modal rules, matching the
   established c3a hoist strategy documented at the top of this file.

   These rules set layout + scroll runway ONLY. They deliberately
   do NOT set `display` — the per-modal classes own the
   display:none <-> display:flex open/close toggle. The flex layout
   below only takes effect once that toggle flips to flex.

   Why this kills the bottom-clipping class of bug permanently:
   - align-items:flex-start  → modal pins to top, never centers
     (centering is what pushes the bottom past the viewport edge).
   - overflow-y:auto         → the overlay itself becomes the scroll
     container, so the runway below the modal is reachable.
   - padding-bottom:18vh     → runway so the last row / action
     buttons clear the iPad keyboard and viewport edge.
   ============================================================ */
.fmn-modal-overlay.fmn-modal-overlay,
.fmn-modal-from-modal-overlay.fmn-modal-from-modal-overlay {
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 6vh 16px 18vh;
}

.fmn-modal-content {
  /* MB21 c8: was position:fixed — removed content from overlay's flex flow
     and broke parent overlay's overflow-y:auto. Tall modals (e.g. New company
     form) couldn't scroll, action buttons clipped off-screen. position:relative
     keeps the element in flex flow AND still creates a stacking context. */
  position: relative;
  z-index: var(--z-modal, 1010);
}

/* ============================================================
   Modal-on-modal layers — composer launched from email-card-detail,
   outcome modal launched from touch-detail, pre-send-checker launched
   from composer.
   ============================================================ */
.fmn-modal-from-modal {
  /* MB21 c8: same scroll fix as .fmn-modal-content. The overlay class
     (.fmn-modal-from-modal-overlay below) keeps position:fixed — that's
     correct because the overlay IS the full-viewport backdrop. */
  position: relative;
  z-index: var(--z-modal-from-modal, 1020);
}

.fmn-modal-from-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-modal-from-modal, 1020) - 1);
  background-color: rgba(0, 0, 0, 0.30);
}

/* ============================================================
   Other floating surfaces
   ============================================================ */
.fmn-popover {
  position: absolute;
  z-index: var(--z-popover, 1100);
}

.fmn-side-panel {
  position: fixed;
  z-index: var(--z-side-panel, 900);
}

.fmn-toast {
  position: fixed;
  z-index: var(--z-toast, 1200);
}

/* ============================================================
   MB21 c2: activity-picker overlay + composer attachment-picker popup
   These two filled the gap left by removing legacy inline z-index
   auto-bumps. activity-picker has no other CSS rule of its own.
   ============================================================ */
.fmn-activity-picker-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal, 1010);
  background-color: rgba(0, 0, 0, 0.40);
}

.fmn-modal-popup {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal-popup, 1030);
  background-color: rgba(0, 0, 0, 0.40);
}

/* === end migrated from styles-additions-v34.css === */


/* === migrated from components-base.css === */
/* ============================================================
   MODAL — overlay + shell + header + body + actions

   Replaces ~6 modal-internal patterns scattered across components.css
   and styles-additions-v*.css. Each existing modal becomes:
     <div class="modal-overlay">
       <div class="modal-shell">
         <div class="modal-header">...</div>
         <div class="modal-body">...</div>
         <div class="modal-actions">...</div>
       </div>
     </div>
   ============================================================ */
.modal-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.modal-overlay.is-open .modal-shell {
  transform: translateY(0) scale(1);
  opacity: 1;
}

@media (max-width: 480px) {
  .modal-overlay { padding: 0; }
  .modal-shell {
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
    height: 100vh;
  }
}

/* === migrated from styles-additions-v33.css === */
/* =============================================================
 * 4. Contact summary card view (C2/C3)
 *
 * Modal overlay containing a large IdentityCard. Opens when user
 * clicks a contact anywhere in the app.
 * ============================================================= */
.fmn-card-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.32);
  z-index: var(--z-modal, 1010);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fmn-fade-in 120ms ease-out;
}

.fmn-card-overlay > .fmn-icard {
  background: var(--surface-card, #fff);
  width: min(420px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.18);
  padding: 20px;
  gap: 14px;
}

.fmn-card-overlay .fmn-icard-close {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 22px;
  color: var(--text-tertiary, #a3a3a3);
  padding: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.fmn-card-overlay .fmn-icard-close:hover {
  background: var(--surface-subtle, #f8f8f7);
  color: var(--text-primary, #171717);
}

/* === migrated from styles-additions-v32.css === */
/* =============================================================
 * 6. Q1 — contact card quick actions popover
 * ============================================================= */
.qa-popover {
  position: absolute;
  background: #171717;
  color: #fff;
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 180px;
  animation: qa-fade-in 120ms ease-out;
}

.qa-popover-action {
  background: transparent;
  border: none;
  padding: 8px 12px;
  text-align: left;
  cursor: pointer;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.qa-popover-action:hover {
  background: rgba(255, 213, 0, 0.18);
  color: var(--color-accent, #FFD500);
}

.qa-popover-action-primary {
  background: var(--color-accent, #FFD500);
  color: #171717;
  font-weight: 600;
}

.qa-popover-action-primary:hover {
  background: #fcc500;
  color: #171717;
}

.qa-popover-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 4px 8px;
}

/* === migrated from styles-additions-v25.css === */
/* styles-additions-v25.css — MB8.5: Diagnostics overlay + batch-setup banner +
 * edit contact button + smart-add buttons
 *
 * Loaded AFTER v24.css. Cache buster v=195.
 *
 * Sections:
 *   1. Diagnostics panel overlay (F6)
 *   2. Batch-setup banner in Contacts view (F4)
 *   3. Smart-add buttons (F4)
 *   4. Edit-contact button in composer (F3)
 *   5. Composer no-email state — layout fix (F2)
 */
/* =============================================================
 * 1. Diagnostics panel overlay (F6)
 * ============================================================= */
.diag-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3, 12px);
  animation: diag-fade-in 200ms ease-out;
}

.diag-panel {
  background: var(--surface-card, #fff);
  border-radius: 8px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.24);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  font-size: 13px;
  color: var(--text-primary, #171717);
}

.diag-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3, 12px) var(--space-4, 16px);
  border-bottom: 1px solid var(--border-default, #e5e5e5);
}

.diag-panel-title {
  font-weight: 600;
  font-size: 15px;
}

.diag-panel-close {
  background: transparent;
  border: none;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: var(--text-tertiary, #a3a3a3);
  padding: 4px 8px;
}

.diag-panel-close:hover { color: var(--text-primary, #171717); }

.diag-panel-body {
  overflow-y: auto;
  padding: var(--space-3, 12px) var(--space-4, 16px);
  display: flex;
  flex-direction: column;
  gap: var(--space-4, 16px);
}

/* === migrated from styles-additions-v21.css === */
/* ============================================================
 * Sequence builder modal
 * ============================================================ */
.seqb-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.seqb-modal {
  background: var(--surface-card, #fff);
  border-radius: 12px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow: auto;
  padding: 24px;
  position: relative;
}

.seqb-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: transparent;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-tertiary);
}

.seqb-title {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 600;
}

.seqb-subtitle {
  margin: 0 0 var(--space-3);
  font-size: 12px;
  color: var(--text-tertiary);
}

.seqb-template-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.seqb-template-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  background: var(--surface-subtle, rgba(0,0,0,0.02));
  border: 1px solid var(--border-default);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease;
}

.seqb-template-card:hover {
  border-color: var(--color-accent, #FFD500);
}

.seqb-template-card.is-selected {
  border-color: var(--color-accent, #FFD500);
  background: rgba(255,213,0,0.06);
}

.seqb-template-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.seqb-template-desc {
  font-size: 12px;
  color: var(--text-secondary);
}

.seqb-template-meta {
  display: flex;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: var(--tracking-mono);
  color: var(--text-tertiary);
}

.seqb-contact-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.seqb-contact-row label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: var(--tracking-mono);
  color: var(--text-tertiary);
}

.seqb-contact-select {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border-default);
  border-radius: 4px;
}

.seqb-preview {
  background: var(--surface-subtle, rgba(0,0,0,0.02));
  border-radius: 6px;
  padding: 12px;
  margin-bottom: var(--space-3);
}

.seqb-preview-title {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: var(--tracking-mono);
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.seqb-preview-touch {
  display: flex;
  gap: var(--space-2);
  padding: 6px 0;
  font-size: 12px;
  border-bottom: 1px dashed var(--border-default);
}

.seqb-preview-touch:last-child { border-bottom: none; }

.seqb-preview-day {
  font-family: var(--font-mono);
  color: var(--text-tertiary);
  min-width: 48px;
}

.seqb-preview-channel {
  font-weight: 600;
  text-transform: capitalize;
}

.seqb-preview-role {
  color: var(--text-tertiary);
  font-style: italic;
  margin-left: auto;
}

.seqb-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}

.seqb-cancel,
.seqb-enroll {
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}

.seqb-cancel {
  background: transparent;
  border: 1px solid var(--border-default);
  color: var(--text-primary);
}

.seqb-enroll {
  background: var(--color-accent, #FFD500);
  border: 1px solid var(--color-accent, #FFD500);
  color: #000;
  font-weight: 500;
}

.seqb-enroll:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================================
 * Pre-send checker dialog (speed bump before "Open in Outlook" / Copy)
 * ============================================================ */
.psc-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  /* MB22 c3.2: was align-items:center → modal top clipped on iPad.
     Universal .fmn-modal-overlay rule now supplies flex-start +
     overflow-y:auto. NOTE: .psc-overlay carries
     .fmn-modal-from-modal-overlay (see pre-send-checker.js), so the
     universal from-modal rule applies here. */
  padding: 24px 16px 18vh;
}

.psc-modal {
  background: var(--surface-card, #fff);
  border-radius: 12px;
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow: auto;
  padding: 24px;
}

.psc-title {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 600;
}

.psc-subtitle {
  margin: 0 0 var(--space-3);
  font-size: 12px;
  color: var(--text-tertiary);
}

.psc-checks {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.psc-check {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid transparent;
}

.psc-check.psc-pass {
  background: rgba(16,185,129,0.06);
  border-color: rgba(16,185,129,0.2);
}

.psc-check.psc-warn {
  background: rgba(245,158,11,0.06);
  border-color: rgba(245,158,11,0.3);
}

.psc-check.psc-block {
  background: rgba(239,68,68,0.08);
  border-color: rgba(239,68,68,0.4);
}

.psc-check-icon {
  font-size: 16px;
  line-height: 1.2;
}

.psc-check-body {
  flex: 1;
  min-width: 0;
  font-size: 13px;
}

.psc-check-name {
  font-weight: 600;
  margin-bottom: 2px;
}

.psc-check-why {
  color: var(--text-secondary);
  font-size: 12px;
}

.psc-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}

.psc-cancel,
.psc-proceed {
  padding: 8px 18px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}

.psc-cancel {
  background: transparent;
  border: 1px solid var(--border-default);
  color: var(--text-primary);
}

.psc-proceed {
  background: var(--color-accent, #FFD500);
  border: 1px solid var(--color-accent, #FFD500);
  color: #000;
  font-weight: 500;
}

.psc-proceed.psc-proceed-warn {
  background: #f59e0b;
  border-color: #f59e0b;
  color: #fff;
}

.psc-proceed.psc-proceed-blocked {
  background: var(--surface-subtle, rgba(0,0,0,0.04));
  border-color: var(--border-default);
  color: var(--text-tertiary);
  cursor: not-allowed;
}

/* === end migrated from styles-additions-v21.css === */


/* === migrated from styles-additions-v17.css === */
/* ============================================================
   2. ACTIVITY PICKER MODAL (.acp-*)

   Two big tappable cards. Used from "+ New activity" on Activities
   page to choose between past-log and future-schedule.
   ============================================================ */
.acp-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 14, 0.45);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 10vh 16px 18vh;
  overflow-y: auto;
}

.acp-overlay.acp-open { display: flex; }

.acp-modal {
  background: var(--bg-elev-1);
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  font-family: var(--font-sans);
  animation: acp-rise 0.2s var(--easing-out);
}

@keyframes acp-rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.acp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}

.acp-header h2 {
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  font-weight: 500;
  color: var(--text-primary);
  margin: 0;
}

.acp-close {
  background: transparent;
  border: 0;
  font-size: var(--text-xl);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0 var(--space-1);
  line-height: 1;
}

.acp-close:hover { color: var(--text-primary); }

.acp-body {
  padding: var(--space-4) var(--space-5) var(--space-5);
}

.acp-prompt {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-mono);
  color: var(--text-tertiary);
  margin: 0 0 var(--space-3);
}

.acp-choices {
  display: flex;
  flex-direction: column;
  gap: var(--space-2_5);
}

.acp-choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-1);
  padding: var(--space-4);
  background: var(--bg-elev-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  text-align: left;
  cursor: pointer;
  transition: background var(--motion-fast) var(--easing-out),
              border-color var(--motion-fast) var(--easing-out),
              transform var(--motion-fast) var(--easing-out);
}

.acp-choice:hover {
  background: var(--bg-elev-1);
  border-color: var(--border-default);
  transform: translateY(-1px);
}

.acp-choice-icon {
  font-size: var(--text-2xl);
  line-height: 1;
  margin-bottom: var(--space-1);
}

.acp-choice-title {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
}

.acp-choice-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.4;
}

@media (max-width: 480px) {
  .acp-overlay { padding: 4vh 8px 16px; }
  .acp-choice  { padding: var(--space-3); }
}

/* ============================================================
   3. CONTACT EDIT MODAL — ACCOUNT SELECT SECTION

   New "Account" select dropdown. Sits between the name and email
   inputs to make company linking visible at the top of the form.
   ============================================================ */
.cem-account-section {
  padding: var(--space-1) var(--space-5) var(--space-2);
}

.cem-account-section label {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-mono);
  color: var(--text-tertiary);
  margin-bottom: var(--space-1);
}

.cem-account-select {
  width: 100%;
  padding: var(--space-2) var(--space-2_5);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--text-primary);
}

.cem-account-select:focus {
  outline: none;
  border-color: var(--border-focus);
}

.cem-account-hint {
  display: block;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: var(--space-1);
  font-style: italic;
}

/* In create mode, the Delete button is hidden and the title changes */
.cem-overlay.cem-create-mode .cem-delete-btn { display: none; }

/* MB26 s3 — Contact create parity + company autocomplete.
   Create mode shows ONLY gate fields (name + company + one reach). The rest is
   hidden and added after (same pattern as the company create modal). */
.cem-overlay.cem-create-mode .cem-post-create { display: none; }
.cem-create-hint {
  margin: 4px 0 0;
  font-size: 12px;
  color: #888780;
  line-height: 1.4;
}
.cem-overlay:not(.cem-create-mode) .cem-create-hint { display: none; }

/* Company autocomplete (replaces the old <select>). */
.cem-account-ac { position: relative; }
.cem-account-search { width: 100%; box-sizing: border-box; }
.cem-account-menu {
  position: absolute;
  left: 0; right: 0; top: calc(100% + 4px);
  z-index: 5;
  background: var(--surface-1, #fdfcfa);
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0,0,0,.16);
  max-height: 260px;
  overflow-y: auto;
  padding: 4px;
}
.cem-ac-item {
  padding: 9px 11px;
  border-radius: 7px;
  font-size: 14px;
  cursor: pointer;
  color: var(--text-primary, #171717);
}
.cem-ac-item:hover,
.cem-ac-item.cem-ac-active { background: rgba(0,0,0,.06); }
.cem-ac-add {
  color: #6b6a66;
  font-weight: 600;
  border-top: 1px solid rgba(0,0,0,.08);
  margin-top: 2px;
}
.cem-ac-add:hover,
.cem-ac-add.cem-ac-active { background: #fff7cc; color: #171717; }
.cem-ac-empty {
  padding: 10px 11px;
  font-size: 13px;
  color: #999;
}

/* Reuse .std-page-header-action class for the compose button —
   defined in section 1. */
/* ============================================================
   MB2.1 — Back buttons in chained modal headers
   ============================================================ */
.acp-back-btn,
.tm-back-btn {
  background: transparent;
  border: 0;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-mono);
  color: var(--text-secondary);
  cursor: pointer;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  align-self: flex-start;
}

.acp-back-btn { margin-bottom: var(--space-2); }

.acp-back-btn:hover,
.tm-back-btn:hover {
  background: var(--bg-elev-2);
  color: var(--text-primary);
}

/* MB2.1 — Hide AccountEditModal Delete button in create mode */
.aem-overlay.aem-create-mode .aem-delete { display: none; }

/* MB26 s2 — Create save-gate: the New-company modal shows ONLY the gate fields
   (name + phone/email). Everything else is filled in after the record exists
   (onboarding). Edit mode shows the full form (no .aem-create-mode class). */
.aem-overlay.aem-create-mode .aem-post-create { display: none; }
.aem-create-hint {
  margin: 4px 0 0;
  font-size: 12px;
  color: #888780;
  line-height: 1.4;
}
/* Hint only makes sense in create mode. */
.aem-overlay:not(.aem-create-mode) .aem-create-hint { display: none; }

/* === end migrated from styles-additions-v17.css === */


/* === migrated from styles-additions-v15.css === */
/* ---------- 5. Contact edit modal (.cem-*) ---------- */
.cem-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 14, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 60px 16px 18vh;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
  overflow-y: auto;
}

.cem-overlay.cem-open {
  opacity: 1;
  pointer-events: auto;
}

.cem-modal {
  width: 100%;
  max-width: 540px;
  background: #fbfaf6;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.06);
  font-family: inherit;
  color: #1a1a1a;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 92px);
}

.cem-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.08);
}

.cem-header h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.2px;
}

.cem-close {
  background: transparent;
  border: 0;
  padding: 4px 8px;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: #888780;
  border-radius: 4px;
  transition: background 0.1s, color 0.1s;
}

.cem-close:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #1a1a1a;
}

.cem-form {
  padding: 16px 22px 22px;
  overflow-y: auto;
}

.cem-banner {
  background: #fff7e3;
  border: 0.5px solid #d4b264;
  border-left: 3px solid #b8902c;
  border-radius: 4px;
  padding: 9px 12px;
  font-size: 12.5px;
  color: #6e5511;
  line-height: 1.45;
  margin-bottom: 14px;
}

.cem-row {
  display: flex;
  flex-direction: column;
  margin-bottom: 12px;
}

.cem-row label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #888780;
  margin-bottom: 4px;
  font-weight: 500;
}

.cem-label-hint {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  color: #b3b0a6;
  margin-left: 6px;
}

.cem-row input,
.cem-row textarea {
  font: inherit;
  font-size: 14px;
  padding: 8px 10px;
  border: 1px solid #d8d6d0;
  border-radius: 6px;
  background: #fff;
  color: #1a1a1a;
  width: 100%;
}

.cem-row input:focus,
.cem-row textarea:focus {
  outline: none;
  border-color: #888780;
  box-shadow: 0 0 0 2px rgba(136, 135, 128, 0.18);
}

.cem-row-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 0;
}

.cem-section-divider {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #b3b0a6;
  margin: 16px 0 10px;
  padding-top: 10px;
  border-top: 0.5px solid rgba(0, 0, 0, 0.08);
  font-weight: 500;
}

.cem-section-divider:first-child {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}

.cem-error {
  background: #fde8e0;
  border: 0.5px solid #c96b3f;
  border-radius: 4px;
  padding: 8px 11px;
  font-size: 13px;
  color: #6e2913;
  margin: 6px 0 4px;
}

.cem-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 0.5px solid rgba(0, 0, 0, 0.08);
}

.cem-spacer {
  flex: 1;
}

.cem-cancel,
.cem-save,
.cem-delete {
  font: inherit;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 6px;
  border: 0;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.cem-cancel {
  background: transparent;
  color: #6b6960;
  border: 1px solid #d8d6d0;
}

.cem-cancel:hover {
  background: rgba(0, 0, 0, 0.04);
  color: #1a1a1a;
}

.cem-save {
  background: #1a1a1a;
  color: #fff;
}

.cem-save:hover { background: #2a2a2a; }

.cem-save:disabled {
  background: #b3b0a6;
  cursor: not-allowed;
}

.cem-delete {
  background: transparent;
  color: #993C1D;
  border: 1px solid #e6c9bd;
}

.cem-delete:hover {
  background: #fde8e0;
  color: #6e2913;
}

@media (max-width: 480px) {
  .cem-overlay {
    padding: 32px 8px 16px;
  }
  .cem-modal {
    max-height: calc(100vh - 48px);
  }
  .cem-form {
    padding: 14px 16px 18px;
  }
  .cem-actions {
    flex-wrap: wrap;
  }
  .cem-delete {
    order: 3;
    width: 100%;
    margin-top: 8px;
  }
}

/* === end migrated from styles-additions-v15.css === */


/* === migrated from styles-additions-v14.css === */
/* ============================================================
   Email card detail — explicit X close button (top-right)
   ============================================================ */
.ecd-x-close {
  position: absolute;
  top: 10px;
  right: 14px;
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid rgba(0,0,0,0.10);
  border-radius: 6px;
  font-size: 18px;
  font-family: inherit;
  color: var(--ds-text-muted, #555);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.ecd-x-close:hover {
  background: rgba(0,0,0,0.05);
  border-color: rgba(0,0,0,0.25);
  color: var(--ds-text, #1a1a1a);
}

/* The overlay-inner needs relative positioning so absolute X anchors correctly */
.ecd-overlay-inner {
  position: relative;
}

/* ============================================================
   Touch detail modal — Compose & send button styling
   ============================================================ */
.tdm-btn-compose {
  background: #1e5fa8;
  color: #fff;
  border-color: #1e5fa8;
  font-weight: 500;
}

.tdm-btn-compose:hover {
  background: #164a85;
  border-color: #164a85;
}

/* === migrated from styles-additions-v13.css === */
/* ============================================================
   Card detail overlay
   ============================================================ */
.ecd-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  /* MB22 c3.2: was align-items:center, which clipped the modal top
     off-screen on iPad. Universal .fmn-modal-overlay rule now supplies
     flex-start + overflow-y:auto. Inner .ecd-overlay-inner keeps its
     own max-height scroll; this overlay overflow is the safety net. */
  padding: 32px 16px 18vh;
}

.ecd-overlay.ecd-hidden {
  display: none;
}

.ecd-overlay-inner {
  width: 100%;
  max-width: 800px;
  max-height: calc(100vh - 64px);  /* fit in viewport minus padding */
  background: var(--ds-card-bg, #faf6ee);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  /* removed min-height: 400px — let content size naturally */
}

/* ----- Top bar ----- */
.ecd-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(0,0,0,0.10);
  flex-shrink: 0;  /* stays visible at top of overlay */
}

.ecd-close {
  background: transparent;
  border: none;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--ds-text-muted, #555);
  cursor: pointer;
  font-family: inherit;
}

.ecd-close:hover {
  background: rgba(0,0,0,0.05);
  color: var(--ds-text, #1a1a1a);
}

.ecd-position {
  flex: 1;
  text-align: center;
  font-size: 12px;
  color: var(--ds-text-muted, #888);
  font-family: var(--ds-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  letter-spacing: 0.04em;
}

.ecd-nav {
  display: flex;
  gap: 4px;
}

.ecd-nav-btn {
  /* MB21 c8: bumped from 32×32 → 44×44 to honor HIG/WCAG tappable minimum
     (was overshadowing .fmn-btn-icon via direct specificity). */
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 6px;
  border: 1px solid rgba(0,0,0,0.12);
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  color: var(--ds-text, #1a1a1a);
}

.ecd-nav-btn:hover:not([disabled]) {
  background: rgba(0,0,0,0.05);
  border-color: rgba(0,0,0,0.25);
}

.ecd-nav-btn[disabled] {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ----- Content area ----- */
.ecd-content {
  flex: 1;
  padding: 20px 24px;
  overflow-y: auto;  /* internal scroll for long emails */
  min-height: 0;     /* required for flex item to shrink below content size */
}

.ecd-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.ecd-account-name {
  font-size: 18px;
  font-weight: 600;
  font-family: var(--ds-font-serif, ui-serif, Georgia, serif);
  color: var(--ds-text, #1a1a1a);
}

.ecd-sent-at {
  font-size: 12px;
  color: var(--ds-text-muted, #888);
  margin-bottom: 18px;
  font-family: var(--ds-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
}

/* ----- Status badges (sized larger than ob-status) ----- */
.ecd-status {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: var(--ds-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
}

.ecd-status-draft  { background: rgba(120,120,120,0.18); color: #444; }

.ecd-status-queued { background: rgba(200,140,40,0.20);  color: #7a5010; }

.ecd-status-failed { background: rgba(200,40,40,0.20);   color: #8a2020; }

.ecd-status-sent   { background: rgba(40,160,80,0.20);   color: #1f6638; }

.ecd-status-default { background: rgba(0,0,0,0.06); color: #555; }

/* ----- Meta grid (To / Subject / Attachments) ----- */
.ecd-meta-grid {
  margin-top: 8px;
  margin-bottom: 24px;
  border-top: 1px solid rgba(0,0,0,0.06);
  border-bottom: 1px solid rgba(0,0,0,0.06);
  padding: 14px 0;
}

.ecd-meta-row {
  display: flex;
  gap: 16px;
  padding: 6px 0;
  font-size: 13px;
}

.ecd-meta-label {
  flex-shrink: 0;
  width: 100px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--ds-text-muted, #888);
  padding-top: 2px;
}

.ecd-meta-value {
  flex: 1;
  color: var(--ds-text, #1a1a1a);
  word-break: break-word;
}

.ecd-attachment {
  display: inline-block;
  margin-right: 8px;
  margin-bottom: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(0,0,0,0.05);
  font-size: 12px;
  color: var(--ds-text, #2a2a2a);
}

.ecd-no-attachments {
  color: var(--ds-text-muted, #999);
  font-style: italic;
  font-size: 12px;
}

/* ----- Body text ----- */
.ecd-body-section {
  margin-top: 8px;
}

.ecd-body-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--ds-text-muted, #888);
  margin-bottom: 8px;
}

.ecd-body-text {
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ds-text, #1a1a1a);
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(255,255,255,0.5);
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 8px;
  padding: 14px 16px;
  min-height: 80px;
}

/* ----- Action bar ----- */
.ecd-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 24px;
  border-top: 1px solid rgba(0,0,0,0.10);
  flex-shrink: 0;  /* stays visible at bottom of overlay */
  background: var(--ds-card-bg, #faf6ee);  /* match overlay-inner bg */
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
}

.ecd-actions-spacer {
  flex: 1;
}

.ecd-btn {
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid rgba(0,0,0,0.12);
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.ecd-btn:hover {
  border-color: rgba(0,0,0,0.25);
}

.ecd-btn-edit {
  background: transparent;
  color: var(--ds-text, #2a2a2a);
}

.ecd-btn-edit:hover {
  background: rgba(0,0,0,0.04);
  border-color: rgba(0,0,0,0.30);
}

.ecd-btn-send {
  background: var(--ds-text, #1a1a1a);
  color: #fff;
  border-color: var(--ds-text, #1a1a1a);
}

.ecd-btn-send:hover {
  background: #000;
  border-color: #000;
}

.ecd-btn-delete {
  color: #a02525;
}

.ecd-btn-delete:hover {
  background: rgba(160,30,30,0.06);
  border-color: rgba(160,30,30,0.30);
}

.ecd-btn-followup {
  color: #1e5fa8;
  border-color: rgba(30,95,168,0.20);
}

.ecd-btn-followup:hover {
  background: rgba(30,95,168,0.06);
  border-color: rgba(30,95,168,0.40);
}

.ecd-btn-back {
  margin-top: 16px;
}

/* ----- Empty state inside detail ----- */
.ecd-empty {
  padding: 60px 24px;
  text-align: center;
  color: var(--ds-text-muted, #777);
}

/* === end migrated from styles-additions-v13.css === */


/* === migrated from components.css === */
/* ===== Touch modal ===== */
.touch-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 14, 0.55);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 16px 18vh;
  overflow-y: auto;
}

.touch-modal-overlay.touch-modal-open {
  display: flex;
}

.touch-modal {
  background: #fdfcf9;
  border-radius: 10px;
  width: 100%;
  max-width: 540px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.25);
  overflow: hidden;
  font-family: 'IBM Plex Sans', sans-serif;
}

.touch-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 22px 24px 10px;
  border-bottom: 1px solid #ebe7df;
}

.touch-modal-header h2 {
  margin: 0;
  font-family: 'Fraunces', serif;
  font-size: 22px;
  font-weight: 500;
  color: #1a1a1a;
}

.touch-modal-subtitle {
  margin-top: 4px;
  font-size: 13px;
  color: #6b6960;
}

.touch-modal-close {
  background: transparent;
  border: 0;
  font-size: 24px;
  color: #888780;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}

.touch-modal-close:hover { color: #1a1a1a; }

.touch-modal-form {
  padding: 16px 24px 20px;
}

.touch-modal-form select,
.touch-modal-form textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d8d6d0;
  border-radius: 6px;
  font: inherit;
  font-size: 14px;
  background: #fff;
  color: #1a1a1a;
}

.touch-modal-form textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.45;
  font-family: 'IBM Plex Sans', sans-serif;
}

.touch-modal-form select:focus,
.touch-modal-form textarea:focus,
.touch-modal-form input:focus {
  outline: 2px solid #378ADD;
  outline-offset: -1px;
  border-color: transparent;
}

.touch-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid #ebe7df;
}

/* ===== Account Edit Modal ===== */
.aem-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 14, 0.55);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 16px 18vh;
  overflow-y: auto;
}

.aem-overlay.aem-open { display: flex; }

.aem-modal {
  background: #fdfcf9;
  border-radius: 10px;
  width: 100%;
  max-width: 540px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.25);
  overflow: hidden;
  font-family: 'IBM Plex Sans', sans-serif;
}

.aem-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 24px 14px;
  border-bottom: 1px solid #ebe7df;
}

.aem-header h2 {
  margin: 0;
  font-family: 'Fraunces', serif;
  font-size: 22px;
  font-weight: 500;
  color: #1a1a1a;
}

.aem-close {
  background: transparent;
  border: 0;
  font-size: 24px;
  color: #888780;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}

.aem-close:hover { color: #1a1a1a; }

.aem-form {
  padding: 16px 24px 20px;
}

.aem-row { margin-bottom: 14px; }

.aem-row-grid {
  display: grid;
  grid-template-columns: 1fr 100px;
  gap: 14px;
}

.aem-row-grid-3 {
  display: grid;
  grid-template-columns: 1fr 80px 100px;
  gap: 14px;
}

@media (max-width: 480px) {
  .aem-row-grid-3 { grid-template-columns: 1fr; }
}

.aem-row label {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #888780;
}

.aem-form input,
.aem-form textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d8d6d0;
  border-radius: 6px;
  font: inherit;
  font-size: 14px;
  background: #fff;
  color: #1a1a1a;
  font-family: 'IBM Plex Sans', sans-serif;
}

.aem-form textarea {
  resize: vertical;
  min-height: 60px;
  line-height: 1.45;
}

.aem-form input:focus,
.aem-form textarea:focus {
  outline: 2px solid #378ADD;
  outline-offset: -1px;
  border-color: transparent;
}

.aem-section-divider {
  margin: 16px 0 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #b3b0a6;
  border-top: 1px solid #f3f0e9;
  padding-top: 14px;
}

.aem-error {
  background: #FAECE7;
  color: #993C1D;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 12px;
}

.aem-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid #ebe7df;
}

.aem-spacer { flex: 1; }

.aem-delete,
.aem-cancel,
.aem-save {
  padding: 9px 18px;
  border-radius: 6px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid transparent;
}

.aem-delete {
  background: transparent;
  color: #993C1D;
  border-color: #FAECE7;
}

.aem-delete:hover { background: #FAECE7; }

.aem-cancel {
  background: #fff;
  color: #1a1a1a;
  border-color: #d8d6d0;
}

.aem-cancel:hover { background: #f7f5f1; }

.aem-save {
  background: #1a1a1a;
  color: #fff;
}

.aem-save:hover { background: #2a2a2a; }

.aem-save:disabled { opacity: 0.6; cursor: not-allowed; }

/* ===== Account Picker Modal ===== */
.apm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 14, 0.55);
  display: none;
  /* MB22 c3.2: layout + overflow now inherited from the universal
     .fmn-modal-overlay rule. align-items/justify-content/overflow
     intentionally removed here so the base wins without conflict. */
  padding: 8vh 16px 18vh;
}

.apm-overlay.apm-open { display: flex; }

.apm-modal {
  background: #fdfcf9;
  border-radius: 10px;
  width: 100%;
  max-width: 480px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0,0,0,0.25);
  overflow: hidden;
  font-family: 'IBM Plex Sans', sans-serif;
}

.apm-header {
  padding: 18px 24px 12px;
  border-bottom: 1px solid #ebe7df;
}

.apm-header h2 {
  margin: 0 0 10px;
  font-family: 'Fraunces', serif;
  font-size: 20px;
  font-weight: 500;
  color: #1a1a1a;
}

.apm-search {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d8d6d0;
  border-radius: 6px;
  font: inherit;
  font-size: 14px;
}

.apm-search:focus {
  outline: 2px solid #378ADD;
  outline-offset: -1px;
  border-color: transparent;
}

.apm-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.apm-row {
  padding: 10px 24px;
  cursor: pointer;
  transition: background 0.1s;
  border-bottom: 1px solid #f3f0e9;
}

.apm-row:hover {
  background: #f7f5f1;
}

.apm-row-name {
  font-weight: 500;
  color: #1a1a1a;
  font-size: 14px;
}

.apm-row-meta {
  font-size: 12px;
  color: #888780;
  margin-top: 2px;
}

.apm-empty {
  padding: 24px;
  text-align: center;
  color: #b3b0a6;
  font-size: 13px;
}

/* ===== Touch Detail Modal ===== */
.tdm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 14, 0.55);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 16px 18vh;
  overflow-y: auto;
  /* v0.34.0 - CSS z-index floor (was MISSING). Touch-detail is almost always
     opened FROM another modal (a linked touch/email inside quote-detail). With
     no floor it fell behind quote-detail's hardcoded 1020 whenever the JS
     ModalStacking heuristic failed to detect the launcher. Belt-and-suspenders
     like .qdm-overlay: sit at the modal layer, escalate to from-modal when open.
     The JS utility still adds an inline z-index on top of this when it fires. */
  z-index: var(--z-modal, 1010);
}

.tdm-overlay.tdm-open {
  display: flex;
  /* v0.34.0 - sit at the nested-popup tier so touch-detail opened FROM the
     quote-detail modal (which is at from-modal/1020) reliably renders ON TOP,
     not behind, even if the JS stacking heuristic does not fire. */
  z-index: var(--z-modal-popup, 1030);
}

.tdm-modal {
  background: #fdfcf9;
  border-radius: 10px;
  width: 100%;
  max-width: 600px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.25);
  overflow: hidden;
  font-family: 'IBM Plex Sans', sans-serif;
}

.tdm-content { display: flex; flex-direction: column; }

.tdm-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 22px 24px 18px;
  border-bottom: 1px solid #ebe7df;
}

.tdm-header-text { flex: 1; min-width: 0; padding-right: 12px; }

.tdm-channel-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.tdm-icon {
  font-size: 20px;
  color: #6b6960;
}

.tdm-title {
  margin: 0;
  font-family: 'Fraunces', serif;
  font-size: 22px;
  font-weight: 500;
  color: #1a1a1a;
}

.tdm-direction-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #6b6960;
  background: #f3f0e9;
  padding: 3px 8px;
  border-radius: 4px;
}

.tdm-subtitle {
  font-size: 14px;
  color: #6b6960;
  margin-bottom: 6px;
}

.tdm-subtitle strong { color: #1a1a1a; font-weight: 600; }

.tdm-meta-line {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tdm-date {
  font-size: 13px;
  color: #888780;
}

.tdm-status-completed {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: #1D9E75;
  background: #E1F5EE;
  padding: 3px 8px;
  border-radius: 4px;
}

.tdm-close {
  background: transparent;
  border: 0;
  font-size: 24px;
  color: #888780;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}

.tdm-close:hover { color: #1a1a1a; }

/* Sections */
.tdm-section {
  padding: 18px 24px;
  border-bottom: 1px solid #f3f0e9;
}

.tdm-section:last-of-type { border-bottom: 0; }

.tdm-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.tdm-section-label {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #888780;
}

.tdm-section-count {
  display: inline-block;
  margin-left: 4px;
  color: #b3b0a6;
  font-weight: 500;
}

.tdm-edit-body, .tdm-plan-followup {
  background: transparent;
  border: 1px solid #d8d6d0;
  border-radius: 5px;
  font: inherit;
  font-size: 12px;
  padding: 5px 10px;
  cursor: pointer;
  color: #6b6960;
}

.tdm-edit-body:hover, .tdm-plan-followup:hover {
  background: #f7f5f1;
  border-color: #1a1a1a;
  color: #1a1a1a;
}

.tdm-body {
  font-size: 14px;
  color: #1a1a1a;
  line-height: 1.5;
  white-space: pre-wrap;
}

.tdm-empty { color: #b3b0a6; font-style: italic; }

/* Inline edit */
.tdm-body-edit { display: flex; flex-direction: column; gap: 8px; }

.tdm-body-textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #d8d6d0;
  border-radius: 6px;
  font: inherit;
  font-size: 14px;
  background: #fff;
  color: #1a1a1a;
  font-family: 'IBM Plex Sans', sans-serif;
  resize: vertical;
  line-height: 1.5;
}

.tdm-body-textarea:focus {
  outline: 2px solid #378ADD;
  outline-offset: -1px;
  border-color: transparent;
}

.tdm-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.tdm-edit-cancel, .tdm-edit-save {
  padding: 6px 12px;
  border-radius: 5px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid transparent;
}

.tdm-edit-cancel {
  background: #fff;
  color: #1a1a1a;
  border-color: #d8d6d0;
}

.tdm-edit-cancel:hover { background: #f7f5f1; }

.tdm-edit-save { background: #1a1a1a; color: #fff; }

.tdm-edit-save:hover { background: #2a2a2a; }

.tdm-edit-save:disabled { opacity: 0.6; cursor: not-allowed; }

/* Touch references (parent + children) */
.tdm-touch-ref {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #f0e8d3;
  border-radius: 6px;
  background: #fdfaf3;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  margin-bottom: 6px;
}

.tdm-touch-ref:hover {
  background: #faf3e3;
  border-color: #C49B3A;
}

.tdm-touch-ref-arrow {
  flex: 0 0 18px;
  font-size: 16px;
  color: #888780;
  text-align: center;
  font-weight: 600;
}

.tdm-touch-ref-content { flex: 1; min-width: 0; }

.tdm-touch-ref-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: #6b6960;
  margin-bottom: 3px;
  flex-wrap: wrap;
}

.tdm-touch-ref-date { color: #888780; }

.tdm-touch-ref-body {
  font-size: 13px;
  color: #1a1a1a;
  line-height: 1.4;
}

.tdm-empty-followups {
  font-size: 13px;
  color: #b3b0a6;
  padding: 12px;
  text-align: center;
  background: #f7f5f1;
  border-radius: 6px;
  font-style: italic;
}

.tdm-followups {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Meta details */
.tdm-meta-list {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 6px 16px;
  margin: 0;
  font-size: 13px;
}

.tdm-meta-list dt {
  color: #888780;
  font-weight: 500;
}

.tdm-meta-list dd {
  margin: 0;
  color: #1a1a1a;
}

.tdm-attachments-coming {
  font-size: 13px;
  color: #b3b0a6;
  padding: 16px;
  text-align: center;
  background: #f7f5f1;
  border-radius: 6px;
  font-style: italic;
}

/* Footer */
.tdm-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid #ebe7df;
  background: #fdfcf9;
}

.tdm-spacer { flex: 1; }

.tdm-btn-delete, .tdm-btn-close {
  padding: 9px 18px;
  border-radius: 6px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid transparent;
}

.tdm-btn-delete {
  background: transparent;
  color: #993C1D;
  border-color: #FAECE7;
}

.tdm-btn-delete:hover { background: #FAECE7; }

.tdm-btn-close {
  background: #1a1a1a;
  color: #fff;
}

.tdm-btn-close:hover { background: #2a2a2a; }

/* ---------- Quote modal ---------- */
.qm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 14, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s;
  overflow-y: auto;
  padding: 5vh 16px;
}

.qm-overlay.qm-open {
  opacity: 1;
  pointer-events: auto;
}

.qm-modal {
  background: var(--paper, #faf8f3);
  border-radius: 12px;
  width: 100%;
  max-width: 600px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
  margin: 0 auto;
  overflow: hidden;
}

.qm-content { padding: 0; }

.qm-header {
  padding: 20px 24px 12px;
  border-bottom: 1px solid #e6e1d5;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.qm-title-text {
  font-family: 'Fraunces', serif;
  font-size: 1.4rem;
  font-weight: 600;
  margin: 0 0 4px 0;
  color: #2a2a2a;
}

.qm-subtitle {
  font-size: 0.9rem;
  color: #6b6960;
}

.qm-subtitle code {
  background: #f3f0e9;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.85rem;
}

.qm-close {
  background: transparent;
  border: none;
  font-size: 1.6rem;
  color: #888780;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.qm-close:hover { background: #ece7db; color: #2a2a2a; }

.qm-origin-strip {
  background: #E1F5EE;
  border-left: 3px solid #1D9E75;
  margin: 0 24px;
  padding: 10px 14px;
  font-size: 0.86rem;
  color: #2a2a2a;
  margin-top: 14px;
  border-radius: 4px;
}

.qm-form {
  padding: 16px 24px 20px;
}

.qm-row { margin-bottom: 14px; }

.qm-row-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.qm-row-grid .qm-row { margin-bottom: 0; }

.qm-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: #2a2a2a;
  margin-bottom: 4px;
}

.qm-req {
  background: #FAECE7;
  color: #993C1D;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 500;
  margin-left: 4px;
}

.qm-hint {
  color: #888780;
  font-weight: 400;
  font-size: 0.78rem;
  margin-left: 4px;
}

.qm-input {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d8d2c4;
  border-radius: 6px;
  background: white;
  font-family: inherit;
  font-size: 0.95rem;
  color: #2a2a2a;
  box-sizing: border-box;
}

.qm-input:focus {
  outline: none;
  border-color: #1F5D9D;
  box-shadow: 0 0 0 3px rgba(31, 93, 157, 0.15);
}

.qm-tag-input {
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.qm-amount-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.qm-currency-prefix {
  position: absolute;
  left: 10px;
  color: #888780;
  pointer-events: none;
  font-weight: 500;
}

.qm-amount-input { padding-left: 22px; }

.qm-prob-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.qm-prob-wrap input[type=range] { flex: 1; }

.qm-prob-display {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  color: #1F5D9D;
  min-width: 42px;
  text-align: right;
}

.qm-quick-status {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  align-items: center;
  flex-wrap: wrap;
}

.qm-quick-label {
  font-size: 0.82rem;
  color: #888780;
}

.qm-quick-btn {
  background: #FAEEDA;
  color: #996024;
  border: 1px solid #EBC685;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s;
}

.qm-quick-btn:hover {
  background: #996024;
  color: white;
  border-color: #996024;
}

.qm-error {
  background: #FAECE7;
  color: #993C1D;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 0.86rem;
  margin-bottom: 14px;
}

.qm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 8px;
}

.qm-btn-cancel {
  background: transparent;
  color: #6b6960;
  border: 1px solid #d8d2c4;
  border-radius: 6px;
  padding: 8px 18px;
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}

.qm-btn-cancel:hover { background: #f3f0e9; }

.qm-btn-submit {
  background: #1D9E75;
  color: white;
  border: 1px solid #1D9E75;
  border-radius: 6px;
  padding: 8px 18px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.qm-btn-submit:hover { background: #18815f; }

.qm-btn-submit:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Quote detail modal ---------- */
.qdm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 14, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  /* MB24 c2.3: was z-index:200 (anomalously low — below every modal overlay,
     which sit at 1000+). Quote-detail opened from touch-detail/account-panel
     rendered BEHIND its launcher. Raised to the modal layer; the open-state
     rule below escalates to the from-modal layer since quote-detail is almost
     always launched from another modal. Belt-and-suspenders with the JS
     ModalStacking utility — CSS alone now guarantees correct layering. */
  z-index: var(--z-modal, 1010);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s;
  overflow-y: auto;
  padding: 5vh 16px;
}

.qdm-overlay.qdm-open {
  opacity: 1;
  pointer-events: auto;
  /* MB24 c2.3: sit at the modal-from-modal layer when open (quote-detail is
     launched from touch-detail, account panel, or the quotes list). */
  z-index: var(--z-modal-from-modal, 1020);
}

.qdm-modal {
  background: var(--paper, #faf8f3);
  border-radius: 12px;
  width: 100%;
  max-width: 680px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
  margin: 0 auto;
  overflow: hidden;
}

.qdm-content { padding: 0; }

.qdm-header {
  padding: 20px 24px 14px;
  border-bottom: 1px solid #e6e1d5;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.qdm-id-row {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.qdm-serial {
  background: #f3f0e9;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.86rem;
  color: #5b5950;
}

.qdm-tag {
  background: #E6F1FB;
  color: #1F5D9D;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.82rem;
  font-weight: 600;
}

.qdm-title {
  font-family: 'Fraunces', serif;
  font-size: 1.5rem;
  font-weight: 600;
  margin: 6px 0 4px 0;
  color: #2a2a2a;
}

.qdm-account-line {
  font-size: 0.95rem;
  color: #6b6960;
}

.qdm-close {
  background: transparent;
  border: none;
  font-size: 1.6rem;
  color: #888780;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
}

.qdm-close:hover { background: #ece7db; color: #2a2a2a; }

.qdm-section {
  padding: 14px 24px;
  border-bottom: 1px solid #e6e1d5;
}

.qdm-section:last-of-type { border-bottom: none; }

.qdm-section-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #6b6960;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 10px 0;
}

.qdm-section-count {
  display: inline-block;
  padding: 1px 8px;
  background: #f3f0e9;
  color: #6b6960;
  border-radius: 10px;
  font-size: 0.74rem;
  font-weight: 500;
  margin-left: 4px;
}

.qdm-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.qdm-stats-section { background: #f7f4ec; }

.qdm-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.qdm-stat label {
  display: block;
  font-size: 0.74rem;
  color: #888780;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.qdm-stat strong {
  display: block;
  font-size: 1.2rem;
  font-family: 'Fraunces', serif;
  color: #2a2a2a;
  font-weight: 600;
}

.qdm-stat span {
  display: block;
  font-size: 0.78rem;
  color: #888780;
  margin-top: 2px;
}

.qdm-body {
  font-size: 0.92rem;
  color: #2a2a2a;
  line-height: 1.55;
  background: white;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid #ece7db;
}

.qdm-notes { background: #FAEEDA; border-color: #EBC685; }

.qdm-origin-section { background: #E1F5EE; }

.qdm-origin-note {
  font-size: 0.82rem;
  color: #18815f;
  margin-top: 6px;
  font-style: italic;
}

.qdm-no-origin {
  font-size: 0.88rem;
  color: #6b6960;
  padding: 8px 12px;
  background: white;
  border-radius: 6px;
  border: 1px dashed #d8d2c4;
}

.qdm-empty {
  font-size: 0.88rem;
  color: #888780;
  font-style: italic;
  padding: 8px;
  text-align: center;
}

.qdm-touch-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.qdm-touch-ref {
  display: flex;
  gap: 10px;
  padding: 8px 10px;
  background: white;
  border: 1px solid #ece7db;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.12s;
}

.qdm-touch-ref:hover {
  background: #f7f4ec;
  border-color: #d8d2c4;
}

.qdm-touch-ref-marker {
  font-size: 1.1rem;
  color: #1D9E75;
  font-weight: 700;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.qdm-touch-ref-content { flex: 1; min-width: 0; }

.qdm-touch-ref-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 0.84rem;
  margin-bottom: 2px;
  flex-wrap: wrap;
}

.qdm-touch-ref-date { color: #888780; }

.qdm-touch-ref-body {
  font-size: 0.84rem;
  color: #6b6960;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qdm-status-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.qdm-status-btn {
  background: white;
  border: 1px solid;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s;
}

.qdm-status-btn:hover {
  background: currentColor;
  filter: brightness(0.94);
}

.qdm-status-btn:hover { color: white !important; }

.qdm-meta-section { background: #f7f4ec; }

.qdm-meta-list {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 6px 14px;
  margin: 0;
  font-size: 0.84rem;
}

.qdm-meta-list dt { color: #888780; font-weight: 500; }

.qdm-meta-list dd { margin: 0; color: #2a2a2a; }

.qdm-attachments-coming {
  margin-top: 10px;
  padding: 10px;
  background: white;
  border: 1px dashed #d8d2c4;
  border-radius: 6px;
  font-size: 0.82rem;
  color: #888780;
  text-align: center;
}

.qdm-footer {
  padding: 14px 24px;
  background: #f3f0e9;
  display: flex;
  align-items: center;
  gap: 10px;
}

.qdm-btn-delete {
  background: transparent;
  border: 1px solid #FAECE7;
  color: #993C1D;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 0.86rem;
  cursor: pointer;
  font-family: inherit;
}

.qdm-btn-delete:hover { background: #993C1D; color: white; border-color: #993C1D; }

.qdm-btn-edit {
  background: white;
  border: 1px solid #d8d2c4;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}

.qdm-btn-edit:hover { background: #1F5D9D; color: white; border-color: #1F5D9D; }

.qdm-btn-close {
  background: transparent;
  border: 1px solid #d8d2c4;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 0.86rem;
  cursor: pointer;
  font-family: inherit;
}

.qdm-btn-close:hover { background: #ece7db; }

.qdm-spacer { flex: 1; }

/* ---------- Touch detail: linked quotes section additions ---------- */
.tdm-convert-quote {
  background: #E1F5EE;
  color: #1D9E75;
  border: 1px solid #B5E0CD;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s;
}

.tdm-convert-quote:hover {
  background: #1D9E75;
  color: white;
  border-color: #1D9E75;
}

.tdm-empty-quotes {
  padding: 12px;
  background: #FAEEDA;
  color: #6b5b3d;
  border: 1px dashed #EBC685;
  border-radius: 6px;
  font-size: 0.86rem;
  line-height: 1.5;
}

.tdm-quotes {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tdm-quote-ref {
  display: flex;
  gap: 10px;
  padding: 8px 10px;
  background: white;
  border: 1px solid #ece7db;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.12s;
}

.tdm-quote-ref:hover {
  background: #f7f4ec;
  border-color: #1D9E75;
}

.tdm-quote-marker {
  font-size: 1.1rem;
  color: #1D9E75;
  font-weight: 700;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.tdm-quote-content { flex: 1; min-width: 0; }

.tdm-quote-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.tdm-quote-meta code {
  background: #f3f0e9;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.76rem;
  color: #5b5950;
}

.tdm-quote-tag {
  background: #E6F1FB !important;
  color: #1F5D9D !important;
  font-weight: 600;
}

.tdm-quote-amount {
  margin-left: auto;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  color: #1D9E75;
}

.tdm-quote-title {
  font-size: 0.9rem;
  color: #2a2a2a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Mobile responsive ---------- */
@media (max-width: 600px) {
  .qm-row-grid { grid-template-columns: 1fr; }
  .qdm-stats { grid-template-columns: 1fr 1fr; }
  .qdm-meta-list { grid-template-columns: 1fr; }
  .dash-quotes-row { flex-wrap: wrap; }
  .dqr-right { width: 100%; text-align: left; display: flex; gap: 12px; }
  .dqr-amount { font-size: 0.95rem; }
}

/* ---------- Action bar in touch detail modal ---------- */
.tdm-action-bar {
  display: flex;
  gap: 8px;
  padding: 14px 24px;
  background: linear-gradient(to bottom, #faf6ec, #f7f4ec);
  border-bottom: 1px solid #e6e1d5;
}

.tdm-action-primary,
.tdm-action-secondary,
.tdm-action-quote {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s;
  border: 1px solid;
  flex: 1;
}

.tdm-action-primary {
  background: #1F5D9D;
  color: white;
  border-color: #1F5D9D;
}

.tdm-action-primary:hover { background: #1a4f86; }

.tdm-action-secondary {
  background: white;
  color: #6b6960;
  border-color: #d8d2c4;
}

.tdm-action-secondary:hover {
  background: #f3f0e9;
  color: #2a2a2a;
  border-color: #888780;
}

.tdm-action-quote {
  background: #1D9E75;
  color: white;
  border-color: #1D9E75;
}

.tdm-action-quote:hover { background: #18815f; }

/* ---------- Customer interest badge (used in touch row + touch detail) ---------- */
.tom-interest-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ---------- Outcome data display in touch detail ---------- */
.tdm-outcome-section {
  background: #f7f4ec;
}

.tdm-outcome-quote {
  background: white;
  border-left: 3px solid #1D9E75;
  padding: 10px 12px;
  border-radius: 4px;
  margin-bottom: 12px;
}

.tdm-outcome-quote-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b6960;
  font-weight: 600;
  margin-bottom: 4px;
}

.tdm-outcome-quote-text {
  font-size: 0.95rem;
  color: #2a2a2a;
  line-height: 1.55;
  font-family: 'Fraunces', serif;
  font-style: italic;
}

.tdm-outcome-list {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 6px 14px;
  margin: 0;
  font-size: 0.86rem;
}

.tdm-outcome-list dt { color: #888780; font-weight: 500; }

.tdm-outcome-list dd { margin: 0; color: #2a2a2a; }

.tdm-internal-note {
  background: #FAEEDA;
  padding: 6px 10px;
  border-radius: 4px;
  border-left: 3px solid #EBC685;
}

.tdm-term-chip {
  display: inline-block;
  background: #E6F1FB;
  color: #1F5D9D;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.78rem;
  margin-right: 4px;
  margin-bottom: 2px;
  font-family: 'IBM Plex Mono', monospace;
}

/* ---------- Outcome modal (TouchOutcomeModal / .tom-) ---------- */
.tom-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 14, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 220;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s;
  overflow-y: auto;
  padding: 4vh 16px;
}

.tom-overlay.tom-open {
  opacity: 1;
  pointer-events: auto;
}

.tom-modal {
  background: var(--paper, #faf8f3);
  border-radius: 12px;
  width: 100%;
  max-width: 720px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
  margin: 0 auto;
  overflow: hidden;
}

.tom-content { padding: 0; }

.tom-header {
  padding: 20px 24px 14px;
  border-bottom: 1px solid #e6e1d5;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(to bottom, white, #faf8f3);
}

.tom-title {
  font-family: 'Fraunces', serif;
  font-size: 1.6rem;
  font-weight: 600;
  margin: 0 0 4px 0;
  color: #2a2a2a;
}

.tom-subtitle {
  font-size: 0.95rem;
  color: #6b6960;
}

.tom-close {
  background: transparent;
  border: none;
  font-size: 1.6rem;
  color: #888780;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tom-close:hover { background: #ece7db; color: #2a2a2a; }

.tom-form { padding: 18px 24px 24px; }

.tom-section { margin-bottom: 18px; }

.tom-section-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}

.tom-section-grid .tom-section { margin-bottom: 0; }

.tom-section-label {
  display: block;
  font-size: 0.86rem;
  font-weight: 600;
  color: #2a2a2a;
  margin-bottom: 6px;
}

.tom-req {
  background: #FAECE7;
  color: #993C1D;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 500;
  margin-left: 4px;
}

.tom-hint {
  color: #888780;
  font-weight: 400;
  font-size: 0.78rem;
}

/* The 4 path buttons */
.tom-paths {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.tom-path-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  background: white;
  border: 2px solid #ece7db;
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: all 0.12s;
}

.tom-path-btn:hover {
  border-color: var(--path-color, #888780);
  background: var(--path-bg, #f3f0e9);
}

.tom-path-btn.tom-path-active {
  border-color: var(--path-color, #888780);
  background: var(--path-bg, #f3f0e9);
  box-shadow: 0 0 0 3px rgba(0,0,0,0.04);
}

.tom-path-btn strong {
  font-size: 1rem;
  color: var(--path-color, #2a2a2a);
  font-weight: 600;
  margin-bottom: 4px;
}

.tom-path-btn span {
  font-size: 0.82rem;
  color: #6b6960;
  font-weight: 400;
}

/* Details — hidden until path picked */
.tom-details {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.3s, opacity 0.3s;
}

.tom-details.tom-details-shown {
  max-height: 2000px;
  opacity: 1;
  margin-top: 18px;
}

/* "What did they say" — emphasized */
.tom-section-priority {
  background: #E1F5EE;
  border: 1px solid #B5E0CD;
  border-radius: 8px;
  padding: 14px;
}

.tom-section-priority .tom-section-label { color: #18815f; }

.tom-priority-note {
  font-size: 0.82rem;
  color: #18815f;
  margin-top: 6px;
  font-style: italic;
}

.tom-input {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d8d2c4;
  border-radius: 6px;
  background: white;
  font-family: inherit;
  font-size: 0.95rem;
  color: #2a2a2a;
  box-sizing: border-box;
  resize: vertical;
}

.tom-input:focus {
  outline: none;
  border-color: #1D9E75;
  box-shadow: 0 0 0 3px rgba(29, 158, 117, 0.18);
}

/* Interest pills */
.tom-interest-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tom-interest-pill {
  background: white;
  border: 1px solid #d8d2c4;
  border-radius: 18px;
  padding: 6px 14px;
  font-size: 0.86rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s;
  color: #6b6960;
}

.tom-interest-pill:hover {
  background: var(--p-bg, #f3f0e9);
  color: var(--p-color, #2a2a2a);
  border-color: var(--p-color, #888780);
}

.tom-interest-pill.tom-interest-active {
  background: var(--p-color, #1F5D9D);
  color: white;
  border-color: var(--p-color, #1F5D9D);
  font-weight: 600;
}

.tom-error {
  background: #FAECE7;
  color: #993C1D;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 0.86rem;
  margin-bottom: 14px;
}

.tom-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid #ece7db;
  margin-top: 18px;
  flex-wrap: wrap;
}

.tom-followup-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tom-followup-btn {
  background: white;
  border: 1px dashed #d8d2c4;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.84rem;
  cursor: pointer;
  font-family: inherit;
  color: #6b6960;
  transition: all 0.12s;
}

.tom-followup-btn:hover {
  background: #f3f0e9;
  color: #2a2a2a;
  border-style: solid;
}

.tom-followup-btn.tom-followup-active {
  background: #1F5D9D;
  color: white;
  border-color: #1F5D9D;
  border-style: solid;
}

.tom-quote-btn.tom-followup-active {
  background: #1D9E75;
  border-color: #1D9E75;
}

.tom-spacer { flex: 1; }

.tom-btn-cancel {
  background: transparent;
  color: #6b6960;
  border: 1px solid #d8d2c4;
  border-radius: 6px;
  padding: 8px 18px;
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}

.tom-btn-cancel:hover { background: #f3f0e9; }

.tom-btn-save {
  background: #1D9E75;
  color: white;
  border: 1px solid #1D9E75;
  border-radius: 6px;
  padding: 8px 22px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.tom-btn-save:hover { background: #18815f; }

.tom-btn-save:disabled { opacity: 0.5; cursor: not-allowed; }

/* Mobile */
@media (max-width: 600px) {
  .tom-paths { grid-template-columns: 1fr; }
  .tom-section-grid { grid-template-columns: 1fr; }
  .tdm-action-bar { flex-direction: column; }
  .tcpanel-action-bar { flex-direction: column; }
}

/* ---------- Intent dot in touch detail header & touch row ---------- */
.tdm-intent-dot,
.tcpr-intent-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #b3b0a6;
  margin-left: 6px;
  flex-shrink: 0;
  cursor: help;
}

/* ---------- Signals section in touch detail modal ---------- */
.tdm-signals-section {
  background: linear-gradient(to bottom, #f7f4ec 0%, #faf8f3 100%);
  border-top: 2px solid #E1F5EE;
}

.tdm-signals-meta {
  flex: 1;
  font-size: 0.78rem;
  color: #888780;
  margin-left: auto;
  margin-right: 8px;
  text-align: right;
  font-family: 'IBM Plex Mono', monospace;
}

.tdm-signals-retry {
  background: white;
  border: 1px solid #d8d2c4;
  color: #6b6960;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.12s;
}

.tdm-signals-retry:hover { background: #f3f0e9; color: #2a2a2a; }

.tdm-signals-retry:disabled { opacity: 0.5; cursor: not-allowed; }

.tdm-signals-pending,
.tdm-signals-error { background: #f7f4ec; }

.tdm-signals-pending-msg {
  padding: 12px;
  background: white;
  border: 1px dashed #d8d2c4;
  border-radius: 6px;
  font-size: 0.86rem;
  color: #6b6960;
  text-align: center;
}

.tdm-signals-spinner {
  display: inline-block;
  margin-right: 4px;
  animation: ai-pill-spin 1.2s linear infinite;
}

.tdm-signals-error-msg {
  padding: 10px 12px;
  background: #FAECE7;
  border: 1px solid #EBB7A4;
  border-radius: 6px;
  font-size: 0.86rem;
  color: #993C1D;
}

.tdm-signal-summary {
  background: white;
  border-left: 3px solid #1D9E75;
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 0.95rem;
  color: #2a2a2a;
  line-height: 1.55;
  margin-bottom: 12px;
  font-family: 'Fraunces', serif;
}

.tdm-signal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.tdm-signal-cell {
  background: white;
  border: 1px solid #ece7db;
  border-radius: 6px;
  padding: 8px 12px;
}

.tdm-signal-cell label {
  display: block;
  font-size: 0.72rem;
  color: #888780;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.tdm-signal-cell strong {
  display: block;
  font-size: 0.95rem;
  color: #2a2a2a;
  text-transform: capitalize;
}

.tdm-signal-cell span {
  display: block;
  font-size: 0.78rem;
  color: #888780;
  margin-top: 2px;
  font-family: 'IBM Plex Mono', monospace;
}

/* Intent color overrides for the strong tag in signal cell */
.tdm-signal-cell strong.tdm-intent-buying_signal      { color: #1D9E75; }

.tdm-signal-cell strong.tdm-intent-objection          { color: #993C1D; }

.tdm-signal-cell strong.tdm-intent-stalling           { color: #996024; }

.tdm-signal-cell strong.tdm-intent-info_gathering     { color: #1F5D9D; }

.tdm-signal-cell strong.tdm-intent-relationship_building { color: #6b5b9d; }

.tdm-signal-cell strong.tdm-intent-decline            { color: #993C1D; }

.tdm-signal-cell strong.tdm-sentiment-positive        { color: #1D9E75; }

.tdm-signal-cell strong.tdm-sentiment-negative        { color: #993C1D; }

.tdm-signal-cell strong.tdm-sentiment-mixed           { color: #996024; }

.tdm-signal-cell strong.tdm-sentiment-neutral         { color: #6b6960; }

.tdm-signal-block {
  background: white;
  border: 1px solid #ece7db;
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 8px;
}

.tdm-signal-block-buying { border-left: 3px solid #1D9E75; }

.tdm-signal-block-risk   { border-left: 3px solid #996024; }

.tdm-signal-block-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: #2a2a2a;
  margin-bottom: 6px;
}

.tdm-signal-item {
  font-size: 0.88rem;
  color: #2a2a2a;
  margin-bottom: 4px;
  cursor: help;
}

.tdm-signal-item strong {
  font-weight: 500;
}

.tdm-signal-evidence {
  display: block;
  font-size: 0.78rem;
  color: #6b6960;
  font-style: italic;
  font-family: 'Fraunces', serif;
  padding-left: 12px;
  margin-top: 1px;
  border-left: 2px solid #f3f0e9;
}

.tdm-topic-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tdm-topic-chip {
  background: #E6F1FB;
  color: #1F5D9D;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.78rem;
  text-transform: lowercase;
}

.tdm-facts-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.tdm-fact-row {
  font-size: 0.84rem;
  color: #2a2a2a;
  padding: 3px 8px;
  background: #f7f4ec;
  border-radius: 4px;
  font-family: 'IBM Plex Mono', monospace;
}

.tdm-signals-thin {
  font-size: 0.84rem;
  color: #888780;
  font-style: italic;
  padding: 8px 0;
}

/* Mobile */
@media (max-width: 600px) {
  .tdm-signal-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   SECTION — Z-index fixes, quote-touch bridge styling (Sprint 4.1)
   Originally: styles-additions-v10.css
   ============================================================ */
/* MB21 c3: legacy z-index re-declarations retired — c3a class hierarchy (.fmn-modal-overlay/.fmn-modal-content/.fmn-modal-from-modal) now owns these layers via the doubled-class hoist in styles-additions-v34.css. */
/* Quote panel: + Log a touch button matches the existing convert-quote button */
.qdm-log-touch {
  background: #E6F1FB;
  color: #1F5D9D;
  border: 1px solid #B5D2EE;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s;
}

.qdm-log-touch:hover {
  background: #1F5D9D;
  color: white;
  border-color: #1F5D9D;
}

/* MB21 c4: the components.css c3a-era duplicates of .fmn-modal-overlay /
   .fmn-modal-content / .fmn-modal-from-modal* / .fmn-popover /
   .fmn-side-panel / .fmn-toast (added in c3a fixup 826b47d as a
   parallel to the v34.css doubled-class hoist) were migrated here
   by the c4 classifier but are redundant with the v34-migrated rules
   at the top of this file (which arrived first in source order and
   are identical now that the doubled-class hack is dropped). Removed
   the duplicates to keep modals.css single-source-of-truth. */

/* === end migrated from components.css === */

/* ============================================================
   MB22 c2 — JournalEntry modal (.jrn-*)
   Mirrors the .aem-* pattern with chip selectors for tags and
   affected dimensions, plus an inline two-tap delete confirm.
   ============================================================ */

.jrn-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 14, 0.55);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 16px 18vh;
  overflow-y: auto;
}

.jrn-overlay.jrn-open { display: flex; }

.jrn-modal {
  background: #fdfcf9;
  border-radius: 10px;
  width: 100%;
  max-width: 540px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.25);
  overflow: hidden;
  font-family: 'IBM Plex Sans', sans-serif;
}

.jrn-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 24px 14px;
  border-bottom: 1px solid #ebe7df;
}

.jrn-title {
  margin: 0;
  font-family: 'Fraunces', serif;
  font-size: 22px;
  font-weight: 500;
  color: #1a1a1a;
}

.jrn-close {
  background: transparent;
  border: 0;
  font-size: 24px;
  color: #888780;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}

.jrn-close:hover { color: #1a1a1a; }

.jrn-context {
  padding: 14px 24px 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
}

.jrn-account-pill { /* uses .account-header-name-pill from cards.css */ }

.jrn-context-subtitle {
  font-size: 12px;
  color: #888780;
}

.jrn-form {
  padding: 16px 24px 20px;
}

.jrn-row { margin-bottom: 14px; }

.jrn-row label {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #888780;
}

.jrn-form textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d8d6d0;
  border-radius: 6px;
  font: inherit;
  font-size: 14px;
  background: #fff;
  color: #1a1a1a;
  font-family: 'IBM Plex Sans', sans-serif;
  resize: vertical;
  min-height: 60px;
  line-height: 1.45;
}

.jrn-form textarea:focus {
  outline: 2px solid #378ADD;
  outline-offset: -1px;
  border-color: transparent;
}

.jrn-section-divider {
  margin: 16px 0 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #b3b0a6;
  border-top: 1px solid #f3f0e9;
  padding-top: 14px;
}

.jrn-error {
  background: #FAECE7;
  color: #993C1D;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 12px;
}

.jrn-chips,
.jrn-dimension-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.jrn-chip,
.jrn-dim-chip {
  background: #f3f0e9;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  color: #5a5852;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s ease, color 0.12s ease;
}

.jrn-chip:hover,
.jrn-dim-chip:hover { background: #e8e4d9; }

.jrn-chip-selected,
.jrn-chip-selected:hover {
  background: #1a1a1a;
  color: #FFD500;
}

.jrn-dim-chip-selected,
.jrn-dim-chip-selected:hover {
  background: #FFD500;
  color: #1a1a1a;
  font-weight: 600;
}

.jrn-custom-tag-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.jrn-custom-tag-input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid #d8d6d0;
  border-radius: 6px;
  font: inherit;
  font-size: 13px;
  background: #fff;
  color: #1a1a1a;
}

.jrn-radio-group {
  display: flex;
  gap: 14px;
}

.jrn-radio-group label {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 0;
  font-size: 13px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: #1a1a1a;
  cursor: pointer;
}

.jrn-radio-group input[type="radio"] {
  accent-color: #FFD500;
  margin: 0;
}

.jrn-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 18px;
  border-top: 1px solid #f3f0e9;
  margin-top: 8px;
}

.jrn-actions-right {
  display: flex;
  gap: 8px;
}

.jrn-delete-confirm {
  background: #faece7 !important;
  color: #993C1D !important;
}

/* ============================================================
   Account panel — Journal section (.tcpanel-journal-*)
   ============================================================ */

.tcpanel-journal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.tcpanel-journal-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tcpanel-journal-row {
  display: block;
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1px solid #ebe7df;
  border-radius: 8px;
  padding: 12px 14px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.12s ease;
}

.tcpanel-journal-row:hover { border-color: #FFD500; }

.tcpanel-journal-row-title {
  font-size: 14px;
  font-weight: 500;
  color: #1a1a1a;
  margin-bottom: 4px;
  line-height: 1.35;
}

.tcpanel-journal-row-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 11px;
  color: #888780;
  flex-wrap: wrap;
}

.tcpanel-journal-weight {
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.6px;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
}

.tcpanel-journal-weight-low    { background: #f3f0e9; color: #5a5852; }
.tcpanel-journal-weight-medium { background: #FFE680; color: #1a1a1a; }
.tcpanel-journal-weight-high   { background: #1a1a1a; color: #FFD500; }

.tcpanel-journal-tags { font-style: italic; }

.tcpanel-journal-date { margin-left: auto; }

.tcpanel-journal-outcome {
  margin-top: 6px;
  font-size: 12px;
  color: #5a5852;
  font-style: italic;
  line-height: 1.4;
}

.tcpanel-journal-empty {
  font-size: 13px;
  color: #888780;
  padding: 12px 0;
  font-style: italic;
}

.tcpanel-journal-add { font-size: 12px; }

/* MB22 c4 — auto-created journal entry marker */
.tcpanel-journal-auto {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--ds-muted-bg, #ece6da);
  color: var(--ds-muted-fg, #7a7363);
  border: 1px solid var(--ds-border, #d8d0c0);
}

/* MB22 c4.1 — account AI summary under "At a glance" */
.tcpanel-ai-summary {
  margin: 0 0 12px;
  padding: 10px 12px;
  background: var(--ds-card-bg, #faf6ee);
  border: 1px solid var(--ds-border, #e4ddcd);
  border-left: 3px solid var(--color-accent, #FFD500);
  border-radius: 8px;
}
.tcpanel-ai-summary-text {
  margin: 0 0 4px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ds-fg, #2a2620);
}
.tcpanel-ai-summary-caption {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ds-muted-fg, #8a8270);
}
.tcpanel-ai-summary-empty {
  margin: 0 0 12px;
  font-size: 13px;
  font-style: italic;
  color: var(--ds-muted-fg, #9a917f);
}

/* ============================================================
   MB22 c3 — AccountRubric character-sheet (.acr-*)
   Namespace deliberately distinct from .rp-* (RubricPanel,
   email composer). Uses tokens.css palette via var().
   ============================================================ */

.tcpanel-rubric-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.acr-overall-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.3px;
}

.acr-radar-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px 0 16px;
}

.acr-radar {
  display: inline-block;
}

.acr-dimensions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.acr-dim-row {
  display: grid;
  grid-template-columns: 100px 1fr 56px;
  gap: 12px;
  align-items: center;
  width: 100%;
  background: #fff;
  border: 1px solid var(--color-paper-200, #ECE7D8);
  border-radius: 8px;
  padding: 10px 14px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.12s ease;
}

.acr-dim-row:hover { border-color: var(--color-accent, #FFD500); }

.acr-dim-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-ink-900, #2C2C2A);
}

.acr-dim-bar-wrap {
  position: relative;
  height: 10px;
  background: var(--color-paper-100, #F4F1E8);
  border-radius: 999px;
  overflow: hidden;
}

.acr-dim-bar {
  display: block;
  height: 100%;
  border-radius: 999px;
  transition: width 0.2s ease, background 0.2s ease;
}

.acr-bar-dashed {
  background-image: repeating-linear-gradient(
    45deg,
    var(--color-paper-200) 0,
    var(--color-paper-200) 4px,
    transparent 4px,
    transparent 8px
  );
  width: 100% !important;
  background-color: transparent !important;
}

.acr-dim-score {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-ink-900, #2C2C2A);
  text-align: right;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.acr-override-badge {
  font-size: 10px;
  color: var(--color-peach-600, #B8771F);
  font-weight: 400;
}

.acr-empty-hint {
  font-size: 12px;
  color: var(--color-ink-100, #8A8783);
  font-style: italic;
  margin: 10px 0 0;
  padding: 0 4px;
}

/* ============================================================
   Editor modal (.acr-edit-*)
   ============================================================ */

.acr-edit-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 14, 0.55);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 16px 18vh;
  overflow-y: auto;
}

.acr-edit-overlay.acr-edit-open { display: flex; }

.acr-edit-modal {
  background: #fdfcf9;
  border-radius: 10px;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  font-family: 'IBM Plex Sans', sans-serif;
}

.acr-edit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 24px 14px;
  border-bottom: 1px solid var(--color-paper-200, #ebe7df);
}

.acr-edit-title {
  margin: 0;
  font-family: 'Fraunces', serif;
  font-size: 22px;
  font-weight: 500;
  color: var(--color-ink-900, #1a1a1a);
}

.acr-edit-close {
  background: transparent;
  border: 0;
  font-size: 24px;
  color: var(--color-ink-100, #888780);
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}
.acr-edit-close:hover { color: var(--color-ink-900, #1a1a1a); }

.acr-edit-context {
  padding: 14px 24px 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
}

.acr-edit-form { padding: 16px 24px 20px; }

.acr-edit-row { margin-bottom: 14px; }

.acr-edit-row label {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--color-ink-100, #888780);
}

.acr-checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 8px;
  font-size: 13px !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  font-weight: 400 !important;
  color: var(--color-ink-900, #1a1a1a) !important;
  cursor: pointer;
}
.acr-checkbox-label input[type="checkbox"] {
  accent-color: var(--color-accent, #FFD500);
  margin: 0;
}

.acr-score-input-row {
  display: flex;
  gap: 12px;
  align-items: center;
}
.acr-score-input-row input[type="range"] {
  flex: 1;
  accent-color: var(--color-accent, #FFD500);
}
.acr-score-input-row input[type="number"] {
  width: 80px;
  padding: 8px 10px;
  border: 1px solid var(--color-paper-200, #d8d6d0);
  border-radius: 6px;
  font: inherit;
  font-size: 14px;
  background: #fff;
  color: var(--color-ink-900, #1a1a1a);
  text-align: center;
}
.acr-score-input-row input[type="number"]:focus {
  outline: 2px solid #378ADD;
  outline-offset: -1px;
  border-color: transparent;
}

.acr-edit-form textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--color-paper-200, #d8d6d0);
  border-radius: 6px;
  font: inherit;
  font-size: 14px;
  background: #fff;
  color: var(--color-ink-900, #1a1a1a);
  font-family: inherit;
  resize: vertical;
  min-height: 50px;
  line-height: 1.45;
}
.acr-edit-form textarea:focus {
  outline: 2px solid #378ADD;
  outline-offset: -1px;
  border-color: transparent;
}

.acr-section-divider {
  margin: 16px 0 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--color-ink-100, #b3b0a6);
  border-top: 1px solid var(--color-paper-100, #f3f0e9);
  padding-top: 14px;
}

.acr-edit-error {
  background: var(--color-rose-50, #FAECE7);
  color: var(--color-rose-800, #993C1D);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 12px;
}

.acr-evidence-list,
.acr-history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
}

.acr-evidence-row,
.acr-history-row {
  background: var(--color-paper-50, #FAF8F2);
  border: 1px solid var(--color-paper-200, #ECE7D8);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--color-ink-700, #3A3936);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
}

.acr-evidence-text { flex: 1; min-width: 200px; }
.acr-evidence-date,
.acr-history-date { color: var(--color-ink-100, #8A8783); }

.acr-evidence-empty,
.acr-history-empty {
  font-size: 12px;
  color: var(--color-ink-100, #8A8783);
  font-style: italic;
  padding: 6px 0;
}

.acr-evidence-more {
  font-size: 11px;
  color: var(--color-ink-100, #8A8783);
  text-align: center;
  padding: 4px;
}

.acr-history-score {
  font-weight: 600;
  color: var(--color-ink-900, #2C2C2A);
}

.acr-history-source {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--color-ink-100, #8A8783);
  letter-spacing: 0.5px;
}

.acr-history-reason {
  width: 100%;
  margin-top: 4px;
  font-style: italic;
  color: var(--color-ink-300, #5F5E5A);
}

.acr-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 18px;
  border-top: 1px solid var(--color-paper-100, #f3f0e9);
  margin-top: 8px;
}

/* MB24 c1 — pipeline-stage chip on the account panel header.
   Append to modals.css near the other .tcpanel-* header rules.
   Colors mirror quote-status.js STATUSES where they overlap. */
.tcpanel-stage-chip {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 9px;
  border-radius: 999px;
  vertical-align: middle;
  white-space: nowrap;
}
.tcpanel-stage-identified  { background: #f3f0e9; color: #6b675f; }
.tcpanel-stage-qualified   { background: #EFEAF7; color: #5A3F8C; }  /* purple, matches quote 'qualified' */
.tcpanel-stage-quoting     { background: #FAEEDA; color: #8A5414; }  /* amber, "Open quote" */
.tcpanel-stage-negotiating { background: #FAEEDA; color: #8A5414; }
.tcpanel-stage-won         { background: #E1F5EE; color: #157355; }
.tcpanel-stage-lost        { background: #FAECE7; color: #99401D; }
.tcpanel-stage-dormant     { background: #f3f0e9; color: #8a8780; }

/* MB24 c2 — quote line items + product picker. Append to modals.css. */

/* ---- line-items section in the quote modal ---- */
.qm-line-items { width: 100%; }
.qli-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.qli-add-btns { display: flex; gap: 6px; }
.qli-empty {
  font-size: 13px; font-style: italic; color: var(--ds-muted-fg, #9a917f);
  padding: 12px; text-align: center;
  border: 1px dashed var(--ds-border, #e4ddcd); border-radius: 8px;
}
.qli-rows { display: flex; flex-direction: column; gap: 8px; }
.qli-row {
  border: 1px solid var(--ds-border, #e4ddcd);
  border-radius: 8px; padding: 10px;
  background: var(--ds-card-bg, #faf6ee);
}
.qli-row-main { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.qli-name { display: flex; flex-direction: column; }
.qli-name-text { font-weight: 600; font-size: 14px; color: var(--ds-fg, #2a2620); }
.qli-sku { font-size: 11px; color: var(--ds-muted-fg, #8a8270); font-variant-numeric: tabular-nums; }
.qli-name-input { flex: 1; }
.qli-row-fields {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 8px;
  align-items: end;
}
.qli-field { display: flex; flex-direction: column; gap: 2px; }
.qli-field > span { font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ds-muted-fg, #8a8270); }
.qli-line-total strong { font-size: 14px; }
.qli-row-meta { font-size: 11px; color: var(--ds-muted-fg, #8a8270); margin-top: 6px; }
.qli-remove { flex-shrink: 0; }

.qli-totals {
  display: flex; gap: 24px; margin-top: 12px; padding-top: 10px;
  border-top: 1px solid var(--ds-border, #e4ddcd);
}
.qli-total-item { display: flex; flex-direction: column; gap: 2px; }
.qli-total-item > span { font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ds-muted-fg, #8a8270); }
.qli-total-item > strong { font-size: 16px; }
.qli-unpriced-flag {
  font-size: 10px; color: #8A5414; background: #FAEEDA;
  padding: 1px 6px; border-radius: 999px; align-self: flex-start; margin-top: 2px;
}
.qli-weight-hint { font-size: 10px; font-style: italic; color: var(--ds-muted-fg, #9a917f); }

/* ---- product picker (modal-from-modal) ---- */
.qli-picker-overlay {
  display: flex; align-items: flex-start; justify-content: center;
  overflow-y: auto; padding: 6vh 16px 18vh;
}
.qli-picker-overlay.qli-picker-hidden { display: none; }
.qli-picker {
  width: 100%; max-width: 560px;
  background: var(--ds-card-bg, #faf6ee);
  border-radius: 12px; padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.qli-picker-header { display: flex; align-items: center; justify-content: space-between; }
.qli-picker-title { font-size: 18px; font-weight: 700; margin: 0; }
.qli-picker-list { display: flex; flex-direction: column; gap: 10px; max-height: 50vh; overflow-y: auto; }
.qli-picker-group-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--ds-muted-fg, #8a8270); font-weight: 700; margin-bottom: 4px;
}
.qli-picker-item {
  display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left;
  padding: 8px 10px; border: 1px solid var(--ds-border, #e4ddcd);
  border-radius: 8px; background: #fff; cursor: pointer; margin-bottom: 4px;
}
.qli-picker-item:hover { border-color: var(--color-accent, #FFD500); }
.qli-picker-item-name { font-weight: 600; font-size: 14px; }
.qli-picker-item-meta { font-size: 11px; color: var(--ds-muted-fg, #8a8270); font-variant-numeric: tabular-nums; }
.qli-picker-empty { font-size: 13px; font-style: italic; color: var(--ds-muted-fg, #9a917f); padding: 16px; text-align: center; }

/* MB24 c2.1 — make the line-item add buttons clearly tappable.
   Override ONLY these two buttons (not the global .fmn-btn-tertiary, which is
   used elsewhere). Append to modals.css. */
.qli-add-product,
.qli-add-freetext {
  background-color: var(--canvas-inset, #F5F1E8);
  color: var(--ink, #2a2620);
  border: 1px solid var(--ds-border, #d8cfba);
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  padding: 6px 12px;
}
.qli-add-product:hover:not(:disabled),
.qli-add-freetext:hover:not(:disabled) {
  background-color: var(--color-accent, #FFD500);
  color: #000;
  border-color: var(--color-accent, #FFD500);
}

/* MB24 c3a — quote-detail Download PDF section. Append to modals.css. */
.qdm-pdf-section { padding-top: 4px; }
.qdm-pdf-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.qdm-pdf-status { font-size: 12px; color: var(--ink-muted, #6b675f); }

/* MB26 s4 — Onboarding Tier-3 flow (one question at a time, tap + type). */
.onb-overlay {
  position: fixed; inset: 0; z-index: 1019;
  display: none; align-items: flex-start; justify-content: center;
  background: rgba(20,20,20,.45); padding: 8vh 16px 18vh; overflow-y: auto;
}
.onb-overlay.onb-open { display: flex; }
.onb-modal {
  background: var(--surface-1, #fdfcfa); border-radius: 16px; width: 480px; max-width: 100%;
  box-shadow: 0 16px 48px rgba(0,0,0,.22); overflow: hidden;
}
.onb-header { display: flex; align-items: center; gap: 12px; padding: 16px 20px 0; }
.onb-progress { display: flex; gap: 6px; flex: 1; }
.onb-dot { width: 26px; height: 4px; border-radius: 2px; background: rgba(0,0,0,.12); }
.onb-dot-done { background: #FFD500; }
.onb-dot-active { background: #171717; }
.onb-close { background: none; border: none; font-size: 20px; color: #999; cursor: pointer; line-height: 1; }
.onb-body { padding: 18px 24px 8px; }
.onb-prompt { margin: 6px 0 4px; font-size: 21px; font-weight: 700; letter-spacing: -0.01em; color: var(--text-primary, #171717); }
.onb-sub { margin: 0 0 16px; font-size: 13px; color: #888780; }
.onb-options { display: flex; flex-direction: column; gap: 8px; }
.onb-opt {
  text-align: left; padding: 13px 15px; border: 1px solid rgba(0,0,0,.14); border-radius: 11px;
  background: #fff; font-size: 15px; color: var(--text-primary, #171717); cursor: pointer;
  transition: border-color .08s, background .08s;
}
.onb-opt:hover { border-color: rgba(0,0,0,.3); }
.onb-opt-active { border-color: #171717; background: #fff7cc; font-weight: 600; }
.onb-options-multi .onb-opt-active { background: #fff7cc; }
.onb-other { margin-top: 12px; }
.onb-other-hidden { display: none; }
.onb-other label { display: block; font-size: 12px; font-weight: 600; color: #555; margin-bottom: 5px; }
.onb-error { margin-top: 12px; color: #c0392b; font-size: 13px; }
.onb-footer { display: flex; align-items: center; gap: 10px; padding: 12px 20px 18px; border-top: 1px solid rgba(0,0,0,.06); }
.onb-spacer { flex: 1; }
.onb-skip { color: #888780; }

/* ============================================================
   MB27-B — PingModal (Notify-Rep colleague pings)
   Reuses .fmn-modal-overlay / .fmn-modal-content base; these are the
   ping-specific bits. Shown via .pgm-open on the overlay.
   ============================================================ */
.pgm-overlay { display: none; }
.pgm-overlay.pgm-open { display: flex; }
.pgm-modal {
  background: #fdfcf9;
  border-radius: 10px;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.25);
  font-family: 'IBM Plex Sans', sans-serif;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pgm-body { overflow-y: auto; }
.pgm-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 12px; }
.pgm-header h2 { margin: 0; font-size: 18px; }
.pgm-body { padding: 4px 20px 8px; }
.pgm-subject {
  background: #FAFAF8; border-left: 3px solid #FFD500; border-radius: 6px;
  padding: 8px 12px; margin: 0 0 14px; font-size: 13px; color: #404040;
}
.pgm-row { margin: 0 0 14px; }
.pgm-row > label {
  display: block; font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: #737373; margin-bottom: 6px;
}
.pgm-optional { font-weight: 500; text-transform: none; letter-spacing: 0; color: #A3A3A3; }
.pgm-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.pgm-text { width: 100%; resize: vertical; min-height: 84px; box-sizing: border-box; }
.pgm-ai-row { display: flex; gap: 8px; margin-top: 8px; }
.pgm-ai-row .pgm-intent { flex: 1; box-sizing: border-box; }
.pgm-ai-note { font-size: 12px; color: #6D28D9; margin: 6px 0 0; min-height: 14px; }
.pgm-error { color: #B91C1C; font-size: 13px; margin: 4px 0 0; }
.pgm-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 12px 20px 18px; border-top: 1px solid #EEEEEC; margin-top: 6px;
}

/* ============================================================
   MB28-B — Agent modal (Ask) + floating launcher
   Reuses .fmn-modal-overlay / .fmn-modal-content base + .agm-modal card.
   ============================================================ */
.agm-overlay { display: none; }
.agm-overlay.agm-open { display: flex; }
.agm-modal {
  background: #fdfcf9;
  border-radius: 10px;
  width: 100%;
  max-width: 600px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.25);
  font-family: 'IBM Plex Sans', sans-serif;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.agm-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 8px; }
.agm-header h2 { margin: 0; font-size: 18px; }
.agm-transcript {
  flex: 1; overflow-y: auto; padding: 8px 20px; min-height: 200px;
  display: flex; flex-direction: column; gap: 10px;
}
.agm-bubble { font-size: 14px; line-height: 1.5; border-radius: 10px; padding: 9px 13px; max-width: 88%; white-space: pre-wrap; }
.agm-user { align-self: flex-end; background: #FFD500; color: #1a1a1a; }
.agm-agent { align-self: flex-start; background: #F1EFE8; color: #1f1f1f; }
.agm-status { align-self: flex-start; font-size: 12px; color: #6D28D9; font-style: italic; padding: 2px 4px; }
.agm-inputbar { display: flex; gap: 8px; padding: 10px 20px; border-top: 1px solid #EEEEEC; }
.agm-input { flex: 1; resize: none; box-sizing: border-box; }
.agm-foot { font-size: 11px; color: #A3A3A3; padding: 0 20px 14px; margin: 0; }
.agm-launcher {
  position: fixed; right: 22px; bottom: 22px; z-index: 1200;
  border-radius: 22px; padding: 11px 22px; font-size: 15px; font-weight: 700;
  box-shadow: 0 6px 20px rgba(0,0,0,0.22); cursor: pointer;
}

/* MB30-B / MB30-D — movable + resizable Ask window (desktop-window style).
   When floating, the overlay stops dimming/centering so the page behind is
   readable; the card becomes absolutely positioned with a draggable title bar
   and 8 edge/corner resize handles. */
.agm-header { cursor: default; -webkit-user-select: none; user-select: none; }
.agm-overlay.agm-open.agm-floating {
  display: block;
  background: transparent;          /* let the page behind show through */
  pointer-events: none;             /* clicks pass to the page... */
}
.agm-overlay.agm-floating .agm-modal {
  pointer-events: auto;             /* ...except on the card itself */
  position: absolute;
  margin: 0;
  max-width: none;
  max-height: none;
  min-width: 320px;
  min-height: 360px;
  overflow: hidden;                 /* keep input row pinned; transcript scrolls */
  box-shadow: 0 24px 64px rgba(0,0,0,0.28);
}
/* the header reads as a grabbable title bar while floating */
.agm-overlay.agm-floating .agm-header {
  cursor: move;
  border-bottom: 1px solid #EEEEEC;
  background: #faf8f2;
}
.agm-overlay.agm-floating .agm-transcript { flex: 1 1 auto; min-height: 0; }

/* MB30-D / MB30-E — resize handles (only active while floating). Invisible hit-zones. */
.agm-resize { display: none; }
.agm-overlay.agm-floating .agm-resize { display: block; position: absolute; z-index: 5; }
.agm-resize-n  { top: -4px; left: 8px; right: 8px; height: 8px; cursor: ns-resize; }
.agm-resize-s  { bottom: -4px; left: 8px; right: 8px; height: 8px; cursor: ns-resize; }
.agm-resize-e  { right: -4px; top: 8px; bottom: 8px; width: 8px; cursor: ew-resize; }
.agm-resize-w  { left: -4px; top: 8px; bottom: 8px; width: 8px; cursor: ew-resize; }
.agm-resize-ne { top: -5px; right: -5px; width: 14px; height: 14px; cursor: nesw-resize; }
.agm-resize-nw { top: -5px; left: -5px; width: 14px; height: 14px; cursor: nwse-resize; }
.agm-resize-se { bottom: -5px; right: -5px; width: 14px; height: 14px; cursor: nwse-resize; }
.agm-resize-sw { bottom: -5px; left: -5px; width: 14px; height: 14px; cursor: nesw-resize; }
/* subtle visible grip in the SE corner so it's discoverable */
.agm-overlay.agm-floating .agm-resize-se::after {
  content: ''; position: absolute; right: 3px; bottom: 3px; width: 7px; height: 7px;
  border-right: 2px solid #c9c7be; border-bottom: 2px solid #c9c7be;
}
/* MB30-E — the header (and its New chat / close buttons) must sit ABOVE the
   top/corner resize handles so their clicks are never swallowed (the ne/nw/n
   handles overlap the header's top edge). */
.agm-overlay.agm-floating .agm-header { position: relative; z-index: 6; }
.agm-overlay.agm-floating .agm-header-actions { position: relative; z-index: 7; }

/* MB28-B.1 — agent header actions (New chat + close) */
.agm-header-actions { display: flex; align-items: center; gap: 8px; }

/* MB29-A — agent change-set review card (slice 1: touch) */
.agm-changeset { display: block; max-width: 92%; }
.agm-cs-summary { font-weight: 500; margin-bottom: 8px; }
.agm-cs-noteline { font-size: 13px; line-height: 1.45; color: #7a4a00; background: #FFF7E0; border: 1px solid #FCE9A8; border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; }
.agm-cs-list { display: flex; flex-direction: column; gap: 10px; }
.agm-cs-item { border: 1px solid var(--color-border, #e0ddd3); border-radius: 10px; padding: 10px 12px; background: var(--color-surface, #fff); }
.agm-cs-kind { font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; color: var(--color-text-muted, #6b6a63); margin-bottom: 6px; }
.agm-cs-field { display: flex; gap: 8px; padding: 2px 0; font-size: 14px; }
.agm-cs-flabel { min-width: 110px; color: var(--color-text-muted, #6b6a63); }
.agm-cs-fval { flex: 1; }
.agm-cs-added { background: rgba(99, 153, 34, 0.12); border-radius: 4px; padding: 0 4px; }
.agm-cs-actions { display: flex; gap: 8px; margin-top: 12px; align-items: center; }
.agm-cs-note { font-size: 13px; color: var(--color-text-muted, #6b6a63); }
.agm-cs-saved { font-size: 14px; font-weight: 600; color: #2e7d32; }
.agm-cs-partial { font-size: 13px; color: #8a6d00; }
.agm-cs-failed { font-size: 13px; color: #b3261e; }
.agm-cs-empty { font-size: 14px; color: var(--color-text-muted, #6b6a63); }

/* MB30-C — structured response cards (list + report). Same visual family as the
   change-set card; Formon yellow/black accents. "Display keeps up with intelligence." */
.agm-structured { display: block; max-width: 92%; }
.agm-struct-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--color-text-muted, #6b6a63); margin-bottom: 10px; }
.agm-list-items { display: flex; flex-direction: column; gap: 10px; }
.agm-acct-card { border: 1px solid var(--color-border, #e0ddd3); border-radius: 10px; padding: 11px 13px; background: var(--color-surface, #fff); }
.agm-acct-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.agm-acct-name { font-size: 15px; font-weight: 700; color: #1a1a1a; }
.agm-acct-chips { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.agm-acct-sub { font-size: 12px; color: var(--color-text-muted, #6b6a63); margin-top: 1px; }
.agm-acct-pills { margin-top: 7px; }
.agm-acct-reason { font-size: 13px; line-height: 1.45; color: #2c2c2a; margin-top: 7px; }
.agm-acct-action { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 9px; padding-top: 8px; border-top: 1px solid #EEEEEC; }
.agm-acct-next { font-size: 13px; color: #1a1a1a; flex: 1; }
.agm-acct-propose { background: #FFD500; color: #1a1a1a; border: none; font-weight: 700; border-radius: 7px; padding: 5px 12px; cursor: pointer; flex-shrink: 0; }
.agm-acct-propose:hover { filter: brightness(0.96); }

/* small chips: tier / score / days-dark */
.agm-chip { display: inline-block; font-size: 11px; font-weight: 700; border-radius: 6px; padding: 2px 7px; line-height: 1.4; }
.agm-chip-tier[data-tier="1"] { background: #FFD500; color: #1a1a1a; }            /* Deep / gold */
.agm-chip-tier[data-tier="2"] { background: #E6F1FB; color: #0C447C; }            /* Qualified */
.agm-chip-tier[data-tier="3"] { background: #F1EFE8; color: #5F5E5A; }            /* Entry / gray */
.agm-chip-score { color: #fff; }
.agm-chip-score[data-band="hot"]  { background: #C0392B; }
.agm-chip-score[data-band="warm"] { background: #E67E22; }
.agm-chip-score[data-band="cool"] { background: #2980B9; }
.agm-chip-score[data-band="cold"] { background: #5D6D7E; }
.agm-chip-dark { background: #F1EFE8; color: #5F5E5A; }
.agm-chip-dark[data-cold="1"] { background: #FBE9E7; color: #C0392B; }

/* report (account brief / agenda) */
.agm-report-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.agm-report-section { margin-top: 11px; }
.agm-report-shead { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--color-text-muted, #6b6a63); margin-bottom: 3px; }
.agm-report-body { font-size: 14px; line-height: 1.5; color: #1f1f1f; white-space: pre-wrap; }
.agm-report-foot { font-size: 12px; color: var(--color-text-muted, #6b6a63); margin-top: 11px; padding-top: 8px; border-top: 1px solid #EEEEEC; }
