/* =============================================================
   site4 · app.css
   All values use CSS custom properties from PrimaryColors.css
   and the cssTokens defined in css-classes.json.
   NO hardcoded hex values.  NO inline styles.
   ============================================================= */

/* ─── Semantic tokens & spacing ──────────────────────────────── */
:root {
  /* Semantic aliases */
  --accent:        var(--color-1);
  --accent-light:  var(--color-1-light);
  --accent-dark:   var(--color-1-dark);
  --accent-glow:   var(--color-1-transparent-2);
  --dark:          var(--color-2);
  --dark-deep:     var(--color-2-dark);
  --dark-deeper:   var(--color-2-darker);

  --color-white:        #fff;
  --color-off-white:    #f8fafc;
  --color-cream:        #f1f5f9;
  --color-border:       #d3e0ec;
  --color-muted:        #6b7280;
  --color-body-text:    #374151;
  --color-heading:      #111827;

  /* Status */
  --color-status-success:      #16a34a;
  --color-status-success-bg:   #dcfce7;
  --color-status-success-dark: #15803d;
  --color-status-danger:       #dc2626;
  --color-status-danger-bg:    #fee2e2;
  --color-status-danger-dark:  #b91c1c;
  --color-status-warning:      #d97706;
  --color-status-warning-bg:   #fef3c7;
  --color-status-warning-dark: #b45309;
  --color-status-info:         #2563eb;
  --color-status-info-bg:      #dbeafe;
  --color-status-info-dark:    #1d4ed8;
  --color-status-neutral:      #6b7280;
  --color-status-neutral-bg:   #f3f4f6;

  /* Font sizes */
  --fs-eyebrow: 0.7rem;
  --fs-small:   0.8125rem;
  --fs-body:    1rem;
  --fs-h4:      1.125rem;
  --fs-h3:      1.375rem;
  --fs-h2:      1.75rem;
  --fs-h1:      2.25rem;

  /* Spacing */
  --s-4:   4px;
  --s-8:   8px;
  --s-12:  12px;
  --s-16:  16px;
  --s-24:  24px;
  --s-32:  32px;
  --s-48:  48px;
  --s-64:  64px;
  --s-80:  80px;
  --s-120: 120px;

  /* Border radius */
  --r-sm:  4px;
  --r-md:  8px;
  --r-lg:  12px;
  --r-xl:  20px;
  --r-full: 9999px;

  /* Shadows */
  --shadow-sm:   0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:   0 4px 12px rgba(0,0,0,.10), 0 2px 6px rgba(0,0,0,.06);
  --shadow-lg:   0 10px 30px rgba(0,0,0,.14), 0 4px 12px rgba(0,0,0,.08);
  --shadow-bloom:0 0 0 4px var(--accent-glow), 0 8px 24px rgba(0,0,0,.12);

  /* Transitions */
  --t-fast: 120ms ease;
  --t-med:  240ms ease;
}

/* ─── Reset / Base ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-1);
  font-size: var(--fs-body);
  color: var(--color-body-text);
  background: var(--color-off-white);
  line-height: 1.6;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ─── Layout ──────────────────────────────────────────────────── */

ms-label {
    font-size:11px;font-weight:700;color:#7ca8c4;letter-spacing:.06em;text-transform:uppercase;flex-shrink:0;
}


section {
    display: block;
    width: 100%;
    clear: both;
}
.container {
  /* max-width: 1200px; */
  margin-inline: auto;
  padding-inline: var(--s-24);
}
.filter-checkbox {
  appearance: checkbox !important;
  -moz-appearance: checkbox !important;
  -webkit-appearance: checkbox !important;
}
.section {
  padding-block: var(--s-80);
}
.section--cream { background: var(--color-cream); }
.section--dark  { background: var(--dark); color: var(--color-white); }

.grid-2   { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-24); }
.grid-3   { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-24); }
.grid-4   { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-24); }
.grid-auto{ display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); gap: var(--s-24); }

.admin-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}
.dual-pane {
  display: grid;
  grid-template-columns: 1fr 3fr;
  gap: var(--s-32);
  min-width: 0;
}
.dual-pane > aside,
.dual-pane > main {
  min-width: 0;
  overflow: hidden;
}
.dual-pane > main {
  overflow-x: auto;
}

/* ─── Typography ──────────────────────────────────────────────── */
.eyebrow {
  font-size: var(--fs-eyebrow);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
}
.section-heading {
  font-family: var(--font-2);
  font-size: var(--fs-h2);
  font-weight: 700;
  color: var(--color-heading);
}
.section-heading::after {
  content: '';
  display: block;
  width: 48px;
  height: 3px;
  background: var(--accent);
  margin-top: var(--s-12);
}
.pinstripe { border-left: 3px solid var(--accent); padding-left: var(--s-16); }
.pull-quote {
  font-family: var(--font-2);
  font-size: var(--fs-h3);
  font-style: italic;
  color: var(--color-heading);
  padding: var(--s-24) var(--s-32);
  border-left: 4px solid var(--accent);
  background: var(--color-cream);
  border-radius: 0 var(--r-md) var(--r-md) 0;
}
.prose { max-width: 68ch; line-height: 1.75; }
.prose h2, .prose h3 { color: var(--color-heading); margin-top: var(--s-32); margin-bottom: var(--s-8); }
.code-block {
  background: var(--dark-deep);
  color: var(--color-cream);
  font-family: 'Courier New', monospace;
  font-size: 0.875rem;
  padding: var(--s-24);
  border-radius: var(--r-md);
  overflow-x: auto;
}
.article { line-height: 1.75; }
.article h1 { font-family: var(--font-2); font-size: var(--fs-h1); color: var(--color-heading); margin-bottom: var(--s-8); }
.article h2 { font-size: var(--fs-h2); color: var(--color-heading); margin-top: var(--s-48); margin-bottom: var(--s-8); }
.article p  { margin-bottom: var(--s-16); }

/* ─── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-8);
  height: 44px;
  padding-inline: var(--s-24);
  font-size: var(--fs-small);
  font-weight: 600;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
  white-space: nowrap;
  text-decoration: none;
}
.btn--primary {
  background: var(--dark);
  color: var(--color-white);
  border-color: var(--dark);
}
.btn--primary:hover { background: var(--dark-deep); }

.btn--ghost {
  background: transparent;
  color: var(--accent);
  border-color: transparent;
}
.btn--ghost:hover { background: var(--accent-glow); }

.btn--accent {
  background: var(--accent);
  color: var(--color-white);
  border-color: var(--accent);
}
.btn--accent:hover { background: var(--accent-dark); border-color: var(--accent-dark); }

.btn--text {
  background: transparent;
  color: var(--accent);
  border-color: transparent;
  height: auto;
  padding: 0;
}
.btn--text::after { content: ''; display: block; height: 1px; background: var(--accent); }

.btn--white {
  background: var(--color-white);
  color: var(--dark);
}
.btn--white:hover { background: var(--color-cream); }

.btn--outline {
  background: transparent;
  color: var(--color-body-text);
  border-color: var(--color-border);
}
.btn--outline:hover { border-color: var(--accent); color: var(--accent); }

.btn--success {
  background: var(--color-status-success);
  color: var(--color-white);
  border-color: var(--color-status-success);
}
.btn--success:hover { background: var(--color-status-success-dark); }

.btn--danger {
  background: var(--color-status-danger);
  color: var(--color-white);
  border-color: var(--color-status-danger);
}
.btn--danger:hover { background: var(--color-status-danger-dark); }

.btn--sm {
  height: 32px;
  padding-inline: var(--s-12);
  font-size: var(--fs-eyebrow);
  border-radius: var(--r-sm);
}
.btn--lg {
  height: 56px;
  padding-inline: var(--s-32);
  font-size: var(--fs-body);
}

/* ─── Forms ───────────────────────────────────────────────────── */
.form-input {
  display: block;
  width: 100%;
  height: 42px;
  padding: var(--s-8) var(--s-12);
  font-size: var(--fs-small);
  color: var(--color-body-text);
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
textarea.form-input { height: auto; min-height: 80px; resize: vertical; }

.form-input--error { border-color: var(--color-status-danger); }
.form-input--error:focus { box-shadow: 0 0 0 3px var(--color-status-danger-bg); }
.form-input--success { border-color: var(--color-status-success); }

.form-label {
  display: block;
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--color-heading);
  margin-bottom: var(--s-4);
}
.form-hint {
  font-size: var(--fs-eyebrow);
  color: var(--color-muted);
  margin-top: var(--s-4);
}
.form-file {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-8);
  padding: var(--s-32);
  border: 2px dashed var(--color-border);
  border-radius: var(--r-md);
  background: var(--color-off-white);
  cursor: pointer;
  transition: border-color var(--t-fast);
}
.form-file:hover { border-color: var(--accent); }

.toggle-switch__slider {
  display: block;
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--color-border);
  border-radius: 12px;
  transition: background var(--t-fast);
  cursor: pointer;
}
.toggle-switch__slider::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--color-white);
  transition: transform var(--t-fast);
}
input:checked + .toggle-switch__slider { background: var(--accent); }
input:checked + .toggle-switch__slider::after { transform: translateX(20px); }

/* ─── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  padding: var(--s-24);
  box-shadow: var(--shadow-sm);
}
.card--hoverable {
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.card--hoverable:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}
.card--accent-top { border-top: 3px solid var(--accent); }
.card--dark {
  background: var(--dark);
  border-color: rgba(255,255,255,0.08);
  color: var(--color-white);
}

/* ─── Tables ──────────────────────────────────────────────────── */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-small);
}
.table th, .table td {
  padding: var(--s-8) var(--s-12);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}
.table th {
  background: var(--color-cream);
  font-weight: 600;
  color: var(--color-heading);
  font-size: var(--fs-eyebrow);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.table tr:hover td { background: var(--color-off-white); }

.table--striped tr:nth-child(even) td { background: var(--color-off-white); }

.line-items { width: 100%; border-collapse: collapse; font-size: var(--fs-small); }
.line-items th, .line-items td {
  padding: var(--s-8) var(--s-12);
  border-bottom: 1px solid var(--color-border);
  text-align: left;
}
.line-items thead th {
  background: var(--color-cream);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: var(--fs-eyebrow);
}

/* ─── Alerts ──────────────────────────────────────────────────── */
.alert {
  padding: var(--s-16) var(--s-24);
  border-left: 4px solid var(--color-border);
  border-radius: var(--r-md);
  font-size: var(--fs-small);
}
.alert--success {
  background: var(--color-status-success-bg);
  color: var(--color-status-success-dark);
  border-left-color: var(--color-status-success-dark);
}
.alert--warning {
  background: var(--color-status-warning-bg);
  color: var(--color-status-warning-dark);
  border-left-color: var(--color-status-warning);
}
.alert--error {
  background: var(--color-status-danger-bg);
  color: var(--color-status-danger-dark);
  border-left-color: var(--color-status-danger-dark);
}
.alert--info {
  background: var(--color-status-info-bg);
  color: var(--color-status-info-dark);
  border-left-color: var(--color-status-info-dark);
}
.toast {
  position: fixed;
  bottom: var(--s-24);
  right: var(--s-24);
  background: var(--dark);
  color: var(--color-white);
  border-left: 4px solid var(--accent);
  border-radius: var(--r-md);
  padding: var(--s-12) var(--s-24);
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-small);
  z-index: 2000;
}

