/* AgentPipeline modern CRM design system — layered over the stable V1 UI. */
:root {
  --modern-canvas: #f5f7f5;
  --modern-paper: #ffffff;
  --modern-paper-soft: #f9fbf9;
  --modern-ink: #17221c;
  --modern-muted: #68756d;
  --modern-line: #dfe6e1;
  --modern-green: #356c4a;
  --modern-green-dark: #244e36;
  --modern-green-soft: #e9f3ec;
  --modern-lime: #d9f36c;
  --modern-blue: #486c9b;
  --modern-blue-soft: #edf3fb;
  --modern-amber: #a96521;
  --modern-amber-soft: #fff4e7;
  --modern-red: #a9483e;
  --modern-red-soft: #fce9e6;
  --modern-shadow: 0 12px 32px rgba(27, 45, 34, 0.065);
  --modern-radius: 16px;
  --modern-radius-sm: 10px;
  --bg: var(--modern-canvas);
  --panel: var(--modern-paper);
  --panel-soft: var(--modern-paper-soft);
  --ink: var(--modern-ink);
  --muted: var(--modern-muted);
  --line: var(--modern-line);
  --green: var(--modern-green);
  --green-dark: var(--modern-green-dark);
  --blue: var(--modern-blue);
  --red: var(--modern-red);
  --amber: var(--modern-amber);
  --shadow: var(--modern-shadow);
}