/* ─── Badges & Status ─────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  font-size: var(--fs-eyebrow);
  font-weight: 600;
  border-radius: var(--r-full);
  background: var(--color-status-success-bg);
  color: var(--color-status-success-dark);
  white-space: nowrap;
}
.badge--muted { background: var(--color-cream); color: var(--color-muted); }
.badge--primary { background: var(--accent); color: var(--color-white); }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px var(--s-8);
  font-size: var(--fs-eyebrow);
  font-weight: 600;
  border-radius: var(--r-full);
}
.status-badge::before {
  content: '';
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
}
.status-badge--completed  { background: var(--color-status-success-bg);  color: var(--color-status-success-dark); }
.status-badge--in-progress{ background: var(--color-status-info-bg);     color: var(--color-status-info-dark); }
.status-badge--pending    { background: var(--color-status-warning-bg);  color: var(--color-status-warning-dark); }
.status-badge--cancelled, 
.status-badge--expired    { background: var(--color-status-danger-bg);   color: var(--color-status-danger-dark); }
.status-badge--draft      { background: var(--color-status-neutral-bg);  color: var(--color-status-neutral); }
.status-badge--paid       { background: var(--color-status-success-bg);  color: var(--color-status-success-dark); }
.status-badge--sent       { background: var(--color-status-info-bg);     color: var(--color-status-info-dark); }
.status-badge--overdue    { background: var(--color-status-danger-bg);   color: var(--color-status-danger-dark); }

.deal-stage {
  display: inline-block;
  padding: 2px var(--s-8);
  font-size: var(--fs-eyebrow);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: var(--r-full);
}
.deal-stage--prospect  { background: var(--color-status-neutral-bg);  color: var(--color-status-neutral); }
.deal-stage--proposal  { background: var(--color-status-warning-bg);  color: var(--color-status-warning-dark); }
.deal-stage--won       { background: var(--color-status-success-bg);  color: var(--color-status-success-dark); }
.deal-stage--lost      { background: var(--color-status-danger-bg);   color: var(--color-status-danger-dark); }

/* ─── Navigation & Tabs ───────────────────────────────────────── */
.tabs { display: flex; align-items: stretch; border-bottom: 1px solid var(--color-border); }
.tabs__tab {
  padding: var(--s-12) var(--s-24);
  font-size: var(--fs-small);
  color: var(--color-muted);
  border-bottom: 2px solid transparent;
  background: transparent;
  border-top: none; border-left: none; border-right: none;
  cursor: pointer;
  transition: color var(--t-fast);
  white-space: nowrap;
}
.tabs__tab:hover { color: var(--color-heading); }
.tabs__tab--active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}
.tabs--pills .tabs__tab {
  border-radius: var(--r-md);
  border: none;
  padding: var(--s-8) var(--s-16);
}
.tabs--pills .tabs__tab--active {
  background: var(--accent);
  color: var(--color-white);
  border-bottom-color: transparent;
}

/* ─── Avatars ─────────────────────────────────────────────────── */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  font-size: var(--fs-small);
  font-weight: 700;
  flex-shrink: 0;
  background: var(--color-2-transparent-2);
  color: var(--dark);
}
.avatar--sm  { width: 28px; height: 28px; font-size: var(--fs-eyebrow); }
.avatar--lg  { width: 56px; height: 56px; font-size: var(--fs-h4); }
.avatar--xl  { width: 80px; height: 80px; font-size: var(--fs-h3); }
.avatar--accent { background: var(--accent-glow); color: var(--dark); }
.avatar--dark   { background: var(--dark); color: var(--color-white); }

/* ─── Progress & Loaders ──────────────────────────────────────── */
.progress {
  width: 100%;
  height: 8px;
  background: var(--color-cream);
  border-radius: var(--r-full);
  overflow: hidden;
}
.progress__bar {
  height: 100%;
  background: var(--accent);
  border-radius: var(--r-full);
  transition: width var(--t-med);
}
.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--color-border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton {
  background: linear-gradient(90deg, var(--color-cream) 25%, var(--color-border) 50%, var(--color-cream) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--r-sm);
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ─── Modals & Drawers ────────────────────────────────────────── */
.modal__backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.modal__panel {
  background: var(--color-white);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  width: min(600px, 96vw);
  max-height: 90vh;
  overflow-y: auto;
  padding: var(--s-32);
}
.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--s-8);
  padding-top: var(--s-24);
  border-top: 1px solid var(--color-border);
  margin-top: var(--s-24);
}

/* ─── Admin sidebar panel ─────────────────────────────────────── */
.admin-sidebar-panel {
  background: var(--dark-deep);
  color: var(--color-white);
  height: 100%;
  overflow-y: auto;
}
.filter-sidebar {
  background: var(--color-white);
  border-right: 1px solid var(--color-border);
  padding: var(--s-24);
}

/* ─── Chat / Communication ────────────────────────────────────── */
.chat-bubble--sent {
  background: var(--accent-glow);
  color: var(--dark);
  padding: var(--s-8) var(--s-12);
  border-radius: var(--r-md) var(--r-md) 0 var(--r-md);
  font-size: var(--fs-small);
  max-width: 72%;
  align-self: flex-end;
}
.chat-bubble--received {
  background: var(--color-cream);
  color: var(--color-body-text);
  padding: var(--s-8) var(--s-12);
  border-radius: var(--r-md) var(--r-md) var(--r-md) 0;
  font-size: var(--fs-small);
  max-width: 72%;
  align-self: flex-start;
}
.notif-item--unread { background: var(--color-1-transparent-1); font-weight: 500; }
.typing-indicator span {
  display: inline-block;
  width: 6px; height: 6px;
  background: var(--color-muted);
  border-radius: 50%;
  animation: bounce .9s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: .15s; }
.typing-indicator span:nth-child(3) { animation-delay: .30s; }
@keyframes bounce { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-4px)} }

/* ─── KPI Dashboard Card ──────────────────────────────────────── */
.kpi-dashboard__card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  padding: var(--s-16) var(--s-24);
  box-shadow: var(--shadow-sm);
}
.kpi-dashboard__card .value {
  font-size: var(--fs-h3);
  font-weight: 700;
  color: var(--color-heading);
  font-family: var(--font-2);
}
.kpi-dashboard__card .label {
  font-size: var(--fs-eyebrow);
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ─── Financial Documents ─────────────────────────────────────── */
.invoice { background: var(--color-white); padding: var(--s-48); max-width: 760px; margin: auto; }
.invoice__status--paid     { color: var(--color-status-success-dark); }
.invoice__status--pending  { color: var(--color-status-warning-dark); }
.invoice__status--overdue  { color: var(--color-status-danger-dark); }

/* ─── Scheduling & Calendar ───────────────────────────────────── */
.appointment-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  padding: var(--s-12) var(--s-16);
  font-size: var(--fs-small);
}
.mini-cal__day--today  { background: var(--accent); color: var(--color-white); border-radius: 50%; }
.mini-cal__day--selected { background: var(--accent-glow); border-radius: 50%; }
.time-slot--selected { background: var(--accent-glow); }

/* ─── Mobile Patterns ─────────────────────────────────────────── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--color-white);
  border-top: 1px solid var(--color-border);
  display: flex; justify-content: space-around;
  padding: var(--s-8) 0 var(--s-12);
  z-index: 100;
}
.bottom-nav__item { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 0.625rem; color: var(--color-muted); }
.bottom-nav__item--active { color: var(--accent); }
.bottom-sheet__panel {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--color-white);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: var(--shadow-lg);
  max-height: 80vh;
  overflow-y: auto;
  z-index: 500;
}
.fab {
  position: fixed; bottom: 80px; right: var(--s-24);
  width: 52px; height: 52px;
  background: var(--accent);
  color: var(--color-white);
  border-radius: 50%;
  border: none;
  box-shadow: var(--shadow-md);
  font-size: 1.5rem;
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
}

/* ─── Utility ─────────────────────────────────────────────────── */
.text-accent   { color: var(--accent); }
.text-muted    { color: var(--color-muted); }
.text-heading  { color: var(--color-heading); }
.text-success  { color: var(--color-status-success-dark); }
.text-danger   { color: var(--color-status-danger-dark); }
.bg-cream      { background: var(--color-cream); }
.bg-off-white  { background: var(--color-off-white); }
.bg-dark       { background: var(--dark); color: var(--color-white); }
.bg-accent     { background: var(--accent); color: var(--color-white); }
.rounded       { border-radius: var(--r-sm); }
.rounded-md    { border-radius: var(--r-md); }
.rounded-lg    { border-radius: var(--r-lg); }
.rounded-full  { border-radius: var(--r-full); }
.shadow-sm     { box-shadow: var(--shadow-sm); }
.shadow-md     { box-shadow: var(--shadow-md); }
.shadow-lg     { box-shadow: var(--shadow-lg); }
.divider       { border: none; border-top: 1px solid var(--color-border); margin-block: var(--s-16); }
.reveal        { opacity: 0; transform: translateY(20px); transition: opacity .5s, transform .5s; }
.reveal.visible{ opacity: 1; transform: translateY(0); }
.empty-state { text-align: center; padding: var(--s-64) var(--s-24); color: var(--color-muted); }
.empty-state__icon { font-size: 3rem; margin-bottom: var(--s-16); opacity: .4; }

/* ─── Empty state / Error ─────────────────────────────────────── */
.error-page__code {
  font-family: var(--font-2);
  font-size: 8rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

/* ═══════════════════════════════════════════════════════════════
   CRM Application — shell, navigation, entity pages, pipeline,
   calendar, mobile patterns. ALL values use CSS tokens.
   ═══════════════════════════════════════════════════════════════ */

/* ─── App shell ───────────────────────────────────────────────── */
.crm-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  background: var(--color-off-white);
}

/* ─── Sidebar ─────────────────────────────────────────────────── */
.crm-sidebar {
  background: var(--dark-deep);
  border-right: 1px solid rgba(255,255,255,.06);
  width: 260px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  position: sticky;
  top: 0;
  height: 100vh;
}
.crm-sidebar__logo {
  background: var(--dark-deeper);
  padding: var(--s-16) var(--s-24);
  color: var(--color-white);
  font-weight: 700;
  font-size: var(--fs-body);
  flex-shrink: 0;
}
.crm-sidebar__section-label {
  color: var(--color-muted);
  font-size: var(--fs-eyebrow);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: var(--s-16) var(--s-24) var(--s-4);
  pointer-events: none;
}
.crm-sidebar__item {
  display: flex;
  align-items: center;
  gap: var(--s-8);
  color: rgba(255,255,255,.72);
  padding: var(--s-8) var(--s-24);
  font-size: var(--fs-small);
  border-radius: var(--r-sm);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}
.crm-sidebar__item:hover { background: rgba(255,255,255,.08); color: var(--color-white); }
.crm-sidebar__item--active {
  background: var(--accent-glow);
  color: var(--color-white);
  font-weight: 600;
}

/* ─── Top bar ─────────────────────────────────────────────────── */
.crm-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding-inline: var(--s-24);
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

/* ─── Content area ────────────────────────────────────────────── */
.crm-content {
  background: var(--color-off-white);
  padding: var(--s-24);
  overflow-y: auto;
  min-height: 100vh;
}

/* ─── Entity header ───────────────────────────────────────────── */
.crm-entity-header {
  background: var(--dark);
  color: var(--color-white);
  border-radius: var(--r-md);
  padding: var(--s-24);
  display: flex;
  align-items: center;
  gap: var(--s-24);
  margin-bottom: var(--s-16);
}
.crm-entity-header__name {
  font-size: var(--fs-h3);
  font-weight: 700;
  color: var(--color-white);
  margin: 0;
}
.crm-entity-header__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-16);
  color: rgba(255,255,255,.75);
  font-size: var(--fs-small);
  margin-top: var(--s-4);
}
.crm-entity-header__meta a { color: var(--accent-light); }

/* ─── CRM tab bar ─────────────────────────────────────────────── */
.crm-tab-bar {
  display: flex;
  background: var(--color-white);
  border-bottom: 2px solid var(--color-border);
  overflow-x: auto;
  flex-shrink: 0;
}
.crm-tab-bar__tab {
  padding: var(--s-12) var(--s-16);
  font-size: var(--fs-small);
  color: var(--color-muted);
  border-bottom: 2px solid transparent;
  background: transparent;
  border-top: none; border-left: none; border-right: none;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--t-fast);
  margin-bottom: -2px;
}
.crm-tab-bar__tab:hover { color: var(--color-heading); }
.crm-tab-bar__tab--active {
  color: var(--dark);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* ─── KPI strip ───────────────────────────────────────────────── */
.crm-kpi-strip {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-12);
  margin-bottom: var(--s-16);
}
.crm-kpi-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  padding: var(--s-12) var(--s-16);
  min-width: 110px;
  box-shadow: var(--shadow-sm);
}
.crm-kpi-card span {
  display: block;
  font-size: 12px;
  color: var(--color-muted);
}
.crm-kpi-card strong {
  display: block;
  font-size: 20px;
  font-weight: 700;
  color: var(--color-heading);
}
.crm-kpi-card__value {
  font-size: var(--fs-h4);
  font-weight: 700;
  color: var(--color-heading);
  display: block;
}
.crm-kpi-card__label {
  font-size: var(--fs-eyebrow);
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ─── Pipeline / Kanban ───────────────────────────────────────── */
.crm-pipeline {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: var(--s-12);
}
@media (max-width: 640px) {
  .crm-pipeline { grid-template-columns: 1fr; }
}
.crm-pipeline__col {
  background: var(--color-cream);
  border-radius: var(--r-md);
  min-width: 260px;
  padding: var(--s-12);
  flex-shrink: 0;
}
.crm-pipeline__col-header {
  font-size: var(--fs-small);
  font-weight: 700;
  color: var(--color-heading);
  padding: var(--s-8) var(--s-4) var(--s-12);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.crm-deal-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--r-sm);
  padding: var(--s-12);
  margin-bottom: var(--s-8);
  cursor: pointer;
  transition: box-shadow var(--t-fast);
  font-size: var(--fs-small);
}
.crm-deal-card:hover { box-shadow: var(--shadow-sm); border-color: var(--accent); }

/* ─── Conveyor belt ───────────────────────────────────────────── */
.crm-conveyor {
  display: flex;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  overflow-x: auto;
  margin-bottom: var(--s-16);
}
.crm-conveyor__step {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: var(--s-4);
  background: var(--color-cream);
  border-right: 1px solid var(--color-border);
  padding: var(--s-12) var(--s-16);
  font-size: var(--fs-small);
  min-width: 120px;
  cursor: pointer;
  transition: background var(--t-fast);
  flex-shrink: 0;
}
.crm-conveyor__step:last-child { border-right: none; }
.crm-conveyor__step:hover { background: var(--color-border); }
.crm-conveyor__step--active {
  background: var(--accent-glow);
  color: var(--dark);
  font-weight: 700;
}
.crm-conveyor__step--complete {
  background: var(--color-status-success-bg);
  color: var(--color-status-success-dark);
}

/* ─── Activity layout ─────────────────────────────────────────── */
.crm-activity-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  min-height: 400px;
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--color-white);
  position: relative;
}
.crm-activity-nav {
  background: var(--color-cream);
  border-right: 1px solid var(--color-border);
  padding: var(--s-8) 0;
}
.crm-activity-nav__item {
  display: flex;
  align-items: center;
  gap: var(--s-8);
  padding: var(--s-8) var(--s-16);
  font-size: var(--fs-small);
  color: var(--color-body-text);
  cursor: pointer;
  border-radius: var(--r-sm);
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: background var(--t-fast);
}
.crm-activity-nav__item:hover { background: var(--color-border); }
.crm-activity-nav__item--active {
  background: var(--color-1-transparent-2);
  color: var(--dark);
  font-weight: 600;
}

/* ─── Side tab button ─────────────────────────────────────────── */
.side-tab-btn {
  display: none; /* shown via media query on mobile */
  position: absolute;
  left: 0;
  top: 50vh;
  transform: translateY(-50%);
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 52px;
  background: var(--color-1-lighter);
  border: 1px solid var(--color-border);
  border-left: none;
  border-radius: 0 var(--r-md) var(--r-md) 0;
  color: var(--dark);
  cursor: pointer;
  font-size: 1rem;
  z-index: 201;
  transition: left var(--t-med);
}
/* Alias: build.js renamed side-tab-btn → side-crm-tab-bar__tab */
.side-crm-tab-bar__tab {
  display: none;
  position: absolute;
  top: 8px;
  left: 0;
  z-index: 22;
  width: 22px;
  height: 52px;
  align-items: center;
  justify-content: center;
  background: var(--color-1-lighter);
  border: 1px solid var(--color-border);
  border-left: none;
  border-radius: 0 var(--r-md) var(--r-md) 0;
  cursor: pointer;
  font-size: var(--fs-small);
  font-weight: 700;
  color: var(--dark);
  transition: left var(--t-fast);
}
/* Alias: build.js renamed .active → .crm-tab-bar__tab--active inside pact */
.pact-dept-tab.crm-tab-bar__tab--active {
  background: var(--color-white);
  border-color: var(--color-border);
  color: var(--color-heading);
  font-weight: 700;
  margin-bottom: -1px;
}
.pact-section-btn.crm-tab-bar__tab--active {
  background: var(--color-status-info-bg);
  border-left-color: var(--color-status-info);
  font-weight: 700;
  color: var(--color-status-info-dark);
}
.pact-section-btn.crm-tab-bar__tab--active .pact-section-count {
  background: var(--color-status-info-bg);
  color: var(--color-status-info-dark);
}

/* ─── Notes ───────────────────────────────────────────────────── */
.crm-notes-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--s-16);
}
.crm-note-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  padding: var(--s-16);
  margin-bottom: var(--s-12);
  font-size: var(--fs-small);
}
.crm-note-card__date {
  font-size: var(--fs-eyebrow);
  color: var(--color-muted);
  margin-bottom: var(--s-4);
}

/* ─── Tasks ───────────────────────────────────────────────────── */
.crm-tasks-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: var(--s-16);
}

/* ─── Conversations ───────────────────────────────────────────── */
.crm-conv-layout {
  display: grid;
  grid-template-columns: 160px 1fr 320px;
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  overflow: hidden;
  min-height: 500px;
  background: var(--color-white);
}
.crm-conv-channel-nav {
  background: var(--color-cream);
  border-right: 1px solid var(--color-border);
}

/* ─── Month calendar ──────────────────────────────────────────── */
.crm-month-cal {
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  overflow: hidden;
  width: 100%;
}
.crm-cal-day-header {
  background: var(--color-cream);
  padding: var(--s-8) var(--s-4);
  text-align: center;
  font-size: var(--fs-eyebrow);
  font-weight: 700;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.crm-cal-day {
  background: var(--color-white);
  border-top: 1px solid var(--color-border);
  border-right: 1px solid var(--color-border);
  min-height: 80px;
  padding: var(--s-4);
  cursor: pointer;
  transition: background var(--t-fast);
  vertical-align: top;
}
.crm-cal-day:hover { background: var(--color-off-white); }
.crm-cal-day--today { background: var(--color-1-transparent-1); }
.crm-cal-day--today .date-num {
  background: var(--accent);
  color: var(--color-white);
  border-radius: 50%;
  width: 22px; height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.crm-cal-appt-chip {
  font-size: var(--fs-eyebrow);
  border-left: 3px solid currentColor;
  padding: 1px var(--s-4);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 1px;
  display: block;
}

/* ─── Day schedule sheet ──────────────────────────────────────── */
.crm-day-sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--color-off-white);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  max-height: 82vh;
  box-shadow: var(--shadow-lg);
  z-index: 600;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.crm-day-sheet__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 599;
}
.crm-day-sheet__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--dark);
  color: var(--color-white);
  padding: var(--s-12) var(--s-16);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  flex-shrink: 0;
  font-weight: 600;
}
.crm-day-sheet__body {
  overflow-y: auto;
  flex: 1;
  padding: var(--s-8);
}
.crm-time-slot {
  display: flex;
  align-items: flex-start;
  gap: var(--s-8);
  border-top: 1px solid var(--color-border);
  min-height: 27px;
  position: relative;
}
.crm-time-slot--hour { border-top-color: var(--color-heading); }
.crm-time-label {
  font-size: var(--fs-eyebrow);
  color: var(--color-muted);
  width: 44px;
  flex-shrink: 0;
  padding-top: 2px;
  text-align: right;
}
.crm-appt-block {
  flex: 1;
  border-left: 3px solid currentColor;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  padding: var(--s-4) var(--s-8) var(--s-4) var(--s-12);
  font-size: var(--fs-small);
  margin-bottom: 2px;
}

/* ─── Product catalog panel ───────────────────────────────────── */
.crm-catalog-panel {
  position: fixed;
  left: 0; top: 56px; bottom: 0;
  width: 320px;
  background: var(--color-off-white);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(-320px);
  transition: transform var(--t-med);
  z-index: 200;
}
.crm-po-layout.panel-open .crm-catalog-panel {
  transform: translateX(0);
  box-shadow: var(--shadow-md);
}
.crm-catalog-header {
  padding: var(--s-12) var(--s-16);
  background: var(--dark);
  color: var(--color-white);
  flex-shrink: 0;
  font-weight: 700;
  font-size: var(--fs-small);
}
.crm-catalog-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--s-8);
}

/* ─── Mobile context bar ──────────────────────────────────────── */
.crm-mobile-context-bar {
  display: none;
  background: var(--dark);
  color: var(--color-white);
  padding: var(--s-8) var(--s-12);
  font-size: var(--fs-small);
  align-items: center;
  justify-content: space-between;
  gap: var(--s-8);
  flex-shrink: 0;
}
.crm-mobile-context-bar .context-label {
  font-weight: 600;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── Mobile view toggle ──────────────────────────────────────── */
.crm-mobile-view-toggle {
  display: none;
  gap: var(--s-8);
  padding: var(--s-8) 0 var(--s-4);
  border-top: 1px solid var(--color-border);
  margin-top: var(--s-8);
}
.crm-mvbtn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-4) var(--s-12);
  font-size: var(--fs-small);
  background: var(--color-white);
  color: var(--dark);
  border: 1px solid var(--color-border);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.crm-mvbtn--active {
  background: var(--dark);
  color: var(--color-white);
  border-color: var(--dark);
}

/* ═══════════════════════════════════════════════════════════════
   Site2 Shell — class aliases using token system
   These match the class names actually rendered by the JS SPA.
   ═══════════════════════════════════════════════════════════════ */

/* ─── Top navigation bar ──────────────────────────────────────── */
.topnav {
  background: var(--dark);
  color: var(--color-white);
  height: 50px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}
.topnav .navbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 var(--s-16);
  width: 100%;
}
.topnav .logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-white);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.topnav .header-nav-item a {
  font-size: 14px;
  color: rgba(255,255,255,.75);
  text-decoration: none;
  padding: 3px 0;
  white-space: nowrap;
}
.topnav .header-nav-item a:hover { color: var(--color-white); }

/* Context-aware topnav links (org / person mode) */
.header-nav-item-link {
  font-size: 13px;
  color: rgba(255,255,255,.75);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  white-space: nowrap;
  flex-shrink: 0;
}
.header-nav-item-link:hover { color: var(--color-white); background: rgba(255,255,255,.1); }
.header-nav-item-link.hn-active { color: var(--color-white); font-weight: 600; background: rgba(255,255,255,.14); }
.hn-context-label {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255,255,255,.5);
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
  margin-right: 4px;
}
.hn-sep {
  color: rgba(255,255,255,.25);
  font-size: 14px;
  flex-shrink: 0;
  padding: 0 4px;
  pointer-events: none;
}
/* Mobile dropdown active/context items */
#mobile-menu-dropdown .mm-active { font-weight: 700; color: var(--color-white); }
#mobile-menu-dropdown .mm-context {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,.5);
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 8px 16px 4px;
}