/* Full analytics workspace */
#reportsView { --analytics-green:#315f3f; --analytics-green-soft:#eaf2ec; --analytics-line:#dce5de; --analytics-muted:#6d7971; }
.analytics-modern-header { display:flex; align-items:flex-end; justify-content:space-between; gap:20px; margin-bottom:14px; padding:20px 22px; }
.analytics-modern-header h3 { margin:3px 0 5px; font-size:clamp(1.5rem,2vw,2rem); }
.analytics-modern-header p:last-child { margin:0; color:var(--analytics-muted); }
.analytics-download-btn { flex:0 0 auto; min-height:42px; }
.analytics-filter-panel { display:grid; grid-template-columns:minmax(220px,1.5fr) minmax(150px,.75fr) minmax(150px,.75fr) minmax(150px,.8fr); gap:12px; align-items:end; margin-bottom:12px; padding:14px; }
.analytics-filter-panel label { display:grid; gap:6px; }
.analytics-filter-panel label > span,
.analytics-filter-status > span { color:var(--analytics-muted); font-size:.72rem; font-weight:700; letter-spacing:.02em; }
.analytics-filter-status { display:grid; min-height:42px; align-content:center; gap:3px; padding:0 12px; border:1px solid var(--analytics-line); border-radius:10px; background:#f7faf8; }
.analytics-filter-status strong { font-size:.86rem; }
.analytics-scope-banner { display:flex; align-items:center; justify-content:space-between; gap:12px; min-height:42px; margin-bottom:10px; padding:10px 14px; border:1px solid #d6e5d9; border-radius:11px; color:#2d5a3a; background:var(--analytics-green-soft); font-size:.82rem; }
.analytics-scope-banner small { color:#577160; text-align:right; }
.analytics-modern-tabs { display:flex; gap:2px; overflow-x:auto; margin:0 0 14px; border-bottom:1px solid var(--analytics-line); scrollbar-width:thin; }
.analytics-modern-tabs button { position:relative; flex:0 0 auto; min-height:46px; padding:0 14px; border:0; color:var(--analytics-muted); background:transparent; font-weight:700; }
.analytics-modern-tabs button[aria-selected="true"] { color:var(--analytics-green); }
.analytics-modern-tabs button[aria-selected="true"]::after { position:absolute; right:10px; bottom:-1px; left:10px; height:3px; border-radius:3px 3px 0 0; content:""; background:var(--analytics-green); }
.analytics-tab-panel[hidden] { display:none !important; }
.analytics-load-status { min-height:20px; margin:0 0 8px; color:var(--analytics-muted); font-size:.76rem; }
.analytics-modern-metrics { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; margin-bottom:12px; }
.analytics-modern-metric { min-width:0; padding:15px; border:1px solid var(--analytics-line); border-radius:13px; background:#fff; box-shadow:0 8px 24px rgba(36,56,43,.035); }
.analytics-modern-metric > span { display:block; min-height:18px; color:var(--analytics-muted); font-size:.74rem; font-weight:700; }
.analytics-modern-metric strong { display:block; margin:5px 0 4px; overflow:hidden; color:#1c2820; font-size:clamp(1.3rem,2vw,1.75rem); font-weight:750; text-overflow:ellipsis; white-space:nowrap; }
.analytics-modern-metric small { display:block; min-height:17px; color:var(--analytics-green); font-size:.72rem; }
.analytics-modern-metric.is-warning small { color:#a87319; }
.analytics-modern-metric.is-loading { opacity:.62; }
.analytics-insight-banner { margin-bottom:12px; padding:12px 14px; border:1px solid #d6e5d9; border-radius:11px; color:#2d5a3a; background:var(--analytics-green-soft); font-size:.82rem; }
.analytics-modern-grid { display:grid; grid-template-columns:minmax(0,1.25fr) minmax(340px,.75fr); gap:12px; }
.analytics-overview-grid { grid-template-columns:minmax(0,1.3fr) minmax(330px,.7fr); }
.analytics-modern-grid > .analytics-modern-card + .analytics-modern-card { margin-top:0; }
.analytics-modern-card { min-width:0; padding:17px; }
.analytics-tab-section { margin-top:12px; }
.analytics-modern-card .panel-head { margin-bottom:14px; }
.analytics-modern-card .panel-head h3 { margin-bottom:3px; }
.analytics-signal-list { display:grid; gap:2px; }
.analytics-signal { display:grid; grid-template-columns:9px minmax(0,1fr) auto; align-items:center; gap:10px; min-height:55px; border-bottom:1px solid var(--analytics-line); }
.analytics-signal:last-child { border-bottom:0; }
.analytics-signal > i { width:8px; height:8px; border-radius:50%; background:var(--analytics-green); }
.analytics-signal > i.is-warning { background:#b37b1a; }
.analytics-signal > i.is-danger { background:#a54d42; }
.analytics-signal div { display:grid; gap:2px; }
.analytics-signal strong { font-size:.82rem; }
.analytics-signal span,
.analytics-signal small { color:var(--analytics-muted); font-size:.73rem; }
.analytics-modern-bars { display:grid; gap:11px; }
.analytics-modern-bars article > div:first-child { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:5px; }
.analytics-modern-bars article > div:first-child strong { font-size:.79rem; }
.analytics-modern-bars article > div:first-child span { color:var(--analytics-muted); font-size:.75rem; font-variant-numeric:tabular-nums; }
.analytics-modern-bars article > div:nth-child(2) { height:8px; overflow:hidden; border-radius:99px; background:#f0f3f1; }
.analytics-modern-bars article > div:nth-child(2) i { display:block; height:100%; border-radius:inherit; background:linear-gradient(90deg,#315f3f,#78a783); }
.analytics-modern-bars article > small { color:var(--analytics-muted); font-size:.69rem; }
.analytics-criteria-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(260px,1fr)); gap:12px; }
.analytics-criteria-group { min-width:0; padding:14px; border:1px solid var(--analytics-line); border-radius:11px; background:#f8faf9; }
.analytics-criteria-group > header { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; margin-bottom:12px; }
.analytics-criteria-group > header strong { color:#1c2820; font-size:.84rem; }
.analytics-criteria-group > header span { flex:0 0 auto; color:var(--analytics-muted); font-size:.7rem; }
.analytics-criteria-group .analytics-modern-bars { gap:9px; }
.analytics-criteria-group .analytics-modern-bars article > div:nth-child(2) { height:6px; }
.analytics-mini-stat-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.analytics-mini-stat-grid article { padding:15px; border:1px solid var(--analytics-line); border-radius:11px; background:#f8faf9; }
.analytics-mini-stat-grid span,
.analytics-mini-stat-grid small { display:block; color:var(--analytics-muted); font-size:.72rem; }
.analytics-mini-stat-grid strong { display:block; margin:8px 0 5px; font-size:1.2rem; }
.analytics-health-score { display:grid; gap:12px; }
.analytics-health-score > strong { font-size:2.6rem; }
.analytics-health-score > div { height:12px; overflow:hidden; border-radius:99px; background:#edf2ee; }
.analytics-health-score > div i { display:block; height:100%; border-radius:inherit; background:linear-gradient(90deg,#315f3f,#88b894); }
.analytics-health-score > span { color:var(--analytics-muted); font-size:.78rem; }
.analytics-quality-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.analytics-quality-actions article { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px; border:1px solid var(--analytics-line); border-radius:11px; background:#f9fbfa; }
.analytics-quality-actions article div { display:grid; gap:3px; }
.analytics-quality-actions strong { font-size:.8rem; }
.analytics-quality-actions span { color:var(--analytics-muted); font-size:.7rem; }
.analytics-quality-actions b { min-width:45px; color:#a54d42; text-align:right; font-size:1.1rem; }
.analytics-catalogue { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }
.analytics-catalogue > section { min-width:0; padding:16px; border:1px solid var(--analytics-line); border-radius:13px; background:#fff; }
.analytics-catalogue h3 { margin:0 0 4px; font-size:1rem; }
.analytics-catalogue section > p { margin:0 0 12px; color:var(--analytics-muted); font-size:.72rem; }
.analytics-catalogue section > div { display:flex; align-items:center; justify-content:space-between; gap:9px; padding:9px 0; border-top:1px solid var(--analytics-line); }
.analytics-catalogue section > div strong { font-size:.76rem; font-weight:650; }
.analytics-catalogue section > div span { color:var(--analytics-green); font-size:.65rem; }
#reportsView .analytics-table th,
#reportsView .analytics-table td { white-space:nowrap; }
#reportsView .analytics-funnel,
#reportsView .analytics-stage-chart { max-height:none; overflow:visible; }

@media (max-width:1200px) {
  .analytics-modern-metrics { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .analytics-catalogue { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width:900px) {
  .analytics-filter-panel { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .analytics-modern-grid,
  .analytics-overview-grid { grid-template-columns:1fr; }
  .analytics-modern-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width:620px) {
  .analytics-modern-header { align-items:flex-start; flex-direction:column; }
  .analytics-filter-panel { grid-template-columns:1fr; }
  .analytics-scope-banner { align-items:flex-start; flex-direction:column; }
  .analytics-scope-banner small { text-align:left; }
  .analytics-modern-metrics,
  .analytics-mini-stat-grid,
  .analytics-quality-actions,
  .analytics-catalogue { grid-template-columns:1fr; }
}

html { background: var(--modern-canvas); }

body {
  background: var(--modern-canvas);
  color: var(--modern-ink);
  font-family: Inter, Aptos, "Segoe UI Variable", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea { font: inherit; }

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(53, 108, 74, .22);
  outline-offset: 2px;
}

/* Authentication */
.auth-screen {
  min-height: 100svh;
  background: #152019;
}

.auth-visual {
  position: relative;
  padding: clamp(42px, 6vw, 86px);
  overflow: hidden;
  background:
    radial-gradient(circle at 16% 82%, rgba(217,243,108,.12), transparent 32%),
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    #152019;
  background-size: auto, 100% 72px, auto;
}

.auth-visual h2 {
  max-width: 980px;
  font-size: clamp(3.6rem, 6.4vw, 7.6rem);
  font-weight: 720;
  line-height: .9;
  letter-spacing: -.065em;
}

.auth-visual p { max-width: 680px; color: rgba(255,255,255,.62); }
.auth-visual .brand-logo-full { width: min(420px, 52%); }
.auth-map { border-color: rgba(255,255,255,.12); border-radius: var(--modern-radius); box-shadow: none; }

.auth-panel {
  padding: clamp(30px, 5vw, 66px);
  background: #fbfcfa;
}

.auth-tabs { padding: 4px; border: 1px solid var(--modern-line); border-radius: 13px; background: #f0f3f0; }
.auth-tab { min-height: 46px; border-radius: 9px; background: transparent; }
.auth-tab.active { color: white; background: var(--modern-green); }
.auth-form h2 { font-size: clamp(2rem, 3vw, 3.2rem); letter-spacing: -.045em; }
.google-btn { min-height: 50px; border-radius: 11px; }
.auth-help { border-radius: 11px; }

/* Product shell */
.app-shell {
  grid-template-columns: 224px minmax(0, 1fr);
  background: var(--modern-canvas);
}

.sidebar {
  z-index: 200;
  gap: 8px;
  padding: 18px 12px;
  border-right: 0;
  background: #152019;
  box-shadow: 8px 0 30px rgba(14,26,18,.05);
}

.sidebar .brand {
  min-height: 54px;
  align-items: center;
  padding: 0 9px 13px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar .brand-logo-full { width: 174px; }
.nav-tabs { gap: 3px; padding: 7px 0 4px; }

.nav-tab {
  position: relative;
  min-height: 42px;
  gap: 9px;
  padding: 9px 10px;
  border: 0;
  border-radius: 10px;
  color: #b9c5bd;
  font-size: .86rem;
  font-weight: 620;
}

.nav-icon {
  width: 24px;
  height: 24px;
  flex-basis: 24px;
  border-radius: 7px;
  color: #d5dfd8;
  background: rgba(255,255,255,.06);
  font-size: .79rem;
}

.nav-tab.active,
.nav-tab:hover {
  border: 0;
  color: #fff;
  background: rgba(255,255,255,.085);
}

.nav-tab.active::before {
  position: absolute;
  left: -12px;
  width: 4px;
  height: 20px;
  border-radius: 0 4px 4px 0;
  background: var(--modern-lime);
  content: "";
}

.sidebar-bottom-nav { padding-top: 7px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-toggle { border-color: rgba(255,255,255,.12); border-radius: 10px; background: rgba(255,255,255,.06); }
.sidebar-panel { border-color: rgba(255,255,255,.09); border-radius: 12px; background: rgba(255,255,255,.045); }

.workspace {
  height: 100vh;
  padding: 0;
  background: var(--modern-canvas);
}

.topbar {
  position: sticky;
  z-index: 120;
  top: 0;
  min-height: 72px;
  margin: 0;
  padding: 11px clamp(20px, 2.4vw, 34px);
  border-bottom: 1px solid var(--modern-line);
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(16px);
}

.topbar h2 { font-size: 1.45rem; font-weight: 740; letter-spacing: -.035em; }
.topbar .eyebrow { margin-bottom: 2px; color: var(--modern-green); font-size: .64rem; letter-spacing: .1em; }
.topbar-actions { gap: 8px; }
.user-chip { border-radius: 999px; background: var(--modern-green-soft); }

.view {
  width: min(1540px, 100%);
  margin: 0 auto;
  padding: clamp(22px, 2.5vw, 34px);
}

/* Shared controls */
.primary-btn,
.ghost-btn,
.text-btn,
.bug-report-btn,
.suggestion-report-btn,
.danger-btn,
.command-trigger {
  min-height: 40px;
  border-radius: var(--modern-radius-sm);
  font-weight: 740;
  letter-spacing: -.01em;
}

.primary-btn { border-color: var(--modern-green); background: var(--modern-green); box-shadow: 0 5px 14px rgba(53,108,74,.15); }
.primary-btn:hover { border-color: var(--modern-green-dark); background: var(--modern-green-dark); }
.ghost-btn { border-color: var(--modern-line); color: var(--modern-ink); background: var(--modern-paper); }
.ghost-btn:hover { border-color: #cbd7ce; background: #f1f5f2; }
.text-btn { color: var(--modern-green); }
.bug-report-btn, .suggestion-report-btn { border-color: var(--modern-line); color: var(--modern-muted); background: var(--modern-paper); }
.danger-btn { border-color: #ecc9c5; color: var(--modern-red); background: var(--modern-red-soft); }

input,
select,
textarea {
  min-height: 42px;
  border: 1px solid #d6dfd8;
  border-radius: var(--modern-radius-sm);
  color: var(--modern-ink);
  background: #fff;
  box-shadow: 0 1px 2px rgba(25,45,33,.025);
}

input:hover,
select:hover,
textarea:hover { border-color: #bccbc0; }

input:focus,
select:focus,
textarea:focus {
  border-color: var(--modern-green);
  box-shadow: 0 0 0 3px rgba(53,108,74,.1);
}

label > span,
.field-label { color: #536158; font-size: .72rem; font-weight: 760; }

.panel,
.metric,
.today-metric,
.stat-card,
.report-card,
.subscription-card {
  border: 1px solid var(--modern-line);
  border-radius: var(--modern-radius);
  background: var(--modern-paper);
  box-shadow: 0 2px 12px rgba(25,45,33,.025);
}

.panel { padding: 18px; }
.panel-head { min-height: 42px; gap: 14px; margin-bottom: 15px; }
.panel-head h3 { font-size: .98rem; font-weight: 760; letter-spacing: -.02em; }
.panel-head span { color: var(--modern-muted); font-size: .72rem; }

.filters,
.management-filters,
.property-filters,
.client-list-filters,
.followup-filters,
.admin-filters {
  gap: 11px;
  padding: 14px;
  border: 1px solid var(--modern-line);
  border-radius: 13px;
  background: var(--modern-paper-soft);
}

.table-toolbar { gap: 10px; margin: 14px 0 10px; }
.data-table-wrap { border: 1px solid var(--modern-line); border-radius: 13px; background: #fff; box-shadow: none; }
.data-table { border-collapse: separate; border-spacing: 0; font-size: .8rem; }
.data-table th {
  position: sticky;
  z-index: 4;
  top: 0;
  padding: 11px 12px;
  border-bottom: 1px solid var(--modern-line);
  color: #66736a;
  background: #f8faf8;
  font-size: .66rem;
  font-weight: 800;
  letter-spacing: .055em;
  text-transform: uppercase;
}
.data-table td { padding: 11px 12px; border-bottom: 1px solid #edf1ee; }
.data-table tbody tr:hover td { background: #f4f8f5; }
.data-table tbody tr:last-child td { border-bottom: 0; }

.empty-state,
.empty-message { border-radius: 12px; color: var(--modern-muted); background: var(--modern-paper-soft); }

/* Dashboard */
.modern-dashboard { display: none; }
.modern-dashboard.active { display: block; }
.modern-dashboard-welcome { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.modern-dashboard-date { margin: 0 0 5px; color: var(--modern-green); font-size: .68rem; font-weight: 820; letter-spacing: .11em; text-transform: uppercase; }
.modern-dashboard-welcome h3 { margin: 0 0 5px; font-size: clamp(2rem, 3.2vw, 3.15rem); line-height: 1; letter-spacing: -.055em; }
.modern-dashboard-welcome p:last-child { margin: 0; color: var(--modern-muted); font-size: .88rem; }
.modern-dashboard-actions { display: flex; gap: 9px; }

.modern-dashboard-setup {
  display: grid;
  grid-template-columns: minmax(230px,.7fr) minmax(0,1.3fr);
  align-items: center;
  gap: 18px;
  margin-bottom: 17px;
  padding: 15px 17px;
  border: 1px solid #ead8bf;
  border-radius: var(--modern-radius);
  background: #fffaf2;
}
.modern-dashboard-setup[hidden] { display: none; }
.modern-dashboard-setup-head { display: flex; align-items: center; gap: 11px; }
.modern-dashboard-setup-count { display: grid; min-width: 38px; height: 38px; place-items: center; border-radius: 11px; color: #81511e; background: #f7e8d1; font-size: .76rem; font-weight: 850; }
.modern-dashboard-setup-head strong, .modern-dashboard-setup-head span { display: block; }
.modern-dashboard-setup-head span { margin-top: 3px; color: #806c55; font-size: .72rem; }
.modern-dashboard-setup-head > .modern-dashboard-setup-count { display:grid; place-items:center; margin-top:0; color:#81511e; font-size:.76rem; line-height:1; }
.modern-dashboard-setup-list { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.modern-setup-action { padding: 8px 10px; border: 1px solid #e7d5b9; border-radius: 9px; color: #624322; background: #fff; font-size: .72rem; font-weight: 760; }
.modern-setup-action:hover { border-color: #d6b985; background: #fffdf9; }

.modern-kpi-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 13px; margin-bottom: 16px; }
.modern-kpi { position: relative; min-height: 126px; padding: 17px; border: 1px solid var(--modern-line); border-radius: var(--modern-radius); background: #fff; }
.modern-kpi-label { color: var(--modern-muted); font-size: .72rem; font-weight: 740; }
.modern-kpi strong { display: block; margin: 12px 0 5px; font-size: 1.85rem; letter-spacing: -.045em; }
.modern-kpi small { color: var(--modern-green); font-size: .68rem; font-weight: 720; }
.modern-kpi small.warning { color: var(--modern-amber); }

.modern-dashboard-primary { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(320px,.65fr); gap: 16px; }
.modern-dashboard-stack { display: grid; align-content: start; gap: 16px; }
.modern-dashboard .panel { margin: 0; }
.modern-priority-list .compact-lead { border-bottom: 1px solid #edf1ee; border-radius: 0; }
.modern-priority-list .compact-lead:last-child { border-bottom: 0; }
.modern-appointment-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; overflow: hidden; border: 1px solid var(--modern-line); border-radius: 12px; background: var(--modern-line); }
.modern-appointment-summary article { padding: 16px; background: #fff; }
.modern-appointment-summary span, .modern-appointment-summary small { display: block; color: var(--modern-muted); font-size: .68rem; }
.modern-appointment-summary strong { display: block; margin: 7px 0 2px; font-size: 1.7rem; }
.appointment-list { display: grid; gap: 8px; margin-top: 12px; }
.appointment-list .appointment { display: grid; grid-template-columns: 64px minmax(0,1fr); gap: 12px; align-items: center; padding: 11px 12px; border: 1px solid var(--modern-line); border-radius: 11px; background: #fff; }
.appointment-list .appointment-time { display: grid; min-height: 38px; place-items: center; border-radius: 8px; color: var(--modern-green-dark); background: var(--modern-green-soft); font-size: .7rem; font-weight: 800; }
.appointment-list .appointment strong, .appointment-list .appointment small { display: block; }
.appointment-list .appointment strong { overflow: hidden; font-size: .76rem; text-overflow: ellipsis; white-space: nowrap; }
.appointment-list .appointment small { margin-top: 3px; overflow: hidden; color: var(--modern-muted); font-size: .66rem; text-overflow: ellipsis; white-space: nowrap; }

.modern-section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 28px 0 13px; }
.modern-section-heading h3 { margin: 0 0 3px; font-size: 1.24rem; letter-spacing: -.03em; }
.modern-section-heading p { margin: 0; color: var(--modern-muted); font-size: .75rem; }
.modern-period-pill { padding: 7px 10px; border: 1px solid var(--modern-line); border-radius: 9px; color: var(--modern-green-dark); background: var(--modern-green-soft); font-size: .68rem; font-weight: 780; }
.modern-performance-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(320px,.72fr); gap: 16px; }
.modern-pulse { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 1px; overflow: hidden; border: 1px solid var(--modern-line); border-radius: 12px; background: var(--modern-line); }
.modern-pulse article { padding: 15px; background: #fff; }
.modern-pulse span { display: block; color: var(--modern-muted); font-size: .66rem; }
.modern-pulse strong { display: block; margin-top: 8px; font-size: 1.35rem; }
.modern-rate-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modern-rate-card { padding: 17px; border-radius: 12px; background: var(--modern-green-soft); }
.modern-rate-card:nth-child(2) { background: var(--modern-blue-soft); }
.modern-rate-card span, .modern-rate-card small { display: block; color: var(--modern-muted); font-size: .68rem; }
.modern-rate-card strong { display: block; margin: 8px 0 3px; font-size: 1.8rem; }

.modern-activity-chart { display: flex; min-height: 152px; align-items: end; gap: 10px; padding-top: 18px; border-bottom: 1px solid var(--modern-line); }
.modern-activity-day { display: grid; flex: 1; height: 138px; grid-template-rows: 1fr auto; gap: 7px; align-items: end; text-align: center; }
.modern-activity-bars { display: flex; height: 100%; align-items: end; justify-content: center; gap: 4px; }
.modern-activity-bar { width: 11px; min-height: 3px; border-radius: 5px 5px 0 0; background: var(--modern-green); }
.modern-activity-bar.answers { background: #bad2c1; }
.modern-activity-day small { color: var(--modern-muted); font-size: .6rem; }
.modern-chart-legend { display: flex; gap: 13px; color: var(--modern-muted); font-size: .65rem; }
.modern-chart-legend i { display: inline-block; width: 8px; height: 8px; margin-right: 4px; border-radius: 50%; background: var(--modern-green); }
.modern-chart-legend i.answers { background: #bad2c1; }

.modern-team-table { width: 100%; border-collapse: collapse; }
.modern-team-table th, .modern-team-table td { padding: 10px 7px; border-bottom: 1px solid #edf1ee; text-align: left; font-size: .72rem; }
.modern-team-table th { color: var(--modern-muted); font-size: .62rem; letter-spacing: .04em; text-transform: uppercase; }
.modern-team-table tr:last-child td { border-bottom: 0; }
.modern-team-name { font-weight: 760; }

/* Today, call workspace and operational pages */
.today-hero { border: 0; color: #fff; background: linear-gradient(135deg,#244e36,#356c4a); box-shadow: var(--modern-shadow); }
.today-hero .eyebrow, .today-hero span { color: rgba(255,255,255,.72); }
.today-metrics { gap: 13px; }
.today-metric { min-height: 104px; padding: 16px; }
.today-grid { gap: 16px; }
.today-item { border-radius: 10px; }

.lead-layout,
.management-layout,
.reports-grid,
.profile-grid,
.setup-grid,
.subscription-grid { gap: 16px; }

.lead-card,
.lead-detail,
.call-panel,
.history-panel { border-radius: var(--modern-radius); }
.lead-card:hover { border-color: #b9c9bd; box-shadow: 0 8px 22px rgba(25,45,33,.06); }
.outcome-grid button,
.quick-outcome-grid button { border-radius: 10px; }

.calendar-panel { overflow: hidden; }
.calendar-panel-head { margin-bottom: 13px; }
.calendar-toolbar { gap: 9px; padding: 12px; border: 1px solid var(--modern-line); border-radius: 12px; background: var(--modern-paper-soft); }
.calendar-filter-toggle, .calendar-view-toggle button, .calendar-sync-pill { border-radius: 999px; }
.calendar-month-grid, .calendar-week-shell, .calendar-agenda { border-color: var(--modern-line); border-radius: 13px; overflow: hidden; }
.calendar-month-day { min-height: 122px; background: #fff; }
.calendar-month-day:hover { background: #f7faf7; }

.report-kpis,
.report-summary-grid,
.admin-stats,
.subscription-metrics { gap: 13px; }
.chart-card, .report-chart, .report-table-card { border-radius: var(--modern-radius); }

.setup-item,
.audit-item,
.notification-item,
.compact-lead,
.history-item,
.caller-item,
.team-member-card,
.showhouse-card {
  border-color: var(--modern-line);
  border-radius: 11px;
  background: #fff;
}

details { border-color: var(--modern-line); border-radius: 11px; }
summary { border-radius: 10px; }

dialog {
  width: min(760px, calc(100vw - 30px));
  max-height: calc(100svh - 34px);
  border: 1px solid var(--modern-line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 28px 90px rgba(17,31,22,.24);
}
dialog::backdrop { background: rgba(15,25,19,.55); backdrop-filter: blur(3px); }
dialog form { border-radius: inherit; }
.dialog-actions { position: sticky; bottom: 0; padding-top: 12px; background: #fff; }

/* Lead capture uses the available screen so its comprehensive form stays compact. */
#leadDialog.lead-dialog {
  width: min(2200px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100dvh - 24px);
}
#leadForm.lead-dialog-form {
  max-height: calc(100dvh - 24px);
  overflow: hidden;
  padding: clamp(16px, 1.4vw, 26px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
#leadForm > .panel-head,
#leadForm > .dialog-actions { flex: 0 0 auto; }
#leadForm > .dialog-actions { margin-top: 0; padding-top: 14px; border-top: 1px solid #e1e8e3; }
#leadForm .lead-editor-layout {
  display: grid;
  grid-template-columns: clamp(220px, 16vw, 280px) minmax(0, 1fr);
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  border: 1px solid #dce5df;
  border-radius: 16px;
  background: #fff;
}
#leadForm .lead-section-sidebar {
  min-width: 0;
  overflow-y: auto;
  padding: 18px 12px;
  border-right: 1px solid #dce5df;
  background: linear-gradient(180deg, #f5f8f6 0%, #eef4f0 100%);
}
#leadForm .lead-section-sidebar-label {
  display: block;
  padding: 0 10px 10px;
  color: #738078;
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
#leadForm .lead-section-nav { display: grid; gap: 5px; }
#leadForm .lead-section-nav button {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: #536159;
  font: inherit;
  font-size: .84rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
}
#leadForm .lead-section-nav button:hover { background: rgba(255,255,255,.7); color: #24432c; }
#leadForm .lead-section-nav button.is-active {
  border-color: #cbdccf;
  background: #fff;
  color: #24432c;
  box-shadow: 0 5px 16px rgba(30,62,40,.08);
}
#leadForm .lead-section-number {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #e4ece6;
  color: #5d6d62;
  font-size: .68rem;
  letter-spacing: .04em;
}
#leadForm .lead-section-nav button.is-active .lead-section-number { background: #416f4c; color: #fff; }
#leadForm .lead-section-content {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding: clamp(18px, 2vw, 32px);
  scrollbar-gutter: stable;
}
#leadForm .lead-section-panels { min-width: 0; }
#leadForm .grouped-form {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  align-content: start;
  gap: 16px 18px;
}
#leadForm .lead-section-panel[hidden] { display: none !important; }
#leadForm .form-section-title {
  margin: 0 0 4px;
  padding: 0 0 14px;
  border-bottom: 1px solid #e1e8e3;
  color: #1e2b22;
  font-size: clamp(1.05rem, 1.2vw, 1.32rem);
}
#leadForm textarea[rows="2"] { min-height: 42px; }

@media (min-width: 1700px) {
  #leadForm .grouped-form { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
}

@media (max-width: 1100px) {
  #leadDialog.lead-dialog { width: calc(100vw - 20px); }
  #leadForm .lead-editor-layout { grid-template-columns: 210px minmax(0, 1fr); }
  #leadForm .grouped-form { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}

@media (max-width: 760px) {
  #leadForm.lead-dialog-form { padding: 12px; }
  #leadForm .lead-editor-layout { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  #leadForm .lead-section-sidebar { overflow-x: auto; overflow-y: hidden; padding: 9px; border-right: 0; border-bottom: 1px solid #dce5df; }
  #leadForm .lead-section-sidebar-label { display: none; }
  #leadForm .lead-section-nav { display: flex; width: max-content; min-width: 100%; gap: 5px; }
  #leadForm .lead-section-nav button { grid-template-columns: 24px auto; width: auto; min-width: max-content; padding: 7px 9px; }
  #leadForm .lead-section-number { width: 23px; height: 23px; border-radius: 7px; }
  #leadForm .lead-section-content { padding: 17px 14px; scrollbar-gutter: auto; }
}

@media (max-width: 520px) {
  #leadDialog.lead-dialog { width: calc(100vw - 12px); }
  #leadForm .grouped-form { grid-template-columns: 1fr !important; }
  #leadForm > .dialog-actions { display: grid; grid-template-columns: 1fr 1fr; }
}

.server-restart-notice { margin: 14px clamp(20px,2.4vw,34px) 0; border-radius: 12px; }
.toast, .form-note { border-radius: 11px; }

@media (min-width: 981px) and (max-width: 1500px) {
  .app-shell { grid-template-columns: 76px minmax(0,1fr); }
  .sidebar { width: 76px; padding: 14px 10px; align-items: center; }
  .workspace { min-width: 0; }
}

@media (max-width: 1280px) {
  .modern-dashboard-primary,
  .modern-performance-grid { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  .mobile-menu-toggle { border-radius: 11px; background: #152019; }
  .topbar { padding-left: 76px; }
  .modern-dashboard-stack,
  .modern-dashboard-primary,
  .modern-performance-grid { min-width: 0; }
}

@media (max-width: 820px) {
  .view { padding: 20px 15px 32px; }
  .topbar { align-items: flex-start; min-height: 66px; padding-right: 14px; }
  .topbar-actions { gap: 6px; }
  .topbar-actions .bug-report-btn,
  .topbar-actions .suggestion-report-btn { display: none; }
  .modern-dashboard-welcome { align-items: flex-start; flex-direction: column; }
  .modern-kpi-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .modern-dashboard-setup { grid-template-columns: 1fr; }
  .modern-dashboard-setup-list { justify-content: flex-start; }
  .modern-pulse { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .filters { align-items: stretch; }
}

@media (max-width: 560px) {
  .auth-screen { display: block; height: auto; overflow: visible; }
  .auth-visual { display: none; }
  .auth-panel { min-height: 100svh; padding: 28px 18px; }
  .topbar h2 { font-size: 1.1rem; }
  .user-chip { display: none; }
  .modern-dashboard-welcome h3 { font-size: 2rem; }
  .modern-dashboard-actions { width: 100%; }
  .modern-dashboard-actions button { flex: 1; }
  .modern-kpi-grid { grid-template-columns: 1fr; }
  .modern-kpi { min-height: 110px; padding: 14px; }
  .modern-kpi strong { font-size: 1.55rem; }
  .modern-rate-grid,
  .modern-appointment-summary { grid-template-columns: 1fr; }
  .data-table th, .data-table td { padding: 10px 9px; }
}

/*
 * Data-heavy workspaces own their scrolling inside the primary records area.
 * The browser/workspace scrollbar stays out of the way while headers, filters,
 * column controls, and calendar controls remain visible.
 */
body:is(
  [data-current-view="leads"],
  [data-current-view="leadManagement"],
  [data-current-view="properties"],
  [data-current-view="buyers"],
  [data-current-view="clients"],
  [data-current-view="followups"],
  [data-current-view="calendar"]
) .app-shell {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

body:is(
  [data-current-view="leads"],
  [data-current-view="leadManagement"],
  [data-current-view="properties"],
  [data-current-view="buyers"],
  [data-current-view="clients"],
  [data-current-view="followups"],
  [data-current-view="calendar"]
) .workspace {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

body:is(
  [data-current-view="leads"],
  [data-current-view="leadManagement"],
  [data-current-view="properties"],
  [data-current-view="buyers"],
  [data-current-view="clients"],
  [data-current-view="followups"],
  [data-current-view="calendar"]
) .topbar {
  flex: 0 0 auto;
}

body:is(
  [data-current-view="leads"],
  [data-current-view="leadManagement"],
  [data-current-view="properties"],
  [data-current-view="buyers"],
  [data-current-view="clients"],
  [data-current-view="followups"],
  [data-current-view="calendar"]
) .view.active {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

/* Call Workspace: filters and goals stay fixed; both working panes use the rest. */
#leadsView.active {
  display: flex;
  flex-direction: column;
  gap: var(--modern-space-4);
}

#leadsView .call-management-banner { flex: 0 0 auto; }
#callWorkspaceCallerMode:not([hidden]) {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

#leadsView .filters,
#leadsView .goal-progress-panel { flex: 0 0 auto; margin-bottom: 0; }

#leadsView .lead-layout {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  align-items: stretch;
}

#leadsView .lead-list-panel,
#leadsView .call-panel {
  min-height: 0;
  max-height: none;
  overflow: hidden;
}

#leadsView .lead-list-panel { display: flex; flex-direction: column; }
#leadsView .lead-list { flex: 1 1 auto; min-height: 0; max-height: none; overflow: auto; }
#leadsView .call-panel { overflow: auto; }

/* Lead Management: only the table in the selected tab scrolls. */
#leadManagementView.active {
  display: flex;
  flex-direction: column;
  gap: var(--modern-space-4);
}

#leadManagementView .lead-management-filter-panel { flex: 0 0 auto; }
#leadManagementView .lead-management-controls { gap: 8px; }
#leadManagementView .management-filters { margin-bottom: 0; }
.data-column-toolbar {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  margin: 0 0 10px;
}
.data-column-toolbar > .column-groups {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
}
.data-column-toolbar > .ghost-btn {
  flex: 0 0 auto;
  min-height: 38px;
}
#propertiesView .property-filters,
#clientsView .client-list-filters { margin-bottom: 8px; }
#leadManagementView .lead-management-results-panel {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  margin-top: 0;
  overflow: hidden;
}

#leadManagementView .lead-management-tabs { flex: 0 0 auto; }
#leadManagementView .lead-management-tab-panel:not([hidden]) {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

#leadManagementView .lead-management-tab-panel-head { flex: 0 0 auto; }
#leadManagementView .lead-management-tab-panel .data-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
}

/* Property Manager, Buyers, and Client List: controls fixed, records scroll. */
#propertiesView.active,
#buyersView.active,
#clientsView.active,
#followupsView.active,
#calendarView.active { display: flex; flex-direction: column; }

#propertiesView > .panel,
#buyersView > .panel,
#clientsView > .panel,
#followupsView > .panel,
#calendarView > .panel {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

#propertiesView .property-table-wrap,
#buyersView .data-table-wrap,
#clientsView .client-list-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
}

#propertiesView .table-load-more,
#buyersView .table-load-more,
#clientsView .table-load-more { flex: 0 0 auto; }

/* Follow-Ups: the queue owns vertical scrolling and its caller filter stays put. */
#followupsView .followup-agenda {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
  scrollbar-color: #9dad9f #eef2ef;
  scrollbar-width: thin;
}

/* Calendar: its controls remain visible while month/week/agenda content scrolls. */
#calendarView .calendar-shell {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  scrollbar-color: #9dad9f #eef2ef;
  scrollbar-width: thin;
}

@media (max-width: 1100px) {
  #leadsView .lead-layout { overflow: auto; }
  #leadsView .lead-list-panel,
  #leadsView .call-panel { overflow: visible; }
  #leadsView .lead-list { max-height: 42dvh; }
}

/* Full-site refinement — consistent hierarchy, grouped navigation and fluid workspaces. */
:root {
  --modern-space-1: 6px;
  --modern-space-2: 10px;
  --modern-space-3: 14px;
  --modern-space-4: 18px;
  --modern-space-5: 24px;
  --modern-space-6: 32px;
  --modern-content-pad: clamp(18px, 1.65vw, 48px);
}

body { line-height: 1.45; }

.workspace { min-width: 0; }

.view {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: var(--modern-content-pad);
}

.view.active:not(.modern-dashboard) {
  animation: modern-view-in 150ms ease-out both;
}

@keyframes modern-view-in {
  from { opacity: .72; transform: translateY(3px); }
  to { opacity: 1; transform: none; }
}

/* Grouped navigation mirrors the approved concepts. */
.nav-tabs {
  gap: 5px;
  padding: 8px 0;
}

.nav-section {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.nav-section + .nav-section { margin-top: 8px; }
.nav-section[hidden],
.nav-section:not(:has(.nav-tab:not([hidden]))) { display: none; }

.nav-section-label {
  display: block;
  padding: 7px 10px 4px;
  color: rgba(216, 230, 220, .5);
  font-size: .6rem;
  font-weight: 820;
  letter-spacing: .12em;
  line-height: 1;
  text-transform: uppercase;
}

.nav-tab {
  width: 100%;
  transition: color 120ms ease, background-color 120ms ease, transform 120ms ease;
}

.nav-tab:hover { transform: translateX(1px); }
.nav-tab.active { box-shadow: inset 0 0 0 1px rgba(255,255,255,.025); }

/* A clean, useful page header at every width. */
.topbar {
  min-height: 78px;
  gap: 20px;
  padding-inline: var(--modern-content-pad);
}

.topbar > div:first-child { min-width: 0; }
.topbar h2 { font-size: clamp(1.3rem, 1.25vw, 1.8rem); line-height: 1.12; }
#viewContext { max-width: min(78ch, 70vw); color: var(--modern-muted); line-height: 1.35; }
.topbar-actions { flex-wrap: wrap; justify-content: flex-end; }

/* Shared card, heading, form and action rhythm. */
.panel,
.metric,
.today-metric,
.stat-card,
.report-card,
.subscription-card,
.showhouse-card,
.team-card,
.caller-card {
  overflow-wrap: anywhere;
}

.panel { padding: clamp(16px, 1.15vw, 24px); }
.panel + .panel { margin-top: var(--modern-space-4); }
.panel-head { align-items: flex-start; }
.panel-head > div { min-width: 0; }
.panel-head h3,
.section-head h3 { font-size: clamp(.98rem, .78vw, 1.15rem); line-height: 1.25; }
.panel-head span,
.section-head span { line-height: 1.4; }

.section-head { margin-bottom: var(--modern-space-3); }
.metric-grid,
.report-kpis,
.report-summary-grid,
.admin-stats,
.subscription-metrics { gap: var(--modern-space-3); }

.metric,
.today-metric,
.stat-card { min-width: 0; padding: clamp(15px, 1vw, 22px); }
.metric strong,
.today-metric strong,
.stat-card strong { letter-spacing: -.045em; }

.filters,
.management-filters,
.property-filters,
.client-list-filters,
.followup-filters,
.admin-filters,
.report-controls {
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  align-items: end;
}

.filters > *,
.management-filters > *,
.property-filters > *,
.client-list-filters > *,
.followup-filters > *,
.admin-filters > *,
.report-controls > * { min-width: 0; }

.form-grid { gap: var(--modern-space-3); }
.form-actions,
.dialog-actions,
.feedback-actions,
.calendar-connection-actions { gap: var(--modern-space-2); }

.empty-state,
.empty-message,
.empty-state-card {
  min-height: 150px;
  align-content: center;
  justify-items: center;
  padding: clamp(24px, 3vw, 54px);
  text-align: center;
}

/* Tables remain internally scrollable by design, with calmer density. */
.data-table-wrap {
  width: 100%;
  max-width: 100%;
  scrollbar-color: #9dad9f #eef2ef;
  scrollbar-width: thin;
}

.data-table-wrap::-webkit-scrollbar { width: 10px; height: 10px; }
.data-table-wrap::-webkit-scrollbar-track { border-radius: 999px; background: #eef2ef; }
.data-table-wrap::-webkit-scrollbar-thumb { border: 2px solid #eef2ef; border-radius: 999px; background: #9dad9f; }
.data-table th { white-space: nowrap; }
.data-table td { line-height: 1.42; vertical-align: middle; }
.table-load-more { justify-content: center; padding: 14px 10px 2px; }

/* Page-specific composition, preserving every existing control and binding. */
#todayView .today-metrics,
#reportsView .report-kpis,
#reportsView .report-summary-grid,
#adminDatabaseView .admin-stats,
#subscriptionView .subscription-metrics {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

#todayView .today-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr));
  align-items: start;
}

#leadsView .lead-layout {
  grid-template-columns: clamp(310px, 23vw, 500px) minmax(0, 1fr);
  gap: clamp(16px, 1.4vw, 30px);
}

#leadsView .lead-list-panel,
#leadsView .lead-detail,
#leadsView .call-panel,
#leadsView .history-panel { min-width: 0; }

#leadsView .lead-card { padding: 13px; }
#leadsView .outcome-grid { grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); }

#leadManagementView > .panel,
#propertiesView > .panel,
#buyersView > .panel,
#clientsView > .panel {
  padding: clamp(16px, 1.1vw, 24px);
}

#leadManagementView .panel-head,
#propertiesView .panel-head,
#buyersView .panel-head,
#clientsView .panel-head {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--modern-line);
}

#leadManagementView .lead-management-results-panel { min-height: 360px; }
.lead-management-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -4px -4px 18px;
  padding: 4px 4px 12px;
  overflow-x: auto;
  border-bottom: 1px solid var(--modern-line);
}
.lead-management-tab {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: #5e6c63;
  background: transparent;
  font: inherit;
  font-size: .84rem;
  font-weight: 800;
  cursor: pointer;
}
.lead-management-tab:hover { background: #f1f5f2; color: #294b33; }
.lead-management-tab[aria-selected="true"] {
  border-color: #cbdccf;
  color: #24432c;
  background: #edf5ef;
  box-shadow: 0 3px 10px rgba(39, 75, 48, .08);
}
.lead-management-tab small {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  color: #627067;
  background: #e7ece8;
  font-size: .7rem;
  font-weight: 750;
  white-space: nowrap;
}
.lead-management-tab[aria-selected="true"] small { color: #315a3d; background: #d9e8dd; }
.lead-management-tab-panel[hidden] { display: none !important; }
.lead-management-tab-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.lead-management-tab-panel-head h3 { margin: 0; }
.lead-management-tab-panel .data-table-wrap { max-height: min(62vh, 900px); overflow: auto; }

@media (max-width: 620px) {
  .lead-management-tabs { align-items: stretch; }
  .lead-management-tab { flex: 1 0 auto; justify-content: space-between; }
  .data-column-toolbar { align-items: stretch; flex-direction: column; }
  .data-column-toolbar > .ghost-btn { width: 100%; }
}

#followupsView .followup-list { display: grid; gap: 10px; }
#followupsView .followup-row { border-radius: 11px; }
#followupsView { container-type: inline-size; }
#followupsView .agenda-item > * { min-width: 0; }
#followupsView .agenda-item > p {
  overflow-wrap: anywhere;
  word-break: break-word;
}

@container (max-width: 1250px) {
  #followupsView .agenda-day { grid-template-columns: minmax(0, 1fr); }
  #followupsView .agenda-item {
    grid-template-columns: 28px minmax(180px, 1.2fr) minmax(130px, .6fr) minmax(120px, .5fr);
    grid-template-areas:
      "select person phone type"
      ". notes notes actions";
    align-items: start;
  }
  #followupsView .agenda-select { grid-area: select; }
  #followupsView .agenda-item > div:nth-of-type(1) { grid-area: person; }
  #followupsView .agenda-item > div:nth-of-type(2) { grid-area: phone; }
  #followupsView .agenda-item > div:nth-of-type(3) { grid-area: type; }
  #followupsView .agenda-item > p { grid-area: notes; }
  #followupsView .agenda-actions { grid-area: actions; align-self: end; }
}

@container (max-width: 700px) {
  #followupsView .agenda-item {
    grid-template-columns: 28px minmax(0, 1fr);
    grid-template-areas:
      "select person"
      ". phone"
      ". type"
      ". notes"
      ". actions";
    gap: 9px 12px;
  }
  #followupsView .agenda-actions { justify-self: start; }
}

#calendarView .calendar-panel { min-width: 0; }
#calendarView .calendar-toolbar { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
#calendarView .calendar-shell { border-radius: 13px; }
#calendarView [data-calendar-view-mode]:disabled {
  cursor: not-allowed;
  opacity: .48;
}

#showhousesView .showhouse-section-list {
  grid-template-columns: repeat(auto-fit, minmax(min(460px, 100%), 1fr));
}

#showhousesView .showhouse-card { height: 100%; }
#showhousesView .showhouse-card-main { grid-template-columns: minmax(0, 1fr) minmax(180px, 260px); }

#reportsView .chart-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(480px, 100%), 1fr));
  align-items: stretch;
}

#reportsView .report-card,
#reportsView .chart-card { height: 100%; }

#callersView { container-type: inline-size; }

#callersView .caller-layout,
#teamView .team-layout {
  grid-template-columns: minmax(0, 1.35fr) minmax(430px, .75fr);
  align-items: start;
}

#callersView .caller-list,
#teamView .team-member-list { display: grid; gap: 12px; }

#callersView .caller-layout > *,
#callersView .caller-form,
#callersView .goal-settings,
#callersView .caller-permissions-field {
  min-width: 0;
  max-width: 100%;
}

@container (max-width: 1450px) {
  #callersView .caller-layout { grid-template-columns: minmax(0, 1fr); }
}

@container (max-width: 720px) {
  #callersView .caller-card { grid-template-columns: minmax(0, 1fr); }
  #callersView .caller-actions { justify-content: flex-start; }
  #callersView .goal-setting-row { grid-template-columns: minmax(0, 1fr) minmax(74px, .45fr) minmax(74px, .45fr); }
}

#exportsView .import-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr));
  align-items: stretch;
}

#exportsView .import-grid > .panel { height: 100%; }

#subscriptionView .subscription-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(460px, 100%), 1fr));
  align-items: start;
}

#profileView .profile-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(520px, 100%), 1fr));
  align-items: start;
}

#profileView .profile-accordion {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

#profileView .profile-accordion > * {
  width: 100%;
  min-width: 0;
}

#profileView .wide-panel { grid-column: 1 / -1; }

#changelogView .changelog-layout {
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, .65fr);
  gap: clamp(16px, 1.4vw, 28px);
}

#adminDatabaseView .admin-health-grid,
#adminServerView .admin-health-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr));
}

#adminUsersView .admin-filters,
#adminOptOutView .admin-filters { margin-bottom: 14px; }

/* Use ultrawide and 4K workspaces instead of centring a narrow canvas. */
@media (min-width: 1900px) {
  .app-shell { grid-template-columns: 252px minmax(0, 1fr); }
  .sidebar { padding: 22px 16px; }
  .sidebar .brand-logo-full { width: 196px; }
  .nav-tab { min-height: 42px; font-size: .88rem; }
  .view { padding: clamp(28px, 1.7vw, 64px); }
  .topbar { padding-inline: clamp(28px, 1.7vw, 64px); }
  .modern-dashboard-primary { grid-template-columns: minmax(0, 1.6fr) minmax(390px, .7fr); }
  .modern-performance-grid { grid-template-columns: minmax(0, 1.55fr) minmax(420px, .75fr); }
  #todayView .today-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #reportsView .chart-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #showhousesView .showhouse-section-list { grid-template-columns: repeat(auto-fit, minmax(520px, 1fr)); }
  #profileView .profile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 3000px) {
  :root { --modern-content-pad: 64px; }
  .app-shell { grid-template-columns: 280px minmax(0, 1fr); }
  .sidebar { padding-inline: 20px; }
  .sidebar .brand-logo-full { width: 218px; }
  .nav-tab { font-size: .94rem; }
  .modern-kpi-grid,
  .metric-grid { gap: 18px; }
  #todayView .today-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #exportsView .import-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #adminDatabaseView .admin-health-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 981px) and (max-width: 1500px) {
  .nav-section { width: 100%; }
  .nav-section + .nav-section { margin-top: 5px; padding-top: 5px; border-top: 1px solid rgba(255,255,255,.065); }
  .nav-section-label { display: none; }
  body.sidebar-open .nav-section-label { display: block; }
}

/* Keep the full labelled navigation on ordinary desktop widths. */
@media (min-width: 1261px) and (max-width: 1500px) {
  .app-shell { grid-template-columns: 224px minmax(0, 1fr); }
  .sidebar { width: auto; padding: 18px 12px; align-items: stretch; }
  .sidebar .brand { justify-content: flex-start; }
  .sidebar .brand-logo-full { display: block; width: 174px; height: auto; }
  .sidebar .brand-logo-mark { display: none; }
  .sidebar-toggle { display: none; }
  .nav-section + .nav-section { margin-top: 8px; padding-top: 0; border-top: 0; }
  .nav-section-label { display: block; }
  .nav-tab { justify-content: flex-start; padding: 9px 10px; }
  .nav-label { display: inline; }
}

@media (max-width: 1180px) {
  #callersView .caller-layout,
  #teamView .team-layout,
  #changelogView .changelog-layout { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  .view { padding: 18px 14px 34px; }
  .nav-section-label { padding-inline: 12px; }
  body:not(.locked) .nav-tab {
    display: flex;
    grid-template-columns: none;
    align-items: center;
    gap: 10px;
  }
  #viewContext { max-width: 100%; }
  #leadsView .lead-layout { grid-template-columns: 1fr; }
  #showhousesView .showhouse-card-main { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .topbar { gap: 10px; }
  .topbar-actions { width: 100%; justify-content: stretch; }
  .topbar-actions > button { flex: 1 1 auto; }
  .panel { padding: 14px; }
  .panel-head,
  .section-head { align-items: flex-start; flex-direction: column; }
  .filters,
  .management-filters,
  .property-filters,
  .client-list-filters,
  .followup-filters,
  .admin-filters,
  .report-controls { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .view.active:not(.modern-dashboard) { animation: none; }
  .nav-tab { transition: none; }
}

/* Deal pipeline and advanced analytics */
.deal-pipeline-hero,
.analytics-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
  background: linear-gradient(135deg, #fff 0%, #f1f7f2 100%);
}
.deal-pipeline-hero h3,
.analytics-hero h3 { margin: 4px 0 6px; font-size: clamp(1.45rem, 2vw, 2rem); }
.deal-pipeline-hero p:last-child,
.analytics-hero p:last-child { margin: 0; color: var(--muted, #68746c); }
.deal-summary-grid,
.analytics-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.analytics-kpi-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.deal-summary-card,
.analytics-kpi { min-width: 0; }
.deal-summary-card strong,
.analytics-kpi strong { font-size: clamp(1.35rem, 2vw, 2rem); overflow-wrap: anywhere; }
.deal-pipeline-panel { padding: 16px; }
.deal-stage-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
  padding: 5px;
  border: 1px solid #dfe7e1;
  border-radius: 15px;
  background: #f3f6f4;
}
.deal-stage-tab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  min-height: 52px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: #607067;
  background: transparent;
  font: inherit;
  font-size: .8rem;
  font-weight: 780;
  text-align: left;
  cursor: pointer;
}
.deal-stage-tab:hover { color: #2f5138; background: rgba(255,255,255,.72); }
.deal-stage-tab.is-active {
  border-color: #bfd2c4;
  color: #24432c;
  background: #fff;
  box-shadow: 0 5px 15px rgba(28, 57, 36, .08);
}
.deal-stage-tab > span { display: flex; align-items: center; gap: 8px; min-width: 0; }
.deal-stage-tab small {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  flex: 0 0 27px;
  border-radius: 8px;
  color: #637269;
  background: #e5ebe7;
  font-size: .65rem;
  letter-spacing: .04em;
}
.deal-stage-tab.is-active small { color: #fff; background: #416f4c; }
.deal-stage-tab strong {
  display: grid;
  place-items: center;
  min-width: 25px;
  height: 25px;
  padding: 0 6px;
  border-radius: 999px;
  color: #53645a;
  background: #e3eae5;
  font-size: .7rem;
}
.deal-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1.6fr) repeat(3, minmax(150px, .7fr)) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 10px;
}
.deal-toolbar label { display: grid; gap: 6px; min-width: 0; }
.deal-toolbar label > span { font-size: .76rem; font-weight: 750; color: var(--muted, #68746c); text-transform: uppercase; letter-spacing: .04em; }
.deal-pipeline-status { min-height: 24px; color: var(--muted, #68746c); font-size: .86rem; }
.deal-pipeline-status.is-error { color: #a43a32; }
.deal-board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(290px, 1fr);
  gap: 12px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  padding: 4px 2px 14px;
  scroll-snap-type: x proximity;
}
.deal-column {
  min-height: 430px;
  padding: 12px;
  border: 1px solid #dfe7e1;
  border-radius: 16px;
  background: #f6f8f6;
  scroll-snap-align: start;
  transition: border-color .16s ease, background .16s ease;
}
.deal-column.is-drag-over { border-color: #467553; background: #edf5ef; }
.deal-column > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 2px 2px 12px; }
.deal-column > header div { display: flex; align-items: center; gap: 7px; }
.deal-column > header strong { font-size: .9rem; }
.deal-column > header span { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 999px; background: #e3ebe5; font-size: .76rem; font-weight: 800; }
.deal-column > header small { color: var(--muted, #68746c); font-weight: 750; }
.deal-column-cards { display: grid; align-content: start; gap: 10px; }
.deal-card {
  padding: 10px;
  border: 1px solid #dce4de;
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 5px 16px rgba(31, 54, 37, .05);
  cursor: grab;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.deal-card:hover { border-color: #c7d6cb; box-shadow: 0 7px 20px rgba(31, 54, 37, .075); }
.deal-card.is-dragging { opacity: .45; }
.deal-card-head,
.deal-card-value,
.deal-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.deal-card h4 { margin: 6px 0 2px; overflow: hidden; font-size: .9rem; text-overflow: ellipsis; white-space: nowrap; }
.deal-card p { min-height: 0; margin: 0 0 7px; overflow: hidden; color: var(--muted, #68746c); font-size: .74rem; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.deal-card-links { margin: -4px 0 11px; color: #53645a; font-size: .7rem; font-weight: 750; }
.deal-type-pill { padding: 3px 7px; border-radius: 999px; background: #e8f1ea; color: #315a3d; font-size: .63rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.deal-card-edit { min-width: 27px; min-height: 27px; }
.deal-card-value { padding-top: 7px; border-top: 1px solid #edf1ee; }
.deal-card-value strong { font-size: .94rem; }
.deal-card-value span,
.deal-card-meta { color: var(--muted, #68746c); font-size: .73rem; }
.deal-card-expand { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 26px; margin-top: 3px; padding: 3px 1px; border: 0; background: transparent; color: #45654e; font: inherit; font-size: .68rem; font-weight: 800; cursor: pointer; }
.deal-card-expand:hover { color: #274c32; }
.deal-card-expand-icon { font-size: 1rem; line-height: 1; transition: transform .16s ease; }
.deal-card-expand[aria-expanded="true"] .deal-card-expand-icon { transform: rotate(180deg); }
.deal-card-details[hidden] { display: none; }
.deal-card-details { padding-top: 4px; border-top: 1px solid #edf1ee; }
.deal-card-commission { display: grid; gap: 2px; margin-top: 8px; color: #53645a; font-size: .7rem; }
.deal-card-commission strong { color: #315a3d; font-size: .73rem; }
.deal-card-commission small { color: #708076; font-size: .64rem; }
.deal-card-commission.is-projected { padding: 8px 9px; border: 1px solid #d9e7dd; border-radius: 9px; background: #f2f7f3; }
.deal-card-meta { margin-top: 9px; }
.deal-card-prices { display: grid; gap: 4px; margin-top: 8px; padding: 8px; border-radius: 9px; background: #f6f8f6; }
.deal-card-prices > span { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.deal-card-prices small { color: var(--muted, #68746c); font-size: .66rem; font-weight: 750; text-transform: uppercase; letter-spacing: .035em; }
.deal-card-prices strong { color: #294c33; font-size: .74rem; }
.deal-card-move { display: grid; grid-template-columns: 32px 1fr 32px; align-items: center; gap: 5px; margin-top: 5px; padding-top: 7px; border-top: 1px solid #edf1ee; }
.deal-card-stage-select { width: 100%; min-width: 0; min-height: 30px; padding: 4px 25px 4px 8px; border: 1px solid #d8e2db; border-radius: 8px; background-color: #fff; color: #315a3d; font: inherit; font-size: .68rem; font-weight: 800; cursor: pointer; }
.deal-card-stage-select:focus { border-color: #75957d; outline: 2px solid rgba(70, 117, 83, .15); outline-offset: 1px; }
.deal-card-move button { min-height: 30px; padding: 0; border: 1px solid #d8e2db; border-radius: 8px; background: #fff; color: #315a3d; font: inherit; font-weight: 850; cursor: pointer; }
.deal-card-move button:hover:not(:disabled) { border-color: #75957d; background: #edf5ef; }
.deal-card-move button:disabled { opacity: .35; cursor: default; }
.deal-dialog { width: min(1500px, calc(100vw - 28px)); max-width: none; }
.deal-dialog-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: calc(100dvh - 28px);
  overflow: hidden;
}
.deal-dialog-form > .panel-head,
.deal-dialog-form > .dialog-actions { flex: 0 0 auto; }
.deal-dialog-form > .dialog-actions { margin-top: 0; padding-top: 14px; border-top: 1px solid #e1e8e3; }
.deal-editor-layout {
  display: grid;
  grid-template-columns: clamp(210px, 16vw, 270px) minmax(0, 1fr);
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  border: 1px solid #dce5df;
  border-radius: 16px;
  background: #fff;
}
.deal-section-sidebar {
  min-width: 0;
  overflow-y: auto;
  padding: 18px 12px;
  border-right: 1px solid #dce5df;
  background: linear-gradient(180deg, #f5f8f6 0%, #eef4f0 100%);
}
.deal-section-sidebar-label {
  display: block;
  padding: 0 10px 10px;
  color: #738078;
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.deal-section-nav { display: grid; gap: 5px; }
.deal-section-nav button {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: #536159;
  font: inherit;
  font-size: .84rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
}
.deal-section-nav button:hover { background: rgba(255,255,255,.7); color: #24432c; }
.deal-section-nav button.is-active { border-color: #cbdccf; background: #fff; color: #24432c; box-shadow: 0 5px 16px rgba(30,62,40,.08); }
.deal-section-number {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #e4ece6;
  color: #5d6d62;
  font-size: .68rem;
  letter-spacing: .04em;
}
.deal-section-nav button.is-active .deal-section-number { background: #416f4c; color: #fff; }
.deal-section-content { min-width: 0; min-height: 0; overflow-y: auto; padding: clamp(18px, 2vw, 32px); scrollbar-gutter: stable; }
.deal-section-panels { min-width: 0; }
.deal-section-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; gap: 16px 18px; }
.deal-section-panel[hidden] { display: none !important; }
.deal-form-section-title {
  margin: 0 0 4px;
  padding: 0 0 14px;
  border-bottom: 1px solid #e1e8e3;
  color: #1e2b22;
  font-size: clamp(1.05rem, 1.2vw, 1.32rem);
}
.deal-price-panel,
.deal-commission-panel { padding: 15px; border: 1px solid #dce5df; border-radius: 14px; background: #f8faf9; }
.deal-price-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.deal-price-fields label { display: grid; gap: 6px; }
.deal-price-fields label > small { color: var(--muted, #68746c); font-size: .68rem; font-weight: 600; }
.deal-commission-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.deal-commission-heading > div { display: grid; gap: 2px; }
.deal-commission-heading strong { color: #213b29; font-size: .92rem; }
.deal-commission-heading span { color: var(--muted, #68746c); font-size: .74rem; }
.deal-commission-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.deal-commission-summary { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.deal-commission-summary article { display: grid; gap: 4px; padding: 10px; border: 1px solid #e0e7e2; border-radius: 10px; background: #fff; }
.deal-commission-summary span { color: var(--muted, #68746c); font-size: .66rem; font-weight: 750; text-transform: uppercase; letter-spacing: .035em; }
.deal-commission-summary strong { color: #243d2b; font-size: .83rem; }
.deal-commission-summary .deal-net-commission { border-color: #b9d1bf; background: #edf5ef; }
.deal-caller-value-input { position: relative; }
.deal-caller-value-input input { width: 100%; padding-left: 30px; padding-right: 30px; }
.deal-caller-value-input > span { position: absolute; z-index: 1; top: 50%; transform: translateY(-50%); color: var(--muted, #68746c); font-size: .8rem; font-weight: 750; pointer-events: none; }
.deal-caller-value-input > span:first-child { left: 12px; }
.deal-caller-value-input > span:last-child { right: 12px; }
.deal-link-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.deal-link-stack { display: grid; gap: 14px; padding: 15px; border: 1px solid #dce5df; border-radius: 14px; background: #f8faf9; }
.deal-link-stack .deal-option-field + .deal-option-field { padding-top: 14px; border-top: 1px solid #e2e9e4; }
.deal-option-field { position: relative; }
.deal-link-label { display: grid; gap: 2px; }
.deal-link-label small { color: var(--muted, #68746c); font-size: .72rem; font-weight: 600; }
.deal-selected-tags { display: grid; gap: 7px; min-height: 36px; margin: 8px 0; }
.deal-selected-tag.deal-linked-record { display: grid; grid-template-columns: 30px minmax(0, 1fr) 28px; align-items: center; gap: 9px; width: 100%; padding: 8px 9px; border: 1px solid #dce5df; border-radius: 10px; background: #f8faf9; color: #294c33; }
.deal-linked-record-icon { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: #e3eee6; color: #315a3d; font-size: .72rem; font-weight: 850; }
.deal-linked-record-copy { display: grid; gap: 1px; min-width: 0; }
.deal-linked-record-copy strong,
.deal-linked-record-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deal-linked-record-copy strong { font-size: .8rem; }
.deal-linked-record-copy small { color: var(--muted, #68746c); font-size: .7rem; font-weight: 600; }
.deal-selected-tag button { display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: #68746c; font: inherit; cursor: pointer; }
.deal-selected-tag button:hover { background: #e8efea; color: #24432c; }
.deal-buyer-panel { display: grid; grid-template-columns: minmax(210px, .34fr) minmax(0, 1fr); gap: 14px 18px; padding: 16px; border: 1px solid #dce5df; border-radius: 14px; background: linear-gradient(135deg, #f8faf9, #f2f7f3); }
.deal-buyer-panel > .deal-commission-heading { grid-column: 1 / -1; margin-bottom: 0; }
.deal-buyer-panel > label { align-self: start; }
.deal-buyer-existing { display: grid; align-content: start; gap: 8px; min-width: 0; }
.deal-buyer-source { display: grid; align-content: start; gap: 6px; }
.deal-buyer-existing .deal-selected-tags { margin: 0; }
.deal-seller-details { grid-column: 1 / -1; min-width: 0; display: grid; gap: 12px; }
.deal-buyer-new-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.deal-buyer-new-fields[hidden], .deal-buyer-existing[hidden] { display: none !important; }
.deal-buyer-note { grid-column: 1 / -1; color: #68746c; line-height: 1.45; }
.deal-card-buyer { display: flex; align-items: center; gap: 7px; margin: 8px 0; padding: 7px 9px; border-radius: 9px; background: #edf5ef; color: #24432c; font-size: .78rem; }
.deal-card-buyer span { color: #68746c; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.deal-card-buyer strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 760px) {
  .deal-dialog { width: calc(100vw - 12px); }
  .deal-dialog-form { padding: 12px; }
  .deal-editor-layout { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .deal-section-sidebar { overflow-x: auto; overflow-y: hidden; padding: 9px; border-right: 0; border-bottom: 1px solid #dce5df; }
  .deal-section-sidebar-label { display: none; }
  .deal-section-nav { display: flex; width: max-content; min-width: 100%; gap: 5px; }
  .deal-section-nav button { grid-template-columns: 24px auto; width: auto; min-width: max-content; padding: 7px 9px; }
  .deal-section-number { width: 23px; height: 23px; border-radius: 7px; }
  .deal-section-content { padding: 17px 14px; scrollbar-gutter: auto; }
  .deal-section-panel { grid-template-columns: 1fr; }
  .deal-buyer-panel { grid-template-columns: 1fr; }
  .deal-buyer-new-fields { grid-template-columns: 1fr; }
}
.deal-tag-empty { align-self: center; padding: 8px 0; color: var(--muted, #68746c); font-size: .76rem; font-weight: 600; }
.deal-owner-load-status:not(:empty) { display: block; margin: -2px 0 8px; padding: 7px 9px; border-radius: 8px; background: #edf5ef; color: #315a3d; font-size: .72rem; font-weight: 700; }
.deal-link-search { position: relative; }
.deal-link-search > span { position: absolute; z-index: 1; left: 12px; top: 50%; transform: translateY(-50%); color: #477052; font-size: 1.05rem; font-weight: 800; pointer-events: none; }
.deal-link-search input { width: 100%; padding-left: 34px; }
.deal-option-results {
  position: absolute;
  z-index: 5;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  display: grid;
  max-height: 220px;
  overflow-y: auto;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(20, 37, 25, .18);
}
.deal-option-results:empty { display: none; }
.deal-option-results button { display: grid; gap: 2px; padding: 10px 12px; border: 0; border-bottom: 1px solid #edf1ee; background: #fff; text-align: left; cursor: pointer; }
.deal-option-results button:hover { background: #f1f6f2; }
.deal-option-results button span { color: var(--muted, #68746c); font-size: .78rem; }
.deal-probability-input { position: relative; }
.deal-probability-input input { width: 100%; padding-right: 34px; }
.deal-probability-input > span { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); color: var(--muted, #68746c); }
.analytics-section { margin: 22px 0 0; }
.analytics-primary-grid,
.analytics-secondary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin: 18px 0; }
.analytics-funnel,
.analytics-stage-chart { display: grid; gap: 13px; }
.analytics-funnel article > div:first-child,
.analytics-stage-chart article > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: .85rem; }
.analytics-funnel article small,
.analytics-stage-chart article small { color: var(--muted, #68746c); font-size: .72rem; }
.analytics-funnel-track,
.analytics-stage-track { height: 10px; margin: 6px 0 4px; overflow: hidden; border-radius: 999px; background: #edf1ee; }
.analytics-funnel-track i,
.analytics-stage-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #315f3f, #69a277); }
.analytics-stage-track i { background: linear-gradient(90deg, #315f3f, #a7c7ae); }
.analytics-table td,
.analytics-table th { white-space: nowrap; }

@media (min-width: 2500px) {
  .deal-board { grid-auto-columns: minmax(330px, 1fr); }
  .deal-summary-grid { grid-template-columns: repeat(4, minmax(300px, 1fr)); }
}

@media (max-width: 1450px) {
  .analytics-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .deal-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .deal-search-field { grid-column: 1 / -1; }
  .deal-toolbar > button { width: 100%; }
}

@media (max-width: 980px) {
  .deal-summary-grid,
  .analytics-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .analytics-primary-grid,
  .analytics-secondary-grid { grid-template-columns: 1fr; }
  .deal-price-fields,
  .deal-commission-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .deal-commission-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .deal-stage-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .deal-pipeline-hero,
  .analytics-hero { align-items: flex-start; flex-direction: column; }
  .deal-pipeline-hero > button { width: 100%; }
  .deal-summary-grid,
  .analytics-kpi-grid,
  .deal-toolbar,
  .deal-link-grid,
  .deal-price-fields,
  .deal-commission-fields,
  .deal-commission-summary { grid-template-columns: 1fr; }
  .deal-search-field { grid-column: auto; }
  .deal-board { grid-auto-columns: minmax(270px, 88vw); }
  .deal-stage-tabs { display: flex; overflow-x: auto; }
  .deal-stage-tab { flex: 0 0 min(230px, 78vw); }
}

/* Final scroll-ownership precedence after all responsive component rules. */
#leadManagementView .lead-management-results-panel { min-height: 0; }
#leadManagementView .lead-management-tab-panel .data-table-wrap {
  min-height: 0;
  max-height: none;
  overflow: auto;
}

/* Focused Call Workspace */
#leadsView { --call-accent: #315f3f; --call-soft: #eef5f0; --call-line: #dce5df; }
#leadsView .filters {
  display: grid;
  grid-template-columns: minmax(240px, 1.45fr) repeat(4, minmax(145px, 1fr)) minmax(345px, auto);
  gap: 8px;
  padding: 9px 11px;
  border: 1px solid var(--call-line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 25px rgba(25, 45, 33, .035);
}
#leadsView .filters label { min-width: 0; }
#leadsView .filters label > span { margin-bottom: 4px; font-size: .65rem; font-weight: 760; color: #66736b; }
#leadsView .filters input,
#leadsView .filters select { min-height: 38px; }
.call-priority-filter { display: flex; min-width: 0; flex-direction: column; }
.call-priority-filter > span { margin-bottom: 4px; color: #66736b; font-size: .65rem; font-weight: 760; }
.call-queue-toggles { display: grid; min-width: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.call-priority-toggle {
  display: grid;
  min-height: 38px;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid #dce5df;
  border-radius: 10px;
  color: #59665e;
  background: #fff;
  font: inherit;
  font-size: .68rem;
  font-weight: 740;
  text-align: left;
  cursor: pointer;
}
.call-priority-toggle strong { color: #7a847d; font-size: .62rem; }
.call-priority-switch { position: relative; width: 30px; height: 18px; border-radius: 999px; background: #cbd4ce; transition: background .18s ease; }
.call-priority-switch::after { position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; border-radius: 50%; content: ""; background: #fff; box-shadow: 0 1px 3px rgba(22,42,28,.22); transition: transform .18s ease; }
.call-priority-toggle.active { border-color: #a9c0b0; color: #294f36; background: #f1f7f3; }
.call-priority-toggle.active strong { color: #315f3f; }
.call-priority-toggle.active .call-priority-switch { background: #52775d; }
.call-priority-toggle.active .call-priority-switch::after { transform: translateX(12px); }
.call-priority-toggle:focus-visible { outline: 3px solid rgba(72,119,86,.22); outline-offset: 2px; }

#leadsView .goal-progress-panel {
  padding: 0;
  border: 0;
  background: transparent;
}
.call-session-progress {
  display: grid;
  grid-template-columns: minmax(170px, .65fr) minmax(0, 2.4fr) auto;
  align-items: center;
  gap: 14px;
  padding: 8px 12px;
  border: 1px solid var(--call-line);
  border-radius: 14px;
  background: linear-gradient(100deg, #f8fbf9, #fff);
}
.call-session-eyebrow,
.call-contact-kicker { display: block; color: var(--call-accent); font-size: .63rem; font-weight: 850; letter-spacing: .11em; }
.call-session-progress > div:first-child strong { display: block; margin-top: 3px; font-size: .9rem; }
.call-session-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.call-session-metric { min-width: 0; }
.call-session-metric-copy { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 2px 9px; }
.call-session-metric-copy span { color: #5d6961; font-size: .68rem; font-weight: 760; }
.call-session-metric-copy strong { font-size: .88rem; }
.call-session-metric-copy small { grid-column: 1 / -1; color: #879188; font-size: .61rem; }
.call-session-metric .goal-bar { height: 5px; margin-top: 7px; }
.call-session-managed { color: #758078; font-size: .67rem; }

#leadsView .lead-layout { grid-template-columns: clamp(300px, 22vw, 390px) minmax(0, 1fr); gap: 14px; }
#leadsView .lead-list-panel,
#leadsView .call-panel { border: 1px solid var(--call-line); box-shadow: 0 10px 30px rgba(30, 50, 37, .045); }
#leadsView .lead-list-panel { padding: 14px 10px 10px; }
#leadsView .lead-list-panel .panel-head { padding: 0 4px 11px; }
#leadsView .lead-list-panel .panel-head h3 { font-size: .95rem; }
#leadsView .lead-list-panel .panel-head span { font-size: .65rem; }
#leadsView .lead-list {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 7px;
  padding-right: 3px;
}
#leadsView .lead-card.call-queue-card {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  width: 100%;
  padding: 10px;
  text-align: left;
  border: 1px solid #e3e9e5;
  border-radius: 12px;
  background: #fff;
  height: auto;
  min-height: 0;
  overflow: visible;
}
#leadsView .lead-card.call-queue-card.active { border-color: #7fa189; background: var(--call-soft); box-shadow: inset 3px 0 0 var(--call-accent); }
#leadsView .lead-card.call-queue-card.logged-today:not(.active) { background: #f7faf8; }
.call-queue-avatar {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  color: #315f3f;
  background: #e3eee6;
  font-size: .7rem;
  font-weight: 850;
}
.call-queue-copy { display: grid; min-width: 0; align-content: start; gap: 3px; }
.call-queue-copy > span:not(.tag-row) { overflow: hidden; color: #768078; font-size: .68rem; text-overflow: ellipsis; white-space: nowrap; }
.call-queue-name-row { display: flex !important; align-items: center; justify-content: space-between; gap: 8px; color: #1d2820 !important; }
.call-queue-name-row strong { overflow: hidden; font-size: .79rem; text-overflow: ellipsis; white-space: nowrap; }
.call-queue-logged { flex: 0 0 auto; padding: 2px 6px; border-radius: 999px; color: #315f3f !important; background: #dfece3; font-size: .56rem !important; font-weight: 800; text-transform: uppercase; }
.call-queue-phone { color: #39463d !important; font-weight: 720; }
.call-queue-copy .tag-row { min-width: 0; margin-top: 3px; }
.call-queue-copy .tag { padding: 3px 6px; font-size: .55rem; }
#leadsView .compact-load-more {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  margin-top: 4px;
  background: #fff;
}

#leadsView .call-panel { overflow: hidden; padding: 0; background: #fff; }
#leadsView .lead-detail { display: flex; height: 100%; min-height: 0; flex-direction: column; gap: 0; overflow: hidden; padding: 0; border: 0; border-radius: 0; background: #fff; }
.call-contact-header { position: relative; padding: 0; border-bottom: 1px solid var(--call-line); background: #fff; }
.call-contact-summary { display: grid; grid-template-columns: minmax(0, 1fr); }
.call-contact-overview { display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 20px 24px; }
.call-contact-avatar { display: grid; width: 54px; height: 54px; place-items: center; border-radius: 50%; color: #315f3f; background: #e3eee6; font-size: 1rem; font-weight: 850; }
.call-contact-identity h3 { margin: 3px 0 2px; color: #172019; font-size: 1.42rem; line-height: 1.08; }
.call-contact-identity p { margin: 0; color: #718078; font-size: .78rem; }
.call-contact-edit { min-height: 44px; padding-inline: 16px; white-space: nowrap; }
.call-contact-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--call-line); border-bottom: 1px solid var(--call-line); }
.call-contact-action { display: grid; min-width: 0; min-height: 72px; grid-template-columns: 25px minmax(0, 1fr); align-items: center; gap: 10px; padding: 13px 22px; color: #243b2a; text-decoration: none; transition: background .15s ease; }
.call-contact-action + .call-contact-action { border-left: 1px solid var(--call-line); }
.call-contact-action:hover { background: #f5f9f6; }
.call-contact-action.disabled { color: #89928c; background: #fbfcfb; }
.call-contact-action-icon { color: #315f3f; font-size: 1.12rem; line-height: 1; text-align: center; }
.call-contact-action > span:last-child { display: grid; min-width: 0; gap: 3px; }
.call-contact-action small { color: #6c776f; font-size: .62rem; font-weight: 850; letter-spacing: .06em; }
.call-contact-action strong { overflow: hidden; color: inherit; font-size: .76rem; text-overflow: ellipsis; white-space: nowrap; }
.call-alternative-phones { width: 100%; max-width: 100%; border: 0; background: #fbfcfb; }
.call-alternative-phones summary { display: flex; min-height: 48px; width: 100%; align-items: center; gap: 10px; padding: 9px 24px; color: #315f3f; font-size: .65rem; font-weight: 760; cursor: pointer; list-style: none; }
.call-alternative-phones summary::-webkit-details-marker { display: none; }
.call-alternative-phones summary::after { margin-left: auto; content: "⌄"; color: #6d7a71; font-size: .9rem; }
.call-alternative-phones[open] summary::after { transform: rotate(180deg); }
.call-alternative-label { color: #718078; font-size: .62rem; font-weight: 850; letter-spacing: .05em; text-transform: uppercase; }
.call-alternative-prompt { padding: 5px 9px; border: 1px solid #d8e3db; border-radius: 999px; background: #f5f9f6; }
.call-alternative-hide { display: none; padding: 5px 9px; border: 1px solid #d8e3db; border-radius: 999px; background: #f5f9f6; }
.call-alternative-phones[open] .call-alternative-prompt { display: none; }
.call-alternative-phones[open] .call-alternative-hide { display: inline-block; }
.call-alternative-phones summary strong { display: inline-grid; min-width: 20px; height: 20px; place-items: center; border-radius: 999px; color: #fff; background: #52775d; font-size: .57rem; }
.call-alternative-phones > div { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 24px 12px; }
.call-alternative-phones a { display: inline-flex; align-items: center; gap: 5px; padding: 6px 10px; border: 1px solid #d8e3db; border-radius: 9px; color: #315f3f; background: #fff; font-size: .68rem; font-weight: 750; text-decoration: none; }

.call-workspace-tabs { display: flex; gap: 3px; padding: 0 18px; border-bottom: 1px solid var(--call-line); background: #fbfcfb; }
.call-workspace-tabs button { position: relative; padding: 12px 13px 10px; border: 0; color: #6c776f; background: transparent; font-size: .74rem; font-weight: 760; cursor: pointer; }
.call-workspace-tabs button::after { position: absolute; right: 10px; bottom: -1px; left: 10px; height: 2px; content: ""; background: transparent; }
.call-workspace-tabs button.active { color: #254d34; }
.call-workspace-tabs button.active::after { background: #315f3f; }
.call-contact-header,
.call-workspace-tabs,
.call-workspace-sticky-actions { flex: 0 0 auto; }
.call-workspace-tab-panel { display: none; padding: 16px 18px; }
.call-workspace-tab-panel.active {
  display: block;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.call-workspace-guidance { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; padding: 10px 12px; border: 1px solid #d6e4da; border-radius: 10px; color: #536159; background: #f2f7f3; font-size: .72rem; }
.call-workspace-guidance strong { color: #294f36; }
#leadsView .detail-section { scroll-margin-top: 12px; margin: 0 0 12px; padding: 14px; border: 1px solid #e0e7e2; border-radius: 12px; background: #fff; }
#leadsView .section-title { margin-bottom: 11px; }
#leadsView .section-title h3 { font-size: .88rem; }
#leadsView .section-title > span { font-size: .68rem; }
.required-chip { display: inline-flex; margin-left: 5px; padding: 2px 6px; vertical-align: 2px; border-radius: 999px; color: #895b13; background: #fff2cf; font-size: .54rem; font-weight: 820; letter-spacing: .02em; }
#leadsView .outcome-grid { grid-template-columns: repeat(3, minmax(120px, 1fr)); gap: 7px; }
#leadsView .outcome-option { min-height: 41px; padding: 8px 10px; border-color: #dce4df; background: #fff; font-size: .7rem; }
#leadsView .outcome-option.active { border-color: #648b70; color: #284f35; background: #e8f1ea; box-shadow: inset 0 0 0 1px #8daa95; }
.call-required-section { border-color: #cbded0 !important; background: #fbfdfb !important; }
.modern-outcome-cards,
.call-interest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(126px, 1fr));
  gap: 8px;
}
.call-outcome-card {
  min-width: 0;
  min-height: 88px;
  padding: 10px;
  border: 1px solid #dce4df;
  border-radius: 12px;
  color: #1f2a22;
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease, transform .16s ease;
}
.call-outcome-card:hover {
  border-color: #9db4a3;
  transform: translateY(-1px);
}
.call-outcome-card.active {
  border-color: #557f62;
  background: #edf5ef;
  box-shadow: inset 0 0 0 1px #7fa088;
}
.call-outcome-card .call-outcome-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 25px;
  height: 25px;
  margin-bottom: 8px;
  border-radius: 8px;
  color: #315f3f;
  background: #f0f4f1;
  font-size: .8rem;
  font-weight: 900;
}
.call-outcome-card.active .call-outcome-icon { color: #fff; background: #416d4d; }
.call-outcome-card strong,
.call-outcome-card small { display: block; }
.call-outcome-card strong { font-size: .72rem; line-height: 1.25; }
.call-outcome-card small { margin-top: 3px; color: #77827a; font-size: .61rem; line-height: 1.32; }
.call-interest-section { background: linear-gradient(135deg, #f8fbf9, #fff) !important; }
.call-interest-grid { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
.quick-follow-up-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(118px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.quick-follow-up-grid > span {
  grid-column: 1 / -1;
  color: #68756c;
  font-size: .64rem;
  font-weight: 850;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.quick-follow-up-grid button {
  min-height: 53px;
  padding: 8px 10px;
  border: 1px solid #dce4df;
  border-radius: 10px;
  color: #28332b;
  background: #fff;
  text-align: left;
  cursor: pointer;
}
.quick-follow-up-grid button:hover,
.quick-follow-up-grid button.active { border-color: #6f9479; background: #edf5ef; }
.quick-follow-up-grid strong,
.quick-follow-up-grid small { display: block; }
.quick-follow-up-grid strong { font-size: .69rem; }
.quick-follow-up-grid small { margin-top: 2px; color: #7a857d; font-size: .59rem; }
.followup-options .wide,
.followup-commitment-summary { grid-column: 1 / -1; }
.followup-commitment-summary,
.calendar-invite-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px;
  border: 1px solid #d8e4dc;
  border-radius: 10px;
  color: #405147;
  background: #f3f7f4;
}
.followup-commitment-summary > span,
.calendar-invite-status > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  color: #3b6848;
  background: #e2eee5;
  font-weight: 900;
}
.followup-commitment-summary strong,
.followup-commitment-summary small,
.calendar-invite-status strong,
.calendar-invite-status small { display: block; }
.followup-commitment-summary strong,
.calendar-invite-status strong { font-size: .7rem; }
.followup-commitment-summary small,
.calendar-invite-status small { margin-top: 2px; color: #748078; font-size: .61rem; line-height: 1.35; }
.calendar-invite-card {
  overflow: hidden;
  border: 1px solid #d8e2db;
  border-radius: 12px;
  background: #fff;
}
.calendar-invite-toggle {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: none !important;
  margin: 0;
  padding: 12px;
  cursor: pointer;
}
.calendar-invite-toggle strong,
.calendar-invite-toggle small { display: block; }
.calendar-invite-toggle strong { color: #263229; font-size: .72rem; }
.calendar-invite-toggle small { margin-top: 2px; color: #77827a; font-size: .61rem; font-weight: 500; }
.calendar-invite-toggle input { flex: 0 0 auto; }
.calendar-invite-details {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
  border-top: 1px solid #edf1ee;
}
.calendar-invite-details[hidden] { display: none !important; }
.calendar-invite-details > label { max-width: none !important; padding-top: 10px; }
.calendar-invite-status.ready { border-color: #bdd3c3; background: #edf6ef; }
@media (max-width: 1100px) {
  .quick-follow-up-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .modern-outcome-cards,
  .call-interest-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .call-outcome-card { min-height: 80px; }
  .quick-follow-up-grid { grid-template-columns: 1fr 1fr; }
  .invite-recipient-row { grid-template-columns: 1fr; }
}
.call-step-highlight { animation: call-step-pulse 1.05s ease; }
@keyframes call-step-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(62,108,76,0); } 35% { box-shadow: 0 0 0 4px rgba(62,108,76,.16); } }
.call-workspace-tab-panel .lead-top-grid { margin-bottom: 14px; }
.call-workspace-tab-panel .owner-grid { margin-top: 12px; }
.owner-box .call-alternative-phones { margin-top: 4px; }
.owner-box .call-alternative-phones > div { gap: 5px; }
.call-workspace-error { position: sticky; z-index: 5; bottom: 68px; margin: 0 18px 8px; box-shadow: 0 6px 18px rgba(90, 35, 35, .12); }
.call-workspace-sticky-actions { position: static; z-index: 6; right: 0; bottom: 0; left: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 0; padding: 12px 18px; border-top: 1px solid var(--call-line); background: rgba(255,255,255,.96); box-shadow: 0 -8px 20px rgba(31,49,37,.055); backdrop-filter: blur(8px); }
.call-workspace-sticky-actions > span { overflow: hidden; color: #6e7971; font-size: .68rem; text-overflow: ellipsis; white-space: nowrap; }
.call-workspace-sticky-actions > div { display: flex; gap: 8px; }
.call-workspace-sticky-actions button { min-height: 40px; }

@media (max-width: 1350px) {
  #leadsView .filters { grid-template-columns: minmax(220px, 1.4fr) repeat(2, minmax(150px, 1fr)); }
  #leadsView .filters label:nth-child(4),
  #leadsView .filters label:nth-child(5) { grid-column: span 1; }
  .call-session-progress { grid-template-columns: minmax(150px, .5fr) minmax(0, 2fr); }
  .call-session-progress > :last-child { display: none; }
}

@media (max-width: 980px) {
  body[data-current-view="leads"] .view.active { overflow: auto; }
  #callWorkspaceCallerMode:not([hidden]) { flex: 0 0 auto; overflow: visible; }
  #leadsView .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #leadsView .filters .search-field { grid-column: 1 / -1; }
  .call-session-progress { grid-template-columns: 1fr; }
  .call-session-metrics { gap: 10px; }
  #leadsView .lead-layout { grid-template-columns: 1fr; overflow: visible; }
  #leadsView .lead-list-panel,
  #leadsView .call-panel { overflow: visible; }
  #leadsView .call-panel {
    height: min(760px, calc(100dvh - 72px));
    min-height: 520px;
    overflow: hidden;
  }
  #leadsView .lead-list { max-height: 34dvh; }
  .call-workspace-sticky-actions { position: static; }
}

@media (max-width: 650px) {
  #leadsView .filters { grid-template-columns: 1fr; }
  #leadsView .filters .search-field { grid-column: auto; }
  .call-queue-toggles { grid-template-columns: 1fr; }
  .call-session-metrics { grid-template-columns: 1fr; }
  .call-contact-overview { grid-template-columns: 44px minmax(0, 1fr); padding: 15px 14px; }
  .call-contact-avatar { width: 44px; height: 44px; }
  .call-contact-identity h3 { font-size: 1.12rem; }
  .call-contact-edit { grid-column: 1 / -1; width: 100%; }
  .call-contact-actions { grid-template-columns: 1fr; }
  .call-contact-action { min-height: 58px; padding: 10px 15px; }
  .call-contact-action + .call-contact-action { border-top: 1px solid var(--call-line); border-left: 0; }
  .call-alternative-phones summary { flex-wrap: wrap; padding-inline: 14px; }
  .call-alternative-phones > div { padding-inline: 14px; }
  .call-workspace-tabs { overflow-x: auto; padding-inline: 8px; }
  .call-workspace-tabs button { flex: 0 0 auto; }
  .call-workspace-tab-panel { padding: 12px 11px; }
  #leadsView .outcome-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .call-workspace-guidance { align-items: flex-start; flex-direction: column; }
  .call-workspace-sticky-actions { align-items: stretch; flex-direction: column; padding: 10px 12px; }
  .call-workspace-sticky-actions > div { display: grid; grid-template-columns: 1fr 1.3fr; }
}

/* Modern Follow-Ups workspace — one page scrollbar, compact queue, spacious context. */
body[data-current-view="followups"] .view.active {
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

#followupsView.active {
  display: flex;
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  gap: 16px;
  overflow-x: hidden;
  overflow-y: auto;
}

#followupsView > .panel { min-height: auto; overflow: visible; }
#followupsView .followup-control-panel { flex: 0 0 auto; margin: 0; }
#followupsView .followup-agenda { flex: 0 0 auto; min-height: 0; overflow: visible; padding: 0; }

.followup-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: clamp(20px, 1.8vw, 32px);
  border: 1px solid #dbe5de;
  border-radius: 16px;
  background: linear-gradient(115deg, #f8fbf8, #eef5f0);
  box-shadow: 0 9px 25px rgba(34, 61, 42, .05);
}
.followup-hero > div:first-child { min-width: 0; }
.followup-hero .eyebrow { color: #477054; font-size: .65rem; font-weight: 850; letter-spacing: .12em; }
.followup-hero h3 { margin: 4px 0 5px; color: #17231b; font-size: clamp(1.45rem, 1.6vw, 2.15rem); letter-spacing: -.04em; }
.followup-hero p { max-width: 720px; margin: 0; color: #6b786f; }
.followup-hero-actions { display: flex; flex: 0 0 auto; gap: 9px; }
.followup-hero-actions button { min-height: 44px; }

.followup-overview-grid {
  display: grid;
  grid-template-columns: minmax(270px, 1.45fr) repeat(4, minmax(130px, .72fr));
  gap: 12px;
}
.followup-progress-card,
.followup-metric {
  min-width: 0;
  padding: 17px 18px;
  border: 1px solid #dfe7e1;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(35, 54, 41, .035);
}
.followup-progress-copy { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.followup-progress-copy span,
.followup-metric span { color: #657269; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .055em; }
.followup-progress-copy strong { color: #203326; font-size: .9rem; }
.followup-progress-track { height: 8px; margin: 13px 0 8px; overflow: hidden; border-radius: 999px; background: #e8eeea; }
.followup-progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: #477454; transition: width 180ms ease; }
.followup-progress-card small,
.followup-metric small { color: #7c877f; font-size: .68rem; }
.followup-metric { display: grid; align-content: center; gap: 3px; }
.followup-metric strong { color: #203326; font-size: clamp(1.55rem, 1.5vw, 2rem); letter-spacing: -.05em; }
.followup-metric.is-danger { border-color: #ecd8d3; background: #fff9f8; }
.followup-metric.is-danger strong { color: #a04e42; }
.followup-metric.is-success { border-color: #d3e2d7; background: #f7fbf8; }
.followup-metric.is-success strong { color: #396949; }

.followup-control-panel .panel-head { margin-bottom: 13px; }
.followup-control-panel .panel-head > div { display: grid; gap: 2px; }
.followup-control-panel .filters { margin: 0; }
.followup-tabs {
  display: flex;
  gap: 5px;
  margin: 15px -4px -7px;
  padding: 4px;
  overflow-x: auto;
  border-top: 1px solid #e3e9e5;
}
.followup-tabs button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 13px;
  border: 0;
  border-bottom: 2px solid transparent;
  color: #66736a;
  background: transparent;
  font: inherit;
  font-size: .8rem;
  font-weight: 790;
  cursor: pointer;
}
.followup-tabs button:hover { color: #315a3d; }
.followup-tabs button.active { border-bottom-color: #477454; color: #315a3d; }
.followup-tabs small { display: inline-grid; min-width: 22px; height: 22px; place-items: center; border-radius: 999px; color: #5d6c62; background: #e9efeb; font-size: .65rem; }
.followup-tabs button.active small { color: #315a3d; background: #deebe1; }

.followup-workspace-grid {
  display: grid;
  grid-template-columns: minmax(360px, .7fr) minmax(520px, 1.3fr);
  align-items: start;
  gap: 16px;
  min-width: 0;
}
.followup-workspace-grid > .panel { min-width: 0; margin: 0; padding: 0; overflow: hidden; }
.followup-queue-panel,
.followup-detail-panel { border-radius: 15px; }
.followup-panel-heading,
.followup-detail-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  min-height: 76px;
  padding: 17px 19px;
  border-bottom: 1px solid #e1e7e3;
}
.followup-panel-heading > div,
.followup-detail-heading > div { display: grid; gap: 3px; min-width: 0; }
.followup-panel-heading h3,
.followup-detail-heading h3 { margin: 0; color: #1d2921; font-size: 1rem; }
.followup-panel-heading span,
.followup-detail-heading span { color: #7a867e; font-size: .72rem; }

#followupsView .bulk-actions { margin: 10px 12px 0; border-radius: 10px; }
.followup-queue-group { padding: 14px 11px 2px; }
.followup-group-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 3px 8px; color: #69766d; font-size: .68rem; font-weight: 850; letter-spacing: .07em; text-transform: uppercase; }
.followup-group-heading span { display: inline-grid; min-width: 22px; height: 22px; place-items: center; border-radius: 999px; background: #eef2ef; font-size: .62rem; }
.followup-queue-items { display: grid; gap: 7px; }
.followup-queue-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 11px;
  min-width: 0;
  padding: 13px 12px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: #fff;
  cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease, box-shadow 120ms ease;
}
.followup-queue-item:hover { border-color: #dce7df; background: #fafcfb; }
.followup-queue-item.active { border-color: #9db7a4; background: #edf5ef; box-shadow: inset 3px 0 0 #477454; }
.followup-item-select { padding-top: 2px; }
.followup-item-select input { width: 17px; height: 17px; }
.followup-item-copy { min-width: 0; }
.followup-item-title { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.followup-item-title strong { color: #1c2820; font-size: .86rem; }
.followup-type-chip { padding: 3px 7px; border-radius: 999px; color: #5d6d62; background: #e9efeb; font-size: .6rem; font-weight: 780; }
.followup-item-copy p { margin: 4px 0 2px; overflow: hidden; color: #58655d; font-size: .74rem; text-overflow: ellipsis; white-space: nowrap; }
.followup-item-copy > span { display: block; overflow: hidden; color: #869088; font-size: .67rem; text-overflow: ellipsis; white-space: nowrap; }
.followup-queue-item time { padding-top: 2px; color: #778279; font-size: .66rem; white-space: nowrap; }

.followup-detail-body { display: grid; gap: 14px; padding: 19px; }
.followup-detail-person { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.followup-detail-person h3 { margin: 0 0 3px; color: #19251d; font-size: clamp(1.2rem, 1.15vw, 1.55rem); }
.followup-detail-person p { margin: 0; color: #758078; }
.followup-priority { flex: 0 0 auto; padding: 5px 9px; border-radius: 999px; color: #6b5a2b; background: #f5efd9; font-size: .63rem; font-weight: 800; }
.followup-priority.high { color: #a14d42; background: #f9e9e6; }
.followup-priority.low { color: #4c6a55; background: #e9f1eb; }
.followup-contact-actions { display: grid; grid-template-columns: minmax(150px, 1.15fr) 1fr 1fr; gap: 8px; }
.followup-contact-actions a,
.followup-contact-actions span { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; text-align: center; text-decoration: none; }
.followup-contact-actions .is-disabled { cursor: not-allowed; opacity: .55; }
.followup-next-action { display: grid; gap: 3px; padding: 13px 14px; border-radius: 11px; color: #264f34; background: #eaf3ec; }
.followup-next-action span { font-size: .62rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.followup-next-action strong { color: #1f2c23; }
.followup-detail-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0; }
.followup-detail-facts > div { min-width: 0; padding: 11px 12px; border-radius: 10px; background: #f7f9f7; }
.followup-detail-facts dt { color: #7c877f; font-size: .62rem; }
.followup-detail-facts dd { margin: 3px 0 0; overflow-wrap: anywhere; color: #263229; font-size: .76rem; font-weight: 750; }
.followup-detail-section { padding-top: 13px; border-top: 1px solid #e1e7e3; }
.followup-detail-section h4 { margin: 0 0 6px; color: #1f2c23; font-size: .82rem; }
.followup-detail-section p { margin: 0; color: #6b776e; line-height: 1.58; white-space: pre-wrap; }
.followup-detail-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.followup-detail-actions button { min-height: 42px; }
.followup-reschedule-form { display: grid; grid-template-columns: minmax(210px, 1fr) auto auto; align-items: end; gap: 8px; padding: 13px; border: 1px solid #d9e5dc; border-radius: 11px; background: #f8fbf9; }
.followup-reschedule-form label { display: grid; gap: 5px; }
.followup-reschedule-form label span { color: #69766d; font-size: .68rem; font-weight: 760; }
.followup-detail-empty { display: grid; min-height: 330px; place-content: center; gap: 6px; padding: 30px; color: #7b867e; text-align: center; }
.followup-detail-empty strong { color: #263229; }

@media (min-width: 1800px) {
  .followup-workspace-grid { grid-template-columns: minmax(420px, .62fr) minmax(660px, 1.38fr); }
}

@media (max-width: 1250px) {
  .followup-overview-grid { grid-template-columns: repeat(4, minmax(130px, 1fr)); }
  .followup-progress-card { grid-column: 1 / -1; }
  .followup-workspace-grid { grid-template-columns: minmax(330px, .82fr) minmax(480px, 1.18fr); }
}

@media (max-width: 980px) {
  .followup-hero { align-items: flex-start; flex-direction: column; }
  .followup-hero-actions { width: 100%; }
  .followup-hero-actions button { flex: 1 1 auto; }
  .followup-workspace-grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .followup-overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .followup-progress-card { grid-column: 1 / -1; }
  .followup-hero-actions { flex-direction: column; }
  .followup-contact-actions,
  .followup-detail-actions,
  .followup-detail-facts { grid-template-columns: 1fr; }
  .followup-reschedule-form { grid-template-columns: 1fr; }
  .followup-queue-item { grid-template-columns: auto minmax(0, 1fr); }
  .followup-queue-item time { grid-column: 2; }
}

/* Follow-Ups viewport fit: only the queue records own vertical scrolling. */
body[data-current-view="followups"] .view.active,
#followupsView.active {
  overflow: hidden;
}

#followupsView.active {
  gap: 10px;
  padding: clamp(10px, 1vw, 18px);
}

#followupsView .followup-hero {
  flex: 0 0 auto;
  min-height: 78px;
  padding: 13px 18px;
}
#followupsView .followup-hero h3 { margin-block: 2px 3px; font-size: clamp(1.25rem, 1.25vw, 1.7rem); }
#followupsView .followup-hero p { font-size: .72rem; }
#followupsView .followup-hero-actions button { min-height: 38px; padding-block: 8px; }

#followupsView .followup-overview-grid {
  flex: 0 0 auto;
  grid-template-columns: minmax(230px, 1.3fr) repeat(4, minmax(100px, .66fr));
  gap: 8px;
}
#followupsView .followup-progress-card,
#followupsView .followup-metric { min-height: 68px; padding: 10px 13px; }
#followupsView .followup-progress-track { height: 6px; margin: 7px 0 4px; }
#followupsView .followup-metric strong { font-size: 1.35rem; line-height: 1; }

#followupsView .followup-control-panel { padding: 11px 14px 7px; }
#followupsView .followup-control-panel .panel-head { margin-bottom: 8px; }
#followupsView .followup-control-panel .filters { gap: 8px; }
#followupsView .followup-control-panel input,
#followupsView .followup-control-panel select { min-height: 36px; padding-block: 7px; }
#followupsView .followup-tabs { min-height: 35px; margin-top: 8px; padding-top: 2px; }
#followupsView .followup-tabs button { min-height: 32px; padding: 5px 10px; }
#followupsView .followup-tabs small { min-width: 19px; height: 19px; }

#followupsView .followup-workspace-grid {
  flex: 1 1 auto;
  min-height: 0;
  height: 0;
  align-items: stretch;
  grid-template-columns: minmax(340px, .7fr) minmax(500px, 1.3fr);
  gap: 10px;
  overflow: hidden;
}
#followupsView .followup-queue-panel,
#followupsView .followup-detail-panel {
  display: flex;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}
#followupsView .followup-panel-heading,
#followupsView .followup-detail-heading {
  min-height: 58px;
  flex: 0 0 auto;
  padding: 12px 15px;
}
#followupsView .followup-agenda {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
  scrollbar-color: #91a396 #eef2ef;
  scrollbar-width: thin;
}
#followupsView .followup-agenda::-webkit-scrollbar { width: 9px; }
#followupsView .followup-agenda::-webkit-scrollbar-track { background: #eef2ef; }
#followupsView .followup-agenda::-webkit-scrollbar-thumb { border: 2px solid #eef2ef; border-radius: 999px; background: #91a396; }
#followupsView .followup-queue-group { padding-top: 9px; }
#followupsView .followup-queue-item { padding-block: 9px; }

#followupsView .followup-detail-body {
  flex: 1 1 auto;
  min-height: 0;
  align-content: start;
  gap: 8px;
  overflow: hidden;
  padding: 12px 15px;
}
#followupsView .followup-detail-person h3 { font-size: 1.12rem; }
#followupsView .followup-contact-actions a,
#followupsView .followup-contact-actions span,
#followupsView .followup-detail-actions button { min-height: 34px; padding-block: 6px; }
#followupsView .followup-next-action { padding: 9px 11px; }
#followupsView .followup-detail-facts { gap: 6px; }
#followupsView .followup-detail-facts > div { padding: 8px 10px; }
#followupsView .followup-detail-section { padding-top: 8px; }
#followupsView .followup-detail-section h4 { margin-bottom: 3px; }
#followupsView .followup-detail-section p { font-size: .72rem; line-height: 1.4; }

@media (max-width: 1250px) {
  #followupsView .followup-overview-grid {
    grid-template-columns: minmax(200px, 1.2fr) repeat(4, minmax(88px, .62fr));
  }
  #followupsView .followup-progress-card { grid-column: auto; }
  #followupsView .followup-workspace-grid { grid-template-columns: minmax(300px, .72fr) minmax(430px, 1.28fr); }
}

@media (max-width: 980px) {
  #followupsView .followup-hero { align-items: center; flex-direction: row; }
  #followupsView .followup-hero p { display: none; }
  #followupsView .followup-hero-actions { width: auto; }
  #followupsView .followup-workspace-grid { grid-template-columns: minmax(270px, .75fr) minmax(360px, 1.25fr); }
}

/*
 * Site-wide height responsiveness.
 * These density profiles react to the browser's usable height (not the monitor
 * label), keeping controls visible while tables, queues and calendars retain
 * their intentional internal scrolling.
 */
@media (max-height: 1100px) {
  :root {
    --modern-space-1: 4px;
    --modern-space-2: 7px;
    --modern-space-3: 10px;
    --modern-space-4: 13px;
    --modern-space-5: 18px;
    --modern-space-6: 24px;
    --modern-content-pad: clamp(11px, 1.15vw, 20px);
  }

  html { font-size: 15px; }
  body { line-height: 1.36; }

  .sidebar { gap: 5px; padding: 10px 9px; }
  .sidebar .brand { min-height: 43px; padding: 0 8px 8px; }
  .sidebar .brand-logo-full { width: 154px; }
  .nav-tabs { gap: 1px; padding-block: 4px; }
  .nav-section + .nav-section { margin-top: 4px; }
  .nav-section-label { padding: 4px 9px 2px; font-size: .55rem; }
  .nav-tab { min-height: 35px; gap: 7px; padding: 6px 8px; font-size: .8rem; }
  .nav-icon { width: 21px; height: 21px; flex-basis: 21px; font-size: .7rem; }
  .sidebar-bottom-nav { padding-top: 4px; }

  .topbar { min-height: 60px; gap: 12px; padding-block: 7px; }
  .topbar h2 { font-size: 1.28rem; }
  .topbar .eyebrow { font-size: .58rem; }
  .topbar-actions { gap: 6px; }
  .user-chip { padding-block: 5px; }

  .view { padding: var(--modern-content-pad); }
  .panel { padding: 13px; }
  .panel + .panel { margin-top: 12px; }
  .panel-head { min-height: 34px; gap: 10px; margin-bottom: 10px; }
  .section-head { margin-bottom: 9px; }

  .primary-btn,
  .ghost-btn,
  .text-btn,
  .bug-report-btn,
  .suggestion-report-btn,
  .danger-btn,
  .command-trigger { min-height: 35px; padding-top: 6px; padding-bottom: 6px; }

  input,
  select,
  textarea { min-height: 36px; }

  .filters,
  .management-filters,
  .property-filters,
  .client-list-filters,
  .followup-filters,
  .admin-filters,
  .report-controls { gap: 8px; padding: 9px; }
  .table-toolbar { gap: 7px; margin: 9px 0 7px; }
  .data-column-toolbar { gap: 7px; margin-bottom: 7px; }
  .column-groups { gap: 6px; }
  .column-group { min-height: 35px; padding-block: 6px; }
  .data-table th { padding: 8px 9px; }
  .data-table td { padding: 8px 9px; line-height: 1.32; }
  .table-load-more { padding-top: 9px; }

  .metric-grid,
  .report-kpis,
  .report-summary-grid,
  .admin-stats,
  .subscription-metrics { gap: 9px; }
  .metric,
  .today-metric,
  .stat-card { padding: 11px 12px; }

  .modern-dashboard-welcome { gap: 14px; margin-bottom: 11px; }
  .modern-dashboard-welcome h3 { font-size: clamp(1.7rem, 2.4vw, 2.35rem); }
  .modern-dashboard-setup { gap: 10px; margin-bottom: 10px; padding: 10px 12px; }
  .modern-dashboard-setup-count { min-width: 31px; height: 31px; }
  .modern-setup-action { padding: 6px 8px; }
  .modern-kpi-grid { gap: 9px; margin-bottom: 10px; }
  .modern-kpi { min-height: 92px; padding: 12px; }
  .modern-kpi strong { margin: 7px 0 3px; font-size: 1.55rem; }
  .modern-dashboard-primary,
  .modern-dashboard-stack,
  .modern-performance-grid { gap: 10px; }
  .modern-appointment-summary article { padding: 10px; }
  .modern-appointment-summary strong { margin-block: 4px 1px; font-size: 1.35rem; }
  .appointment-list { gap: 5px; margin-top: 7px; }
  .appointment-list .appointment { grid-template-columns: 54px minmax(0, 1fr); gap: 8px; padding: 7px 9px; }
  .modern-section-heading { margin: 16px 0 8px; }
  .modern-pulse article,
  .modern-rate-card { padding: 10px 11px; }
  .modern-rate-card strong { margin-block: 5px 2px; font-size: 1.45rem; }
  .modern-activity-chart { min-height: 118px; padding-top: 10px; }
  .modern-activity-day { height: 105px; }

  .today-hero { padding: 13px; }
  .today-metrics,
  .today-grid { gap: 10px; }
  .today-metric { min-height: 76px; padding: 11px; }
  .today-item { padding-block: 8px; }

  #leadsView.active { gap: 10px; }
  #leadsView .filters { gap: 7px; padding: 9px; }
  #leadsView .filters input,
  #leadsView .filters select { min-height: 35px; }
  #leadsView .goal-progress-panel { padding: 9px 11px; }
  #leadsView .lead-layout { gap: 10px; }
  #leadsView .lead-list-panel { padding: 10px 7px 7px; }
  #leadsView .lead-list-panel .panel-head { padding-bottom: 7px; }
  #leadsView .lead-list { gap: 5px; }
  #leadsView .lead-card.call-queue-card { min-height: 66px; padding: 8px; }
  .call-contact-overview { padding: 12px 14px; }
  .call-contact-actions .call-contact-action { min-height: 52px; padding-block: 8px; }
  .call-workspace-tabs button { padding-block: 9px 7px; }
  .call-workspace-tab-panel { padding: 11px 13px; }
  #leadsView .detail-section { margin-bottom: 8px; padding: 10px; }
  #leadsView .section-title { margin-bottom: 7px; }
  #leadsView .outcome-grid { gap: 5px; }
  #leadsView .outcome-option { min-height: 35px; padding: 6px 8px; }
  .call-workspace-guidance { margin-bottom: 8px; padding: 7px 9px; }
  .call-workspace-sticky-actions { padding: 8px 13px; }
  .call-workspace-sticky-actions button { min-height: 35px; }

  .lead-management-tabs { gap: 6px; margin-bottom: 10px; padding-bottom: 7px; }
  .lead-management-tab { min-height: 36px; padding: 6px 10px; }
  .lead-management-tab small { min-height: 20px; padding-block: 2px; }
  .lead-management-tab-panel-head { margin-bottom: 8px; }

  .calendar-panel-head { margin-bottom: 8px; }
  .calendar-toolbar { gap: 7px; padding: 8px; }
  .calendar-filter-toggles,
  .calendar-sync-strip { gap: 5px; }
  .calendar-month-day { min-height: 92px; }

  .deal-pipeline-hero,
  .analytics-hero { gap: 14px; margin-bottom: 10px; padding: 12px; }
  .deal-pipeline-hero h3,
  .analytics-hero h3 { margin-block: 2px 3px; font-size: 1.45rem; }
  .deal-summary-grid,
  .analytics-kpi-grid { gap: 8px; margin-bottom: 10px; }
  .deal-pipeline-panel { padding: 11px; }
  .deal-stage-tabs { gap: 5px; margin-bottom: 8px; padding: 3px; }
  .deal-stage-tab { min-height: 40px; padding: 6px 8px; }
  .deal-stage-tab small { width: 22px; height: 22px; flex-basis: 22px; }
  .deal-toolbar { gap: 7px; margin-bottom: 7px; }
  .deal-board { gap: 8px; padding-bottom: 8px; }
  .deal-column { min-height: 330px; padding: 8px; }
  .deal-card { padding: 10px; }

  .analytics-modern-header,
  .analytics-filter-panel,
  .analytics-scope-banner { gap: 9px; padding: 11px; }
  .analytics-modern-metrics,
  .analytics-mini-stat-grid,
  .analytics-modern-grid,
  .analytics-overview-grid { gap: 9px; }
  .analytics-modern-card,
  .analytics-mini-stat { padding: 11px; }

  #callersView .caller-layout,
  #teamView .team-layout,
  #profileView .profile-grid,
  #exportsView .import-grid,
  #subscriptionView .subscription-grid,
  #showhousesView .showhouse-section-list,
  #adminDatabaseView .admin-health-grid,
  #adminServerView .admin-health-grid { gap: 10px; }
  #callersView .caller-list,
  #teamView .team-member-list { gap: 8px; }
  .caller-card,
  .team-member-card,
  .showhouse-card { padding: 11px; }

  dialog { max-height: calc(100dvh - 16px); }
  .dialog-form { padding: 14px; }
  .dialog-actions { gap: 7px; padding-top: 8px; }
  #leadForm.lead-dialog-form { max-height: calc(100dvh - 12px); padding: 12px; gap: 8px; }
  #leadForm .lead-section-sidebar { padding: 11px 8px; }
  #leadForm .lead-section-content { padding: 14px; }
  .deal-dialog-form { max-height: calc(100dvh - 12px); }
  .deal-section-sidebar { padding: 11px 8px; }
  .deal-section-content { padding: 14px; }
}

@media (max-height: 850px) {
  :root { --modern-content-pad: clamp(8px, .8vw, 13px); }
  html { font-size: 14px; }

  .sidebar { gap: 3px; padding: 7px; }
  .sidebar .brand { min-height: 36px; padding-bottom: 6px; }
  .sidebar .brand-logo-full { width: 138px; }
  .nav-tabs { padding-block: 2px; }
  .nav-section + .nav-section { margin-top: 2px; }
  .nav-section-label { padding-top: 2px; }
  .nav-tab { min-height: 31px; padding: 4px 7px; }
  .nav-icon { width: 19px; height: 19px; flex-basis: 19px; }

  .topbar { min-height: 52px; padding-block: 5px; }
  .topbar h2 { font-size: 1.18rem; }
  #viewContext { display: none; }
  .topbar-actions .bug-report-btn,
  .topbar-actions .suggestion-report-btn { min-height: 31px; }

  .panel { padding: 10px; }
  .panel + .panel { margin-top: 8px; }
  .panel-head { min-height: 29px; margin-bottom: 7px; }
  .primary-btn,
  .ghost-btn,
  .text-btn,
  .bug-report-btn,
  .suggestion-report-btn,
  .danger-btn,
  .command-trigger { min-height: 32px; padding-block: 5px; }
  input,
  select,
  textarea { min-height: 32px; }
  .filters,
  .management-filters,
  .property-filters,
  .client-list-filters,
  .followup-filters,
  .admin-filters,
  .report-controls { gap: 6px; padding: 7px; }

  .data-table th { padding: 6px 7px; }
  .data-table td { padding: 6px 7px; }
  .modern-dashboard-welcome { margin-bottom: 8px; }
  .modern-dashboard-welcome h3 { font-size: 1.7rem; }
  .modern-dashboard-setup { margin-bottom: 7px; padding: 7px 9px; }
  .modern-kpi-grid { gap: 7px; margin-bottom: 7px; }
  .modern-kpi { min-height: 76px; padding: 9px; }
  .modern-kpi strong { margin-block: 4px 1px; font-size: 1.35rem; }
  .modern-dashboard-primary,
  .modern-dashboard-stack,
  .modern-performance-grid { gap: 7px; }
  .modern-section-heading { margin: 11px 0 6px; }
  .modern-activity-chart { min-height: 96px; }
  .modern-activity-day { height: 84px; }

  .today-metric { min-height: 62px; padding: 8px; }
  #leadsView.active { gap: 7px; }
  #leadsView .filters { padding: 6px; }
  #leadsView .goal-progress-panel { padding: 6px 8px; }
  #leadsView .lead-layout { gap: 7px; }
  #leadsView .lead-list-panel { padding-top: 7px; }
  #leadsView .lead-card.call-queue-card { min-height: 56px; padding: 6px; }
  .call-contact-overview { padding: 9px 11px; }
  .call-contact-actions .call-contact-action { min-height: 44px; }
  .call-workspace-tab-panel { padding: 8px 9px; }
  #leadsView .detail-section { margin-bottom: 6px; padding: 8px; }
  #leadsView .outcome-option { min-height: 31px; padding: 5px 6px; }
  .call-workspace-sticky-actions { padding: 6px 9px; }

  .calendar-toolbar { padding: 6px; }
  .calendar-month-day { min-height: 74px; }
  .deal-pipeline-hero,
  .analytics-hero { margin-bottom: 7px; padding: 9px; }
  .deal-summary-grid,
  .analytics-kpi-grid { gap: 6px; margin-bottom: 7px; }
  .deal-stage-tab { min-height: 34px; }
  .deal-column { min-height: 270px; }

  #followupsView.active { gap: 7px; padding: 7px; }
  #followupsView .followup-hero { min-height: 60px; padding: 8px 12px; }
  #followupsView .followup-hero p { display: none; }
  #followupsView .followup-progress-card,
  #followupsView .followup-metric { min-height: 54px; padding: 7px 9px; }
  #followupsView .followup-control-panel { padding: 7px 9px 4px; }
  #followupsView .followup-tabs { margin-top: 5px; }
  #followupsView .followup-panel-heading,
  #followupsView .followup-detail-heading { min-height: 46px; padding: 8px 11px; }
  #followupsView .followup-detail-body { gap: 6px; padding: 8px 11px; }
  #followupsView .followup-queue-item { padding-block: 7px; }

  dialog { max-height: calc(100dvh - 8px); border-radius: 13px; }
  .dialog-form { padding: 10px; }
  #leadForm.lead-dialog-form,
  .deal-dialog-form { max-height: calc(100dvh - 6px); }
}

@media (max-height: 700px) and (min-width: 720px) {
  html { font-size: 13px; }
  .topbar { min-height: 46px; }
  .sidebar .brand { min-height: 31px; }
  .sidebar .brand-logo-full { width: 124px; }
  .nav-tab { min-height: 27px; padding-block: 3px; }
  .nav-section-label { display: none; }
  .view { padding: 6px; }
  .panel { padding: 8px; }
  .modern-dashboard-welcome p:last-child,
  .deal-pipeline-hero p:last-child,
  .analytics-hero p:last-child { display: none; }
  .modern-kpi { min-height: 66px; }
  .modern-activity-chart { min-height: 78px; }
  .modern-activity-day { height: 68px; }
  .calendar-month-day { min-height: 62px; }
  #leadsView .lead-card.call-queue-card { min-height: 48px; }
  .call-contact-actions .call-contact-action { min-height: 38px; }
  #followupsView .followup-hero { min-height: 48px; }
  #followupsView .followup-overview-grid { gap: 5px; }
  #followupsView .followup-progress-card,
  #followupsView .followup-metric { min-height: 45px; padding: 5px 7px; }
  #followupsView .followup-progress-card small,
  #followupsView .followup-metric small { display: none; }
}

/* High-zoom safety mode: reachability wins over viewport fitting. */
@media (max-height: 760px) and (max-width: 1500px) {
  body:is(
    [data-current-view="leads"],
    [data-current-view="leadManagement"],
    [data-current-view="properties"],
    [data-current-view="buyers"],
    [data-current-view="clients"],
    [data-current-view="followups"],
    [data-current-view="calendar"]
  ) .view.active {
    overflow-x: hidden;
    overflow-y: auto;
  }

  #followupsView.active {
    display: flex;
    height: auto;
    min-height: 0;
    overflow-y: auto;
  }
  #followupsView .followup-workspace-grid {
    height: auto;
    min-height: 0;
    flex: 0 0 auto;
    align-items: start;
    overflow: visible;
  }
  #followupsView .followup-queue-panel,
  #followupsView .followup-detail-panel {
    height: auto;
    min-height: 0;
    overflow: visible;
  }
  #followupsView .followup-agenda,
  #followupsView .followup-detail-body {
    flex: 0 0 auto;
    overflow: visible;
  }

  dialog:not(#leadDialog):not(#dealDialog) { overflow-y: auto; }
}

/* Queue cards remain content-sized at every browser zoom level. */

@media (max-height: 760px) and (max-width: 700px) {
  #followupsView .followup-workspace-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Modern tabbed My Profile workspace. */
#profileView {
  --profile-green: #436f4d;
  --profile-green-dark: #294c33;
  --profile-green-soft: #edf4ef;
  --profile-soft: #f6f8f7;
  --profile-line: #dfe6e1;
  --profile-muted: #707b73;
}

#profileView .profile-modern-identity {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(240px, 330px) auto;
  gap: 18px;
  align-items: center;
  margin-bottom: 14px;
  padding: 18px 22px;
  border-radius: 16px;
}

#profileView .profile-modern-avatar {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  border-radius: 18px;
  color: var(--profile-green-dark);
  background: var(--profile-green-soft);
  font-size: 1.2rem;
  font-weight: 900;
}

#profileView .profile-modern-copy .eyebrow {
  margin: 0 0 2px;
  color: var(--profile-green);
  font-size: .66rem;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}

#profileView .profile-modern-copy h3 { margin: 0 0 3px; font-size: 1.42rem; }
#profileView .profile-modern-copy > p:last-child { margin: 0; color: var(--profile-muted); }

#profileView .profile-modern-progress { display: grid; gap: 6px; }
#profileView .profile-modern-progress > div:first-child { display: flex; justify-content: space-between; font-size: .74rem; }
#profileView .profile-modern-progress small { color: var(--profile-muted); font-size: .7rem; }
#profileView .profile-modern-progress-track { height: 7px; overflow: hidden; border-radius: 99px; background: #e6ebe7; }
#profileView .profile-modern-progress-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--profile-green); transition: width .2s ease; }

#profileView .profile-modern-account-badge {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 10px;
  border-radius: 99px;
  color: var(--profile-green-dark);
  background: var(--profile-green-soft);
  font-size: .68rem;
  font-weight: 850;
  white-space: nowrap;
}

#profileView .profile-settings-tabs {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 14px;
  padding: 7px;
  border-radius: 15px;
}

#profileView .profile-settings-tabs button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 9px;
  align-items: center;
  min-width: 0;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--profile-muted);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

#profileView .profile-settings-tabs button:hover { background: var(--profile-soft); }
#profileView .profile-settings-tabs button.active {
  border-color: #c6d7ca;
  color: var(--profile-green-dark);
  background: var(--profile-green-soft);
  box-shadow: 0 4px 12px rgba(39, 74, 48, .08);
}

#profileView .profile-settings-tabs button > span {
  grid-row: 1 / 3;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 8px;
  background: #eaf0ec;
  font-size: .68rem;
  font-weight: 900;
}

#profileView .profile-settings-tabs button.active > span { color: #fff; background: var(--profile-green); }
#profileView .profile-settings-tabs strong,
#profileView .profile-settings-tabs small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#profileView .profile-settings-tabs strong { font-size: .77rem; }
#profileView .profile-settings-tabs small { font-size: .63rem; }

#profileView .profile-settings-panels { gap: 14px; }
#profileView .profile-settings-panels > .profile-settings-panel { margin: 0; }
#profileView .profile-settings-panel[hidden] { display: none !important; }
#profileView .profile-settings-panel { padding: 20px; border-radius: 15px; }
#profileView .profile-settings-panel > .profile-accordion { gap: 0; }
#profileView .profile-settings-panel .profile-accordion > summary { cursor: default; }
#profileView .profile-settings-panel .profile-accordion > summary::after { display: none; }
#profileView .profile-settings-panel .profile-accordion > summary strong { font-size: 1rem; }
#profileView .profile-settings-panel .profile-accordion > summary small { margin-top: 3px; font-size: .72rem; }
#profileView .profile-settings-panel .profile-accordion > :not(summary) { margin-top: 16px; }

#profileView .profile-settings-panel .profile-form > button.primary-btn,
#profileView .profile-settings-panel #saveAppointmentTemplates {
  justify-self: end;
  min-width: 150px;
  margin-top: 4px;
}

#profileView .profile-password-grid { gap: 14px; }
#profileView .account-status-card,
#profileView .calendar-status-row,
#profileView .calendar-provider-options,
#profileView .calendar-ics-item,
#profileView .calendar-ics-field,
#profileView .goal-setting-row,
#profileView .availability-table,
#profileView .template-panel-section,
#profileView .dropdown-settings-card { border-color: var(--profile-line); border-radius: 10px; }

#profileView .account-status-card { padding: 16px; background: var(--profile-soft); }
#profileView .account-status-card strong { color: var(--profile-green-dark); }
#profileView .calendar-status-row { min-height: 72px; padding: 13px 14px; background: #fff; }
#profileView .calendar-status-row strong { display: block; margin-top: 3px; }
#profileView .calendar-settings-form { margin-top: 14px; }
#profileView .calendar-provider-options {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) repeat(2, minmax(125px, auto));
  gap: 12px;
  align-items: center;
  margin-top: 0;
  padding: 14px 16px;
  background: var(--profile-soft);
}
#profileView .calendar-provider-options > span {
  width: auto;
  margin: 0;
  color: #536158;
  font-size: .72rem;
  font-weight: 850;
  line-height: 1.35;
  letter-spacing: 0;
  text-transform: none;
}
#profileView .calendar-provider-options label {
  display: inline-flex;
  width: auto;
  min-width: 0;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin: 0;
  font-size: .74rem;
  line-height: 1.2;
  white-space: nowrap;
}
#profileView .calendar-provider-options input[type="checkbox"] {
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
  padding: 0;
}
#profileView .calendar-ics-field { padding: 14px; border: 1px solid var(--profile-line); background: var(--profile-soft); }

#profileView .goal-settings-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
#profileView .goal-setting-row {
  grid-template-columns: minmax(0, 1fr) repeat(2, minmax(80px, .55fr));
  padding: 15px;
  border: 1px solid var(--profile-line);
  background: #fbfdfb;
}

#profileView .availability-grid { padding: 1px 0 7px; }
#profileView .availability-table { min-width: 980px; }
#profileView .availability-day-head { color: var(--profile-green-dark); background: var(--profile-green-soft); }
#profileView .availability-range-row { border-color: var(--profile-line); border-radius: 9px; background: var(--profile-soft); }

#profileView .profile-template-workspace {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

#profileView .profile-template-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
  padding: 0 2px;
}

#profileView .profile-template-heading .eyebrow {
  margin: 0 0 5px;
  color: var(--profile-green);
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .11em;
  text-transform: uppercase;
}

#profileView .profile-template-heading h3 { margin: 0; font-size: 1.45rem; }
#profileView .profile-template-heading > div > p:last-child { margin: 6px 0 0; color: var(--profile-muted); font-size: .78rem; }
#profileView .profile-template-heading > button { min-height: 44px; padding-inline: 18px; white-space: nowrap; }
#profileView .profile-template-heading > button:disabled { cursor: not-allowed; opacity: .55; }

#profileView .profile-template-layout {
  display: grid;
  grid-template-columns: 255px minmax(0, 1fr);
  min-height: 570px;
  overflow: hidden;
  border-radius: 15px;
}

#profileView .template-tabs {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 10px;
  border-right: 1px solid var(--profile-line);
  background: var(--profile-soft);
}

#profileView .template-tab-button {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 68px;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--profile-muted);
  background: transparent;
  text-align: left;
}

#profileView .template-tab-button:hover { color: var(--profile-green-dark); background: rgba(255, 255, 255, .72); }
#profileView .template-tab-button.active {
  color: var(--profile-green-dark);
  border-color: #d9e4dc;
  background: #fff;
  box-shadow: 0 4px 12px rgba(33, 53, 39, .07);
}

#profileView .template-nav-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 9px;
  color: var(--profile-green-dark);
  background: #e8eeea;
  font-size: .82rem;
  font-weight: 900;
}

#profileView .template-nav-copy { min-width: 0; }
#profileView .template-nav-copy strong,
#profileView .template-nav-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#profileView .template-nav-copy strong { font-size: .78rem; }
#profileView .template-nav-copy small { margin-top: 3px; font-size: .66rem; font-weight: 500; }

#profileView .profile-template-editor-card { min-width: 0; padding: 20px 24px 22px; }
#profileView .profile-template-editor-heading { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
#profileView .profile-template-editor-heading h4 { margin: 0; font-size: 1.08rem; }
#profileView .profile-template-editor-heading p { margin: 5px 0 0; color: var(--profile-muted); font-size: .75rem; }
#profileView .profile-template-editor-heading .status-pill { flex: 0 0 auto; }

#profileView .template-form { display: grid; gap: 16px; padding: 0; }
#profileView .template-form > label:first-child { max-width: none; }
#profileView .template-tab-panel { display: grid; gap: 16px; }
#profileView .template-tab-panel[hidden] { display: none !important; }
#profileView .template-field { display: grid; gap: 7px; margin: 0; }
#profileView .template-field .field-title { color: #536158; font-size: .71rem; font-weight: 850; }
#profileView .template-editor { min-height: 44px; padding: 11px 13px; border-radius: 9px; background: #fff; }
#profileView .template-editor.multiline { min-height: 135px; line-height: 1.55; }
#profileView .template-placeholder-palette { display: flex; flex-wrap: wrap; gap: 6px; margin: 1px 0 0; }
#profileView .template-placeholder-palette::before { content: "Insert:"; align-self: center; margin-right: 2px; color: var(--profile-muted); font-size: .67rem; font-weight: 850; }
#profileView .template-placeholder-palette button { min-height: 29px; border-radius: 99px; }
#profileView .template-form .template-actions { display: none; }

#profileView .template-manager-toolbar {
  align-items: end;
  padding: 12px;
  border: 1px solid var(--profile-line);
  border-radius: 10px;
  background: var(--profile-soft);
}

#profileView .template-manager-actions { align-items: center; }
#profileView .template-panel-section { margin: 0; padding: 15px; background: #fbfdfb; }
#profileView .template-panel-section + .template-panel-section { margin-top: 0; }

#profileView .profile-template-live-preview {
  display: grid;
  gap: 9px;
  margin-top: 2px;
  padding: 16px;
  border: 1px solid var(--profile-line);
  border-radius: 11px;
  background: var(--profile-soft);
}

#profileView .profile-template-live-preview > span {
  color: var(--profile-muted);
  font-size: .67rem;
  font-weight: 900;
  letter-spacing: .02em;
  text-transform: uppercase;
}

#profileView .profile-template-live-preview strong { color: var(--profile-green-dark); font-size: .78rem; }
#profileView .profile-template-live-preview p { margin: 0; color: #415047; font-size: .75rem; line-height: 1.62; }
#profileView .profile-template-footer { display: flex; justify-content: flex-end; gap: 9px; padding-top: 2px; border-top: 1px solid var(--profile-line); }
#profileView .profile-template-footer button { min-width: 118px; margin-top: 14px; }
#profileView .profile-template-footer #saveAppointmentTemplates { justify-self: auto; margin-top: 14px; }

#profileView .dropdown-settings-form {
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--profile-line);
  border-radius: 12px;
  background: #fff;
}

#profileView .profile-option-tabs {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px;
  border-right: 1px solid var(--profile-line);
  background: var(--profile-soft);
}

#profileView .profile-option-tabs button {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 11px;
  border: 0;
  border-radius: 8px;
  color: var(--profile-muted);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

#profileView .profile-option-tabs button:hover,
#profileView .profile-option-tabs button.active { color: var(--profile-green-dark); background: #fff; box-shadow: 0 3px 10px rgba(33, 53, 39, .06); }
#profileView .profile-option-tabs span { font-size: .73rem; font-weight: 850; }
#profileView .profile-option-tabs small { font-size: .62rem; }
#profileView .dropdown-settings-grid { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 18px; }
#profileView .dropdown-settings-card { grid-column: 1; padding: 14px; background: #fff; }
#profileView .dropdown-settings-card[hidden] { display: none !important; }
#profileView .dropdown-settings-form > .primary-btn { grid-column: 2; justify-self: end; margin: 0 18px 18px; }

#profileView .profile-intake-panel { display: grid; gap: 18px; }
#profileView .profile-intake-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
#profileView .profile-intake-heading .eyebrow { margin: 0 0 5px; color: var(--profile-green); font-size: .68rem; font-weight: 900; letter-spacing: .11em; text-transform: uppercase; }
#profileView .profile-intake-heading h3 { margin: 0; font-size: 1.42rem; letter-spacing: -.035em; }
#profileView .profile-intake-heading > div > p:last-child { max-width: 720px; margin: 7px 0 0; color: var(--profile-muted); font-size: .75rem; line-height: 1.55; }
#profileView .profile-intake-status { display: inline-flex; min-height: 30px; align-items: center; padding: 0 11px; border-radius: 99px; color: var(--profile-green-dark); background: var(--profile-green-soft); font-size: .67rem; font-weight: 850; white-space: nowrap; }
#profileView .profile-intake-status.is-paused { color: #895f24; background: #f7edda; }
#profileView .profile-intake-status.is-error { color: #97483c; background: #fae9e6; }

#profileView .profile-intake-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(260px, .65fr); gap: 14px; }
#profileView .profile-intake-link-card,
#profileView .profile-intake-controls,
#profileView .profile-intake-recent { border: 1px solid var(--profile-line); border-radius: 13px; }
#profileView .profile-intake-link-card { padding: 20px; background: linear-gradient(145deg, #f5faf6, #edf5ef); }
#profileView .profile-intake-kicker { display: block; color: var(--profile-green); font-size: .63rem; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; }
#profileView .profile-intake-link-card > strong { display: block; margin-top: 7px; color: var(--profile-green-dark); font-size: .95rem; }
#profileView .profile-intake-link-card > p { max-width: 690px; margin: 6px 0 16px; color: var(--profile-muted); font-size: .7rem; line-height: 1.5; }
#profileView .profile-intake-link-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
#profileView .profile-intake-link-row input { min-width: 0; min-height: 43px; color: #445048; background: #fff; font-size: .71rem; }
#profileView .profile-intake-link-row button { min-width: 105px; }
#profileView .profile-intake-share-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; }
#profileView .profile-intake-share-actions button { min-height: 36px; }

#profileView .profile-intake-controls { display: grid; align-content: start; gap: 13px; padding: 16px; background: #fff; }
#profileView .profile-intake-control-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 13px; border-bottom: 1px solid var(--profile-line); }
#profileView .profile-intake-control-row strong,
#profileView .profile-intake-control-row small { display: block; }
#profileView .profile-intake-control-row strong { font-size: .75rem; }
#profileView .profile-intake-control-row small { margin-top: 3px; color: var(--profile-muted); font-size: .62rem; line-height: 1.4; }
#profileView .profile-intake-switch { display: block; flex: 0 0 auto; cursor: pointer; }
#profileView .profile-intake-switch input { position: absolute; opacity: 0; pointer-events: none; }
#profileView .profile-intake-switch span { position: relative; display: block; width: 42px; height: 24px; border-radius: 99px; background: #d7ded9; transition: background .16s ease; }
#profileView .profile-intake-switch span::after { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 2px 7px rgba(32, 48, 37, .2); content: ""; transition: transform .16s ease; }
#profileView .profile-intake-switch input:checked + span { background: var(--profile-green); }
#profileView .profile-intake-switch input:checked + span::after { transform: translateX(18px); }
#profileView .profile-intake-switch input:focus-visible + span { outline: 3px solid rgba(64, 113, 77, .2); outline-offset: 2px; }
#profileView .profile-intake-stat { padding: 13px; border-radius: 10px; background: var(--profile-soft); }
#profileView .profile-intake-stat span,
#profileView .profile-intake-stat small { display: block; color: var(--profile-muted); font-size: .61rem; }
#profileView .profile-intake-stat strong { display: block; margin: 3px 0; color: var(--profile-green-dark); font-size: 1.55rem; }
#profileView .profile-intake-controls > button { width: 100%; }
#profileView .profile-intake-warning { color: var(--profile-muted); font-size: .58rem; line-height: 1.4; text-align: center; }

#profileView .profile-intake-recent { overflow: hidden; background: #fff; }
#profileView .profile-intake-recent > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 13px 16px; border-bottom: 1px solid var(--profile-line); }
#profileView .profile-intake-recent > div:first-child strong { font-size: .79rem; }
#profileView .profile-intake-recent > div:first-child small { color: var(--profile-muted); font-size: .63rem; }
#profileView .profile-intake-submission-list { display: grid; }
#profileView .profile-intake-submission-list > p { margin: 0; padding: 22px 16px; font-size: .68rem; }
#profileView .profile-intake-submission { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 11px; align-items: center; min-height: 60px; padding: 9px 16px; border-bottom: 1px solid #edf1ee; }
#profileView .profile-intake-submission:last-child { border-bottom: 0; }
#profileView .profile-intake-submission-avatar { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 10px; color: var(--profile-green-dark); background: var(--profile-green-soft); font-size: .65rem; font-weight: 900; }
#profileView .profile-intake-submission strong,
#profileView .profile-intake-submission small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#profileView .profile-intake-submission strong { font-size: .72rem; }
#profileView .profile-intake-submission small { margin-top: 3px; color: var(--profile-muted); font-size: .61rem; }
#profileView .profile-intake-submission > time { color: var(--profile-muted); font-size: .61rem; white-space: nowrap; }
#profileView .profile-intake-message { min-height: 16px; margin: -7px 0 0; color: var(--profile-muted); font-size: .64rem; }
#profileView .profile-intake-message.is-error { color: #9a4a3c; }

@media (min-width: 1900px) {
  #profileView .profile-settings-panel[data-profile-settings-panel="account"] { min-height: 100%; }
  #profileView .goal-settings-grid { grid-template-columns: repeat(3, minmax(320px, 1fr)); }
}

@media (max-width: 1260px) {
  #profileView .profile-settings-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #profileView .profile-modern-identity { grid-template-columns: auto minmax(0, 1fr) minmax(220px, 300px); }
  #profileView .profile-modern-account-badge { grid-column: 3; justify-self: end; }
  #profileView .profile-grid { grid-template-columns: minmax(0, 1fr); }
  #profileView .goal-settings-grid { grid-template-columns: minmax(0, 1fr); }
  #profileView .profile-intake-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 820px) {
  #profileView .profile-modern-identity { grid-template-columns: auto minmax(0, 1fr); padding: 15px; }
  #profileView .profile-modern-progress { grid-column: 1 / 3; }
  #profileView .profile-modern-account-badge { position: absolute; right: 30px; }
  #profileView .profile-settings-tabs { display: flex; overflow-x: auto; }
  #profileView .profile-settings-tabs button { flex: 0 0 165px; }
  #profileView .profile-template-layout { grid-template-columns: minmax(0, 1fr); }
  #profileView .template-tabs { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--profile-line); }
  #profileView .template-tab-button { flex: 0 0 195px; min-height: 62px; }
  #profileView .profile-template-editor-card { padding: 18px; }
  #profileView .dropdown-settings-form { grid-template-columns: minmax(0, 1fr); }
  #profileView .profile-option-tabs { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--profile-line); }
  #profileView .profile-option-tabs button { flex: 0 0 165px; }
  #profileView .dropdown-settings-form > .primary-btn { grid-column: 1; }
  #profileView .profile-intake-heading { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 600px) {
  #profileView .profile-modern-avatar { width: 52px; height: 52px; border-radius: 14px; }
  #profileView .profile-modern-account-badge { display: none; }
  #profileView .profile-settings-panel { padding: 15px; }
  #profileView .profile-template-workspace { padding: 0; }
  #profileView .profile-template-heading { align-items: flex-start; flex-direction: column; }
  #profileView .profile-template-heading > button { width: 100%; }
  #profileView .profile-template-editor-card { padding: 15px; }
  #profileView .profile-template-editor-heading { align-items: flex-start; }
  #profileView .profile-intake-link-row { grid-template-columns: minmax(0, 1fr); }
  #profileView .profile-intake-link-row button { width: 100%; }
  #profileView .profile-intake-share-actions { display: grid; grid-template-columns: minmax(0, 1fr); }
  #profileView .profile-intake-recent > div:first-child { align-items: flex-start; flex-direction: column; gap: 3px; }
  #profileView .profile-intake-submission { grid-template-columns: auto minmax(0, 1fr); }
  #profileView .profile-intake-submission > time { grid-column: 2; }
  #profileView .template-manager-toolbar { align-items: stretch; flex-direction: column; }
  #profileView .template-manager-actions { display: grid; grid-template-columns: 1fr 1fr; }
  #profileView .profile-template-footer { display: grid; grid-template-columns: 1fr 1fr; }
  #profileView .profile-template-footer button { width: 100%; min-width: 0; }
  #profileView .profile-password-grid { grid-template-columns: minmax(0, 1fr); }
  #profileView .calendar-status-row { align-items: stretch; flex-direction: column; }
  #profileView .calendar-status-actions { justify-content: stretch; }
  #profileView .calendar-status-actions button { flex: 1; }
  #profileView .calendar-provider-options { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  #profileView .calendar-provider-options > span { grid-column: 1 / -1; }
  #profileView .goal-setting-row { grid-template-columns: minmax(0, 1fr); }
}

/* Modern Buyers workspace: compact buyer rows with on-demand property matches. */
#buyersView {
  --buyer-green: #436f4d;
  --buyer-dark: #294c33;
  --buyer-soft: #edf4ef;
  --buyer-line: #dfe6e1;
  --buyer-muted: #707b73;
  gap: 12px;
  max-width: none;
  padding: 18px 22px 22px;
}

#buyersView.active { overflow: hidden; }
#buyersView .buyers-modern-heading { display: flex; flex: 0 0 auto; align-items: end; justify-content: space-between; gap: 18px; padding: 2px; }
#buyersView .buyers-modern-heading p { margin: 0; color: var(--buyer-green); font-size: .66rem; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; }
#buyersView .buyers-modern-heading h3 { margin: 3px 0 4px; font-size: 1.4rem; }
#buyersView .buyers-modern-heading span { color: var(--buyer-muted); font-size: .74rem; }
#buyersView .buyers-modern-heading > button { flex: 0 0 auto; }

#buyersView .buyer-summary-grid { display: grid; flex: 0 0 auto; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
#buyersView .buyer-summary-grid article { display: grid; height: 100%; align-content: start; gap: 2px; margin: 0; padding: 12px 15px; border-radius: 13px; }
#buyersView .buyer-summary-grid article.highlight { border-color: #bfd1c3; background: var(--buyer-soft); }
#buyersView .buyer-summary-grid span { color: var(--buyer-muted); font-size: .62rem; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
#buyersView .buyer-summary-grid strong { font-size: 1.25rem; }
#buyersView .buyer-summary-grid small { color: var(--buyer-muted); font-size: .63rem; }

#buyersView .buyer-filter-panel { flex: 0 0 auto; min-height: 0; margin: 0; padding: 13px 14px; overflow: visible; border-radius: 14px; }
#buyersView .buyer-filter-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
#buyersView .buyer-filter-head > div { display: flex; align-items: center; }
#buyersView .buyer-filter-head h3 { margin: 0; font-size: .9rem; }
#buyersView .buyer-filter-head span { margin-left: 7px; color: var(--buyer-muted); font-size: .67rem; }
#buyersView .buyer-filter-grid { display: grid; grid-template-columns: minmax(260px, 1.5fr) repeat(3, minmax(150px, .7fr)); gap: 9px; }
#buyersView .buyer-filter-grid label { display: grid; gap: 5px; }
#buyersView .buyer-filter-grid label > span { color: #56635a; font-size: .63rem; font-weight: 800; }
#buyersView .buyer-filter-grid input,
#buyersView .buyer-filter-grid select { width: 100%; min-height: 38px; padding: 7px 10px; border: 1px solid var(--buyer-line); border-radius: 8px; background: #fff; }
#buyersView .buyer-filter-grid input:focus,
#buyersView .buyer-filter-grid select:focus { outline: 2px solid #aac1af; border-color: #76927c; }

#buyersView .buyer-table-panel { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 300px; padding: 0; overflow: hidden; border-radius: 14px; }
#buyersView .buyer-table-scroll { flex: 1 1 auto; min-height: 0; max-height: none; overflow: auto; }
#buyersView .buyer-modern-table { width: 100%; min-width: 1050px; border-collapse: collapse; table-layout: fixed; }
#buyersView .buyer-modern-table th { height: 40px; padding: 8px 12px; border-bottom: 1px solid var(--buyer-line); color: #68746c; background: #f8faf9; font-size: .62rem; font-weight: 900; letter-spacing: .06em; text-align: left; text-transform: uppercase; }
#buyersView .buyer-modern-table th:nth-child(1) { width: 21%; }
#buyersView .buyer-modern-table th:nth-child(2) { width: 14%; }
#buyersView .buyer-modern-table th:nth-child(3) { width: 29%; }
#buyersView .buyer-modern-table th:nth-child(4) { width: 15%; }
#buyersView .buyer-modern-table th:nth-child(5) { width: 16%; }
#buyersView .buyer-modern-table th:last-child { width: 5%; }
#buyersView .buyer-modern-table td { height: 72px; max-height: 72px; padding: 9px 12px; overflow: hidden; border-bottom: 1px solid #e6ebe7; line-height: 1.35; vertical-align: middle; }
#buyersView .buyer-modern-table tbody tr { transition: background .15s ease; }
#buyersView .buyer-modern-table tbody tr:hover { background: #fbfdfb; }
#buyersView .buyer-person { display: flex; align-items: center; gap: 10px; min-width: 0; }
#buyersView .buyer-avatar { display: grid; width: 35px; height: 35px; flex: 0 0 35px; place-items: center; border-radius: 10px; color: var(--buyer-dark); background: var(--buyer-soft); font-size: .68rem; font-weight: 900; }
#buyersView .buyer-person-copy { min-width: 0; }
#buyersView .buyer-person strong,
#buyersView .buyer-person small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#buyersView .buyer-person strong { font-size: .76rem; }
#buyersView .buyer-person small { margin-top: 3px; color: var(--buyer-muted); font-size: .64rem; }
#buyersView .buyer-contact a { display: block; color: #25362a; font-size: .71rem; text-decoration: none; }
#buyersView .buyer-contact small { display: block; margin-top: 4px; color: var(--buyer-muted); font-size: .62rem; }
#buyersView .buyer-requirements { display: flex; flex-wrap: wrap; gap: 5px; max-height: 48px; overflow: hidden; }
#buyersView .requirement-chip,
.buyer-property-meta span { display: inline-flex; min-height: 22px; align-items: center; padding: 3px 7px; border-radius: 99px; color: #526158; background: #f0f3f1; font-size: .61rem; font-weight: 700; white-space: nowrap; }
#buyersView .buyer-requirements.incomplete { color: var(--buyer-muted); font-size: .67rem; }
#buyersView .buyer-quality { display: grid; gap: 6px; }
#buyersView .buyer-quality-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#buyersView .buyer-quality-line strong { font-size: .77rem; }
#buyersView .buyer-quality-line span { color: var(--buyer-muted); font-size: .61rem; }
#buyersView .buyer-quality-bar { height: 5px; overflow: hidden; border-radius: 99px; background: #e5ebe7; }
#buyersView .buyer-quality-bar i { display: block; height: 100%; border-radius: inherit; background: var(--buyer-green); }
#buyersView .buyer-quality.none { color: var(--buyer-muted); font-size: .67rem; }
#buyersView .buyer-match-summary { display: grid; gap: 3px; }
#buyersView .buyer-match-summary strong { font-size: .76rem; }
#buyersView .buyer-match-summary button { justify-self: start; padding: 0; border: 0; color: var(--buyer-green); background: transparent; font-size: .65rem; font-weight: 850; cursor: pointer; }
#buyersView .buyer-match-summary button:hover { text-decoration: underline; }
#buyersView .buyer-match-summary.none span { color: var(--buyer-muted); font-size: .67rem; }
#buyersView .buyer-row-actions { display: flex; justify-content: flex-end; }
#buyersView .buyer-row-actions button { width: 32px; height: 32px; }
#buyersView .buyer-table-footer { display: flex; flex: 0 0 auto; align-items: center; justify-content: center; gap: 9px; min-height: 48px; padding: 8px 13px; border-top: 1px solid var(--buyer-line); color: var(--buyer-muted); font-size: .66rem; }

.buyer-drawer-scrim { position: fixed; inset: 0; z-index: 200; border: 0; background: rgba(20, 31, 23, .36); backdrop-filter: blur(2px); }
.buyer-match-drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 210; display: grid; grid-template-rows: auto auto auto minmax(0, 1fr) auto; width: min(620px, calc(100vw - 24px)); transform: translateX(102%); border-left: 1px solid #dfe6e1; background: #fff; box-shadow: -22px 0 60px rgba(20, 35, 24, .2); transition: transform .22s ease; }
.buyer-match-drawer.open { transform: translateX(0); }
.buyer-drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; padding: 19px 20px; border-bottom: 1px solid #dfe6e1; }
.buyer-drawer-head p { margin: 0 0 3px; color: #436f4d; font-size: .64rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.buyer-drawer-head h3 { margin: 0 0 3px; font-size: 1.2rem; }
.buyer-drawer-head span { color: #707b73; font-size: .68rem; }
.buyer-drawer-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 13px 20px; border-bottom: 1px solid #dfe6e1; background: #fbfcfb; }
.buyer-drawer-summary > div { padding: 9px 10px; border-radius: 9px; background: #fff; }
.buyer-drawer-summary span,
.buyer-drawer-summary strong { display: block; }
.buyer-drawer-summary span { color: #707b73; font-size: .61rem; }
.buyer-drawer-summary strong { margin-top: 3px; font-size: .72rem; }
.buyer-drawer-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 10px; padding: 12px 20px; border-bottom: 1px solid #dfe6e1; }
.buyer-drawer-toolbar label { display: grid; gap: 4px; min-width: 190px; }
.buyer-drawer-toolbar label span { color: #707b73; font-size: .62rem; font-weight: 800; }
.buyer-drawer-toolbar select { min-height: 38px; padding: 7px 9px; border: 1px solid #dfe6e1; border-radius: 8px; background: #fff; }
.buyer-property-list { overflow: auto; padding: 13px 20px; }
.buyer-property-match-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; margin-bottom: 9px; padding: 13px; border: 1px solid #dfe6e1; border-radius: 11px; background: #fff; }
.buyer-property-match-card:hover { border-color: #bfd0c2; background: #fbfdfb; }
.buyer-property-match-title { display: flex; align-items: center; gap: 8px; }
.buyer-property-match-title strong { font-size: .8rem; }
.buyer-property-match-title span { display: inline-flex; min-height: 23px; align-items: center; padding: 3px 7px; border-radius: 99px; color: #294c33; background: #edf4ef; font-size: .62rem; font-weight: 850; }
.buyer-property-match-card p { margin: 6px 0; color: #707b73; font-size: .68rem; }
.buyer-property-meta { display: flex; flex-wrap: wrap; gap: 5px; }
.buyer-property-price { text-align: right; }
.buyer-property-price strong,
.buyer-property-price small { display: block; }
.buyer-property-price strong { font-size: .82rem; }
.buyer-property-price small { margin: 4px 0 8px; color: #707b73; font-size: .62rem; }
.buyer-drawer-empty { padding: 36px 12px; color: #707b73; text-align: center; }
.buyer-drawer-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 13px 20px; border-top: 1px solid #dfe6e1; background: #fff; }
body.buyer-drawer-open { overflow: hidden; }

.buyer-create-dialog {
  width: min(860px, calc(100vw - 28px));
  max-height: min(860px, calc(100dvh - 28px));
  overflow: hidden;
  border: 1px solid #dfe6e1;
  border-radius: 18px;
}

.buyer-create-form {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-height: min(860px, calc(100dvh - 28px));
  padding: 0;
}

.buyer-create-head {
  align-items: flex-start;
  margin: 0;
  padding: 20px 22px 18px;
  border-bottom: 1px solid #dfe6e1;
  background: linear-gradient(135deg, #fbfdfb 0%, #eef5ef 100%);
}

.buyer-create-head > div { min-width: 0; }
.buyer-create-head p { margin: 0; color: #436f4d; font-size: .65rem; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; }
.buyer-create-head h3 { margin: 4px 0 4px; font-size: 1.35rem; }
.buyer-create-head span { display: block; color: #707b73; font-size: .76rem; line-height: 1.45; }
.buyer-create-head .icon-btn { flex: 0 0 auto; }

.buyer-create-body {
  display: grid;
  gap: 14px;
  min-height: 0;
  padding: 16px 22px;
  overflow: auto;
  background: #f7f9f7;
}

.buyer-create-section {
  padding: 16px;
  border: 1px solid #dfe6e1;
  border-radius: 14px;
  background: #fff;
}

.buyer-create-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.buyer-create-section-head > div { display: flex; align-items: center; gap: 10px; min-width: 0; }
.buyer-create-section-head > div > span { display: inline-flex; width: 28px; height: 28px; flex: 0 0 28px; align-items: center; justify-content: center; border-radius: 9px; background: #eaf2eb; color: #365d3e; font-size: .72rem; font-weight: 900; }
.buyer-create-section-head h4 { margin: 0 0 2px; font-size: .88rem; }
.buyer-create-section-head p,
.buyer-create-section-head small { margin: 0; color: #707b73; font-size: .66rem; line-height: 1.4; }
.buyer-create-section-head > small { text-align: right; }

.buyer-create-grid label { gap: 6px; }
.buyer-create-grid label > span:first-child { color: #566158; font-size: .68rem; font-weight: 800; }
.buyer-create-grid input,
.buyer-create-grid select,
.buyer-create-grid textarea { min-height: 42px; border-color: #d9e1dc; border-radius: 10px; background: #fcfdfc; }
.buyer-create-grid textarea { min-height: 78px; resize: vertical; }

.buyer-create-grid .buyer-pool-requirement {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 9px;
  padding: 8px 11px;
  border: 1px solid #d9e1dc;
  border-radius: 10px;
  background: #fcfdfc;
}

.buyer-create-grid .buyer-pool-requirement input { width: 18px; min-height: 18px; flex: 0 0 18px; }
.buyer-create-grid .buyer-pool-requirement > span { display: grid; gap: 1px; }
.buyer-create-grid .buyer-pool-requirement strong { color: #253029; font-size: .7rem; }
.buyer-create-grid .buyer-pool-requirement small { color: #707b73; font-size: .61rem; font-weight: 500; }

.buyer-create-actions {
  min-height: 66px;
  align-items: center;
  margin: 0;
  padding: 12px 22px;
  border-top: 1px solid #dfe6e1;
  background: #fff;
}

.buyer-create-actions button { min-width: 118px; }

@media (max-width: 1150px) {
  #buyersView.active { overflow: auto; }
  #buyersView .buyer-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #buyersView .buyer-filter-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  #buyersView .buyer-table-panel { flex: 0 0 auto; min-height: 440px; }
}

@media (max-width: 700px) {
  #buyersView { padding: 76px 12px 24px; }
  #buyersView .buyers-modern-heading { align-items: flex-start; flex-direction: column; }
  #buyersView .buyers-modern-heading button { width: 100%; }
  #buyersView .buyer-filter-grid { grid-template-columns: minmax(0, 1fr); }
  #buyersView .buyer-table-footer { align-items: stretch; flex-direction: column; }
  .buyer-drawer-summary { grid-template-columns: minmax(0, 1fr); }
  .buyer-drawer-toolbar { align-items: stretch; flex-direction: column; }
  .buyer-drawer-toolbar label { min-width: 0; }
  .buyer-property-match-card { grid-template-columns: minmax(0, 1fr); }
  .buyer-property-price { text-align: left; }
  .buyer-drawer-footer button { flex: 1; }
  .buyer-create-dialog,
  .buyer-create-form { max-height: calc(100dvh - 16px); }
  .buyer-create-head,
  .buyer-create-body,
  .buyer-create-actions { padding-left: 14px; padding-right: 14px; }
  .buyer-create-section { padding: 13px; }
  .buyer-create-section-head { align-items: flex-start; flex-direction: column; gap: 7px; }
  .buyer-create-section-head > small { padding-left: 38px; text-align: left; }
  .buyer-create-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .buyer-create-actions button { min-width: 0; }
}

@media (max-width: 430px) {
  #buyersView .buyer-summary-grid { grid-template-columns: minmax(0, 1fr); }
  .buyer-match-drawer { width: 100vw; }
  .buyer-drawer-head,
  .buyer-drawer-summary,
  .buyer-drawer-toolbar,
  .buyer-property-list,
  .buyer-drawer-footer { padding-inline: 14px; }
}

/* Approved Today + Dashboard workspace (2026-08-30). */
#dashboardView.dashboard-focus-preview,
#todayView.today-focus-preview {
  --ap-soft: #f8faf8;
  --ap-green: #436f4d;
  --ap-green-dark: #294c33;
  --ap-green-soft: #edf4ef;
  --ap-red: #a44d42;
  --ap-red-soft: #f9ebe9;
  --ap-blue: #416b9a;
  --ap-blue-soft: #edf3fa;
  --ap-amber: #a76720;
  --ap-amber-soft: #fff4e4;
  padding: clamp(16px, 1.45vw, 28px);
  color: var(--modern-ink);
}
#dashboardView .ap-page-intro,
#todayView .ap-page-intro { display:flex; align-items:flex-end; justify-content:space-between; gap:20px; margin-bottom:14px; }
#dashboardView .ap-eyebrow,
#todayView .ap-eyebrow { margin:0 0 4px; color:var(--ap-green); font-size:.63rem; font-weight:900; letter-spacing:.1em; text-transform:uppercase; }
#dashboardView .ap-page-intro h2,
#todayView .ap-page-intro h2 { margin:0 0 4px; font-size:clamp(1.65rem,2.25vw,2.25rem); letter-spacing:-.035em; }
#dashboardView .ap-page-intro > div > span,
#todayView .ap-page-intro > div > span { color:var(--modern-muted); font-size:.76rem; }
#dashboardView .ap-page-actions,
#todayView .ap-page-actions { display:flex; align-items:center; gap:8px; }
#dashboardView .ap-live-pill { display:inline-flex; min-height:34px; align-items:center; padding:0 11px; border-radius:99px; color:var(--ap-green-dark); background:var(--ap-green-soft); font-size:.62rem; font-weight:850; }
#dashboardView .ap-card,
#todayView .ap-card,
#dashboardView .ap-metric-card,
#dashboardView .ap-focus-ribbon,
#todayView .ap-day-progress-card,
#todayView .ap-today-metrics article { min-width:0; border:1px solid var(--modern-line); border-radius:14px; background:#fff; box-shadow:0 10px 28px rgba(32,50,39,.055); }
#dashboardView .ap-card,
#todayView .ap-card { overflow:hidden; }
#dashboardView .ap-card-head,
#todayView .ap-card-head { display:flex; min-height:70px; align-items:center; justify-content:space-between; gap:16px; padding:13px 16px; border-bottom:1px solid var(--modern-line); }
#dashboardView .ap-card-head h3,
#todayView .ap-card-head h3 { margin:1px 0 2px; font-size:.95rem; }
#dashboardView .ap-card-head > div > span,
#todayView .ap-card-head > div > span { color:var(--modern-muted); font-size:.65rem; }
#dashboardView .ap-section-kicker,
#todayView .ap-section-kicker { margin:0; color:var(--ap-green); font-size:.57rem; font-weight:900; letter-spacing:.09em; text-transform:uppercase; }

#dashboardView .ap-focus-ribbon { display:flex; align-items:center; justify-content:space-between; gap:18px; margin-bottom:11px; padding:12px 14px; border-color:#cbdacf; background:var(--ap-green-soft); }
#dashboardView .ap-focus-copy { display:flex; min-width:0; align-items:center; gap:11px; }
#dashboardView .ap-focus-icon,
#todayView .ap-focus-icon { display:grid; width:34px; height:34px; flex:0 0 34px; place-items:center; border-radius:10px; color:#fff; background:var(--ap-green); font-weight:900; }
#dashboardView .ap-focus-copy p,
#todayView .ap-day-progress-copy p { margin:0 0 2px; color:var(--ap-green); font-size:.59rem; font-weight:900; letter-spacing:.08em; text-transform:uppercase; }
#dashboardView .ap-focus-copy strong,
#dashboardView .ap-focus-copy small { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
#dashboardView .ap-focus-copy strong { font-size:.78rem; }
#dashboardView .ap-focus-copy small { margin-top:3px; color:var(--modern-muted); font-size:.63rem; }
#dashboardView .ap-focus-actions { display:flex; flex:0 0 auto; gap:7px; }

#dashboardView .ap-metric-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; margin-bottom:11px; }
#dashboardView .ap-metric-card { position:relative; display:grid; min-height:104px; grid-template-columns:minmax(0,1fr) auto; grid-template-rows:auto 1fr; gap:4px 12px; padding:13px 14px; overflow:hidden; }
#dashboardView .ap-metric-card > div:first-child span,
#dashboardView .ap-metric-card > div:first-child small { display:block; }
#dashboardView .ap-metric-card > div:first-child span { font-size:.67rem; font-weight:850; }
#dashboardView .ap-metric-card > div:first-child small { margin-top:3px; color:var(--modern-muted); font-size:.57rem; }
#dashboardView .ap-metric-card > strong { align-self:end; font-size:1.6rem; letter-spacing:-.035em; }
#dashboardView .ap-metric-card.accent { border-color:#bed1c2; background:var(--ap-green-soft); }
#dashboardView .ap-mini-bars { display:flex; width:82px; height:47px; align-self:end; align-items:end; justify-content:flex-end; gap:4px; }
#dashboardView .ap-mini-bars i { width:8px; border-radius:4px 4px 2px 2px; background:#dbe5dd; }
#dashboardView .ap-mini-bars i.active { background:var(--ap-green); }
#dashboardView .ap-ring { --value:0; position:relative; display:grid; width:46px; height:46px; align-self:end; place-items:center; border-radius:50%; background:conic-gradient(var(--ap-green) calc(var(--value) * 1%), #e5ebe7 0); }
#dashboardView .ap-ring::before { position:absolute; width:34px; height:34px; border-radius:50%; background:#fff; content:""; }
#dashboardView .ap-ring b { z-index:1; font-size:.6rem; }
#dashboardView .ap-metric-dots { display:flex; align-self:end; gap:4px; }
#dashboardView .ap-metric-dots i { width:8px; height:8px; border-radius:50%; background:var(--ap-green); }
#dashboardView .ap-metric-dots i:nth-child(n+4) { background:#dfe6e1; }
#dashboardView .ap-pipeline-mini { display:grid; width:90px; align-self:end; gap:5px; }
#dashboardView .ap-pipeline-mini span { display:block; height:6px; border-radius:99px; background:var(--ap-green); }

#dashboardView .ap-dashboard-grid { display:grid; grid-template-columns:minmax(0,1.5fr) minmax(330px,.7fr); gap:11px; }
#dashboardView .ap-priorities-card,
#dashboardView .ap-schedule-card { min-height:330px; }
#dashboardView .ap-performance-card,
#dashboardView .ap-momentum-card { min-height:255px; }
#dashboardView .ap-priority-list { padding:4px 0; }
#dashboardView .ap-priority-row { display:grid; width:100%; grid-template-columns:50px minmax(0,1fr) 104px 16px; gap:10px; align-items:center; min-height:62px; padding:8px 14px; border:0; border-bottom:1px solid #edf0ee; color:var(--modern-ink); background:#fff; text-align:left; }
#dashboardView .ap-priority-row:hover,
#dashboardView .ap-priority-row.active { background:#f8fbf9; }
#dashboardView .ap-priority-row.active { box-shadow:inset 3px 0 var(--ap-green); }
#dashboardView .ap-priority-time { display:inline-flex; min-height:25px; align-items:center; justify-content:center; border-radius:8px; color:#59655d; background:#f1f4f2; font-size:.63rem; font-weight:850; }
#dashboardView .ap-priority-time.overdue { color:var(--ap-red); background:var(--ap-red-soft); }
#dashboardView .ap-priority-person strong,
#dashboardView .ap-priority-person small,
#dashboardView .ap-priority-meta b,
#dashboardView .ap-priority-meta small { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
#dashboardView .ap-priority-person strong { font-size:.73rem; }
#dashboardView .ap-priority-person small { margin-top:4px; color:var(--modern-muted); font-size:.62rem; }
#dashboardView .ap-priority-meta { text-align:right; }
#dashboardView .ap-priority-meta b { font-size:.62rem; }
#dashboardView .ap-priority-meta small { margin-top:3px; color:var(--modern-muted); font-size:.57rem; }
#dashboardView .ap-row-arrow { color:#8c978f; font-size:1rem; }
#dashboardView .ap-icon-button { display:grid; width:36px; min-height:36px; padding:0; place-items:center; border:1px solid var(--modern-line); border-radius:9px; color:var(--ap-green-dark); background:#fff; }
#dashboardView .ap-schedule-line { padding:11px 15px 4px; }
#dashboardView .ap-schedule-item { display:grid; grid-template-columns:47px 12px minmax(0,1fr); gap:8px; min-height:62px; }
#dashboardView .ap-schedule-item time { padding-top:4px; color:#556159; font-size:.65rem; font-weight:800; }
#dashboardView .ap-schedule-item i { position:relative; width:2px; justify-self:center; background:#dfe6e1; }
#dashboardView .ap-schedule-item i::before { position:absolute; top:5px; left:-4px; width:10px; height:10px; border:2px solid #fff; border-radius:50%; background:var(--ap-green); box-shadow:0 0 0 1px #c8d5cb; content:""; }
#dashboardView .ap-schedule-item strong,
#dashboardView .ap-schedule-item span { display:block; }
#dashboardView .ap-schedule-item strong { padding-top:2px; font-size:.7rem; }
#dashboardView .ap-schedule-item span { margin-top:4px; color:var(--modern-muted); font-size:.6rem; }
#dashboardView .ap-full-link { display:block; width:calc(100% - 30px); min-height:37px; margin:0 15px 13px; padding:7px 10px; border:1px solid var(--modern-line); border-radius:9px; color:var(--ap-green-dark); background:var(--ap-soft); font-weight:800; }
#dashboardView .ap-live-chart { display:flex; min-height:180px; align-items:end; gap:clamp(8px,2vw,24px); padding:16px 20px 12px; }
#dashboardView .modern-activity-day { display:grid; min-width:0; flex:1; grid-template-rows:145px auto; gap:6px; justify-items:center; }
#dashboardView .modern-activity-bars { display:flex; width:100%; height:145px; align-items:end; justify-content:center; gap:5px; border-bottom:1px solid #e8ece9; }
#dashboardView .modern-activity-bar { display:block; width:min(18px,34%); border-radius:5px 5px 2px 2px; background:var(--ap-green); }
#dashboardView .modern-activity-bar.answers { background:#b8cbbb; }
#dashboardView .modern-activity-day small { color:var(--modern-muted); font-size:.58rem; }
#dashboardView .ap-legend { display:flex; gap:10px; }
#dashboardView .ap-legend span { color:var(--modern-muted); font-size:.58rem; }
#dashboardView .ap-legend i { display:inline-block; width:8px; height:8px; margin-right:4px; border-radius:50%; background:var(--ap-green); }
#dashboardView .ap-legend i.answers { background:#b8cbbb; }
#dashboardView .ap-stage-list { display:grid; gap:11px; padding:14px 16px; }
#dashboardView .ap-stage-list > div { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:5px 10px; }
#dashboardView .ap-stage-list span,
#dashboardView .ap-stage-list strong { font-size:.65rem; }
#dashboardView .ap-stage-list span b { display:inline-grid; width:20px; height:20px; margin-right:6px; place-items:center; border-radius:7px; color:var(--ap-green-dark); background:var(--ap-green-soft); font-size:.58rem; }
#dashboardView .ap-stage-list i { grid-column:1/-1; height:5px; overflow:hidden; border-radius:99px; background:#e8ece9; }
#dashboardView .ap-stage-list em { display:block; height:100%; border-radius:inherit; background:var(--ap-green); }
#dashboardView .ap-dashboard-legacy,
#todayView .ap-today-legacy { display:none !important; }
#dashboardView .ap-team-card { margin-top:11px; }

#todayView .ap-day-progress-card { display:grid; grid-template-columns:auto minmax(260px,1fr) auto; gap:22px; align-items:center; margin-bottom:10px; padding:13px 15px; }
#todayView .ap-day-progress-copy { display:flex; align-items:center; gap:10px; }
#todayView .ap-day-progress-copy strong { font-size:.76rem; }
#todayView .ap-day-progress-copy strong b { font-size:1.05rem; }
#todayView .ap-progress-block { min-width:0; }
#todayView .ap-progress-block > div { display:flex; justify-content:space-between; margin-bottom:6px; font-size:.61rem; }
#todayView .ap-progress-block span { font-weight:800; }
#todayView .ap-progress-block small { color:var(--modern-muted); }
#todayView .ap-progress-block > i { display:block; height:7px; overflow:hidden; border-radius:99px; background:#e7ece8; }
#todayView .ap-progress-block em { display:block; height:100%; border-radius:inherit; background:var(--ap-green); transition:width .2s; }
#todayView .ap-day-progress-actions { display:flex; gap:7px; }
#todayView .ap-today-metrics { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; margin-bottom:10px; }
#todayView .ap-today-metrics article { padding:12px 14px; box-shadow:none; }
#todayView .ap-today-metrics span,
#todayView .ap-today-metrics strong,
#todayView .ap-today-metrics small { display:block; }
#todayView .ap-today-metrics span { color:var(--modern-muted); font-size:.61rem; font-weight:800; }
#todayView .ap-today-metrics strong { margin:5px 0 2px; font-size:1.35rem; }
#todayView .ap-today-metrics small { color:var(--modern-muted); font-size:.58rem; }
#todayView .ap-today-primary-grid { display:grid; grid-template-columns:minmax(0,1.55fr) minmax(340px,.65fr); gap:10px; margin-bottom:10px; }
#todayView .ap-agenda-filter { display:flex; gap:3px; padding:3px; border-radius:9px; background:#f0f3f1; }
#todayView .ap-agenda-filter button { min-height:28px; padding:4px 8px; border:0; border-radius:7px; color:var(--modern-muted); background:transparent; font-size:.6rem; font-weight:800; }
#todayView .ap-agenda-filter button.active { color:var(--ap-green-dark); background:#fff; box-shadow:0 2px 7px rgba(32,50,39,.08); }
#todayView .ap-agenda-list { max-height:414px; overflow-y:auto; }
#todayView .ap-agenda-item { display:grid; grid-template-columns:46px 31px minmax(0,1fr) auto; gap:9px; align-items:center; min-height:75px; padding:8px 14px; border-bottom:1px solid #edf0ee; }
#todayView .ap-agenda-item.urgent { background:#fffaf9; }
#todayView .ap-agenda-item[hidden] { display:none; }
#todayView .ap-agenda-item.pulse { animation:apTodayPulse .9s ease; }
@keyframes apTodayPulse { 0%,100% { box-shadow:none; } 45% { box-shadow:inset 0 0 0 2px #8eb49a; background:#edf4ef; } }
#todayView .ap-agenda-item time { color:#5e6a62; font-size:.62rem; font-weight:850; }
#todayView .ap-agenda-marker { display:grid; width:29px; height:29px; place-items:center; border-radius:9px; color:var(--ap-green-dark); background:var(--ap-green-soft); font-size:.65rem; }
#todayView .ap-agenda-marker.appointment { color:var(--ap-blue); background:var(--ap-blue-soft); }
#todayView .ap-agenda-copy > div { display:flex; align-items:center; gap:6px; }
#todayView .ap-agenda-copy strong { font-size:.72rem; }
#todayView .ap-agenda-copy p { margin:3px 0; font-size:.64rem; }
#todayView .ap-agenda-copy small { display:block; overflow:hidden; color:var(--modern-muted); font-size:.58rem; text-overflow:ellipsis; white-space:nowrap; }
#todayView .ap-status { padding:3px 6px; border-radius:99px; font-size:.52rem; font-weight:850; }
#todayView .ap-status.danger { color:var(--ap-red); background:var(--ap-red-soft); }
#todayView .ap-status.info { color:var(--ap-blue); background:var(--ap-blue-soft); }
#todayView .ap-status.neutral { color:#5f6c63; background:#edf1ee; }
#todayView .ap-agenda-actions { display:flex; gap:5px; }
#todayView .ap-agenda-actions a,
#todayView .ap-agenda-actions button { display:inline-flex; min-height:31px; align-items:center; justify-content:center; padding:5px 9px; font-size:.6rem; text-decoration:none; }
#todayView .ap-next-action-card { align-self:start; }
#todayView .ap-priority-badge { padding:5px 8px; border-radius:99px; color:var(--ap-red); background:var(--ap-red-soft); font-size:.56rem; font-weight:850; }
#todayView .ap-next-person { display:flex; align-items:center; gap:10px; padding:14px 15px 9px; }
#todayView .ap-large-avatar { display:grid; width:42px; height:42px; place-items:center; border-radius:12px; color:var(--ap-green-dark); background:var(--ap-green-soft); font-size:.74rem; font-weight:900; }
#todayView .ap-next-person strong,
#todayView .ap-next-person span { display:block; }
#todayView .ap-next-person strong { font-size:.83rem; }
#todayView .ap-next-person span { margin-top:3px; color:var(--modern-muted); font-size:.61rem; }
#todayView .ap-contact-buttons { display:grid; grid-template-columns:1fr 1fr; gap:6px; padding:0 15px 10px; }
#todayView .ap-contact-buttons a,
#todayView .ap-contact-buttons span { display:flex; min-height:37px; align-items:center; justify-content:center; border-radius:9px; font-size:.64rem; text-align:center; text-decoration:none; }
#todayView .ap-action-note { margin:0 15px 10px; padding:11px 12px; border-radius:10px; background:var(--ap-green-soft); }
#todayView .ap-action-note span { color:var(--ap-green); font-size:.55rem; font-weight:900; text-transform:uppercase; }
#todayView .ap-action-note strong { display:block; margin-top:4px; font-size:.68rem; }
#todayView .ap-action-note p { margin:6px 0 0; color:#526158; font-size:.59rem; line-height:1.45; }
#todayView .ap-quick-facts { display:grid; grid-template-columns:1fr 1fr; gap:6px; margin:0; padding:0 15px 10px; }
#todayView .ap-quick-facts div { padding:8px 9px; border-radius:8px; background:var(--ap-soft); }
#todayView .ap-quick-facts dt { color:var(--modern-muted); font-size:.54rem; }
#todayView .ap-quick-facts dd { margin:3px 0 0; font-size:.62rem; font-weight:800; }
#todayView .ap-next-actions { display:grid; grid-template-columns:1fr 1fr; gap:6px; padding:0 15px 14px; }
#todayView .ap-next-actions button { font-size:.62rem; }
#todayView .ap-focus-empty { padding:28px 18px; text-align:center; }
#todayView .ap-focus-empty strong { font-size:1rem; }
#todayView .ap-focus-empty p { color:var(--modern-muted); font-size:.7rem; }
#todayView .ap-attention-card { overflow:hidden; }
#todayView .ap-attention-head { display:flex; align-items:flex-end; justify-content:space-between; gap:15px; padding:12px 15px 8px; border-bottom:1px solid var(--modern-line); }
#todayView .ap-attention-head h3 { margin:2px 0 0; font-size:.9rem; }
#todayView .ap-attention-tabs { display:flex; gap:3px; }
#todayView .ap-attention-tabs button { min-height:31px; padding:5px 9px; border:0; border-radius:8px; color:var(--modern-muted); background:transparent; font-size:.59rem; font-weight:800; }
#todayView .ap-attention-tabs button.active { color:var(--ap-green-dark); background:var(--ap-green-soft); }
#todayView .ap-attention-list { display:none; }
#todayView .ap-attention-list.active { display:block; }
#todayView .ap-attention-list article { display:grid; grid-template-columns:70px minmax(0,1fr) 130px 58px; gap:10px; align-items:center; min-height:54px; padding:7px 15px; border-bottom:1px solid #edf0ee; }
#todayView .ap-attention-type { display:inline-flex; min-height:24px; align-items:center; justify-content:center; border-radius:8px; font-size:.56rem; font-weight:850; }
#todayView .ap-attention-type.danger { color:var(--ap-red); background:var(--ap-red-soft); }
#todayView .ap-attention-type.warning { color:var(--ap-amber); background:var(--ap-amber-soft); }
#todayView .ap-attention-type.info { color:var(--ap-blue); background:var(--ap-blue-soft); }
#todayView .ap-attention-list strong,
#todayView .ap-attention-list small { display:block; }
#todayView .ap-attention-list strong { font-size:.68rem; }
#todayView .ap-attention-list small { margin-top:3px; color:var(--modern-muted); font-size:.59rem; }
#todayView .ap-attention-list article > b { color:#606c64; font-size:.6rem; text-align:right; }

@media (min-width:1900px) {
  #dashboardView.dashboard-focus-preview,
  #todayView.today-focus-preview { padding-inline:34px; }
  #dashboardView .ap-dashboard-grid { grid-template-columns:minmax(0,1.65fr) minmax(380px,.6fr); }
  #todayView .ap-today-primary-grid { grid-template-columns:minmax(0,1.7fr) minmax(390px,.58fr); }
}
@media (max-width:1180px) {
  #dashboardView .ap-metric-grid,
  #todayView .ap-today-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); }
  #dashboardView .ap-dashboard-grid,
  #todayView .ap-today-primary-grid { grid-template-columns:minmax(0,1fr); }
  #todayView .ap-day-progress-card { grid-template-columns:auto minmax(0,1fr); }
  #todayView .ap-day-progress-actions { grid-column:1/-1; justify-content:flex-end; }
}
@media (max-width:720px) {
  #dashboardView.dashboard-focus-preview,
  #todayView.today-focus-preview { padding:76px 10px 24px; }
  #dashboardView .ap-page-intro,
  #todayView .ap-page-intro { align-items:flex-start; flex-direction:column; }
  #dashboardView .ap-page-actions,
  #todayView .ap-page-actions { width:100%; }
  #dashboardView .ap-page-actions > *,
  #todayView .ap-page-actions > * { flex:1; }
  #dashboardView .ap-focus-ribbon { align-items:stretch; flex-direction:column; }
  #dashboardView .ap-focus-actions button { flex:1; }
  #dashboardView .ap-metric-grid,
  #todayView .ap-today-metrics { grid-template-columns:minmax(0,1fr); }
  #dashboardView .ap-priority-row { grid-template-columns:44px minmax(0,1fr) 15px; }
  #dashboardView .ap-priority-meta { display:none; }
  #dashboardView .ap-card-head,
  #todayView .ap-card-head { align-items:flex-start; }
  #dashboardView .ap-legend { display:none; }
  #todayView .ap-day-progress-card { grid-template-columns:minmax(0,1fr); }
  #todayView .ap-progress-block,
  #todayView .ap-day-progress-actions { grid-column:auto; }
  #todayView .ap-day-progress-actions button { flex:1; }
  #todayView .ap-agenda-item { grid-template-columns:40px 28px minmax(0,1fr); }
  #todayView .ap-agenda-actions { grid-column:2/-1; }
  #todayView .ap-attention-head { align-items:stretch; flex-direction:column; }
  #todayView .ap-attention-tabs { overflow-x:auto; }
  #todayView .ap-attention-tabs button { flex:0 0 auto; }
  #todayView .ap-attention-list article { grid-template-columns:65px minmax(0,1fr) 55px; }
  #todayView .ap-attention-list article > b { display:none; }
}

/* Consistent desktop page gutter: match the approved Buyers workspace. */
@media (min-width:821px) {
  .view { padding:18px 22px 22px; }
  #dashboardView.dashboard-focus-preview,
  #todayView.today-focus-preview { padding:18px 22px 22px; }
}

/* Side-by-side workspace panels must share the same top edge. */
#leadsView .lead-layout > .panel + .panel { margin-top:0; }

/* Calendar workspace: compact controls and a month grid that fits the viewport. */
#calendarView .calendar-panel {
  gap:8px;
  padding:12px 14px 14px;
}
#calendarView .calendar-toolbar { flex:0 0 auto; }
#calendarView .calendar-range-row {
  display:flex;
  flex:0 0 auto;
  align-items:center;
  gap:12px;
  min-width:0;
}
#calendarView .calendar-filter-toggles {
  flex:1 1 auto;
  min-width:0;
}
#calendarView .calendar-date-actions {
  flex:0 0 auto;
  margin-left:auto;
}
#calendarView .calendar-sync-strip { flex:0 0 auto; }
#calendarView .calendar-sync-strip:empty { display:none; }
#calendarView .calendar-month-grid {
  height:100%;
  min-height:0;
  grid-template-rows:auto repeat(var(--calendar-week-count, 6), minmax(0, 1fr));
}
#calendarView .calendar-month-day {
  min-height:0;
  overflow:hidden;
  padding:clamp(5px, .55vh, 8px);
}
#calendarView .calendar-event-stack { overflow:hidden; }
#calendarView .calendar-month-day.has-overflow { position:relative; }
#calendarView .calendar-month-day.has-overflow .calendar-event-stack {
  padding-bottom:30px;
}
#calendarView .calendar-month-day.has-overflow .calendar-event-more {
  position:absolute;
  z-index:2;
  right:clamp(5px, .55vh, 8px);
  bottom:clamp(5px, .55vh, 8px);
  left:clamp(5px, .55vh, 8px);
  width:auto;
  box-shadow:0 -5px 12px rgba(255,255,255,.92);
}

@media (max-width:1100px) {
  #calendarView .calendar-range-row { align-items:stretch; flex-direction:column; }
  #calendarView .calendar-date-actions { width:100%; margin-left:0; }
  #calendarView .calendar-range-label { flex:1; min-width:0; }
}

/* Dashboard columns share one vertical grid line from metrics through details. */
@media (min-width:1181px) {
  #dashboardView .ap-dashboard-grid {
    grid-template-columns:repeat(4, minmax(0, 1fr));
    gap:10px;
  }
  #dashboardView .ap-priorities-card,
  #dashboardView .ap-performance-card { grid-column:1 / span 3; }
  #dashboardView .ap-schedule-card,
  #dashboardView .ap-momentum-card { grid-column:4; }
}

/* Keep every dashboard metric on the same vertical rhythm. */
#dashboardView .ap-metric-card > div:first-child {
  grid-column:1 / -1;
  grid-row:1;
}
#dashboardView .ap-metric-card > strong {
  grid-column:1;
  grid-row:2;
  align-self:end;
}
#dashboardView .ap-metric-card > .ap-mini-bars,
#dashboardView .ap-metric-card > .ap-ring,
#dashboardView .ap-metric-card > .ap-metric-dots,
#dashboardView .ap-metric-card > .ap-pipeline-mini {
  grid-column:2;
  grid-row:2;
  align-self:end;
  justify-self:end;
}
#dashboardView .ap-schedule-line > .empty-state {
  display:grid;
  min-height:0;
  justify-items:start;
  padding:14px 0;
  background:transparent;
  text-align:left;
}

/* Today metrics and working panels share the same four-column tracks. */
@media (min-width:1181px) {
  #todayView .ap-today-primary-grid {
    grid-template-columns:repeat(4, minmax(0, 1fr));
    gap:10px;
  }
  #todayView .ap-agenda-card { grid-column:1 / span 3; }
  #todayView .ap-next-action-card { grid-column:4; }
}

/* Import/export cards are grid siblings, not vertically stacked panels. */
#exportsView .import-grid > .panel + .panel { margin-top:0; }

/* Compact month cells expose their full day through an accessible dialog. */
#calendarView .calendar-event-more {
  width:100%;
  min-height:24px;
  padding:4px 7px;
  border:1px solid #d9e2dc;
  border-radius:7px;
  color:#315f3f;
  background:#f3f7f4;
  font:inherit;
  font-size:.62rem;
  font-weight:850;
  text-align:left;
  cursor:pointer;
}
#calendarView .calendar-event-more:hover { border-color:#aac0b0; background:#eaf2ec; }
.calendar-day-dialog { width:min(680px, calc(100vw - 30px)); }
.calendar-day-dialog .dialog-form { display:flex; max-height:min(78dvh, 760px); flex-direction:column; }
.calendar-day-event-list {
  display:grid;
  gap:8px;
  min-height:0;
  overflow-y:auto;
  padding:2px;
}
.calendar-day-event-list .calendar-event-card { width:100%; }

/* Call outcomes and manager retry rules — production version of the approved preview. */
#leadsView .call-management-banner {
  min-height:72px;
  margin-bottom:0;
  padding:10px 14px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  border:1px solid #d4dfd7;
  border-radius:14px;
  background:linear-gradient(120deg,#f8fbf9 0%,#edf5f0 100%);
  box-shadow:0 12px 30px rgba(33,55,40,.06);
}
#leadsView .call-management-banner h2 { margin:2px 0 0; color:#17231b; font-size:clamp(1.05rem,1.45vw,1.45rem); letter-spacing:-.03em; }
#leadsView .call-management-banner p { margin:3px 0 0; color:#748078; font-size:.7rem; }
.call-management-eyebrow { color:#456d4e; font-size:.58rem; font-weight:900; letter-spacing:.1em; }
.call-management-mode-switch { display:flex; flex:0 0 auto; padding:3px; border:1px solid #cad7ce; border-radius:11px; background:rgba(255,255,255,.76); }
.call-management-mode-switch button { min-height:34px; padding:6px 11px; border:0; border-radius:8px; color:#667269; background:transparent; font:inherit; font-size:.7rem; font-weight:850; cursor:pointer; }
.call-management-mode-switch button.active { color:#fff; background:#426d4d; box-shadow:0 5px 14px rgba(50,84,59,.18); }
#callWorkspaceCallerMode[hidden], #callWorkspaceManagerMode[hidden] { display:none !important; }

.call-outcome-specific { border-bottom:1px solid #dfe6e1; }
.call-outcome-step-heading { display:flex; align-items:center; justify-content:space-between; gap:14px; margin-bottom:14px; }
.call-outcome-step-heading > div { display:flex; align-items:center; gap:11px; }
.call-outcome-step-heading > div > span:last-child { display:flex; flex-direction:column; }
.call-outcome-step-heading strong { color:#17231b; font-size:.98rem; }
.call-outcome-step-heading small { margin-top:3px; color:#7a857d; font-size:.72rem; }
.call-outcome-step-heading > em { padding:6px 10px; border-radius:999px; color:#355e3f; background:#eaf1ec; font-size:.68rem; font-style:normal; font-weight:900; }
.call-outcome-step { width:34px; height:34px; display:inline-flex; align-items:center; justify-content:center; border-radius:10px; color:#355e3f; background:#eaf1ec; font-size:.76rem; font-weight:900; }
.call-outcome-dynamic-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.call-outcome-dynamic-grid > label { display:flex; min-width:0; flex-direction:column; gap:6px; color:#526057; font-size:.72rem; font-weight:850; }
.call-outcome-dynamic-grid > label.full, .call-outcome-dynamic-grid > .full { grid-column:1/-1; }
.call-outcome-dynamic-grid select,
.call-outcome-dynamic-grid input[type="date"],
.call-outcome-dynamic-grid textarea { width:100%; min-height:44px; padding:10px 12px; border:1px solid #d6dfd9; border-radius:10px; color:#26332b; background:#fff; font:inherit; font-size:.8rem; outline:0; }
.call-outcome-dynamic-grid textarea { min-height:72px; resize:vertical; }
.call-outcome-dynamic-grid select:focus,
.call-outcome-dynamic-grid input[type="date"]:focus,
.call-outcome-dynamic-grid textarea:focus { border-color:#5b8465; box-shadow:0 0 0 3px rgba(72,111,81,.11); }
.call-review-later { padding:14px; border:1px solid #d8e3dc; border-radius:12px; background:#f8fbf9; }
.call-review-later-heading { margin-bottom:10px; display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.call-review-later-heading > span { display:flex; flex-direction:column; gap:2px; }
.call-review-later-heading strong { color:#26352b; font-size:.78rem; }
.call-review-later-heading small { color:#78837b; font-size:.68rem; }
.call-review-later-heading em { padding:4px 8px; border-radius:999px; color:#355e3f; background:#e4eee7; font-size:.62rem; font-style:normal; font-weight:900; white-space:nowrap; }
.call-review-later-options { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; }
.call-review-later-options button { min-height:58px; padding:9px 10px; display:flex; flex-direction:column; align-items:flex-start; justify-content:center; gap:2px; border:1px solid #d5ded8; border-radius:10px; color:#26352b; background:#fff; font:inherit; text-align:left; cursor:pointer; }
.call-review-later-options button strong { font-size:.73rem; }
.call-review-later-options button small { color:#7a857d; font-size:.62rem; }
.call-review-later-options button.active { border-color:#557b60; background:#eaf2ec; box-shadow:inset 0 0 0 1px #86a48e; }
.call-review-date-field { margin-top:12px; padding-top:12px; display:grid !important; grid-template-columns:minmax(150px,220px) minmax(0,1fr); align-items:center; gap:6px 12px !important; border-top:1px solid #dce5df; }
.call-review-date-field > span { color:#35463b; font-size:.72rem; font-weight:900; }
.call-review-date-field input { grid-column:1; }
.call-review-date-field > small { grid-column:2; grid-row:1 / span 2; color:#6f7b73; font-size:.69rem; font-weight:600; line-height:1.45; }
.call-review-date-field > small strong { color:#31583b; }
.call-outcome-chip-options { display:flex; flex-wrap:wrap; gap:8px; }
.call-outcome-chip-options button { min-height:36px; padding:7px 12px; border:1px solid #d5ded8; border-radius:999px; color:#26352b; background:#fff; font:inherit; font-size:.72rem; font-weight:850; cursor:pointer; }
.call-outcome-chip-options button.active { border-color:#557b60; color:#2e5b39; background:#edf4ef; }
.call-outcome-chip-options button:disabled { opacity:.42; cursor:not-allowed; }
.call-outcome-confirm-row { min-height:70px; padding:14px; display:flex !important; flex-direction:row !important; align-items:center; gap:12px !important; border:1px solid #e5cbc5; border-radius:11px; color:#7b4136 !important; background:#f7eae7; }
.call-outcome-confirm-row input { width:22px; height:22px; flex:0 0 auto; accent-color:#426d4d; }
.call-outcome-rule-result { margin-top:18px; padding:14px 16px; display:grid; grid-template-columns:42px minmax(0,1fr) auto; align-items:center; gap:14px; border:1px solid #bfd2c4; border-radius:13px; background:#f1f7f3; }
.call-outcome-rule-result.warning { border-color:#e4c9c2; background:#f7ebe8; }
.call-outcome-rule-icon { width:42px; height:42px; display:inline-flex; align-items:center; justify-content:center; border-radius:10px; color:#fff; background:#4e7858; font-size:1.12rem; font-weight:900; }
.call-outcome-rule-result.warning .call-outcome-rule-icon { background:#a95f4e; }
.call-outcome-rule-result > div { display:flex; min-width:0; flex-direction:column; }
.call-outcome-rule-result strong { color:#18251c; font-size:.88rem; }
.call-outcome-rule-result small { margin-top:3px; color:#718078; font-size:.72rem; }
.call-outcome-rule-result em { padding:8px 11px; border:1px solid #ccd9d0; border-radius:9px; color:#2d5436; background:#fff; font-size:.69rem; font-style:normal; font-weight:900; white-space:nowrap; }

.call-retry-manager { display:grid; gap:12px; }
.call-retry-manager-layout { display:grid; grid-template-columns:minmax(0,1.75fr) minmax(310px,.75fr); align-items:start; gap:12px; }
.call-retry-rules-card { overflow:hidden; padding:0; }
.call-retry-card-head { padding:18px; display:flex; align-items:center; justify-content:space-between; gap:16px; border-bottom:1px solid #dfe6e1; }
.call-retry-card-head h3 { margin:4px 0 0; font-size:1.25rem; }
.call-retry-card-head p { margin:4px 0 0; color:#78837b; font-size:.72rem; }
.call-retry-preset { display:flex; flex-direction:column; gap:5px; color:#78837b; font-size:.68rem; font-weight:850; }
.call-retry-preset select { min-width:150px; padding:9px; border:1px solid #d6dfd9; border-radius:9px; background:#fff; font:inherit; font-size:.76rem; font-weight:750; }
.call-retry-rules-table { min-width:850px; }
.call-retry-rules-card { overflow-x:auto; }
.call-retry-rules-row { width:100%; min-height:56px; padding:9px 14px; display:grid; grid-template-columns:minmax(165px,1.35fr) repeat(4,minmax(105px,1fr)) 20px; align-items:center; gap:10px; border:0; border-bottom:1px solid #e5ebe7; color:#5f6b63; background:#fff; text-align:left; font:inherit; font-size:.71rem; cursor:pointer; }
.call-retry-rules-row:last-child { border-bottom:0; }
.call-retry-rules-row:hover { background:#f8faf9; }
.call-retry-rules-row.selected { background:#edf4ef; box-shadow:inset 4px 0 #426d4d; }
.call-retry-rules-header { min-height:38px; color:#7d8880; background:#f7f9f8; font-size:.61rem; font-weight:900; letter-spacing:.06em; cursor:default; }
.call-retry-rules-row > span:first-child { display:flex; align-items:center; gap:9px; color:#26332b; }
.call-retry-rules-row i { width:28px; height:28px; display:inline-flex; align-items:center; justify-content:center; border-radius:8px; color:#345e3e; background:#e7f0e9; font-style:normal; font-weight:900; }
.call-retry-rules-row i.amber { color:#8c641f; background:#fbf1dc; }
.call-retry-rules-row i.red { color:#984e3f; background:#f8e7e3; }
.call-retry-rules-row i.blue { color:#3b5f8c; background:#e9f0fa; }

.call-retry-editor-card { padding:18px; }
.call-retry-editor-head { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.call-retry-editor-head h3 { margin:4px 0 0; font-size:1.2rem; }
.call-retry-active-pill { padding:6px 9px; border-radius:999px; color:#355e3f; background:#eaf1ec; font-size:.68rem; font-weight:900; }
#callRetryRuleForm { margin-top:15px; display:grid; gap:11px; }
#callRetryRuleForm > label { display:flex; flex-direction:column; gap:5px; color:#526057; font-size:.7rem; font-weight:850; }
#callRetryRuleForm select { min-height:42px; padding:9px 10px; border:1px solid #d6dfd9; border-radius:9px; color:#28352d; background:#fff; font:inherit; font-size:.76rem; }
.call-retry-switch-row { padding:10px 0; flex-direction:row !important; align-items:center; justify-content:space-between; }
.call-retry-switch-row span { display:flex; flex-direction:column; }
.call-retry-switch-row small { margin-top:3px; color:#7a857d; font-size:.65rem; font-weight:500; }
.call-retry-switch-row input { width:40px; height:21px; accent-color:#426d4d; }
.call-retry-simulation { margin-top:16px; padding:13px; border-radius:11px; background:#f6f8f7; }
.call-retry-simulation h4 { margin:4px 0 9px; font-size:.86rem; }
.call-retry-simulation ol { margin:0; padding:0; display:grid; gap:6px; list-style:none; }
.call-retry-simulation li { display:grid; grid-template-columns:25px minmax(0,1fr) auto; align-items:center; gap:8px; color:#536159; font-size:.68rem; }
.call-retry-simulation li b { width:23px; height:23px; display:inline-flex; align-items:center; justify-content:center; border-radius:50%; color:#355e3f; background:#e4eee7; }
.call-retry-simulation li em { font-style:normal; color:#78837b; }
.call-retry-editor-actions { margin-top:15px; display:flex; justify-content:flex-end; gap:8px; }
.call-retry-editor-actions button:disabled { opacity:.55; cursor:not-allowed; }
.call-retry-guardrails { padding:16px 18px; display:grid; grid-template-columns:minmax(240px,1.15fr) repeat(3,minmax(190px,1fr)); align-items:center; gap:14px; }
.call-retry-guardrails h3 { margin:4px 0 0; font-size:1rem; }
.call-retry-guardrails label { display:flex; align-items:flex-start; gap:9px; }
.call-retry-guardrails input { width:18px; height:18px; flex:0 0 auto; accent-color:#426d4d; }
.call-retry-guardrails label span { display:flex; flex-direction:column; }
.call-retry-guardrails label b { font-size:.74rem; }
.call-retry-guardrails label small { margin-top:3px; color:#78837b; font-size:.65rem; }

@media (max-width:1450px) {
  .call-retry-manager-layout { grid-template-columns:1fr; }
  .call-retry-editor-card { display:grid; grid-template-columns:minmax(0,1fr) minmax(300px,.8fr); gap:16px; }
  .call-retry-editor-head, .call-retry-editor-actions { grid-column:1/-1; }
  .call-retry-simulation { margin-top:0; }
  .call-retry-guardrails { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .call-retry-guardrails > div { grid-column:1/-1; }
}
@media (max-width:900px) {
  #leadsView .call-management-banner { align-items:flex-start; flex-direction:column; }
  .call-management-mode-switch { width:100%; }
  .call-management-mode-switch button { flex:1; }
  .call-outcome-dynamic-grid { grid-template-columns:1fr; }
  .call-outcome-dynamic-grid > label.full, .call-outcome-dynamic-grid > .full { grid-column:auto; }
  .call-review-later-options { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .call-review-date-field { grid-template-columns:1fr; }
  .call-review-date-field input, .call-review-date-field > small { grid-column:1; grid-row:auto; }
  .call-outcome-rule-result { grid-template-columns:42px minmax(0,1fr); }
  .call-outcome-rule-result em { grid-column:2; justify-self:start; white-space:normal; }
  .call-retry-editor-card { display:block; }
  .call-retry-simulation { margin-top:16px; }
  .call-retry-guardrails { grid-template-columns:1fr; }
  .call-retry-guardrails > div { grid-column:auto; }
}

@media (max-height:850px) and (min-width:981px) {
  #leadsView .call-management-banner {
    min-height:0;
    margin-bottom:0;
    padding:8px 12px;
  }
  #leadsView .call-management-banner h2 { margin-top:2px; font-size:1.05rem; }
  #leadsView .call-management-banner p { display:none; }
  .call-management-mode-switch button { min-height:30px; padding:5px 10px; }
  #leadsView .goal-progress-panel { padding:0; }
  .call-session-progress { gap:10px; padding:7px 10px; }
  .call-session-metric-copy small { display:none; }
  .call-session-metric .goal-bar { margin-top:4px; }
}