/* ─── App shell grid ──────────────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: calc(100vh - 50px);
}

/* ─── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  border-right: 1px solid var(--color-border);
  background: var(--color-cream);
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: var(--s-8);
  position: sticky;
  top: 50px;
  height: calc(100vh - 50px);
  overflow-x: hidden;
  overflow-y: auto;
}
.sidebar .btn,
.sidebar button {
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  text-overflow: ellipsis;
}
.menu-group {
  border: 1px solid var(--color-border);
  background: var(--color-white);
  border-radius: var(--r-md);
  padding: var(--s-8);
}
.menu-group h2 {
  font-size: var(--fs-eyebrow);
  font-weight: 600;
  color: var(--color-muted);
  margin: 0 0 var(--s-8);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.sidebar-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-8);
  margin-bottom: var(--s-8);
}
.sidebar-panel-head h2 { margin: 0; font-size: var(--fs-eyebrow); font-weight: 600; color: var(--color-muted); text-transform: uppercase; letter-spacing: 0.3px; }
.sidebar-panel-actions { display: inline-flex; align-items: center; gap: 6px; }
.sidebar-icon-button {
  width: 28px; height: 28px;
  border: 1px solid var(--color-border);
  border-radius: var(--r-sm);
  background: var(--color-white);
  color: var(--dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
}
.sidebar-icon-button:hover { background: var(--color-off-white); }

.panel {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  padding: var(--s-8);
}
.panel h2 { margin: 0 0 var(--s-8); font-size: var(--fs-eyebrow); font-weight: 600; color: var(--color-muted); text-transform: uppercase; letter-spacing: 0.2px; }
.panel p { margin: 0; color: var(--color-muted); font-size: var(--fs-eyebrow); }

.entity-list,
.workspace-list,
.recent-list { display: grid; gap: var(--s-8); margin-top: 10px; }

.brand {
  padding: 10px;
  border-radius: var(--r-md);
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.15);
  color: var(--color-off-white);
}
.brand h1 { margin: 0; font-family: var(--font-2); font-size: 21px; letter-spacing: 0.2px; }
.brand p  { margin: 6px 0 0; font-size: 11px; color: rgba(255,255,255,.65); }
.host { margin-top: var(--s-8); font-size: 10px; display: inline-block; padding: 3px 7px; border-radius: var(--r-full); background: rgba(255,255,255,.14); }

/* ─── Workspace (main content) ────────────────────────────────── */
.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--color-off-white);
}
.workspace-header {
  padding: 0 0 10px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-white);
  position: sticky;
  /* top: 50px; */
  z-index: 20;
}
.crm-titlebar {
  height: 48px;
  display: flex;
  align-items: center;
  gap: var(--s-16);
  padding: 0 14px;
  background: var(--color-white);
  color: var(--dark);
  font-size: 14px;
  border-bottom: 1px solid var(--color-border);
}
.crm-titlebar a { color: var(--dark); text-decoration: none; font-weight: 500; }
.crm-titlebar span { margin-left: auto; font-size: 12px; color: var(--color-muted); }

/* ─── Toolbar ─────────────────────────────────────────────────── */
.toolbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  margin: 10px 18px 10px;
}
.search-wrap { position: relative; }
.search-wrap input {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--r-lg);
  padding: 10px 36px 10px 12px;
  background: var(--color-white);
  font-size: var(--fs-small);
  font-family: inherit;
}
.search-wrap::after {
  content: '?';
  position: absolute;
  right: 12px;
  top: 8px;
  color: var(--color-muted);
  font-size: 18px;
}
.search-results {
  position: absolute;
  left: 0; right: 0;
  top: calc(100% + 6px);
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  max-height: 320px;
  overflow: auto;
  display: none;
  z-index: 50;
}
.search-results.active { display: block; }
.result-item { padding: 9px 10px; border-bottom: 1px solid var(--color-border); cursor: pointer; }
.result-item:last-child { border-bottom: none; }
.result-item:hover { background: var(--color-off-white); }
.result-item strong { display: block; font-size: var(--fs-small); }
.result-item span { font-size: var(--fs-eyebrow); color: var(--color-muted); }
.toolbar-actions { display: flex; gap: var(--s-8); flex-wrap: wrap; justify-content: flex-end; }

/* ─── Tab rows ────────────────────────────────────────────────── */
.tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  overflow: auto;
  padding: 0 18px 4px;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs-row { display: flex; align-items: center; gap: var(--s-8); padding: 0 18px; }
.tabs-row-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--color-muted);
  min-width: 68px;
  flex-shrink: 0;
}
.business-tabs { padding: 4px 0 2px; border-bottom: 1px solid var(--color-border); }
.item-tabs { padding: 2px 0 4px; }

.clear-business-context-btn {
  width: 26px; height: 26px;
  border: 1px solid var(--color-border);
  border-radius: var(--r-sm);
  background: var(--color-white);
  color: var(--dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
}
.clear-business-context-btn:hover { background: var(--color-off-white); }

/* ─── Tabs ────────────────────────────────────────────────────── */
.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 6px 6px 0 0;
  border: 1px solid var(--color-border);
  border-bottom: none;
  background: var(--color-cream);
  padding: 6px 8px;
  min-width: 120px;
  max-width: 280px;
  cursor: pointer;
  flex-shrink: 0;
  font-size: var(--fs-small);
  color: var(--color-body-text);
}
.tab.active {
  background: var(--color-1-transparent-2);
  color: var(--dark);
  border-color: var(--color-1-dark);
  box-shadow: inset 0 -2px 0 var(--accent-dark);
}
.tab.context-selected {
  background: var(--color-1-transparent-1);
  border-color: var(--color-1-dark);
  box-shadow: inset 0 -2px 0 var(--accent);
}
.tab.active.context-selected { background: var(--color-1-transparent-2); }
.tab-context-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 1px 5px;
  font-size: 10px;
  font-weight: 700;
  border-radius: var(--r-full);
  background: var(--accent);
  color: var(--color-white);
  text-transform: uppercase;
}
.tab.tab-kind-organization { border-top: 2px solid var(--dark); }
.tab.tab-kind-person        { border-top: 2px solid var(--color-status-success); }
.tab.tab-kind-all           { border-top: 2px solid var(--color-muted); }
.tab.active .tab-title      { font-weight: 600; }
.tab.linked-business        { border-left: 3px solid var(--dark); }
.tab-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: var(--fs-small); }
.tab button { border: none; background: transparent; color: inherit; cursor: pointer; padding: 0; font-size: 13px; }

/* ─── Menu strip (secondary nav bar) ─────────────────────────── */
.menu-strip {
  display: flex;
  gap: 10px;
  padding: 0 var(--s-16);
  align-items: center;
  height: 44px;
  background: var(--dark-deep);
  border-bottom: 1px solid var(--dark-deeper);
  overflow-x: auto;
  scrollbar-width: none;
}
.menu-strip::-webkit-scrollbar { display: none; }

/* Mobile-only toggle button (hidden on desktop) */
.menu-strip-toggle {
  display: none;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: var(--r-sm);
  color: var(--color-white);
  font-size: 13px;
  font-family: inherit;
  padding: 4px 10px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.ms-section { color: rgba(255,255,255,.6); font-size: 11px; text-transform: uppercase; font-weight: 700; letter-spacing: .04em; }
.ms-active { font-weight: 600; }
.ms-caret { font-size: 10px; margin-left: 4px; }

/* Menu links — support both old .button and new .menu-link class names */
.menu-link,
.menu-strip .button,
.menu-strip .button.small {
  text-align: center;
  background: transparent;
  border: none;
  color: rgba(255,255,255,.75);
  font-size: 13px;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  font-family: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.menu-link:hover,
.menu-strip .button:hover { color: var(--color-white); background: rgba(255,255,255,.1); }
.menu-link.active, .menu-link.active-menu,
.menu-strip .button.active, .menu-strip .button.active-menu { color: var(--color-white); font-weight: 600; background: rgba(255,255,255,.12); }

/* Menu strip label (MENU text) — override inline style */
.menu-strip > span {
  font-size: 11px !important;
  font-weight: 700;
  color: rgba(255,255,255,.5) !important;
  letter-spacing: .06em;
  text-transform: uppercase;
  flex-shrink: 0;
}

/* ─── Dashboard layout ────────────────────────────────────────── */
.content {
  padding: 12px;
  overflow: auto;
  flex: 1;
  min-width: 0;
}
.dashboard { padding: var(--s-24); }
.dashboard-layout { display: grid; grid-template-columns: 1fr 320px; gap: var(--s-24); align-items: start; min-width: 0; }
.dashboard-main { display: flex; flex-direction: column; gap: var(--s-16); min-width: 0; overflow: hidden; }
.dashboard-side { display: flex; flex-direction: column; gap: var(--s-16); min-width: 0; }
.schedule-layout { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--s-16); align-items: start; }

/* ─── Content sections / cards ────────────────────────────────── */
.section {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  padding: var(--s-24);
}
.section h3 {
  margin: 0 0 var(--s-16);
  font-size: 15px;
  font-weight: 600;
  color: var(--color-heading);
}
.split { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-16); }
.hint { color: var(--color-muted); font-size: var(--fs-eyebrow); }
.empty { color: var(--color-muted); font-style: italic; font-size: var(--fs-small); padding: 12px 0; }

/* ─── Form grid ───────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-12); }
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-small); font-weight: 500; color: var(--color-heading); }
.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  padding: 7px 10px;
  font-size: var(--fs-small);
  font-family: inherit;
  background: var(--color-white);
}
.form-grid textarea { min-height: 80px; resize: vertical; }

/* ─── Misc UI ─────────────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px var(--s-8);
  font-size: var(--fs-eyebrow); font-weight: 600;
  border-radius: var(--r-full);
  background: var(--color-cream);
  color: var(--color-muted);
  white-space: nowrap;
}
.kpis { display: flex; flex-wrap: wrap; gap: var(--s-12); margin-bottom: var(--s-16); }
.kpi { background: var(--color-white); border: 1px solid var(--color-border); border-radius: var(--r-md); padding: var(--s-12) var(--s-16); min-width: 110px; box-shadow: var(--shadow-sm); }
.kpi .value { font-size: var(--fs-h4); font-weight: 700; color: var(--color-heading); display: block; }
.kpi .label { font-size: var(--fs-eyebrow); color: var(--color-muted); text-transform: uppercase; letter-spacing: 0.06em; }

/* ─── Business tone colors (entity buttons & pipeline boxes) ──── */
.btn.business-tone-1, .pipeline-box.tone-1 { background: var(--color-status-info-bg);    border-color: var(--color-1-transparent-3); color: var(--color-body-text); }
.btn.business-tone-2, .pipeline-box.tone-2 { background: var(--color-status-success-bg); border-color: var(--color-2-transparent-3); color: var(--color-body-text); }
.btn.business-tone-3, .pipeline-box.tone-3 { background: var(--color-status-warning-bg); border-color: var(--color-3-transparent-3); color: var(--color-body-text); }
.btn.business-tone-4, .pipeline-box.tone-4 { background: var(--color-status-danger-bg);  border-color: var(--color-4-transparent-3); color: var(--color-body-text); }

/* ─── Sidebar entity list buttons ─────────────────────────────── */
.sidebar .btn.business-tone-1,
.sidebar .btn.business-tone-2,
.sidebar .btn.business-tone-3,
.sidebar .btn.business-tone-4 {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  white-space: normal;
  width: 100%;
  height: auto;
  min-height: 0;
  text-align: left;
  padding: 8px 10px;
  word-break: break-word;
  font-size: var(--fs-small);
}
.sidebar .btn.business-tone-1 strong,
.sidebar .btn.business-tone-2 strong,
.sidebar .btn.business-tone-3 strong,
.sidebar .btn.business-tone-4 strong { font-size: 13px; font-weight: 700; display: block; }
.sidebar .btn.business-tone-1 span,
.sidebar .btn.business-tone-2 span,
.sidebar .btn.business-tone-3 span,
.sidebar .btn.business-tone-4 span { font-size: 11px; color: var(--color-muted); display: block; }

.sidebar .contact-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  white-space: normal;
  width: 100%;
  height: auto;
  min-height: 0;
  text-align: left;
  padding: 8px 10px;
  background: var(--color-white);
  border-color: var(--color-border);
  color: var(--color-heading);
}
.sidebar .contact-tile strong { font-size: 13px; font-weight: 600; display: block; }
.sidebar .contact-tile span { font-size: 11px; color: var(--color-muted); display: block; }

/* ─── Pipeline workspace contact cards ───────────────────────────
   Cards in the 4-column pipeline kanban — block layout so each
   piece of info shows on its own line.
   ──────────────────────────────────────────────────────────────── */
.pipeline-contact-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--r-sm);
  padding: var(--s-12);
  margin-bottom: var(--s-8);
  cursor: pointer;
  font-size: var(--fs-small);
  display: block;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.pipeline-contact-card:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }
.pipeline-contact-card .pipeline-card-biz { font-size: 11px; font-weight: 700; color: var(--dark); letter-spacing: 0.02em; display: block; }
.pipeline-contact-card .pipeline-card-name,
.pipeline-contact-card strong { font-size: 13px; font-weight: 600; color: var(--color-heading); display: block; }
.pipeline-contact-card small { font-size: 11px; color: var(--color-muted); display: block; }
.pipeline-contact-card > span:not(.pipeline-card-biz) { font-size: 11px; color: var(--color-muted); display: block; }

/* ─── Conversation path ───────────────────────────────────────── */
.conv-path-list { display: grid; gap: 4px; }
.conv-group-label { font-size: 10px; font-weight: 700; color: var(--color-muted); text-transform: uppercase; letter-spacing: .06em; padding: 4px 0 2px; }
.conv-path-item { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 9px 12px; border: 1px solid var(--color-border); border-radius: var(--r-md); background: var(--color-white); cursor: pointer; font-family: inherit; }
.conv-path-item:hover { background: var(--color-off-white); border-color: var(--accent); }
.conv-path-item.active { background: var(--dark); border-color: var(--dark); color: var(--color-white); }
.conv-editor { background: var(--color-white); border: 1px solid var(--color-border); border-radius: var(--r-md); padding: var(--s-24); }

/* ─── Mobile navigation ───────────────────────────────────────── */
#mobile-menu-toggle { display: none; flex-direction: column; gap: 4px; background: transparent; border: none; cursor: pointer; padding: 6px; }
#mobile-menu-toggle span { display: block; width: 20px; height: 2px; background: var(--color-white); border-radius: 2px; }
#mobile-menu-dropdown { display: none; position: fixed; top: 50px; left: 0; right: 0; background: var(--dark-deep); z-index: 200; padding: var(--s-16); flex-direction: column; gap: var(--s-8); box-shadow: var(--shadow-lg); }
#mobile-menu-dropdown.open { display: flex; }
#mobile-menu-dropdown a { color: rgba(255,255,255,.8); text-decoration: none; padding: var(--s-8) var(--s-12); border-radius: var(--r-sm); font-size: var(--fs-small); }
#mobile-menu-dropdown a:hover { background: rgba(255,255,255,.1); }
#sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 98; }
#sidebar-backdrop.visible { display: block; }
#sidebar-toggle { background: transparent; border: none; cursor: pointer; color: var(--color-white); padding: 6px; font-size: 18px; }

/* ─── Quick open search ───────────────────────────────────────── */
#quick-open-search {
  width: 100%;
  padding: 8px;
  margin-bottom: 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: var(--fs-small);
  background: var(--color-white);
  color: var(--dark);
}

/* ─── Mobile tab tree ─────────────────────────────────────────── */
.mobile-tab-tree { display: none; }
.mobile-acc-head { display: flex; align-items: center; width: 100%; background: transparent; border: none; cursor: pointer; gap: var(--s-8); padding: var(--s-8); border-radius: var(--r-sm); font-family: inherit; font-size: var(--fs-small); text-align: left; }
.mobile-acc-head:hover { background: var(--color-off-white); }
.mobile-acc-head.is-context { background: var(--color-1-transparent-2); font-weight: 600; }
.mobile-acc-head.is-active { color: var(--dark); font-weight: 600; }
.mobile-acc-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mobile-acc-badge { font-size: 10px; font-weight: 700; background: var(--accent); color: var(--color-white); border-radius: var(--r-full); padding: 1px 5px; white-space: nowrap; }
.mobile-acc-close { width: 22px; height: 22px; border: none; background: transparent; cursor: pointer; border-radius: var(--r-sm); color: var(--color-muted); flex-shrink: 0; }
.mobile-acc-children { padding-left: var(--s-16); }
.mobile-acc-child { display: flex; align-items: center; gap: 4px; }
.mobile-acc-child-btn { flex: 1; background: transparent; border: none; cursor: pointer; font-family: inherit; font-size: var(--fs-small); text-align: left; padding: 5px var(--s-8); border-radius: var(--r-sm); color: var(--color-body-text); }
.mobile-acc-child.is-active .mobile-acc-child-btn { color: var(--dark); font-weight: 600; }
.mobile-acc-empty { font-size: var(--fs-eyebrow); color: var(--color-muted); padding: 4px var(--s-8); }
.mobile-acc-group { border-bottom: 1px solid var(--color-border); }
.mobile-acc-group .mobile-acc-children { display: none; }
.mobile-acc-group.is-open .mobile-acc-children { display: block; }
.mobile-acc-title { flex: 1; background: transparent; border: none; cursor: pointer; font-family: inherit; font-size: var(--fs-small); display: flex; align-items: center; gap: 6px; padding: 0; text-align: left; }
.mobile-acc-chevron { font-size: 10px; transition: transform var(--t-fast); }
.mobile-acc-group.is-open .mobile-acc-chevron { transform: rotate(90deg); }

/* ─── Section heading override for inside .section ───────────── */
.section.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-16); }
.section.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--s-16); }

/* ─── Org dashboard header row ───────────────────────────────── */
.org-dash-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: var(--s-16); }
.org-dash-header h3 { margin: 0; font-size: 20px; font-weight: 700; color: var(--color-heading); }
.org-dash-header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ─── Org dashboard quick-nav ─────────────────────────────────── */
.org-quick-nav { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: var(--s-20); }
.org-quick-nav-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 12px 10px; background: var(--color-white); border: 1px solid var(--color-border); border-radius: var(--r-md); cursor: pointer; min-width: 90px; transition: box-shadow var(--t-fast); }
.org-quick-nav-btn:hover { box-shadow: var(--shadow-md); }
.org-quick-nav-btn__count { font-size: 20px; font-weight: 800; color: var(--accent); }
.org-quick-nav-btn__label { font-size: 11px; font-weight: 600; color: var(--color-muted); }

/* ─── Pipeline page ───────────────────────────────────────────── */
.pipeline-grid { display: flex; gap: var(--s-16); align-items: flex-start; overflow-x: auto; padding-bottom: var(--s-24); }
.pipeline-box { background: var(--color-cream); border-radius: var(--r-md); min-width: 240px; padding: var(--s-12); flex-shrink: 0; }
.pipeline-empty { color: var(--color-muted); font-style: italic; font-size: var(--fs-small); padding: var(--s-8); }
.sopp-col-head { font-size: var(--fs-eyebrow); font-weight: 700; color: var(--color-heading); padding: var(--s-8) var(--s-4) var(--s-12); display: flex; justify-content: space-between; }

/* ─── Interest buttons ────────────────────────────────────────── */
.interest-remove-btn { color: var(--color-muted); }
.cust-bucket-remove { width: 24px; height: 24px; border: none; background: transparent; cursor: pointer; color: var(--color-muted); font-size: 14px; border-radius: var(--r-sm); }
.cust-bucket-remove:hover { background: var(--color-status-danger-bg); color: var(--color-status-danger); }
.cust-add-btn { display: flex; align-items: center; gap: 4px; padding: 4px var(--s-8); font-size: var(--fs-eyebrow); }

/* ─── Timeline ────────────────────────────────────────────────── */
.timeline { display: flex; flex-direction: column; gap: 2px; }
.timeline-item { display: flex; align-items: flex-start; gap: var(--s-12); padding: var(--s-8) 0; border-bottom: 1px solid var(--color-border); font-size: var(--fs-small); }
.timeline-item:last-child { border-bottom: none; }
.note-log { display: flex; flex-direction: column; gap: var(--s-8); }
.note-log-content { font-size: var(--fs-small); color: var(--color-body-text); }
.note-edit-content,
.note-new-content { width: 100%; min-height: 80px; border: 1px solid var(--color-border); border-radius: var(--r-md); padding: var(--s-8); font-family: inherit; font-size: var(--fs-small); }

/* ─── Person activity (pact) layout ──────────────────────────── */
.pact-wrap { display: flex; flex-direction: column; height: calc(100vh - 110px); overflow: hidden; }
.pact-dept-tabs { display: flex; gap: 4px; padding: 10px var(--s-16) 0; background: var(--color-off-white); border-bottom: 1px solid var(--color-border); flex-shrink: 0; }
.pact-dept-tab { font-size: var(--fs-small); padding: 6px var(--s-16); border-radius: var(--r-sm) var(--r-sm) 0 0; border: 1px solid transparent; border-bottom: none; background: transparent; color: var(--dark); cursor: pointer; transition: background var(--t-fast); }
.pact-dept-tab:hover { background: var(--color-border); }
.pact-body { display: grid; grid-template-columns: 220px 1fr; flex: 1; overflow: hidden; position: relative; }
.pact-section-list { border-right: 1px solid var(--color-border); overflow-y: auto; background: var(--color-off-white); padding: var(--s-8) 0; }
.pact-section-btn { width: 100%; display: flex; align-items: center; gap: 9px; padding: 10px var(--s-16); background: transparent; border: none; border-left: 3px solid transparent; cursor: pointer; color: var(--dark); font-size: var(--fs-small); transition: background var(--t-fast), border-left-color var(--t-fast); text-align: left; }
.pact-section-btn:hover { background: var(--color-cream); }
.pact-section-icon { font-size: 15px; flex-shrink: 0; line-height: 1; }
.pact-section-label { flex: 1; }
.pact-section-count { font-size: 10px; font-weight: 700; padding: 1px 6px; background: var(--color-border); color: var(--dark); border-radius: var(--r-full); }
.pact-detail-col { overflow-y: auto; padding: var(--s-16) var(--s-20); }
.pact-type-pill { font-size: 10px; font-weight: 600; padding: 2px var(--s-8); border-radius: var(--r-full); border: 1px solid; white-space: nowrap; }

/* ─── Person activity tabs ────────────────────────────────────── */
.pact-section-heading { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--color-muted); margin: var(--s-12) 0 var(--s-4); padding-bottom: var(--s-8); border-bottom: 2px solid var(--color-border); }
.pact-card { background: var(--color-white); border: 1px solid var(--color-border); border-radius: var(--r-md); padding: var(--s-16); margin-bottom: var(--s-12); font-size: var(--fs-small); }
.pact-card-header { display: flex; align-items: center; gap: var(--s-8); flex-wrap: wrap; margin-bottom: var(--s-8); }
.pact-card-body { color: var(--color-body-text); margin: 0; line-height: 1.5; }

/* ─── Notes ───────────────────────────────────────────────────── */
.pnote-card { background: var(--color-white); border: 1px solid var(--color-border); border-radius: var(--r-md); padding: var(--s-16); margin-bottom: var(--s-12); }
.pnote-card-header { display: flex; align-items: center; gap: var(--s-8); margin-bottom: var(--s-8); }
.pnote-source-badge { display: inline-block; padding: 1px 7px; border-radius: var(--r-full); font-size: 9px; font-weight: 700; background: var(--color-status-info-bg); border: 1px solid var(--color-status-info); color: var(--color-status-info-dark); white-space: nowrap; }
.pnote-type-badge { display: inline-block; padding: 1px 7px; border-radius: var(--r-full); font-size: 9px; font-weight: 700; background: var(--color-cream); color: var(--color-muted); white-space: nowrap; }
.pnote-tag { display: inline-block; padding: 1px 7px; border-radius: var(--r-full); font-size: 9px; background: var(--color-off-white); border: 1px solid var(--color-border); color: var(--color-muted); white-space: nowrap; }
.pnote-tags-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: var(--s-4); }
.pnote-content { font-size: var(--fs-small); color: var(--color-body-text); line-height: 1.6; }
.pnote-meta { font-size: var(--fs-eyebrow); color: var(--color-muted); }
.pnotes-col-heading { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--color-muted); margin: var(--s-8) 0 var(--s-4); }

/* ─── Schedule ────────────────────────────────────────────────── */
.schedule-area-row { display: grid; grid-template-columns: 60px 1fr; gap: var(--s-8); align-items: start; }
.schedule-column { display: flex; flex-direction: column; gap: var(--s-4); }
.schedule-day { background: var(--color-white); border: 1px solid var(--color-border); border-radius: var(--r-md); padding: var(--s-8); margin-bottom: var(--s-8); }
.schedule-appointment { background: var(--color-1-transparent-2); border-left: 3px solid var(--accent); border-radius: 0 var(--r-sm) var(--r-sm) 0; padding: var(--s-4) var(--s-8) var(--s-4) var(--s-12); font-size: var(--fs-small); margin-bottom: var(--s-4); }
.schedule-appointment.active { background: var(--accent); color: var(--color-white); border-left-color: var(--accent-dark); }
.schedule-agenda { display: flex; flex-direction: column; gap: var(--s-4); }
.schedule-area-list { display: flex; flex-direction: column; }
.schedule-map { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-16); }
.schedule-map-frame { border: 1px solid var(--color-border); border-radius: var(--r-md); overflow: hidden; background: var(--color-off-white); }
.schedule-map-accounts { display: flex; flex-direction: column; gap: var(--s-8); }

/* ─── Invoice / line items ────────────────────────────────────── */
.appointments-table { width: 100%; border-collapse: collapse; font-size: var(--fs-small); }
.appointments-table th { background: var(--color-cream); padding: var(--s-8) var(--s-12); text-align: left; font-size: var(--fs-eyebrow); text-transform: uppercase; font-weight: 600; border-bottom: 1px solid var(--color-border); }
.appointments-table td { padding: var(--s-8) var(--s-12); border-bottom: 1px solid var(--color-border); }

/* ─── Bar chart ───────────────────────────────────────────────── */
.graph-grid { display: grid; gap: var(--s-4); }
.graph-row { display: grid; grid-template-columns: 80px 1fr auto; gap: var(--s-8); align-items: center; font-size: var(--fs-small); }
.graph-card { background: var(--color-white); border: 1px solid var(--color-border); border-radius: var(--r-md); padding: var(--s-16); }
.bar { background: var(--color-cream); border-radius: var(--r-sm); height: 14px; overflow: hidden; position: relative; }
.bar > div { height: 100%; background: var(--accent); border-radius: var(--r-sm); }
.pie-wrap { position: relative; }
.pie-chart { width: 100%; aspect-ratio: 1; border-radius: 50%; }
.pie-legend { display: flex; flex-direction: column; gap: 4px; margin-top: var(--s-8); }
.count { font-size: var(--fs-eyebrow); font-weight: 700; color: var(--accent); }
.map-panel { border: 1px solid var(--color-border); border-radius: var(--r-md); overflow: hidden; }
.row { display: flex; align-items: center; gap: var(--s-8); }
.item { display: flex; align-items: center; gap: var(--s-4); }
.meta { font-size: var(--fs-eyebrow); color: var(--color-muted); }
.meta-line { display: flex; gap: var(--s-8); align-items: center; flex-wrap: wrap; margin: var(--s-4) 0; }
.tab-title-row { display: flex; align-items: center; gap: var(--s-8); margin-bottom: var(--s-12); }
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ─── Person detail page ──────────────────────────────────────── */
.person-main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--s-16);
  min-width: 0;
}
.person-main-grid > * { min-width: 0; }
.person-profile-header {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  flex-wrap: wrap;
}

/* ─── Pipeline workspace ──────────────────────────────────────── */
.pipeline-workspace {
  display: grid;
  grid-template-columns: repeat(4, minmax(200px, 1fr));
  gap: var(--s-12);
  min-width: 0;
}
.pipeline-lane {
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  padding: var(--s-12);
  background: var(--color-white);
}
.pipeline-lane.market   { background: var(--color-2-transparent-1); }
.pipeline-lane.prospect { background: var(--color-status-danger-bg); }
.pipeline-lane.lead     { background: var(--color-status-warning-bg); }
.pipeline-lane.sale     { background: var(--color-status-success-bg); }
.pipeline-lane-desc { font-size: 0.78rem; color: var(--color-muted); margin: -4px 0 10px; line-height: 1.4; }
.pipeline-lane h3 { margin: 0 0 10px; font-size: var(--fs-small); font-weight: 700; }
.lane-stack { display: grid; gap: var(--s-8); min-height: 120px; }
.pipeline-note-list { display: grid; gap: var(--s-8); }

/* ─── Sidebar pipeline board ──────────────────────────────────── */
.sidebar-pipeline-board { display: grid; gap: var(--s-8); margin-top: var(--s-8); }
.sidebar-pipeline-stage {
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  padding: var(--s-8);
  background: var(--color-white);
}
.sidebar-pipeline-stage header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
}
.sidebar-pipeline-stage.prospect { background: var(--color-status-danger-bg); border-color: var(--color-status-danger); }
.sidebar-pipeline-stage.lead     { background: var(--color-status-warning-bg); border-color: var(--color-status-warning); }
.sidebar-pipeline-stage.sale     { background: var(--color-status-success-bg); border-color: var(--color-status-success); }
.sidebar-pipeline-cards { display: grid; gap: 6px; min-height: 28px; }
.pipeline-card-biz  { font-size: 11px; font-weight: 700; color: var(--dark); letter-spacing: 0.02em; }
.pipeline-card-name { font-size: 12px; color: var(--color-heading); }

/* ─── Pipeline: stage labels ──────────────────────────────────── */
.prospect { color: var(--color-status-danger); }
.lead     { color: var(--color-status-warning); }
.sale     { color: var(--color-status-success); }
.market   { color: var(--color-status-info); }

/* ─── Status text helpers ─────────────────────────────────────── */
.good    { color: var(--color-status-success); font-weight: 600; }
.bad     { color: var(--color-status-danger); font-weight: 600; }
.warn    { color: var(--color-status-warning); font-weight: 600; }
.accent  { color: var(--accent); font-weight: 600; }
.primary { color: var(--dark); font-weight: 600; }
.ghost   { opacity: 0.55; }

/* ─── Tone color helpers ──────────────────────────────────────── */
.tone-1 { background: var(--color-1-transparent-1); border-color: var(--color-1-transparent-3); color: var(--dark); }
.tone-2 { background: var(--color-2-transparent-1); border-color: var(--color-2-transparent-3); color: var(--dark); }
.tone-3 { background: var(--color-3-transparent-1); border-color: var(--color-3-transparent-3); color: var(--dark); }
.tone-4 { background: var(--color-4-transparent-1); border-color: var(--color-4-transparent-3); color: var(--dark); }

/* ─── Entity links & footer ───────────────────────────────────── */
.entity-link { color: var(--color-status-success); font-weight: 600; text-decoration: none; cursor: pointer; }
.entity-link:hover { text-decoration: underline; }
.footer-note { color: var(--color-muted); font-size: var(--fs-eyebrow); }

/* ─── Business card (in pipeline lanes) ──────────────────────── */
.business-card { display: grid; grid-template-columns: 1fr auto; gap: var(--s-8); align-items: center; }
.business-card .meta { font-size: var(--fs-small); color: var(--color-muted); line-height: 1.5; }

/* ─── Chip / tag ─────────────────────────────────────────────── */
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--color-border); border-radius: var(--r-full); padding: 4px 10px; font-size: 12px; background: var(--color-cream); }

/* ─── Bar / graph ─────────────────────────────────────────────── */
.bar-wrap { display: grid; gap: var(--s-8); }
.graph-track { height: 10px; border-radius: var(--r-full); background: var(--color-border); overflow: hidden; }
.graph-fill  { height: 100%; background: var(--accent); border-radius: var(--r-full); }
.columns { display: flex; align-items: flex-end; gap: var(--s-12); height: 140px; padding-top: var(--s-8); }
.column-item { flex: 1; display: grid; gap: 6px; justify-items: center; }
.column-item .bar { width: 100%; max-width: 48px; background: var(--accent); border-radius: 8px 8px 2px 2px; min-height: 4px; }
.column-item .label { font-size: 11px; color: var(--color-muted); text-align: center; }
.column-item .value { font-size: 11px; font-weight: 600; color: var(--dark); }

/* ─── Composer (note editor) ──────────────────────────────────── */
.composer { border: 1px solid var(--color-border); border-radius: var(--r-md); padding: var(--s-8); min-height: 88px; background: var(--color-white); }

/* ─── Process sale layout ─────────────────────────────────────── */
.process-sale-layout { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; align-items: start; min-width: 0; }

/* ─── Product catalog ─────────────────────────────────────────── */
.product-catalog-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: 7px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  background: var(--color-white);
  font-size: var(--fs-eyebrow);
  gap: var(--s-8);
  cursor: pointer;
  text-align: left;
  width: 100%;
  font-family: inherit;
}
.product-catalog-item:hover { background: var(--color-off-white); border-color: var(--accent); }
.product-catalog-item .add-label { font-size: var(--fs-eyebrow); color: var(--dark); font-weight: 700; white-space: nowrap; }
.product-cat-label { font-size: 10px; color: var(--color-muted); }

/* ─── Order cart ──────────────────────────────────────────────── */
.order-cart-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: var(--s-8);
  align-items: center;
  padding: 7px 10px;
  background: var(--color-off-white);
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  font-size: 12px;
}
.order-cart-item .remove-item { cursor: pointer; color: var(--color-status-danger); font-weight: 700; background: none; border: none; padding: 0 4px; }
.order-history-item { padding: 8px 10px; border: 1px solid var(--color-border); border-radius: var(--r-md); background: var(--color-white); font-size: 12px; }
.order-history-item strong { display: block; }
.order-history-item span { color: var(--color-muted); font-size: 11px; }

/* ─── Customer pipeline buckets ───────────────────────────────── */
.cust-pipeline-subnav { display: flex; gap: 6px; margin-bottom: 0; }
.cust-pipeline-subnav button {
  padding: 5px 14px;
  border-radius: var(--r-full);
  border: 1px solid var(--color-border);
  background: var(--color-white);
  font-size: 12px;
  cursor: pointer;
  color: var(--dark);
  font-family: inherit;
}
.cust-pipeline-subnav button.active { background: var(--dark); color: var(--color-white); border-color: var(--dark); }
.cust-pipeline-buckets { display: grid; gap: 14px; margin-bottom: 20px; }
.cust-bucket-col { background: var(--color-off-white); border: 1px solid var(--color-border); border-radius: var(--r-md); padding: 14px; min-height: 180px; }
.cust-bucket-col h4 { margin: 0 0 4px; font-size: var(--fs-small); color: var(--dark); font-weight: 700; }
.bucket-desc { font-size: 11px; color: var(--color-muted); margin: 0 0 12px; }
.cust-bucket-card { background: var(--color-white); border: 1px solid var(--color-border); border-radius: var(--r-sm); padding: 10px 12px; margin-bottom: var(--s-8); display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s-8); }
.cust-bucket-card .card-info strong { font-size: var(--fs-small); display: block; }
.cust-bucket-card .card-info small { font-size: 11px; color: var(--color-muted); display: block; margin-top: 2px; }
.card-badges { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 5px; }
.cust-bucket-badge { font-size: 10px; background: var(--color-1-transparent-1); color: var(--dark); border-radius: var(--r-full); padding: 1px 7px; }
.cust-add-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--s-8); max-height: 300px; overflow-y: auto; }
.cust-add-card { background: var(--color-white); border: 1px solid var(--color-border); border-radius: var(--r-md); padding: 10px 12px; display: flex; justify-content: space-between; align-items: center; gap: var(--s-8); }
.cust-add-card strong { font-size: 12px; display: block; }
.cust-add-card small { font-size: 10px; color: var(--color-muted); }
.process-sale-biz-header { font-size: 15px; font-weight: 700; color: var(--dark); margin-bottom: var(--s-8); }

/* ─── Org-nav badge ───────────────────────────────────────────── */
.org-nav-badge { display: inline-flex !important; align-items: center; gap: 3px; padding: 2px 7px; border-radius: 10px; font-size: 9px; font-weight: 600; border: 1px solid; cursor: pointer; white-space: nowrap; }

/* ─── PO compose panel ────────────────────────────────────────── */
.po-compose-wrap { overflow: visible !important; position: relative; }
.po-catalog-panel { position: fixed; left: 0; top: 50px; bottom: 0; width: 320px; background: var(--color-off-white); border-right: 1px solid var(--color-border); display: flex; flex-direction: column; overflow: hidden; transform: translateX(-320px); transition: transform var(--t-med); z-index: 200; }
.po-compose-wrap.side-open .po-catalog-panel { transform: translateX(0); box-shadow: var(--shadow-md); }
.po-catalog-header { padding: 12px 14px; background: var(--dark); color: var(--color-white); flex-shrink: 0; font-weight: 700; }
.po-compose-wrap > .side-tab-btn { display: flex; position: fixed; left: 0; right: auto; top: 50vh; border-radius: 0 var(--r-md) var(--r-md) 0; border-left: none; border-right: 1px solid var(--color-border); z-index: 201; }
.po-compose-wrap.side-open > .side-tab-btn { left: 320px; }

/* ─── Mobile context bar ──────────────────────────────────────── */
.mobile-context-bar { display: none; background: var(--dark); color: var(--color-white); padding: var(--s-8) var(--s-12); font-size: var(--fs-small); align-items: center; justify-content: space-between; gap: var(--s-8); flex-shrink: 0; }
.mcb-biz-name { font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mcb-context-label { font-size: var(--fs-eyebrow); color: rgba(255,255,255,.7); }

/* ─── Mobile view toggle ──────────────────────────────────────── */
.appt-mobile-view-toggle { display: none; gap: var(--s-8); padding: var(--s-8) 0 var(--s-4); border-top: 1px solid var(--color-border); margin-top: var(--s-8); }
.appt-mvbtn { display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px; font-size: var(--fs-small); background: var(--color-white); color: var(--dark); border: 1px solid var(--color-border); border-radius: var(--r-sm); cursor: pointer; }
.appt-mvbtn.active { background: var(--dark); color: var(--color-white); border-color: var(--dark); }

/* ─── Person header / entity detail ──────────────────────────────*/
.pctasks-col-heading { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--color-muted); margin: var(--s-8) 0 var(--s-4); }

/* ═══════════════════════════════════════════════════════════════
   Responsive — @media (max-width: 900px)
   ═══════════════════════════════════════════════════════════════ */
/* ── Large breakpoint: sidebar stacks on tablet ────────────────── */
@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    display: none;
    position: fixed !important;
    top: 50px;
    left: 0;
    width: 280px;
    height: calc(100vh - 50px);
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 4px 0 20px rgba(0,0,0,.18);
    overflow-y: auto;
    border-right: none;
  }
  .sidebar.open {
    display: flex !important;
    transform: translateX(0);
  }
  .mobile-tab-tree { display: block; }
  .mobile-context-bar { display: flex; }
  .workspace-header { top: 0; }
  .pipeline-grid { grid-template-columns: 1fr; }
  .graph-grid { grid-template-columns: 1fr; }
  .dashboard-layout { grid-template-columns: 1fr; }
  .section.grid-2 { grid-template-columns: 1fr; }
  .section.grid-3 { grid-template-columns: 1fr; }
  .org-dash-2col { grid-template-columns: 1fr !important; }
  .org-dash-3col { grid-template-columns: 1fr !important; }
  .pie-wrap { grid-template-columns: 1fr; justify-items: center; }

  /* Show mobile menu toggle, hide individual links */
  .menu-strip-toggle { display: inline-flex; }
  .menu-strip .menu-link,
  .menu-strip .button,
  .menu-strip > span { display: none !important; }
  /* When strip is open, show links as dropdown */
  .menu-strip.open {
    flex-direction: column;
    height: auto;
    overflow: visible;
  }
  .menu-strip.open .menu-link,
  .menu-strip.open .button {
    display: flex !important;
    width: 100%;
    padding: 10px 16px;
    text-align: left;
    justify-content: flex-start;
  }

  #mobile-menu-toggle { display: flex; }
}

/* ── Medium breakpoint: toolbar stacks ─────────────────────────── */
@media (max-width: 700px) {
  .toolbar { grid-template-columns: 1fr; }
  .toolbar-actions { justify-content: flex-start; }
  .content { padding: 10px; }
  /* Schedule collapses to 1 column, hide map & accounts columns */
  .schedule-layout { grid-template-columns: 1fr; }
  .schedule-layout .schedule-column:nth-child(2),
  .schedule-layout .schedule-column:nth-child(3) { display: none; }
}

/* ── Main responsive block ─────────────────────────────────────── */
@media (max-width: 900px) {
  /* crm-* shell classes */
  .crm-shell { grid-template-columns: 1fr; }
  .crm-sidebar { display: none; }
  .crm-mobile-context-bar { display: flex; }
  .crm-content { padding: var(--s-12); }
  .crm-topbar { padding-inline: var(--s-12); }

  /* Appointments — only hide KPI strip inside the CRM shell (not dashboard) */
  .crm-content .crm-kpi-strip { display: none !important; }
  .crm-mobile-view-toggle { display: flex !important; }
  .appt-mobile-view-toggle { display: flex; }

  /* Calendar: cal view goes full-width */
  .appt-mode-cal .appt-list-col { display: none !important; }
  .appt-mode-cal .appt-cal-col  { grid-column: 1 / -1 !important; }

  /* Uniform calendar day cells on mobile */
  .crm-cal-day { min-height: 0 !important; height: 52px; overflow: hidden; }

  /* Appointment chips become dots on mobile */
  .crm-cal-appt-chip {
    font-size: 0 !important;
    width: 8px; height: 8px;
    border-radius: 50% !important;
    border-left: none;
    background: currentColor;
    padding: 0;
    display: inline-block;
    margin: 1px;
  }

  /* Side panel: show tab button */
  .side-tab-btn { display: flex; }
  .side-crm-tab-bar__tab { display: flex; }

  /* pact-wrap activity panel: single-column with slide-in section list */
  .pact-body { position: relative; grid-template-columns: 1fr !important; overflow: visible !important; }
  .pact-section-list { position: absolute; left: 0; top: 0; bottom: 0; width: 210px; z-index: 20; transform: translateX(-211px); transition: transform var(--t-fast); background: var(--color-off-white); }
  .pact-wrap.side-open .pact-section-list { transform: translateX(0); box-shadow: var(--shadow-md); }
  .pact-wrap.side-open .side-crm-tab-bar__tab { left: 210px; }
  .pact-detail-col { overflow-x: hidden; }

  /* conv-grid: slide-in channels column */
  .conv-grid { position: relative; grid-template-columns: 1fr !important; overflow: visible !important; }
  .conv-grid > div:first-of-type { position: absolute; left: 0; top: 0; bottom: 0; width: 160px; z-index: 20; background: var(--color-off-white); transform: translateX(-161px); transition: transform var(--t-fast); border-right: 1px solid var(--color-border); }
  .conv-grid.side-open > div:first-of-type { transform: translateX(0); box-shadow: var(--shadow-md); }
  .conv-grid.side-open .side-crm-tab-bar__tab { left: 160px; }

  /* pctasks-grid: slide-in task nav column */
  .pctasks-grid { position: relative; grid-template-columns: 1fr !important; overflow: visible !important; }
  .pctasks-crm-col { position: absolute; left: 0; top: 0; bottom: 0; width: 260px; z-index: 20; background: var(--color-off-white); transform: translateX(-261px); transition: transform var(--t-fast); }
  .pctasks-grid.side-open .pctasks-crm-col { transform: translateX(0); box-shadow: var(--shadow-md); }
  .pctasks-grid.side-open .side-crm-tab-bar__tab { left: 260px; }

  /* pnotes-grid: slide-in compose column */
  .pnotes-grid { position: relative; grid-template-columns: 1fr !important; overflow: visible !important; }
  .pnotes-compose-col { position: absolute; left: 0; top: 0; bottom: 0; width: 260px; z-index: 20; transform: translateX(-261px); transition: transform var(--t-fast); }
  .pnotes-grid.side-open .pnotes-compose-col { transform: translateX(0); box-shadow: var(--shadow-md); }
  .pnotes-grid.side-open .side-crm-tab-bar__tab { left: 260px; }

  /* org-tasks-grid: slide-in contacts column */
  .org-tasks-grid { position: relative; grid-template-columns: 1fr !important; overflow: visible !important; }
  .org-tasks-left { position: absolute; left: 0; top: 0; bottom: 0; width: 220px; z-index: 20; background: var(--color-off-white); transform: translateX(-221px); transition: transform var(--t-fast); border-right: 1px solid var(--color-border); max-height: none !important; }
  .org-tasks-grid.side-open .org-tasks-left { transform: translateX(0); box-shadow: var(--shadow-md); }
  .org-tasks-grid.side-open .side-crm-tab-bar__tab { left: 220px; }

  /* org-notes-outer: slide-in contacts column */
  .org-notes-outer { position: relative; grid-template-columns: 1fr !important; overflow: visible !important; }
  .org-notes-left { position: absolute; left: 0; top: 0; bottom: 0; width: 220px; z-index: 20; background: var(--color-off-white); transform: translateX(-221px); transition: transform var(--t-fast); border-right: 1px solid var(--color-border); max-height: none !important; }
  .org-notes-outer.side-open .org-notes-left { transform: translateX(0); box-shadow: var(--shadow-md); }
  .org-notes-outer.side-open .side-crm-tab-bar__tab { left: 220px; }

  /* Layout collapse for activity sub-pages */
  .crm-activity-layout { grid-template-columns: 1fr; }
  .crm-activity-nav { display: none; }

  .crm-notes-layout  { grid-template-columns: 1fr; }
  .crm-tasks-layout  { grid-template-columns: 1fr; }
  .crm-conv-layout   { grid-template-columns: 1fr; }
  .crm-conv-channel-nav { display: none; }

  /* Person grid */
  .person-main-grid { grid-template-columns: 1fr 1fr; }
  .person-interests-grid { grid-template-columns: 1fr 1fr !important; }
  .sopp-grid { grid-template-columns: 1fr 1fr !important; }

  /* Tabs scroll — hide non-essential */
  .tabs { padding: 0 10px 4px; }
  .tabs-row { padding: 0 10px; }

  /* KPI strip */
  .kpis { flex-wrap: wrap; }
  .kpi { min-width: 90px; }

  /* Split becomes stack */
  .split { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }

  /* Schedule map stack */
  .schedule-map { grid-template-columns: 1fr; }
}

/* ── Small / phone breakpoint ───────────────────────────────────── */
@media (max-width: 640px) {
  #save-workspace-btn, #restore-session-btn { display: none; }
  /* Hide chip filter rows on mobile (replaced by .mobile-context-bar) */
  .workspace-header .crm-tab-bar { display: none; }
}

@media (max-width: 600px) {
  .person-main-grid { grid-template-columns: 1fr; }
  .person-interests-grid { grid-template-columns: 1fr !important; }
  .sopp-grid { grid-template-columns: 1fr !important; }
  .person-profile-header { flex-direction: column; }
  .appointments-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .person-edit-form-grid { grid-template-columns: 1fr !important; }
  .content { padding: 8px !important; }
  .sopp-page { padding: 12px !important; }
  .sopp-kpi { min-width: 70px !important; padding: 8px 10px !important; }
  .sopp-kpi-val { font-size: 18px !important; }

  /* Tabs: ultra compact */
  .tab { min-width: 90px; max-width: 180px; font-size: 12px; }
  .tab-title { font-size: 12px; }
  .crm-titlebar { font-size: 13px; padding: 0 10px; }
  .crm-titlebar a { font-size: 13px; }

  /* Dashboard compact */
  .dashboard { padding: var(--s-12); }
  .dashboard-layout { gap: var(--s-12); }

  /* Section compact */
  .section { padding: var(--s-16); }

  /* Toolbar compact */
  .toolbar { margin: 8px 10px; }
  .search-wrap input { padding: 8px 32px 8px 10px; }

  /* Mobile topnav: hide text items if too long */
  .topnav .header-nav-item { display: none; }
  #mobile-menu-toggle { display: flex; }
}

/* --- Contacts page responsive filter -------------------------- */
.contacts-filter-panel { display: block; }
button[data-contacts-filter-toggle] { display: none; }
.hide-mobile { }
@media (max-width: 768px) {
  .contacts-filter-panel { display: none; }
  .contacts-filter-panel.mobile-open { display: block !important; position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 200; overflow-y: auto; background: var(--color-white); }
  button[data-contacts-filter-toggle] { display: flex !important; }
  .hide-mobile { display: none !important; }
  .contacts-layout { grid-template-columns: 1fr !important; }
}

/* ═══════════════════════════════════════════════════════════════
   Dev tools — sidebar toggle (devtools.js)
   ═══════════════════════════════════════════════════════════════ */
/* Applied to <body> by devtools.js when panel is toggled off */
body.no-sidebar .page-shell   { grid-template-columns: 1fr !important; }
body.no-sidebar .page-sidebar { display: none !important; }

/* ═══════════════════════════════════════════════════════════════
   Business View page — .bv-* layout classes
   ═══════════════════════════════════════════════════════════════ */
.bv-top-row     { display: grid; grid-template-columns: 1fr auto; gap: var(--s-8); margin-bottom: var(--s-16); align-items: stretch; }
.bv-header-card { display: flex; align-items: flex-start; gap: 20px; padding: var(--s-16); }
.bv-quadrants   { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-8); margin-bottom: var(--s-16); }
.bv-quick-add   { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-16); }

@media (max-width: 900px) {
  .bv-top-row   { grid-template-columns: 1fr; }
  .bv-quick-add { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .bv-top-row          { grid-template-columns: 1fr; }
  .bv-header-card      { flex-direction: column; gap: 12px; }
  .bv-header-logo      { width: 100% !important; height: 56px !important; }
  .bv-header-meta      { grid-template-columns: 1fr !important; }
  .bv-header-actions   { flex-direction: row; flex-wrap: wrap; }
  .bv-pie-card         { flex-direction: row !important; align-items: center; gap: 20px; padding: var(--s-16) !important; }
  .bv-pie-card .eyebrow { display: none; }
  .bv-quadrants        { grid-template-columns: 1fr; }
  .bv-appt-table       { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .bv-quick-add        { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════════
   List3 page shell — triggered by .list3-page on the <section>
   No class on <html>, <body>, or any main tag.
   Uses CSS :has() (all modern browsers).
   ═══════════════════════════════════════════════════════════════ */
body:has(.list3-page) {
  height: 100dvh;
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body:has(.list3-page) nav { flex-shrink: 0; }
body:has(.list3-page) .page-content {
  flex: 1 1 0;
  overflow-y: auto;
  min-height: 0;
}
body:has(.list3-page) .page-content .container {
  max-width: 100%;
  padding-inline: var(--s-24, 24px);
}

/* ═══════════════════════════════════════════════════════════════
   Mobile list patterns — table--mobile-cards + filter-toggle
   Pure HTML/CSS, no JavaScript.
   ═══════════════════════════════════════════════════════════════ */

/* ── Filter toggle (CSS-only checkbox hack) ─────────────────────
   DOM order required inside <aside>:
     <input type="checkbox" class="filter-toggle-input" id="ft">
     <label for="ft"  class="filter-toggle-btn">Filters <i class="filter-chevron">▼</i></label>
     <div class="filter-panel"> ... cards ... </div>
   ─────────────────────────────────────────────────────────────── */
.filter-toggle-input { display: none; }  /* always hidden */
.filter-toggle-btn   { display: none; }  /* hidden on desktop — shown on mobile */
/* .filter-panel visible by default on desktop */

/* ── Mobile card table ───────────────────────────────────────────
   Add class="table--mobile-cards" to any .table on a list page.
   Add data-label="Column Name" to every <td> in tbody.
   ─────────────────────────────────────────────────────────────── */
/* no desktop overrides needed */

/* ── Sort arrows (added by listutils.js) ─────────────────────── */
.sortable-th {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.sortable-th:hover { color: var(--dark, #002858); }
.sort-arrow {
  display: inline-block;
  margin-left: 5px;
  font-size: 12px;
  color: var(--color-border);
  transition: color 0.15s;
  line-height: 1;
}
.sort-arrow--active { color: var(--accent); font-size: 13px; }

/* ── Pagination bar (added by listutils.js) ───────────────────── */
.list-table-wrap { position: relative; }
.list-pagination {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-12) 0 var(--s-8);
  flex-wrap: wrap;
}
.list-page-label {
  font-size: var(--fs-eyebrow);
  color: var(--color-muted);
  margin-right: var(--s-8);
  flex-shrink: 0;
}
.list-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 var(--s-8);
  font-size: var(--fs-eyebrow);
  font-family: inherit;
  font-weight: 600;
  border: 1px solid var(--color-border);
  border-radius: var(--r-sm);
  background: var(--color-white);
  color: var(--color-body-text);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.list-page-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.list-page-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.list-page-btn--active {
  background: var(--dark);
  border-color: var(--dark);
  color: var(--color-white);
}

@media (max-width: 640px) {
  .list-pagination { padding: var(--s-12) var(--s-16) var(--s-8); }
  .list-page-btn { min-width: 36px; height: 36px; font-size: var(--fs-small); }
}

@media (max-width: 640px) {
  /* ── Strip section/container padding on list3 pages ── */
  body:has(.list3-page) .page-content .section   { padding: 0 !important; }
  body:has(.list3-page) .page-content .container { padding-inline: 0 !important; }

  /* ── Stack aside above main ── */
  body:has(.list3-page) .page-content .dual-pane             { grid-template-columns: 1fr !important; }
  body:has(.list3-page) .page-content .dual-pane > aside     { order: 1; overflow: visible; }
  body:has(.list3-page) .page-content .dual-pane > main      { order: 2; min-width: 0; overflow: visible; }

  /* ── Filter toggle button ── */
  .filter-toggle-btn {
    display: flex;
    align-items: center;
    gap: var(--s-8);
    width: 100%;
    padding: 11px var(--s-16);
    background: var(--color-cream);
    border: none;
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
    font-family: inherit;
    font-size: var(--fs-small);
    font-weight: 600;
    color: var(--color-body-text);
    text-align: left;
    user-select: none;
    box-sizing: border-box;
  }
  .filter-chevron {
    margin-left: auto;
    display: inline-block;
    font-style: normal;
    transition: transform 0.2s ease;
  }
  .filter-toggle-input:checked ~ .filter-toggle-btn .filter-chevron {
    transform: rotate(180deg);
  }

  /* ── Filter panel: hidden by default, shown when checked ── */
  .filter-panel { display: none; }
  .filter-toggle-input:checked ~ .filter-panel { display: block; }
  .filter-toggle-input:checked ~ .filter-panel .card {
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
    box-shadow: none;
  }

  /* ── Table → cards ── */
  .table--mobile-cards thead { display: none; }

  .table--mobile-cards tbody tr {
    display: block;
    background: var(--color-white);
    border-bottom: 8px solid var(--color-cream);
  }
  .table--mobile-cards tbody tr:last-child { border-bottom: none; }
  .table--mobile-cards tbody tr:hover td   { background: transparent !important; }

  .table--mobile-cards tbody td {
    display: flex;
    align-items: center;
    gap: var(--s-8);
    padding: 9px var(--s-16);
    border-bottom: 1px solid var(--color-border);
    font-size: var(--fs-small);
    background: transparent !important;
  }
  .table--mobile-cards tbody td:last-child { border-bottom: none; }

  /* Label from data-label — fixed width, never shrinks */
  .table--mobile-cards tbody td::before {
    content: attr(data-label);
    flex: 0 0 90px;
    font-size: var(--fs-eyebrow);
    font-weight: 700;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: .07em;
    white-space: nowrap;
  }

  /* First cell = no special treatment — same label | value as all others */
  .table--mobile-cards tbody td:first-child {
    background: transparent !important;
    font-weight: 600;
    border-bottom: 1px solid var(--color-border);
  }

  /* Photo row — centered image, no label, full-width on mobile */
  .table--mobile-cards tbody td.row-photo {
    justify-content: center;
    padding: var(--s-16) var(--s-16) var(--s-12);
    background: var(--color-off-white) !important;
    border-bottom: 1px solid var(--color-border);
  }
  .table--mobile-cards tbody td.row-photo::before { display: none; }

  /* Last cell = action buttons on one row */
  .table--mobile-cards tbody td:last-child {
    gap: var(--s-8);
    padding: 10px var(--s-16);
    background: var(--color-off-white) !important;
  }
  .table--mobile-cards tbody td:last-child::before { display: none; }
}

/* ═══════════════════════════════════════════════════════════════
   Mobile-friendly: grid + dual-pane collapse
   ═══════════════════════════════════════════════════════════════ */

/* Tablet — 900px: stack grids and dual-pane */
@media (max-width: 900px) {
  /* Standalone .grid-* not already covered by the .section.grid-* rules above */
  .grid-2 { grid-template-columns: 1fr !important; }
  .grid-3 { grid-template-columns: 1fr !important; }
  .grid-4 { grid-template-columns: 1fr !important; }

  /* Aside + main layout used on list pages */
  .dual-pane { grid-template-columns: 1fr !important; }
  .dual-pane > aside { order: 2; overflow: visible; }  /* filters move below main content on mobile */
  .dual-pane > main  { order: 1; overflow-x: auto; }

  /* Tables scroll horizontally instead of expanding the column */
  .table { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* Phone — 600px: reduce section padding, scrollable tables, compact container */
@media (max-width: 600px) {
  /* Reduce section vertical padding so content isn't buried */
  .section { padding-block: var(--s-32) !important; }

  /* Prevent container from touching screen edges */
  .container { padding-inline: var(--s-16) !important; }

  /* Make all data tables scrollable rather than clipping */
  .table { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Fieldset rows that use grid-3 (city/state/zip) */
  .grid-3 { grid-template-columns: 1fr !important; }

  /* Card headers that use inline flex often overflow on very small screens */
  .card { padding: var(--s-12) !important; }

  /* Form submit button rows — stack on tiny screens */
  .btn + .btn { margin-top: var(--s-8); }
}
